Class PanamaMemory

java.lang.Object
ai.tegmentum.wasmtime4j.panama.PanamaMemory
All Implemented Interfaces:
ai.tegmentum.wasmtime4j.WasmMemory

public final class PanamaMemory extends Object implements ai.tegmentum.wasmtime4j.WasmMemory
Panama FFI implementation of WebAssembly Memory.
Since:
1.0.0
  • Method Details

    • dataPtr

      public long dataPtr()
      Specified by:
      dataPtr in interface ai.tegmentum.wasmtime4j.WasmMemory
    • pageSizeLog2

      public int pageSizeLog2()
      Specified by:
      pageSizeLog2 in interface ai.tegmentum.wasmtime4j.WasmMemory
    • pageSize

      public int pageSize()
      Specified by:
      pageSize in interface ai.tegmentum.wasmtime4j.WasmMemory
    • dataSize

      public long dataSize()
      Specified by:
      dataSize in interface ai.tegmentum.wasmtime4j.WasmMemory
    • getSize

      public int getSize()
      Specified by:
      getSize in interface ai.tegmentum.wasmtime4j.WasmMemory
    • grow

      public int grow(int pages)
      Specified by:
      grow in interface ai.tegmentum.wasmtime4j.WasmMemory
    • getMaxSize

      public int getMaxSize()
      Specified by:
      getMaxSize in interface ai.tegmentum.wasmtime4j.WasmMemory
    • getBuffer

      public ByteBuffer getBuffer()
      Specified by:
      getBuffer in interface ai.tegmentum.wasmtime4j.WasmMemory
    • readByte

      public byte readByte(int offset)
      Specified by:
      readByte in interface ai.tegmentum.wasmtime4j.WasmMemory
    • writeByte

      public void writeByte(int offset, byte value)
      Specified by:
      writeByte in interface ai.tegmentum.wasmtime4j.WasmMemory
    • readBytes

      public void readBytes(int offset, byte[] dest, int destOffset, int length)
      Specified by:
      readBytes in interface ai.tegmentum.wasmtime4j.WasmMemory
    • writeBytes

      public void writeBytes(int offset, byte[] src, int srcOffset, int length)
      Specified by:
      writeBytes in interface ai.tegmentum.wasmtime4j.WasmMemory
    • copy

      public void copy(int destOffset, int srcOffset, int length)
      Specified by:
      copy in interface ai.tegmentum.wasmtime4j.WasmMemory
    • fill

      public void fill(int offset, byte value, int length)
      Specified by:
      fill in interface ai.tegmentum.wasmtime4j.WasmMemory
    • init

      public void init(int destOffset, int dataSegmentIndex, int srcOffset, int length)
      Specified by:
      init in interface ai.tegmentum.wasmtime4j.WasmMemory
    • dropDataSegment

      public void dropDataSegment(int dataSegmentIndex)
      Specified by:
      dropDataSegment in interface ai.tegmentum.wasmtime4j.WasmMemory
    • isShared

      public boolean isShared()
      Specified by:
      isShared in interface ai.tegmentum.wasmtime4j.WasmMemory
    • getMemoryType

      public ai.tegmentum.wasmtime4j.type.MemoryType getMemoryType()
      Specified by:
      getMemoryType in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicCompareAndSwapInt

      public int atomicCompareAndSwapInt(int offset, int expected, int newValue)
      Specified by:
      atomicCompareAndSwapInt in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicCompareAndSwapLong

      public long atomicCompareAndSwapLong(int offset, long expected, long newValue)
      Specified by:
      atomicCompareAndSwapLong in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicLoadInt

      public int atomicLoadInt(int offset)
      Specified by:
      atomicLoadInt in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicLoadLong

      public long atomicLoadLong(int offset)
      Specified by:
      atomicLoadLong in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicStoreInt

      public void atomicStoreInt(int offset, int value)
      Specified by:
      atomicStoreInt in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicStoreLong

      public void atomicStoreLong(int offset, long value)
      Specified by:
      atomicStoreLong in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicAddInt

      public int atomicAddInt(int offset, int value)
      Specified by:
      atomicAddInt in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicAddLong

      public long atomicAddLong(int offset, long value)
      Specified by:
      atomicAddLong in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicAndInt

      public int atomicAndInt(int offset, int value)
      Specified by:
      atomicAndInt in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicOrInt

      public int atomicOrInt(int offset, int value)
      Specified by:
      atomicOrInt in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicXorInt

      public int atomicXorInt(int offset, int value)
      Specified by:
      atomicXorInt in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicAndLong

      public long atomicAndLong(int offset, long value)
      Specified by:
      atomicAndLong in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicOrLong

      public long atomicOrLong(int offset, long value)
      Specified by:
      atomicOrLong in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicXorLong

      public long atomicXorLong(int offset, long value)
      Specified by:
      atomicXorLong in interface ai.tegmentum.wasmtime4j.WasmMemory
    • readBytes64

      public void readBytes64(long offset, byte[] dest, int destOffset, int length)
      Specified by:
      readBytes64 in interface ai.tegmentum.wasmtime4j.WasmMemory
    • writeBytes64

      public void writeBytes64(long offset, byte[] src, int srcOffset, int length)
      Specified by:
      writeBytes64 in interface ai.tegmentum.wasmtime4j.WasmMemory
    • getSize64

      public long getSize64()
      Specified by:
      getSize64 in interface ai.tegmentum.wasmtime4j.WasmMemory
    • grow64

      public long grow64(long pages)
      Specified by:
      grow64 in interface ai.tegmentum.wasmtime4j.WasmMemory
    • supports64BitAddressing

      public boolean supports64BitAddressing()
      Specified by:
      supports64BitAddressing in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicFence

      public void atomicFence()
      Specified by:
      atomicFence in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicNotify

      public int atomicNotify(int offset, int count)
      Specified by:
      atomicNotify in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicWait32

      public ai.tegmentum.wasmtime4j.WaitResult atomicWait32(int offset, int expected, long timeoutNanos)
      Specified by:
      atomicWait32 in interface ai.tegmentum.wasmtime4j.WasmMemory
    • atomicWait64

      public ai.tegmentum.wasmtime4j.WaitResult atomicWait64(int offset, long expected, long timeoutNanos)
      Specified by:
      atomicWait64 in interface ai.tegmentum.wasmtime4j.WasmMemory
    • growAsync

      public long growAsync(long pages) throws ai.tegmentum.wasmtime4j.exception.WasmException
      Specified by:
      growAsync in interface ai.tegmentum.wasmtime4j.WasmMemory
      Throws:
      ai.tegmentum.wasmtime4j.exception.WasmException
    • close

      public void close()
      Closes the memory and releases resources.
    • getNativeMemory

      public MemorySegment getNativeMemory()
      Gets the native memory pointer.

      For instance-exported memories, this method looks up the memory pointer by name. For store-created memories, it returns the stored native pointer.

      Returns:
      native memory segment, or NULL if the memory pointer cannot be obtained