RFR: 8253694: Remove Thread::muxAcquire() from ThreadCrashProtection()

Patricio Chilano Mateo pchilanomate at openjdk.java.net
Mon Sep 28 21:08:24 UTC 2020


On Mon, 28 Sep 2020 15:00:20 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Hi all,
>> 
>> Please review the following patch. Current ThreadCrashProtection() implementation uses static members which requires
>> the use of Thread::muxAcquire() to allow only one user at a time. We can avoid this synchronization requirement if each
>> thread has its own ThreadCrashProtection *data. I tested it builds on Linux, macOS and Windows. Since the
>> JfrThreadSampler is the only one using this I run all the tests from test/jdk/jdk/jfr/. I also run some tests with JFR
>> enabled while forcing a crash in OSThreadSampler::protected_task() and tests passed with several "Thread method sampler
>> crashed" UL output. Also run tiers1-3.  Thanks, Patricio
>
> src/hotspot/share/runtime/thread.hpp line 756:
> 
>> 754:   }
>> 755: #endif
>> 756:
> 
> Could this be pushed down into osThread ?

Yes, it can but it's not that clean I think given the osthread indirections. Here's how it looks:
https://github.com/pchilano/jdk/commit/73a41ad867b4b7466cdddc87173828b4e80f8179

I think another alternative could be to remove the "#ifndef _WINDOWS" clause and define an empty
check_crash_protection() method in os_windows.hpp

-------------

PR: https://git.openjdk.java.net/jdk/pull/376


More information about the hotspot-runtime-dev mailing list