RFR: 8375040: Clearer names for non-metadata oop iterators in ObjArrayKlass

Stefan Karlsson stefank at openjdk.org
Mon Jan 12 14:27:41 UTC 2026


During the review of [JDK-8374780](https://bugs.openjdk.org/browse/JDK-8374780) it was clear that the naming of the various oop iterators, and also their comments, were somewhat misleading about if they visited the metadata or not.

I propose that we make a clear separation and have it so that all iterators that only visit the array elements are named to contain the word "elements" to make it slightly clearer that these iterators only visits the elements.

So, we know how the following ObjArrayKlass oop iterators:

Iterators that also visit the metadata:

oop_oop_iterate
oop_oop_iterate_reverse
oop_oop_iterate_bounded


Iterators that are not visiting the metadata:

oop_oop_iterate_elements
oop_oop_iterate_elements_range
oop_oop_iterate_elements_bounded


The objArrayOopDesc class also exposes an oop iterator and that function has been renamed to mimic the above scheme to add the `_elements` to functions that does not visit the metadata:

oop_iterate_elements_range


Two extra things to check in the patch:

1) I did some slight tweaks to the code so that `oop_oop_iterate_elements` is implemented with `oop_oop_iterate_elements_range`.

2) I moved the objArrayOopDesc function back to the oopArrayOop.inline.hpp. The reason is that we have now solved the problems with circular dependencies between .inline.hpp files, so this workaround isn't needed anymore.

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

Commit messages:
 -     8375040: Clearer names for non-metadata oop iterators in ObjArrayKlass

Changes: https://git.openjdk.org/jdk/pull/29170/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29170&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8375040
  Stats: 62 lines in 11 files changed: 18 ins; 21 del; 23 mod
  Patch: https://git.openjdk.org/jdk/pull/29170.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29170/head:pull/29170

PR: https://git.openjdk.org/jdk/pull/29170


More information about the shenandoah-dev mailing list