On Mon, 21 Sep 2026 11:38:58 GMT, Stefan Karlsson <[email protected]> wrote:

>> src/hotspot/share/classfile/fieldLayoutBuilder.hpp line 311:
>> 
>>> 309: 
>>> 310:   template<typename T>
>>> 311:   int largest_layout_of(T lk) {
>> 
>> The name of this function seems a bit off, given that it only tests one 
>> layout  kind instance. And with that said, is this even used? It looks like 
>> this was supposed to be the base case, but the `largest_layout_of` function 
>> below doesn't use this function, but instead has its own version of it.
>
> I looked at this again and see that the function is used. It is still true 
> that the code is duplicated in the two functions.

Well, it's not duplicated, they are different. One takes the base-case, and one 
takes the recursive case. In C++17 you can also use folding functions ( 
https://en.cppreference.com/cpp/language/fold ) but I think that those look 
even stranger.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32276#discussion_r4062396818

Reply via email to