Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Community] ArrayIndexOutOfBoundsException in MonitorSnippets.java #43

Closed
JohnTortugo opened this issue Feb 3, 2025 · 0 comments · Fixed by #42
Closed

[Community] ArrayIndexOutOfBoundsException in MonitorSnippets.java #43

JohnTortugo opened this issue Feb 3, 2025 · 0 comments · Fixed by #42
Labels
bug Something isn't working

Comments

@JohnTortugo
Copy link
Contributor

JohnTortugo commented Feb 3, 2025

Describe the Issue

The lowering of MonitorEnterNode and MonitorExitNode in Graal21 has an issue where it "pushes" more arguments than needed by the callee (monitorenterStub and monitorexitStub, respectively) when JVMCIUseFastLocking is disabled. See Stacktrace of the error below.

Thread[#19,JVMCI-native CompilerThread2,5,main]: Compilation of java.util.concurrent.ConcurrentHashMap.putVal(Object, Object, boolean) @ -1 failed: java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.SnippetTemplate$Arguments.addConst(SnippetTemplate.java:641)
at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.SnippetTemplate$Arguments.addConst(SnippetTemplate.java:636)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.replacements.MonitorSnippets$Templates.lower(MonitorSnippets.java:911)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.meta.DefaultHotSpotLoweringProvider.lowerWithoutDelegation(DefaultHotSpotLoweringProvider.java:459)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.meta.DefaultHotSpotLoweringProvider.lower(DefaultHotSpotLoweringProvider.java:629)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.amd64.AMD64HotSpotLoweringProvider.lower(AMD64HotSpotLoweringProvider.java:87)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.spi.Lowerable.lower(Lowerable.java:40)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.process(LoweringPhase.java:665)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase$ProcessFrame.preprocess(LoweringPhase.java:553)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.processBlock(LoweringPhase.java:764)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.lower(LoweringPhase.java:297)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.run(LoweringPhase.java:271)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.run(LoweringPhase.java:113)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:322)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.phases.BaseTier.run(BaseTier.java:47)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:322)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.emitFrontEnd(GraalCompiler.java:304)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:169)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:137)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotGraalCompiler.compileHelper(HotSpotGraalCompiler.java:244)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotGraalCompiler.compile(HotSpotGraalCompiler.java:259)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.CompilationTask$HotSpotCompilationWrapper.performCompilation(CompilationTask.java:202)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.CompilationTask$HotSpotCompilationWrapper.performCompilation(CompilationTask.java:108)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.CompilationWrapper.run(CompilationWrapper.java:222)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.CompilationTask.runCompilation(CompilationTask.java:382)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.CompilationTask.runCompilation(CompilationTask.java:357)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotGraalCompiler.compileMethod(HotSpotGraalCompiler.java:159)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotGraalCompiler.compileMethod(HotSpotGraalCompiler.java:693)
at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotGraalCompiler.compileMethod(HotSpotGraalCompiler.java:110)
at [jdk.internal.vm.ci@21.0.6](mailto:jdk.internal.vm.ci@21.0.6)/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:924)

Steps to reproduce the issue

Just run any reasonably sized program with -XX:-JVMCIUseFastLocking.

GraalVM Community Build

Built from sources using latest version available in graalvm-community-jdk21u repo and applying the changes in this pull request.

GraalVM Version

#41

Operating System and Version

Not OS specific.

Architecture

Not architecture specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant