RFR: 8349374: [JVMCI] concurrent use of HotSpotSpeculationLog can crash
Doug Simon
dnsimon at openjdk.org
Tue Feb 4 16:58:09 UTC 2025
On Tue, 4 Feb 2025 16:31:50 GMT, Tom Rodriguez <never at openjdk.org> wrote:
> This ensures that collectFailedSpeculations sees the initialization of the recently allocated failedSpeculationsAddress memory.
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java line 179:
> 177: }
> 178:
> 179: if (UnsafeAccess.UNSAFE.getLong(getFailedSpeculationsAddress()) != 0) {
It's still possible for `getFailedSpeculationsAddress()` to return 0 (i.e. when `managesFailedSpeculations` is `false`). So I think this should be:
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java
index fd46e281c3b..a861c00d77d 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java
@@ -171,8 +171,9 @@ public String toString() {
@Override
public void collectFailedSpeculations() {
- if (failedSpeculationsAddress != 0 && UnsafeAccess.UNSAFE.getLong(failedSpeculationsAddress) != 0) {
- failedSpeculations = compilerToVM().getFailedSpeculations(failedSpeculationsAddress, failedSpeculations);
+ long address = getFailedSpeculationsAddress();
+ if (address != 0 && UnsafeAccess.UNSAFE.getLong(address) != 0) {
+ failedSpeculations = compilerToVM().getFailedSpeculations(address, failedSpeculations);
assert failedSpeculations.getClass() == byte[][].class;
}
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23444#discussion_r1941551882
More information about the hotspot-compiler-dev
mailing list