Rename wast to wat

This commit is contained in:
dcodeIO
2018-02-17 11:09:22 +01:00
parent 6b459259f9
commit e50a23bf75
123 changed files with 8534 additions and 176 deletions

View File

@ -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;
}

View File

@ -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";

View File

@ -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";

View File

@ -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;

4
std/portable.d.ts vendored
View File

@ -179,9 +179,9 @@ declare class String {
static fromCodePoints(arr: i32[]): string;
readonly length: i32;
private constructor();
indexOf(subject: string): i32;
indexOf(subject: string, position?: i32): i32;
includes(other: string): bool;
lastIndexOf(subject: string): i32;
lastIndexOf(subject: string, position?: i32): i32;
charAt(index: i32): string;
charCodeAt(index: i32): i32;
substring(from: i32, to?: i32): string;