Class PanamaGcRuntime
java.lang.Object
ai.tegmentum.wasmtime4j.panama.PanamaGcRuntime
- All Implemented Interfaces:
ai.tegmentum.wasmtime4j.gc.GcRuntime
Panama FFI implementation of WebAssembly GC runtime operations.
This class provides actual WebAssembly GC functionality through Panama FFI bindings to the native Wasmtime GC implementation. It supports all GC operations including struct creation, array manipulation, reference type conversions, and heap management.
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionPanamaGcRuntime(long engineHandle) Creates a new Panama GC runtime with the specified engine handle. -
Method Summary
Modifier and TypeMethodDescriptionlonganyRefConvertExtern(long externRefData) longanyRefFromRaw(long raw) booleananyRefMatchesTy(long objectId, int heapTypeOrdinal) longanyRefToRaw(long objectId) booleanarrayRefMatchesTy(long objectId, int heapTypeOrdinal) ai.tegmentum.wasmtime4j.gc.GcStatsvoidcopyArrayElements(ai.tegmentum.wasmtime4j.gc.ArrayInstance sourceArray, int sourceIndex, ai.tegmentum.wasmtime4j.gc.ArrayInstance destArray, int destIndex, int length) ai.tegmentum.wasmtime4j.gc.ArrayInstancecreateArray(ai.tegmentum.wasmtime4j.gc.ArrayType arrayType, int length) ai.tegmentum.wasmtime4j.gc.ArrayInstancecreateArray(ai.tegmentum.wasmtime4j.gc.ArrayType arrayType, List<ai.tegmentum.wasmtime4j.gc.GcValue> elements) ai.tegmentum.wasmtime4j.gc.ArrayInstancecreateArrayAsync(ai.tegmentum.wasmtime4j.gc.ArrayType arrayType, List<ai.tegmentum.wasmtime4j.gc.GcValue> elements) ai.tegmentum.wasmtime4j.gc.I31InstancecreateI31(int value) ai.tegmentum.wasmtime4j.gc.I31InstancecreateI31Unsigned(int value) ai.tegmentum.wasmtime4j.gc.I31InstancecreateI31Wrapping(int value) ai.tegmentum.wasmtime4j.gc.I31InstancecreateI31WrappingUnsigned(int value) ai.tegmentum.wasmtime4j.gc.StructInstancecreateStruct(ai.tegmentum.wasmtime4j.gc.StructType structType) ai.tegmentum.wasmtime4j.gc.StructInstancecreateStruct(ai.tegmentum.wasmtime4j.gc.StructType structType, List<ai.tegmentum.wasmtime4j.gc.GcValue> fieldValues) ai.tegmentum.wasmtime4j.gc.StructInstancecreateStructAsync(ai.tegmentum.wasmtime4j.gc.StructType structType, List<ai.tegmentum.wasmtime4j.gc.GcValue> fieldValues) voiddispose()Disposes this GC runtime and releases native resources.booleaneqRefMatchesTy(long objectId, int heapTypeOrdinal) inteqRefTy(long objectId) longexternRefConvertAny(long objectId) voidfillArrayElements(ai.tegmentum.wasmtime4j.gc.ArrayInstance array, int startIndex, int length, ai.tegmentum.wasmtime4j.gc.GcValue value) ai.tegmentum.wasmtime4j.gc.GcValuegetArrayElement(ai.tegmentum.wasmtime4j.gc.ArrayInstance array, int elementIndex) intgetArrayLength(ai.tegmentum.wasmtime4j.gc.ArrayInstance array) ai.tegmentum.wasmtime4j.gc.GcStatsai.tegmentum.wasmtime4j.gc.GcReferenceTypegetRuntimeType(ai.tegmentum.wasmtime4j.gc.GcObject object) ai.tegmentum.wasmtime4j.gc.GcValuegetStructField(ai.tegmentum.wasmtime4j.gc.StructInstance struct, int fieldIndex) booleanisNull(ai.tegmentum.wasmtime4j.gc.GcObject object) ai.tegmentum.wasmtime4j.gc.GcObjectrefCast(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.GcReferenceType targetType) ai.tegmentum.wasmtime4j.gc.ArrayInstancerefCastArray(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.ArrayType targetArrayType) Optional<ai.tegmentum.wasmtime4j.gc.GcObject> refCastNullable(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.GcReferenceType targetType) ai.tegmentum.wasmtime4j.gc.StructInstancerefCastStruct(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.StructType targetStructType) booleanrefEquals(ai.tegmentum.wasmtime4j.gc.GcObject obj1, ai.tegmentum.wasmtime4j.gc.GcObject obj2) booleanrefTest(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.GcReferenceType targetType) booleanrefTestArray(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.ArrayType targetArrayType) booleanrefTestStruct(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.StructType targetStructType) intregisterArrayType(ai.tegmentum.wasmtime4j.gc.ArrayType arrayType) intregisterStructType(ai.tegmentum.wasmtime4j.gc.StructType structType) booleanreleaseObject(long objectId) voidsetArrayElement(ai.tegmentum.wasmtime4j.gc.ArrayInstance array, int elementIndex, ai.tegmentum.wasmtime4j.gc.GcValue value) voidsetStructField(ai.tegmentum.wasmtime4j.gc.StructInstance struct, int fieldIndex, ai.tegmentum.wasmtime4j.gc.GcValue value) booleanstructRefMatchesTy(long objectId, int heapTypeOrdinal) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.tegmentum.wasmtime4j.gc.GcRuntime
createArrayFixed, createArrayFixedAsync
-
Constructor Details
-
PanamaGcRuntime
Creates a new Panama GC runtime with the specified engine handle.- Parameters:
engineHandle- the native engine handle- Throws:
PanamaException- if runtime creation fails
-
-
Method Details
-
createStruct
public ai.tegmentum.wasmtime4j.gc.StructInstance createStruct(ai.tegmentum.wasmtime4j.gc.StructType structType, List<ai.tegmentum.wasmtime4j.gc.GcValue> fieldValues) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createStructin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
createStruct
public ai.tegmentum.wasmtime4j.gc.StructInstance createStruct(ai.tegmentum.wasmtime4j.gc.StructType structType) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createStructin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
createStructAsync
public ai.tegmentum.wasmtime4j.gc.StructInstance createStructAsync(ai.tegmentum.wasmtime4j.gc.StructType structType, List<ai.tegmentum.wasmtime4j.gc.GcValue> fieldValues) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createStructAsyncin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
createArray
public ai.tegmentum.wasmtime4j.gc.ArrayInstance createArray(ai.tegmentum.wasmtime4j.gc.ArrayType arrayType, List<ai.tegmentum.wasmtime4j.gc.GcValue> elements) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createArrayin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
createArray
public ai.tegmentum.wasmtime4j.gc.ArrayInstance createArray(ai.tegmentum.wasmtime4j.gc.ArrayType arrayType, int length) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createArrayin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
createArrayAsync
public ai.tegmentum.wasmtime4j.gc.ArrayInstance createArrayAsync(ai.tegmentum.wasmtime4j.gc.ArrayType arrayType, List<ai.tegmentum.wasmtime4j.gc.GcValue> elements) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createArrayAsyncin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
createI31
public ai.tegmentum.wasmtime4j.gc.I31Instance createI31(int value) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createI31in interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
createI31Unsigned
public ai.tegmentum.wasmtime4j.gc.I31Instance createI31Unsigned(int value) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createI31Unsignedin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
createI31Wrapping
public ai.tegmentum.wasmtime4j.gc.I31Instance createI31Wrapping(int value) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createI31Wrappingin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
createI31WrappingUnsigned
public ai.tegmentum.wasmtime4j.gc.I31Instance createI31WrappingUnsigned(int value) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
createI31WrappingUnsignedin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
getStructField
public ai.tegmentum.wasmtime4j.gc.GcValue getStructField(ai.tegmentum.wasmtime4j.gc.StructInstance struct, int fieldIndex) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
getStructFieldin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
setStructField
public void setStructField(ai.tegmentum.wasmtime4j.gc.StructInstance struct, int fieldIndex, ai.tegmentum.wasmtime4j.gc.GcValue value) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
setStructFieldin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
getArrayElement
public ai.tegmentum.wasmtime4j.gc.GcValue getArrayElement(ai.tegmentum.wasmtime4j.gc.ArrayInstance array, int elementIndex) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
getArrayElementin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
setArrayElement
public void setArrayElement(ai.tegmentum.wasmtime4j.gc.ArrayInstance array, int elementIndex, ai.tegmentum.wasmtime4j.gc.GcValue value) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
setArrayElementin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
getArrayLength
public int getArrayLength(ai.tegmentum.wasmtime4j.gc.ArrayInstance array) - Specified by:
getArrayLengthin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
refCast
public ai.tegmentum.wasmtime4j.gc.GcObject refCast(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.GcReferenceType targetType) - Specified by:
refCastin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
refTest
public boolean refTest(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.GcReferenceType targetType) - Specified by:
refTestin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
refEquals
public boolean refEquals(ai.tegmentum.wasmtime4j.gc.GcObject obj1, ai.tegmentum.wasmtime4j.gc.GcObject obj2) - Specified by:
refEqualsin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
isNull
public boolean isNull(ai.tegmentum.wasmtime4j.gc.GcObject object) - Specified by:
isNullin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
registerStructType
public int registerStructType(ai.tegmentum.wasmtime4j.gc.StructType structType) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
registerStructTypein interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
registerArrayType
public int registerArrayType(ai.tegmentum.wasmtime4j.gc.ArrayType arrayType) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
registerArrayTypein interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
releaseObject
public boolean releaseObject(long objectId) - Specified by:
releaseObjectin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
collectGarbage
public ai.tegmentum.wasmtime4j.gc.GcStats collectGarbage()- Specified by:
collectGarbagein interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
getGcStats
public ai.tegmentum.wasmtime4j.gc.GcStats getGcStats()- Specified by:
getGcStatsin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
dispose
public void dispose()Disposes this GC runtime and releases native resources.- Throws:
PanamaException- if disposal fails
-
refCastStruct
public ai.tegmentum.wasmtime4j.gc.StructInstance refCastStruct(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.StructType targetStructType) - Specified by:
refCastStructin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
refCastArray
public ai.tegmentum.wasmtime4j.gc.ArrayInstance refCastArray(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.ArrayType targetArrayType) - Specified by:
refCastArrayin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
refTestStruct
public boolean refTestStruct(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.StructType targetStructType) - Specified by:
refTestStructin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
refTestArray
public boolean refTestArray(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.ArrayType targetArrayType) - Specified by:
refTestArrayin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
getRuntimeType
public ai.tegmentum.wasmtime4j.gc.GcReferenceType getRuntimeType(ai.tegmentum.wasmtime4j.gc.GcObject object) - Specified by:
getRuntimeTypein interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
refCastNullable
public Optional<ai.tegmentum.wasmtime4j.gc.GcObject> refCastNullable(ai.tegmentum.wasmtime4j.gc.GcObject object, ai.tegmentum.wasmtime4j.gc.GcReferenceType targetType) - Specified by:
refCastNullablein interfaceai.tegmentum.wasmtime4j.gc.GcRuntime
-
copyArrayElements
public void copyArrayElements(ai.tegmentum.wasmtime4j.gc.ArrayInstance sourceArray, int sourceIndex, ai.tegmentum.wasmtime4j.gc.ArrayInstance destArray, int destIndex, int length) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
copyArrayElementsin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
fillArrayElements
public void fillArrayElements(ai.tegmentum.wasmtime4j.gc.ArrayInstance array, int startIndex, int length, ai.tegmentum.wasmtime4j.gc.GcValue value) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
fillArrayElementsin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
anyRefToRaw
public long anyRefToRaw(long objectId) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
anyRefToRawin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
anyRefFromRaw
public long anyRefFromRaw(long raw) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
anyRefFromRawin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
anyRefMatchesTy
public boolean anyRefMatchesTy(long objectId, int heapTypeOrdinal) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
anyRefMatchesTyin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
eqRefTy
public int eqRefTy(long objectId) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
eqRefTyin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
eqRefMatchesTy
public boolean eqRefMatchesTy(long objectId, int heapTypeOrdinal) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
eqRefMatchesTyin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
structRefMatchesTy
public boolean structRefMatchesTy(long objectId, int heapTypeOrdinal) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
structRefMatchesTyin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
arrayRefMatchesTy
public boolean arrayRefMatchesTy(long objectId, int heapTypeOrdinal) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
arrayRefMatchesTyin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
externRefConvertAny
public long externRefConvertAny(long objectId) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
externRefConvertAnyin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-
anyRefConvertExtern
public long anyRefConvertExtern(long externRefData) throws ai.tegmentum.wasmtime4j.gc.GcException - Specified by:
anyRefConvertExternin interfaceai.tegmentum.wasmtime4j.gc.GcRuntime- Throws:
ai.tegmentum.wasmtime4j.gc.GcException
-