Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix support for delegates+unbox trampolines in full-aot mode.

  • Loading branch information...
commit 787938f1f6fed3f2d90eab3792c25fb12a2f10aa 1 parent 6b623dc
@vargaz vargaz authored
Showing with 32 additions and 4 deletions.
  1. +20 −0 mono/mini/generics.cs
  2. +12 −4 mono/mini/mini-trampolines.c
View
20 mono/mini/generics.cs
@@ -980,4 +980,24 @@ enum ConstrainedEnum {
var r = new ConstrainedEnum [10];
return Foo3<ConstrainedEnum>.CompareTo (r);
}
+
+ public interface IFoo2 {
+ void MoveNext ();
+ }
+
+ public struct Foo2 : IFoo2 {
+ public void MoveNext () {
+ }
+ }
+
+ public static Action Dingus (ref Foo2 f) {
+ return new Action (f.MoveNext);
+ }
+
+ public static int test_0_delegate_unbox_full_aot () {
+ Foo2 foo = new Foo2 ();
+ Dingus (ref foo) ();
+ return 0;
+ }
+
}
View
16 mono/mini/mini-trampolines.c
@@ -868,6 +868,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_data, gui
MonoMethod *method = NULL;
gboolean multicast, callvirt = FALSE;
gboolean need_rgctx_tramp = FALSE;
+ gboolean need_unbox_tramp = FALSE;
gboolean enable_caching = TRUE;
MonoMethod *invoke = tramp_data [0];
guint8 *impl_this = tramp_data [1];
@@ -903,8 +904,12 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_data, gui
if (!sig)
mono_error_raise_exception (&err);
- if (sig->hasthis && method->klass->valuetype)
- method = mono_marshal_get_unbox_wrapper (method);
+ if (sig->hasthis && method->klass->valuetype) {
+ if (mono_aot_only)
+ need_unbox_tramp = TRUE;
+ else
+ method = mono_marshal_get_unbox_wrapper (method);
+ }
}
} else {
ji = mono_jit_info_table_find (domain, mono_get_addr_from_ftnptr (delegate->method_ptr));
@@ -944,8 +949,11 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_data, gui
delegate->method_ptr = *delegate->method_code;
} else {
delegate->method_ptr = mono_compile_method (method);
- if (need_rgctx_tramp)
- delegate->method_ptr = mono_create_static_rgctx_trampoline (method, delegate->method_ptr);
+ if (need_unbox_tramp)
+ delegate->method_ptr = get_unbox_trampoline (method, delegate->method_ptr, need_rgctx_tramp);
+ else
+ if (need_rgctx_tramp)
+ delegate->method_ptr = mono_create_static_rgctx_trampoline (method, delegate->method_ptr);
if (enable_caching && delegate->method_code)
*delegate->method_code = delegate->method_ptr;
mono_debugger_trampoline_compiled (NULL, method, delegate->method_ptr);
Please sign in to comment.
Something went wrong with that request. Please try again.