2008-08-19 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Tue, 19 Aug 2008 00:00:55 +0000 (00:00 -0000)
committerZoltan Varga <vargaz@gmail.com>
Tue, 19 Aug 2008 00:00:55 +0000 (00:00 -0000)
* aot-runtime.c (decode_klass_ref): Add support for VARs/MVARs.

* aot-compiler.c (encode_klass_ref): Encode is_method too for VARs/MVARs.

* method-to-ir.c (emit_get_rgctx_method): Use MONO_PATCH_INFO_METHODCONST
as the patch type.

* mini.c (mono_resolve_patch_target): Ditto.

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

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

index 52e79c045260a125ecf93b8229a442f7f405a60c..7ca52980d2aa7960b5a0f511e124a13508bccc02 100644 (file)
@@ -1,5 +1,14 @@
 2008-08-19  Zoltan Varga  <vargaz@gmail.com>
 
+       * aot-runtime.c (decode_klass_ref): Add support for VARs/MVARs.
+
+       * aot-compiler.c (encode_klass_ref): Encode is_method too for VARs/MVARs.
+
+       * method-to-ir.c (emit_get_rgctx_method): Use MONO_PATCH_INFO_METHODCONST
+       as the patch type.
+
+       * mini.c (mono_resolve_patch_target): Ditto.
+       
        * aot-compiler.c (encode_patch): Add support for RGCTX_FETCH.
        (encode_klass_ref): Add support for encoding VARs/MVARs.
 
index f84f0689da6f1ba1e2d104978b4317f92984850e..89378abe3ce25e65265917883e33a153c8b2045a 100644 (file)
@@ -1741,6 +1741,7 @@ encode_klass_ref (MonoAotCompile *acfg, MonoClass *klass, guint8 *buf, guint8 **
                encode_value (param->num, p, &p);
                
                g_assert (param->owner);
+               encode_value (param->owner->is_method, p, &p);
                if (param->owner->is_method)
                        encode_method_ref (acfg, param->owner->owner.method, p, &p);
                else
index e619ed21298c3c85bd17d720ecd90a77dbaed5d1..5918bcd11e10c2cf4469fb1d42c3e39c7579a75a 100644 (file)
@@ -239,6 +239,9 @@ decode_value (guint8 *ptr, guint8 **rptr)
        return len;
 }
 
+static MonoMethod*
+decode_method_ref_2 (MonoAotModule *module, guint8 *buf, guint8 **endbuf);
+
 static MonoClass*
 decode_klass_ref (MonoAotModule *module, guint8 *buf, guint8 **endbuf)
 {
@@ -288,7 +291,35 @@ decode_klass_ref (MonoAotModule *module, guint8 *buf, guint8 **endbuf)
                                klass = mono_class_from_mono_type (type);
                                mono_metadata_free_type (type);
                        } else if ((type == MONO_TYPE_VAR) || (type == MONO_TYPE_MVAR)) {
-                               g_assert_not_reached ();
+                               MonoType *t;
+                               gboolean is_method;
+
+                               // FIXME: Maybe use types directly to avoid
+                               // the overhead of creating MonoClass-es
+
+                               // FIXME: Memory management
+                               t = g_new0 (MonoType, 1);
+                               t->type = type;
+                               t->data.generic_param = g_new0 (MonoGenericParam, 1);
+                               t->data.generic_param->num = decode_value (p, &p);
+
+                               is_method = decode_value (p, &p);
+                               if (is_method) {
+                                       g_assert_not_reached ();
+                               } else {
+                                       MonoClass *class_def = decode_klass_ref (module, p, &p);
+                                       
+                                       if (!class_def) {
+                                               g_free (t->data.generic_param);
+                                               g_free (t);
+                                               return NULL;
+                                       }
+
+                                       g_assert (class_def->generic_container);
+                                       t->data.generic_param->owner = class_def->generic_container;
+                               }
+
+                               klass = mono_class_from_mono_type (t);
                        } else {
                                g_assert_not_reached ();
                        }
@@ -408,7 +439,7 @@ decode_method_ref (MonoAotModule *module, guint32 *token, MonoMethod **method, g
  *
  *   Similar to decode_method_ref, but resolve and return the method itself.
  */
-static inline MonoMethod*
+static MonoMethod*
 decode_method_ref_2 (MonoAotModule *module, guint8 *buf, guint8 **endbuf)
 {
        MonoMethod *method;
index c613ce8859bd437ed7db52b4a58845391455d30e..9574bc14f9642ed3d793fcaed122095305bf9155 100644 (file)
@@ -11535,7 +11535,7 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                case MONO_PATCH_INFO_CLASS:
                        slot = mono_method_lookup_or_register_other_info (entry->method, entry->in_mrgctx, &entry->data->data.klass->byval_arg, entry->info_type, mono_method_get_context (entry->method));
                        break;
-               case MONO_PATCH_INFO_METHOD:
+               case MONO_PATCH_INFO_METHODCONST:
                        slot = mono_method_lookup_or_register_other_info (entry->method, entry->in_mrgctx, entry->data->data.method, entry->info_type, mono_method_get_context (entry->method));
                        break;
                case MONO_PATCH_INFO_FIELD: