Skip to content

Commit

Permalink
8254824: SignalHandlerMark have no purpose
Browse files Browse the repository at this point in the history
Reviewed-by: stuefe, shade, dholmes, coleenp
  • Loading branch information
robehn committed Oct 19, 2020
1 parent 736e077 commit 011dd0d
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 49 deletions.
2 changes: 0 additions & 2 deletions src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec

Thread* t = Thread::current_or_null_safe();

SignalHandlerMark shm(t);

// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
Expand Down
7 changes: 3 additions & 4 deletions src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,11 @@ JVM_handle_bsd_signal(int sig,

Thread* t = Thread::current_or_null_safe();

// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
// (no destructors can be run)
// If crash protection is installed we may longjmp away and no destructors
// for objects in this scope will be run.
// So don't use any RAII utilities before crash protection is checked.
os::ThreadCrashProtection::check_crash_protection(sig, t);

SignalHandlerMark shm(t);

// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ JVM_handle_bsd_signal(int sig,

Thread* t = Thread::current_or_null_safe();

SignalHandlerMark shm(t);

// handle SafeFetch faults
if (sig == SIGSEGV || sig == SIGBUS) {
sigjmp_buf* const pjb = get_jmp_buf_for_continuation();
Expand Down
7 changes: 3 additions & 4 deletions src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,11 @@ JVM_handle_linux_signal(int sig,

Thread* t = Thread::current_or_null_safe();

// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
// (no destructors can be run)
// If crash protection is installed we may longjmp away and no destructors
// for objects in this scope will be run.
// So don't use any RAII utilities before crash protection is checked.
os::ThreadCrashProtection::check_crash_protection(sig, t);

SignalHandlerMark shm(t);

// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
Expand Down
7 changes: 3 additions & 4 deletions src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,11 @@ extern "C" int JVM_handle_linux_signal(int sig, siginfo_t* info,

Thread* t = Thread::current_or_null_safe();

// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
// (no destructors can be run)
// If crash protection is installed we may longjmp away and no destructors
// for objects in this scope will be run.
// So don't use any RAII utilities before crash protection is checked.
os::ThreadCrashProtection::check_crash_protection(sig, t);

SignalHandlerMark shm(t);

if (sig == SIGILL &&
((info->si_addr == (caddr_t)check_simd_fault_instr)
|| info->si_addr == (caddr_t)check_vfp_fault_instr
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ JVM_handle_linux_signal(int sig,

Thread* t = Thread::current_or_null_safe();

SignalHandlerMark shm(t);

// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
Expand Down
7 changes: 3 additions & 4 deletions src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,11 @@ JVM_handle_linux_signal(int sig,

Thread* t = Thread::current_or_null_safe();

// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
// (no destructors can be run).
// If crash protection is installed we may longjmp away and no destructors
// for objects in this scope will be run.
// So don't use any RAII utilities before crash protection is checked.
os::ThreadCrashProtection::check_crash_protection(sig, t);

SignalHandlerMark shm(t);

// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
Expand Down
7 changes: 3 additions & 4 deletions src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,11 @@ JVM_handle_linux_signal(int sig,

Thread* t = Thread::current_or_null_safe();

// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
// (no destructors can be run)
// If crash protection is installed we may longjmp away and no destructors
// for objects in this scope will be run.
// So don't use any RAII utilities before crash protection is checked.
os::ThreadCrashProtection::check_crash_protection(sig, t);

SignalHandlerMark shm(t);

// Note: it's not uncommon that JNI code uses signal/sigset to install
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ JVM_handle_linux_signal(int sig,

Thread* t = Thread::current_or_null_safe();

SignalHandlerMark shm(t);

// handle SafeFetch faults
if (sig == SIGSEGV || sig == SIGBUS) {
sigjmp_buf* const pjb = get_jmp_buf_for_continuation();
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/runtime/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ Thread::Thread() {
_current_pending_monitor_is_from_java = true;
_current_waiting_monitor = NULL;
_current_pending_raw_monitor = NULL;
_num_nested_signal = 0;
om_free_list = NULL;
om_free_count = 0;
om_free_provision = 32;
Expand Down
20 changes: 0 additions & 20 deletions src/hotspot/share/runtime/thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,9 @@ class Thread: public ThreadShadow {
volatile uint32_t _suspend_flags;

private:
int _num_nested_signal;

DEBUG_ONLY(bool _suspendible_thread;)

public:
void enter_signal_handler() { _num_nested_signal++; }
void leave_signal_handler() { _num_nested_signal--; }
bool is_inside_signal_handler() const { return _num_nested_signal > 0; }

// Determines if a heap allocation failure will be retried
// (e.g., by deoptimizing and re-executing in the interpreter).
// In this case, the failed allocation must raise
Expand Down Expand Up @@ -2146,20 +2140,6 @@ class Threads: AllStatic {
struct Test; // For private gtest access.
};

class SignalHandlerMark: public StackObj {
private:
Thread* _thread;
public:
SignalHandlerMark(Thread* t) {
_thread = t;
if (_thread) _thread->enter_signal_handler();
}
~SignalHandlerMark() {
if (_thread) _thread->leave_signal_handler();
_thread = NULL;
}
};

class UnlockFlagSaver {
private:
JavaThread* _thread;
Expand Down

1 comment on commit 011dd0d

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 011dd0d Oct 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.