RFR: 8254824: SignalHandlerMark have no purpose

David Holmes david.holmes at oracle.com
Thu Oct 15 11:35:41 UTC 2020


On 15/10/2020 7:08 pm, Thomas Stuefe wrote:
> On Thu, 15 Oct 2020 08:46:01 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
> 
>> SignalHandlerMark increase and decrease _num_nested_signal, but it is never read.
>> We have no caller to is_inside_signal_handler().
>>
>> Testing T1.
> 
> Looks good. Seems like a leftover from Solaris.

Yes (for os::fork_and_exec), and also the old Thread::current() code:

inline Thread* Thread::current() {
#ifdef ASSERT
// This function is very high traffic. Define PARANOID to enable expensive
// asserts.
#ifdef PARANOID
   // Signal handler should call ThreadLocalStorage::get_thread_slow()
   Thread* t = ThreadLocalStorage::get_thread_slow();
   assert(t != NULL && !t->is_inside_signal_handler(),
          "Don't use Thread::current() inside signal handler");
#endif
#endif
   Thread* thread = ThreadLocalStorage::thread();
   assert(thread != NULL, "just checking");
   return thread;
}

Arguably we should be checking that a lot of code is never executed in a 
signal handling context, but crash reporting will likely invalidate any 
attempt to do (unless we have an escape clause for when doing error 
reporting).

David
-----

> -------------
> 
> Marked as reviewed by stuefe (Reviewer).
> 
> PR: https://git.openjdk.java.net/jdk/pull/677
> 


More information about the hotspot-runtime-dev mailing list