[aot] Don't error out if a method fails to JIT in full-aot mode. This was a regressio...
authorZoltan Varga <vargaz@gmail.com>
Thu, 5 Oct 2017 15:54:16 +0000 (17:54 +0200)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2017 15:54:16 +0000 (17:54 +0200)
mono/mini/aot-compiler.c

index 6b91543a56b6bbfd9e7f6a4c32f6bdb29911f289..5bfa4d0920387d4bcbaf388a254e24f328622407 100644 (file)
@@ -421,7 +421,7 @@ aot_printerrf (MonoAotCompile *acfg, const gchar *format, ...)
 }
 
 static void
 }
 
 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;
 {
        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);
 
        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);
        }
                fprintf (output, "FullAOT cannot continue if there are loader errors.\n");
                exit (1);
        }
@@ -3832,7 +3832,7 @@ add_wrappers (MonoAotCompile *acfg)
                gboolean skip = FALSE;
 
                method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
                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) ||
 
                if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
                        (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
@@ -4183,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);
                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) {
 
                if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
                        if (method->is_generic) {
@@ -4216,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);
                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)) {
 
                if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
                        (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) {
@@ -4240,7 +4240,7 @@ add_wrappers (MonoAotCompile *acfg)
                int j;
 
                method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
                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
 
                /* 
                 * Only generate native-to-managed wrappers for methods which have an
@@ -4250,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);
                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);
                }
 
                        g_free (name);
                }
 
@@ -7638,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)
        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;
        }
                /* Let the exception happen at runtime */
                return;
        }
@@ -10268,7 +10268,7 @@ collect_methods (MonoAotCompile *acfg)
                        continue;
 
                method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
                        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;
 
                if (method->is_generic || mono_class_is_gtd (method->klass)) {
                        MonoMethod *gshared;