mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8261954: Dependencies: Improve iteration over class hierarchy under context class
Reviewed-by: kvn, coleenp, eosterlund
This commit is contained in:
parent
722142ee6c
commit
0a4e710ff6
3 changed files with 104 additions and 105 deletions
|
@ -4284,3 +4284,24 @@ void InstanceKlass::log_to_classlist(const ClassFileStream* stream) const {
|
|||
}
|
||||
#endif // INCLUDE_CDS
|
||||
}
|
||||
|
||||
// Make a step iterating over the class hierarchy under the root class.
|
||||
// Skips subclasses if requested.
|
||||
void ClassHierarchyIterator::next() {
|
||||
assert(_current != NULL, "required");
|
||||
if (_visit_subclasses && _current->subklass() != NULL) {
|
||||
_current = _current->subklass();
|
||||
return; // visit next subclass
|
||||
}
|
||||
_visit_subclasses = true; // reset
|
||||
while (_current->next_sibling() == NULL && _current != _root) {
|
||||
_current = _current->superklass(); // backtrack; no more sibling subclasses left
|
||||
}
|
||||
if (_current == _root) {
|
||||
// Iteration is over (back at root after backtracking). Invalidate the iterator.
|
||||
_current = NULL;
|
||||
return;
|
||||
}
|
||||
_current = _current->next_sibling();
|
||||
return; // visit next sibling subclass
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue