mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 06:14:49 +02:00
8344168: Change Unsafe base offset from int to long
Reviewed-by: liach
This commit is contained in:
parent
5d5b294b0a
commit
fdfb68c8d0
53 changed files with 164 additions and 154 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -715,7 +715,7 @@ final class StringLatin1 {
|
||||||
static void putCharsAt(byte[] val, int index, int c1, int c2, int c3, int c4) {
|
static void putCharsAt(byte[] val, int index, int c1, int c2, int c3, int c4) {
|
||||||
assert index >= 0 && index + 3 < length(val) : "Trusted caller missed bounds check";
|
assert index >= 0 && index + 3 < length(val) : "Trusted caller missed bounds check";
|
||||||
// Don't use the putChar method, Its instrinsic will cause C2 unable to combining values into larger stores.
|
// Don't use the putChar method, Its instrinsic will cause C2 unable to combining values into larger stores.
|
||||||
long offset = (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
long offset = Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
||||||
UNSAFE.putByte(val, offset , (byte)(c1));
|
UNSAFE.putByte(val, offset , (byte)(c1));
|
||||||
UNSAFE.putByte(val, offset + 1, (byte)(c2));
|
UNSAFE.putByte(val, offset + 1, (byte)(c2));
|
||||||
UNSAFE.putByte(val, offset + 2, (byte)(c3));
|
UNSAFE.putByte(val, offset + 2, (byte)(c3));
|
||||||
|
@ -725,7 +725,7 @@ final class StringLatin1 {
|
||||||
static void putCharsAt(byte[] val, int index, int c1, int c2, int c3, int c4, int c5) {
|
static void putCharsAt(byte[] val, int index, int c1, int c2, int c3, int c4, int c5) {
|
||||||
assert index >= 0 && index + 4 < length(val) : "Trusted caller missed bounds check";
|
assert index >= 0 && index + 4 < length(val) : "Trusted caller missed bounds check";
|
||||||
// Don't use the putChar method, Its instrinsic will cause C2 unable to combining values into larger stores.
|
// Don't use the putChar method, Its instrinsic will cause C2 unable to combining values into larger stores.
|
||||||
long offset = (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
long offset = Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
||||||
UNSAFE.putByte(val, offset , (byte)(c1));
|
UNSAFE.putByte(val, offset , (byte)(c1));
|
||||||
UNSAFE.putByte(val, offset + 1, (byte)(c2));
|
UNSAFE.putByte(val, offset + 1, (byte)(c2));
|
||||||
UNSAFE.putByte(val, offset + 2, (byte)(c3));
|
UNSAFE.putByte(val, offset + 2, (byte)(c3));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -196,7 +196,7 @@ final class VarHandles {
|
||||||
|
|
||||||
Class<?> componentType = arrayClass.getComponentType();
|
Class<?> componentType = arrayClass.getComponentType();
|
||||||
|
|
||||||
int aoffset = UNSAFE.arrayBaseOffset(arrayClass);
|
int aoffset = (int) UNSAFE.arrayBaseOffset(arrayClass);
|
||||||
int ascale = UNSAFE.arrayIndexScale(arrayClass);
|
int ascale = UNSAFE.arrayIndexScale(arrayClass);
|
||||||
int ashift = 31 - Integer.numberOfLeadingZeros(ascale);
|
int ashift = 31 - Integer.numberOfLeadingZeros(ascale);
|
||||||
|
|
||||||
|
|
|
@ -6383,7 +6383,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||||
= U.objectFieldOffset(ConcurrentHashMap.class, "cellsBusy");
|
= U.objectFieldOffset(ConcurrentHashMap.class, "cellsBusy");
|
||||||
private static final long CELLVALUE
|
private static final long CELLVALUE
|
||||||
= U.objectFieldOffset(CounterCell.class, "value");
|
= U.objectFieldOffset(CounterCell.class, "value");
|
||||||
private static final int ABASE = U.arrayBaseOffset(Node[].class);
|
private static final long ABASE = U.arrayBaseOffset(Node[].class);
|
||||||
private static final int ASHIFT;
|
private static final int ASHIFT;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -222,9 +222,9 @@ public final class CRC32C implements Checksum {
|
||||||
if (end - off >= 8 && Unsafe.ARRAY_BYTE_INDEX_SCALE == 1) {
|
if (end - off >= 8 && Unsafe.ARRAY_BYTE_INDEX_SCALE == 1) {
|
||||||
|
|
||||||
// align on 8 bytes
|
// align on 8 bytes
|
||||||
int alignLength
|
long alignLength
|
||||||
= (8 - ((Unsafe.ARRAY_BYTE_BASE_OFFSET + off) & 0x7)) & 0x7;
|
= (8 - ((Unsafe.ARRAY_BYTE_BASE_OFFSET + off) & 0x7)) & 0x7;
|
||||||
for (int alignEnd = off + alignLength; off < alignEnd; off++) {
|
for (long alignEnd = off + alignLength; off < alignEnd; off++) {
|
||||||
crc = (crc >>> 8) ^ byteTable[(crc ^ b[off]) & 0xFF];
|
crc = (crc >>> 8) ^ byteTable[(crc ^ b[off]) & 0xFF];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,11 +238,11 @@ public final class CRC32C implements Checksum {
|
||||||
int secondHalf;
|
int secondHalf;
|
||||||
if (Unsafe.ADDRESS_SIZE == 4) {
|
if (Unsafe.ADDRESS_SIZE == 4) {
|
||||||
// On 32 bit platforms read two ints instead of a single 64bit long
|
// On 32 bit platforms read two ints instead of a single 64bit long
|
||||||
firstHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
|
firstHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
|
||||||
secondHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off
|
secondHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off
|
||||||
+ Integer.BYTES);
|
+ Integer.BYTES);
|
||||||
} else {
|
} else {
|
||||||
long value = UNSAFE.getLong(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
|
long value = UNSAFE.getLong(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
|
||||||
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
|
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
|
||||||
firstHalf = (int) value;
|
firstHalf = (int) value;
|
||||||
secondHalf = (int) (value >>> 32);
|
secondHalf = (int) (value >>> 32);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -174,7 +174,7 @@ class ZipUtils {
|
||||||
Preconditions.checkIndex(off, b.length, Preconditions.AIOOBE_FORMATTER);
|
Preconditions.checkIndex(off, b.length, Preconditions.AIOOBE_FORMATTER);
|
||||||
Preconditions.checkIndex(off + 1, b.length, Preconditions.AIOOBE_FORMATTER);
|
Preconditions.checkIndex(off + 1, b.length, Preconditions.AIOOBE_FORMATTER);
|
||||||
return Short.toUnsignedInt(
|
return Short.toUnsignedInt(
|
||||||
UNSAFE.getShortUnaligned(b, off + (long) Unsafe.ARRAY_BYTE_BASE_OFFSET, false));
|
UNSAFE.getShortUnaligned(b, off + Unsafe.ARRAY_BYTE_BASE_OFFSET, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -185,7 +185,7 @@ class ZipUtils {
|
||||||
Preconditions.checkIndex(off, b.length, Preconditions.AIOOBE_FORMATTER);
|
Preconditions.checkIndex(off, b.length, Preconditions.AIOOBE_FORMATTER);
|
||||||
Preconditions.checkIndex(off + 3, b.length, Preconditions.AIOOBE_FORMATTER);
|
Preconditions.checkIndex(off + 3, b.length, Preconditions.AIOOBE_FORMATTER);
|
||||||
return Integer.toUnsignedLong(
|
return Integer.toUnsignedLong(
|
||||||
UNSAFE.getIntUnaligned(b, off + (long) Unsafe.ARRAY_BYTE_BASE_OFFSET, false));
|
UNSAFE.getIntUnaligned(b, off + Unsafe.ARRAY_BYTE_BASE_OFFSET, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -195,7 +195,7 @@ class ZipUtils {
|
||||||
public static final long get64S(byte[] b, int off) {
|
public static final long get64S(byte[] b, int off) {
|
||||||
Preconditions.checkIndex(off, b.length, Preconditions.AIOOBE_FORMATTER);
|
Preconditions.checkIndex(off, b.length, Preconditions.AIOOBE_FORMATTER);
|
||||||
Preconditions.checkIndex(off + 7, b.length, Preconditions.AIOOBE_FORMATTER);
|
Preconditions.checkIndex(off + 7, b.length, Preconditions.AIOOBE_FORMATTER);
|
||||||
return UNSAFE.getLongUnaligned(b, off + (long) Unsafe.ARRAY_BYTE_BASE_OFFSET, false);
|
return UNSAFE.getLongUnaligned(b, off + Unsafe.ARRAY_BYTE_BASE_OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,7 +206,7 @@ class ZipUtils {
|
||||||
public static final int get32S(byte[] b, int off) {
|
public static final int get32S(byte[] b, int off) {
|
||||||
Preconditions.checkIndex(off, b.length, Preconditions.AIOOBE_FORMATTER);
|
Preconditions.checkIndex(off, b.length, Preconditions.AIOOBE_FORMATTER);
|
||||||
Preconditions.checkIndex(off + 3, b.length, Preconditions.AIOOBE_FORMATTER);
|
Preconditions.checkIndex(off + 3, b.length, Preconditions.AIOOBE_FORMATTER);
|
||||||
return UNSAFE.getIntUnaligned(b, off + (long) Unsafe.ARRAY_BYTE_BASE_OFFSET, false);
|
return UNSAFE.getIntUnaligned(b, off + Unsafe.ARRAY_BYTE_BASE_OFFSET, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -386,16 +386,16 @@ public final class RawBytecodeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getU2Unchecked(int bci) {
|
public int getU2Unchecked(int bci) {
|
||||||
return UNSAFE.getCharUnaligned(code.array, (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + bci, true);
|
return UNSAFE.getCharUnaligned(code.array, Unsafe.ARRAY_BYTE_BASE_OFFSET + bci, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getShortUnchecked(int bci) {
|
public int getShortUnchecked(int bci) {
|
||||||
return UNSAFE.getShortUnaligned(code.array, (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + bci, true);
|
return UNSAFE.getShortUnaligned(code.array, Unsafe.ARRAY_BYTE_BASE_OFFSET + bci, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// used after switch validation
|
// used after switch validation
|
||||||
public int getIntUnchecked(int bci) {
|
public int getIntUnchecked(int bci) {
|
||||||
return UNSAFE.getIntUnaligned(code.array, (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + bci, true);
|
return UNSAFE.getIntUnaligned(code.array, Unsafe.ARRAY_BYTE_BASE_OFFSET + bci, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// non-wide branches
|
// non-wide branches
|
||||||
|
|
|
@ -93,7 +93,7 @@ abstract sealed class HeapMemorySegmentImpl extends AbstractMemorySegmentImpl {
|
||||||
throw new UnsupportedOperationException("Not an address to an heap-allocated byte array");
|
throw new UnsupportedOperationException("Not an address to an heap-allocated byte array");
|
||||||
}
|
}
|
||||||
JavaNioAccess nioAccess = SharedSecrets.getJavaNioAccess();
|
JavaNioAccess nioAccess = SharedSecrets.getJavaNioAccess();
|
||||||
return nioAccess.newHeapByteBuffer(baseByte, (int)offset - Utils.BaseAndScale.BYTE.base(), (int) byteSize(), null);
|
return nioAccess.newHeapByteBuffer(baseByte, (int)(offset - Utils.BaseAndScale.BYTE.base()), (int) byteSize(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// factories
|
// factories
|
||||||
|
|
|
@ -298,7 +298,7 @@ public final class Utils {
|
||||||
return "0x" + Long.toHexString(value);
|
return "0x" + Long.toHexString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public record BaseAndScale(int base, long scale) {
|
public record BaseAndScale(long base, long scale) {
|
||||||
|
|
||||||
public static final BaseAndScale BYTE =
|
public static final BaseAndScale BYTE =
|
||||||
new BaseAndScale(Unsafe.ARRAY_BYTE_BASE_OFFSET, Unsafe.ARRAY_BYTE_INDEX_SCALE);
|
new BaseAndScale(Unsafe.ARRAY_BYTE_BASE_OFFSET, Unsafe.ARRAY_BYTE_INDEX_SCALE);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -1043,8 +1043,11 @@ public final class Unsafe {
|
||||||
* This constant differs from all results that will ever be returned from
|
* This constant differs from all results that will ever be returned from
|
||||||
* {@link #staticFieldOffset}, {@link #objectFieldOffset},
|
* {@link #staticFieldOffset}, {@link #objectFieldOffset},
|
||||||
* or {@link #arrayBaseOffset}.
|
* or {@link #arrayBaseOffset}.
|
||||||
|
* <p>
|
||||||
|
* The static type is @code long} to emphasize that long arithmetic should
|
||||||
|
* always be used for offset calculations to avoid overflows.
|
||||||
*/
|
*/
|
||||||
public static final int INVALID_FIELD_OFFSET = -1;
|
public static final long INVALID_FIELD_OFFSET = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports the location of a given field in the storage allocation of its
|
* Reports the location of a given field in the storage allocation of its
|
||||||
|
@ -1172,11 +1175,15 @@ public final class Unsafe {
|
||||||
* for the same class, you may use that scale factor, together with this
|
* for the same class, you may use that scale factor, together with this
|
||||||
* base offset, to form new offsets to access elements of arrays of the
|
* base offset, to form new offsets to access elements of arrays of the
|
||||||
* given class.
|
* given class.
|
||||||
|
* <p>
|
||||||
|
* The return value is in the range of a {@code int}. The return type is
|
||||||
|
* {@code long} to emphasize that long arithmetic should always be used
|
||||||
|
* for offset calculations to avoid overflows.
|
||||||
*
|
*
|
||||||
* @see #getInt(Object, long)
|
* @see #getInt(Object, long)
|
||||||
* @see #putInt(Object, long, int)
|
* @see #putInt(Object, long, int)
|
||||||
*/
|
*/
|
||||||
public int arrayBaseOffset(Class<?> arrayClass) {
|
public long arrayBaseOffset(Class<?> arrayClass) {
|
||||||
if (arrayClass == null) {
|
if (arrayClass == null) {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
|
@ -1186,39 +1193,39 @@ public final class Unsafe {
|
||||||
|
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(boolean[].class)} */
|
/** The value of {@code arrayBaseOffset(boolean[].class)} */
|
||||||
public static final int ARRAY_BOOLEAN_BASE_OFFSET
|
public static final long ARRAY_BOOLEAN_BASE_OFFSET
|
||||||
= theUnsafe.arrayBaseOffset(boolean[].class);
|
= theUnsafe.arrayBaseOffset(boolean[].class);
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(byte[].class)} */
|
/** The value of {@code arrayBaseOffset(byte[].class)} */
|
||||||
public static final int ARRAY_BYTE_BASE_OFFSET
|
public static final long ARRAY_BYTE_BASE_OFFSET
|
||||||
= theUnsafe.arrayBaseOffset(byte[].class);
|
= theUnsafe.arrayBaseOffset(byte[].class);
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(short[].class)} */
|
/** The value of {@code arrayBaseOffset(short[].class)} */
|
||||||
public static final int ARRAY_SHORT_BASE_OFFSET
|
public static final long ARRAY_SHORT_BASE_OFFSET
|
||||||
= theUnsafe.arrayBaseOffset(short[].class);
|
= theUnsafe.arrayBaseOffset(short[].class);
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(char[].class)} */
|
/** The value of {@code arrayBaseOffset(char[].class)} */
|
||||||
public static final int ARRAY_CHAR_BASE_OFFSET
|
public static final long ARRAY_CHAR_BASE_OFFSET
|
||||||
= theUnsafe.arrayBaseOffset(char[].class);
|
= theUnsafe.arrayBaseOffset(char[].class);
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(int[].class)} */
|
/** The value of {@code arrayBaseOffset(int[].class)} */
|
||||||
public static final int ARRAY_INT_BASE_OFFSET
|
public static final long ARRAY_INT_BASE_OFFSET
|
||||||
= theUnsafe.arrayBaseOffset(int[].class);
|
= theUnsafe.arrayBaseOffset(int[].class);
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(long[].class)} */
|
/** The value of {@code arrayBaseOffset(long[].class)} */
|
||||||
public static final int ARRAY_LONG_BASE_OFFSET
|
public static final long ARRAY_LONG_BASE_OFFSET
|
||||||
= theUnsafe.arrayBaseOffset(long[].class);
|
= theUnsafe.arrayBaseOffset(long[].class);
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(float[].class)} */
|
/** The value of {@code arrayBaseOffset(float[].class)} */
|
||||||
public static final int ARRAY_FLOAT_BASE_OFFSET
|
public static final long ARRAY_FLOAT_BASE_OFFSET
|
||||||
= theUnsafe.arrayBaseOffset(float[].class);
|
= theUnsafe.arrayBaseOffset(float[].class);
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(double[].class)} */
|
/** The value of {@code arrayBaseOffset(double[].class)} */
|
||||||
public static final int ARRAY_DOUBLE_BASE_OFFSET
|
public static final long ARRAY_DOUBLE_BASE_OFFSET
|
||||||
= theUnsafe.arrayBaseOffset(double[].class);
|
= theUnsafe.arrayBaseOffset(double[].class);
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(Object[].class)} */
|
/** The value of {@code arrayBaseOffset(Object[].class)} */
|
||||||
public static final int ARRAY_OBJECT_BASE_OFFSET
|
public static final long ARRAY_OBJECT_BASE_OFFSET
|
||||||
= theUnsafe.arrayBaseOffset(Object[].class);
|
= theUnsafe.arrayBaseOffset(Object[].class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1227,6 +1234,9 @@ public final class Unsafe {
|
||||||
* will generally not work properly with accessors like {@link
|
* will generally not work properly with accessors like {@link
|
||||||
* #getByte(Object, long)}, so the scale factor for such classes is reported
|
* #getByte(Object, long)}, so the scale factor for such classes is reported
|
||||||
* as zero.
|
* as zero.
|
||||||
|
* <p>
|
||||||
|
* The computation of the actual memory offset should always use {@code
|
||||||
|
* long} arithmetic to avoid overflows.
|
||||||
*
|
*
|
||||||
* @see #arrayBaseOffset
|
* @see #arrayBaseOffset
|
||||||
* @see #getInt(Object, long)
|
* @see #getInt(Object, long)
|
||||||
|
@ -3840,7 +3850,7 @@ public final class Unsafe {
|
||||||
private native Object staticFieldBase0(Field f);
|
private native Object staticFieldBase0(Field f);
|
||||||
private native boolean shouldBeInitialized0(Class<?> c);
|
private native boolean shouldBeInitialized0(Class<?> c);
|
||||||
private native void ensureClassInitialized0(Class<?> c);
|
private native void ensureClassInitialized0(Class<?> c);
|
||||||
private native int arrayBaseOffset0(Class<?> arrayClass);
|
private native int arrayBaseOffset0(Class<?> arrayClass); // public version returns long to promote correct arithmetic
|
||||||
private native int arrayIndexScale0(Class<?> arrayClass);
|
private native int arrayIndexScale0(Class<?> arrayClass);
|
||||||
private native int getLoadAverage0(double[] loadavg, int nelems);
|
private native int getLoadAverage0(double[] loadavg, int nelems);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -457,8 +457,8 @@ public class ArraysSupport {
|
||||||
if (length > 7) {
|
if (length > 7) {
|
||||||
if (a[aFromIndex] != b[bFromIndex])
|
if (a[aFromIndex] != b[bFromIndex])
|
||||||
return 0;
|
return 0;
|
||||||
int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
|
long aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
|
||||||
int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
|
long bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
|
||||||
i = vectorizedMismatch(
|
i = vectorizedMismatch(
|
||||||
a, aOffset,
|
a, aOffset,
|
||||||
b, bOffset,
|
b, bOffset,
|
||||||
|
@ -550,8 +550,8 @@ public class ArraysSupport {
|
||||||
if (length > 7) {
|
if (length > 7) {
|
||||||
if (a[aFromIndex] != b[bFromIndex])
|
if (a[aFromIndex] != b[bFromIndex])
|
||||||
return 0;
|
return 0;
|
||||||
int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
|
long aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
|
||||||
int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
|
long bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
|
||||||
i = vectorizedMismatch(
|
i = vectorizedMismatch(
|
||||||
a, aOffset,
|
a, aOffset,
|
||||||
b, bOffset,
|
b, bOffset,
|
||||||
|
@ -599,8 +599,8 @@ public class ArraysSupport {
|
||||||
if (length > 3) {
|
if (length > 3) {
|
||||||
if (a[aFromIndex] != b[bFromIndex])
|
if (a[aFromIndex] != b[bFromIndex])
|
||||||
return 0;
|
return 0;
|
||||||
int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
|
long aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
|
||||||
int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
|
long bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
|
||||||
i = vectorizedMismatch(
|
i = vectorizedMismatch(
|
||||||
a, aOffset,
|
a, aOffset,
|
||||||
b, bOffset,
|
b, bOffset,
|
||||||
|
@ -648,8 +648,8 @@ public class ArraysSupport {
|
||||||
if (length > 3) {
|
if (length > 3) {
|
||||||
if (a[aFromIndex] != b[bFromIndex])
|
if (a[aFromIndex] != b[bFromIndex])
|
||||||
return 0;
|
return 0;
|
||||||
int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
|
long aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
|
||||||
int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
|
long bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
|
||||||
i = vectorizedMismatch(
|
i = vectorizedMismatch(
|
||||||
a, aOffset,
|
a, aOffset,
|
||||||
b, bOffset,
|
b, bOffset,
|
||||||
|
@ -697,8 +697,8 @@ public class ArraysSupport {
|
||||||
if (length > 1) {
|
if (length > 1) {
|
||||||
if (a[aFromIndex] != b[bFromIndex])
|
if (a[aFromIndex] != b[bFromIndex])
|
||||||
return 0;
|
return 0;
|
||||||
int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
|
long aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
|
||||||
int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
|
long bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
|
||||||
i = vectorizedMismatch(
|
i = vectorizedMismatch(
|
||||||
a, aOffset,
|
a, aOffset,
|
||||||
b, bOffset,
|
b, bOffset,
|
||||||
|
@ -729,8 +729,8 @@ public class ArraysSupport {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (length > 1) {
|
if (length > 1) {
|
||||||
if (Float.floatToRawIntBits(a[aFromIndex]) == Float.floatToRawIntBits(b[bFromIndex])) {
|
if (Float.floatToRawIntBits(a[aFromIndex]) == Float.floatToRawIntBits(b[bFromIndex])) {
|
||||||
int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
|
long aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
|
||||||
int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
|
long bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
|
||||||
i = vectorizedMismatch(
|
i = vectorizedMismatch(
|
||||||
a, aOffset,
|
a, aOffset,
|
||||||
b, bOffset,
|
b, bOffset,
|
||||||
|
@ -787,8 +787,8 @@ public class ArraysSupport {
|
||||||
}
|
}
|
||||||
if (a[aFromIndex] != b[bFromIndex])
|
if (a[aFromIndex] != b[bFromIndex])
|
||||||
return 0;
|
return 0;
|
||||||
int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
|
long aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
|
||||||
int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
|
long bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
|
||||||
int i = vectorizedMismatch(
|
int i = vectorizedMismatch(
|
||||||
a, aOffset,
|
a, aOffset,
|
||||||
b, bOffset,
|
b, bOffset,
|
||||||
|
@ -813,8 +813,8 @@ public class ArraysSupport {
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (Double.doubleToRawLongBits(a[aFromIndex]) == Double.doubleToRawLongBits(b[bFromIndex])) {
|
if (Double.doubleToRawLongBits(a[aFromIndex]) == Double.doubleToRawLongBits(b[bFromIndex])) {
|
||||||
int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
|
long aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
|
||||||
int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
|
long bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
|
||||||
i = vectorizedMismatch(
|
i = vectorizedMismatch(
|
||||||
a, aOffset,
|
a, aOffset,
|
||||||
b, bOffset,
|
b, bOffset,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -426,7 +426,7 @@ public final class DecimalDigits {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void putCharLatin1(byte[] buf, int charPos, int c) {
|
private static void putCharLatin1(byte[] buf, int charPos, int c) {
|
||||||
UNSAFE.putByte(buf, ARRAY_BYTE_BASE_OFFSET + (long) charPos, (byte) c);
|
UNSAFE.putByte(buf, ARRAY_BYTE_BASE_OFFSET + charPos, (byte) c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void putCharUTF16(byte[] buf, int charPos, int c) {
|
private static void putCharUTF16(byte[] buf, int charPos, int c) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -182,7 +182,7 @@ abstract class UnixUserDefinedFileAttributeView
|
||||||
int n = read(name, address, rem);
|
int n = read(name, address, rem);
|
||||||
|
|
||||||
// copy from buffer into backing array
|
// copy from buffer into backing array
|
||||||
long off = dst.arrayOffset() + pos + (long) Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
long off = dst.arrayOffset() + pos + Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
||||||
unsafe.copyMemory(null, address, dst.array(), off, n);
|
unsafe.copyMemory(null, address, dst.array(), off, n);
|
||||||
dst.position(pos + n);
|
dst.position(pos + n);
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ abstract class UnixUserDefinedFileAttributeView
|
||||||
|
|
||||||
if (src.hasArray()) {
|
if (src.hasArray()) {
|
||||||
// copy from backing array into buffer
|
// copy from backing array into buffer
|
||||||
long off = src.arrayOffset() + pos + (long) Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
long off = src.arrayOffset() + pos + Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
||||||
unsafe.copyMemory(src.array(), off, null, address, rem);
|
unsafe.copyMemory(src.array(), off, null, address, rem);
|
||||||
} else {
|
} else {
|
||||||
// backing array not accessible so transfer via temporary array
|
// backing array not accessible so transfer via temporary array
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -4105,7 +4105,7 @@ public abstract class ByteVector extends AbstractVector<Byte> {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static long byteArrayAddress(byte[] a, int index) {
|
static long byteArrayAddress(byte[] a, int index) {
|
||||||
return (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
return Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================================
|
// ================================================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -3615,7 +3615,7 @@ public abstract class DoubleVector extends AbstractVector<Double> {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static long byteArrayAddress(byte[] a, int index) {
|
static long byteArrayAddress(byte[] a, int index) {
|
||||||
return (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
return Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================================
|
// ================================================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -3565,7 +3565,7 @@ public abstract class FloatVector extends AbstractVector<Float> {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static long byteArrayAddress(byte[] a, int index) {
|
static long byteArrayAddress(byte[] a, int index) {
|
||||||
return (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
return Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================================
|
// ================================================
|
||||||
|
|
|
@ -3743,7 +3743,7 @@ public abstract class IntVector extends AbstractVector<Integer> {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static long byteArrayAddress(byte[] a, int index) {
|
static long byteArrayAddress(byte[] a, int index) {
|
||||||
return (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
return Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================================
|
// ================================================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -3678,7 +3678,7 @@ public abstract class LongVector extends AbstractVector<Long> {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static long byteArrayAddress(byte[] a, int index) {
|
static long byteArrayAddress(byte[] a, int index) {
|
||||||
return (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
return Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================================
|
// ================================================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -4096,7 +4096,7 @@ public abstract class ShortVector extends AbstractVector<Short> {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static long byteArrayAddress(byte[] a, int index) {
|
static long byteArrayAddress(byte[] a, int index) {
|
||||||
return (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
return Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================================
|
// ================================================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -5348,7 +5348,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static long byteArrayAddress(byte[] a, int index) {
|
static long byteArrayAddress(byte[] a, int index) {
|
||||||
return (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
return Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================================
|
// ================================================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -863,7 +863,7 @@ public final class Unsafe {
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int INVALID_FIELD_OFFSET = jdk.internal.misc.Unsafe.INVALID_FIELD_OFFSET;
|
public static final int INVALID_FIELD_OFFSET = (int) jdk.internal.misc.Unsafe.INVALID_FIELD_OFFSET;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports the location of a given field in the storage allocation of its
|
* Reports the location of a given field in the storage allocation of its
|
||||||
|
@ -994,7 +994,7 @@ public final class Unsafe {
|
||||||
@ForceInline
|
@ForceInline
|
||||||
public int arrayBaseOffset(Class<?> arrayClass) {
|
public int arrayBaseOffset(Class<?> arrayClass) {
|
||||||
beforeMemoryAccess();
|
beforeMemoryAccess();
|
||||||
return theInternalUnsafe.arrayBaseOffset(arrayClass);
|
return (int) theInternalUnsafe.arrayBaseOffset(arrayClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(boolean[].class)}.
|
/** The value of {@code arrayBaseOffset(boolean[].class)}.
|
||||||
|
@ -1002,63 +1002,63 @@ public final class Unsafe {
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int ARRAY_BOOLEAN_BASE_OFFSET = jdk.internal.misc.Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
|
public static final int ARRAY_BOOLEAN_BASE_OFFSET = (int) jdk.internal.misc.Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(byte[].class)}.
|
/** The value of {@code arrayBaseOffset(byte[].class)}.
|
||||||
*
|
*
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int ARRAY_BYTE_BASE_OFFSET = jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
public static final int ARRAY_BYTE_BASE_OFFSET = (int) jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(short[].class)}.
|
/** The value of {@code arrayBaseOffset(short[].class)}.
|
||||||
*
|
*
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int ARRAY_SHORT_BASE_OFFSET = jdk.internal.misc.Unsafe.ARRAY_SHORT_BASE_OFFSET;
|
public static final int ARRAY_SHORT_BASE_OFFSET = (int) jdk.internal.misc.Unsafe.ARRAY_SHORT_BASE_OFFSET;
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(char[].class)}.
|
/** The value of {@code arrayBaseOffset(char[].class)}.
|
||||||
*
|
*
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int ARRAY_CHAR_BASE_OFFSET = jdk.internal.misc.Unsafe.ARRAY_CHAR_BASE_OFFSET;
|
public static final int ARRAY_CHAR_BASE_OFFSET = (int) jdk.internal.misc.Unsafe.ARRAY_CHAR_BASE_OFFSET;
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(int[].class)}.
|
/** The value of {@code arrayBaseOffset(int[].class)}.
|
||||||
*
|
*
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int ARRAY_INT_BASE_OFFSET = jdk.internal.misc.Unsafe.ARRAY_INT_BASE_OFFSET;
|
public static final int ARRAY_INT_BASE_OFFSET = (int) jdk.internal.misc.Unsafe.ARRAY_INT_BASE_OFFSET;
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(long[].class)}.
|
/** The value of {@code arrayBaseOffset(long[].class)}.
|
||||||
*
|
*
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int ARRAY_LONG_BASE_OFFSET = jdk.internal.misc.Unsafe.ARRAY_LONG_BASE_OFFSET;
|
public static final int ARRAY_LONG_BASE_OFFSET = (int) jdk.internal.misc.Unsafe.ARRAY_LONG_BASE_OFFSET;
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(float[].class)}.
|
/** The value of {@code arrayBaseOffset(float[].class)}.
|
||||||
*
|
*
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int ARRAY_FLOAT_BASE_OFFSET = jdk.internal.misc.Unsafe.ARRAY_FLOAT_BASE_OFFSET;
|
public static final int ARRAY_FLOAT_BASE_OFFSET = (int) jdk.internal.misc.Unsafe.ARRAY_FLOAT_BASE_OFFSET;
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(double[].class)}.
|
/** The value of {@code arrayBaseOffset(double[].class)}.
|
||||||
*
|
*
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int ARRAY_DOUBLE_BASE_OFFSET = jdk.internal.misc.Unsafe.ARRAY_DOUBLE_BASE_OFFSET;
|
public static final int ARRAY_DOUBLE_BASE_OFFSET = (int) jdk.internal.misc.Unsafe.ARRAY_DOUBLE_BASE_OFFSET;
|
||||||
|
|
||||||
/** The value of {@code arrayBaseOffset(Object[].class)}.
|
/** The value of {@code arrayBaseOffset(Object[].class)}.
|
||||||
*
|
*
|
||||||
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
* @deprecated Not needed when using {@link VarHandle} or {@link java.lang.foreign}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="23", forRemoval=true)
|
@Deprecated(since="23", forRemoval=true)
|
||||||
public static final int ARRAY_OBJECT_BASE_OFFSET = jdk.internal.misc.Unsafe.ARRAY_OBJECT_BASE_OFFSET;
|
public static final int ARRAY_OBJECT_BASE_OFFSET = (int) jdk.internal.misc.Unsafe.ARRAY_OBJECT_BASE_OFFSET;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports the scale factor for addressing elements in the storage
|
* Reports the scale factor for addressing elements in the storage
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -39,7 +39,7 @@ import java.lang.reflect.Field;
|
||||||
public class Test6968348 {
|
public class Test6968348 {
|
||||||
static Unsafe unsafe = Unsafe.getUnsafe();
|
static Unsafe unsafe = Unsafe.getUnsafe();
|
||||||
static final long[] buffer = new long[4096];
|
static final long[] buffer = new long[4096];
|
||||||
static int array_long_base_offset;
|
static long array_long_base_offset;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
array_long_base_offset = unsafe.arrayBaseOffset(long[].class);
|
array_long_base_offset = unsafe.arrayBaseOffset(long[].class);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -50,7 +50,7 @@ public class TestIntUnsafeCAS {
|
||||||
private static final int UNALIGN_OFF = 5;
|
private static final int UNALIGN_OFF = 5;
|
||||||
|
|
||||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||||
private static final int BASE;
|
private static final long BASE;
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
BASE = unsafe.arrayBaseOffset(int[].class);
|
BASE = unsafe.arrayBaseOffset(int[].class);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -50,7 +50,7 @@ public class TestIntUnsafeOrdered {
|
||||||
private static final int UNALIGN_OFF = 5;
|
private static final int UNALIGN_OFF = 5;
|
||||||
|
|
||||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||||
private static final int BASE;
|
private static final long BASE;
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
BASE = unsafe.arrayBaseOffset(int[].class);
|
BASE = unsafe.arrayBaseOffset(int[].class);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -50,7 +50,7 @@ public class TestIntUnsafeVolatile {
|
||||||
private static final int UNALIGN_OFF = 5;
|
private static final int UNALIGN_OFF = 5;
|
||||||
|
|
||||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||||
private static final int BASE;
|
private static final long BASE;
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
BASE = unsafe.arrayBaseOffset(int[].class);
|
BASE = unsafe.arrayBaseOffset(int[].class);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -156,7 +156,7 @@ public class TestMovingLoadBeforeStore {
|
||||||
|
|
||||||
static void test3(byte[] a) {
|
static void test3(byte[] a) {
|
||||||
for (int i = 51; i < 6000; i++) {
|
for (int i = 51; i < 6000; i++) {
|
||||||
int adr = UNSAFE.ARRAY_BYTE_BASE_OFFSET + 42 + i;
|
long adr = UNSAFE.ARRAY_BYTE_BASE_OFFSET + 42 + i;
|
||||||
UNSAFE.putIntUnaligned(a, adr + 0*4, UNSAFE.getIntUnaligned(a, adr + 0*4) + 1);
|
UNSAFE.putIntUnaligned(a, adr + 0*4, UNSAFE.getIntUnaligned(a, adr + 0*4) + 1);
|
||||||
UNSAFE.putIntUnaligned(a, adr + 1*4, UNSAFE.getIntUnaligned(a, adr + 1*4) + 1);
|
UNSAFE.putIntUnaligned(a, adr + 1*4, UNSAFE.getIntUnaligned(a, adr + 1*4) + 1);
|
||||||
UNSAFE.putIntUnaligned(a, adr + 2*4, UNSAFE.getIntUnaligned(a, adr + 2*4) + 1);
|
UNSAFE.putIntUnaligned(a, adr + 2*4, UNSAFE.getIntUnaligned(a, adr + 2*4) + 1);
|
||||||
|
@ -171,7 +171,7 @@ public class TestMovingLoadBeforeStore {
|
||||||
|
|
||||||
static void ref3(byte[] a) {
|
static void ref3(byte[] a) {
|
||||||
for (int i = 51; i < 6000; i++) {
|
for (int i = 51; i < 6000; i++) {
|
||||||
int adr = UNSAFE.ARRAY_BYTE_BASE_OFFSET + 42 + i;
|
long adr = UNSAFE.ARRAY_BYTE_BASE_OFFSET + 42 + i;
|
||||||
UNSAFE.putIntUnaligned(a, adr + 0*4, UNSAFE.getIntUnaligned(a, adr + 0*4) + 1);
|
UNSAFE.putIntUnaligned(a, adr + 0*4, UNSAFE.getIntUnaligned(a, adr + 0*4) + 1);
|
||||||
UNSAFE.putIntUnaligned(a, adr + 1*4, UNSAFE.getIntUnaligned(a, adr + 1*4) + 1);
|
UNSAFE.putIntUnaligned(a, adr + 1*4, UNSAFE.getIntUnaligned(a, adr + 1*4) + 1);
|
||||||
UNSAFE.putIntUnaligned(a, adr + 2*4, UNSAFE.getIntUnaligned(a, adr + 2*4) + 1);
|
UNSAFE.putIntUnaligned(a, adr + 2*4, UNSAFE.getIntUnaligned(a, adr + 2*4) + 1);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -74,7 +74,7 @@ public class Test8010927 {
|
||||||
static final Test8010927 elem = new Test8010927();
|
static final Test8010927 elem = new Test8010927();
|
||||||
static final WhiteBox wb = WhiteBox.getWhiteBox();
|
static final WhiteBox wb = WhiteBox.getWhiteBox();
|
||||||
|
|
||||||
static final int obj_header_size = U.ARRAY_OBJECT_BASE_OFFSET;
|
static final int obj_header_size = (int) U.ARRAY_OBJECT_BASE_OFFSET;
|
||||||
static final int heap_oop_size = wb.getHeapOopSize();
|
static final int heap_oop_size = wb.getHeapOopSize();
|
||||||
static final int card_size = 512;
|
static final int card_size = 512;
|
||||||
static final int one_card = (card_size - obj_header_size) / heap_oop_size;
|
static final int one_card = (card_size - obj_header_size) / heap_oop_size;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class JdkInternalMiscUnsafeAccessTestByte {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class JdkInternalMiscUnsafeAccessTestChar {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class JdkInternalMiscUnsafeAccessTestInt {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class JdkInternalMiscUnsafeAccessTestLong {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class JdkInternalMiscUnsafeAccessTestObject {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class JdkInternalMiscUnsafeAccessTestShort {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class SunMiscUnsafeAccessTestBoolean {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class SunMiscUnsafeAccessTestByte {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class SunMiscUnsafeAccessTestChar {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class SunMiscUnsafeAccessTestDouble {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class SunMiscUnsafeAccessTestFloat {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class SunMiscUnsafeAccessTestInt {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class SunMiscUnsafeAccessTestLong {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class SunMiscUnsafeAccessTestObject {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -60,7 +60,7 @@ public class SunMiscUnsafeAccessTestShort {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -64,7 +64,7 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
|
||||||
|
|
||||||
static final long STATIC_V_OFFSET;
|
static final long STATIC_V_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_OFFSET;
|
static long ARRAY_OFFSET;
|
||||||
|
|
||||||
static int ARRAY_SHIFT;
|
static int ARRAY_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -138,7 +138,7 @@ public class TestMaxMinHeapFreeRatioFlags {
|
||||||
// Size of byte array that will be allocated
|
// Size of byte array that will be allocated
|
||||||
public static final int CHUNK_SIZE = 1024;
|
public static final int CHUNK_SIZE = 1024;
|
||||||
// Length of byte array, that will be added to "garbage" list.
|
// Length of byte array, that will be added to "garbage" list.
|
||||||
public static final int ARRAY_LENGTH = CHUNK_SIZE - Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
public static final int ARRAY_LENGTH = CHUNK_SIZE - (int) Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
||||||
// Amount of tries to force heap shrinking/expansion using GC
|
// Amount of tries to force heap shrinking/expansion using GC
|
||||||
public static final int GC_TRIES = 10;
|
public static final int GC_TRIES = 10;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -254,7 +254,7 @@ public class TestTargetSurvivorRatioFlag {
|
||||||
// Desired size of memory allocated at once
|
// Desired size of memory allocated at once
|
||||||
public static final int CHUNK_SIZE = 1024;
|
public static final int CHUNK_SIZE = 1024;
|
||||||
// Length of byte[] array that will have occupy CHUNK_SIZE bytes in heap
|
// Length of byte[] array that will have occupy CHUNK_SIZE bytes in heap
|
||||||
public static final int ARRAY_LENGTH = CHUNK_SIZE - Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
public static final int ARRAY_LENGTH = CHUNK_SIZE - (int) Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
||||||
|
|
||||||
public static void main(String args[]) throws Exception {
|
public static void main(String args[]) throws Exception {
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -110,8 +110,8 @@ public class BaseOffsets {
|
||||||
public static final WhiteBox WB = WhiteBox.getWhiteBox();
|
public static final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||||
|
|
||||||
static final long INT_OFFSET;
|
static final long INT_OFFSET;
|
||||||
static final int INT_ARRAY_OFFSET;
|
static final long INT_ARRAY_OFFSET;
|
||||||
static final int LONG_ARRAY_OFFSET;
|
static final long LONG_ARRAY_OFFSET;
|
||||||
static {
|
static {
|
||||||
if (!Platform.is64bit() || WB.getBooleanVMFlag("UseCompactObjectHeaders")) {
|
if (!Platform.is64bit() || WB.getBooleanVMFlag("UseCompactObjectHeaders")) {
|
||||||
INT_OFFSET = 8;
|
INT_OFFSET = 8;
|
||||||
|
@ -151,7 +151,7 @@ public class BaseOffsets {
|
||||||
Asserts.assertEquals(unsafe.arrayBaseOffset(double[].class), LONG_ARRAY_OFFSET, "Misplaced double array base");
|
Asserts.assertEquals(unsafe.arrayBaseOffset(double[].class), LONG_ARRAY_OFFSET, "Misplaced double array base");
|
||||||
boolean narrowOops = System.getProperty("java.vm.compressedOopsMode") != null ||
|
boolean narrowOops = System.getProperty("java.vm.compressedOopsMode") != null ||
|
||||||
!Platform.is64bit();
|
!Platform.is64bit();
|
||||||
int expected_objary_offset = narrowOops ? INT_ARRAY_OFFSET : LONG_ARRAY_OFFSET;
|
long expected_objary_offset = narrowOops ? INT_ARRAY_OFFSET : LONG_ARRAY_OFFSET;
|
||||||
Asserts.assertEquals(unsafe.arrayBaseOffset(Object[].class), expected_objary_offset, "Misplaced object array base");
|
Asserts.assertEquals(unsafe.arrayBaseOffset(Object[].class), expected_objary_offset, "Misplaced object array base");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -37,11 +37,11 @@ import static jdk.test.lib.Asserts.*;
|
||||||
public class GetField {
|
public class GetField {
|
||||||
public static void main(String args[]) throws Exception {
|
public static void main(String args[]) throws Exception {
|
||||||
Unsafe unsafe = Unsafe.getUnsafe();
|
Unsafe unsafe = Unsafe.getUnsafe();
|
||||||
// Unsafe.INVALID_FIELD_OFFSET is a static final int field,
|
// Unsafe.INVALID_FIELD_OFFSET is a static final long field,
|
||||||
// make sure getField returns the correct field
|
// make sure getField returns the correct field
|
||||||
Field field = Unsafe.class.getField("INVALID_FIELD_OFFSET");
|
Field field = Unsafe.class.getField("INVALID_FIELD_OFFSET");
|
||||||
assertNotEquals(field.getModifiers() & Modifier.FINAL, 0);
|
assertNotEquals(field.getModifiers() & Modifier.FINAL, 0);
|
||||||
assertNotEquals(field.getModifiers() & Modifier.STATIC, 0);
|
assertNotEquals(field.getModifiers() & Modifier.STATIC, 0);
|
||||||
assertEquals(field.getType(), int.class);
|
assertEquals(field.getType(), long.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -147,7 +147,7 @@ public class InternalErrorTest {
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// testing Unsafe.copySwapMemory, trying to access next page after truncation.
|
// testing Unsafe.copySwapMemory, trying to access next page after truncation.
|
||||||
int destOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
long destOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET;
|
||||||
unsafe.copySwapMemory(null, mapAddr + pageSize, new byte[4000], destOffset, 2000, 2);
|
unsafe.copySwapMemory(null, mapAddr + pageSize, new byte[4000], destOffset, 2000, 2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -69,7 +69,7 @@ public class BulkOps {
|
||||||
|
|
||||||
final int[] ints = new int[ELEM_SIZE];
|
final int[] ints = new int[ELEM_SIZE];
|
||||||
final MemorySegment bytesSegment = MemorySegment.ofArray(ints);
|
final MemorySegment bytesSegment = MemorySegment.ofArray(ints);
|
||||||
final int UNSAFE_INT_OFFSET = unsafe.arrayBaseOffset(int[].class);
|
final long UNSAFE_INT_OFFSET = unsafe.arrayBaseOffset(int[].class);
|
||||||
|
|
||||||
// large(ish) segments/buffers with same content, 0, for mismatch, non-multiple-of-8 sized
|
// large(ish) segments/buffers with same content, 0, for mismatch, non-multiple-of-8 sized
|
||||||
static final int SIZE_WITH_TAIL = (1024 * 1024) + 7;
|
static final int SIZE_WITH_TAIL = (1024 * 1024) + 7;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -57,8 +57,8 @@ public class LoopOverNonConstantHeap extends JavaLayouts {
|
||||||
static final int ELEM_SIZE = 1_000_000;
|
static final int ELEM_SIZE = 1_000_000;
|
||||||
static final int CARRIER_SIZE = (int)JAVA_INT.byteSize();
|
static final int CARRIER_SIZE = (int)JAVA_INT.byteSize();
|
||||||
static final int ALLOC_SIZE = ELEM_SIZE * CARRIER_SIZE;
|
static final int ALLOC_SIZE = ELEM_SIZE * CARRIER_SIZE;
|
||||||
static final int UNSAFE_BYTE_BASE = unsafe.arrayBaseOffset(byte[].class);
|
static final long UNSAFE_BYTE_BASE = unsafe.arrayBaseOffset(byte[].class);
|
||||||
static final int UNSAFE_INT_BASE = unsafe.arrayBaseOffset(int[].class);
|
static final long UNSAFE_INT_BASE = unsafe.arrayBaseOffset(int[].class);
|
||||||
|
|
||||||
MemorySegment segment, alignedSegment;
|
MemorySegment segment, alignedSegment;
|
||||||
byte[] base;
|
byte[] base;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -42,7 +42,7 @@ import static org.openjdk.bench.java.lang.foreign.CLayouts.*;
|
||||||
public class GetArrayUnsafeXorOpImpl implements XorOp {
|
public class GetArrayUnsafeXorOpImpl implements XorOp {
|
||||||
|
|
||||||
static final Unsafe UNSAFE = Utils.unsafe;
|
static final Unsafe UNSAFE = Utils.unsafe;
|
||||||
static final int BYTE_ARR_OFFSET = Utils.unsafe.arrayBaseOffset(byte[].class);
|
static final long BYTE_ARR_OFFSET = Utils.unsafe.arrayBaseOffset(byte[].class);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("jnitest");
|
System.loadLibrary("jnitest");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue