> This change prevents NullPointerException in the clhsdb dumpcodecache command. > > `CodeCache.createCodeBlobWrapper()` causes NullPointerException. > `CodeHeap.findStart()` may return null and `CodeHeap.iterate()` passes it to > `CodeCache.createCodeBlobWrapper()` as the `cbStart` argument. > > https://github.com/openjdk/jdk/blob/bbd629b0ef4d0ac7fbc2b33bb76170fd15060cd3/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/CodeHeap.java#L111 > > So this change makes `createCodeBlobWrapper()` return null when `cbStart` is > null. > > ### Testing > * jtreg:hotspot/jtreg/serviceability/sa/ > > $ make test TEST="jtreg:hotspot/jtreg/serviceability/sa/" > ============================== > TEST TOTAL PASS FAIL ERROR > SKIP > jtreg:test/hotspot/jtreg/serviceability/sa 81 76 0 0 > 5 > ============================== > > * Manual verification: dumpcodecache does not output NullPointerException. > > $ jhsdb clhsdb --pid 654607 > Attaching to process 654607, please wait... > hsdb> dumpcodecache > <snip> > hsdb> > > Note: `hotspot/jtreg/serviceability/sa/TestDebugInfoDecode.java` passed, but > printed NullPointerException before this change. There is no > NullPointerException in the test output after the change. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
Koichi Sakata has updated the pull request incrementally with one additional commit since the last revision: Check whether NullPointerException is printed in TestDebugInfoDecode ------------- Changes: - all: https://git.openjdk.org/jdk/pull/33568/files - new: https://git.openjdk.org/jdk/pull/33568/files/59a7dcab..111b7273 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=33568&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33568&range=00-01 Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/33568.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/33568/head:pull/33568 PR: https://git.openjdk.org/jdk/pull/33568
