On Tue, 20 Oct 2026 09:17:55 GMT, Koichi Sakata <[email protected]> wrote:

> This change fixes an infinite loop in the clhsdb dumpcodecache command.
> 
> [JDK-8166317](https://bugs.openjdk.org/browse/JDK-8166317) introduced 
> trimming of the unused tail of the interpreter’s stub buffer, allowing 
> `_queue_end` to `equal _buffer_limit`. The native `StubQueue::next()` was 
> updated to handle this case, but the corresponding change was not made to 
> SA’s `StubQueue.getNext()`.
> 
> The native `StubQueue::next()` already handles this case:
> https://github.com/openjdk/jdk/blob/a5d5806cb48100eff225898129bb357778d7cfa0/src/hotspot/share/code/stubs.hpp#L211-L213
> This change adds the missing wrap-around condition to SA’s 
> `StubQueue.getNext()`.
> 
> ### Testing
> - jtreg:hotspot/jtreg/serviceability/sa/
> 
> 
> TEST                                              TOTAL  PASS  FAIL ERROR  
> SKIP
> jtreg:test/hotspot/jtreg/serviceability/sa           80    75     0     0     
> 5
> 
> 
> - Manual verification: dumpcodecache returns to the clhsdb prompt, and a 
> subsequent command can be executed.
> 
> $ jhsdb clhsdb --pid 13353
> Attaching to process 133539, please wait...
> hsdb> dumpcodecache
> Disassembly for compiled method [public static int toUnsignedInt(byte) 
> @0x0000ffff50175988 ] @0x0000ffff74ac8008
> 
> Method
> public static int toUnsignedInt(byte) @0x0000ffff50175988 of public final 
> class java.lang.Byte [signature 
> Ljava/lang/Number;Ljava/lang/Comparable<Ljava/lang/Byte;>;Ljava/lang/constant/Constable;]
>  @0x0000001c0005f000
> <snip>
> 0x0000ffff746a495c:    br       x8
> 
> java.lang.NullPointerException
> java.lang.NullPointerException
> hsdb>
> 
> 
> During verification, I also observed NullPointerExceptions during CodeHeap 
> iteration. Source history indicates that these are caused by a separate 
> null-handling regression introduced by 
> [JDK-8349088](https://bugs.openjdk.org/browse/JDK-8349088). I will file a 
> separate JBS issue and address that problem independently.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Thank you for reviewing, Chris and Yasumasa!

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

PR Comment: https://git.openjdk.org/jdk/pull/33463#issuecomment-6356256386

Reply via email to