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.
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
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)
{
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 ();
}
*
* 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;
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: