[jdk19] RFR: 8289091: move oop safety check from SharedRuntime::get_java_tid() to JavaThread::threadObj() [v3]
Daniel D. Daugherty
dcubed at openjdk.org
Fri Jul 1 01:01:06 UTC 2022
On Tue, 28 Jun 2022 16:55:29 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:
>> A trivial move of the oop safety check from SharedRuntime::get_java_tid() to
>> JavaThread::threadObj(). Also made adjustments to the threadObj() calls in
>> JavaThread::print_on_error() and JavaThread::get_thread_name_string() so
>> that we don't get secondary crashes when a JavaThread crashes after it has
>> detached the GC barrier.
>>
>> Tested with Mach5 Tier[1-7]. A Mach5 Tier8 will be started this weekend.
>
> Daniel D. Daugherty has updated the pull request incrementally with one additional commit since the last revision:
>
> dholmes CR - use Thread::current() instead of Thread::current_or_null().
This latest version has only been tested with Mach5 Tier1 so far.
In JavaThread::get_thread_name_string() and when you look at the PR with
white space changes disabled, you'll see this new code which is executed
in the "normal code" case:
Thread* current = Thread::current_or_null_safe();
assert(current != nullptr, "cannot be called by a detached thread");
if (!current->is_Java_thread() || JavaThread::cast(current)->is_oop_safe()) {
// Only access threadObj() if current thread is not a JavaThread
// or if it is a JavaThread that can safely access oops.
so I've switched to `Thread::current_or_null_safe` and added an
assert() for the `current` value not being `nullptr`.
-------------
PR: https://git.openjdk.org/jdk19/pull/69
More information about the hotspot-runtime-dev
mailing list