Skip to content

Commit

Permalink
Enable INLINE support for s390x
Browse files Browse the repository at this point in the history
  • Loading branch information
nealef committed Aug 22, 2013
1 parent b46b038 commit 9bcd33f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 54 deletions.
3 changes: 3 additions & 0 deletions mono/metadata/mono-debug.h
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions mono/mini/debug-mini.c
Expand Up @@ -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 ();
}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 ();
Expand Down
68 changes: 14 additions & 54 deletions mono/mini/mini-s390x.c
Expand Up @@ -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 ======================*/
Expand Down Expand Up @@ -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 ===================*/

/*------------------------------------------------------------------*/
Expand Down Expand Up @@ -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;
}

Expand All @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
/*-----------------------------------------*/
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 9bcd33f

Please sign in to comment.