static MonoTrampoline arch_create_jit_trampoline = default_trampoline;
static MonoJumpTrampoline arch_create_jump_trampoline = default_jump_trampoline;
static MonoDelegateTrampoline arch_create_delegate_trampoline = default_delegate_trampoline;
-static MonoImtThunkBuilder imt_thunk_builder = NULL;
-#define ARCH_USE_IMT (imt_thunk_builder != NULL)
+static MonoImtThunkBuilder imt_thunk_builder;
#if (MONO_IMT_SIZE > 32)
#error "MONO_IMT_SIZE cannot be larger than 32"
#endif
if (class_size)
vtable_slots++;
- if (ARCH_USE_IMT) {
- if (class->interface_offsets_count) {
- imt_table_bytes = sizeof (gpointer) * (MONO_IMT_SIZE);
- mono_stats.imt_number_of_tables++;
- mono_stats.imt_tables_size += imt_table_bytes;
- } else {
- imt_table_bytes = 0;
- }
+ if (class->interface_offsets_count) {
+ imt_table_bytes = sizeof (gpointer) * (MONO_IMT_SIZE);
+ mono_stats.imt_number_of_tables++;
+ mono_stats.imt_tables_size += imt_table_bytes;
} else {
- imt_table_bytes = sizeof (gpointer) * (class->max_interface_id + 1);
+ imt_table_bytes = 0;
}
vtable_size = imt_table_bytes + MONO_SIZEOF_VTABLE + vtable_slots * sizeof (gpointer);
//printf ("Initializing VT for class %s (interface_offsets_count = %d)\n",
// class->name, class->interface_offsets_count);
- if (! ARCH_USE_IMT) {
- /* initialize interface offsets */
- for (i = 0; i < class->interface_offsets_count; ++i) {
- int interface_id = class->interfaces_packed [i]->interface_id;
- int slot = class->interface_offsets_packed [i];
- interface_offsets [class->max_interface_id - interface_id] = &(vt->vtable [slot]);
- }
+ /* initialize interface offsets */
+ for (i = 0; i < class->interface_offsets_count; ++i) {
+ int interface_id = class->interfaces_packed [i]->interface_id;
+ int slot = class->interface_offsets_packed [i];
+ interface_offsets [class->max_interface_id - interface_id] = &(vt->vtable [slot]);
}
/* Initialize vtable */
}
}
- if (ARCH_USE_IMT && imt_table_bytes) {
+ if (imt_table_bytes) {
/* Now that the vtable is full, we can actually fill up the IMT */
if (callbacks.get_imt_trampoline) {
/* lazy construction of the IMT entries enabled */
if (iclass->max_interface_id > max_interface_id) max_interface_id = iclass->max_interface_id;
}
- if (ARCH_USE_IMT) {
- imt_table_bytes = sizeof (gpointer) * MONO_IMT_SIZE;
- mono_stats.imt_number_of_tables++;
- mono_stats.imt_tables_size += imt_table_bytes;
- } else {
- imt_table_bytes = sizeof (gpointer) * (max_interface_id + 1);
- }
+ imt_table_bytes = sizeof (gpointer) * MONO_IMT_SIZE;
+ mono_stats.imt_number_of_tables++;
+ mono_stats.imt_tables_size += imt_table_bytes;
vtsize = imt_table_bytes + MONO_SIZEOF_VTABLE + class->vtable_size * sizeof (gpointer);
bitmap = mono_domain_alloc0 (domain, bsize);
#endif
- if (! ARCH_USE_IMT) {
- /* initialize interface offsets */
- for (i = 0; i < class->interface_offsets_count; ++i) {
- int interface_id = class->interfaces_packed [i]->interface_id;
- int slot = class->interface_offsets_packed [i];
- interface_offsets [class->max_interface_id - interface_id] = &(pvt->vtable [slot]);
- }
- }
for (i = 0; i < class->interface_offsets_count; ++i) {
int interface_id = class->interfaces_packed [i]->interface_id;
bitmap [interface_id >> 3] |= (1 << (interface_id & 7));
for (list_item = extra_interfaces; list_item != NULL; list_item=list_item->next) {
interf = list_item->data;
- if (! ARCH_USE_IMT) {
- interface_offsets [max_interface_id - interf->interface_id] = &pvt->vtable [slot];
- }
bitmap [interf->interface_id >> 3] |= (1 << (interf->interface_id & 7));
iter = NULL;
slot += mono_class_num_methods (interf);
}
- if (! ARCH_USE_IMT) {
- g_slist_free (extra_interfaces);
- }
}
- if (ARCH_USE_IMT) {
- /* Now that the vtable is full, we can actually fill up the IMT */
- build_imt (class, pvt, domain, interface_offsets, extra_interfaces);
- if (extra_interfaces) {
- g_slist_free (extra_interfaces);
- }
+ /* Now that the vtable is full, we can actually fill up the IMT */
+ build_imt (class, pvt, domain, interface_offsets, extra_interfaces);
+ if (extra_interfaces) {
+ g_slist_free (extra_interfaces);
}
#ifdef COMPRESSED_INTERFACE_BITMAP
vtable_reg = alloc_preg (cfg);
MONO_EMIT_NEW_LOAD_MEMBASE_FAULT (cfg, vtable_reg, this_reg, MONO_STRUCT_OFFSET (MonoObject, vtable));
if (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
- slot_reg = -1;
- if (mono_use_imt) {
- guint32 imt_slot = mono_method_get_imt_slot (method);
- emit_imt_argument (cfg, call, call->method, imt_arg);
- slot_reg = vtable_reg;
- offset = ((gint32)imt_slot - MONO_IMT_SIZE) * SIZEOF_VOID_P;
- }
- if (slot_reg == -1) {
- slot_reg = alloc_preg (cfg);
- mini_emit_load_intf_reg_vtable (cfg, slot_reg, vtable_reg, method->klass);
- offset = mono_method_get_vtable_index (method) * SIZEOF_VOID_P;
- }
+ guint32 imt_slot = mono_method_get_imt_slot (method);
+ emit_imt_argument (cfg, call, call->method, imt_arg);
+ slot_reg = vtable_reg;
+ offset = ((gint32)imt_slot - MONO_IMT_SIZE) * SIZEOF_VOID_P;
} else {
slot_reg = vtable_reg;
offset = MONO_STRUCT_OFFSET (MonoVTable, vtable) +
GSHAREDVT_FAILURE (*ip);
#if MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK && defined(MONO_ARCH_GSHARED_SUPPORTED)
- if (cmethod->wrapper_type == MONO_WRAPPER_NONE && mono_use_imt)
+ if (cmethod->wrapper_type == MONO_WRAPPER_NONE)
use_imt = TRUE;
#endif
GSHAREDVT_FAILURE (*ip);
if (fsig->generic_param_count) {
/* virtual generic call */
- g_assert (mono_use_imt);
g_assert (!imt_arg);
/* Same as the virtual generic case above */
imt_arg = emit_get_rgctx_method (cfg, context_used,
gboolean mono_compile_aot = FALSE;
/* If this is set, no code is generated dynamically, everything is taken from AOT files */
gboolean mono_aot_only = FALSE;
-/* Whenever to use IMT */
-gboolean mono_use_imt = TRUE;
+
const char *mono_build_date;
gboolean mono_do_signal_chaining;
gboolean mono_do_crash_chaining;
callbacks.debug_log_is_enabled = mono_debugger_agent_debug_log_is_enabled;
callbacks.tls_key_supported = mini_tls_key_supported;
- if (mono_use_imt) {
- callbacks.get_vtable_trampoline = mini_get_vtable_trampoline;
- callbacks.get_imt_trampoline = mini_get_imt_trampoline;
- }
+ callbacks.get_vtable_trampoline = mini_get_vtable_trampoline;
+ callbacks.get_imt_trampoline = mini_get_imt_trampoline;
mono_install_callbacks (&callbacks);
mono_marshal_use_aot_wrappers (TRUE);
}
- if (mono_use_imt) {
- if (mono_aot_only)
- mono_install_imt_thunk_builder (mono_aot_get_imt_thunk);
- else
- mono_install_imt_thunk_builder (mono_arch_build_imt_thunk);
- }
+ if (mono_aot_only)
+ mono_install_imt_thunk_builder (mono_aot_get_imt_thunk);
+ else
+ mono_install_imt_thunk_builder (mono_arch_build_imt_thunk);
/*Init arch tls information only after the metadata side is inited to make sure we see dynamic appdomain tls keys*/
mono_arch_finish_init ();