[][src]Module fluence_sdk_main::memory

Raw API for dealing with Wasm memory.

This module contains functions for memory initializing and manipulating.

Modules

errors

Contains definitions for memory errors.

Constants

RESULT_SIZE_BYTES

Count of bytes that length of resulted array occupies.

Functions

alloc

Allocates memory area of specified size and returns its address. Actually is just a wrapper for GlobalAlloc::alloc.

dealloc

Deallocates memory area for current memory pointer and size. Actually is just a wrapper for GlobalAlloc::dealloc.

read_input_from_mem

Reads array of bytes from a given ptr that has to have len bytes size.

read_len

Reads u32 (assuming that it is given in little endianness order) from a specified pointer.

write_result_to_mem

Allocates 'RESULT_SIZE_BYTES + result.len()' bytes and writes length of the result as little endianes RESULT_SIZE_BYTES bytes and then writes content of 'result'. So the final layout of the result in memory is following: | array_length: RESULT_SIZE_BYTES bytes (little-endian) | array: $array_length bytes | This function should normally be used for returning result of invoke function. Vm wrapper expects result in this format.

Type Definitions

MemResult

Result type for this module.