Skip to content

Commit dbc16dd

Browse files
committed
fix exception throw in sharedRuntime_s390
1 parent 48d06c8 commit dbc16dd

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/hotspot/cpu/s390/sharedRuntime_s390.cpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,29 +1674,35 @@ static void gen_continuation_enter(MacroAssembler* masm,
16741674
// --- Exception handling path
16751675
exception_offset = __ pc() - start;
16761676

1677-
// FIXME: taken from stubGenerator, grep for exception_handler_for_return_address
1678-
__ stop("exception is there: sharedRuntime_s390.cpp");
1679-
__ z_lgr(Z_ARG2, Z_R14); // Copy exception pc into Z_ARG2.
1677+
// Load caller's return pc
1678+
__ z_lg(Z_ARG2, _z_common_abi(callers_sp), Z_SP);
1679+
__ z_lg(Z_ARG2, _z_common_abi(return_pc), Z_ARG2);
1680+
16801681
__ save_return_pc();
1681-
__ push_frame_abi160(0);
1682+
__ push_frame_abi160(0 + 2 * BytesPerWord);
1683+
1684+
__ z_stg(Z_ARG1, 0 * BytesPerWord + frame::z_abi_160_size, Z_SP); // save return value containing the exception oop
1685+
__ z_stg(Z_ARG2, 1 * BytesPerWord + frame::z_abi_160_size, Z_SP); // save exception_pc
1686+
16821687
// Find exception handler.
16831688
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address),
16841689
Z_thread,
16851690
Z_ARG2);
1691+
16861692
// Copy handler's address.
16871693
__ z_lgr(Z_R1, Z_RET);
1688-
__ pop_frame();
1689-
__ restore_return_pc();
1694+
16901695
// Set up the arguments for the exception handler:
16911696
// - Z_ARG1: exception oop
16921697
// - Z_ARG2: exception pc
1693-
// Load pending exception oop.
1694-
__ z_lg(Z_ARG1, in_bytes(Thread::pending_exception_offset()), Z_thread);
1695-
// The exception pc is the return address in the caller,
1696-
// must load it into Z_ARG2
1697-
__ z_lgr(Z_ARG2, Z_R14);
1698-
// Clear the pending exception.
1699-
__ clear_mem(Address(Z_thread, in_bytes(Thread::pending_exception_offset())), sizeof(void *));
1698+
__ z_lg(Z_ARG1, 0 * BytesPerWord + frame::z_abi_160_size, Z_SP); // load the exception oop
1699+
__ z_lg(Z_ARG2, 1 * BytesPerWord + frame::z_abi_160_size, Z_SP); // load the exception pc
1700+
1701+
__ pop_frame(); // pop frame pushed before runtime call
1702+
1703+
__ pop_frame(); // pop enterSpecial frame
1704+
__ restore_return_pc();
1705+
17001706
// Jump to exception handler
17011707
__ z_br(Z_R1 /*handler address*/);
17021708
}

0 commit comments

Comments
 (0)