mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-23 03:39:35 -10:00
Merge pull request mono/mono#14295 from vargaz/mixed-eh-5
[runtime] Fix some mixed EH problems. Commit migrated from https://github.com/mono/mono/commit/2e97d6edd7e57127acc1582a75714ccadc1cfee3
This commit is contained in:
commit
5ea45ebcb4
5 files changed
+45
-7
No files matched your search
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user