From: Peter Molnar Date: Sat, 27 Oct 2007 00:55:32 +0000 (+0000) Subject: * src/vm/jit/linenumbertable.c (linenumbertable_create, linenumbertable_linenumber_fo... X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=38f0cefd4cdc83b0461b186bc16f43e07ec7c745;p=cacao.git * src/vm/jit/linenumbertable.c (linenumbertable_create, linenumbertable_linenumber_for_pc_intern) [__S390__]: Use 31 bits of addresses as lookup keys. * src/vm/jit/s390/codegen.c (codegen_emit_stub_native): In case of exception, use branch (not following) instruction as XPC. * src/vm/jit/s390/md.c (md_signal_handler_sigill): Fixes to scenario where JIT compiler fails. --- diff --git a/src/vm/jit/linenumbertable.c b/src/vm/jit/linenumbertable.c index 9909fc0c5..c8a7e6401 100644 --- a/src/vm/jit/linenumbertable.c +++ b/src/vm/jit/linenumbertable.c @@ -39,6 +39,11 @@ # include "vmcore/statistics.h" #endif +#if defined(__S390__) +# define ADDR_MASK(type, x) ((type)((uintptr_t)(x) & 0x7FFFFFFF)) +#else +# define ADDR_MASK(type, x) (x) +#endif /* linenumbertable_create ****************************************************** @@ -94,7 +99,7 @@ void linenumbertable_create(jitdata *jd) /* Fill the linenumber table entries in reverse order, so the search can be forward. */ - pv = code->entrypoint; + pv = ADDR_MASK(uint8_t *, code->entrypoint); for (le = list_last_unsynced(l); le != NULL; le = list_prev_unsynced(l, le), lnte++) { @@ -225,6 +230,8 @@ static s4 linenumbertable_linenumber_for_pc_intern(methodinfo **pm, linenumberta { linenumbertable_entry_t *lntinline; /* special entry for inlined method */ + pc = ADDR_MASK(void *, pc); + for (; lntsize > 0; lntsize--, lnte++) { /* Note: In case of inlining this may actually compare the pc against a methodinfo *, yielding a non-sensical diff --git a/src/vm/jit/s390/codegen.c b/src/vm/jit/s390/codegen.c index 689ca19b9..b0a1516f0 100644 --- a/src/vm/jit/s390/codegen.c +++ b/src/vm/jit/s390/codegen.c @@ -3750,6 +3750,7 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f, int s /* handle exception */ M_MOV(REG_RA, REG_ITMP1_XPC); + M_ASUB_IMM(2, REG_ITMP1_XPC); disp = dseg_add_functionptr(cd, asm_handle_nat_exception); M_ALD_DSEG(REG_ITMP2, disp); diff --git a/src/vm/jit/s390/md.c b/src/vm/jit/s390/md.c index 626f38234..1371bc1cc 100644 --- a/src/vm/jit/s390/md.c +++ b/src/vm/jit/s390/md.c @@ -244,6 +244,8 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p) /* The return address in is REG_RA */ ra = (u1 *)_mc->gregs[REG_RA]; + + xpc = ra - 2; } /* Handle the type. */ @@ -253,7 +255,8 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p) if (EXCEPTION_HARDWARE_COMPILER == type) { if (NULL == p) { _mc->gregs[REG_ITMP3_XPTR] = (intptr_t) builtin_retrieve_exception(); - _mc->gregs[REG_ITMP1_XPC] = (intptr_t) xpc; + _mc->gregs[REG_ITMP1_XPC] = (intptr_t) ra - 2; + _mc->gregs[REG_PV] = (intptr_t) md_codegen_get_pv_from_pc(ra); _mc->psw.addr = (intptr_t) asm_handle_exception; } else { _mc->gregs[REG_PV] = (intptr_t) p; @@ -679,7 +682,7 @@ void md_handle_exception(int32_t *regs, int64_t *fregs, int32_t *out) { /* new xpc is call before return address */ - xpc = ra; + xpc = ra - 2; } else { xpc = handler;