View Source Orb.Memory (Orb v0.0.25)

Work with memory.

Summary

Functions

Increases the size of the memory instance by a specified number of pages. Each page is 64KiB.

Initializes data in memory. In Wat is (data …)

Initializes data in memory from a packed Map. In Wat is (data …)

Load value of type from memory address.

Declare how many 64Kib pages of memory your module needs.

Returns the number of pages the memory instance currently has. Each page is 64KiB.

Store value of type at memory address.

Functions

Increases the size of the memory instance by a specified number of pages. Each page is 64KiB.

Note: only 0 and 1 are supported in today’s runtimes.

It returns the previous size of memory in pages if the operation was successful, or returns -1 if the operation failed.

https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Memory/Grow

Memory.grow!(1)

Initializes data in memory. In Wat is (data …)

Link to this function

initial_data_prepacked(packed_map)

View Source

Initializes data in memory from a packed Map. In Wat is (data …)

Load value of type from memory address.

Memory.load!(I32, 0x100)
Memory.load!(I32.U8, 0x100)
Link to this macro

pages(page_count)

View Source (macro)

Declare how many 64Kib pages of memory your module needs.

Can be called multiple times, with each summed up.

Returns the previous page count, which can be used as a start offset.

Returns the number of pages the memory instance currently has. Each page is 64KiB.

To increase the number of pages call grow!/1.

https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Memory/Size

Memory.size()
Link to this function

store!(type, address, value)

View Source

Store value of type at memory address.

Memory.store!(I32, 0x100, 42)
Memory.store!(I32.U8, 0x100, ?a)