This commit is contained in:
dcode 2019-03-16 11:24:13 +01:00
parent b8a08da7a5
commit 05a35f42f6
18 changed files with 15370 additions and 16933 deletions

View File

@ -585,11 +585,7 @@ export function compileCall(
let classReference = type.classReference;
if (!classReference) return module.createI32(0);
let classPrototype = classReference.prototype;
return module.createI32(
(<ClassPrototype>classPrototype).extends(compiler.program.arrayPrototype)
? 1
: 0
);
return module.createI32(classPrototype.extends(compiler.program.arrayPrototype) ? 1 : 0);
}
case BuiltinSymbols.isArrayLike: { // isArrayLike<T!>() / isArrayLike<T?>(value: T) -> bool
let type = evaluateConstantType(compiler, typeArguments, operands, reportNode);
@ -597,12 +593,7 @@ export function compileCall(
if (!type) return module.createUnreachable();
let classReference = type.classReference;
if (!classReference) return module.createI32(0);
return module.createI32(
classReference.lookupInSelf("length") && (
classReference.lookupOverload(OperatorKind.INDEXED_GET) ||
classReference.lookupOverload(OperatorKind.UNCHECKED_INDEXED_GET)
) ? 1 : 0
);
return module.createI32(classReference.isArrayLike ? 1 : 0);
}
case BuiltinSymbols.isFunction: { // isFunction<T!> / isFunction<T?>(value: T) -> bool
let type = evaluateConstantType(compiler, typeArguments, operands, reportNode);
@ -4153,17 +4144,17 @@ function compileTypedArrayGet(
WrapMode.NONE
));
if (getExpressionId(dynamicOffset) == ExpressionId.Const) {
constantOffset = getConstValueI32(dynamicOffset) * type.byteSize;
constantOffset = getConstValueI32(dynamicOffset);
dynamicOffset = 0;
} else if (getExpressionId(dynamicOffset) == ExpressionId.Binary) {
if (getBinaryOp(dynamicOffset) == BinaryOp.AddI32) {
let left = getBinaryLeft(dynamicOffset);
let right = getBinaryRight(dynamicOffset);
if (getExpressionId(left) == ExpressionId.Const) {
constantOffset = getConstValueI32(left) * type.byteSize;
constantOffset = getConstValueI32(left);
dynamicOffset = right;
} else if (getExpressionId(right) == ExpressionId.Const) {
constantOffset = getConstValueI32(right) * type.byteSize;
constantOffset = getConstValueI32(right);
dynamicOffset = left;
}
}
@ -4180,7 +4171,16 @@ function compileTypedArrayGet(
),
nativeSizeType, (<Field>dataStart).memoryOffset
);
var typeAlignLog2 = type.alignLog2;
constantOffset <<= typeAlignLog2;
if (dynamicOffset) {
if (typeAlignLog2) {
dynamicOffset = module.createBinary(BinaryOp.ShlI32,
dynamicOffset,
module.createI32(typeAlignLog2)
);
}
if (nativeSizeType == NativeType.I64) {
dataStartExpr = module.createBinary(BinaryOp.AddI64,
dataStartExpr,
@ -4242,12 +4242,14 @@ function compileTypedArraySet(
assert(dataEnd.kind == ElementKind.FIELD);
var constantOffset: i32 = 0;
var dynamicOffset = module.precomputeExpression(compiler.compileExpression(
elementExpression,
Type.i32,
ConversionKind.IMPLICIT,
WrapMode.NONE
));
var dynamicOffset = module.precomputeExpression(
compiler.compileExpression(
elementExpression,
Type.i32,
ConversionKind.IMPLICIT,
WrapMode.NONE
)
);
if (getExpressionId(dynamicOffset) == ExpressionId.Const) {
constantOffset = getConstValueI32(dynamicOffset);
dynamicOffset = 0;
@ -4276,7 +4278,16 @@ function compileTypedArraySet(
),
nativeSizeType, (<Field>dataStart).memoryOffset
);
var typeAlignLog2 = type.alignLog2;
constantOffset <<= typeAlignLog2;
if (dynamicOffset) {
if (typeAlignLog2) {
dynamicOffset = module.createBinary(BinaryOp.ShlI32,
dynamicOffset,
module.createI32(typeAlignLog2)
);
}
if (nativeSizeType == NativeType.I64) {
dataStartExpr = module.createBinary(BinaryOp.AddI64,
dataStartExpr,
@ -4292,13 +4303,47 @@ function compileTypedArraySet(
var valueExpr = compiler.compileExpression(
valueExpression,
type.is(TypeFlags.SIGNED) ? Type.i32 : Type.u32,
type.is(TypeFlags.INTEGER | TypeFlags.VALUE)
? type.is(TypeFlags.LONG)
? type.is(TypeFlags.SIGNED)
? Type.i64
: Type.u64
: type.is(TypeFlags.SIGNED)
? Type.i32
: Type.u32
: type,
ConversionKind.IMPLICIT,
WrapMode.NONE
);
// clamp
if (target.internalName == BuiltinSymbols.Uint8ClampedArray) {
let tempLocal = compiler.currentFlow.getAndFreeTempLocal(Type.i32, true);
// ~(value >> 31) & (((255 - value) >> 31) | value)
valueExpr = module.createBinary(BinaryOp.AndI32,
module.createBinary(BinaryOp.XorI32,
module.createBinary(BinaryOp.ShrI32,
module.createTeeLocal(tempLocal.index, valueExpr),
module.createI32(31)
),
module.createI32(-1)
),
module.createBinary(BinaryOp.OrI32,
module.createBinary(BinaryOp.ShrI32,
module.createBinary(BinaryOp.SubI32,
module.createI32(255),
module.createGetLocal(tempLocal.index, NativeType.I32)
),
module.createI32(31)
),
module.createGetLocal(tempLocal.index, NativeType.I32)
)
);
}
var nativeType = type.toNativeType();
// TODO: check offset, clamp
// TODO: check offset
if (contextualType == Type.void) {
compiler.currentType = Type.void;

View File

@ -2837,6 +2837,13 @@ export class ClassPrototype extends DeclaredElement {
return (<ClassDeclaration>this.declaration).implementsTypes;
}
/** Tests if this prototype is of a builtin array type (Array/TypedArray). */
get isBuiltinArray(): bool {
var arrayBufferViewInstance = this.program.arrayBufferViewInstance;
return arrayBufferViewInstance !== null
&& this.extends(arrayBufferViewInstance.prototype);
}
/** Tests if this prototype extends the specified. */
extends(basePtototype: ClassPrototype | null): bool {
var current: ClassPrototype | null = this;
@ -2919,6 +2926,27 @@ export class Class extends TypedElement {
return id;
}
/** Tests if this class is of a builtin array type (Array/TypedArray). */
get isBuiltinArray(): bool {
return this.prototype.isBuiltinArray;
}
/** Tests if this class is array-like. */
get isArrayLike(): bool {
if (this.isBuiltinArray) return true;
var lengthField = this.lookupInSelf("length");
return lengthField !== null && (
lengthField.kind == ElementKind.FIELD ||
(
lengthField.kind == ElementKind.PROPERTY &&
(<Property>lengthField).getterInstance !== null // TODO: resolve & check type?
)
) && (
this.lookupOverload(OperatorKind.INDEXED_GET) !== null ||
this.lookupOverload(OperatorKind.UNCHECKED_INDEXED_GET) !== null
);
}
/** Constructs a new class. */
constructor(
/** Name incl. type parameters, i.e. `Foo<i32>`. */

View File

@ -145,6 +145,11 @@ export class Type {
}
}
/** Gets this type's logarithmic alignment in memory. */
get alignLog2(): i32 {
return 31 - clz<i32>(this.byteSize);
}
/** Tests if this is a managed type that needs GC hooks. */
isManaged(program: Program): bool {
if (program.gcImplemented) {

View File

@ -219,9 +219,9 @@ export abstract class ArrayBufferView {
@unsafe
dataEnd: usize;
constructor(length: i32, alignLog2: i32) {
protected constructor(length: i32, alignLog2: i32) {
if (<u32>length > <u32>MAX_BYTELENGTH >>> alignLog2) throw new RangeError("Invalid length");
var buffer = new ArrayBuffer(length << alignLog2);
var buffer = new ArrayBuffer(length = length << alignLog2);
this.data = buffer;
this.dataStart = changetype<usize>(buffer);
this.dataEnd = changetype<usize>(buffer) + <usize>length;

View File

@ -84,7 +84,9 @@ export class Uint8Array extends ArrayBufferView {
super(length, alignof<u8>());
}
get length(): i32 { return this.byteLength; }
get length(): i32 {
return this.byteLength;
}
fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8Array {
return FILL<Uint8Array, u8>(this, value, start, end);
@ -209,7 +211,7 @@ export class Int16Array extends ArrayBufferView {
}
get length(): i32 {
return this.byteLength >>> 1;
return this.byteLength >>> alignof<i16>();
}
fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array {
@ -278,7 +280,7 @@ export class Uint16Array extends ArrayBufferView {
}
get length(): i32 {
return this.byteLength >>> 1;
return this.byteLength >>> alignof<u16>();
}
fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array {
@ -347,7 +349,7 @@ export class Int32Array extends ArrayBufferView {
}
get length(): i32 {
return this.byteLength >>> 2;
return this.byteLength >>> alignof<i32>();
}
fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array {
@ -416,7 +418,7 @@ export class Uint32Array extends ArrayBufferView {
}
get length(): i32 {
return this.byteLength >>> 2;
return this.byteLength >>> alignof<u32>();
}
fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array {
@ -485,7 +487,7 @@ export class Int64Array extends ArrayBufferView {
}
get length(): i32 {
return this.byteLength >>> 3;
return this.byteLength >>> alignof<i64>();
}
fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array {
@ -554,7 +556,7 @@ export class Uint64Array extends ArrayBufferView {
}
get length(): i32 {
return this.byteLength >>> 3;
return this.byteLength >>> alignof<u64>();
}
fill(value: u64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array {
@ -623,7 +625,7 @@ export class Float32Array extends ArrayBufferView {
}
get length(): i32 {
return this.byteLength >>> 2;
return this.byteLength >>> alignof<f32>();
}
fill(value: f32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array {
@ -692,7 +694,7 @@ export class Float64Array extends ArrayBufferView {
}
get length(): i32 {
return this.byteLength >>> 3;
return this.byteLength >>> alignof<f64>();
}
fill(value: f64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array {
@ -797,18 +799,18 @@ function SUBARRAY<TArray extends ArrayBufferView, T>(
begin: i32,
end: i32
): TArray {
var buffer = array.data;
var length = <i32>array.length;
if (begin < 0) begin = max(length + begin, 0);
else begin = min(begin, length);
if (end < 0) end = max(length + end, begin);
else end = max(min(end, length), begin);
var out = ALLOCATE(offsetof<TArray>());
store<usize>(out, buffer, offsetof<TArray>("buffer"));
store<usize>(out, array.dataStart + (<usize>begin << alignof<T>()) , offsetof<TArray>("dataStart"));
store<usize>(out, array.dataEnd + (<usize>(end - begin) << alignof<T>()), offsetof<TArray>("dataEnd"));
LINK(buffer, REGISTER<TArray>(out)); // register first, then link
return changetype<TArray>(out);
var out = REGISTER<TArray>(ALLOCATE(offsetof<TArray>()));
var data = array.data;
var dataStart = array.dataStart;
changetype<ArrayBufferView>(out).data = data; // links
changetype<ArrayBufferView>(out).dataStart = dataStart + (<usize>begin << alignof<T>());
changetype<ArrayBufferView>(out).dataEnd = dataStart + (<usize>end << alignof<T>());
return out;
}
// @ts-ignore: decorator

View File

@ -4,8 +4,9 @@
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\0b\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s")
(data (i32.const 40) "\01\00\00\001")
(data (i32.const 8) "\01\00\00\00\16\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s")
(data (i32.const 40) "\01")
(data (i32.const 48) "\01\00\00\00\06\00\00\00a\00b\00c")
(table $0 2 funcref)
(elem (i32.const 0) $builtins/test $start:builtins~anonymous|0)
(global $builtins/b (mut i32) (i32.const 0))
@ -42,8 +43,8 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 66
i32.const 16
i32.const 67
i32.const 19
call $~lib/env/abort
unreachable
@ -55,8 +56,8 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 67
i32.const 16
i32.const 68
i32.const 20
call $~lib/env/abort
unreachable
@ -68,8 +69,8 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 68
i32.const 16
i32.const 69
i32.const 20
call $~lib/env/abort
unreachable
@ -91,8 +92,8 @@
i64.ne
if
i32.const 0
i32.const 8
i32.const 84
i32.const 16
i32.const 85
i32.const 19
call $~lib/env/abort
unreachable
@ -104,8 +105,8 @@
i64.ne
if
i32.const 0
i32.const 8
i32.const 85
i32.const 16
i32.const 86
i32.const 20
call $~lib/env/abort
unreachable
@ -117,8 +118,8 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 86
i32.const 16
i32.const 87
i32.const 20
call $~lib/env/abort
unreachable

View File

@ -26,7 +26,8 @@ assert(isFloat(<f32>1));
assert(!isFloat(<i32>1));
assert(isReference(changetype<string>(null)));
assert(!isReference(changetype<usize>(null)));
assert(isString("1"));
assert(isString(""));
assert(isString("abc"));
assert(!isString(1));
assert(isArray(changetype<i32[]>(null)));
assert(isArrayLike(changetype<i32[]>(null)));

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
import "allocator/arena";
var arr: i32[] = [1, 2, 3];
assert(arr.length == 3);
assert(arr[0] == 1);
assert(arr[1] == 2);
assert(arr[2] == 3);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -193,9 +193,9 @@ assert(sub32.byteLength == 3 * sizeof<i32>());
assert(isInt32ArrayEqual(sub32, <i32[]>[0, 0, 0]));
assert(isInt32ArrayEqual(arr32, <i32[]>[1, 0, 0, 0, 2]));
import { MAX_BLENGTH } from "internal/arraybuffer";
import { MAX_BYTELENGTH } from "runtime";
const MAX_F64LENGTH = <u32>MAX_BLENGTH >> alignof<f64>();
const MAX_F64LENGTH = <u32>MAX_BYTELENGTH >> alignof<f64>();
new Float64Array(MAX_F64LENGTH); // 1GB
// new Float64Array(MAX_F64 + 1); // throws

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\t\00\00\00s\00w\00i\00t\00c\00h\00.\00t\00s")
(data (i32.const 8) "\01\00\00\00\12\00\00\00s\00w\00i\00t\00c\00h\00.\00t\00s")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(export "memory" (memory $0))
@ -68,7 +68,7 @@
call $switch/doSwitch
if
i32.const 0
i32.const 8
i32.const 16
i32.const 10
i32.const 0
call $~lib/env/abort
@ -80,7 +80,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 11
i32.const 0
call $~lib/env/abort
@ -92,7 +92,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 12
i32.const 0
call $~lib/env/abort
@ -104,7 +104,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 13
i32.const 0
call $~lib/env/abort
@ -114,7 +114,7 @@
call $switch/doSwitch
if
i32.const 0
i32.const 8
i32.const 16
i32.const 14
i32.const 0
call $~lib/env/abort
@ -124,7 +124,7 @@
call $switch/doSwitch
if
i32.const 0
i32.const 8
i32.const 16
i32.const 24
i32.const 0
call $~lib/env/abort
@ -136,7 +136,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 25
i32.const 0
call $~lib/env/abort
@ -148,7 +148,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 26
i32.const 0
call $~lib/env/abort
@ -160,7 +160,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 27
i32.const 0
call $~lib/env/abort
@ -170,7 +170,7 @@
call $switch/doSwitch
if
i32.const 0
i32.const 8
i32.const 16
i32.const 28
i32.const 0
call $~lib/env/abort
@ -180,7 +180,7 @@
call $switch/doSwitchDefaultOmitted
if
i32.const 0
i32.const 8
i32.const 16
i32.const 38
i32.const 0
call $~lib/env/abort
@ -192,7 +192,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 39
i32.const 0
call $~lib/env/abort
@ -204,7 +204,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 40
i32.const 0
call $~lib/env/abort
@ -216,7 +216,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 41
i32.const 0
call $~lib/env/abort
@ -226,7 +226,7 @@
call $switch/doSwitchDefaultOmitted
if
i32.const 0
i32.const 8
i32.const 16
i32.const 42
i32.const 0
call $~lib/env/abort

View File

@ -4,10 +4,10 @@
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\t\00\00\00s\00w\00i\00t\00c\00h\00.\00t\00s\00")
(data (i32.const 8) "\01\00\00\00\12\00\00\00s\00w\00i\00t\00c\00h\00.\00t\00s\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/memory/HEAP_BASE i32 (i32.const 32))
(global $~lib/memory/HEAP_BASE i32 (i32.const 36))
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
@ -176,7 +176,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 10
i32.const 0
call $~lib/env/abort
@ -189,7 +189,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 11
i32.const 0
call $~lib/env/abort
@ -202,7 +202,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 12
i32.const 0
call $~lib/env/abort
@ -215,7 +215,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 13
i32.const 0
call $~lib/env/abort
@ -228,7 +228,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 14
i32.const 0
call $~lib/env/abort
@ -241,7 +241,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 24
i32.const 0
call $~lib/env/abort
@ -254,7 +254,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 25
i32.const 0
call $~lib/env/abort
@ -267,7 +267,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 26
i32.const 0
call $~lib/env/abort
@ -280,7 +280,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 27
i32.const 0
call $~lib/env/abort
@ -293,7 +293,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 28
i32.const 0
call $~lib/env/abort
@ -306,7 +306,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 38
i32.const 0
call $~lib/env/abort
@ -319,7 +319,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 39
i32.const 0
call $~lib/env/abort
@ -332,7 +332,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 40
i32.const 0
call $~lib/env/abort
@ -345,7 +345,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 41
i32.const 0
call $~lib/env/abort
@ -358,7 +358,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 42
i32.const 0
call $~lib/env/abort
@ -371,7 +371,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 51
i32.const 0
call $~lib/env/abort
@ -384,7 +384,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 52
i32.const 0
call $~lib/env/abort
@ -397,7 +397,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 53
i32.const 0
call $~lib/env/abort
@ -410,7 +410,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 62
i32.const 0
call $~lib/env/abort
@ -423,7 +423,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 63
i32.const 0
call $~lib/env/abort
@ -436,7 +436,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 64
i32.const 0
call $~lib/env/abort
@ -449,7 +449,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 73
i32.const 0
call $~lib/env/abort
@ -462,7 +462,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 74
i32.const 0
call $~lib/env/abort
@ -475,7 +475,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 75
i32.const 0
call $~lib/env/abort
@ -488,7 +488,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 84
i32.const 0
call $~lib/env/abort
@ -501,7 +501,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 85
i32.const 0
call $~lib/env/abort
@ -514,7 +514,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 86
i32.const 0
call $~lib/env/abort
@ -527,7 +527,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 92
i32.const 0
call $~lib/env/abort
@ -540,7 +540,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 93
i32.const 0
call $~lib/env/abort
@ -553,7 +553,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 94
i32.const 0
call $~lib/env/abort

View File

@ -3,7 +3,7 @@
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\08\00\00\00w\00h\00i\00l\00e\00.\00t\00s")
(data (i32.const 8) "\01\00\00\00\10\00\00\00w\00h\00i\00l\00e\00.\00t\00s")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $while/n (mut i32) (i32.const 10))
@ -31,7 +31,7 @@
global.get $while/n
if
i32.const 0
i32.const 8
i32.const 16
i32.const 8
i32.const 0
call $~lib/env/abort
@ -42,7 +42,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 9
i32.const 0
call $~lib/env/abort
@ -80,7 +80,7 @@
global.get $while/n
if
i32.const 0
i32.const 8
i32.const 16
i32.const 21
i32.const 2
call $~lib/env/abort
@ -91,7 +91,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 22
i32.const 2
call $~lib/env/abort
@ -103,7 +103,7 @@
global.get $while/n
if
i32.const 0
i32.const 8
i32.const 16
i32.const 24
i32.const 0
call $~lib/env/abort
@ -114,7 +114,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 25
i32.const 0
call $~lib/env/abort
@ -125,7 +125,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 26
i32.const 0
call $~lib/env/abort
@ -158,7 +158,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 31
i32.const 0
call $~lib/env/abort
@ -169,7 +169,7 @@
i32.ne
if
i32.const 0
i32.const 8
i32.const 16
i32.const 32
i32.const 0
call $~lib/env/abort

View File

@ -3,13 +3,13 @@
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\08\00\00\00w\00h\00i\00l\00e\00.\00t\00s\00")
(data (i32.const 8) "\01\00\00\00\10\00\00\00w\00h\00i\00l\00e\00.\00t\00s\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $while/n (mut i32) (i32.const 10))
(global $while/m (mut i32) (i32.const 0))
(global $while/o (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 28))
(global $~lib/memory/HEAP_BASE i32 (i32.const 32))
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
@ -39,7 +39,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 8
i32.const 0
call $~lib/env/abort
@ -51,7 +51,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 9
i32.const 0
call $~lib/env/abort
@ -98,7 +98,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 21
i32.const 2
call $~lib/env/abort
@ -110,7 +110,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 22
i32.const 2
call $~lib/env/abort
@ -127,7 +127,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 24
i32.const 0
call $~lib/env/abort
@ -139,7 +139,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 25
i32.const 0
call $~lib/env/abort
@ -151,7 +151,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 26
i32.const 0
call $~lib/env/abort
@ -193,7 +193,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 31
i32.const 0
call $~lib/env/abort
@ -205,7 +205,7 @@
i32.eqz
if
i32.const 0
i32.const 8
i32.const 16
i32.const 32
i32.const 0
call $~lib/env/abort