Integrated: 8375040: Clearer names for non-metadata oop iterators in ObjArrayKlass
Stefan Karlsson
stefank at openjdk.org
Thu Jan 15 09:27:03 UTC 2026
On Mon, 12 Jan 2026 14:15:57 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
> 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.
This pull request has now been integrated.
Changeset: bf0da3dd
Author: Stefan Karlsson <stefank at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/bf0da3dd5c20410aceab8e6f7a7a31432d17b96d
Stats: 62 lines in 11 files changed: 18 ins; 21 del; 23 mod
8375040: Clearer names for non-metadata oop iterators in ObjArrayKlass
Reviewed-by: tschatzl, kbarrett, aboldtch
-------------
PR: https://git.openjdk.org/jdk/pull/29170
More information about the shenandoah-dev
mailing list