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;
}
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);
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.
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);
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: {
}
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;
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);
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;
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);
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;
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;
}
}
if (mono_aot_only) {
g_error ("Failed to load AOT module '%s' while running in aot-only mode: %s.\n", 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.", aot_name, msg);
}
g_free (msg);
g_free (aot_name);
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"))
}
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);
+ g_free (found_aot_name);
}
/*
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)];
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);
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);
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;
}
}
- 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;
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);
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;
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);
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");
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");
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;
}
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;
MonoAotModule *amodule;
if (mono_llvm_only)
- return no_imt_thunk;
+ return no_imt_trampoline;
real_count = 0;
for (i = 0; i < count; ++i) {
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;
}
}
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;