Skip to content

Commit

Permalink
Fix a regression introduced by the gsharedvt changes. Delegate invoke…
Browse files Browse the repository at this point in the history
…s to gshared methods using a non-generic delegate type would crash. Fixes #10513.
  • Loading branch information
vargaz committed Feb 23, 2013
1 parent be4ae1d commit eed19f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mono/mini/mini-trampolines.c
Expand Up @@ -1087,7 +1087,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_data, gui
/* The general, unoptimized case */
m = mono_marshal_get_delegate_invoke (invoke, delegate);
code = mono_compile_method (m);
code = mini_add_method_trampoline (NULL, m, code, NULL, need_rgctx_tramp);
code = mini_add_method_trampoline (NULL, m, code, NULL, mono_method_needs_static_rgctx_invoke (m, FALSE));
delegate->invoke_impl = mono_get_addr_from_ftnptr (code);
mono_debugger_trampoline_compiled (NULL, m, delegate->invoke_impl);

Expand Down
23 changes: 22 additions & 1 deletion mono/mini/objects.cs
Expand Up @@ -1078,7 +1078,8 @@ static ulong Y ()
}
public static int test_0_cond_branch_side_effects () {
counter = 5;
if (WriteStuff());
if (WriteStuff()) {
}
if (counter == 10)
return 0;
return 1;
Expand Down Expand Up @@ -1548,5 +1549,25 @@ class B {
getInstance ();
return 0;
}

struct BStruct {
public Type t;
}

class Del<T> {
public static BStruct foo () {
return new BStruct () { t = typeof (T) };
}
}

delegate BStruct ADelegate ();

static int test_0_regress_10601 () {
var act = (ADelegate)(Del<string>.foo);
BStruct b = act ();
if (b.t != typeof (string))
return 1;
return 0;
}
}

0 comments on commit eed19f9

Please sign in to comment.