for (method_slot_in_interface = 0; method_slot_in_interface < iface->method.count; method_slot_in_interface++) {
MonoMethod *method;
- if (slot_num >= 0 && iface->is_inflated) {
+ if (slot_num >= 0 && mono_class_is_ginst (iface)) {
/*
* The imt slot of the method is the same as for its declaring method,
* see the comment in mono_method_get_imt_slot (), so we can
static gboolean inited = FALSE;
static int num_added = 0;
+ static int num_freed = 0;
GenericVirtualCase *gvc, *list;
MonoImtBuilderEntry *entries;
if (!domain->generic_virtual_cases)
domain->generic_virtual_cases = g_hash_table_new (mono_aligned_addr_hash, NULL);
+ if (!inited) {
+ mono_counters_register ("Generic virtual cases", MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &num_added);
+ mono_counters_register ("Freed IMT trampolines", MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &num_freed);
+ inited = TRUE;
+ }
+
/* Check whether the case was already added */
list = (GenericVirtualCase *)g_hash_table_lookup (domain->generic_virtual_cases, vtable_slot);
gvc = list;
g_hash_table_insert (domain->generic_virtual_cases, vtable_slot, gvc);
- if (!inited) {
- mono_counters_register ("Generic virtual cases", MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &num_added);
- inited = TRUE;
- }
num_added++;
}
if (++gvc->count == THUNK_THRESHOLD) {
+ gpointer *old_thunk = (void **)*vtable_slot;
gpointer vtable_trampoline = NULL;
gpointer imt_trampoline = NULL;
for (i = 0; i < sorted->len; ++i)
g_free (g_ptr_array_index (sorted, i));
g_ptr_array_free (sorted, TRUE);
+
+ if (old_thunk != vtable_trampoline && old_thunk != imt_trampoline)
+ num_freed ++;
}
}
if (mono_class_has_failure (element_class)) {
/*Can happen if element_class only got bad after mono_class_setup_vtable*/
if (!mono_class_has_failure (klass))
- mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
+ mono_class_set_type_load_failure (klass, "");
mono_domain_unlock (domain);
mono_loader_unlock ();
mono_error_set_for_class_failure (error, klass);
MonoClass *param_class = klass->cast_class;
- mono_class_setup_fields_locking (klass);
+ mono_class_setup_fields (klass);
g_assert (klass->fields_inited);
g_assert (mono_class_from_mono_type (klass->fields [0].type) == param_class);
mono_error_init (error);
MonoClass *param_class = klass->cast_class;
- mono_class_setup_fields_locking (klass);
+ mono_class_setup_fields (klass);
g_assert (klass->fields_inited);
g_assert (mono_class_from_mono_type (klass->fields [0].type) == param_class);
*pass_size_in_words = FALSE;
- if (mono_class_has_finalizer (vtable->klass) || mono_class_is_marshalbyref (vtable->klass) || (mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS))
+ if (mono_class_has_finalizer (vtable->klass) || mono_class_is_marshalbyref (vtable->klass))
return ves_icall_object_new_specific;
if (vtable->gc_descr != MONO_GC_DESCRIPTOR_NULL) {
o = (MonoObject *)mono_gc_alloc_vector (vtable, byte_len, len);
if (G_UNLIKELY (!o)) {
- mono_error_set_out_of_memory (error, "Could not allocate %i bytes", byte_len);
+ mono_error_set_out_of_memory (error, "Could not allocate %zd bytes", (gsize) byte_len);
return NULL;
}
o = (MonoObject *)mono_gc_alloc_vector (vtable, byte_len, n);
if (G_UNLIKELY (!o)) {
- mono_error_set_out_of_memory (error, "Could not allocate %i bytes", byte_len);
+ mono_error_set_out_of_memory (error, "Could not allocate %zd bytes", (gsize) byte_len);
return NULL;
}
s = (MonoString *)mono_gc_alloc_string (vtable, size, len);
if (G_UNLIKELY (!s)) {
- mono_error_set_out_of_memory (error, "Could not allocate %i bytes", size);
+ mono_error_set_out_of_memory (error, "Could not allocate %zd bytes", size);
return NULL;
}