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;
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);
}
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;
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);