Package com.dylibso.chicory.runtime
Class ByteBufferMemory
java.lang.Object
com.dylibso.chicory.runtime.ByteBufferMemory
- All Implemented Interfaces:
Memory
Represents the linear memory in the Wasm program. Can be shared
reference b/w the host and the guest.
This is the preferred memory implementation on Android systems.
-
Field Summary
Fields inherited from interface com.dylibso.chicory.runtime.Memory
PAGE_SIZE, RUNTIME_MAX_PAGES -
Constructor Summary
ConstructorsConstructorDescriptionByteBufferMemory(MemoryLimits limits) ByteBufferMemory(MemoryLimits limits, MemAllocStrategy allocStrategy) -
Method Summary
Modifier and TypeMethodDescriptionvoiddrop(int segment) voidfill(byte value, int fromIndex, int toIndex) intgrow(int size) voidinitialize(Instance instance, DataSegment[] dataSegments) intvoidinitPassiveSegment(int segmentId, int dest, int offset, int size) intintpages()Gets the size of the memory in number of pagesbyteread(int addr) byte[]readBytes(int addr, int len) doublereadDouble(int addr) longreadF32(int addr) longreadF64(int addr) floatreadFloat(int addr) intreadInt(int addr) longreadLong(int addr) shortreadShort(int addr) longreadU16(int addr) voidwrite(int addr, byte[] data, int offset, int size) voidwriteByte(int addr, byte data) voidwriteF32(int addr, float data) voidwriteF64(int addr, double data) voidwriteI32(int addr, int data) voidwriteLong(int addr, long data) voidwriteShort(int addr, short data) voidzero()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.dylibso.chicory.runtime.Memory
copy, readCString, readCString, readI16, readI32, readI64, readI8, readString, readString, readU32, readU8, write, writeCString, writeCString, writeString, writeString
-
Constructor Details
-
ByteBufferMemory
-
ByteBufferMemory
-
-
Method Details
-
pages
public int pages()Gets the size of the memory in number of pages -
grow
public int grow(int size) -
initialPages
public int initialPages()- Specified by:
initialPagesin interfaceMemory
-
maximumPages
public int maximumPages()- Specified by:
maximumPagesin interfaceMemory
-
initialize
- Specified by:
initializein interfaceMemory
-
initPassiveSegment
public void initPassiveSegment(int segmentId, int dest, int offset, int size) - Specified by:
initPassiveSegmentin interfaceMemory
-
write
public void write(int addr, byte[] data, int offset, int size) -
read
public byte read(int addr) -
readBytes
public byte[] readBytes(int addr, int len) -
writeI32
public void writeI32(int addr, int data) -
readInt
public int readInt(int addr) -
writeLong
public void writeLong(int addr, long data) -
readLong
public long readLong(int addr) -
writeShort
public void writeShort(int addr, short data) - Specified by:
writeShortin interfaceMemory
-
readShort
public short readShort(int addr) -
readU16
public long readU16(int addr) -
writeByte
public void writeByte(int addr, byte data) -
writeF32
public void writeF32(int addr, float data) -
readF32
public long readF32(int addr) -
readFloat
public float readFloat(int addr) -
writeF64
public void writeF64(int addr, double data) -
readDouble
public double readDouble(int addr) - Specified by:
readDoublein interfaceMemory
-
readF64
public long readF64(int addr) -
zero
public void zero() -
fill
public void fill(byte value, int fromIndex, int toIndex) -
drop
public void drop(int segment)
-