2007-01-19 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Fri, 19 Jan 2007 14:52:09 +0000 (14:52 -0000)
committerZoltan Varga <vargaz@gmail.com>
Fri, 19 Jan 2007 14:52:09 +0000 (14:52 -0000)
* aot-compiler.c (encode_klass_info): Allow classes of the form <Type>[][].
(compile_method): Ditto.

* aot-runtime.c (decode_klass_info): Ditto.

* mini.c (mono_method_to_ir): Call mono_get_got_var () in a place where it is
needed by the code generated by inssel.brg. Also fix a warning.

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

mono/mini/ChangeLog
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/mini.c

index 4dff8ad86ba2e4e6dec95fa62688d083efac8614..d1714f5df5c3011c36b128916ec5311325c7be51 100644 (file)
@@ -1,3 +1,12 @@
+2007-01-19  Zoltan Varga  <vargaz@gmail.com>
+
+       * aot-compiler.c (encode_klass_info): Allow classes of the form <Type>[][].
+       (compile_method): Ditto.
+
+       * aot-runtime.c (decode_klass_info): Ditto.
+
+       * mini.c (mono_method_to_ir): Call mono_get_got_var () in a place where it is
+       needed by the code generated by inssel.brg. Also fix a warning.
 
 Thu Jan 18 16:52:56 CET 2007 Paolo Molaro <lupus@ximian.com>
 
index 5c2576b5d3f240d2654c738a5a8b3fde910ba180..864f278c323a46f0c36eba9d209d267e67e643ac 100644 (file)
@@ -1587,13 +1587,22 @@ static void
 encode_klass_info (MonoAotCompile *cfg, MonoClass *klass, guint8 *buf, guint8 **endbuf)
 {
        if (!klass->type_token) {
+               guint32 token;
+
                /* Array class */
                g_assert (klass->rank > 0);
-               g_assert (klass->element_class->type_token);
                encode_value (MONO_TOKEN_TYPE_DEF, buf, &buf);
                encode_value (get_image_index (cfg, klass->image), buf, &buf);
-               g_assert (mono_metadata_token_code (klass->element_class->type_token) == MONO_TOKEN_TYPE_DEF);
-               encode_value (klass->element_class->type_token - MONO_TOKEN_TYPE_DEF, buf, &buf);
+               token = klass->element_class->type_token;
+               if (!token) {
+                       /* <Type>[][] */
+                       g_assert (klass->element_class->rank);
+                       encode_value (0, buf, &buf);
+                       encode_value (klass->element_class->rank, buf, &buf);
+                       token = klass->element_class->element_class->type_token;
+               }
+               g_assert (mono_metadata_token_code (token) == MONO_TOKEN_TYPE_DEF);
+               encode_value (token - MONO_TOKEN_TYPE_DEF, buf, &buf);
                encode_value (klass->rank, buf, &buf);
        }
        else {
@@ -2641,7 +2650,7 @@ compile_method (MonoAotCompile *acfg, int index)
                case MONO_PATCH_INFO_IID:
                case MONO_PATCH_INFO_ADJUSTED_IID:
                        if (!patch_info->data.klass->type_token)
-                               if (!patch_info->data.klass->element_class->type_token)
+                               if (!patch_info->data.klass->element_class->type_token && !(patch_info->data.klass->element_class->rank && patch_info->data.klass->element_class->element_class->type_token))
                                        skip = TRUE;
                        break;
                default:
index 161c1859660bb30f237e2632fe6e3d1ca47e77d2..ee41e00f06a251b866ed6331e9a3d3fcda6a3f88 100644 (file)
@@ -239,9 +239,20 @@ decode_klass_info (MonoAotModule *module, guint8 *buf, guint8 **endbuf)
        } else {
                token = MONO_TOKEN_TYPE_DEF + decode_value (buf, &buf);
                rank = decode_value (buf, &buf);
-               klass = mono_class_get (image, token);
-               g_assert (klass);
-               klass = mono_array_class_get (klass, rank);
+               if (token == MONO_TOKEN_TYPE_DEF) {
+                       /* <Type>[][] */
+                       token = MONO_TOKEN_TYPE_DEF + decode_value (buf, &buf);
+                       klass = mono_class_get (image, token);
+                       g_assert (klass);
+                       klass = mono_array_class_get (klass, rank);
+
+                       rank = decode_value (buf, &buf);
+                       klass = mono_array_class_get (klass, rank);
+               } else {
+                       klass = mono_class_get (image, token);
+                       g_assert (klass);
+                       klass = mono_array_class_get (klass, rank);
+               }
        }
        g_assert (klass);
        mono_class_init (klass);
index 3a79082941807d8414011273bb7e2abba2cbfef4..fd96e6df945ed3acd7d34bd286a25e5b37c2b73e 100644 (file)
@@ -6458,7 +6458,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        if (cfg->compile_aot) {
                                                NEW_AOTCONST_TOKEN (cfg, iargs [1], MONO_PATCH_INFO_RVA, method->klass->image, GPOINTER_TO_UINT(data_ptr), STACK_PTR, NULL);
                                        } else {
-                                               NEW_PCONST (cfg, iargs [1], data_ptr);
+                                               NEW_PCONST (cfg, iargs [1], (char*)data_ptr);
                                        }
                                        mono_emit_method_call_spilled (cfg, bblock, memcpy_method, memcpy_method->signature, iargs, ip, NULL);
                                        ip += 11;
@@ -6495,6 +6495,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                         */
                        if (!klass->valuetype && method->wrapper_type == MONO_WRAPPER_NONE) {
                                MonoInst* check;
+
+                               /* Needed by the code generated in inssel.brg */
+                               mono_get_got_var (cfg);
+
                                MONO_INST_NEW (cfg, check, OP_CHECK_ARRAY_TYPE);
                                check->cil_code = ip;
                                check->klass = klass;