[wasm] Fix the propagation of exceptions through runtime invokes. (#39316)
authormonojenkins <jo.shields+jenkins@xamarin.com>
Wed, 15 Jul 2020 06:22:10 +0000 (02:22 -0400)
committerGitHub <noreply@github.com>
Wed, 15 Jul 2020 06:22:10 +0000 (02:22 -0400)
The previous code would convert exceptions into errors which would
be rethrown later, clearing the resume state.

Hopefully fixes https://github.com/dotnet/runtime/issues/38337.

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
src/mono/mono/mini/interp/interp.c

index b232c76850746ba7ba2a8ac35e22ffaa0d4452e5..8640163368d4d52b03b05839dc56a3b866c0aec3 100644 (file)
@@ -1913,12 +1913,10 @@ interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject
        context->stack_pointer = (guchar*)sp;
 
        if (context->has_resume_state) {
-               // This can happen on wasm !?
-               MonoException *thrown_exc = (MonoException*) mono_gchandle_get_target_internal (context->exc_gchandle);
-               if (exc)
-                       *exc = (MonoObject*)thrown_exc;
-               else
-                       mono_error_set_exception_instance (error, thrown_exc);
+               /*
+                * This can happen on wasm where native frames cannot be skipped during EH.
+                * EH processing will continue when control returns to the interpreter.
+                */
                return NULL;
        }
        return (MonoObject*)result.data.p;