RFR: 8261954: Dependencies: Improve iteration over class hierarchy under context class [v2]

Vladimir Ivanov vlivanov at openjdk.java.net
Fri Feb 26 08:22:53 UTC 2021


> Simplify `ClassHierarchyWalker::find_witness_anywhere()` which iterates over class hierarchy under context class searching for witnesses.
> 
> Current implementation traverses the hierarchy in a breadth-first manner and keeps a stack-allocated array to keep a worklist.
> But all the subclasses are already part of a singly linked list formed by `Klass::subklass()`/`next_sibling()`/`superklass()`.
> 
> Proposed refactoring gets rid of the explicit worklist and switches to the traversal over the linked list (encapsulated into `ClassHierarchyIterator`). It performs depth-first pre-order hierarchy traversal. 
> 
> (There are some other minor refactorings applied in `ClassHierarchyWalker` along the way.) 
> 
> Testing:
> - [x] hs-tier1 - hs-tier8
> - [x] additional verification that CHA decisions aren't affected

Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:

  Move ClassHierarchyIterator::next() into CPP file

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2630/files
  - new: https://git.openjdk.java.net/jdk/pull/2630/files/ae78e51e..7237e9c5

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2630&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2630&range=00-01

  Stats: 39 lines in 2 files changed: 21 ins; 17 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2630.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2630/head:pull/2630

PR: https://git.openjdk.java.net/jdk/pull/2630


More information about the hotspot-runtime-dev mailing list