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

Tobias Hartmann thartmann at openjdk.org
Mon Jul 14 13:24:45 UTC 2025


On Mon, 14 Jul 2025 12:20:45 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:
> 
>   Review comments resolutions

`compiler/intrinsics/TestBitShuffleOpers.java` fails with `-ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -server -XX:-TieredCompilation`:


# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/workspace/open/src/hotspot/share/opto/intrinsicnode.cpp:315), pid=3588220, tid=3588247
#  Error: assert(lo == (T_INT ? min_jint : min_jlong)) failed
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-internal-2025-07-14-1229127.tobias.hartmann.jdk4)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-internal-2025-07-14-1229127.tobias.hartmann.jdk4, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x1066720]  bitshuffle_value(TypeInteger const*, TypeInteger const*, int, BasicType)+0x440
#

urrent CompileTask:
C2:2810  490 %  b        compiler.intrinsics.TestBitShuffleOpers::test17 @ 7 (1042 bytes)

Stack: [0x00007f2910b4c000,0x00007f2910c4c000],  sp=0x00007f2910c47e30,  free space=1007k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1066720]  bitshuffle_value(TypeInteger const*, TypeInteger const*, int, BasicType)+0x440  (intrinsicnode.cpp:315)
V  [libjvm.so+0x182ddbf]  PhaseGVN::transform(Node*)+0x1cf  (phaseX.cpp:703)
V  [libjvm.so+0x14913a2]  LibraryCallKit::inline_bitshuffle_methods(vmIntrinsicID)+0xb2  (library_call.cpp:2244)
V  [libjvm.so+0x14bcff8]  LibraryCallKit::try_to_inline(int)+0x1b8  (library_call.cpp:556)
V  [libjvm.so+0x14bfea0]  LibraryIntrinsic::generate(JVMState*)+0x230  (library_call.cpp:119)
V  [libjvm.so+0xd1aaa2]  Parse::do_call()+0x712  (doCall.cpp:677)
V  [libjvm.so+0x17ff8b8]  Parse::do_one_bytecode()+0x4b8  (parse2.cpp:2723)
V  [libjvm.so+0x17eca9c]  Parse::do_one_block()+0x24c  (parse1.cpp:1586)
V  [libjvm.so+0x17edea0]  Parse::do_all_blocks()+0x130  (parse1.cpp:724)
V  [libjvm.so+0x17f1393]  Parse::Parse(JVMState*, ciMethod*, float)+0xaa3  (parse1.cpp:628)
V  [libjvm.so+0x97cb6b]  ParseGenerator::generate(JVMState*)+0x13b  (callGenerator.cpp:97)
V  [libjvm.so+0xb54c49]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x18b9  (compile.cpp:804)
V  [libjvm.so+0x97a437]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x467  (c2compiler.cpp:141)
V  [libjvm.so+0xb64698]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb58  (compileBroker.cpp:2324)
V  [libjvm.so+0xb65868]  CompileBroker::compiler_thread_loop()+0x578  (compileBroker.cpp:1968)
V  [libjvm.so+0x10bcacb]  JavaThread::thread_main_inner()+0x13b  (javaThread.cpp:773)
V  [libjvm.so+0x1b2ed66]  Thread::call_run()+0xb6  (thread.cpp:243)
V  [libjvm.so+0x179e8d8]  thread_native_entry(Thread*)+0x128  (os_linux.cpp:868)

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

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


More information about the hotspot-compiler-dev mailing list