# 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 ******************************************************
/* 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++) {
{
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
/* 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);
/* The return address in is REG_RA */
ra = (u1 *)_mc->gregs[REG_RA];
+
+ xpc = ra - 2;
}
/* Handle the type. */
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;
/* new xpc is call before return address */
- xpc = ra;
+ xpc = ra - 2;
} else {
xpc = handler;