Skip to content

Commit

Permalink
[jit] Always pass the imt arg to interface calls in gsharedvt methods…
Browse files Browse the repository at this point in the history
…. Fixes #22624.
  • Loading branch information
vargaz committed Sep 11, 2014
1 parent 9fd3c7a commit 41339d9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
41 changes: 41 additions & 0 deletions mono/mini/gshared.cs
Expand Up @@ -944,6 +944,47 @@ class Class2 : Base {
return 0;
}

public interface IFace1<T> {
void m1 ();
void m2 ();
void m3 ();
void m4 ();
void m5 ();
}

public class ClassIFace<T> : IFace1<T> {
public void m1 () {
}
public void m2 () {
}
public void m3 () {
}
public void m4 () {
}
public void m5 () {
}
}

interface IFaceIFaceCall {
void call<T, T2> (IFace1<object> iface);
}

class MakeIFaceCall : IFaceIFaceCall {
public void call<T, T2> (IFace1<object> iface) {
iface.m1 ();
}
}

// Check normal interface calls from gsharedvt call to fully instantiated methods
public static int test_0_instatiated_iface_call () {
ClassIFace<object> c1 = new ClassIFace<object> ();

IFaceIFaceCall c = new MakeIFaceCall ();

c.call<object, int> (c1);
return 0;
}

[MethodImplAttribute (MethodImplOptions.NoInlining)]
static string to_string<T, T2>(T t, T2 t2) {
return t.ToString ();
Expand Down
5 changes: 5 additions & 0 deletions mono/mini/method-to-ir.c
Expand Up @@ -8434,6 +8434,11 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
cmethod, MONO_RGCTX_INFO_METHOD);
/* This is not needed, as the trampoline code will pass one, and it might be passed in the same reg as the imt arg */
vtable_arg = NULL;
} else if ((cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE) && !imt_arg) {
/* This can happen when we call a fully instantiated iface method */
imt_arg = emit_get_rgctx_method (cfg, context_used,
cmethod, MONO_RGCTX_INFO_METHOD);
vtable_arg = NULL;
}
}

Expand Down

0 comments on commit 41339d9

Please sign in to comment.