From a2be0ae29368c8324962d6d6a80161ce253b4800 Mon Sep 17 00:00:00 2001 From: Mark Probst Date: Wed, 10 Oct 2007 10:32:22 +0000 Subject: [PATCH] 2007-10-10 Mark Probst * generic-sharing.c, mini.h, mini-amd64.c, mini-x86.c: Moved type variable handling out of arch-specific code. svn path=/trunk/mono/; revision=87249 --- mono/mini/ChangeLog | 4 ++++ mono/mini/generic-sharing.c | 11 +++++++++++ mono/mini/mini-amd64.c | 13 ++----------- mono/mini/mini-x86.c | 13 ++----------- mono/mini/mini.h | 1 + 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 4f2d26090e7..5dc92170880 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,7 @@ +2007-10-10 Mark Probst + + * generic-sharing.c, mini.h, mini-amd64.c, mini-x86.c: Moved type + variable handling out of arch-specific code. Wed Oct 10 10:49:28 CEST 2007 Paolo Molaro diff --git a/mono/mini/generic-sharing.c b/mono/mini/generic-sharing.c index 233fb060770..5034e4307a6 100644 --- a/mono/mini/generic-sharing.c +++ b/mono/mini/generic-sharing.c @@ -207,3 +207,14 @@ mono_make_shared_context (MonoCompile *cfg, MonoGenericContext *context) return shared; } + +MonoType* +mini_get_basic_type_from_generic (MonoCompile *cfg, MonoType *type) +{ + if (!type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR)) { + /* FIXME: we support sharing only of reference types */ + g_assert (cfg->generic_shared); + return &mono_defaults.object_class->byval_arg; + } + return type; +} diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c index 85586a3b9d2..8381c2fa1a1 100644 --- a/mono/mini/mini-amd64.c +++ b/mono/mini/mini-amd64.c @@ -517,6 +517,7 @@ get_call_info (MonoCompile *cfg, MonoMemPool *mp, MonoMethodSignature *sig, gboo /* return value */ { ret_type = mono_type_get_underlying_type (sig->ret); + ret_type = mini_get_basic_type_from_generic (cfg, ret_type); switch (ret_type->type) { case MONO_TYPE_BOOLEAN: case MONO_TYPE_I1: @@ -574,12 +575,6 @@ get_call_info (MonoCompile *cfg, MonoMemPool *mp, MonoMethodSignature *sig, gboo break; case MONO_TYPE_VOID: break; - case MONO_TYPE_VAR: - case MONO_TYPE_MVAR: - g_assert (cfg->generic_shared); - cinfo->ret.storage = ArgInIReg; - cinfo->ret.reg = AMD64_RAX; - break; default: g_error ("Can't handle as return value 0x%x", sig->ret->type); } @@ -619,6 +614,7 @@ get_call_info (MonoCompile *cfg, MonoMemPool *mp, MonoMethodSignature *sig, gboo continue; } ptype = mono_type_get_underlying_type (sig->params [i]); + ptype = mini_get_basic_type_from_generic (cfg, ptype); switch (ptype->type) { case MONO_TYPE_BOOLEAN: case MONO_TYPE_I1: @@ -668,11 +664,6 @@ get_call_info (MonoCompile *cfg, MonoMemPool *mp, MonoMethodSignature *sig, gboo case MONO_TYPE_R8: add_float (&fr, &stack_size, ainfo, TRUE); break; - case MONO_TYPE_VAR: - case MONO_TYPE_MVAR: - g_assert (cfg->generic_shared); - add_general (&gr, &stack_size, ainfo); - break; default: g_assert_not_reached (); } diff --git a/mono/mini/mini-x86.c b/mono/mini/mini-x86.c index 25565d57a6a..4934e8a7eeb 100644 --- a/mono/mini/mini-x86.c +++ b/mono/mini/mini-x86.c @@ -258,6 +258,7 @@ get_call_info (MonoCompile *cfg, MonoMemPool *mp, MonoMethodSignature *sig, gboo /* return value */ { ret_type = mono_type_get_underlying_type (sig->ret); + ret_type = mini_get_basic_type_from_generic (cfg, ret_type); switch (ret_type->type) { case MONO_TYPE_BOOLEAN: case MONO_TYPE_I1: @@ -314,12 +315,6 @@ get_call_info (MonoCompile *cfg, MonoMemPool *mp, MonoMethodSignature *sig, gboo case MONO_TYPE_VOID: cinfo->ret.storage = ArgNone; break; - case MONO_TYPE_VAR: - case MONO_TYPE_MVAR: - g_assert (cfg->generic_shared); - cinfo->ret.storage = ArgInIReg; - cinfo->ret.reg = X86_EAX; - break; default: g_error ("Can't handle as return value 0x%x", sig->ret->type); } @@ -359,6 +354,7 @@ get_call_info (MonoCompile *cfg, MonoMemPool *mp, MonoMethodSignature *sig, gboo continue; } ptype = mono_type_get_underlying_type (sig->params [i]); + ptype = mini_get_basic_type_from_generic (cfg, ptype); switch (ptype->type) { case MONO_TYPE_BOOLEAN: case MONO_TYPE_I1: @@ -408,11 +404,6 @@ get_call_info (MonoCompile *cfg, MonoMemPool *mp, MonoMethodSignature *sig, gboo case MONO_TYPE_R8: add_float (&fr, &stack_size, ainfo, TRUE); break; - case MONO_TYPE_VAR: - case MONO_TYPE_MVAR: - g_assert (cfg->generic_shared); - add_general (&gr, &stack_size, ainfo); - break; default: g_error ("unexpected type 0x%x", ptype->type); g_assert_not_reached (); diff --git a/mono/mini/mini.h b/mono/mini/mini.h index 16ea0fe491e..15182ffc416 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -1124,5 +1124,6 @@ gboolean mono_method_is_generic_sharable_impl (MonoMethod *method) MONO_INTERNAL MonoGenericContext* mono_make_shared_context (MonoCompile *cfg, MonoGenericContext *context) MONO_INTERNAL; +MonoType* mini_get_basic_type_from_generic (MonoCompile *cfg, MonoType *type) MONO_INTERNAL; #endif /* __MONO_MINI_H__ */ -- 2.25.1