Inflate calli generic method signature even if not a wrapper
authorVirgile Bello <virgile.bello@gmail.com>
Fri, 2 Oct 2015 13:40:47 +0000 (22:40 +0900)
committerVirgile Bello <virgile.bello@gmail.com>
Fri, 2 Oct 2015 14:31:18 +0000 (23:31 +0900)
mono/mini/method-to-ir.c
mono/tests/Makefile.am
mono/tests/calliGenericTest.il [new file with mode: 0644]

index e5cd02291b0f5d10da83c9779fda373ba294fb37..785b5f8f21b3b4f5c7b8ffae79ecef128339b330 100644 (file)
@@ -7182,17 +7182,16 @@ mini_get_signature (MonoMethod *method, guint32 token, MonoGenericContext *conte
        MonoMethodSignature *fsig;
 
        if (method->wrapper_type != MONO_WRAPPER_NONE) {
-               MonoError error;
-
                fsig = (MonoMethodSignature *)mono_method_get_wrapper_data (method, token);
-               if (context) {
-                       fsig = mono_inflate_generic_signature (fsig, context, &error);
-                       // FIXME:
-                       g_assert (mono_error_ok (&error));
-               }
        } else {
                fsig = mono_metadata_parse_signature (method->klass->image, token);
        }
+       if (context) {
+               MonoError error;
+               fsig = mono_inflate_generic_signature(fsig, context, &error);
+               // FIXME:
+               g_assert(mono_error_ok(&error));
+       }
        return fsig;
 }
 
index 02057eb5c205d655ae227a8fca2e21cfac21d518..de320d10935d5bf86124b11823daa10929c5f2e8 100644 (file)
@@ -611,6 +611,7 @@ TEST_IL_SRC=                        \
        cpblkTest.il            \
        vbinterface.il          \
        calliTest.il            \
+       calliGenericTest.il             \
        ckfiniteTest.il         \
        fault-handler.il                \
        locallocTest.il         \
diff --git a/mono/tests/calliGenericTest.il b/mono/tests/calliGenericTest.il
new file mode 100644 (file)
index 0000000..4e3f39f
--- /dev/null
@@ -0,0 +1,32 @@
+//Tests ldftn and calli with generic return signature
+
+.assembly extern mscorlib{}
+.assembly someTest{}
+.module someTest
+
+.class public auto ansi beforefieldinit Test`1<T>
+  extends [mscorlib]System.Object
+{
+    // method line 1
+    .method public hidebysig
+           static default void test (native int ptr)  cil managed 
+    {
+       .maxstack 8
+       ldarg ptr
+       calli !T()
+       call void class [mscorlib]System.Console::WriteLine(int32)
+       ret 
+    }
+}
+       
+.class private auto ansi someTest
+       extends [mscorlib]System.Object {
+          
+  .method public static void  go() cil managed {
+    .entrypoint
+
+       ldftn int32 [mscorlib]System.Environment::get_ProcessorCount()
+       call void class Test`1<int32>::test(native int)
+       ret
+  }
+} 
\ No newline at end of file