On Wed, 14 Jan 2026 12:34:51 GMT, ExE Boss <[email protected]> wrote:

>> test/hotspot/jtreg/compiler/intrinsics/string/TestRangeCheck.java line 58:
>> 
>>> 56:             // cut off the dead code. As a result, -1 is fed as input 
>>> into the
>>> 57:             // StringCoding::countPositives0 intrinsic which is 
>>> replaced by TOP and causes a
>>> 58:             // failure in the matcher.
>> 
>> I'd appreciate it if we can be more elaborate for less C2-illiterate people 
>> like myself. 😇
>> 
>> Suggestion:
>> 
>>             // Calling `StringCoding::countPositives`, which is a "front 
>> door"
>>             // to the `StringCoding::countPositives0` intrinsic.
>>             // `countPositives` validates its input using
>>             // `Preconditions::checkFromIndexSize`, which also maps to an
>>             // intrinsic. When `checkFromIndexSize` is not inlined, C2 does 
>> not
>>             // know about the explicit range checks, and does not cut off the
>>             // dead code. As a result, an invalid value (e.g., `-1`) can be 
>> fed
>>             // as input into the `countPositives0` intrinsic, got replaced
>>             // by TOP, and cause a failure in the matcher.
>
> **Nit:** Using “get” here is grammatically better:
> 
>              // intrinsic. When `checkFromIndexSize` is not inlined, C2 does 
> not
>              // know about the explicit range checks, and does not cut off the
> -            // as input into the `countPositives0` intrinsic, got replaced
> +            // as input into the `countPositives0` intrinsic, get replaced
>              // by TOP, and cause a failure in the matcher.

Done. Thanks for the suggestion!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29164#discussion_r2694948915

Reply via email to