X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Faot-compiler.c;h=5bfa4d0920387d4bcbaf388a254e24f328622407;hb=caa9ed689f20ab27f43ed988848fca7f7834b6b0;hp=e4b2378a3e822f033baf8474b29064bef69e441f;hpb=ff285585d451b696333ecb22a729b38acb633bdf;p=mono.git diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c index e4b2378a3e8..5bfa4d09203 100644 --- a/mono/mini/aot-compiler.c +++ b/mono/mini/aot-compiler.c @@ -421,7 +421,7 @@ aot_printerrf (MonoAotCompile *acfg, const gchar *format, ...) } static void -report_loader_error (MonoAotCompile *acfg, MonoError *error, const char *format, ...) +report_loader_error (MonoAotCompile *acfg, MonoError *error, gboolean fatal, const char *format, ...) { FILE *output; va_list args; @@ -439,7 +439,7 @@ report_loader_error (MonoAotCompile *acfg, MonoError *error, const char *format, va_end (args); mono_error_cleanup (error); - if (acfg->is_full_aot) { + if (acfg->is_full_aot && fatal) { fprintf (output, "FullAOT cannot continue if there are loader errors.\n"); exit (1); } @@ -2897,7 +2897,7 @@ encode_klass_ref_inner (MonoAotCompile *acfg, MonoClass *klass, guint8 *buf, gui if (par->gshared_constraint) { MonoGSharedGenericParam *gpar = (MonoGSharedGenericParam*)par; encode_type (acfg, par->gshared_constraint, p, &p); - encode_klass_ref (acfg, mono_class_from_generic_parameter (gpar->parent, NULL, klass->byval_arg.type == MONO_TYPE_MVAR), p, &p); + encode_klass_ref (acfg, mono_class_from_generic_parameter_internal (gpar->parent), p, &p); } else { encode_value (klass->byval_arg.type, p, &p); encode_value (mono_type_get_generic_param_num (&klass->byval_arg), p, &p); @@ -3832,7 +3832,7 @@ add_wrappers (MonoAotCompile *acfg) gboolean skip = FALSE; method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error); - report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); + report_loader_error (acfg, &error, TRUE, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) || (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) || @@ -3978,6 +3978,8 @@ add_wrappers (MonoAotCompile *acfg) add_method (acfg, m); if ((m = mono_gc_get_managed_allocator_by_type (i, MANAGED_ALLOCATOR_SLOW_PATH))) add_method (acfg, m); + if ((m = mono_gc_get_managed_allocator_by_type (i, MANAGED_ALLOCATOR_PROFILER))) + add_method (acfg, m); } /* write barriers */ @@ -4181,7 +4183,7 @@ add_wrappers (MonoAotCompile *acfg) MonoError error; token = MONO_TOKEN_METHOD_DEF | (i + 1); method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error); - report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); + report_loader_error (acfg, &error, TRUE, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) { if (method->is_generic) { @@ -4214,7 +4216,7 @@ add_wrappers (MonoAotCompile *acfg) guint32 token = MONO_TOKEN_METHOD_DEF | (i + 1); method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error); - report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); + report_loader_error (acfg, &error, TRUE, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) || (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) { @@ -4238,7 +4240,7 @@ add_wrappers (MonoAotCompile *acfg) int j; method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error); - report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); + report_loader_error (acfg, &error, TRUE, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); /* * Only generate native-to-managed wrappers for methods which have an @@ -4248,7 +4250,7 @@ add_wrappers (MonoAotCompile *acfg) cattr = mono_custom_attrs_from_method_checked (method, &error); if (!is_ok (&error)) { char *name = mono_method_get_full_name (method); - report_loader_error (acfg, &error, "Failed to load custom attributes from method %s due to %s\n", name, mono_error_get_message (&error)); + report_loader_error (acfg, &error, TRUE, "Failed to load custom attributes from method %s due to %s\n", name, mono_error_get_message (&error)); g_free (name); } @@ -5818,6 +5820,8 @@ encode_patch (MonoAotCompile *acfg, MonoJumpInfo *patch_info, guint8 *buf, guint break; case MONO_PATCH_INFO_INTERRUPTION_REQUEST_FLAG: break; + case MONO_PATCH_INFO_PROFILER_ALLOCATION_COUNT: + break; case MONO_PATCH_INFO_RGCTX_FETCH: case MONO_PATCH_INFO_RGCTX_SLOT_INDEX: { MonoJumpInfoRgctxEntry *entry = patch_info->data.rgctx_entry; @@ -6737,10 +6741,6 @@ emit_trampolines (MonoAotCompile *acfg) #ifdef DISABLE_REMOTING if (tramp_type == MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING) continue; -#endif -#ifndef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD - if (tramp_type == MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD) - continue; #endif mono_arch_create_generic_trampoline ((MonoTrampolineType)tramp_type, &info, acfg->aot_opts.use_trampolines_page? 2: TRUE); emit_trampoline (acfg, acfg->got_offset, info); @@ -6821,11 +6821,6 @@ emit_trampolines (MonoAotCompile *acfg) } } -#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT - mono_arch_create_handler_block_trampoline (&info, TRUE); - emit_trampoline (acfg, acfg->got_offset, info); -#endif - if (mono_aot_mode_is_interp (&acfg->aot_opts)) { mono_arch_get_enter_icall_trampoline (&info); emit_trampoline (acfg, acfg->got_offset, info); @@ -7643,7 +7638,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) if (cfg->exception_type != MONO_EXCEPTION_NONE) { /* Some instances cannot be JITted due to constraints etc. */ if (!method->is_inflated) - report_loader_error (acfg, &cfg->error, "Unable to compile method '%s' due to: '%s'.\n", mono_method_get_full_name (method), mono_error_get_message (&cfg->error)); + report_loader_error (acfg, &cfg->error, FALSE, "Unable to compile method '%s' due to: '%s'.\n", mono_method_get_full_name (method), mono_error_get_message (&cfg->error)); /* Let the exception happen at runtime */ return; } @@ -7922,6 +7917,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) g_hash_table_insert (acfg->method_to_cfg, cfg->orig_method, cfg); + /* Update global stats while holding a lock. */ mono_update_jit_stats (cfg); /* @@ -10272,7 +10268,7 @@ collect_methods (MonoAotCompile *acfg) continue; method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error); - report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); + report_loader_error (acfg, &error, TRUE, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error)); if (method->is_generic || mono_class_is_gtd (method->klass)) { MonoMethod *gshared; @@ -11627,7 +11623,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options) #ifdef ENABLE_LLVM if (acfg->llvm) { llvm_acfg = acfg; - mono_llvm_create_aot_module (acfg->image->assembly, acfg->global_prefix, TRUE, acfg->aot_opts.static_link, acfg->aot_opts.llvm_only); + mono_llvm_create_aot_module (acfg->image->assembly, acfg->global_prefix, acfg->nshared_got_entries, TRUE, acfg->aot_opts.static_link, acfg->aot_opts.llvm_only); } #endif