From 9302c31f81abd2f5bbf9a8ddd27993e1ece55db2 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Wed, 5 Apr 2017 23:06:47 -0400 Subject: [PATCH] [aot] Print JIT failures without having to pass an additional option. (#4648) --- mono/mini/aot-compiler.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c index d6dfd3b69d2..236bdd2d7b6 100644 --- a/mono/mini/aot-compiler.c +++ b/mono/mini/aot-compiler.c @@ -298,6 +298,7 @@ typedef struct MonoAotCompile { guint32 label_generator; gboolean llvm; gboolean has_jitted_code; + gboolean is_full_aot; MonoAotFileFlags flags; MonoDynamicStream blob; gboolean blob_closed; @@ -438,7 +439,10 @@ report_loader_error (MonoAotCompile *acfg, MonoError *error, const char *format, va_end (args); mono_error_cleanup (error); - g_error ("FullAOT cannot continue if there are loader errors"); + if (acfg->is_full_aot) { + fprintf (output, "FullAOT cannot continue if there are loader errors.\n"); + exit (1); + } } /* Wrappers around the image writer functions */ @@ -7613,11 +7617,9 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) return; } if (cfg->exception_type != MONO_EXCEPTION_NONE) { - if (acfg->aot_opts.print_skipped_methods) { - printf ("Skip (JIT failure): %s\n", mono_method_get_full_name (method)); - if (cfg->exception_message) - printf ("Caused by: %s\n", cfg->exception_message); - } + /* 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)); /* Let the exception happen at runtime */ return; } @@ -11485,8 +11487,10 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options) } } - if (mono_aot_mode_is_full (&acfg->aot_opts)) + if (mono_aot_mode_is_full (&acfg->aot_opts)) { acfg->flags = (MonoAotFileFlags)(acfg->flags | MONO_AOT_FILE_FLAG_FULL_AOT); + acfg->is_full_aot = TRUE; + } if (mono_threads_is_coop_enabled ()) acfg->flags = (MonoAotFileFlags)(acfg->flags | MONO_AOT_FILE_FLAG_SAFEPOINTS); -- 2.25.1