JDK-8324839 : Return address mask creation fails with assert(reg < CHUNK_SIZE) failed: sanity
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,23
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2024-01-29
  • Updated: 2024-08-13
  • Resolved: 2024-05-06
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 23
23Resolved
Related Reports
Duplicate :  
Relates :  
Description
# Failure analysis

The large number of synchronized statements in the test results in that the return address cannot fit in a register mask. There is no guard before constructing this register mask, resulting in the assert failure.

# Original description

C2 fails to compile the attached Test.java consisting of deeply nested synchronize statements. This issue is an edge case revealed when investigating JDK-8322996. See the comments in Test.java for additional information.

$ java -XX:CompileCommand=compileonly,Test::test* -XX:-TieredCompilation -Xcomp Test.java
CompileCommand: compileonly Test.test* bool compileonly = true
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/dlunden/jdk-box-lock-node-8322996/open/src/hotspot/share/opto/regmask.hpp:299), pid=258248, tid=258262
#  assert(reg < CHUNK_SIZE) failed: sanity
#
# JRE version: Java(TM) SE Runtime Environment (23.0) (slowdebug build 23-internal-2024-01-26-0943371.dlunden...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 23-internal-2024-01-26-0943371.dlunden..., compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x883348]  RegMask::Insert(int)+0xf6
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/dlunden/oracle/issues/return-mask/core.258248)
#
# An error report file with more information is saved as:
# /home/dlunden/oracle/issues/return-mask/hs_err_pid258248.log
#
# Compiler replay data is saved as:
# /home/dlunden/oracle/issues/return-mask/replay_pid258248.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
Aborted (core dumped)

Comments
I'm closing this as a duplicate of JDK-8325467. The solution for JDK-8325467 will add dynamically expanding register masks, fixing this issue as well.
06-05-2024

ILW = Same as JDK-8322996 = P3
30-01-2024