RFR: 8350896: Integer/Long.compress gets wrong type from CompressBitsNode::Value [v14]

Tobias Hartmann thartmann at openjdk.org
Tue Jul 15 14:52:48 UTC 2025


On Mon, 14 Jul 2025 13:48:07 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> Hi All,
>> 
>> This bugfix patch fixes incorrect value computation for Integer/Long. compress APIs.
>> 
>> Problems occur with a constant input and variable mask where the input's value is equal to the lower bound of the mask value., In this case, an erroneous value range estimation results in a constant value. Existing value routine first attempts to constant fold the compression operation if both input and compression mask are constant values; otherwise, it attempts to constrain the value range of result based on the upper and lower bounds of mask type.
>> 
>> New IR test covers the issue reported in the bug report along with a case for value range based logic pruning.
>> 
>> Kindly review and share your feedback.
>> 
>> Best Regards,
>> Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Broken assertions fix

With the latest version, I see this failure:


java/lang/CompressExpandTest.java
-Xcomp -ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -server -XX:+TieredCompilation -XX:+DeoptimizeALot

 870  Phi  === 820 227 872  [[ 339 339 120 282 334 224 338 338 119 119 337 337 336 336 340 120 335 335 432 275 283 224 340 334 ]]  #int !orig=[98] !jvms: Assert::assertEquals @ bci:1 (line 797) Assert::assertEquals @ bci:3 (line 807) AbstractCompressExpandTest::assertContiguousMask @ bci:13 (line 356) AbstractCompressExpandTest::testContiguousMasksInt @ bci:48 (line 251)
 917  LoadI  === 916 218 219  [[ 336 336 331 119 119 339 339 432 275 337 337 338 338 224 224 340 340 120 120 342 330 118 117 116 115 341 343 114 113 112 111 344 121 110 333 332 335 335 282 439 109 329 328 334 334 222 327 122 254 369 ]]  @int[int:>=0] (java/lang/Cloneable,java/io/Serializable):exact+any *, idx=7; #int (does not depend only on test, unknown control) !orig=[86] !jvms: AbstractCompressExpandTest::testContiguousMasksInt @ bci:39 (line 250)
 282  ExpandBits  === _ 917 870  [[ 120 120 340 340 224 224 338 338 736 338 339 339 380 ]]  #int !jvms: CompressExpandTest::actualExpand @ bci:2 (line 40) AbstractCompressExpandTest::assertContiguousMask @ bci:17 (line 265) AbstractCompressExpandTest::testContiguousMasksInt @ bci:92 (line 256)
told = bool
tnew = int:1..2
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/workspace/open/src/hotspot/share/opto/phaseX.cpp:2731), pid=6038, tid=6057
#  fatal error: Not monotonic
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-internal-2025-07-15-0649374.tobias.hartmann.jdk4)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-internal-2025-07-15-0649374.tobias.hartmann.jdk4, compiled mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x1828409]  PhaseCCP::verify_type(Node*, Type const*, Type const*)+0x169
#26314 


Also happens with a few other configurations/flags.

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

PR Comment: https://git.openjdk.org/jdk/pull/23947#issuecomment-3073939505


More information about the hotspot-compiler-dev mailing list