diff options
author | Neale Ferguson <neale@sinenomine.net> | 2016-01-27 23:45:37 +0300 |
---|---|---|
committer | Neale Ferguson <neale@sinenomine.net> | 2016-01-27 23:48:56 +0300 |
commit | ef8c67a1d7c45391f9eaceb446f4e9a33df7b061 (patch) | |
tree | 5b604cb41e8dd9ffc2a9819eb0e60975840bb5ee | |
parent | 1a1864545a8b9eec6b0757528aacca5398dc21b3 (diff) |
Use S390_SET to get addresses rather than the previous more convoluted method
[jit] Add a new jit icall mono_interruption_checkpoint_from_trampoline () and use that instead of mono_thread_force_interruption_checkpoint () so the latter can go away eventually.
-rw-r--r-- | mono/mini/exceptions-s390x.c | 14 | ||||
-rw-r--r-- | mono/mini/mini-s390x.c | 33 | ||||
-rw-r--r-- | mono/mini/tramp-s390x.c | 15 |
3 files changed, 48 insertions, 14 deletions
diff --git a/mono/mini/exceptions-s390x.c b/mono/mini/exceptions-s390x.c index 83d5f6b1368..18e51bd94ee 100644 --- a/mono/mini/exceptions-s390x.c +++ b/mono/mini/exceptions-s390x.c @@ -59,6 +59,7 @@ #include "mini.h" #include "mini-s390x.h" +#include "support-s390x.h" /*========================= End of Includes ========================*/ @@ -306,12 +307,8 @@ mono_arch_get_throw_exception_generic (int size, MonoTrampInfo **info, s390_stg (code, s390_r14, 0, STK_BASE, 0); s390_lgr (code, s390_r3, s390_r2); if (corlib) { - s390_basr (code, s390_r13, 0); - s390_j (code, 10); - s390_llong(code, mono_defaults.exception_class->image); - s390_llong(code, mono_exception_from_token); - s390_lg (code, s390_r2, 0, s390_r13, 4); - s390_lg (code, s390_r1, 0, s390_r13, 12); + S390_SET (code, s390_r1, (guint8 *)mono_exception_from_token); + S390_SET (code, s390_r2, (guint8 *)mono_defaults.exception_class->image); s390_basr (code, s390_r14, s390_r1); } @@ -354,12 +351,9 @@ mono_arch_get_throw_exception_generic (int size, MonoTrampInfo **info, s390_la (code, s390_r7, 0, STK_BASE, S390_THROWSTACK_ACCREGS); s390_stg (code, s390_r7, 0, STK_BASE, S390_THROWSTACK_ACCPRM); s390_stfpc(code, STK_BASE, S390_THROWSTACK_FPCPRM+4); + S390_SET (code, s390_r1, (guint8 *)throw_exception); s390_lghi (code, s390_r7, rethrow); s390_stg (code, s390_r7, 0, STK_BASE, S390_THROWSTACK_RETHROW); - s390_basr (code, s390_r13, 0); - s390_j (code, 6); - s390_llong(code, throw_exception); - s390_lg (code, s390_r1, 0, s390_r13, 4); s390_basr (code, s390_r14, s390_r1); /* we should never reach this breakpoint */ s390_break (code); diff --git a/mono/mini/mini-s390x.c b/mono/mini/mini-s390x.c index 8c27ecee488..368c3bc9882 100644 --- a/mono/mini/mini-s390x.c +++ b/mono/mini/mini-s390x.c @@ -275,6 +275,7 @@ if (ins->inst_target_bb->native_offset) { \ #include "jit-icalls.h" #include "ir-emit.h" #include "trace.h" +#include "mini-gc.h" /*========================= End of Includes ========================*/ @@ -577,6 +578,7 @@ emit_unwind_regs(MonoCompile *cfg, guint8 *code, int start, int end, long offset for (i = start; i < end; i++) { mono_emit_unwind_op_offset (cfg, code, i, offset); + mini_gc_set_slot_type_from_cfa (cfg, offset, SLOT_NOREF); offset += sizeof(gulong); } } @@ -1310,6 +1312,7 @@ mono_arch_init (void) { guint8 *code; + mono_set_partial_sharing_supported (FALSE); mono_os_mutex_init_recursive (&mini_arch_mutex); ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ); @@ -5573,7 +5576,8 @@ mono_arch_emit_prolog (MonoCompile *cfg) CallInfo *cinfo; int tracing = 0, argsClobbered = 0, - lmfOffset; + lmfOffset, + fpOffset; cfg->code_size = 512; @@ -5592,6 +5596,7 @@ mono_arch_emit_prolog (MonoCompile *cfg) emit_unwind_regs(cfg, code, s390_r6, s390_r14, S390_REG_SAVE_OFFSET); s390_stmg (code, s390_r6, s390_r14, STK_BASE, S390_REG_SAVE_OFFSET); mono_emit_unwind_op_offset (cfg, code, s390_r14, S390_RET_ADDR_OFFSET); + mini_gc_set_slot_type_from_cfa (cfg, S390_RET_ADDR_OFFSET, SLOT_NOREF); if (cfg->arch.bkchain_reg != -1) s390_lgr (code, cfg->arch.bkchain_reg, STK_BASE); @@ -5778,6 +5783,12 @@ mono_arch_emit_prolog (MonoCompile *cfg) s390_stmg (code, s390_r2, s390_r6, s390_r13, G_STRUCT_OFFSET(MonoLMF, pregs[0])); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[0]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[1]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[2]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[3]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[4]), SLOT_NOREF); + /*---------------------------------------------------------------*/ /* On return from this call r2 have the address of the &lmf */ /*---------------------------------------------------------------*/ @@ -5801,6 +5812,7 @@ mono_arch_emit_prolog (MonoCompile *cfg) /*---------------------------------------------------------------*/ s390_stg (code, s390_r2, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, lmf_addr)); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, lmf_addr), SLOT_NOREF); /*---------------------------------------------------------------*/ /* Get current lmf */ @@ -5817,6 +5829,7 @@ mono_arch_emit_prolog (MonoCompile *cfg) /*---------------------------------------------------------------*/ s390_stg (code, s390_r0, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, previous_lmf)); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, previous_lmf), SLOT_NOREF); /*---------------------------------------------------------------*/ /* save method info */ @@ -5824,6 +5837,7 @@ mono_arch_emit_prolog (MonoCompile *cfg) S390_SET (code, s390_r1, method); s390_stg (code, s390_r1, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, method)); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, method), SLOT_NOREF); /*---------------------------------------------------------------*/ /* save the current IP */ @@ -5831,15 +5845,32 @@ mono_arch_emit_prolog (MonoCompile *cfg) s390_stg (code, STK_BASE, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, ebp)); s390_basr (code, s390_r1, 0); s390_stg (code, s390_r1, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, eip)); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, ebp), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, eip), SLOT_NOREF); /*---------------------------------------------------------------*/ /* Save general and floating point registers */ /*---------------------------------------------------------------*/ s390_stmg (code, s390_r2, s390_r12, s390_r13, G_STRUCT_OFFSET(MonoLMF, gregs[2])); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[0]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[1]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[2]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[3]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[4]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[5]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[6]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[7]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[8]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[9]), SLOT_NOREF); + mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[10]), SLOT_NOREF); + + fpOffset = lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, fregs[0]); for (i = 0; i < 16; i++) { s390_std (code, i, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, fregs[i])); + mini_gc_set_slot_type_from_fp (cfg, fpOffset, SLOT_NOREF); + fpOffset += sizeof(double); } /*---------------------------------------------------------------*/ diff --git a/mono/mini/tramp-s390x.c b/mono/mini/tramp-s390x.c index 4a604f97e16..eb61dc05cd4 100644 --- a/mono/mini/tramp-s390x.c +++ b/mono/mini/tramp-s390x.c @@ -48,6 +48,7 @@ #include "mini.h" #include "mini-s390x.h" #include "support-s390x.h" +#include "jit-icalls.h" /*========================= End of Includes ========================*/ @@ -57,6 +58,7 @@ typedef struct { guint8 stk[S390_MINIMAL_STACK_SIZE]; /* Standard s390x stack */ + guint64 saveFn; /* Call address */ struct MonoLMF LMF; /* LMF */ } trampStack_t; @@ -308,15 +310,22 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf S390_SET (buf, s390_r1, tramp); s390_basr (buf, s390_r14, s390_r1); - /* OK, code address is now on r2. Move it to r1, so that we - can restore r2 and use it from r1 later */ - s390_lgr (buf, s390_r1, s390_r2); + /* OK, code address is now on r2. Save it, so that we + can restore r2 and use it later */ + s390_stg (buf, s390_r2, 0, STK_BASE, G_STRUCT_OFFSET(trampStack_t, saveFn)); + + /* Check for thread interruption */ + S390_SET (buf, s390_r1, (guint8 *)mono_interruption_checkpoint_from_trampoline); + s390_basr (buf, s390_r14, s390_r1); /*---------------------------------------------------------- STEP 3: Restore the LMF ----------------------------------------------------------*/ restoreLMF(buf, STK_BASE, sizeof(trampStack_t)); + /* Reload result */ + s390_lg (buf, s390_r1, 0, STK_BASE, G_STRUCT_OFFSET(trampStack_t, saveFn)); + /*---------------------------------------------------------- STEP 4: call the compiled method ----------------------------------------------------------*/ |