JDK-8256823 : C2 compilation fails with "assert(isShiftCount(imm8 >> 1)) failed: illegal shift count"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2020-11-21
  • Updated: 2021-01-14
  • Resolved: 2020-11-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b26Fixed
Related Reports
Relates :  
Relates :  
Description
The following test failed in the JDK16 CI:

applications/runthese/RunThese30M.java

Here's snippets from the hs_err_pid file:

#  Internal Error (/System/Volumes/Data/mesos/work_dir/slaves/47535081-0322-4d83-bb78-f7e11abb86d0-S39182/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/c0cd4bc7-e57f-4212-94ab-1ee15277b000/runs/728b1386-8304-4f8d-b9e7-ab13698c85fd/workspace/open/src/hotspot/cpu/x86/assembler_x86.cpp:4944), pid=43439, tid=22531
#  assert(isShiftCount(imm8 >> 1)) failed: illegal shift count
#
# JRE version: Java(TM) SE Runtime Environment (16.0+25) (fastdebug build 16-ea+25-1626)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 16-ea+25-1626, compiled mode, sharing, compressed oops, g1 gc, bsd-amd64)
# Core dump will be written. Default location: core.43439
#
# JFR recording file will be written. Location: /mesos/work_dir/slaves/4076d11c-c6ed-4d07-84c1-4ab8d55cd975-S365288/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/ee53267b-d0dc-4d9e-8be9-27363d5aabac/runs/6adfd9ea-b17c-4d53-97cc-fa4dfdf16c51/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/hs_err_pid43439.jfr

Here's the crashing thread's stack:

---------------  T H R E A D  ---------------

Current thread (0x00007fe413084230):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=22531, stack(0x0000700002cf2000,0x0000700002df2000)]


Current CompileTask:
C2:1982799 251582    b        javasoft.sqe.tests.api.java.lang.Long.rotateRightTests::rotateRight002 (118 bytes)

Stack: [0x0000700002cf2000,0x0000700002df2000],  sp=0x0000700002deda90,  free space=1006k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.dylib+0x114eefd]  VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x6dd
V  [libjvm.dylib+0x114f51b]  VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, __va_list_tag*)+0x3b
V  [libjvm.dylib+0x60bdcf]  report_vm_error(char const*, int, char const*, char const*, ...)+0x13f
V  [libjvm.dylib+0x315fcd]  Assembler::rorq(RegisterImpl*, int)+0x3d
V  [libjvm.dylib+0x6c684]  rorL_immI8_legacyNode::emit(CodeBuffer&, PhaseRegAlloc*) const+0x154
V  [libjvm.dylib+0xe808a5]  PhaseOutput::scratch_emit_size(Node const*)+0x345
V  [libjvm.dylib+0xe75974]  PhaseOutput::shorten_branches(unsigned int*)+0x494
V  [libjvm.dylib+0xe7512b]  PhaseOutput::Output()+0xb9b
V  [libjvm.dylib+0x5b4f56]  Compile::Code_Gen()+0x596
V  [libjvm.dylib+0x5b1e13]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x1a13
V  [libjvm.dylib+0x4a5d60]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0xe0
V  [libjvm.dylib+0x5ce028]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x608
V  [libjvm.dylib+0x5cd7b6]  CompileBroker::compiler_thread_loop()+0x2e6
V  [libjvm.dylib+0x10a8464]  JavaThread::thread_main_inner()+0x2b4
V  [libjvm.dylib+0x10a4187]  Thread::call_run()+0x1b7
V  [libjvm.dylib+0xe64cef]  thread_native_entry(Thread*)+0x15f
C  [libsystem_pthread.dylib+0x3661]  _pthread_body+0x154
C  [libsystem_pthread.dylib+0x350d]  _pthread_body+0x0
C  [libsystem_pthread.dylib+0x2bf9]  thread_start+0xd
Comments
Filed JDK-8257182.
26-11-2020

Okay, thanks for testing. This might be a different issue then (probably also related to JDK-8248830 or JDK-8254872). Could you please file a new bug?
26-11-2020

JVM doesn't crash any more after this fix, but these JCK tests fail on x86 when running with -XX:-TieredCompilation: api/java_lang/Integer/rotateRight api/java_lang/Long/rotateRight Failed for :(80000000,1), result: 1 vs ffffffff
26-11-2020

Changeset: 1c4c99ea Author: Tobias Hartmann <thartmann@openjdk.org> Date: 2020-11-24 16:52:13 +0000 URL: https://github.com/openjdk/jdk/commit/1c4c99ea
24-11-2020

Also observed when running JCK test api/java_lang/Long/rotateRight with -XX:-TieredCompilation.
24-11-2020

Code was introduced by JDK-8248830 in JDK 16 b11, bug was triggered by JDK-8254872.
23-11-2020

ILW = Assert in C2 due to rotate instruction with invalid immediate (regression in JDK 16), reproducible with simple test, disable compilation of affected method = HMM = P2
23-11-2020