Interface Memory
interface Memory {
collection: Collection<unknown>;
config: Config<unknown>;
heap: Heap<Uint8Array>;
stack: Stack<unknown>;
allocate(size: number): number;
compare(address1: number, address2: number): boolean;
copy(source: number, destination: number): void;
free(address: number): void;
move(source: number, destination: number): void;
peek(): undefined | StackFrame<unknown>;
pop(): undefined | StackFrame<unknown>;
push(value: StackFrame<unknown>): void;
read(address: number): undefined | Uint8Array;
search(value: Uint8Array): number;
write(address: number, value: Uint8Array): void;
}
collection: Collection<unknown>;
config: Config<unknown>;
heap: Heap<Uint8Array>;
stack: Stack<unknown>;
allocate(size: number): number;
compare(address1: number, address2: number): boolean;
copy(source: number, destination: number): void;
free(address: number): void;
move(source: number, destination: number): void;
peek(): undefined | StackFrame<unknown>;
pop(): undefined | StackFrame<unknown>;
push(value: StackFrame<unknown>): void;
read(address: number): undefined | Uint8Array;
search(value: Uint8Array): number;
write(address: number, value: Uint8Array): void;
}
Properties
Readonly
collection
Collection storage
Readonly
config
Configuration storage
Readonly
heap
Heap storage
Readonly
stack
Stack storage
Methods
allocate
compare
copy
free
move
peek
- peek(): undefined | StackFrame<unknown>
Peek at the top value on the stack
Returns undefined | StackFrame<unknown>
pop
- pop(): undefined | StackFrame<unknown>
Pop a value from the stack
Returns undefined | StackFrame<unknown>
push
- push(value: StackFrame<unknown>): void
Push a value onto the stack
Parameters
- value: StackFrame<unknown>
Value to push
Returns void
- value: StackFrame<unknown>
read
- read(address: number): undefined | Uint8Array
Read memory from the heap
Parameters
- address: number
Address to read from
Returns undefined | Uint8Array
- address: number
search
- search(value: Uint8Array): number
Search for a pattern in memory
Parameters
- value: Uint8Array
Pattern to search for
Returns number
- value: Uint8Array
write
- write(address: number, value: Uint8Array): void
Write memory to the heap
Parameters
- address: number
Address to write to
- value: Uint8Array
Data to write
Returns void
- address: number
Interface for memory management functionality