2010-07-11 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sun, 11 Jul 2010 19:38:49 +0000 (19:38 -0000)
committerZoltan Varga <vargaz@gmail.com>
Sun, 11 Jul 2010 19:38:49 +0000 (19:38 -0000)
* mini-<ARCH>.c (get_call_info): Call mini_type_get_underlying_type () before passing
a type to MONO_TYPE_IS_REFERENCE (), since the latter can't handle VAR/MVAR.
Fixes #620864.

* generics.cs: Add a test.

svn path=/trunk/mono/; revision=160206

mono/mini/ChangeLog
mono/mini/generics.cs
mono/mini/mini-amd64.c
mono/mini/mini-arm.c
mono/mini/mini-ppc.c
mono/mini/mini-x86.c

index adefca52665a57a60db88cc65e4035dff17fb61f..afbfd26ba8958a27e3498d7e394ede0e25fdee72 100755 (executable)
@@ -1,3 +1,11 @@
+2010-07-11  Zoltan Varga  <vargaz@gmail.com>
+
+       * mini-<ARCH>.c (get_call_info): Call mini_type_get_underlying_type () before passing
+       a type to MONO_TYPE_IS_REFERENCE (), since the latter can't handle VAR/MVAR.
+       Fixes #620864.
+
+       * generics.cs: Add a test.
+
 2010-07-11 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * mini.c (mono_jit_compile_method_inner): Don't bomb out if we don't
index a75e3ad59a8f5c5a21a2c5a0b29374f3787d9914..c72b0056bbb7e2f93d5eed9231a114235cb1f29e 100644 (file)
@@ -563,6 +563,25 @@ class Tests {
                return 0;
        }
 
+       class Pair<TKey, TValue> {
+               public static KeyValuePair<TKey, TValue> make_pair (TKey key, TValue value)
+                       {
+                               return new KeyValuePair<TKey, TValue> (key, value);
+                       }
+
+               public delegate TRet Transform<TRet> (TKey key, TValue value);
+       }
+
+       public static int test_0_bug_620864 () {
+               var d = new Pair<string, Type>.Transform<KeyValuePair<string, Type>> (Pair<string, Type>.make_pair);
+
+               var p = d ("FOO", typeof (int));
+               if (p.Key != "FOO" || p.Value != typeof (int))
+                       return 1;
+
+               return 0;
+       }
+
        public static int test_0_partial_sharing () {
                if (PartialShared1 (new List<string> (), 1) != typeof (string))
                        return 1;
index d51446cdd83af55546a2d87f6cf2b0aa7fc3d087..20fa9cd1d092a8915f6785954275e114e4edebbe 100644 (file)
@@ -712,7 +712,7 @@ get_call_info (MonoGenericSharingContext *gsctx, MonoMemPool *mp, MonoMethodSign
         * are sometimes made using calli without sig->hasthis set, like in the delegate
         * invoke wrappers.
         */
-       if (cinfo->vtype_retaddr && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (sig->params [0])))) {
+       if (cinfo->vtype_retaddr && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (mini_type_get_underlying_type (gsctx, sig->params [0]))))) {
                if (sig->hasthis) {
                        add_general (&gr, &stack_size, cinfo->args + 0);
                } else {
index 8a69711a202da99699e5075bd816393c4bbdb234..9ce001942b0bef637e4bc33c8fa94c584d5d71d4 100644 (file)
@@ -799,7 +799,7 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig, gboolean is_pinvoke)
         * are sometimes made using calli without sig->hasthis set, like in the delegate
         * invoke wrappers.
         */
-       if (cinfo->vtype_retaddr && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (sig->params [0])))) {
+       if (cinfo->vtype_retaddr && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (mini_type_get_underlying_type (gsctx, sig->params [0]))))) {
                if (sig->hasthis) {
                        add_general (&gr, &stack_size, cinfo->args + 0, TRUE);
                } else {
index c0cbfa10db930adf190f1287151a55d65052d493..5992b007fdc7832a5407bb3a5f8ae074c58e4fd7 100755 (executable)
@@ -996,7 +996,7 @@ calculate_sizes (MonoMethodSignature *sig, gboolean is_pinvoke)
         * are sometimes made using calli without sig->hasthis set, like in the delegate
         * invoke wrappers.
         */
-       if (cinfo->vtype_retaddr && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (sig->params [0])))) {
+       if (cinfo->vtype_retaddr && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (mini_type_get_underlying_type (gsctx, sig->params [0]))))) {
                if (sig->hasthis) {
                        add_general (&gr, &stack_size, cinfo->args + 0, TRUE);
                        n ++;
index 344d01d309f40ce9ab40f31f62d056d740ea748c..f6a7ca4a6b9cdbfbd30f889ec0389e82d5b477da 100644 (file)
@@ -386,7 +386,7 @@ get_call_info_internal (MonoGenericSharingContext *gsctx, CallInfo *cinfo, MonoM
         * are sometimes made using calli without sig->hasthis set, like in the delegate
         * invoke wrappers.
         */
-       if (cinfo->vtype_retaddr && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (sig->params [0])))) {
+       if (cinfo->vtype_retaddr && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (mini_type_get_underlying_type (gsctx, sig->params [0]))))) {
                if (sig->hasthis) {
                        add_general (&gr, &stack_size, cinfo->args + 0);
                } else {