Class PanamaMemoryType
java.lang.Object
ai.tegmentum.wasmtime4j.panama.type.PanamaMemoryType
- All Implemented Interfaces:
ai.tegmentum.wasmtime4j.type.MemoryType,ai.tegmentum.wasmtime4j.type.WasmType
public final class PanamaMemoryType
extends Object
implements ai.tegmentum.wasmtime4j.type.MemoryType
Panama implementation of MemoryType interface.
This class provides type introspection capabilities for WebAssembly memory types using Panama Foreign Function Interface bindings to the native Wasmtime library.
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionPanamaMemoryType(long minimum, Long maximum, boolean is64Bit, boolean isShared) Creates a new PanamaMemoryType instance with just the type values.PanamaMemoryType(long minimum, Long maximum, boolean is64Bit, boolean isShared, int pageSizeLog2) Creates a new PanamaMemoryType instance with just the type values including page size.PanamaMemoryType(long minimum, Long maximum, boolean is64Bit, boolean isShared, int pageSizeLog2, Arena arena, MemorySegment nativeHandle) Creates a new PanamaMemoryType instance with native handle.PanamaMemoryType(long minimum, Long maximum, boolean is64Bit, boolean isShared, Arena arena, MemorySegment nativeHandle) Creates a new PanamaMemoryType instance with native handle and default page size. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic PanamaMemoryTypefromNative(MemorySegment nativeHandle, Arena arena) Creates a PanamaMemoryType from native memory type information.getArena()Gets the memory arena used by this memory type.ai.tegmentum.wasmtime4j.type.WasmTypeKindgetKind()longGets the native handle for this memory type.longintinthashCode()booleanis64Bit()booleanisShared()toString()
-
Constructor Details
-
PanamaMemoryType
Creates a new PanamaMemoryType instance with just the type values.This constructor is used when the type information is already known and no native handle is needed for further operations.
- Parameters:
minimum- the minimum number of memory pagesmaximum- the maximum number of memory pages (null if unlimited)is64Bit- true if this is 64-bit addressable memoryisShared- true if this is shared memory
-
PanamaMemoryType
public PanamaMemoryType(long minimum, Long maximum, boolean is64Bit, boolean isShared, int pageSizeLog2) Creates a new PanamaMemoryType instance with just the type values including page size.- Parameters:
minimum- the minimum number of memory pagesmaximum- the maximum number of memory pages (null if unlimited)is64Bit- true if this is 64-bit addressable memoryisShared- true if this is shared memorypageSizeLog2- the log2 of the page size (e.g. 16 for 65536 bytes)
-
PanamaMemoryType
public PanamaMemoryType(long minimum, Long maximum, boolean is64Bit, boolean isShared, Arena arena, MemorySegment nativeHandle) Creates a new PanamaMemoryType instance with native handle and default page size.- Parameters:
minimum- the minimum number of memory pagesmaximum- the maximum number of memory pages (null if unlimited)is64Bit- true if this is 64-bit addressable memoryisShared- true if this is shared memoryarena- the memory arena for resource managementnativeHandle- the native handle to the memory type
-
PanamaMemoryType
public PanamaMemoryType(long minimum, Long maximum, boolean is64Bit, boolean isShared, int pageSizeLog2, Arena arena, MemorySegment nativeHandle) Creates a new PanamaMemoryType instance with native handle.- Parameters:
minimum- the minimum number of memory pagesmaximum- the maximum number of memory pages (null if unlimited)is64Bit- true if this is 64-bit addressable memoryisShared- true if this is shared memorypageSizeLog2- the log2 of the page size (e.g. 16 for 65536 bytes)arena- the memory arena for resource managementnativeHandle- the native handle to the memory type
-
-
Method Details
-
fromNative
Creates a PanamaMemoryType from native memory type information.- Parameters:
nativeHandle- the native handle to the memory typearena- the memory arena for resource management- Returns:
- the PanamaMemoryType instance
- Throws:
IllegalArgumentException- if nativeHandle is invalid
-
getMinimum
public long getMinimum()- Specified by:
getMinimumin interfaceai.tegmentum.wasmtime4j.type.MemoryType
-
getMaximum
-
is64Bit
public boolean is64Bit()- Specified by:
is64Bitin interfaceai.tegmentum.wasmtime4j.type.MemoryType
-
getPageSize
public long getPageSize()- Specified by:
getPageSizein interfaceai.tegmentum.wasmtime4j.type.MemoryType
-
getPageSizeLog2
public int getPageSizeLog2()- Specified by:
getPageSizeLog2in interfaceai.tegmentum.wasmtime4j.type.MemoryType
-
getKind
public ai.tegmentum.wasmtime4j.type.WasmTypeKind getKind()- Specified by:
getKindin interfaceai.tegmentum.wasmtime4j.type.MemoryType- Specified by:
getKindin interfaceai.tegmentum.wasmtime4j.type.WasmType
-
getNativeHandle
Gets the native handle for this memory type.- Returns:
- the native handle
-
getArena
-
equals
-
hashCode
-
toString
-