RFR: 8358568: C2 compilation hits "must have a monitor" assert with -XX:-GenerateSynchronizationCode [v5]
hanguanqiang
duke at openjdk.org
Fri Jul 4 06:43:02 UTC 2025
> This PR fixes JDK-8358568, a JVM crash triggered when running with -XX:-GenerateSynchronizationCode
>
> Problem:
> When synchronization code generation is disabled by -XX:-GenerateSynchronizationCode, the compiler’s do_monitor_exit() method still tries to access monitor objects without checking if any monitors exist.This causes an assertion failure and JVM crash.
>
> Root Cause:
> Parse::do_monitor_exit() calls shared_unlock() using monitor info unconditionally,but with GenerateSynchronizationCode disabled, no monitor info is available, leading to invalid access.
>
> Fix
> Add a check in do_monitor_exit() to skip monitor unlocking if GenerateSynchronizationCode is false, avoiding invalid monitor access and preventing the crash.
hanguanqiang has updated the pull request incrementally with one additional commit since the last revision:
correct an error
correct an error
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/26108/files
- new: https://git.openjdk.org/jdk/pull/26108/files/1d6e8f5c..6ebc2ecb
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=26108&range=04
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=26108&range=03-04
Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/26108.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26108/head:pull/26108
PR: https://git.openjdk.org/jdk/pull/26108
More information about the hotspot-compiler-dev
mailing list