[hybrid] Enable logging for methods not found with gsharedvt enabled
[mono.git] / mono / mini / aot-runtime.c
index 14fcfbabc056fbde074805348a4d92c75fdb1133..86c6fbb5d0dd4399fc48b8f4c7f05b03aac69d15 100644 (file)
@@ -268,15 +268,15 @@ load_image (MonoAotModule *amodule, int index, MonoError *error)
 
        assembly = mono_assembly_load (&amodule->image_names [index], amodule->assembly->basedir, &status);
        if (!assembly) {
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable because dependency %s is not found.\n", amodule->aot_name, amodule->image_names [index].name);
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable because dependency %s is not found.", amodule->aot_name, amodule->image_names [index].name);
                mono_error_set_bad_image_name (error, amodule->aot_name, "module is unusable because dependency %s is not found (error %d).\n", amodule->image_names [index].name, status);
                amodule->out_of_date = TRUE;
                return NULL;
        }
 
        if (strcmp (assembly->image->guid, amodule->image_guids [index])) {
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable (GUID of dependent assembly %s doesn't match (expected '%s', got '%s').\n", amodule->aot_name, amodule->image_names [index].name, amodule->image_guids [index], assembly->image->guid);
-               mono_error_set_bad_image_name (error, amodule->aot_name, "module is unusable (GUID of dependent assembly %s doesn't match (expected '%s', got '%s').\n", amodule->image_names [index].name, amodule->image_guids [index], assembly->image->guid);
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable (GUID of dependent assembly %s doesn't match (expected '%s', got '%s').", amodule->aot_name, amodule->image_names [index].name, amodule->image_guids [index], assembly->image->guid);
+               mono_error_set_bad_image_name (error, amodule->aot_name, "module is unusable (GUID of dependent assembly %s doesn't match (expected '%s', got '%s').", amodule->image_names [index].name, amodule->image_guids [index], assembly->image->guid);
                amodule->out_of_date = TRUE;
                return NULL;
        }
@@ -473,7 +473,7 @@ decode_klass_ref (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError
                gclass = decode_klass_ref (module, p, &p, error);
                if (!gclass)
                        return NULL;
-               g_assert (gclass->generic_container);
+               g_assert (mono_class_is_gtd (gclass));
 
                memset (&ctx, 0, sizeof (ctx));
                ctx.class_inst = decode_generic_inst (module, p, &p, error);
@@ -528,7 +528,7 @@ decode_klass_ref (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError
                                        if (!class_def)
                                                return NULL;
 
-                                       container = class_def->generic_container;
+                                       container = mono_class_try_get_generic_container (class_def); //FIXME is this a case for a try_get?
                                }
                        } else {
                                // We didn't decode is_method, so we have to infer it from type enum.
@@ -684,7 +684,7 @@ decode_type (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError *err
                gclass = decode_klass_ref (module, p, &p, error);
                if (!gclass)
                        goto fail;
-               g_assert (gclass->generic_container);
+               g_assert (mono_class_is_gtd (gclass));
 
                memset (&ctx, 0, sizeof (ctx));
                ctx.class_inst = decode_generic_inst (module, p, &p, error);
@@ -694,7 +694,7 @@ decode_type (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError *err
                if (!type)
                        goto fail;
                klass = mono_class_from_mono_type (type);
-               t->data.generic_class = klass->generic_class;
+               t->data.generic_class = mono_class_get_generic_class (klass);
                break;
        }
        case MONO_TYPE_ARRAY: {
@@ -903,8 +903,7 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                }
                case MONO_WRAPPER_LDFLD:
                case MONO_WRAPPER_LDFLDA:
-               case MONO_WRAPPER_STFLD:
-               case MONO_WRAPPER_ISINST: {
+               case MONO_WRAPPER_STFLD: {
                        MonoClass *klass = decode_klass_ref (module, p, &p, error);
                        if (!klass)
                                return FALSE;
@@ -914,17 +913,12 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                                ref->method = mono_marshal_get_ldflda_wrapper (&klass->byval_arg);
                        else if (wrapper_type == MONO_WRAPPER_STFLD)
                                ref->method = mono_marshal_get_stfld_wrapper (&klass->byval_arg);
-                       else if (wrapper_type == MONO_WRAPPER_ISINST)
-                               ref->method = mono_marshal_get_isinst (klass);
                        else {
                                mono_error_set_bad_image_name (error, module->aot_name, "Unknown AOT wrapper type %d", wrapper_type);
                                return FALSE;
                        }
                        break;
                }
-               case MONO_WRAPPER_STFLD_REMOTE:
-                       ref->method = mono_marshal_get_stfld_remote_wrapper (NULL);
-                       break;
 #endif
                case MONO_WRAPPER_ALLOC: {
                        int atype = decode_value (p, &p);
@@ -933,6 +927,9 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                                MANAGED_ALLOCATOR_SLOW_PATH : MANAGED_ALLOCATOR_REGULAR;
 
                        ref->method = mono_gc_get_managed_allocator_by_type (atype, variant);
+                       /* Try to fallback to the slow path version */
+                       if (!ref->method && variant == MANAGED_ALLOCATOR_REGULAR)
+                               ref->method = mono_gc_get_managed_allocator_by_type (atype, MANAGED_ALLOCATOR_SLOW_PATH);
                        if (!ref->method) {
                                mono_error_set_bad_image_name (error, module->aot_name, "Error: No managed allocator, but we need one for AOT.\nAre you using non-standard GC options?\n");
                                return FALSE;
@@ -1259,8 +1256,8 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
 
                memset (&ctx, 0, sizeof (ctx));
 
-               if (FALSE && klass->generic_class) {
-                       ctx.class_inst = klass->generic_class->context.class_inst;
+               if (FALSE && mono_class_is_ginst (klass)) {
+                       ctx.class_inst = mono_class_get_generic_class (klass)->context.class_inst;
                        ctx.method_inst = NULL;
  
                        ref->method = mono_class_inflate_generic_method_full_checked (ref->method, klass, &ctx, error);
@@ -1921,7 +1918,7 @@ init_amodule_got (MonoAotModule *amodule)
 static void
 load_aot_module (MonoAssembly *assembly, gpointer user_data)
 {
-       char *aot_name;
+       char *aot_name, *found_aot_name;
        MonoAotModule *amodule;
        MonoDl *sofile;
        gboolean usable = TRUE;
@@ -1956,43 +1953,70 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
 
        sofile = NULL;
 
+       found_aot_name = NULL;
+
        if (info) {
                /* Statically linked AOT module */
                aot_name = g_strdup_printf ("%s", assembly->aname.name);
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "Found statically linked AOT module '%s'.\n", aot_name);
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "Found statically linked AOT module '%s'.", aot_name);
                if (!(info->flags & MONO_AOT_FILE_FLAG_LLVM_ONLY)) {
                        globals = (void **)info->globals;
                        g_assert (globals);
                }
        } else {
+               char *err;
+
                if (enable_aot_cache)
                        sofile = aot_cache_load_module (assembly, &aot_name);
                if (!sofile) {
-                       char *err;
                        aot_name = g_strdup_printf ("%s%s", assembly->image->name, MONO_SOLIB_EXT);
 
                        sofile = mono_dl_open (aot_name, MONO_DL_LAZY, &err);
-
+                       if (sofile) {
+                               found_aot_name = g_strdup (aot_name);
+                       } else {
+                               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: image '%s' not found: %s", aot_name, err);
+                               g_free (err);
+                       }
+                       g_free (aot_name);
+               }
+               if (!sofile) {
+                       char *basename = g_path_get_basename (assembly->image->name);
+                       aot_name = g_strdup_printf ("%s/mono/aot-cache/%s/%s%s", mono_assembly_getrootdir(), MONO_ARCHITECTURE, basename, MONO_SOLIB_EXT);
+                       g_free (basename);
+                       sofile = mono_dl_open (aot_name, MONO_DL_LAZY, &err);
                        if (!sofile) {
-                               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT module '%s' not found: %s\n", aot_name, err);
+                               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: image '%s' not found: %s", aot_name, err);
                                g_free (err);
+                       }
+               }
+               if (!sofile) {
+                       GList *l;
+
+                       for (l = mono_aot_paths; l; l = l->next) {
+                               char *path = l->data;
 
-                               g_free (aot_name);
                                char *basename = g_path_get_basename (assembly->image->name);
-                               aot_name = g_strdup_printf ("%s/mono/aot-cache/%s/%s%s", mono_assembly_getrootdir(), MONO_ARCHITECTURE, basename, MONO_SOLIB_EXT);
-                               g_free (basename);
+                               aot_name = g_strdup_printf ("%s/%s%s", path, basename, MONO_SOLIB_EXT);
                                sofile = mono_dl_open (aot_name, MONO_DL_LAZY, &err);
-                               if (!sofile) {
-                                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT module '%s' not found: %s\n", aot_name, err);
+                               if (sofile) {
+                                       found_aot_name = g_strdup (aot_name);
+                               } else {
+                                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: image '%s' not found: %s", aot_name, err);
                                        g_free (err);
                                }
-
+                               g_free (basename);
+                               g_free (aot_name);
+                               if (sofile)
+                                       break;
                        }
                }
                if (!sofile) {
-                       if (mono_aot_only && assembly->image->tables [MONO_TABLE_METHOD].rows)
+                       if (mono_aot_only && assembly->image->tables [MONO_TABLE_METHOD].rows) {
+                               aot_name = g_strdup_printf ("%s%s", assembly->image->name, MONO_SOLIB_EXT);
                                g_error ("Failed to load AOT module '%s' in aot-only mode.\n", aot_name);
-                       g_free (aot_name);
+                               g_free (aot_name);
+                       }
                        return;
                }
        }
@@ -2033,12 +2057,12 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
 
        if (!usable) {
                if (mono_aot_only) {
-                       g_error ("Failed to load AOT module '%s' while running in aot-only mode: %s.\n", aot_name, msg);
+                       g_error ("Failed to load AOT module '%s' while running in aot-only mode: %s.\n", found_aot_name, msg);
                } else {
-                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable: %s.\n", aot_name, msg);
+                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable: %s.", found_aot_name, msg);
                }
                g_free (msg);
-               g_free (aot_name);
+               g_free (found_aot_name);
                if (sofile)
                        mono_dl_close (sofile);
                assembly->image->aot_module = NULL;
@@ -2053,7 +2077,7 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        g_assert (info->generic_tramp_num == MONO_TRAMPOLINE_NUM);
 
        amodule = g_new0 (MonoAotModule, 1);
-       amodule->aot_name = aot_name;
+       amodule->aot_name = found_aot_name;
        amodule->assembly = assembly;
 
        memcpy (&amodule->info, info, sizeof (*info));
@@ -2151,7 +2175,7 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        amodule->mono_eh_frame = (guint8 *)info->mono_eh_frame;
        amodule->trampolines [MONO_AOT_TRAMP_SPECIFIC] = (guint8 *)info->specific_trampolines;
        amodule->trampolines [MONO_AOT_TRAMP_STATIC_RGCTX] = (guint8 *)info->static_rgctx_trampolines;
-       amodule->trampolines [MONO_AOT_TRAMP_IMT_THUNK] = (guint8 *)info->imt_thunks;
+       amodule->trampolines [MONO_AOT_TRAMP_IMT] = (guint8 *)info->imt_trampolines;
        amodule->trampolines [MONO_AOT_TRAMP_GSHAREDVT_ARG] = (guint8 *)info->gsharedvt_arg_trampolines;
 
        if (!strcmp (assembly->aname.name, "mscorlib"))
@@ -2273,12 +2297,12 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        }
 
        if (amodule->out_of_date) {
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: Module %s is unusable because a dependency is out-of-date.\n", assembly->image->name);
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: Module %s is unusable because a dependency is out-of-date.", assembly->image->name);
                if (mono_aot_only)
-                       g_error ("Failed to load AOT module '%s' while running in aot-only mode because a dependency cannot be found or it is out of date.\n", aot_name);
+                       g_error ("Failed to load AOT module '%s' while running in aot-only mode because a dependency cannot be found or it is out of date.\n", found_aot_name);
+       } else {
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: image '%s' found.", found_aot_name);
        }
-       else
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: loaded AOT Module for %s.\n", assembly->image->name);
 }
 
 /*
@@ -2444,7 +2468,7 @@ mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res)
        guint8 *p;
        gboolean err;
 
-       if (klass->rank || !amodule)
+       if (klass->rank || !klass->type_token || !amodule)
                return FALSE;
 
        p = (guint8*)&amodule->blob [mono_aot_get_offset (amodule->class_info_offsets, mono_metadata_token_index (klass->type_token) - 1)];
@@ -3591,7 +3615,6 @@ decode_patch (MonoAotModule *aot_module, MonoMemPool *mp, MonoJumpInfo *ji, guin
        case MONO_PATCH_INFO_GC_CARD_TABLE_ADDR:
        case MONO_PATCH_INFO_GC_NURSERY_START:
        case MONO_PATCH_INFO_GC_NURSERY_BITS:
-       case MONO_PATCH_INFO_JIT_TLS_ID:
                break;
        case MONO_PATCH_INFO_CASTCLASS_CACHE:
                ji->data.index = decode_value (p, &p);
@@ -3629,9 +3652,6 @@ decode_patch (MonoAotModule *aot_module, MonoMemPool *mp, MonoJumpInfo *ji, guin
        case MONO_PATCH_INFO_GSHAREDVT_IN_WRAPPER:
                ji->data.target = decode_signature (aot_module, p, &p);
                break;
-       case MONO_PATCH_INFO_TLS_OFFSET:
-               ji->data.target = GINT_TO_POINTER (decode_value (p, &p));
-               break;
        case MONO_PATCH_INFO_GSHAREDVT_CALL: {
                MonoJumpInfoGSharedVtCall *info = (MonoJumpInfoGSharedVtCall *)mono_mempool_alloc0 (mp, sizeof (MonoJumpInfoGSharedVtCall));
                info->sig = decode_signature (aot_module, p, &p);
@@ -3702,7 +3722,10 @@ decode_patch (MonoAotModule *aot_module, MonoMemPool *mp, MonoJumpInfo *ji, guin
                break;
        }
        case MONO_PATCH_INFO_GC_SAFE_POINT_FLAG:
+       case MONO_PATCH_INFO_JIT_THREAD_ATTACH:
                break;
+       case MONO_PATCH_INFO_GET_TLS_TRAMP:
+       case MONO_PATCH_INFO_SET_TLS_TRAMP:
        case MONO_PATCH_INFO_AOT_JIT_INFO:
                ji->data.index = decode_value (p, &p);
                break;
@@ -3908,7 +3931,8 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
                }
        }
 
-       if (!(is_llvm_code (amodule, code) && (amodule->info.flags & MONO_AOT_FILE_FLAG_LLVM_ONLY))) {
+       if (!(is_llvm_code (amodule, code) && (amodule->info.flags & MONO_AOT_FILE_FLAG_LLVM_ONLY)) ||
+               (mono_llvm_only && method && method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED)) {
                res = init_method (amodule, method_index, method, NULL, NULL, error);
                if (!res)
                        goto cleanup;
@@ -4024,32 +4048,6 @@ find_aot_method_in_amodule (MonoAotModule *amodule, MonoMethod *method, guint32
                        break;
                }
 
-               /*
-                * Special case: wrappers of shared generic methods.
-                * This is needed because of the way mini_get_shared_method () works,
-                * we could end up with multiple copies of the same wrapper.
-                */
-               if (m && method->wrapper_type && method->wrapper_type == m->wrapper_type &&
-                       method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) {
-                       MonoMethod *w1 = mono_marshal_method_from_wrapper (method);
-                       MonoMethod *w2 = mono_marshal_method_from_wrapper (m);
-
-                       if ((w1 == w2) || (w1->is_inflated && ((MonoMethodInflated *)w1)->declaring == w2)) {
-                               index = value;
-                               break;
-                       }
-               }
-               if (m && method->wrapper_type && method->wrapper_type == m->wrapper_type &&
-                       method->wrapper_type == MONO_WRAPPER_DELEGATE_INVOKE) {
-                       WrapperInfo *info1 = mono_marshal_get_wrapper_info (method);
-                       WrapperInfo *info2 = mono_marshal_get_wrapper_info (m);
-
-                       if (info1 && info2 && info1->subtype == info2->subtype && method->klass == m->klass) {
-                               index = value;
-                               break;
-                       }
-               }
-
                /* Methods decoded needlessly */
                if (m) {
                        //printf ("%d %s %s %p\n", n_extra_decodes, mono_method_full_name (method, TRUE), mono_method_full_name (m, TRUE), orig_p);
@@ -4237,7 +4235,7 @@ init_method (MonoAotModule *amodule, guint32 method_index, MonoMethod *method, M
        gboolean inited_ok = TRUE;
        if (init_class)
                inited_ok = mono_runtime_class_init_full (mono_class_vtable (domain, init_class), error);
-       else if (from_plt && klass_to_run_ctor && !klass_to_run_ctor->generic_container)
+       else if (from_plt && klass_to_run_ctor && !mono_class_is_gtd (klass_to_run_ctor))
                inited_ok = mono_runtime_class_init_full (mono_class_vtable (domain, klass_to_run_ctor), error);
        if (!inited_ok)
                return FALSE;
@@ -4304,10 +4302,10 @@ mono_aot_init_gshared_method_mrgctx (gpointer aot_module, guint32 method_index,
        MonoGenericContext context = { NULL, NULL };
        MonoClass *klass = rgctx->class_vtable->klass;
 
-       if (klass->generic_class)
-               context.class_inst = klass->generic_class->context.class_inst;
-       else if (klass->generic_container)
-               context.class_inst = klass->generic_container->context.class_inst;
+       if (mono_class_is_ginst (klass))
+               context.class_inst = mono_class_get_generic_class (klass)->context.class_inst;
+       else if (mono_class_is_gtd (klass))
+               context.class_inst = mono_class_get_generic_container (klass)->context.class_inst;
        context.method_inst = rgctx->method_inst;
 
        init_llvmonly_method (amodule, method_index, NULL, rgctx->class_vtable->klass, &context);
@@ -4556,7 +4554,7 @@ mono_aot_get_method_checked (MonoDomain *domain, MonoMethod *method, MonoError *
                }
 
                if (method_index == 0xffffff) {
-                       if (mono_aot_only && mono_trace_is_traced (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT)) {
+                       if (mono_trace_is_traced (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT)) {
                                char *full_name;
 
                                full_name = mono_method_full_name (method, TRUE);
@@ -5185,7 +5183,7 @@ read_page_trampoline_uwinfo (MonoTrampInfo *info, int tramp_type, gboolean is_ge
                sprintf (symbol_name, "specific_trampolines_page_%s_p", is_generic ? "gen" : "sp");
        else if (tramp_type == MONO_AOT_TRAMP_STATIC_RGCTX)
                sprintf (symbol_name, "rgctx_trampolines_page_%s_p", is_generic ? "gen" : "sp");
-       else if (tramp_type == MONO_AOT_TRAMP_IMT_THUNK)
+       else if (tramp_type == MONO_AOT_TRAMP_IMT)
                sprintf (symbol_name, "imt_trampolines_page_%s_p", is_generic ? "gen" : "sp");
        else if (tramp_type == MONO_AOT_TRAMP_GSHAREDVT_ARG)
                sprintf (symbol_name, "gsharedvt_trampolines_page_%s_p", is_generic ? "gen" : "sp");
@@ -5233,7 +5231,7 @@ get_new_trampoline_from_page (int tramp_type)
                tpage = load_function (amodule, "specific_trampolines_page");
        else if (tramp_type == MONO_AOT_TRAMP_STATIC_RGCTX)
                tpage = load_function (amodule, "rgctx_trampolines_page");
-       else if (tramp_type == MONO_AOT_TRAMP_IMT_THUNK)
+       else if (tramp_type == MONO_AOT_TRAMP_IMT)
                tpage = load_function (amodule, "imt_trampolines_page");
        else if (tramp_type == MONO_AOT_TRAMP_GSHAREDVT_ARG)
                tpage = load_function (amodule, "gsharedvt_arg_trampolines_page");
@@ -5361,7 +5359,7 @@ get_new_imt_trampoline_from_page (gpointer arg)
        void *code;
        gpointer *data;
 
-       code = get_new_trampoline_from_page (MONO_AOT_TRAMP_IMT_THUNK);
+       code = get_new_trampoline_from_page (MONO_AOT_TRAMP_IMT);
 
        data = (gpointer*)((char*)code - MONO_AOT_TRAMP_PAGE_SIZE);
        data [0] = arg;
@@ -5614,13 +5612,13 @@ mono_aot_get_lazy_fetch_trampoline (guint32 slot)
 }
 
 static void
-no_imt_thunk (void)
+no_imt_trampoline (void)
 {
-       g_assert_not_reached ();
+       g_assert_not_reached ();
 }
 
 gpointer
-mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
+mono_aot_get_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
 {
        guint32 got_offset;
        gpointer code;
@@ -5629,7 +5627,7 @@ mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem
        MonoAotModule *amodule;
 
        if (mono_llvm_only)
-               return no_imt_thunk;
+               return no_imt_trampoline;
 
        real_count = 0;
        for (i = 0; i < count; ++i) {
@@ -5666,7 +5664,7 @@ mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem
        if (USE_PAGE_TRAMPOLINES) {
                code = get_new_imt_trampoline_from_page (buf);
        } else {
-               code = get_numerous_trampoline (MONO_AOT_TRAMP_IMT_THUNK, 1, &amodule, &got_offset, NULL);
+               code = get_numerous_trampoline (MONO_AOT_TRAMP_IMT, 1, &amodule, &got_offset, NULL);
 
                amodule->got [got_offset] = buf;
        }
@@ -5947,7 +5945,7 @@ mono_aot_get_lazy_fetch_trampoline (guint32 slot)
 }
 
 gpointer
-mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
+mono_aot_get_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp)
 {
        g_assert_not_reached ();
        return NULL;