Add a 'call_indirect' builtin to emit arbitrary calls (might trap at runtime); Optimize 'for' loop compilation a bit

This commit is contained in:
dcodeIO
2018-05-25 15:59:17 +02:00
parent 51ede113dd
commit 7ad13f9d65
47 changed files with 3311 additions and 22111 deletions

2
std/assembly.d.ts vendored
View File

@ -267,6 +267,8 @@ declare function offsetof<T>(fieldName?: string): usize;
declare function changetype<T>(value: any): T;
/** Explicitly requests no bounds checks on the provided expression. Useful for array accesses. */
declare function unchecked<T>(value: T): T;
/** Creates a `call_indirect` instruction, calling the specified target by index with the specified arguments. */
declare function call_indirect<T>(target: Function | u32, ...args: any[]): T;
/** Tests if a 32-bit or 64-bit float is `NaN`. */
declare function isNaN<T = f32 | f64>(value: T): bool;
/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */

View File

@ -80,6 +80,8 @@ export declare function assert<T>(isTrueish: T, message?: string): T;
export declare function unchecked<T>(expr: T): T;
export declare function call_indirect<T>(target: void, ...args: void[]): T;
export declare function i8(value: void): i8;
export namespace i8 {
export const MIN_VALUE: i8 = -128;