APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.foreign

public Class SegmentFactories

extends Object
Class Inheritance
Imports
jdk.internal.access.foreign.UnmapperProxy, jdk.internal.foreign.HeapMemorySegmentImpl.OfByte, .HeapMemorySegmentImpl.OfChar, .HeapMemorySegmentImpl.OfDouble, .HeapMemorySegmentImpl.OfFloat, .HeapMemorySegmentImpl.OfInt, .HeapMemorySegmentImpl.OfLong, .HeapMemorySegmentImpl.OfShort, jdk.internal.misc.Unsafe, .VM, jdk.internal.vm.annotation.DontInline, .ForceInline, java.lang.foreign.MemorySegment, java.util.Objects

This class is used to retrieve concrete memory segment implementations, while making sure that classes are initialized in the right order (that is, that MemorySegment is always initialized first). See SegmentFactories#ensureInitialized().

Field Summary

Modifier and TypeField and Description
private static final long
private static final Unsafe

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static long
private static long
allocateNativeInternal(long byteSize, long byteAlignment, MemorySessionImpl sessionImpl, boolean shouldReserve, boolean init)

public static NativeMemorySegmentImpl
allocateNativeSegment(long byteSize, long byteAlignment, MemorySessionImpl sessionImpl, boolean shouldReserve, boolean init)

public static HeapMemorySegmentImpl.OfByte
arrayOfByteSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)

public static HeapMemorySegmentImpl.OfChar
arrayOfCharSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)

public static HeapMemorySegmentImpl.OfDouble
arrayOfDoubleSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)

public static HeapMemorySegmentImpl.OfFloat
arrayOfFloatSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)

public static HeapMemorySegmentImpl.OfInt
arrayOfIntSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)

public static HeapMemorySegmentImpl.OfLong
arrayOfLongSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)

public static HeapMemorySegmentImpl.OfShort
arrayOfShortSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)

private static void
public static HeapMemorySegmentImpl.OfByte
fromArray(byte[] arr)

public static HeapMemorySegmentImpl.OfShort
fromArray(short[] arr)

public static HeapMemorySegmentImpl.OfInt
fromArray(int[] arr)

public static HeapMemorySegmentImpl.OfChar
fromArray(char[] arr)

public static HeapMemorySegmentImpl.OfFloat
fromArray(float[] arr)

public static HeapMemorySegmentImpl.OfDouble
fromArray(double[] arr)

public static HeapMemorySegmentImpl.OfLong
fromArray(long[] arr)

private static void
initNativeMemory(long address, long byteSize)

public static NativeMemorySegmentImpl
makeNativeSegmentUnchecked(long min, long byteSize, MemorySessionImpl sessionImpl, boolean readOnly, Runnable action)

public static NativeMemorySegmentImpl
makeNativeSegmentUnchecked(long min, long byteSize, MemorySessionImpl sessionImpl)

public static NativeMemorySegmentImpl
makeNativeSegmentUnchecked(long min, long byteSize)

public static MappedMemorySegmentImpl
mapSegment(long size, UnmapperProxy unmapper, boolean readOnly, MemorySessionImpl sessionImpl)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MAX_MALLOC_ALIGNback to summary
private static final long MAX_MALLOC_ALIGN
UNSAFEback to summary
private static final Unsafe UNSAFE

Constructor Detail

SegmentFactoriesback to summary
public SegmentFactories()

Method Detail

allocateMemoryWrapperback to summary
private static long allocateMemoryWrapper(long size)
allocateNativeInternalback to summary
private static long allocateNativeInternal(long byteSize, long byteAlignment, MemorySessionImpl sessionImpl, boolean shouldReserve, boolean init)
allocateNativeSegmentback to summary
public static NativeMemorySegmentImpl allocateNativeSegment(long byteSize, long byteAlignment, MemorySessionImpl sessionImpl, boolean shouldReserve, boolean init)
arrayOfByteSegmentback to summary
public static HeapMemorySegmentImpl.OfByte arrayOfByteSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)
arrayOfCharSegmentback to summary
public static HeapMemorySegmentImpl.OfChar arrayOfCharSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)
arrayOfDoubleSegmentback to summary
public static HeapMemorySegmentImpl.OfDouble arrayOfDoubleSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)
arrayOfFloatSegmentback to summary
public static HeapMemorySegmentImpl.OfFloat arrayOfFloatSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)
arrayOfIntSegmentback to summary
public static HeapMemorySegmentImpl.OfInt arrayOfIntSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)
arrayOfLongSegmentback to summary
public static HeapMemorySegmentImpl.OfLong arrayOfLongSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)
arrayOfShortSegmentback to summary
public static HeapMemorySegmentImpl.OfShort arrayOfShortSegment(Object base, long offset, long length, boolean readOnly, MemorySessionImpl bufferScope)
ensureInitializedback to summary
private static void ensureInitialized()
Annotations
@ForceInline
fromArrayback to summary
public static HeapMemorySegmentImpl.OfByte fromArray(byte[] arr)
fromArrayback to summary
public static HeapMemorySegmentImpl.OfShort fromArray(short[] arr)
fromArrayback to summary
public static HeapMemorySegmentImpl.OfInt fromArray(int[] arr)
fromArrayback to summary
public static HeapMemorySegmentImpl.OfChar fromArray(char[] arr)
fromArrayback to summary
public static HeapMemorySegmentImpl.OfFloat fromArray(float[] arr)
fromArrayback to summary
public static HeapMemorySegmentImpl.OfDouble fromArray(double[] arr)
fromArrayback to summary
public static HeapMemorySegmentImpl.OfLong fromArray(long[] arr)
initNativeMemoryback to summary
private static void initNativeMemory(long address, long byteSize)
makeNativeSegmentUncheckedback to summary
public static NativeMemorySegmentImpl makeNativeSegmentUnchecked(long min, long byteSize, MemorySessionImpl sessionImpl, boolean readOnly, Runnable action)
Annotations
@ForceInline
makeNativeSegmentUncheckedback to summary
public static NativeMemorySegmentImpl makeNativeSegmentUnchecked(long min, long byteSize, MemorySessionImpl sessionImpl)
Annotations
@ForceInline
makeNativeSegmentUncheckedback to summary
public static NativeMemorySegmentImpl makeNativeSegmentUnchecked(long min, long byteSize)
Annotations
@ForceInline
mapSegmentback to summary
public static MappedMemorySegmentImpl mapSegment(long size, UnmapperProxy unmapper, boolean readOnly, MemorySessionImpl sessionImpl)