* Contains information about the type arguments for generic shared methods.
*/
typedef struct {
- /*
- * If not NULL, determines whenever the class type arguments of the gshared method are references or vtypes.
- * The array length is equal to class_inst->type_argv.
- */
- gboolean *var_is_vt;
- /* Same for method type parameters */
- gboolean *mvar_is_vt;
+ gboolean is_gsharedvt;
} MonoGenericSharingContext;
/* Simplified DWARF location list entry */
p += p2 - buf2;
g_free (buf2);
- if (gsctx && (gsctx->var_is_vt || gsctx->mvar_is_vt)) {
- MonoMethodInflated *inflated;
- MonoGenericContext *context;
- MonoGenericInst *inst;
-
- g_assert (jinfo->d.method->is_inflated);
- inflated = (MonoMethodInflated*)jinfo->d.method;
- context = &inflated->context;
-
+ if (gsctx && gsctx->is_gsharedvt) {
encode_value (1, p, &p);
- if (context->class_inst) {
- inst = context->class_inst;
-
- encode_value (inst->type_argc, p, &p);
- for (i = 0; i < inst->type_argc; ++i)
- encode_value (gsctx->var_is_vt [i], p, &p);
- } else {
- encode_value (0, p, &p);
- }
- if (context->method_inst) {
- inst = context->method_inst;
-
- encode_value (inst->type_argc, p, &p);
- for (i = 0; i < inst->type_argc; ++i)
- encode_value (gsctx->mvar_is_vt [i], p, &p);
- } else {
- encode_value (0, p, &p);
- }
} else {
encode_value (0, p, &p);
}
gi->generic_sharing_context = g_new0 (MonoGenericSharingContext, 1);
if (decode_value (p, &p)) {
/* gsharedvt */
- int i, n;
MonoGenericSharingContext *gsctx = gi->generic_sharing_context;
- n = decode_value (p, &p);
- if (n) {
- gsctx->var_is_vt = alloc0_jit_info_data (domain, sizeof (gboolean) * n, async);
- for (i = 0; i < n; ++i)
- gsctx->var_is_vt [i] = decode_value (p, &p);
- }
- n = decode_value (p, &p);
- if (n) {
- gsctx->mvar_is_vt = alloc0_jit_info_data (domain, sizeof (gboolean) * n, async);
- for (i = 0; i < n; ++i)
- gsctx->mvar_is_vt [i] = decode_value (p, &p);
- }
+ gsctx->is_gsharedvt = TRUE;
}
}
static gboolean
ji_is_gsharedvt (MonoJitInfo *ji)
{
- if (ji && ji->has_generic_jit_info && (mono_jit_info_get_generic_sharing_context (ji)->var_is_vt ||
- mono_jit_info_get_generic_sharing_context (ji)->mvar_is_vt))
+ if (ji && ji->has_generic_jit_info && (mono_jit_info_get_generic_sharing_context (ji)->is_gsharedvt))
return TRUE;
else
return FALSE;
gboolean
mini_type_var_is_vt (MonoCompile *cfg, MonoType *type)
{
- if (type->type == MONO_TYPE_VAR) {
- if (cfg->generic_sharing_context->var_is_vt && cfg->generic_sharing_context->var_is_vt [type->data.generic_param->num])
- return TRUE;
- else
- return FALSE;
- } else if (type->type == MONO_TYPE_MVAR) {
- if (cfg->generic_sharing_context->mvar_is_vt && cfg->generic_sharing_context->mvar_is_vt [type->data.generic_param->num])
- return TRUE;
- else
- return FALSE;
+ if (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR) {
+ return type->data.generic_param->gshared_constraint && type->data.generic_param->gshared_constraint->type == MONO_TYPE_VALUETYPE;
} else {
g_assert_not_reached ();
+ return FALSE;
}
- return FALSE;
}
gboolean
gsctx = mono_jit_info_get_generic_sharing_context (ji);
shared_type = "";
if (gsctx) {
- if (gsctx->var_is_vt || gsctx->mvar_is_vt)
+ if (gsctx->is_gsharedvt)
shared_type = "gsharedvt ";
else
shared_type = "gshared ";
if (context && context->class_inst) {
inst = context->class_inst;
- if (domain)
- gsctx->var_is_vt = mono_domain_alloc0 (domain, sizeof (gboolean) * inst->type_argc);
- else if (mp)
- gsctx->var_is_vt = mono_mempool_alloc0 (mp, sizeof (gboolean) * inst->type_argc);
- else
- gsctx->var_is_vt = g_new0 (gboolean, inst->type_argc);
-
for (i = 0; i < inst->type_argc; ++i) {
MonoType *type = inst->type_argv [i];
if (mini_is_gsharedvt_gparam (type))
- gsctx->var_is_vt [i] = TRUE;
+ gsctx->is_gsharedvt = TRUE;
}
}
if (context && context->method_inst) {
inst = context->method_inst;
- if (domain)
- gsctx->mvar_is_vt = mono_domain_alloc0 (domain, sizeof (gboolean) * inst->type_argc);
- else if (mp)
- gsctx->mvar_is_vt = mono_mempool_alloc0 (mp, sizeof (gboolean) * inst->type_argc);
- else
- gsctx->mvar_is_vt = g_new0 (gboolean, inst->type_argc);
for (i = 0; i < inst->type_argc; ++i) {
MonoType *type = inst->type_argv [i];
if (mini_is_gsharedvt_gparam (type))
- gsctx->mvar_is_vt [i] = TRUE;
+ gsctx->is_gsharedvt = TRUE;
}
}
}
gboolean
mini_jit_info_is_gsharedvt (MonoJitInfo *ji)
{
- if (ji && ji->has_generic_jit_info && (mono_jit_info_get_generic_sharing_context (ji)->var_is_vt ||
- mono_jit_info_get_generic_sharing_context (ji)->mvar_is_vt))
+ if (ji && ji->has_generic_jit_info && (mono_jit_info_get_generic_sharing_context (ji)->is_gsharedvt))
return TRUE;
else
return FALSE;
MonoJitInfo *ji = mini_jit_info_table_find (mono_domain_get (), RETURN_ADDRESS (), NULL);
if (ji) {
gsctx = mono_jit_info_get_generic_sharing_context (ji);
- if (gsctx && (gsctx->var_is_vt || gsctx->mvar_is_vt)) {
+ if (gsctx && gsctx->is_gsharedvt) {
/* Needs a ctx to get precise method */
printf (") <gsharedvt>\n");
return;
MonoJitInfo *ji = mini_jit_info_table_find (mono_domain_get (), RETURN_ADDRESS (), NULL);
if (ji) {
gsctx = mono_jit_info_get_generic_sharing_context (ji);
- if (gsctx && (gsctx->var_is_vt || gsctx->mvar_is_vt)) {
+ if (gsctx && gsctx->is_gsharedvt) {
/* Needs a ctx to get precise method */
printf (") <gsharedvt>\n");
return;