RFR: 8295851: Do not use ttyLock in BytecodeTracer::trace [v3]

Coleen Phillimore coleenp at openjdk.org
Mon Jun 23 11:55:27 UTC 2025


On Mon, 23 Jun 2025 05:47:29 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Put back include osthread.hpp
>
> src/hotspot/share/interpreter/bytecodeTracer.cpp line 182:
> 
>> 180: // the method has changed. If this method is redefined and removed, that's ok because the method passed in won't match, and
>> 181: // this will print that one.
>> 182: static Method* _current_method = nullptr;
> 
> And if we are calling `trace_interpreter` from multiple threads they will each stomp on this shared global field. Sorry I can't see how some form of locking is not needed here.

If multiple threads change the value of _current_method, the method printing will print the method name again.  That's a benign race.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25915#discussion_r2161434683


More information about the hotspot-runtime-dev mailing list