Skip to content
Permalink
Browse files

[jit] Always pass the imt arg to interface calls in gsharedvt methods…

…. Fixes #22624.
  • Loading branch information...
vargaz authored and migueldeicaza committed Sep 11, 2014
1 parent db71bc1 commit e451fb2813e67d6f9d56424775444d0e5acca19f
Showing with 46 additions and 0 deletions.
  1. +41 −0 mono/mini/gshared.cs
  2. +5 −0 mono/mini/method-to-ir.c
@@ -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 ();
@@ -8411,6 +8411,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;
}
}

0 comments on commit e451fb2

Please sign in to comment.
You can’t perform that action at this time.