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

View File

@ -2837,6 +2837,13 @@ export class ClassPrototype extends DeclaredElement {
return (<ClassDeclaration>this.declaration).implementsTypes; 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. */ /** Tests if this prototype extends the specified. */
extends(basePtototype: ClassPrototype | null): bool { extends(basePtototype: ClassPrototype | null): bool {
var current: ClassPrototype | null = this; var current: ClassPrototype | null = this;
@ -2919,6 +2926,27 @@ export class Class extends TypedElement {
return id; 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. */ /** Constructs a new class. */
constructor( constructor(
/** Name incl. type parameters, i.e. `Foo<i32>`. */ /** 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. */ /** Tests if this is a managed type that needs GC hooks. */
isManaged(program: Program): bool { isManaged(program: Program): bool {
if (program.gcImplemented) { if (program.gcImplemented) {

View File

@ -219,9 +219,9 @@ export abstract class ArrayBufferView {
@unsafe @unsafe
dataEnd: usize; 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"); 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.data = buffer;
this.dataStart = changetype<usize>(buffer); this.dataStart = changetype<usize>(buffer);
this.dataEnd = changetype<usize>(buffer) + <usize>length; this.dataEnd = changetype<usize>(buffer) + <usize>length;

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
(module (module
(type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viii (func (param i32 i32 i32))) (type $FUNCSIG$viii (func (param i32 i32 i32)))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$vii (func (param i32 i32))) (type $FUNCSIG$vii (func (param i32 i32)))
@ -12,8 +12,8 @@
(memory $0 1) (memory $0 1)
(data (i32.const 8) "\01\00\00\00\06\00\00\001\002\003") (data (i32.const 8) "\01\00\00\00\06\00\00\001\002\003")
(data (i32.const 24) "\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s") (data (i32.const 24) "\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s")
(data (i32.const 64) "\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 64) "\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 112) "\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s") (data (i32.const 104) "\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s")
(data (i32.const 152) "\01") (data (i32.const 152) "\01")
(data (i32.const 160) "\01\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e") (data (i32.const 160) "\01\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e")
(data (i32.const 192) "\01\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e") (data (i32.const 192) "\01\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e")
@ -54,7 +54,7 @@
(export "memory" (memory $0)) (export "memory" (memory $0))
(export "table" (table $0)) (export "table" (table $0))
(start $start) (start $start)
(func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/memory/memory.allocate (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
@ -77,15 +77,15 @@
i32.add i32.add
i32.const -8 i32.const -8
i32.and i32.and
local.tee $2 local.tee $0
current_memory current_memory
local.tee $3 local.tee $2
i32.const 16 i32.const 16
i32.shl i32.shl
i32.gt_u i32.gt_u
if if
local.get $3
local.get $2 local.get $2
local.get $0
local.get $1 local.get $1
i32.sub i32.sub
i32.const 65535 i32.const 65535
@ -94,16 +94,16 @@
i32.and i32.and
i32.const 16 i32.const 16
i32.shr_u i32.shr_u
local.tee $0 local.tee $3
local.get $2
local.get $3 local.get $3
local.get $0
i32.gt_s i32.gt_s
select select
grow_memory grow_memory
i32.const 0 i32.const 0
i32.lt_s i32.lt_s
if if
local.get $0 local.get $3
grow_memory grow_memory
i32.const 0 i32.const 0
i32.lt_s i32.lt_s
@ -112,11 +112,11 @@
end end
end end
end end
local.get $2 local.get $0
global.set $~lib/allocator/arena/offset global.set $~lib/allocator/arena/offset
local.get $1 local.get $1
) )
(func $~lib/runtime/runtime.allocRaw (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/runtime/doAllocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
i32.const 1 i32.const 1
i32.const 32 i32.const 32
@ -126,7 +126,7 @@
i32.clz i32.clz
i32.sub i32.sub
i32.shl i32.shl
call $~lib/allocator/arena/__memory_allocate call $~lib/memory/memory.allocate
local.tee $1 local.tee $1
i32.const -1520547049 i32.const -1520547049
i32.store i32.store
@ -137,13 +137,49 @@
i32.const 8 i32.const 8
i32.add i32.add
) )
(func $~lib/util/memory/memset (; 3 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/runtime/assertUnregistered (; 3 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
i32.const 740
i32.le_u
if
i32.const 0
i32.const 72
i32.const 188
i32.const 2
call $~lib/env/abort
unreachable
end
local.get $0
i32.const 8
i32.sub
i32.load
i32.const -1520547049
i32.ne
if
i32.const 0
i32.const 72
i32.const 189
i32.const 2
call $~lib/env/abort
unreachable
end
)
(func $~lib/runtime/doRegister (; 4 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
call $~lib/runtime/assertUnregistered
local.get $0
i32.const 8
i32.sub
local.get $1
i32.store
local.get $0
)
(func $~lib/memory/memory.fill (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
block $~lib/util/memory/memset|inlined.0
local.get $1 local.get $1
i32.eqz i32.eqz
if br_if $~lib/util/memory/memset|inlined.0
return
end
local.get $0 local.get $0
i32.const 0 i32.const 0
i32.store8 i32.store8
@ -157,9 +193,7 @@
local.get $1 local.get $1
i32.const 2 i32.const 2
i32.le_u i32.le_u
if br_if $~lib/util/memory/memset|inlined.0
return
end
local.get $0 local.get $0
i32.const 1 i32.const 1
i32.add i32.add
@ -186,9 +220,7 @@
local.get $1 local.get $1
i32.const 6 i32.const 6
i32.le_u i32.le_u
if br_if $~lib/util/memory/memset|inlined.0
return
end
local.get $0 local.get $0
i32.const 3 i32.const 3
i32.add i32.add
@ -204,23 +236,23 @@
local.get $1 local.get $1
i32.const 8 i32.const 8
i32.le_u i32.le_u
if br_if $~lib/util/memory/memset|inlined.0
return local.get $1
end
i32.const 0 i32.const 0
local.get $0 local.get $0
i32.sub i32.sub
i32.const 3 i32.const 3
i32.and i32.and
local.tee $2 local.tee $2
i32.sub
local.set $1
local.get $0 local.get $0
local.get $2
i32.add i32.add
local.tee $0 local.tee $0
i32.const 0 i32.const 0
i32.store i32.store
local.get $1 local.get $1
local.get $2
i32.sub
i32.const -4 i32.const -4
i32.and i32.and
local.tee $1 local.tee $1
@ -233,9 +265,7 @@
local.get $1 local.get $1
i32.const 8 i32.const 8
i32.le_u i32.le_u
if br_if $~lib/util/memory/memset|inlined.0
return
end
local.get $0 local.get $0
i32.const 4 i32.const 4
i32.add i32.add
@ -262,9 +292,7 @@
local.get $1 local.get $1
i32.const 24 i32.const 24
i32.le_u i32.le_u
if br_if $~lib/util/memory/memset|inlined.0
return
end
local.get $0 local.get $0
i32.const 12 i32.const 12
i32.add i32.add
@ -355,62 +383,31 @@
br $continue|0 br $continue|0
end end
end end
)
(func $~lib/runtime/runtime.unref (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.const 748
i32.lt_u
if
i32.const 0
i32.const 120
i32.const 117
i32.const 4
call $~lib/env/abort
unreachable
end end
local.get $0
i32.const 8
i32.sub
local.tee $0
i32.load
i32.const -1520547049
i32.ne
if
i32.const 0
i32.const 120
i32.const 119
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
) )
(func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/arraybuffer/ArrayBuffer#constructor (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
local.get $0 local.get $0
i32.const 1073741816 i32.const 1073741816
i32.gt_u i32.gt_u
if if
i32.const 0 i32.const 0
i32.const 72 i32.const 112
i32.const 24 i32.const 24
i32.const 59 i32.const 43
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
end end
local.get $0 local.get $0
call $~lib/runtime/runtime.allocRaw call $~lib/runtime/doAllocate
local.tee $1 local.tee $1
local.get $0 local.get $0
call $~lib/util/memory/memset call $~lib/memory/memory.fill
local.get $1 local.get $1
local.tee $0 i32.const 3
call $~lib/runtime/runtime.unref call $~lib/runtime/doRegister
i32.const 2
i32.store
local.get $0
) )
(func $~lib/map/Map<String,usize>#clear (; 6 ;) (type $FUNCSIG$vi) (param $0 i32) (func $~lib/map/Map<String,usize>#clear (; 7 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0 local.get $0
i32.const 16 i32.const 16
call $~lib/arraybuffer/ArrayBuffer#constructor call $~lib/arraybuffer/ArrayBuffer#constructor
@ -432,10 +429,12 @@
i32.const 0 i32.const 0
i32.store offset=20 i32.store offset=20
) )
(func $~lib/map/Map<String,usize>#constructor (; 7 ;) (type $FUNCSIG$i) (result i32) (func $~lib/map/Map<String,usize>#constructor (; 8 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32) (local $0 i32)
i32.const 24 i32.const 24
call $~lib/allocator/arena/__memory_allocate call $~lib/runtime/doAllocate
i32.const 2
call $~lib/runtime/doRegister
local.tee $0 local.tee $0
i32.const 0 i32.const 0
i32.store i32.store
@ -458,7 +457,35 @@
call $~lib/map/Map<String,usize>#clear call $~lib/map/Map<String,usize>#clear
local.get $0 local.get $0
) )
(func $~lib/util/hash/hashStr (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<usize,String>#constructor (; 9 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 24
call $~lib/runtime/doAllocate
i32.const 4
call $~lib/runtime/doRegister
local.tee $0
i32.const 0
i32.store
local.get $0
i32.const 0
i32.store offset=4
local.get $0
i32.const 0
i32.store offset=8
local.get $0
i32.const 0
i32.store offset=12
local.get $0
i32.const 0
i32.store offset=16
local.get $0
i32.const 0
i32.store offset=20
local.get $0
call $~lib/map/Map<String,usize>#clear
local.get $0
)
(func $~lib/util/hash/hashStr (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
@ -496,7 +523,7 @@
end end
local.get $1 local.get $1
) )
(func $~lib/util/string/compareImpl (; 9 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (func $~lib/util/string/compareImpl (; 11 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32) (local $3 i32)
loop $continue|0 loop $continue|0
local.get $2 local.get $2
@ -529,7 +556,7 @@
end end
local.get $3 local.get $3
) )
(func $~lib/string/String.eq (; 10 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/string/String.eq (; 12 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32) (local $2 i32)
local.get $0 local.get $0
local.get $1 local.get $1
@ -575,7 +602,7 @@
call $~lib/util/string/compareImpl call $~lib/util/string/compareImpl
i32.eqz i32.eqz
) )
(func $~lib/map/Map<String,usize>#find (; 11 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/map/Map<String,usize>#find (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0 local.get $0
i32.load i32.load
local.get $0 local.get $0
@ -618,7 +645,7 @@
end end
i32.const 0 i32.const 0
) )
(func $~lib/map/Map<String,usize>#rehash (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<String,usize>#rehash (; 14 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@ -719,7 +746,7 @@
i32.load offset=20 i32.load offset=20
i32.store offset=16 i32.store offset=16
) )
(func $~lib/map/Map<String,usize>#set (; 13 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<String,usize>#set (; 15 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@ -808,7 +835,7 @@
i32.store i32.store
end end
) )
(func $~lib/util/hash/hash32 (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/util/hash/hash32 (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
i32.const 255 i32.const 255
i32.and i32.and
@ -839,7 +866,7 @@
i32.const 16777619 i32.const 16777619
i32.mul i32.mul
) )
(func $~lib/map/Map<usize,String>#find (; 15 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (func $~lib/map/Map<usize,String>#find (; 17 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
local.get $0 local.get $0
i32.load i32.load
local.get $0 local.get $0
@ -882,7 +909,7 @@
end end
i32.const 0 i32.const 0
) )
(func $~lib/map/Map<usize,String>#rehash (; 16 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<usize,String>#rehash (; 18 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@ -983,7 +1010,7 @@
i32.load offset=20 i32.load offset=20
i32.store offset=16 i32.store offset=16
) )
(func $~lib/map/Map<usize,String>#set (; 17 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<usize,String>#set (; 19 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@ -1073,7 +1100,7 @@
i32.store i32.store
end end
) )
(func $~lib/symbol/_Symbol.for (; 18 ;) (type $FUNCSIG$i) (result i32) (func $~lib/symbol/_Symbol.for (; 20 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32) (local $0 i32)
global.get $~lib/symbol/stringToId global.get $~lib/symbol/stringToId
if if
@ -1098,7 +1125,7 @@
else else
call $~lib/map/Map<String,usize>#constructor call $~lib/map/Map<String,usize>#constructor
global.set $~lib/symbol/stringToId global.set $~lib/symbol/stringToId
call $~lib/map/Map<String,usize>#constructor call $~lib/map/Map<usize,String>#constructor
global.set $~lib/symbol/idToString global.set $~lib/symbol/idToString
end end
global.get $~lib/symbol/nextId global.get $~lib/symbol/nextId
@ -1119,7 +1146,7 @@
call $~lib/map/Map<usize,String>#set call $~lib/map/Map<usize,String>#set
local.get $0 local.get $0
) )
(func $~lib/map/Map<usize,String>#has (; 19 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/map/Map<usize,String>#has (; 21 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0 local.get $0
local.get $1 local.get $1
local.get $1 local.get $1
@ -1128,7 +1155,7 @@
i32.const 0 i32.const 0
i32.ne i32.ne
) )
(func $~lib/map/Map<usize,String>#get (; 20 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/map/Map<usize,String>#get (; 22 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0 local.get $0
local.get $1 local.get $1
local.get $1 local.get $1
@ -1142,7 +1169,7 @@
unreachable unreachable
end end
) )
(func $~lib/symbol/_Symbol.keyFor (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/symbol/_Symbol.keyFor (; 23 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
global.get $~lib/symbol/idToString global.get $~lib/symbol/idToString
i32.const 0 i32.const 0
@ -1163,7 +1190,7 @@
i32.const 0 i32.const 0
end end
) )
(func $~lib/util/memory/memcpy (; 22 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/util/memory/memcpy (; 24 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
(local $5 i32) (local $5 i32)
@ -2060,98 +2087,98 @@
i32.store8 i32.store8
end end
) )
(func $~lib/util/memory/memmove (; 23 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/memory/memory.copy (; 25 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
local.get $0 block $~lib/util/memory/memmove|inlined.0
local.get $1
i32.eq
if
return
end
local.get $1
local.get $2 local.get $2
i32.add local.set $3
local.get $1
local.get $0 local.get $0
local.tee $2
i32.eq
br_if $~lib/util/memory/memmove|inlined.0
local.get $1
local.get $3
i32.add
local.get $2
i32.le_u i32.le_u
local.tee $3 local.tee $0
i32.eqz i32.eqz
if if
local.get $0
local.get $2 local.get $2
local.get $3
i32.add i32.add
local.get $1 local.get $1
i32.le_u i32.le_u
local.set $3 local.set $0
end end
local.get $3 local.get $0
if if
local.get $0
local.get $1
local.get $2 local.get $2
local.get $1
local.get $3
call $~lib/util/memory/memcpy call $~lib/util/memory/memcpy
return br $~lib/util/memory/memmove|inlined.0
end end
local.get $0 local.get $2
local.get $1 local.get $1
i32.lt_u i32.lt_u
if if
local.get $1 local.get $1
i32.const 7 i32.const 7
i32.and i32.and
local.get $0 local.get $2
i32.const 7 i32.const 7
i32.and i32.and
i32.eq i32.eq
if if
loop $continue|0 loop $continue|0
local.get $0 local.get $2
i32.const 7 i32.const 7
i32.and i32.and
if if
local.get $2 local.get $3
i32.eqz i32.eqz
if br_if $~lib/util/memory/memmove|inlined.0
return local.get $3
end
local.get $2
i32.const 1 i32.const 1
i32.sub i32.sub
local.set $2 local.set $3
local.get $0 local.get $2
local.tee $4 local.tee $4
i32.const 1 i32.const 1
i32.add i32.add
local.set $0 local.set $2
local.get $1 local.get $1
local.tee $3 local.tee $0
i32.const 1 i32.const 1
i32.add i32.add
local.set $1 local.set $1
local.get $4 local.get $4
local.get $3 local.get $0
i32.load8_u i32.load8_u
i32.store8 i32.store8
br $continue|0 br $continue|0
end end
end end
loop $continue|1 loop $continue|1
local.get $2 local.get $3
i32.const 8 i32.const 8
i32.ge_u i32.ge_u
if if
local.get $0 local.get $2
local.get $1 local.get $1
i64.load i64.load
i64.store i64.store
local.get $2 local.get $3
i32.const 8 i32.const 8
i32.sub i32.sub
local.set $2 local.set $3
local.get $0 local.get $2
i32.const 8 i32.const 8
i32.add i32.add
local.set $0 local.set $2
local.get $1 local.get $1
i32.const 8 i32.const 8
i32.add i32.add
@ -2161,26 +2188,26 @@
end end
end end
loop $continue|2 loop $continue|2
local.get $2 local.get $3
if if
local.get $0 local.get $2
local.tee $4 local.tee $4
i32.const 1 i32.const 1
i32.add i32.add
local.set $0 local.set $2
local.get $1 local.get $1
local.tee $3 local.tee $0
i32.const 1 i32.const 1
i32.add i32.add
local.set $1 local.set $1
local.get $4 local.get $4
local.get $3 local.get $0
i32.load8_u i32.load8_u
i32.store8 i32.store8
local.get $2 local.get $3
i32.const 1 i32.const 1
i32.sub i32.sub
local.set $2 local.set $3
br $continue|2 br $continue|2
end end
end end
@ -2188,31 +2215,29 @@
local.get $1 local.get $1
i32.const 7 i32.const 7
i32.and i32.and
local.get $0 local.get $2
i32.const 7 i32.const 7
i32.and i32.and
i32.eq i32.eq
if if
loop $continue|3 loop $continue|3
local.get $0
local.get $2 local.get $2
local.get $3
i32.add i32.add
i32.const 7 i32.const 7
i32.and i32.and
if if
local.get $2 local.get $3
i32.eqz i32.eqz
if br_if $~lib/util/memory/memmove|inlined.0
return local.get $3
end
local.get $2
i32.const 1 i32.const 1
i32.sub i32.sub
local.tee $2 local.tee $3
local.get $0 local.get $2
i32.add i32.add
local.get $1 local.get $1
local.get $2 local.get $3
i32.add i32.add
i32.load8_u i32.load8_u
i32.store8 i32.store8
@ -2220,18 +2245,18 @@
end end
end end
loop $continue|4 loop $continue|4
local.get $2 local.get $3
i32.const 8 i32.const 8
i32.ge_u i32.ge_u
if if
local.get $2 local.get $3
i32.const 8 i32.const 8
i32.sub i32.sub
local.tee $2 local.tee $3
local.get $0 local.get $2
i32.add i32.add
local.get $1 local.get $1
local.get $2 local.get $3
i32.add i32.add
i64.load i64.load
i64.store i64.store
@ -2240,16 +2265,16 @@
end end
end end
loop $continue|5 loop $continue|5
local.get $2 local.get $3
if if
local.get $2 local.get $3
i32.const 1 i32.const 1
i32.sub i32.sub
local.tee $2 local.tee $3
local.get $0 local.get $2
i32.add i32.add
local.get $1 local.get $1
local.get $2 local.get $3
i32.add i32.add
i32.load8_u i32.load8_u
i32.store8 i32.store8
@ -2257,14 +2282,9 @@
end end
end end
end end
end
) )
(func $~lib/memory/memory.copy (; 24 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/string/String#concat (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
local.get $1
local.get $2
call $~lib/util/memory/memmove
)
(func $~lib/string/String#concat (; 25 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@ -2273,7 +2293,7 @@
if if
i32.const 0 i32.const 0
i32.const 528 i32.const 528
i32.const 67 i32.const 65
i32.const 4 i32.const 4
call $~lib/env/abort call $~lib/env/abort
unreachable unreachable
@ -2308,7 +2328,7 @@
return return
end end
local.get $2 local.get $2
call $~lib/runtime/runtime.allocRaw call $~lib/runtime/doAllocate
local.tee $2 local.tee $2
local.get $0 local.get $0
local.get $3 local.get $3
@ -2320,12 +2340,10 @@
local.get $4 local.get $4
call $~lib/memory/memory.copy call $~lib/memory/memory.copy
local.get $2 local.get $2
call $~lib/runtime/runtime.unref
i32.const 1 i32.const 1
i32.store call $~lib/runtime/doRegister
local.get $2
) )
(func $~lib/string/String.concat (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/string/String.concat (; 27 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0 local.get $0
i32.const 512 i32.const 512
local.get $0 local.get $0
@ -2333,7 +2351,7 @@
local.get $1 local.get $1
call $~lib/string/String#concat call $~lib/string/String#concat
) )
(func $~lib/symbol/_Symbol#toString (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/symbol/_Symbol#toString (; 28 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32) (local $1 i32)
(local $2 i32) (local $2 i32)
i32.const 160 i32.const 160
@ -2417,7 +2435,7 @@
i32.const 568 i32.const 568
call $~lib/string/String.concat call $~lib/string/String.concat
) )
(func $start:std/symbol (; 28 ;) (type $FUNCSIG$v) (func $start:std/symbol (; 29 ;) (type $FUNCSIG$v)
(local $0 i32) (local $0 i32)
global.get $~lib/symbol/nextId global.get $~lib/symbol/nextId
local.tee $0 local.tee $0
@ -2594,10 +2612,10 @@
unreachable unreachable
end end
) )
(func $start (; 29 ;) (type $FUNCSIG$v) (func $start (; 30 ;) (type $FUNCSIG$v)
call $start:std/symbol call $start:std/symbol
) )
(func $null (; 30 ;) (type $FUNCSIG$v) (func $null (; 31 ;) (type $FUNCSIG$v)
nop nop
) )
) )

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(sub32, <i32[]>[0, 0, 0]));
assert(isInt32ArrayEqual(arr32, <i32[]>[1, 0, 0, 0, 2])); 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_F64LENGTH); // 1GB
// new Float64Array(MAX_F64 + 1); // throws // 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)) (type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1) (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) (table $0 1 funcref)
(elem (i32.const 0) $null) (elem (i32.const 0) $null)
(export "memory" (memory $0)) (export "memory" (memory $0))
@ -68,7 +68,7 @@
call $switch/doSwitch call $switch/doSwitch
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 10 i32.const 10
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -80,7 +80,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 11 i32.const 11
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -92,7 +92,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 12 i32.const 12
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -104,7 +104,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 13 i32.const 13
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -114,7 +114,7 @@
call $switch/doSwitch call $switch/doSwitch
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 14 i32.const 14
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -124,7 +124,7 @@
call $switch/doSwitch call $switch/doSwitch
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 24 i32.const 24
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -136,7 +136,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 25 i32.const 25
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -148,7 +148,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 26 i32.const 26
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -160,7 +160,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 27 i32.const 27
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -170,7 +170,7 @@
call $switch/doSwitch call $switch/doSwitch
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 28 i32.const 28
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -180,7 +180,7 @@
call $switch/doSwitchDefaultOmitted call $switch/doSwitchDefaultOmitted
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 38 i32.const 38
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -192,7 +192,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 39 i32.const 39
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -204,7 +204,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 40 i32.const 40
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -216,7 +216,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 41 i32.const 41
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -226,7 +226,7 @@
call $switch/doSwitchDefaultOmitted call $switch/doSwitchDefaultOmitted
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 42 i32.const 42
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort

View File

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

View File

@ -3,7 +3,7 @@
(type $FUNCSIG$v (func)) (type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1) (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) (table $0 1 funcref)
(elem (i32.const 0) $null) (elem (i32.const 0) $null)
(global $while/n (mut i32) (i32.const 10)) (global $while/n (mut i32) (i32.const 10))
@ -31,7 +31,7 @@
global.get $while/n global.get $while/n
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 8 i32.const 8
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -42,7 +42,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 9 i32.const 9
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -80,7 +80,7 @@
global.get $while/n global.get $while/n
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 21 i32.const 21
i32.const 2 i32.const 2
call $~lib/env/abort call $~lib/env/abort
@ -91,7 +91,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 22 i32.const 22
i32.const 2 i32.const 2
call $~lib/env/abort call $~lib/env/abort
@ -103,7 +103,7 @@
global.get $while/n global.get $while/n
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 24 i32.const 24
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -114,7 +114,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 25 i32.const 25
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -125,7 +125,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 26 i32.const 26
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -158,7 +158,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 31 i32.const 31
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -169,7 +169,7 @@
i32.ne i32.ne
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 32 i32.const 32
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort

View File

@ -3,13 +3,13 @@
(type $FUNCSIG$v (func)) (type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1) (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) (table $0 1 funcref)
(elem (i32.const 0) $null) (elem (i32.const 0) $null)
(global $while/n (mut i32) (i32.const 10)) (global $while/n (mut i32) (i32.const 10))
(global $while/m (mut i32) (i32.const 0)) (global $while/m (mut i32) (i32.const 0))
(global $while/o (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 "memory" (memory $0))
(export "table" (table $0)) (export "table" (table $0))
(start $start) (start $start)
@ -39,7 +39,7 @@
i32.eqz i32.eqz
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 8 i32.const 8
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -51,7 +51,7 @@
i32.eqz i32.eqz
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 9 i32.const 9
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -98,7 +98,7 @@
i32.eqz i32.eqz
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 21 i32.const 21
i32.const 2 i32.const 2
call $~lib/env/abort call $~lib/env/abort
@ -110,7 +110,7 @@
i32.eqz i32.eqz
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 22 i32.const 22
i32.const 2 i32.const 2
call $~lib/env/abort call $~lib/env/abort
@ -127,7 +127,7 @@
i32.eqz i32.eqz
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 24 i32.const 24
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -139,7 +139,7 @@
i32.eqz i32.eqz
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 25 i32.const 25
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -151,7 +151,7 @@
i32.eqz i32.eqz
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 26 i32.const 26
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -193,7 +193,7 @@
i32.eqz i32.eqz
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 31 i32.const 31
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort
@ -205,7 +205,7 @@
i32.eqz i32.eqz
if if
i32.const 0 i32.const 0
i32.const 8 i32.const 16
i32.const 32 i32.const 32
i32.const 0 i32.const 0
call $~lib/env/abort call $~lib/env/abort