8288534: Out of bound errors for memory segment access mentions wrong values

Reviewed-by: psandoz
This commit is contained in:
Maurizio Cimadamore 2022-06-16 15:59:22 +00:00
parent 729164f534
commit ff3db52044
3 changed files with 26 additions and 3 deletions

View file

@ -28,6 +28,7 @@ package java.lang.foreign;
import java.util.Objects;
import java.util.Optional;
import jdk.internal.foreign.Utils;
import jdk.internal.vm.annotation.ForceInline;
import jdk.internal.vm.annotation.Stable;
abstract non-sealed class AbstractLayout implements MemoryLayout {
@ -86,6 +87,7 @@ abstract non-sealed class AbstractLayout implements MemoryLayout {
}
@Override
@ForceInline
public long byteSize() {
if (cachedSize == 0) {
cachedSize = Utils.bitsToBytesOrThrow(bitSize(),