diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index c23c98a440e..aa0f7c12dfb 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -780,7 +780,7 @@ AC_DEFUN([JDKOPT_CHECK_CODESIGN_PARAMS], $RM "$CODESIGN_TESTFILE" $TOUCH "$CODESIGN_TESTFILE" CODESIGN_SUCCESS=false - $CODESIGN $PARAMS "$CODESIGN_TESTFILE" 2>&AS_MESSAGE_LOG_FD \ + eval \"$CODESIGN\" $PARAMS \"$CODESIGN_TESTFILE\" 2>&AS_MESSAGE_LOG_FD \ >&AS_MESSAGE_LOG_FD && CODESIGN_SUCCESS=true $RM "$CODESIGN_TESTFILE" AC_MSG_CHECKING([$MESSAGE]) @@ -793,7 +793,7 @@ AC_DEFUN([JDKOPT_CHECK_CODESIGN_PARAMS], AC_DEFUN([JDKOPT_CHECK_CODESIGN_HARDENED], [ - JDKOPT_CHECK_CODESIGN_PARAMS([-s "$MACOSX_CODESIGN_IDENTITY" --option runtime], + JDKOPT_CHECK_CODESIGN_PARAMS([-s \"$MACOSX_CODESIGN_IDENTITY\" --option runtime], [if codesign with hardened runtime is possible]) ]) diff --git a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp index 40afbe3f065..4ca90e584be 100644 --- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp @@ -1230,6 +1230,15 @@ static void gen_continuation_yield(MacroAssembler* masm, __ bind(pinned); // pinned -- return to caller + // handle pending exception thrown by freeze + __ ldr(rscratch1, Address(rthread, in_bytes(Thread::pending_exception_offset()))); + Label ok; + __ cbz(rscratch1, ok); + __ leave(); + __ lea(rscratch1, RuntimeAddress(StubRoutines::forward_exception_entry())); + __ br(rscratch1); + __ bind(ok); + __ leave(); __ ret(lr); diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp index 2cd3323f181..27e2bae6ab7 100644 --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp @@ -1990,6 +1990,19 @@ static void gen_continuation_yield(MacroAssembler* masm, __ bind(L_pinned); // pinned -- return to caller + // handle pending exception thrown by freeze + Label ok; + __ ld(tmp, in_bytes(JavaThread::pending_exception_offset()), R16_thread); + __ cmpdi(CCR0, tmp, 0); + __ beq(CCR0, ok); + __ pop_frame(); + __ ld(R0, _abi0(lr), R1_SP); // Return pc + __ mtlr(R0); + __ load_const_optimized(tmp, StubRoutines::forward_exception_entry(), R0); + __ mtctr(tmp); + __ bctr(); + __ bind(ok); + // Pop frame and return __ pop_frame(); __ ld(R0, _abi0(lr), R1_SP); // Return pc diff --git a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp index 136508af21d..71930240ac5 100644 --- a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp +++ b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp @@ -1107,6 +1107,15 @@ static void gen_continuation_yield(MacroAssembler* masm, __ bind(pinned); // pinned -- return to caller + // handle pending exception thrown by freeze + __ ld(t0, Address(xthread, in_bytes(Thread::pending_exception_offset()))); + Label ok; + __ beqz(t0, ok); + __ leave(); + __ la(t0, RuntimeAddress(StubRoutines::forward_exception_entry())); + __ jr(t0); + __ bind(ok); + __ leave(); __ ret(); diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index 4ebdaa04aae..8a4a7aa22b1 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -1587,6 +1587,15 @@ static void gen_continuation_yield(MacroAssembler* masm, __ bind(L_pinned); // Pinned, return to caller + + // handle pending exception thrown by freeze + __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), NULL_WORD); + Label ok; + __ jcc(Assembler::equal, ok); + __ leave(); + __ jump(RuntimeAddress(StubRoutines::forward_exception_entry())); + __ bind(ok); + __ leave(); __ ret(0); } diff --git a/src/hotspot/share/runtime/continuationFreezeThaw.cpp b/src/hotspot/share/runtime/continuationFreezeThaw.cpp index a18fd0359ed..ceef56ca751 100644 --- a/src/hotspot/share/runtime/continuationFreezeThaw.cpp +++ b/src/hotspot/share/runtime/continuationFreezeThaw.cpp @@ -275,7 +275,7 @@ public: static bool stack_overflow_check(JavaThread* thread, int size, address sp) { const int page_size = os::vm_page_size(); if (size > page_size) { - if (sp - size < thread->stack_overflow_state()->stack_overflow_limit()) { + if (sp - size < thread->stack_overflow_state()->shadow_zone_safe_limit()) { return false; } } @@ -1260,7 +1260,7 @@ NOINLINE void FreezeBase::finish_freeze(const frame& f, const frame& top) { inline bool FreezeBase::stack_overflow() { // detect stack overflow in recursive native code JavaThread* t = !_preempt ? _thread : JavaThread::current(); assert(t == JavaThread::current(), ""); - if (os::current_stack_pointer() < t->stack_overflow_state()->stack_overflow_limit()) { + if (os::current_stack_pointer() < t->stack_overflow_state()->shadow_zone_safe_limit()) { if (!_preempt) { ContinuationWrapper::SafepointOp so(t, _cont); // could also call _cont.done() instead Exceptions::_throw_msg(t, __FILE__, __LINE__, vmSymbols::java_lang_StackOverflowError(), "Stack overflow while freezing");