case 4: /* TypeSpec */
klass = mono_class_get_full (m, MONO_TOKEN_TYPE_SPEC | idx, (MonoGenericContext *) container);
g_assert (klass);
- return mono_class_is_ginst (klass) ? mono_class_get_generic_class (klass)->container_class->generic_container : NULL;
+ return mono_class_is_ginst (klass) ? mono_class_get_generic_container (mono_class_get_generic_class (klass)->container_class) : NULL;
}
g_assert_not_reached ();
return NULL;
MonoMethod *mh = NULL;
mh = mono_get_method_checked (m, decl, NULL, (MonoGenericContext *) container, &error);
- if (mh && (mh->klass && (mono_class_is_ginst (mh->klass) || mh->klass->generic_container))) {
+ if (mh && (mh->klass && (mono_class_is_ginst (mh->klass) || mono_class_is_gtd (mh->klass)))) {
char *meth_str;
char *ret;
g_assert (klass->class_kind == MONO_CLASS_DEF || klass->class_kind == MONO_CLASS_GTD);
((MonoClassDef*)klass)->flags = flags;
}
+
+/*
+ * mono_class_get_generic_container:
+ *
+ * Return the generic container of KLASS which should be a generic type definition.
+ */
+MonoGenericContainer*
+mono_class_get_generic_container (MonoClass *klass)
+{
+ g_assert (mono_class_is_gtd (klass));
+
+ return ((MonoClassGtd*)klass)->generic_container;
+}
+
+MonoGenericContainer*
+mono_class_try_get_generic_container (MonoClass *klass)
+{
+ if (mono_class_is_gtd (klass))
+ return ((MonoClassGtd*)klass)->generic_container;
+ return NULL;
+}
+
+
+void
+mono_class_set_generic_container (MonoClass *klass, MonoGenericContainer *container)
+{
+ g_assert (mono_class_is_gtd (klass));
+
+ ((MonoClassGtd*)klass)->generic_container = container;
+}
MonoType this_arg;
MonoType byval_arg;
- MonoGenericContainer *generic_container;
-
MonoGCDescriptor gc_descr;
MonoClassRuntimeInfo *runtime_info;
typedef struct {
MonoClassDef class;
+ MonoGenericContainer *generic_container;
} MonoClassGtd;
typedef struct {
void
mono_class_set_flags (MonoClass *klass, guint32 flags);
+MonoGenericContainer*
+mono_class_try_get_generic_container (MonoClass *klass);
+
+void
+mono_class_set_generic_container (MonoClass *klass, MonoGenericContainer *container);
+
/*Now that everything has been defined, let's include the inline functions */
#include <mono/metadata/class-inlines.h>
g_string_append_c (str, '>');
else
g_string_append_c (str, ']');
- } else if (klass->generic_container &&
+ } else if (mono_class_is_gtd (klass) &&
(format != MONO_TYPE_NAME_FORMAT_FULL_NAME) &&
(format != MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED)) {
int i;
g_string_append_c (str, '<');
else
g_string_append_c (str, '[');
- for (i = 0; i < klass->generic_container->type_argc; i++) {
+ for (i = 0; i < mono_class_get_generic_container (klass)->type_argc; i++) {
if (i)
g_string_append_c (str, ',');
- g_string_append (str, mono_generic_container_get_param_info (klass->generic_container, i)->name);
+ g_string_append (str, mono_generic_container_get_param_info (mono_class_get_generic_container (klass), i)->name);
}
if (format == MONO_TYPE_NAME_FORMAT_IL)
g_string_append_c (str, '>');
return t->data.generic_class->context.class_inst->is_open;
case MONO_TYPE_CLASS:
case MONO_TYPE_VALUETYPE:
- return t->data.klass->generic_container != NULL;
+ return mono_class_is_gtd (t->data.klass);
default:
return FALSE;
}
case MONO_TYPE_CLASS:
case MONO_TYPE_VALUETYPE: {
MonoClass *klass = type->data.klass;
- MonoGenericContainer *container = klass->generic_container;
+ MonoGenericContainer *container = mono_class_try_get_generic_container (klass);
MonoGenericInst *inst;
MonoGenericClass *gclass = NULL;
MonoType *nt;
return gklass ? mono_generic_class_get_context (gklass) : NULL;
}
-/*
- * mono_class_get_generic_container:
- *
- * Return the generic container of KLASS which should be a generic type definition.
- */
-MonoGenericContainer*
-mono_class_get_generic_container (MonoClass *klass)
-{
- g_assert (mono_class_is_gtd (klass));
-
- return klass->generic_container;
-}
-
/*
* mono_class_inflate_generic_type_with_mempool:
* @mempool: a mempool
*
*/
if (!((method->is_generic && context->method_inst) ||
- (method->klass->generic_container && context->class_inst)))
+ (mono_class_is_gtd (method->klass) && context->class_inst)))
return method;
iresult = g_new0 (MonoMethodInflated, 1);
if (!context->class_inst) {
g_assert (!mono_class_is_ginst (iresult->declaring->klass));
- if (iresult->declaring->klass->generic_container)
- iresult->context.class_inst = iresult->declaring->klass->generic_container->context.class_inst;
+ if (mono_class_is_gtd (iresult->declaring->klass))
+ iresult->context.class_inst = mono_class_get_generic_container (iresult->declaring->klass)->context.class_inst;
}
/* This can happen with some callers like mono_object_get_virtual_method () */
- if (!iresult->declaring->klass->generic_container && !mono_class_is_ginst (iresult->declaring->klass))
+ if (!mono_class_is_gtd (iresult->declaring->klass) && !mono_class_is_ginst (iresult->declaring->klass))
iresult->context.class_inst = NULL;
MonoImageSet *set = mono_metadata_get_image_set_for_method (iresult);
klass_hint = NULL;
}
- if (method->klass->generic_container)
+ if (mono_class_is_gtd (method->klass))
result->klass = klass_hint;
if (!result->klass) {
return NULL;
if (method->is_generic)
return &(mono_method_get_generic_container (method)->context);
- if (method->klass->generic_container)
- return &method->klass->generic_container->context;
+ if (mono_class_is_gtd (method->klass))
+ return &mono_class_get_generic_container (method->klass)->context;
return NULL;
}
mono_error_init (error);
- if (klass->generic_container)
- container = klass->generic_container;
- else if (mono_class_is_ginst (klass)) {
+ container = mono_class_try_get_generic_container (klass);
+ if (mono_class_is_ginst (klass)) {
MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
- container = gklass->generic_container;
+ container = mono_class_get_generic_container (gklass);
g_assert (container);
}
context = mono_class_get_context (klass);
type_token = mono_class_get_generic_class (klass)->container_class->type_token;
} else {
- context = (MonoGenericContext *) klass->generic_container;
+ context = (MonoGenericContext *) mono_class_try_get_generic_container (klass); //FIXME is this a case of a try?
type_token = klass->type_token;
}
/*
* Check whether we're a generic type definition.
*/
- klass->generic_container = mono_metadata_load_generic_params (image, klass->type_token, NULL);
- if (klass->generic_container) {
- klass->generic_container->owner.klass = klass;
- klass->generic_container->is_anonymous = FALSE; // Owner class is now known, container is no longer anonymous
- context = &klass->generic_container->context;
- }
-
- if (klass->generic_container)
+ if (mono_class_is_gtd (klass)) {
+ MonoGenericContainer *generic_container = mono_metadata_load_generic_params (image, klass->type_token, NULL);
+ generic_container->owner.klass = klass;
+ generic_container->is_anonymous = FALSE; // Owner class is now known, container is no longer anonymous
+ context = &generic_container->context;
+ mono_class_set_generic_container (klass, generic_container);
enable_gclass_recording ();
+ }
if (cols [MONO_TYPEDEF_EXTENDS]) {
MonoClass *tmp;
mono_class_set_failure_and_error (klass, error, "Cycle found while resolving parent");
goto parent_failure;
}
- if (klass->generic_container && mono_class_is_ginst (tmp) && mono_class_get_generic_class (tmp)->container_class == klass) {
+ if (mono_class_is_gtd (klass) && mono_class_is_ginst (tmp) && mono_class_get_generic_class (tmp)->container_class == klass) {
mono_class_set_failure_and_error (klass, error, "Parent extends generic instance of this type");
goto parent_failure;
}
/* uses ->valuetype, which is initialized by mono_class_setup_parent above */
mono_class_setup_mono_type (klass);
- if (klass->generic_container)
+ if (mono_class_is_gtd (klass))
disable_gclass_recording (fix_gclass_incomplete_instantiation, klass);
/*
* We must do this after the class has been constructed to make certain recursive scenarios
* work.
*/
- if (klass->generic_container && !mono_metadata_load_generic_param_constraints_checked (image, type_token, klass->generic_container, error)) {
+ if (mono_class_is_gtd (klass) && !mono_metadata_load_generic_param_constraints_checked (image, type_token, mono_class_get_generic_container (klass), error)) {
mono_class_set_type_load_failure (klass, "Could not load generic parameter constrains due to %s", mono_error_get_message (error));
mono_loader_unlock ();
mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED);
klass->this_arg = klass->byval_arg;
klass->this_arg.byref = 1;
- klass->generic_container = eclass->generic_container;
+ //WTF was this? it's wrong
+ // klass->generic_container = eclass->generic_container;
if (rank == 1 && !bounded) {
MonoClass *prev_class;
if (!mono_class_is_ginst (klass))
return FALSE;
- container = mono_class_get_generic_class (klass)->container_class->generic_container;
+ container = mono_class_get_generic_container (mono_class_get_generic_class (klass)->container_class);
for (i = 0; i < container->type_argc; ++i)
if (mono_generic_container_get_param_info (container, i)->flags & (MONO_GEN_PARAM_VARIANT|MONO_GEN_PARAM_COVARIANT))
int j;
MonoType **klass_argv, **oklass_argv;
MonoClass *klass_gtd = mono_class_get_generic_type_definition (klass);
- MonoGenericContainer *container = klass_gtd->generic_container;
+ MonoGenericContainer *container = mono_class_get_generic_container (klass_gtd);
if (klass == oklass)
return TRUE;
int j;
MonoType **klass_argv, **oklass_argv;
MonoClass *klass_gtd = mono_class_get_generic_type_definition (klass);
- MonoGenericContainer *container = klass_gtd->generic_container;
+ MonoGenericContainer *container = mono_class_get_generic_container (klass_gtd);
/*Viable candidates are instances of the same generic interface*/
if (mono_class_get_generic_type_definition (oklass) != klass_gtd || oklass == klass_gtd)
MonoGenericClass *access_gklass = mono_class_try_get_generic_class (access_klass);
if (((access_gklass && access_gklass->container_class) ||
- access_klass->generic_container) &&
+ mono_class_is_gtd (access_klass)) &&
(member_generic_def = get_generic_definition_class (member_klass))) {
MonoClass *access_container;
- if (access_klass->generic_container)
+ if (mono_class_is_gtd (access_klass))
access_container = access_klass;
else
access_container = access_gklass->container_class;
gboolean
mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass)
{
- return gklass->context.class_inst == gklass->container_class->generic_container->context.class_inst;
+ return gklass->context.class_inst == mono_class_get_generic_container (gklass->container_class)->context.class_inst;
}
/*
/*FIXME, in theory we do not lazy load SRE fields*/
g_assert (!image_is_dynamic (image));
- if (klass->generic_container) {
- container = klass->generic_container;
+ if (mono_class_is_gtd (klass)) {
+ container = mono_class_get_generic_container (klass);
} else if (gtd) {
- container = gtd->generic_container;
+ container = mono_class_get_generic_container (gtd);
g_assert (container);
}
klass = mono_class_from_mono_type (handle);
MONO_CHECK_ARG (handle, klass,);
- if (klass->generic_container)
+ if (mono_class_is_gtd (klass))
return;
vtable = mono_class_vtable_full (mono_domain_get (), klass, &error);
int i;
MonoGenericClass *gklass = mono_class_try_get_generic_class (klass);
- if (klass->generic_container ||
+ if (mono_class_is_gtd (klass) ||
(gklass && gklass->context.class_inst->is_open))
return NULL;
klass = mono_class_from_mono_type (type->type);
- if (klass->generic_container) {
- MonoGenericContainer *container = klass->generic_container;
+ if (mono_class_is_gtd (klass)) {
+ MonoGenericContainer *container = mono_class_get_generic_container (klass);
res = create_type_array (domain, runtimeTypeArray, container->type_argc, &error);
if (mono_error_set_pending_exception (&error))
return NULL;
return FALSE;
klass = mono_class_from_mono_type (type->type);
- return klass->generic_container != NULL;
+ return mono_class_is_gtd (klass);
}
ICALL_EXPORT MonoReflectionType*
klass = mono_class_from_mono_type (type->type);
- if (klass->generic_container) {
+ if (mono_class_is_gtd (klass)) {
return type; /* check this one */
}
if (mono_class_is_ginst (klass)) {
return FALSE;
klass = mono_class_from_mono_type (type->type);
- return mono_class_is_ginst (klass) || klass->generic_container != NULL;
+ return mono_class_is_ginst (klass) || mono_class_is_gtd (klass);
}
ICALL_EXPORT gint32
ctx.class_inst = inflated->context.class_inst;
if (mono_class_is_ginst (klass))
ctx.class_inst = mono_class_get_generic_class (klass)->context.class_inst;
- else if (klass->generic_container)
- ctx.class_inst = klass->generic_container->context.class_inst;
+ else if (mono_class_is_gtd (klass))
+ ctx.class_inst = mono_class_get_generic_container (klass)->context.class_inst;
result = mono_class_inflate_generic_method_full_checked (inflated->declaring, klass, &ctx, &error);
g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
return result;
}
}
- if (field && field->parent && !mono_class_is_ginst (field->parent) && !field->parent->generic_container) {
+ if (field && field->parent && !mono_class_is_ginst (field->parent) && !mono_class_is_gtd (field->parent)) {
mono_image_lock (image);
mono_conc_hashtable_insert (image->field_cache, GUINT_TO_POINTER (token), field);
mono_image_unlock (image);
sig = mono_metadata_blob_heap (image, cols [4]);
/* size = */ mono_metadata_decode_blob_size (sig, &sig);
- container = klass->generic_container;
+ container = mono_class_try_get_generic_container (klass);
/*
* load_generic_params does a binary search so only call it if the method
g_assert (!mono_class_is_ginst (m->klass));
container = mono_method_get_generic_container (m);
if (!container)
- container = m->klass->generic_container;
+ container = mono_class_try_get_generic_container (m->klass);
/* Generic signatures depend on the container so they cannot be cached */
/* icall/pinvoke signatures cannot be cached cause we modify them below */
*/
container = mono_method_get_generic_container (method);
if (!container)
- container = method->klass->generic_container;
+ container = mono_class_try_get_generic_container (method->klass);
return mono_metadata_parse_mh_full (img, container, (const char *)loc, error);
}
container = mono_method_get_generic_container (method);
if (!container)
- container = method->klass->generic_container;
+ container = mono_class_try_get_generic_container (method->klass); //FIXME is this a case of a try?
g_assert (container);
invoke_sig = sig = mono_signature_no_pinvoke (method);
method = ((MonoMethodInflated*)method)->declaring;
container = mono_method_get_generic_container (method);
if (!container)
- container = method->klass->generic_container;
+ container = mono_class_try_get_generic_container (method->klass); //FIXME is this a case of a try?
g_assert (container);
}
method = ((MonoMethodInflated*)method)->declaring;
container = mono_method_get_generic_container (method);
if (!container)
- container = method->klass->generic_container;
+ container = mono_class_try_get_generic_container (method->klass); //FIXME is this a case of a try?
g_assert (container);
}
static gboolean
mono_metadata_is_type_builder_generic_type_definition (MonoClass *container_class, MonoGenericInst *inst, gboolean is_dynamic)
{
- MonoGenericContainer *container = container_class->generic_container;
+ MonoGenericContainer *container = mono_class_get_generic_container (container_class);
if (!is_dynamic || container_class->wastypebuilder || container->type_argc != inst->type_argc)
return FALSE;
gclass->context.class_inst = inst;
gclass->context.method_inst = NULL;
gclass->owner = set;
- if (inst == container_class->generic_container->context.class_inst && !is_tb_open)
+ if (inst == mono_class_get_generic_container (container_class)->context.class_inst && !is_tb_open)
gclass->cached_class = container_class;
g_hash_table_insert (set->gclass_cache, gclass, gclass);
return FALSE;
gklass = mono_class_from_mono_type (gtype);
- if (!gklass->generic_container) {
+ if (!mono_class_is_gtd (gklass)) {
mono_error_set_bad_image (error, m, "Generic instance with non-generic definition");
return FALSE;
}
_mono_metadata_generic_class_container_equal (const MonoGenericClass *g1, MonoClass *c2, gboolean signature_only)
{
MonoGenericInst *i1 = g1->context.class_inst;
- MonoGenericInst *i2 = c2->generic_container->context.class_inst;
+ MonoGenericInst *i2 = mono_class_get_generic_container (c2)->context.class_inst;
if (!mono_metadata_class_equal (g1->container_class, c2, signature_only))
return FALSE;
return TRUE;
if (mono_class_is_ginst (c1) && mono_class_is_ginst (c2))
return _mono_metadata_generic_class_equal (mono_class_get_generic_class (c1), mono_class_get_generic_class (c2), signature_only);
- if (mono_class_is_ginst (c1) && c2->generic_container)
+ if (mono_class_is_ginst (c1) && mono_class_is_gtd (c2))
return _mono_metadata_generic_class_container_equal (mono_class_get_generic_class (c1), c2, signature_only);
- if (c1->generic_container && mono_class_is_ginst (c2))
+ if (mono_class_is_gtd (c1) && mono_class_is_ginst (c2))
return _mono_metadata_generic_class_container_equal (mono_class_get_generic_class (c2), c1, signature_only);
if ((c1->byval_arg.type == MONO_TYPE_VAR) && (c2->byval_arg.type == MONO_TYPE_VAR))
return mono_metadata_generic_param_equal_internal (
ji = mono_jit_info_table_find (mono_get_root_domain (), (char *)mono_get_addr_from_ftnptr (addr));
if (ji) {
method = mono_jit_info_get_method (ji);
- g_assert (!method->klass->generic_container);
+ g_assert (!mono_class_is_gtd (method->klass));
}
return mono_delegate_ctor_with_method (this_obj, target, addr, method, error);
return type;
gtd = gclass->container_class;
- gcontainer = gtd->generic_container;
+ gcontainer = mono_class_get_generic_container (gtd);
argv = g_newa (MonoType*, ginst->type_argc);
for (i = 0; i < ginst->type_argc; ++i) {
}
klass = mono_class_from_mono_type (t);
- if (!klass->generic_container) {
+ if (!mono_class_is_gtd (klass)) {
mono_loader_unlock ();
mono_error_set_type_load_class (error, klass, "Cannot bind generic parameters of a non-generic type");
return NULL;
MonoGenericClass *gclass;
MonoGenericInst *inst;
- g_assert (klass->generic_container);
+ g_assert (mono_class_is_gtd (klass));
inst = mono_metadata_get_generic_inst (type_argc, types);
gclass = mono_metadata_lookup_generic_class (klass, inst, is_dynamic);
case MONO_TYPE_CLASS: {
MonoClass *k = mono_class_from_mono_type (type);
- if (k->generic_container) {
- MonoGenericClass *gclass = mono_metadata_lookup_generic_class (k, k->generic_container->context.class_inst, TRUE);
+ if (mono_class_is_gtd (k)) {
+ MonoGenericClass *gclass = mono_metadata_lookup_generic_class (k, mono_class_get_generic_container (k)->context.class_inst, TRUE);
encode_generic_class (assembly, gclass, buf);
} else {
/*
goto fail;
/* encode custom attributes before the type */
- if (klass->generic_container)
+ if (mono_class_is_gtd (klass))
typespec = create_typespec (assembly, type);
if (typespec) {
MonoGenericClass *gclass;
- gclass = mono_metadata_lookup_generic_class (klass, klass->generic_container->context.class_inst, TRUE);
+ gclass = mono_metadata_lookup_generic_class (klass, mono_class_get_generic_container (klass)->context.class_inst, TRUE);
encode_generic_class (assembly, gclass, &buf);
} else {
encode_type (assembly, type, &buf);
case MONO_TYPE_CLASS:
case MONO_TYPE_VALUETYPE: {
MonoClass *k = mono_class_from_mono_type (type);
- if (!k || !k->generic_container) {
+ if (!k || !mono_class_is_gtd (k)) {
sigbuffer_free (&buf);
return 0;
}
} else if (!strcmp (iltoken->member->vtable->klass->name, "MonoMethod") ||
!strcmp (iltoken->member->vtable->klass->name, "MonoCMethod")) {
MonoMethod *m = ((MonoReflectionMethod*)iltoken->member)->method;
- g_assert (mono_class_is_ginst (m->klass) || m->klass->generic_container);
+ g_assert (mono_class_is_ginst (m->klass) || mono_class_is_gtd (m->klass));
continue;
} else if (!strcmp (iltoken->member->vtable->klass->name, "FieldBuilder")) {
g_assert_not_reached ();
return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_REFLECTION);
ta = klass->image->assembly;
if (assembly_is_dynamic (ta) || (ta == ass)) {
- if (mono_class_is_ginst (klass) || klass->generic_container)
+ if (mono_class_is_ginst (klass) || mono_class_is_gtd (klass))
/* For generic type definitions, we want T, while REFLECTION returns T<K> */
return mono_type_get_name_full (type, MONO_TYPE_NAME_FORMAT_FULL_NAME);
else
return_val_if_nok (error, 0);
MonoClass *mc = mono_class_from_mono_type (type);
token = mono_metadata_token_from_dor (
- mono_dynimage_encode_typedef_or_ref_full (assembly, type, mc->generic_container == NULL || create_open_instance));
+ mono_dynimage_encode_typedef_or_ref_full (assembly, type, !mono_class_is_gtd (mc) || create_open_instance));
} else if (strcmp (klass->name, "MonoCMethod") == 0 ||
strcmp (klass->name, "MonoMethod") == 0) {
MonoReflectionMethod *m = (MonoReflectionMethod *)obj;
MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)(gparam->tbuilder), error);
mono_error_assert_ok (error);
MonoClass *owner = mono_class_from_mono_type (type);
- g_assert (owner->generic_container);
- param->param.owner = owner->generic_container;
+ g_assert (mono_class_is_gtd (owner));
+ param->param.owner = mono_class_get_generic_container (owner);
}
pklass = mono_class_from_generic_parameter_internal ((MonoGenericParam *) param);
return TRUE;
}
+ /*
+ * The size calculation here warrants some explaining.
+ * reflection_setup_internal_class is called too early, well before we know whether the type will be a GTD or DEF,
+ * meaning we need to alloc enough space to morth a def into a gtd.
+ */
klass = (MonoClass *)mono_image_alloc0 (&tb->module->dynamic_image->image, MAX (sizeof (MonoClassDef), sizeof (MonoClassGtd)));
klass->class_kind = MONO_CLASS_DEF;
if (count == 0)
return TRUE;
- klass->generic_container = (MonoGenericContainer *)mono_image_alloc0 (klass->image, sizeof (MonoGenericContainer));
+ MonoGenericContainer *generic_container = (MonoGenericContainer *)mono_image_alloc0 (klass->image, sizeof (MonoGenericContainer));
- klass->generic_container->owner.klass = klass;
- klass->generic_container->type_argc = count;
- klass->generic_container->type_params = (MonoGenericParamFull *)mono_image_alloc0 (klass->image, sizeof (MonoGenericParamFull) * count);
+ generic_container->owner.klass = klass;
+ generic_container->type_argc = count;
+ generic_container->type_params = (MonoGenericParamFull *)mono_image_alloc0 (klass->image, sizeof (MonoGenericParamFull) * count);
klass->class_kind = MONO_CLASS_GTD;
+ mono_class_set_generic_container (klass, generic_container);
+
for (i = 0; i < count; i++) {
MonoReflectionGenericParam *gparam = (MonoReflectionGenericParam *)mono_array_get (tb->generic_params, gpointer, i);
MonoType *param_type = mono_reflection_type_get_handle ((MonoReflectionType*)gparam, error);
return_val_if_nok (error, FALSE);
MonoGenericParamFull *param = (MonoGenericParamFull *) param_type->data.generic_param;
- klass->generic_container->type_params [i] = *param;
+ generic_container->type_params [i] = *param;
/*Make sure we are a diferent type instance */
- klass->generic_container->type_params [i].param.owner = klass->generic_container;
- klass->generic_container->type_params [i].info.pklass = NULL;
- klass->generic_container->type_params [i].info.flags = gparam->attrs;
+ generic_container->type_params [i].param.owner = generic_container;
+ generic_container->type_params [i].info.pklass = NULL;
+ generic_container->type_params [i].info.flags = gparam->attrs;
- g_assert (klass->generic_container->type_params [i].param.owner);
+ g_assert (generic_container->type_params [i].param.owner);
}
- klass->generic_container->context.class_inst = mono_get_shared_generic_inst (klass->generic_container);
+ generic_container->context.class_inst = mono_get_shared_generic_inst (generic_container);
return TRUE;
}
}
}
- if (klass->generic_container) {
- container->parent = klass->generic_container;
- container->context.class_inst = klass->generic_container->context.class_inst;
+ if (mono_class_is_gtd (klass)) {
+ container->parent = mono_class_get_generic_container (klass);
+ container->context.class_inst = mono_class_get_generic_container (klass)->context.class_inst;
}
container->context.method_inst = mono_get_shared_generic_inst (container);
}
*
* Together with this we must ensure the contents of all instances to match the created type.
*/
- if (domain->type_hash && klass->generic_container) {
+ if (domain->type_hash && mono_class_is_gtd (klass)) {
struct remove_instantiations_user_data data;
data.klass = klass;
data.error = &error;
if (klass->byval_arg.type != type->type)
return mono_type_is_valid_type_in_context_full (&klass->byval_arg, context, check_gtd);
- if (check_gtd && klass->generic_container)
+ if (check_gtd && mono_class_is_gtd (klass))
return FALSE;
break;
}
* The type A <K> has a parent B<K>, that is inflated into the GTD B<>.
* Since A<K> is open, thus not instantiatable, this is valid.
*/
- if (paramClass->generic_container && param_type->type != MONO_TYPE_GENERICINST && !ginst->is_open)
+ if (mono_class_is_gtd (paramClass) && param_type->type != MONO_TYPE_GENERICINST && !ginst->is_open)
return FALSE;
/*it's not safe to call mono_class_init from here*/
MonoClass *gtd = method->klass;
if (mono_class_is_ginst (gtd))
gtd = mono_class_get_generic_class (gtd)->container_class;
- gc = gtd->generic_container;
+ gc = mono_class_try_get_generic_container (gtd);
} else { //MVAR
MonoMethod *gmd = method;
if (method->is_inflated)
{
MonoGenericClass *gklass = mono_class_get_generic_class (klass);
MonoGenericInst *ginst = gklass->context.class_inst;
- MonoGenericContainer *gc = gklass->container_class->generic_container;
+ MonoGenericContainer *gc = mono_class_get_generic_container (gklass->container_class);
return !gc || generic_arguments_respect_constraints (ctx, gc, &gklass->context, ginst);
}
{
MonoGenericClass *gklass = mono_class_get_generic_class (klass);
MonoGenericInst *ginst = gklass->context.class_inst;
- MonoGenericContainer *gc = gklass->container_class->generic_container;
+ MonoGenericContainer *gc = mono_class_get_generic_container (gklass->container_class);
if (ctx && !is_valid_generic_instantiation_in_context (ctx, ginst, TRUE))
return FALSE;
return is_valid_generic_instantiation (gc, &gklass->context, ginst);
if (!(klass = mono_class_from_mono_type (type)))
ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Could not retrieve type token for %s at 0x%04x", opcode, ctx->ip_offset));
- if (klass->generic_container && type->type != MONO_TYPE_GENERICINST)
+ if (mono_class_is_gtd (klass) && type->type != MONO_TYPE_GENERICINST)
CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Cannot use the generic type definition in a boxable type position for %s at 0x%04x", opcode, ctx->ip_offset));
check_unverifiable_type (ctx, type);
if (ctx.signature->is_inflated)
ctx.generic_context = generic_context = mono_method_get_context (method);
- if (!generic_context && (method->klass->generic_container || method->is_generic)) {
+ if (!generic_context && (mono_class_is_gtd (method->klass) || method->is_generic)) {
if (method->is_generic)
ctx.generic_context = generic_context = &(mono_method_get_generic_container (method)->context);
else
- ctx.generic_context = generic_context = &method->klass->generic_container->context;
+ ctx.generic_context = generic_context = &mono_class_get_generic_container (method->klass)->context;
}
for (i = 0; i < ctx.num_locals; ++i) {
MonoClassField *field;
MonoGenericContext *context = mono_class_get_context (klass);
GHashTable *unique_fields = g_hash_table_new_full (&field_hash, &field_equals, NULL, NULL);
- if (klass->generic_container)
- context = &klass->generic_container->context;
+ if (mono_class_is_gtd (klass))
+ context = &mono_class_get_generic_container (klass)->context;
while ((field = mono_class_get_fields (klass, &iter)) != NULL) {
if (!mono_type_is_valid_type_in_context (field->type, context)) {
verify_generic_parameters (MonoClass *klass)
{
int i;
- MonoGenericContainer *gc = klass->generic_container;
+ MonoGenericContainer *gc = mono_class_get_generic_container (klass);
MonoBitSet *used_args = mono_bitset_new (gc->type_argc, 0);
for (i = 0; i < gc->type_argc; ++i) {
if (klass->parent) {
if (MONO_CLASS_IS_INTERFACE (klass->parent))
return FALSE;
- if (!mono_class_is_ginst (klass) && klass->parent->generic_container)
+ if (!mono_class_is_ginst (klass) && mono_class_is_gtd (klass->parent))
return FALSE;
if (mono_class_is_ginst (klass->parent) && !mono_class_is_ginst (klass)) {
MonoGenericContext *context = mono_class_get_context (klass);
- if (klass->generic_container)
- context = &klass->generic_container->context;
+ if (mono_class_is_gtd (klass))
+ context = &mono_class_get_generic_container (klass)->context;
if (!mono_type_is_valid_type_in_context (&klass->parent->byval_arg, context))
return FALSE;
}
}
- if (klass->generic_container && (mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT)
+ if (mono_class_is_gtd (klass) && (mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT)
return FALSE;
- if (klass->generic_container && !verify_generic_parameters (klass))
+ if (mono_class_is_gtd (klass) && !verify_generic_parameters (klass))
return FALSE;
if (!verify_class_for_overlapping_reference_fields (klass))
return FALSE;
memset (ctx, 0, sizeof (MonoGenericContext));
- if (method->klass->generic_container) {
- shared_context = method->klass->generic_container->context;
+ if (mono_class_is_gtd (method->klass)) {
+ shared_context = mono_class_get_generic_container (method->klass)->context;
inst = shared_context.class_inst;
args = g_new0 (MonoType*, inst->type_argc);
if (!klass->delegate || klass == mono_defaults.delegate_class || klass == mono_defaults.multicastdelegate_class)
continue;
- if (!klass->generic_container) {
+ if (!mono_class_is_gtd (klass)) {
method = mono_get_delegate_invoke (klass);
m = mono_marshal_get_delegate_invoke (method, NULL);
add_method (acfg, del_invoke);
}
}
- } else if ((acfg->opts & MONO_OPT_GSHAREDVT) && klass->generic_container) {
+ } else if ((acfg->opts & MONO_OPT_GSHAREDVT) && mono_class_is_gtd (klass)) {
MonoError error;
MonoGenericContext ctx;
MonoMethod *inst, *gshared;
if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
if (method->is_generic) {
// FIXME:
- } else if ((acfg->opts & MONO_OPT_GSHAREDVT) && method->klass->generic_container) {
+ } else if ((acfg->opts & MONO_OPT_GSHAREDVT) && mono_class_is_gtd (method->klass)) {
MonoError error;
MonoGenericContext ctx;
MonoMethod *inst, *gshared, *m;
continue;
}
- if (klass->valuetype && !klass->generic_container && can_marshal_struct (klass) &&
+ if (klass->valuetype && !mono_class_is_gtd (klass) && can_marshal_struct (klass) &&
!(klass->nested_in && strstr (klass->nested_in->name, "<PrivateImplementationDetails>") == klass->nested_in->name)) {
add_method (acfg, mono_marshal_get_struct_to_ptr (klass));
add_method (acfg, mono_marshal_get_ptr_to_struct (klass));
return TRUE;
}
}
- if (klass->generic_container)
+ if (mono_class_is_gtd (klass))
return TRUE;
return FALSE;
}
g_free (type_argv);
}
- if (method->is_generic || method->klass->generic_container)
+ if (method->is_generic || mono_class_is_gtd (method->klass))
declaring_method = method;
else
declaring_method = mono_method_get_declaring_generic_method (method);
mono_class_has_finalizer (klass);
- if (klass->generic_container || cant_encode) {
+ if (mono_class_is_gtd (klass) || cant_encode) {
encode_value (-1, p, &p);
} else {
encode_value (klass->vtable_size, p, &p);
- encode_value ((klass->generic_container ? (1 << 8) : 0) | (no_special_static << 7) | (klass->has_static_refs << 6) | (klass->has_references << 5) | ((klass->blittable << 4) | ((klass->ext && klass->ext->nested_classes) ? 1 : 0) << 3) | (klass->has_cctor << 2) | (klass->has_finalize << 1) | klass->ghcimpl, p, &p);
+ encode_value ((mono_class_is_gtd (klass) ? (1 << 8) : 0) | (no_special_static << 7) | (klass->has_static_refs << 6) | (klass->has_references << 5) | ((klass->blittable << 4) | ((klass->ext && klass->ext->nested_classes) ? 1 : 0) << 3) | (klass->has_cctor << 2) | (klass->has_finalize << 1) | klass->ghcimpl, p, &p);
if (klass->has_cctor)
encode_method_ref (acfg, mono_class_get_cctor (klass), p, &p);
if (klass->has_finalize)
InterlockedIncrement (&acfg->stats.mcount);
#if 0
- if (method->is_generic || method->klass->generic_container) {
+ if (method->is_generic || mono_class_is_gtd (method->klass)) {
InterlockedIncrement (&acfg->stats.genericcount);
return;
}
}
*/
- if (method->is_generic || method->klass->generic_container)
+ if (method->is_generic || mono_class_is_gtd (method->klass))
/* Compile the ref shared version instead */
method = mini_get_shared_method (method);
method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error));
- if (method->is_generic || method->klass->generic_container) {
+ if (method->is_generic || mono_class_is_gtd (method->klass)) {
MonoMethod *gshared;
gshared = mini_get_shared_method_full (method, TRUE, TRUE);
gclass = decode_klass_ref (module, p, &p, error);
if (!gclass)
return NULL;
- g_assert (gclass->generic_container);
+ g_assert (mono_class_is_gtd (gclass));
memset (&ctx, 0, sizeof (ctx));
ctx.class_inst = decode_generic_inst (module, p, &p, error);
if (!class_def)
return NULL;
- container = class_def->generic_container;
+ container = mono_class_try_get_generic_container (class_def); //FIXME is this a case for a try_get?
}
} else {
// We didn't decode is_method, so we have to infer it from type enum.
gclass = decode_klass_ref (module, p, &p, error);
if (!gclass)
goto fail;
- g_assert (gclass->generic_container);
+ g_assert (mono_class_is_gtd (gclass));
memset (&ctx, 0, sizeof (ctx));
ctx.class_inst = decode_generic_inst (module, p, &p, error);
gboolean inited_ok = TRUE;
if (init_class)
inited_ok = mono_runtime_class_init_full (mono_class_vtable (domain, init_class), error);
- else if (from_plt && klass_to_run_ctor && !klass_to_run_ctor->generic_container)
+ else if (from_plt && klass_to_run_ctor && !mono_class_is_gtd (klass_to_run_ctor))
inited_ok = mono_runtime_class_init_full (mono_class_vtable (domain, klass_to_run_ctor), error);
if (!inited_ok)
return FALSE;
if (mono_class_is_ginst (klass))
context.class_inst = mono_class_get_generic_class (klass)->context.class_inst;
- else if (klass->generic_container)
- context.class_inst = klass->generic_container->context.class_inst;
+ else if (mono_class_is_gtd (klass))
+ context.class_inst = mono_class_get_generic_container (klass)->context.class_inst;
context.method_inst = rgctx->method_inst;
init_llvmonly_method (amodule, method_index, NULL, rgctx->class_vtable->klass, &context);
b |= (1 << 3);
if (klass->enumtype)
b |= (1 << 4);
- if (klass->generic_container)
+ if (mono_class_is_gtd (klass))
b |= (1 << 5);
- if (klass->generic_container || mono_class_is_ginst (klass))
+ if (mono_class_is_gtd (klass) || mono_class_is_ginst (klass))
b |= (1 << 6);
buffer_add_byte (buf, b);
nnested = 0;
while ((nested = mono_class_get_nested_types (klass, &iter)))
buffer_add_typeid (buf, domain, nested);
if (CHECK_PROTOCOL_VERSION (2, 12)) {
- if (klass->generic_container)
+ if (mono_class_is_gtd (klass))
buffer_add_typeid (buf, domain, klass);
else if (mono_class_is_ginst (klass))
buffer_add_typeid (buf, domain, mono_class_get_generic_class (klass)->container_class);
buffer_add_int (buf, count);
for (i = 0; i < count; i++)
buffer_add_typeid (buf, domain, mono_class_from_mono_type (inst->type_argv [i]));
- } else if (klass->generic_container) {
- MonoGenericContainer *container = klass->generic_container;
+ } else if (mono_class_is_gtd (klass)) {
+ MonoGenericContainer *container = mono_class_get_generic_container (klass);
MonoClass *pklass;
count = container->type_argc;
(method->flags & METHOD_ATTRIBUTE_ABSTRACT))
continue;
- if (method->klass->generic_container)
+ if (mono_class_is_gtd (method->klass))
continue;
sig = mono_method_signature (method);
if (!sig) {
if (mono_class_is_ginst (res->klass))
context.class_inst = mono_class_get_generic_class (res->klass)->context.class_inst;
- else if (res->klass->generic_container)
- context.class_inst = res->klass->generic_container->context.class_inst;
+ else if (mono_class_is_gtd (res->klass))
+ context.class_inst = mono_class_get_generic_container (res->klass)->context.class_inst;
context.method_inst = mono_method_get_context (method)->method_inst;
res = mono_class_inflate_generic_method_checked (res, &context, &error);
return NULL;
}
vmethod = mono_object_get_virtual_method (obj, method);
- g_assert (!vmethod->klass->generic_container);
+ g_assert (!mono_class_is_gtd (vmethod->klass));
g_assert (!mono_class_is_ginst (vmethod->klass) || !mono_class_get_generic_class (vmethod->klass)->context.class_inst->is_open);
g_assert (!context->method_inst || !context->method_inst->is_open);
if (mono_class_is_ginst (m->klass))
context.class_inst = mono_class_get_generic_class (m->klass)->context.class_inst;
else
- g_assert (!m->klass->generic_container);
+ g_assert (!mono_class_is_gtd (m->klass));
generic_virtual = imt_method;
g_assert (generic_virtual);
if (mono_class_is_ginst (m->klass))
context.class_inst = mono_class_get_generic_class (m->klass)->context.class_inst;
else
- g_assert (!m->klass->generic_container);
+ g_assert (!mono_class_is_gtd (m->klass));
g_assert (generic_virtual->is_inflated);
context.method_inst = ((MonoMethodInflated*)generic_virtual)->context.method_inst;
gboolean pass_mrgctx = FALSE;
if (((cmethod->flags & METHOD_ATTRIBUTE_STATIC) || cmethod->klass->valuetype) &&
- (mono_class_is_ginst (cmethod->klass) || cmethod->klass->generic_container)) {
+ (mono_class_is_ginst (cmethod->klass) || mono_class_is_gtd (cmethod->klass))) {
gboolean sharable = FALSE;
if (mono_method_is_generic_sharable_full (cmethod, TRUE, TRUE, TRUE))
MonoGenericInst *ginst;
if (mono_class_is_ginst (klass)) {
- container = mono_class_get_generic_class (klass)->container_class->generic_container;
+ container = mono_class_get_generic_container (mono_class_get_generic_class (klass)->container_class);
ginst = mono_class_get_generic_class (klass)->context.class_inst;
- } else if (klass->generic_container && context_used) {
- container = klass->generic_container;
+ } else if (mono_class_is_gtd (klass) && context_used) {
+ container = mono_class_get_generic_container (klass);
ginst = container->context.class_inst;
} else {
return FALSE;
n = fsig->param_count + fsig->hasthis;
- if (!cfg->gshared && cmethod->klass->generic_container)
+ if (!cfg->gshared && mono_class_is_gtd (cmethod->klass))
UNVERIFIED;
if (!cfg->gshared)
klass = vtable->klass;
}
- //g_assert (!method->klass->generic_container);
+ //g_assert (!mono_class_is_gtd (method->klass));
if (mono_class_is_ginst (method->klass))
method_container_class = mono_class_get_generic_class (method->klass)->container_class;
else
g_assert (klass);
}
- if (mono_class_is_ginst (klass) || klass->generic_container)
+ if (mono_class_is_ginst (klass) || mono_class_is_gtd (klass))
context.class_inst = mini_class_get_context (klass)->class_inst;
if (mono_class_is_ginst (klass))
if (recursive) {
MonoGenericClass *gclass = type->data.generic_class;
- g_assert (gclass->container_class->generic_container);
+ g_assert (mono_class_is_gtd (gclass->container_class));
return mono_generic_context_check_used (&gclass->context);
} else {
return 0;
if (mono_class_is_ginst (klass))
context_used |= mono_generic_context_check_used (&mono_class_get_generic_class (klass)->context);
- else if (klass->generic_container)
- context_used |= mono_generic_context_check_used (&klass->generic_container->context);
+ else if (mono_class_is_gtd (klass))
+ context_used |= mono_generic_context_check_used (&mono_class_get_generic_container (klass)->context);
return context_used;
}
MonoMethodRuntimeGenericContext *mrgctx;
MonoMethodRuntimeGenericContext key;
- g_assert (!class_vtable->klass->generic_container);
+ g_assert (!mono_class_is_gtd (class_vtable->klass));
g_assert (!method_inst->is_open);
mono_domain_lock (domain);
if not compiled with sharing. */
if (method->wrapper_type != MONO_WRAPPER_NONE)
return FALSE;
- if (method->klass->generic_container)
+ if (mono_class_is_gtd (method->klass))
return TRUE;
return FALSE;
}
return FALSE;
g_assert (mono_class_get_generic_class (method->klass)->container_class &&
- mono_class_get_generic_class (method->klass)->container_class->generic_container);
+ mono_class_is_gtd (mono_class_get_generic_class (method->klass)->container_class));
- if (has_constraints (mono_class_get_generic_class (method->klass)->container_class->generic_container))
+ if (has_constraints (mono_class_get_generic_container (mono_class_get_generic_class (method->klass)->container_class)))
return FALSE;
}
- if (method->klass->generic_container && !allow_type_vars)
+ if (mono_class_is_gtd (method->klass) && !allow_type_vars)
return FALSE;
/* This does potentially expensive cattr checks, so do it at the end */
return ((method->flags & METHOD_ATTRIBUTE_STATIC) ||
method->klass->valuetype) &&
- (mono_class_is_ginst (method->klass) || method->klass->generic_container);
+ (mono_class_is_ginst (method->klass) || mono_class_is_gtd (method->klass));
}
static MonoGenericInst*
MonoGenericContext object_context;
g_assert (!mono_class_is_ginst (method->klass));
- if (method->klass->generic_container) {
- int type_argc = method->klass->generic_container->type_argc;
+ if (mono_class_is_gtd (method->klass)) {
+ int type_argc = mono_class_get_generic_container (method->klass)->type_argc;
object_context.class_inst = get_object_generic_inst (type_argc);
} else {
if (mono_class_is_ginst (klass))
return mono_class_get_generic_class (klass)->container_class;
- g_assert (klass->generic_container);
+ g_assert (mono_class_is_gtd (klass));
return klass;
}
if (mono_class_is_ginst (klass))
return &mono_class_get_generic_class (klass)->context;
- g_assert (klass->generic_container);
- return &klass->generic_container->context;
+ g_assert (mono_class_is_gtd (klass));
+ return &mono_class_get_generic_container (klass)->context;
}
/*
memset (&context, 0, sizeof (context));
if (gclass->context.class_inst)
- context.class_inst = get_shared_inst (gclass->context.class_inst, gclass->container_class->generic_container->context.class_inst, NULL, FALSE, FALSE, TRUE);
+ context.class_inst = get_shared_inst (gclass->context.class_inst, mono_class_get_generic_container (gclass->container_class)->context.class_inst, NULL, FALSE, FALSE, TRUE);
if (gclass->context.method_inst)
- context.method_inst = get_shared_inst (gclass->context.method_inst, gclass->container_class->generic_container->context.method_inst, NULL, FALSE, FALSE, TRUE);
+ context.method_inst = get_shared_inst (gclass->context.method_inst, mono_class_get_generic_container (gclass->container_class)->context.method_inst, NULL, FALSE, FALSE, TRUE);
k = mono_class_inflate_generic_class_checked (gclass->container_class, &context, &error);
mono_error_assert_ok (&error); /* FIXME don't swallow the error */
}
}
- if (method->is_generic || (method->klass->generic_container && !method->is_inflated)) {
+ if (method->is_generic || (mono_class_is_gtd (method->klass) && !method->is_inflated)) {
declaring_method = method;
} else {
declaring_method = mono_method_get_declaring_generic_method (method);
if (declaring_method->is_generic)
shared_context = mono_method_get_generic_container (declaring_method)->context;
else
- shared_context = declaring_method->klass->generic_container->context;
+ shared_context = mono_class_get_generic_container (declaring_method->klass)->context;
if (!is_gsharedvt)
partial = mono_method_is_generic_sharable_full (method, FALSE, TRUE, FALSE);
gsharedvt = is_gsharedvt || (!partial && mini_is_gsharedvt_sharable_method (method));
- class_container = declaring_method->klass->generic_container;
+ class_container = mono_class_try_get_generic_container (declaring_method->klass); //FIXME is this a case for a try_get?
method_container = mono_method_get_generic_container (declaring_method);
/*
}
if (method->flags & METHOD_ATTRIBUTE_ABSTRACT)
continue;
- if (method->is_generic || method->klass->generic_container)
+ if (method->is_generic || mono_class_is_gtd (method->klass))
continue;
count++;
if (mono_class_is_ginst (m->klass))
context.class_inst = mono_class_get_generic_class (m->klass)->context.class_inst;
else
- g_assert (!m->klass->generic_container);
+ g_assert (!mono_class_is_gtd (m->klass));
generic_virtual = mono_arch_find_imt_method (regs, code);
g_assert (generic_virtual);
if (mono_class_is_ginst (klass))
context.class_inst = mono_class_get_generic_class (klass)->context.class_inst;
- else if (klass->generic_container)
- context.class_inst = klass->generic_container->context.class_inst;
+ else if (mono_class_is_gtd (klass))
+ context.class_inst = mono_class_get_generic_container (klass)->context.class_inst;
context.method_inst = method_inst;
actual_method = mono_class_inflate_generic_method_checked (declaring, &context, error);
if (mono_class_is_ginst (m->klass))
context.class_inst = mono_class_get_generic_class (m->klass)->context.class_inst;
else
- g_assert (!m->klass->generic_container);
+ g_assert (!mono_class_is_gtd (m->klass));
imt_method = mono_arch_find_imt_method (regs, code);
if (imt_method->is_inflated)
gboolean is_generic = FALSE;
if (cfg->method->is_inflated || mono_method_get_generic_container (cfg->method) ||
- cfg->method->klass->generic_container || mono_class_is_ginst (cfg->method->klass)) {
+ mono_class_is_gtd (cfg->method->klass) || mono_class_is_ginst (cfg->method->klass)) {
is_generic = TRUE;
}
cfg->seq_points = g_ptr_array_new ();
mono_error_init (&cfg->error);
- if (cfg->compile_aot && !try_generic_shared && (method->is_generic || method->klass->generic_container || method_is_gshared)) {
+ if (cfg->compile_aot && !try_generic_shared && (method->is_generic || mono_class_is_gtd (method->klass) || method_is_gshared)) {
cfg->exception_type = MONO_EXCEPTION_GENERIC_SHARING_FAILED;
return cfg;
}