Class PlatformDependent0

java.lang.Object
io.netty.util.internal.PlatformDependent0

final class PlatformDependent0 extends java.lang.Object
The PlatformDependent operations which requires access to sun.misc.*.
  • Field Details

    • logger

      private static final InternalLogger logger
    • ADDRESS_FIELD_OFFSET

      private static final long ADDRESS_FIELD_OFFSET
    • BYTE_ARRAY_BASE_OFFSET

      private static final long BYTE_ARRAY_BASE_OFFSET
    • INT_ARRAY_BASE_OFFSET

      private static final long INT_ARRAY_BASE_OFFSET
    • INT_ARRAY_INDEX_SCALE

      private static final long INT_ARRAY_INDEX_SCALE
    • LONG_ARRAY_BASE_OFFSET

      private static final long LONG_ARRAY_BASE_OFFSET
    • LONG_ARRAY_INDEX_SCALE

      private static final long LONG_ARRAY_INDEX_SCALE
    • DIRECT_BUFFER_CONSTRUCTOR

      private static final MethodHandle DIRECT_BUFFER_CONSTRUCTOR
    • ALLOCATE_ARRAY_METHOD

      private static final MethodHandle ALLOCATE_ARRAY_METHOD
    • ALIGN_SLICE

      private static final MethodHandle ALIGN_SLICE
    • OFFSET_SLICE

      private static final MethodHandle OFFSET_SLICE
    • ABSOLUTE_PUT_BUFFER

      private static final MethodHandle ABSOLUTE_PUT_BUFFER
    • ABSOLUTE_PUT_ARRAY

      private static final MethodHandle ABSOLUTE_PUT_ARRAY
    • MEMORY_SEGMENT_ADDRESS_OF_BUFFER

      private static final MethodHandle MEMORY_SEGMENT_ADDRESS_OF_BUFFER
    • SPLITTABLE_RANDOM_NEXT_BYTES

      private static final MethodHandle SPLITTABLE_RANDOM_NEXT_BYTES
    • IS_ANDROID

      private static final boolean IS_ANDROID
    • JAVA_VERSION

      private static final int JAVA_VERSION
    • EXPLICIT_NO_UNSAFE_CAUSE

      private static final java.lang.Throwable EXPLICIT_NO_UNSAFE_CAUSE
    • UNSAFE_UNAVAILABILITY_CAUSE

      private static final java.lang.Throwable UNSAFE_UNAVAILABILITY_CAUSE
    • RUNNING_IN_NATIVE_IMAGE

      private static final boolean RUNNING_IN_NATIVE_IMAGE
    • IS_EXPLICIT_TRY_REFLECTION_SET_ACCESSIBLE

      private static final boolean IS_EXPLICIT_TRY_REFLECTION_SET_ACCESSIBLE
    • IS_VIRTUAL_THREAD_METHOD_HANDLE

      static final MethodHandle IS_VIRTUAL_THREAD_METHOD_HANDLE
    • UNSAFE

      static final sun.misc.Unsafe UNSAFE
    • HASH_CODE_ASCII_SEED

      static final int HASH_CODE_ASCII_SEED
      See Also:
    • HASH_CODE_C1

      static final int HASH_CODE_C1
      See Also:
    • HASH_CODE_C2

      static final int HASH_CODE_C2
      See Also:
    • UNSAFE_COPY_THRESHOLD

      private static final long UNSAFE_COPY_THRESHOLD
      Limits the number of bytes to copy per Unsafe.copyMemory(long, long, long) to allow safepoint polling during a large copy.
      See Also:
    • UNALIGNED

      private static final boolean UNALIGNED
    • BITS_MAX_DIRECT_MEMORY

      private static final long BITS_MAX_DIRECT_MEMORY
  • Constructor Details

    • PlatformDependent0

      private PlatformDependent0()
  • Method Details

    • getIsVirtualThreadMethodHandle

      private static MethodHandle getIsVirtualThreadMethodHandle()
    • isVirtualThread

      static boolean isVirtualThread(java.lang.Thread thread)
      Parameters:
      thread - The thread to be checked.
      Returns:
      true if this Thread is a virtual thread, false otherwise.
    • isNativeImage

      static boolean isNativeImage()
    • isExplicitNoUnsafe

      static boolean isExplicitNoUnsafe()
    • explicitNoUnsafeCause0

      private static java.lang.Throwable explicitNoUnsafeCause0()
    • isUnaligned

      static boolean isUnaligned()
    • bitsMaxDirectMemory

      static long bitsMaxDirectMemory()
      Any value >= 0 should be considered as a valid max direct memory value.
    • hasUnsafe

      static boolean hasUnsafe()
    • getUnsafeUnavailabilityCause

      static java.lang.Throwable getUnsafeUnavailabilityCause()
    • hasMemorySegmentAddressOfBuffer

      static boolean hasMemorySegmentAddressOfBuffer()
    • unalignedAccess

      static boolean unalignedAccess()
    • splittableRandomNextBytes

      static void splittableRandomNextBytes(java.util.SplittableRandom rng, byte[] data)
    • throwException

      static void throwException(java.lang.Throwable cause)
    • throwException0

      private static <E extends java.lang.Throwable> void throwException0(java.lang.Throwable t) throws E
      Throws:
      E
    • hasDirectBufferNoCleanerConstructor

      static boolean hasDirectBufferNoCleanerConstructor()
    • reallocateDirectNoCleaner

      static java.nio.ByteBuffer reallocateDirectNoCleaner(java.nio.ByteBuffer buffer, int capacity)
    • allocateDirectNoCleaner

      static java.nio.ByteBuffer allocateDirectNoCleaner(int capacity)
    • hasAlignSliceMethod

      static boolean hasAlignSliceMethod()
    • alignSlice

      static java.nio.ByteBuffer alignSlice(java.nio.ByteBuffer buffer, int alignment)
    • hasOffsetSliceMethod

      static boolean hasOffsetSliceMethod()
    • offsetSlice

      static java.nio.ByteBuffer offsetSlice(java.nio.ByteBuffer buffer, int index, int length)
    • hasAbsolutePutBufferMethod

      static boolean hasAbsolutePutBufferMethod()
    • hasAbsolutePutArrayMethod

      static boolean hasAbsolutePutArrayMethod()
    • absolutePut

      static java.nio.ByteBuffer absolutePut(java.nio.ByteBuffer dst, int dstOffset, java.nio.ByteBuffer src, int srcOffset, int length)
    • absolutePut

      static java.nio.ByteBuffer absolutePut(java.nio.ByteBuffer dst, int dstOffset, byte[] src, int srcOffset, int length)
    • hasAllocateArrayMethod

      static boolean hasAllocateArrayMethod()
    • allocateUninitializedArray

      static byte[] allocateUninitializedArray(int size)
    • newDirectBuffer

      static java.nio.ByteBuffer newDirectBuffer(long address, int capacity)
    • rethrowIfPossible

      private static void rethrowIfPossible(java.lang.Throwable cause)
    • hasDirectByteBufferAddress

      static boolean hasDirectByteBufferAddress(java.nio.ByteBuffer buffer)
    • directBufferAddress

      static long directBufferAddress(java.nio.ByteBuffer buffer)
    • byteArrayBaseOffset

      static long byteArrayBaseOffset()
    • getObject

      static java.lang.Object getObject(java.lang.Object object, long fieldOffset)
    • getInt

      static int getInt(java.lang.Object object, long fieldOffset)
    • getIntVolatile

      static int getIntVolatile(java.lang.Object object, long fieldOffset)
    • putOrderedInt

      static void putOrderedInt(java.lang.Object object, long fieldOffset, int value)
    • getAndAddInt

      static int getAndAddInt(java.lang.Object object, long fieldOffset, int value)
    • compareAndSwapInt

      static boolean compareAndSwapInt(java.lang.Object object, long fieldOffset, int expected, int value)
    • safeConstructPutInt

      static void safeConstructPutInt(java.lang.Object object, long fieldOffset, int value)
    • getLong

      private static long getLong(java.lang.Object object, long fieldOffset)
    • objectFieldOffset

      static long objectFieldOffset(java.lang.reflect.Field field)
    • getByte

      static byte getByte(long address)
    • getShort

      static short getShort(long address)
    • getInt

      static int getInt(long address)
    • getLong

      static long getLong(long address)
    • getByte

      static byte getByte(byte[] data, int index)
    • getByte

      static byte getByte(byte[] data, long index)
    • getShort

      static short getShort(byte[] data, int index)
    • getInt

      static int getInt(byte[] data, int index)
    • getInt

      static int getInt(int[] data, long index)
    • getLong

      static long getLong(byte[] data, int index)
    • getLong

      static long getLong(long[] data, long index)
    • putByte

      static void putByte(long address, byte value)
    • putShort

      static void putShort(long address, short value)
    • putShortOrdered

      static void putShortOrdered(long address, short newValue)
    • putInt

      static void putInt(long address, int value)
    • putLong

      static void putLong(long address, long value)
    • putByte

      static void putByte(byte[] data, int index, byte value)
    • putByte

      static void putByte(java.lang.Object data, long offset, byte value)
    • putShort

      static void putShort(byte[] data, int index, short value)
    • putInt

      static void putInt(byte[] data, int index, int value)
    • putLong

      static void putLong(byte[] data, int index, long value)
    • putObject

      static void putObject(java.lang.Object o, long offset, java.lang.Object x)
    • copyMemory

      static void copyMemory(long srcAddr, long dstAddr, long length)
    • copyMemoryWithSafePointPolling

      private static void copyMemoryWithSafePointPolling(long srcAddr, long dstAddr, long length)
    • copyMemory

      static void copyMemory(java.lang.Object src, long srcOffset, java.lang.Object dst, long dstOffset, long length)
    • copyMemoryWithSafePointPolling

      private static void copyMemoryWithSafePointPolling(java.lang.Object src, long srcOffset, java.lang.Object dst, long dstOffset, long length)
    • setMemory

      static void setMemory(long address, long bytes, byte value)
    • setMemory

      static void setMemory(java.lang.Object o, long offset, long bytes, byte value)
    • equals

      static boolean equals(byte[] bytes1, int startPos1, byte[] bytes2, int startPos2, int length)
    • equalsConstantTime

      static int equalsConstantTime(byte[] bytes1, int startPos1, byte[] bytes2, int startPos2, int length)
    • isZero

      static boolean isZero(byte[] bytes, int startPos, int length)
    • hashCodeAscii

      static int hashCodeAscii(byte[] bytes, int startPos, int length)
    • hashCodeAsciiCompute

      static int hashCodeAsciiCompute(long value, int hash)
    • hashCodeAsciiSanitize

      static int hashCodeAsciiSanitize(int value)
    • hashCodeAsciiSanitize

      static int hashCodeAsciiSanitize(short value)
    • hashCodeAsciiSanitize

      static int hashCodeAsciiSanitize(byte value)
    • getClassLoader

      static java.lang.ClassLoader getClassLoader(java.lang.Class<?> clazz)
    • getContextClassLoader

      static java.lang.ClassLoader getContextClassLoader()
    • getSystemClassLoader

      static java.lang.ClassLoader getSystemClassLoader()
    • addressSize

      static int addressSize()
    • allocateMemory

      static long allocateMemory(long size)
    • freeMemory

      static void freeMemory(long address)
    • reallocateMemory

      static long reallocateMemory(long address, long newSize)
    • isAndroid

      static boolean isAndroid()
    • isAndroid0

      private static boolean isAndroid0()
    • explicitTryReflectionSetAccessible0

      private static boolean explicitTryReflectionSetAccessible0()
    • isExplicitTryReflectionSetAccessible

      static boolean isExplicitTryReflectionSetAccessible()
    • javaVersion

      static int javaVersion()
    • javaVersion0

      private static int javaVersion0()
    • majorVersionFromJavaSpecificationVersion

      static int majorVersionFromJavaSpecificationVersion()
    • majorVersion

      static int majorVersion(java.lang.String javaSpecVersion)