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

Axel Boldt-Christmas aboldtch at openjdk.org
Tue Jan 13 08:16:39 UTC 2026


On Mon, 12 Jan 2026 15:38:08 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.
>
> Stefan Karlsson has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update src/hotspot/share/oops/objArrayOop.hpp
>   
>   Co-authored-by: Thomas Schatzl <59967451+tschatzl at users.noreply.github.com>

lgtm.

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

Marked as reviewed by aboldtch (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/29170#pullrequestreview-3654436558


More information about the shenandoah-dev mailing list