#include <mono/metadata/profiler-private.h>
#include <mono/utils/mono-math.h>
#include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-hwcap-s390x.h>
#include "mini-s390x.h"
#include "cpu-s390x.h"
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 ======================*/
static int indent_level = 0;
-int has_ld = 0;
-
static gint appdomain_tls_offset = -1,
lmf_tls_offset = -1,
lmf_addr_tls_offset = -1;
breakpoint_t breakpointCode;
-/*
- * This mutex protects architecture specific caches
- */
-static CRITICAL_SECTION mini_arch_mutex;
-
/*====================== End of Global Variables ===================*/
/*------------------------------------------------------------------*/
mono_method_signature (method)->ret->type);
}
- ip = ((gint64) __builtin_return_address (0));
+ ip = ((gint64) __builtin_extract_return_addr (__builtin_return_address (0)));
printf (" ip: %p\n", (gpointer) ip);
}
/*========================= End of Function ========================*/
-/*------------------------------------------------------------------*/
-/* */
-/* Name - catch_SIGILL */
-/* */
-/* Function - Catch SIGILL as a result of testing for long */
-/* displacement facility. */
-/* */
-/*------------------------------------------------------------------*/
-
-void
-catch_SIGILL(int sigNo, siginfo_t *info, void *act) {
-
- has_ld = 0;
-
-}
-
-/*========================= End of Function ========================*/
-
/*------------------------------------------------------------------*/
/* */
/* Name - mono_arch_cpu_init */
void
mono_arch_cpu_init (void)
{
- struct sigaction sa,
- *oldSa = NULL;
- guint mode = 1;
-
- /*--------------------------------------*/
- /* Set default rounding mode for FP */
- /*--------------------------------------*/
- __asm__ ("SRNM\t%0\n\t"
- : : "m" (mode));
-
- /*--------------------------------------*/
- /* Determine if we have long displace- */
- /* ment facility on this processor */
- /*--------------------------------------*/
- sa.sa_sigaction = catch_SIGILL;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = SA_SIGINFO;
-
- sigaction (SIGILL, &sa, oldSa);
-
- /*--------------------------------------*/
- /* We test by executing the STY inst */
- /*--------------------------------------*/
- __asm__ ("LGHI\t0,1\n\t"
- "LA\t1,%0\n\t"
- ".byte\t0xe3,0x00,0x10,0x00,0x00,0x50\n\t"
- : "=m" (has_ld) : : "0", "1");
-
- sigaction (SIGILL, oldSa, NULL);
}
/*========================= End of Function ========================*/
/*----------------------------------------------------------*/
/* 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;
}
}
/*========================= 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 */
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);
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);
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:
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];
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) {
if (cfg->method->save_lmf)
parmOffset -= sizeof(MonoLMF);
fpOffset = parmOffset + (5*sizeof(gpointer));
- if ((!has_ld) && (fpOffset > 4096)) {
+ if ((!mono_hwcap_s390x_has_ld) && (fpOffset > 4096)) {
s390_lgr (code, s390_r12, STK_BASE);
baseReg = s390_r12;
while (fpOffset > 4096) {
}
s390_stmg (code, s390_r2, s390_r6, STK_BASE, parmOffset);
- if (has_ld) {
+ if (mono_hwcap_s390x_has_ld) {
s390_stdy (code, s390_f0, 0, STK_BASE, fpOffset);
s390_stdy (code, s390_f2, 0, STK_BASE, fpOffset+sizeof(gdouble));
s390_stdy (code, s390_f4, 0, STK_BASE, fpOffset+2*sizeof(gdouble));
s390_llong(code, cfg->method);
s390_llong(code, func);
s390_lg (code, s390_r2, 0, s390_r13, 4);
- if (has_ld)
+ if (mono_hwcap_s390x_has_ld)
s390_lay (code, s390_r3, 0, STK_BASE, parmOffset);
else
s390_la (code, s390_r3, 0, baseReg, parmOffset);
s390_aghi (code, s390_r4, cfg->stack_usage);
s390_lg (code, s390_r1, 0, s390_r13, 12);
s390_basr (code, s390_r14, s390_r1);
- if (has_ld) {
+ if (mono_hwcap_s390x_has_ld) {
s390_ldy (code, s390_f6, 0, STK_BASE, fpOffset+3*sizeof(gdouble));
s390_ldy (code, s390_f4, 0, STK_BASE, fpOffset+2*sizeof(gdouble));
s390_ldy (code, s390_f2, 0, STK_BASE, fpOffset+sizeof(gdouble));
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;
/*-----------------------------------------*/
/* 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: {
/*========================= End of Function ========================*/
-/*------------------------------------------------------------------*/
-/* */
-/* Name - mono_arch_get_domain_intrinsic */
-/* */
-/* Function - */
-/* */
-/* Returns - */
-/* */
-/*------------------------------------------------------------------*/
-
-MonoInst *
-mono_arch_get_domain_intrinsic (MonoCompile* cfg)
-{
- MonoInst *ins;
-
- if (appdomain_tls_offset == -1)
- return NULL;
-
- MONO_INST_NEW (cfg, ins, OP_TLS_GET);
- ins->inst_offset = appdomain_tls_offset;
- return (ins);
-}
-
-/*========================= End of Function ========================*/
-
/*------------------------------------------------------------------*/
/* */
/* Name - mono_arch_flush_register_windows */
guint8 *code;
guint32 code_len;
int i;
+ char *tramp_name;
code = get_delegate_invoke_impl (TRUE, 0, &code_len, TRUE);
- res = g_slist_prepend (res, mono_tramp_info_create (g_strdup ("delegate_invoke_impl_has_target"), code, code_len, NULL, NULL));
+ res = g_slist_prepend (res, mono_tramp_info_create ("delegate_invoke_impl_has_target", code, code_len, NULL, NULL));
for (i = 0; i < MAX_ARCH_DELEGATE_PARAMS; ++i) {
code = get_delegate_invoke_impl (FALSE, i, &code_len, TRUE);
- res = g_slist_prepend (res, mono_tramp_info_create (g_strdup_printf ("delegate_invoke_impl_target_%d", i), code, code_len, NULL, NULL));
+ tramp_name = g_strdup_printf ("delegate_invoke_impl_target_%d", i);
+ res = g_slist_prepend (res, mono_tramp_info_create (tramp_name, code, code_len, NULL, NULL));
+ g_free (tramp_name);
}
return res;
return NULL;
}
+/*------------------------------------------------------------------*/
+/* */
+/* Name - mono_arch_init_lmf_ext. */
+/* */
+/* Function - */
+/* */
+/*------------------------------------------------------------------*/
+
+void
+mono_arch_init_lmf_ext (MonoLMFExt *ext, gpointer prev_lmf)
+{
+ ext->lmf.previous_lmf = prev_lmf;
+ /* Mark that this is a MonoLMFExt */
+ ext->lmf.previous_lmf = (gpointer)(((gssize)ext->lmf.previous_lmf) | 2);
+ ext->lmf.ebp = (gssize)ext;
+}
+
/*========================= End of Function ========================*/
#endif