On Sat, 3 Sep 2022 11:05:18 GMT, Kevin Walls <kev...@openjdk.org> wrote:

>> src/hotspot/share/runtime/javaThread.cpp line 165:
>> 
>>> 163: oop JavaThread::threadObj() const {
>>> 164:   // Using Thread::current_or_null_safe() here risks that calling 
>>> threadObj() can
>>> 165:   // overwrite a native thread local, e.g. JVMTI operations clearing 
>>> GetLastError on Windows.
>> 
>> Suggestion:
>> 
>> // Ideally we would verify the current thread is oop_safe when this is 
>> called, but as we can
>> // be called from a signal handler we would have to use 
>> Thread::current_or_null_safe(). That
>> // has overhead and also interacts poorly with GetLastError on Windows due 
>> to the use of TLS.
>> // Instead callers must verify oop safe access.
>
> Thanks David, will update comment and check Dan is OK with this.

Updated comment.

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

PR: https://git.openjdk.org/jdk/pull/10147

Reply via email to