* marshal.c (mono_mb_emit_restore_result): Properly handle generic enums.
2009-12-30 Rodrigo Kumpera <rkumpera@novell.com>
* mini.c:
* method-to.ir.c:
* mini-*.c: Properly handle generic enums.
Fixes #566294
svn path=/trunk/mono/; revision=148941
+2009-12-30 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * marshal.c (mono_mb_emit_restore_result): Properly handle generic enums.
+
2009-12-26 Zoltan Varga <vargaz@gmail.com>
* monitor.c (ves_icall_System_Threading_Monitor_Monitor_wait): Don't close the
mono_mb_emit_byte (mb, mono_type_to_ldind (return_type));
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (return_type))
+ if (!mono_type_generic_inst_is_valuetype (t))
break;
/* fall through */
case MONO_TYPE_VALUETYPE: {
continue;
}
+ /*FIXME 'this doesn't handle generic enums. Shouldn't we?*/
type = sig->params [i]->type;
handle_enum:
switch (type) {
+2009-12-30 Rodrigo Kumpera <rkumpera@novell.com>
+
+ * mini.c:
+ * method-to.ir.c:
+ * mini-*.c: Properly handle generic enums.
+
+ Fixes #566294
+
2009-12-28 Zoltan Varga <vargaz@gmail.com>
* method-to-ir.c (mono_method_to_ir): Handle the failure of mono_class_vtable ()
static G_GNUC_UNUSED int
type_to_stack_type (MonoType *t)
{
- switch (mono_type_get_underlying_type (t)->type) {
+ t = mono_type_get_underlying_type (t);
+ switch (t->type) {
case MONO_TYPE_I1:
case MONO_TYPE_U1:
case MONO_TYPE_BOOLEAN:
cinfo->ret.reg = alpha_f0;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret))
+ if (!mono_type_generic_inst_is_valuetype (ret_type))
{
cinfo->ret.storage = ArgInIReg;
cinfo->ret.reg = alpha_r0;
add_general (pgr, &stack_size, ainfo);
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->params [i]))
+ if (!mono_type_generic_inst_is_valuetype (ptype))
{
add_general (pgr, &stack_size, ainfo);
break;
cinfo->ret.reg = AMD64_XMM0;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (ret_type)) {
cinfo->ret.storage = ArgInIReg;
cinfo->ret.reg = AMD64_RAX;
break;
guchar *code = p;
int save_mode = SAVE_NONE;
MonoMethod *method = cfg->method;
- int rtype = mini_type_get_underlying_type (NULL, mono_method_signature (method)->ret)->type;
+ MonoType *ret_type = mini_type_get_underlying_type (NULL, mono_method_signature (method)->ret);
- switch (rtype) {
+ switch (ret_type->type) {
case MONO_TYPE_VOID:
/* special case string .ctor icall */
if (strcmp (".ctor", method->name) && method->klass == mono_defaults.string_class)
save_mode = SAVE_XMM;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (mono_method_signature (method)->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (ret_type)) {
save_mode = SAVE_EAX;
break;
}
n++;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->params [i])) {
+ if (!mono_type_generic_inst_is_valuetype (simpletype)) {
cinfo->args [n].size = sizeof (gpointer);
add_general (&gr, &stack_size, cinfo->args + n, TRUE);
n++;
cinfo->ret.storage = RegTypeFP;*/
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (simpletype)) {
cinfo->ret.storage = RegTypeGeneral;
cinfo->ret.reg = ARMREG_R0;
break;
cinfo->ret.reg = 8;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (ret_type)) {
cinfo->ret.storage = ArgInIReg;
cinfo->ret.reg = IA64_R8;
break;
add_general (&gr, &stack_size, ainfo);
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->params [i])) {
+ if (!mono_type_generic_inst_is_valuetype (ptype)) {
add_general (&gr, &stack_size, ainfo);
break;
}
{
guint i;
int n = sig->hasthis + sig->param_count;
- guint32 simpletype;
+ MonoType* simpletype;
CallInfo *cinfo = g_malloc0 (sizeof (CallInfo) + sizeof (ArgInfo) * n);
cinfo->fr = MIPS_FIRST_FPARG_REG;
n++;
continue;
}
- simpletype = mono_type_get_underlying_type (sig->params [i])->type;
- switch (simpletype) {
+ simpletype = mono_type_get_underlying_type (sig->params [i]);
+ switch (simpletype->type) {
case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
n++;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->params [i])) {
+ if (!mono_type_generic_inst_is_valuetype (simpletype)) {
cinfo->args [n].size = sizeof (gpointer);
add_int32_arg (cinfo, &cinfo->args[n]);
n++;
}
{
- simpletype = mono_type_get_underlying_type (sig->ret)->type;
- switch (simpletype) {
+ simpletype = mono_type_get_underlying_type (sig->ret);
+ switch (simpletype->type) {
case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
cinfo->ret.regtype = RegTypeFP;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (simpletype)) {
cinfo->ret.reg = mips_v0;
break;
}
{
guint i, fr, gr;
int n = sig->hasthis + sig->param_count;
- guint32 simpletype;
+ MonoType *simpletype;
guint32 stack_size = 0;
CallInfo *cinfo = g_malloc0 (sizeof (CallInfo) + sizeof (ArgInfo) * n);
n++;
continue;
}
- simpletype = mini_type_get_underlying_type (NULL, sig->params [i])->type;
- switch (simpletype) {
+ simpletype = mini_type_get_underlying_type (NULL, sig->params [i]);
+ switch (simpletype->type) {
case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
n++;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->params [i])) {
+ if (!mono_type_generic_inst_is_valuetype (simpletype)) {
cinfo->args [n].size = sizeof (gpointer);
add_general (&gr, &stack_size, cinfo->args + n, TRUE);
n++;
MonoClass *klass;
klass = mono_class_from_mono_type (sig->params [i]);
- if (simpletype == MONO_TYPE_TYPEDBYREF)
+ if (simpletype->type == MONO_TYPE_TYPEDBYREF)
size = sizeof (MonoTypedRef);
else if (is_pinvoke)
size = mono_class_native_size (klass, NULL);
}
{
- simpletype = mini_type_get_underlying_type (NULL, sig->ret)->type;
- switch (simpletype) {
+ simpletype = mini_type_get_underlying_type (NULL, sig->ret);
+ switch (simpletype->type) {
case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
cinfo->ret.regtype = RegTypeFP;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (simpletype)) {
cinfo->ret.reg = ppc_r3;
break;
}
sz->code_size += 4;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (ret_type)) {
cinfo->ret.reg = s390_r2;
sz->code_size += 4;
break;
nParm++;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->params [i])) {
+ if (!mono_type_generic_inst_is_valuetype (ptype)) {
cinfo->args[nParm].size = sizeof(gpointer);
add_general (&gr, sz, cinfo->args+nParm, TRUE);
nParm++;
add_general (&gr, &stack_size, ainfo, FALSE);
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->params [i])) {
+ if (!mono_type_generic_inst_is_valuetype (ptype)) {
add_general (&gr, &stack_size, ainfo, FALSE);
break;
}
cinfo->ret.reg = sparc_f0;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (ret_type)) {
cinfo->ret.storage = ArgInIReg;
cinfo->ret.reg = sparc_i0;
if (gr < 1)
cinfo->ret.storage = ArgOnDoubleFpStack;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (ret_type)) {
cinfo->ret.storage = ArgInIReg;
cinfo->ret.reg = X86_EAX;
break;
add_general (&gr, &stack_size, ainfo);
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->params [i])) {
+ if (!mono_type_generic_inst_is_valuetype (ptype)) {
add_general (&gr, &stack_size, ainfo);
break;
}
guchar *code = p;
int arg_size = 0, stack_usage = 0, save_mode = SAVE_NONE;
MonoMethod *method = cfg->method;
-
- switch (mini_type_get_underlying_type (cfg->generic_sharing_context, mono_method_signature (method)->ret)->type) {
+ MonoType *ret_type = mini_type_get_underlying_type (cfg->generic_sharing_context, mono_method_signature (method)->ret);
+
+ switch (ret_type->type) {
case MONO_TYPE_VOID:
/* special case string .ctor icall */
if (strcmp (".ctor", method->name) && method->klass == mono_defaults.string_class) {
stack_usage = enable_arguments ? 16 : 8;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (mono_method_signature (method)->ret)) {
+ if (!mono_type_generic_inst_is_valuetype (ret_type)) {
save_mode = SAVE_EAX;
stack_usage = enable_arguments ? 8 : 4;
break;
if (type->byref)
return OP_LOAD_MEMBASE;
- switch (mono_type_get_underlying_type (type)->type) {
+ type = mono_type_get_underlying_type (type);
+
+ switch (type->type) {
case MONO_TYPE_I1:
return OP_LOADI1_MEMBASE;
case MONO_TYPE_U1: