[jit] Get rid of MonoGenericSharingContext->var_is_vt/mvar_is_vt, they are not needed...
authorZoltan Varga <vargaz@gmail.com>
Tue, 16 Jun 2015 01:57:02 +0000 (21:57 -0400)
committerZoltan Varga <vargaz@gmail.com>
Tue, 16 Jun 2015 01:57:02 +0000 (21:57 -0400)
mono/metadata/domain-internals.h
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/mini-generic-sharing.c
mono/mini/mini-runtime.c
mono/mini/mini-trampolines.c
mono/mini/trace.c

index db0421ec9ffbab9d2b9a6f2ba9d502672a06268b..8edf619c8d5b80df1c07177f10cfdbf1424d5685 100644 (file)
@@ -100,13 +100,7 @@ typedef struct {
  * 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 */
index 1aa05636260fa141ce57f393098e229ac5b3c660..a2f8a8acb0a3c564101cbac73b13a7c391eadcc8 100644 (file)
@@ -5713,34 +5713,8 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg, gboolean stor
                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);
                }
index 63e184e5945671ced4eee67bc21c1e9b5ca27abb..75f332eb9e45a54d314d4c95975b704f249572a2 100644 (file)
@@ -2841,21 +2841,9 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain,
                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;
                }
        }
 
index f6ec4979abd7a5418850d3512ed17b26ccda3024..4855b8f9834eb43835f30c9e72b0a06001c49dd2 100644 (file)
@@ -1002,8 +1002,7 @@ class_type_info (MonoDomain *domain, MonoClass *class, MonoRgctxInfoType info_ty
 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;
@@ -2734,20 +2733,12 @@ mono_generic_sharing_cleanup (void)
 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
index 8fee20af405154e02f2a33d0bfa316ee65aa44e1..12f5901920d83d1d33961bd4c2065cb33ec5f7e7 100644 (file)
@@ -260,7 +260,7 @@ mono_print_method_from_ip (void *ip)
        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 ";
@@ -1686,34 +1686,21 @@ mini_init_gsctx (MonoDomain *domain, MonoMemPool *mp, MonoGenericContext *contex
 
        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;
                }
        }
 }
index 7de1cae2345af807baa9deab34d9437552fef163..b2c06eb12fc3b29741415f0555a748c5da0d9955 100644 (file)
@@ -269,8 +269,7 @@ is_generic_method_definition (MonoMethod *m)
 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;
index e0fa41e3be6edcd05e31865b6cc491dfabe902e3..3ed9254036f8aa3bb9bc74f981f827ee22d808f4 100644 (file)
@@ -432,7 +432,7 @@ mono_trace_enter_method (MonoMethod *method, char *ebp)
                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;
@@ -590,7 +590,7 @@ mono_trace_leave_method (MonoMethod *method, ...)
                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;