diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 14427441d08..9d439906a8e 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -1828,8 +1828,12 @@ interp_entry (InterpEntryData *data) if (rmethod->needs_thread_attach) mono_threads_detach_coop (orig_domain, &attach_cookie); - // FIXME: - g_assert (frame.ex == NULL); + if (mono_llvm_only) { + if (frame.ex) + mono_llvm_reraise_exception (frame.ex); + } else { + g_assert (frame.ex == NULL); + } type = rmethod->rtype; switch (type->type) { @@ -3308,12 +3312,12 @@ interp_exec_method_full (InterpFrame *frame, ThreadContext *context, FrameClause InterpMethod *rmethod = (InterpMethod*)imethod->data_items [* (guint16 *)(ip + 1)]; ERROR_DECL (error); frame->ip = ip; - ip += 2; sp = do_jit_call (sp, vt_sp, context, frame, rmethod, error); if (!is_ok (error)) { MonoException *ex = mono_error_convert_to_exception (error); THROW_EX (ex, ip); } + ip += 2; CHECK_RESUME_STATE (context); diff --git a/src/mono/mono/mini/mini-exceptions.c b/src/mono/mono/mini/mini-exceptions.c index daef57c5a07..9ce55c9092a 100644 --- a/src/mono/mono/mini/mini-exceptions.c +++ b/src/mono/mono/mini/mini-exceptions.c @@ -1283,7 +1283,7 @@ mono_walk_stack_full (MonoJitStackWalk func, MonoContext *start_ctx, MonoDomain if (func (&frame, NULL, user_data)) break; } - g_free (ips); + g_slist_free (ips); return; } #endif diff --git a/src/mono/mono/tests/llvmonly-mixed/Makefile.am b/src/mono/mono/tests/llvmonly-mixed/Makefile.am index 48796637c09..1af1bf87d86 100644 --- a/src/mono/mono/tests/llvmonly-mixed/Makefile.am +++ b/src/mono/mono/tests/llvmonly-mixed/Makefile.am @@ -3,7 +3,10 @@ include ../common_mixed.mk tests.exe: $(srcdir)/tests.cs TestDriver.dll interponly.dll $(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -r:TestDriver.dll -r:interponly.dll -target:exe -out:$@ $< -interponly.dll: $(srcdir)/interponly.cs TestDriver.dll +interponly.dll: $(srcdir)/interponly.cs TestDriver.dll jitonly.dll + $(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -r:TestDriver.dll -r:jitonly.dll -target:library -out:$@ $< + +jitonly.dll: $(srcdir)/jitonly.cs TestDriver.dll $(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -r:TestDriver.dll -target:library -out:$@ $< TestDriver.dll: @@ -25,7 +28,7 @@ SOURCES = \ interponly.cs # interponly.dll is not AOT-ed -ASSEMBLIES = mscorlib.dll tests.exe TestDriver.dll +ASSEMBLIES = mscorlib.dll tests.exe jitonly.dll TestDriver.dll AOT_IMAGES = $(patsubst %,$(AOTDIR)/%$(PLATFORM_AOT_SUFFIX),$(ASSEMBLIES)) @@ -41,7 +44,7 @@ $(AOTDIR)/%.exe: %.exe mkdir -p $(AOTDIR) cp $< $@ -$(AOTDIR)/tests.exe: $(AOTDIR)/TestDriver.dll $(AOTDIR)/interponly.dll +$(AOTDIR)/tests.exe: $(AOTDIR)/TestDriver.dll $(AOTDIR)/jitonly.dll $(AOTDIR)/interponly.dll if ENABLE_LLVM check: $(AOT_IMAGES) diff --git a/src/mono/mono/tests/llvmonly-mixed/interponly.cs b/src/mono/mono/tests/llvmonly-mixed/interponly.cs index 25e2f656d61..97187bb55d7 100644 --- a/src/mono/mono/tests/llvmonly-mixed/interponly.cs +++ b/src/mono/mono/tests/llvmonly-mixed/interponly.cs @@ -1,6 +1,8 @@ using System; using System.Collections; using System.Runtime.CompilerServices; +using System.IO; +using System.IO.IsolatedStorage; // // This assembly is not AOT-ed, so all calls into it transition to the interpreter @@ -67,6 +69,24 @@ public class InterpOnly : InterpOnlyIFace public static int entry_sig (byte b1, byte b2, byte b3, byte b4, byte b5, byte b6) { return b1 + b2 + b3 + b4 + b5 + b6; } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static void try_after_jitonly_call () { + JitOnly.throw_ovf_ex (); + try { + throw new Exception (); + } catch { + throw new InvalidOperationException (); + } + } + + // Check that exceptions thrown from jitted code are not caught by the try block after the call + public static void test_0_try_after_jitonly_call () { + try { + try_after_jitonly_call (); + } catch (OverflowException) { + } + } } public struct InterpOnlyStruct : InterpOnlyIFace diff --git a/src/mono/mono/tests/llvmonly-mixed/jitonly.cs b/src/mono/mono/tests/llvmonly-mixed/jitonly.cs new file mode 100644 index 00000000000..40fc937ef23 --- /dev/null +++ b/src/mono/mono/tests/llvmonly-mixed/jitonly.cs @@ -0,0 +1,11 @@ +using System; +using System.Runtime.CompilerServices; + +// Class whose methods are AOTed +public class JitOnly +{ + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static void throw_ovf_ex () { + throw new OverflowException (); + } +}