RFR: 8334866: Improve Speed of ElfDecoder source search
Kerem Kat
krk at openjdk.org
Wed Sep 17 10:25:21 UTC 2025
Right now, looking up source file and line number info is slow because we do a full linear scan of the `.debug_aranges` section for every single call. This can be a major bottleneck on large binaries, especially during frequent native stack walking, e.g. while writing an hs_err.
This change fixes that by caching the address ranges on the first lookup, and keeping it in memory for the lifetime of the `DwarfFile` object.
All subsequent lookups on that object now use a binary search instead of the slow linear scan. If caching fails for any reason, it just falls back to the old method.
-------------
Commit messages:
- 8334866: Cache debug_aranges for faster address lookups
Changes: https://git.openjdk.org/jdk/pull/27337/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27337&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8334866
Stats: 188 lines in 2 files changed: 186 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/27337.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27337/head:pull/27337
PR: https://git.openjdk.org/jdk/pull/27337
More information about the hotspot-dev
mailing list