mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-18 01:11:32 +00:00
Rename wast to wat
This commit is contained in:
@ -10,6 +10,7 @@ const ALIGN_MASK: usize = ALIGN_SIZE - 1;
|
||||
|
||||
var HEAP_OFFSET: usize = HEAP_BASE;
|
||||
|
||||
@global
|
||||
export function allocate_memory(size: usize): usize {
|
||||
if (!size) return 0;
|
||||
var ptr = HEAP_OFFSET;
|
||||
@ -25,10 +26,12 @@ export function allocate_memory(size: usize): usize {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@global
|
||||
export function free_memory(ptr: usize): void {
|
||||
// nop
|
||||
}
|
||||
|
||||
@global
|
||||
export function reset_memory(): void {
|
||||
HEAP_OFFSET = HEAP_BASE;
|
||||
}
|
||||
|
@ -7,12 +7,15 @@
|
||||
declare function _malloc(size: usize): usize;
|
||||
declare function _free(ptr: usize): void;
|
||||
|
||||
@global
|
||||
export function allocate_memory(size: usize): usize {
|
||||
return _malloc(size);
|
||||
}
|
||||
|
||||
@global
|
||||
export function free_memory(ptr: usize): void {
|
||||
_free(ptr);
|
||||
}
|
||||
|
||||
@global
|
||||
export { reset_memory } from "./none";
|
||||
|
@ -6,12 +6,15 @@
|
||||
declare function malloc(size: usize): usize;
|
||||
declare function free(ptr: usize): void;
|
||||
|
||||
@global
|
||||
export function allocate_memory(size: usize): usize {
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
@global
|
||||
export function free_memory(ptr: usize): void {
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
@global
|
||||
export { reset_memory } from "./none";
|
||||
|
@ -431,6 +431,7 @@ var ROOT: Root = changetype<Root>(0);
|
||||
// External interface
|
||||
|
||||
/** Allocates a chunk of memory. */
|
||||
@global
|
||||
export function allocate_memory(size: usize): usize {
|
||||
|
||||
// initialize if necessary
|
||||
@ -474,6 +475,7 @@ export function allocate_memory(size: usize): usize {
|
||||
}
|
||||
|
||||
/** Frees the chunk of memory at the specified address. */
|
||||
@global
|
||||
export function free_memory(data: usize): void {
|
||||
if (data) {
|
||||
var root = ROOT;
|
||||
|
Reference in New Issue
Block a user