On Fri, 17 Apr 2026 08:13:43 GMT, Stefan Karlsson <[email protected]> wrote:

>> In JDK-8381934 "Wrong type passed to FREE_C_HEAP_ARRAY deallocating 
>> G1CardSetMemoryManager" we saw how the wrong type was being passed to the 
>> FREE_C_HEAP_ARRAY macro. That bug is benign, because the type parameter is 
>> not used. I see that we have similar issues in some of our gtests. I propose 
>> that we get rid of the type parameter to remove this confusion and lower the 
>> line noise on these lines.
>> 
>> I also propose that we get rid of it from the REALLOC_ macros. These macros 
>> however are using the type parameter, but we can infer the type from the 
>> other parameters, so I propose that we do that instead.
>> 
>> Tested with tier1-3
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Stefan Karlsson has updated the pull request incrementally with two 
> additional commits since the last revision:
> 
>  - Use REALLOC_RETURN_TYPE in arena.hpp
>  - Minor tweak of comment

src/hotspot/share/memory/allocation.hpp line 514:

> 512: 
> 513: #define FREE_FAST(obj)\
> 514:     /* nop */

Suggestion:



Not referenced anywhere, please remove.

src/hotspot/share/opto/block.cpp line 1433:

> 1431:     uint size = 16;
> 1432:     while( size <= from_idx ) size <<=1;
> 1433:     _indices = REALLOC_RESOURCE_ARRAY( _indices, _max, size );

Suggestion:

    _indices = REALLOC_RESOURCE_ARRAY(_indices, _max, size );

src/hotspot/share/opto/compile.cpp line 1622:

> 1620:   _max_alias_types = grow_ats;
> 1621:   _alias_types =  REALLOC_ARENA_ARRAY(comp_arena(), _alias_types, 
> old_ats, grow_ats);
> 1622:   AliasType* ats =    NEW_ARENA_ARRAY(comp_arena(), AliasType, new_ats);

Pre-existing but this code aligns to the opening bracket, and similar code in 
`loopnode.cpp` aligns on the "=". May be worth choosing one or other style.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30786#discussion_r3099310577
PR Review Comment: https://git.openjdk.org/jdk/pull/30786#discussion_r3099265120
PR Review Comment: https://git.openjdk.org/jdk/pull/30786#discussion_r3099274468

Reply via email to