You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: web-image/src/com.oracle.svm.hosted.webimage/src/com/oracle/svm/hosted/webimage/wasmgc/WasmGCUnalignedUnsafeSupport.java
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -371,11 +371,15 @@ private static int getArrayIndexScale(JavaKind kind) {
371
371
}
372
372
373
373
/**
374
-
* Detect out of bounds access that is still within the same 4-byte word as the last element.
375
-
* {@code jdk.internal.misc.Unsafe#compareAndExchangeByte} uses int accesses that are out of
376
-
* bounds. For example, there might be an int access at the end of a byte array of length 5.
377
-
* Such accesses are undefined behaviour. We may therefore ignore such accesses instead of
378
-
* throwing an out-of-bounds exception.
374
+
* Detect out of bounds access that is still within the same 4-byte aligned 4-byte word as the
375
+
* last element. Such accesses are usually undefined behaviour, but to not produce unexpected
376
+
* behavior (i.e. a crash), out of bounds accesses where this method returns {@code true} should
377
+
* not crash and just return an arbitrary value and ignore any writes.
378
+
* <p>
379
+
* {@code jdk.internal.misc.Unsafe#compareAndExchangeByte} uses int accesses that may go out of
380
+
* bounds and does not expect a crash in that case, though it ignores the out-of-bounds bytes.
381
+
* For example, there might be an int access at the first element of a 1-element byte array.
0 commit comments