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

David Holmes dholmes at openjdk.org
Tue Jun 24 02:53:32 UTC 2025


On Fri, 20 Jun 2025 13:29:42 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> This didn't need ttyLock for synchronization, the code only needs to see if the method changes so it can print the method name before the bytecodes, like:
>> 
>> [490166] static void java.lang.String.<clinit>()
>> [490166]       13    18  putstatic 613 <java/lang/String.CASE_INSENSITIVE_ORDER:Ljava/util/Comparator;>
>> [490166]       14    21  return
>> 
>> [490166] static void java.lang.System.<clinit>()
>> [490166]       15     0  invokestatic 471 <java/lang/System.registerNatives()V>
>> [490166]       16     3  aconst_null
>> [490166]       17     4  putstatic 474 <java/lang/System.in:Ljava/io/InputStream;>
>> 
>> Verified manually and added some parallelism to the test, and fixed trace() to initialize is_linked(), which it always is.
>> Also ran tier1-4.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Put back include osthread.hpp

Changes requested by dholmes (Reviewer).

src/hotspot/share/interpreter/bytecodeTracer.cpp line 186:

> 184: void BytecodeTracer::trace_interpreter(const methodHandle& method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st) {
> 185:   if (TraceBytecodes && BytecodeCounter::counter_value() >= TraceBytecodesAt) {
> 186:     BytecodePrinter printer(_current_method);

You need a `Atomic::load_acquire` here to pair with the `Atomic::release_store` below.

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

PR Review: https://git.openjdk.org/jdk/pull/25915#pullrequestreview-2952022500
PR Review Comment: https://git.openjdk.org/jdk/pull/25915#discussion_r2162859385


More information about the hotspot-runtime-dev mailing list