From 9bcd33f029f0b5e2cd87e6d4d884809aab0ba920 Mon Sep 17 00:00:00 2001 From: Neale Ferguson Date: Thu, 22 Aug 2013 08:15:56 -0400 Subject: [PATCH] Enable INLINE support for s390x --- mono/metadata/mono-debug.h | 3 ++ mono/mini/debug-mini.c | 8 +++++ mono/mini/mini-s390x.c | 68 ++++++++------------------------------ 3 files changed, 25 insertions(+), 54 deletions(-) diff --git a/mono/metadata/mono-debug.h b/mono/metadata/mono-debug.h index 06ba9ffd47a5f..5f8b0258143de 100644 --- a/mono/metadata/mono-debug.h +++ b/mono/metadata/mono-debug.h @@ -130,6 +130,9 @@ struct _MonoDebugSourceLocation { /* gsharedvt local */ #define MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL 0x50000000 +/* variable is a vt address */ +#define MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR 0x60000000 + struct _MonoDebugVarInfo { uint32_t index; uint32_t offset; diff --git a/mono/mini/debug-mini.c b/mono/mini/debug-mini.c index a8078869ae685..f45f63f6b9792 100644 --- a/mono/mini/debug-mini.c +++ b/mono/mini/debug-mini.c @@ -163,6 +163,9 @@ write_variable (MonoInst *inst, MonoDebugVarInfo *var) var->offset = inst->inst_offset; } else if (inst->opcode == OP_GSHAREDVT_LOCAL) { var->index = inst->inst_imm | MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL; + } else if (inst->opcode == OP_VTARG_ADDR) { + var->offset = inst->inst_offset; + var->index = inst->inst_basereg | MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR; } else { g_assert_not_reached (); } @@ -486,6 +489,7 @@ serialize_variable (MonoDebugVarInfo *var, guint8 *p, guint8 **endbuf) encode_value (var->offset, p, &p); break; case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL: + case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR: case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD: break; default: @@ -568,6 +572,7 @@ deserialize_variable (MonoDebugVarInfo *var, guint8 *p, guint8 **endbuf) var->offset = decode_value (p, &p); break; case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL: + case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR: case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD: break; default: @@ -693,6 +698,9 @@ print_var_info (MonoDebugVarInfo *info, int idx, const char *name, const char *t case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL: g_print ("%s %s (%d) gsharedvt local.\n", type, name, idx); break; + case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR: + g_print ("%s %s (%d) vt address: base register %s + %d\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)), info->offset); + break; case MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS: default: g_assert_not_reached (); diff --git a/mono/mini/mini-s390x.c b/mono/mini/mini-s390x.c index c405aeb1d2ac6..cc2a055e78d6a 100644 --- a/mono/mini/mini-s390x.c +++ b/mono/mini/mini-s390x.c @@ -365,14 +365,12 @@ static guint8 * backUpStackPtr(MonoCompile *, guint8 *); static void decodeParm (MonoType *, void *, int); static void enter_method (MonoMethod *, RegParm *, char *); static void leave_method (MonoMethod *, ...); -static gboolean is_regsize_var (MonoType *); static inline void add_general (guint *, size_data *, ArgInfo *); static inline void add_stackParm (guint *, size_data *, ArgInfo *, gint); static inline void add_float (guint *, size_data *, ArgInfo *); static CallInfo * get_call_info (MonoCompile *, MonoMemPool *, MonoMethodSignature *); static guchar * emit_float_to_int (MonoCompile *, guchar *, int, int, int, gboolean); static guint8 * emit_load_volatile_arguments (guint8 *, MonoCompile *); -static void catch_SIGILL(int, siginfo_t *, void *); static __inline__ void emit_unwind_regs(MonoCompile *, guint8 *, int, int, long); /*========================= End of Prototypes ======================*/ @@ -416,11 +414,6 @@ static gpointer bp_trigger_page; breakpoint_t breakpointCode; -/* - * This mutex protects architecture specific caches - */ -static CRITICAL_SECTION mini_arch_mutex; - /*====================== End of Global Variables ===================*/ /*------------------------------------------------------------------*/ @@ -1329,8 +1322,7 @@ mono_arch_cpu_optimizations (guint32 *exclude_mask) /*----------------------------------------------------------*/ /* No s390-specific optimizations yet */ /*----------------------------------------------------------*/ - *exclude_mask = MONO_OPT_INLINE|MONO_OPT_LINEARS; -// *exclude_mask = MONO_OPT_INLINE; + *exclude_mask = MONO_OPT_LINEARS; return opts; } @@ -1351,44 +1343,6 @@ mono_arch_cpu_enumerate_simd_versions (void) } /*========================= End of Function ========================*/ -/*------------------------------------------------------------------*/ -/* */ -/* Name - */ -/* */ -/* Function - */ -/* */ -/*------------------------------------------------------------------*/ - -static gboolean -is_regsize_var (MonoType *t) { - if (t->byref) - return TRUE; - switch (mono_type_get_underlying_type (t)->type) { - case MONO_TYPE_I4: - case MONO_TYPE_U4: - case MONO_TYPE_I: - case MONO_TYPE_I8: - case MONO_TYPE_U8: - case MONO_TYPE_U: - case MONO_TYPE_PTR: - case MONO_TYPE_FNPTR: - return TRUE; - case MONO_TYPE_OBJECT: - case MONO_TYPE_STRING: - case MONO_TYPE_CLASS: - case MONO_TYPE_SZARRAY: - case MONO_TYPE_ARRAY: - return FALSE; - case MONO_TYPE_VALUETYPE: - if (t->data.klass->enumtype) - return is_regsize_var (mono_class_enum_basetype (t->data.klass)); - return FALSE; - } - return FALSE; -} - -/*========================= End of Function ========================*/ - /*------------------------------------------------------------------*/ /* */ /* Name - mono_arch_get_allocatable_int_vars */ @@ -1416,7 +1370,7 @@ mono_arch_get_allocatable_int_vars (MonoCompile *cfg) continue; /* we can only allocate 32 bit values */ - if (is_regsize_var (ins->inst_vtype)) { + if (mono_is_regsize_var(ins->inst_vtype)) { g_assert (MONO_VARINFO (cfg, i)->reg == -1); g_assert (i == vmv->idx); vars = mono_varlist_insert_sorted (cfg, vars, vmv, FALSE); @@ -1826,7 +1780,11 @@ get_call_info (MonoCompile *cfg, MonoMemPool *mp, MonoMethodSignature *sig) MonoMarshalType *info; MonoClass *klass = mono_class_from_mono_type (ptype); - size = mini_type_stack_size_full(gsctx, &klass->byval_arg, NULL, sig->pinvoke); + if (sig->pinvoke) + size = mono_class_native_size(klass, NULL); + else + size = mono_class_value_size(klass, NULL); + if (simpleType != MONO_TYPE_GENERICINST) { info = mono_marshal_load_type_info(klass); @@ -2002,7 +1960,7 @@ mono_arch_allocate_vars (MonoCompile *cfg) cinfo = get_call_info (cfg, cfg->mempool, sig); if (!cinfo->struct_ret) { - switch (mono_type_get_underlying_type (sig->ret)->type) { + switch (mini_type_get_underlying_type (cfg->generic_sharing_context, sig->ret)->type) { case MONO_TYPE_VOID: break; default: @@ -2375,7 +2333,7 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call) t = sig->params [i - sig->hasthis]; else t = &mono_defaults.int_class->byval_arg; - t = mono_type_get_underlying_type (t); + t = mini_type_get_underlying_type (cfg->generic_sharing_context, t); in = call->args [i]; @@ -2591,7 +2549,8 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src) void mono_arch_emit_setret (MonoCompile *cfg, MonoMethod *method, MonoInst *val) { - MonoType *ret = mono_type_get_underlying_type (mono_method_signature (method)->ret); + MonoType *ret = mini_type_get_underlying_type (cfg->generic_sharing_context, + mono_method_signature (method)->ret); if (!ret->byref) { if (ret->type == MONO_TYPE_R4) { @@ -2721,7 +2680,8 @@ mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolea saveOffset, offset; MonoMethod *method = cfg->method; - int rtype = mono_type_get_underlying_type (mono_method_signature (method)->ret)->type; + int rtype = mini_type_get_underlying_type (cfg->generic_sharing_context, + mono_method_signature (method)->ret)->type; offset = code - cfg->native_code; /*-----------------------------------------*/ @@ -4129,7 +4089,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) /* ensure ins->sreg1 is not NULL */ s390_lg (code, s390_r0, 0, ins->sreg1, 0); s390_ltgr (code, s390_r0, s390_r0); - EMIT_COND_SYSTEM_EXCEPTION (S390_CC_ZR, "NullReferenceException"); +// EMIT_COND_SYSTEM_EXCEPTION (S390_CC_ZR, "NullReferenceException"); } break; case OP_ARGLIST: {