[jdk19] RFR: 8289091: move oop safety check from SharedRuntime::get_java_tid() to JavaThread::threadObj() [v3]
Daniel D. Daugherty
dcubed at openjdk.org
Wed Jun 29 18:26:36 UTC 2022
On Wed, 29 Jun 2022 14:32:54 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> 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().
>
> src/hotspot/share/runtime/thread.cpp line 2151:
>
>> 2149: st->print("%s \"%s\"", type_name(), get_thread_name_string(buf, buflen));
>> 2150: Thread* current = Thread::current();
>> 2151: if (!current->is_Java_thread() || JavaThread::cast(current)->is_oop_safe()) {
>
> This is really tricky. Why not have threadObj() return null if this is happening. Then you can say why in that function.
The purpose of the guarantee() in threadObj() is catch bad calls to
threadObj() that a thread makes after it has passed the GC barrier detach
point. Returning nullptr from threadObj() would defeat this purpose.
-------------
PR: https://git.openjdk.org/jdk19/pull/69
More information about the hotspot-runtime-dev
mailing list