RFR: 8360192: C2: Make the type of count leading/trailing zero nodes more precise [v14]
    Qizheng Xing 
    qxing at openjdk.org
       
    Tue Oct 14 06:16:09 UTC 2025
    
    
  
On Fri, 12 Sep 2025 12:46:44 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Qizheng Xing has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove redundant import
>
> test/hotspot/jtreg/compiler/c2/gvn/TestCountBitsRange.java line 516:
> 
>> 514:     }
>> 515: 
>> 516:     int getResultChecksum(int result, int[] LIMITS) {
> 
> I would put a `@ForceInlinie` before this. You are using it in many methods, and so it may not get inlined reliably. And if it does not get inlined, then the result verifcation would not constant-fold, and so it would be kind of useless. Because we rely on the fact that if the range is wrong, we could get bad constant folding ;)
Added `@ForceInline`.
> test/hotspot/jtreg/compiler/c2/gvn/TestCountBitsRange.java line 521:
> 
>> 519:             if (result < LIMITS[i]) sum += 1 << i;
>> 520:             if (result > LIMITS[i + 1]) sum += 1 << (i + 1);
>> 521:         }
> 
> I doublt that this works, because the test would not constant fold if the range was too narrow.
> I think you need to manually unroll the loop, and load the constants from `static final` values, or another method that allows it to be a compile time constant.
Updated.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25928#discussion_r2428020170
PR Review Comment: https://git.openjdk.org/jdk/pull/25928#discussion_r2428020382
    
    
More information about the hotspot-compiler-dev
mailing list