Class PanamaInstancePre
java.lang.Object
ai.tegmentum.wasmtime4j.panama.PanamaInstancePre
- All Implemented Interfaces:
ai.tegmentum.wasmtime4j.InstancePre,Closeable,AutoCloseable
Panama FFI implementation of
InstancePre.
This class wraps a native pre-instantiated module handle and provides fast instantiation capabilities. Pre-instantiation performs expensive setup work once, allowing subsequent instance creation to be significantly faster.
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionPanamaInstancePre(MemorySegment nativeInstancePre, ai.tegmentum.wasmtime4j.Module module, ai.tegmentum.wasmtime4j.Engine engine) Creates a new PanamaInstancePre with the given native handle. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()ai.tegmentum.wasmtime4j.Enginelongai.tegmentum.wasmtime4j.ModuleReturns the native InstancePre memory segment.ai.tegmentum.wasmtime4j.validation.PreInstantiationStatisticsai.tegmentum.wasmtime4j.Instanceinstantiate(ai.tegmentum.wasmtime4j.Store store) ai.tegmentum.wasmtime4j.Instanceinstantiate(ai.tegmentum.wasmtime4j.Store store, ai.tegmentum.wasmtime4j.validation.ImportMap imports) CompletableFuture<ai.tegmentum.wasmtime4j.Instance> instantiateAsync(ai.tegmentum.wasmtime4j.Store store) booleanisValid()toString()
-
Constructor Details
-
PanamaInstancePre
public PanamaInstancePre(MemorySegment nativeInstancePre, ai.tegmentum.wasmtime4j.Module module, ai.tegmentum.wasmtime4j.Engine engine) Creates a new PanamaInstancePre with the given native handle.- Parameters:
nativeInstancePre- the native InstancePre memory segmentmodule- the module that was pre-instantiatedengine- the engine used for pre-instantiation- Throws:
IllegalArgumentException- if nativeInstancePre is null or module/engine is null
-
-
Method Details
-
instantiate
public ai.tegmentum.wasmtime4j.Instance instantiate(ai.tegmentum.wasmtime4j.Store store) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
instantiatein interfaceai.tegmentum.wasmtime4j.InstancePre- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
instantiate
public ai.tegmentum.wasmtime4j.Instance instantiate(ai.tegmentum.wasmtime4j.Store store, ai.tegmentum.wasmtime4j.validation.ImportMap imports) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
instantiatein interfaceai.tegmentum.wasmtime4j.InstancePre- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
instantiateAsync
public CompletableFuture<ai.tegmentum.wasmtime4j.Instance> instantiateAsync(ai.tegmentum.wasmtime4j.Store store) - Specified by:
instantiateAsyncin interfaceai.tegmentum.wasmtime4j.InstancePre
-
getModule
public ai.tegmentum.wasmtime4j.Module getModule()- Specified by:
getModulein interfaceai.tegmentum.wasmtime4j.InstancePre
-
getEngine
public ai.tegmentum.wasmtime4j.Engine getEngine()- Specified by:
getEnginein interfaceai.tegmentum.wasmtime4j.InstancePre
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceai.tegmentum.wasmtime4j.InstancePre
-
getInstanceCount
public long getInstanceCount()- Specified by:
getInstanceCountin interfaceai.tegmentum.wasmtime4j.InstancePre
-
getStatistics
public ai.tegmentum.wasmtime4j.validation.PreInstantiationStatistics getStatistics()- Specified by:
getStatisticsin interfaceai.tegmentum.wasmtime4j.InstancePre
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceai.tegmentum.wasmtime4j.InstancePre
-
getNativeInstancePre
Returns the native InstancePre memory segment.- Returns:
- the native memory segment
-
toString
-