mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
Implement dynamic array literals
This commit is contained in:
parent
88b00c1689
commit
de98a19eb8
2
dist/assemblyscript.js
vendored
2
dist/assemblyscript.js
vendored
File diff suppressed because one or more lines are too long
2
dist/assemblyscript.js.map
vendored
2
dist/assemblyscript.js.map
vendored
File diff suppressed because one or more lines are too long
@ -181,13 +181,13 @@ class NBodySystem {
|
||||
var system: NBodySystem;
|
||||
|
||||
export function init(): void {
|
||||
var bodies = new Array<Body>();
|
||||
bodies.push(Sun());
|
||||
bodies.push(Jupiter());
|
||||
bodies.push(Saturn());
|
||||
bodies.push(Uranus());
|
||||
bodies.push(Neptune());
|
||||
system = new NBodySystem(bodies);
|
||||
system = new NBodySystem([
|
||||
Sun(),
|
||||
Jupiter(),
|
||||
Saturn(),
|
||||
Uranus(),
|
||||
Neptune()
|
||||
]);
|
||||
}
|
||||
|
||||
export function getBody(index: i32): Body | null {
|
||||
|
@ -18,7 +18,6 @@ function asmFunc(global, env, buffer) {
|
||||
var $lib_allocator_arena_startOffset = 0;
|
||||
var $lib_allocator_arena_offset = 0;
|
||||
var assembly_index_system = 0;
|
||||
var $argc = 0;
|
||||
var HEAP_BASE = 36;
|
||||
var i64toi32_i32$HIGH_BITS = 0;
|
||||
function $lib_allocator_arena_allocate_memory($0) {
|
||||
@ -40,6 +39,30 @@ function asmFunc(global, env, buffer) {
|
||||
return 0 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6, $7) {
|
||||
$0 = $0 | 0;
|
||||
$1 = +$1;
|
||||
$2 = +$2;
|
||||
$3 = +$3;
|
||||
$4 = +$4;
|
||||
$5 = +$5;
|
||||
$6 = +$6;
|
||||
$7 = +$7;
|
||||
var $8 = 0, $9 = 0;
|
||||
if ($0) $9 = $0; else {
|
||||
$8 = $lib_allocator_arena_allocate_memory(56 | 0) | 0;
|
||||
HEAPF64[$8 >> 3] = $1;
|
||||
HEAPF64[($8 + 8 | 0) >> 3] = $2;
|
||||
HEAPF64[($8 + 16 | 0) >> 3] = $3;
|
||||
HEAPF64[($8 + 24 | 0) >> 3] = $4;
|
||||
HEAPF64[($8 + 32 | 0) >> 3] = $5;
|
||||
HEAPF64[($8 + 40 | 0) >> 3] = $6;
|
||||
HEAPF64[($8 + 48 | 0) >> 3] = $7;
|
||||
$9 = $8;
|
||||
}
|
||||
return $9 | 0;
|
||||
}
|
||||
|
||||
function $lib_internal_arraybuffer_allocUnsafe($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0;
|
||||
@ -69,30 +92,6 @@ function asmFunc(global, env, buffer) {
|
||||
return $0 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6, $7) {
|
||||
$0 = $0 | 0;
|
||||
$1 = +$1;
|
||||
$2 = +$2;
|
||||
$3 = +$3;
|
||||
$4 = +$4;
|
||||
$5 = +$5;
|
||||
$6 = +$6;
|
||||
$7 = +$7;
|
||||
var $8 = 0, $9 = 0;
|
||||
if ($0) $9 = $0; else {
|
||||
$8 = $lib_allocator_arena_allocate_memory(56 | 0) | 0;
|
||||
HEAPF64[$8 >> 3] = $1;
|
||||
HEAPF64[($8 + 8 | 0) >> 3] = $2;
|
||||
HEAPF64[($8 + 16 | 0) >> 3] = $3;
|
||||
HEAPF64[($8 + 24 | 0) >> 3] = $4;
|
||||
HEAPF64[($8 + 32 | 0) >> 3] = $5;
|
||||
HEAPF64[($8 + 40 | 0) >> 3] = $6;
|
||||
HEAPF64[($8 + 48 | 0) >> 3] = $7;
|
||||
$9 = $8;
|
||||
}
|
||||
return $9 | 0;
|
||||
}
|
||||
|
||||
function $lib_memory_set_memory($0, $1, $2) {
|
||||
$0 = $0 | 0;
|
||||
$1 = $1 | 0;
|
||||
@ -659,24 +658,22 @@ function asmFunc(global, env, buffer) {
|
||||
return $0 | 0;
|
||||
}
|
||||
|
||||
function $lib_array_Array_Body__push($0, $1) {
|
||||
function $lib_array_Array_Body____set($0, $1, $2) {
|
||||
$0 = $0 | 0;
|
||||
$1 = $1 | 0;
|
||||
var $4 = 0, $2 = 0, $3 = 0;
|
||||
$2 = HEAP32[($0 + 4 | 0) >> 2] | 0;
|
||||
$3 = $2 + 1 | 0;
|
||||
$4 = HEAPU32[$0 >> 2] | 0;
|
||||
if ($2 >>> 0 >= ((HEAP32[$4 >> 2] | 0) >>> 2 | 0) >>> 0) {
|
||||
if ($2 >>> 0 >= 268435454 >>> 0) {
|
||||
abort(0 | 0, 4 | 0, 128 | 0, 42 | 0);
|
||||
$2 = $2 | 0;
|
||||
var $3 = 0;
|
||||
$3 = HEAPU32[$0 >> 2] | 0;
|
||||
if ($1 >>> 0 >= ((HEAP32[$3 >> 2] | 0) >>> 2 | 0) >>> 0) {
|
||||
if ($1 >>> 0 >= 268435454 >>> 0) {
|
||||
abort(0 | 0, 4 | 0, 75 | 0, 41 | 0);
|
||||
abort();
|
||||
}
|
||||
$4 = $lib_internal_arraybuffer_reallocUnsafe($4 | 0, $3 << 2 | 0 | 0) | 0;
|
||||
HEAP32[$0 >> 2] = $4;
|
||||
$3 = $lib_internal_arraybuffer_reallocUnsafe($3 | 0, ($1 + 1 | 0) << 2 | 0 | 0) | 0;
|
||||
HEAP32[$0 >> 2] = $3;
|
||||
HEAP32[($0 + 4 | 0) >> 2] = $1 + 1 | 0;
|
||||
}
|
||||
HEAP32[($0 + 4 | 0) >> 2] = $3;
|
||||
HEAP32[(($4 + ($2 << 2 | 0) | 0) + 8 | 0) >> 2] = $1;
|
||||
return $3 | 0;
|
||||
HEAP32[(($3 + ($1 << 2 | 0) | 0) + 8 | 0) >> 2] = $2;
|
||||
}
|
||||
|
||||
function $lib_array_Array_Body____get($0, $1) {
|
||||
@ -725,28 +722,12 @@ function asmFunc(global, env, buffer) {
|
||||
|
||||
function assembly_index_init() {
|
||||
var $0 = 0;
|
||||
$argc = 0;
|
||||
$1of1 : {
|
||||
$0of1 : {
|
||||
oob : {
|
||||
switch ($argc | 0) {
|
||||
case 0:
|
||||
break $0of1;
|
||||
case 1:
|
||||
break $1of1;
|
||||
default:
|
||||
break oob;
|
||||
};
|
||||
};
|
||||
abort();
|
||||
};
|
||||
};
|
||||
$0 = $lib_array_Array_Body__constructor(0 | 0, 0 | 0) | 0;
|
||||
$lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0 | 0) | 0;
|
||||
$lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0 | 0) | 0;
|
||||
$lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(8.34336671824458), +(4.124798564124305), +(-.4035234171143214), +(-1.0107743461787924), +(1.8256623712304119), +(.008415761376584154), +(.011286326131968767)) | 0 | 0) | 0;
|
||||
$lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(12.894369562139131), +(-15.111151401698631), +(-.22330757889265573), +(1.0827910064415354), +(.8687130181696082), +(-.010832637401363636), +(1.7237240570597112e-03)) | 0 | 0) | 0;
|
||||
$lib_array_Array_Body__push($0 | 0, assembly_index_Body_constructor(0 | 0, +(15.379697114850917), +(-25.919314609987964), +(.17925877295037118), +(.979090732243898), +(.5946989986476762), +(-.034755955504078104), +(2.0336868699246304e-03)) | 0 | 0) | 0;
|
||||
$0 = $lib_array_Array_Body__constructor(0 | 0, 5 | 0) | 0;
|
||||
$lib_array_Array_Body____set($0 | 0, 0 | 0, assembly_index_Body_constructor(0 | 0, +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0 | 0);
|
||||
$lib_array_Array_Body____set($0 | 0, 1 | 0, assembly_index_Body_constructor(0 | 0, +(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0 | 0);
|
||||
$lib_array_Array_Body____set($0 | 0, 2 | 0, assembly_index_Body_constructor(0 | 0, +(8.34336671824458), +(4.124798564124305), +(-.4035234171143214), +(-1.0107743461787924), +(1.8256623712304119), +(.008415761376584154), +(.011286326131968767)) | 0 | 0);
|
||||
$lib_array_Array_Body____set($0 | 0, 3 | 0, assembly_index_Body_constructor(0 | 0, +(12.894369562139131), +(-15.111151401698631), +(-.22330757889265573), +(1.0827910064415354), +(.8687130181696082), +(-.010832637401363636), +(1.7237240570597112e-03)) | 0 | 0);
|
||||
$lib_array_Array_Body____set($0 | 0, 4 | 0, assembly_index_Body_constructor(0 | 0, +(15.379697114850917), +(-25.919314609987964), +(.17925877295037118), +(.979090732243898), +(.5946989986476762), +(-.034755955504078104), +(2.0336868699246304e-03)) | 0 | 0);
|
||||
assembly_index_system = assembly_index_NBodySystem_constructor(0 | 0, $0 | 0) | 0;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -1,10 +1,10 @@
|
||||
(module
|
||||
(type $F (func (result f64)))
|
||||
(type $v (func))
|
||||
(type $iFFFFFFFi (func (param i32 f64 f64 f64 f64 f64 f64 f64) (result i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $iFFFFFFFi (func (param i32 f64 f64 f64 f64 f64 f64 f64) (result i32)))
|
||||
(type $iiiv (func (param i32 i32 i32)))
|
||||
(type $iFv (func (param i32 f64)))
|
||||
(type $iF (func (param i32) (result f64)))
|
||||
@ -13,7 +13,6 @@
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
(global $assembly/index/system (mut i32) (i32.const 0))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 36))
|
||||
(memory $0 1)
|
||||
(data (i32.const 4) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s")
|
||||
@ -112,7 +111,49 @@
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/allocUnsafe (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $assembly/index/Body#constructor (; 2 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32)
|
||||
(local $8 i32)
|
||||
(if (result i32)
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
(block (result i32)
|
||||
(f64.store
|
||||
(tee_local $8
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 56)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(f64.store offset=8
|
||||
(get_local $8)
|
||||
(get_local $2)
|
||||
)
|
||||
(f64.store offset=16
|
||||
(get_local $8)
|
||||
(get_local $3)
|
||||
)
|
||||
(f64.store offset=24
|
||||
(get_local $8)
|
||||
(get_local $4)
|
||||
)
|
||||
(f64.store offset=32
|
||||
(get_local $8)
|
||||
(get_local $5)
|
||||
)
|
||||
(f64.store offset=40
|
||||
(get_local $8)
|
||||
(get_local $6)
|
||||
)
|
||||
(f64.store offset=48
|
||||
(get_local $8)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(i32.store
|
||||
(tee_local $1
|
||||
@ -137,7 +178,7 @@
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#constructor (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/array/Array<Body>#constructor (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(if
|
||||
(i32.gt_u
|
||||
@ -189,48 +230,6 @@
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $assembly/index/Body#constructor (; 4 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32)
|
||||
(local $8 i32)
|
||||
(if (result i32)
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
(block (result i32)
|
||||
(f64.store
|
||||
(tee_local $8
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 56)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(f64.store offset=8
|
||||
(get_local $8)
|
||||
(get_local $2)
|
||||
)
|
||||
(f64.store offset=16
|
||||
(get_local $8)
|
||||
(get_local $3)
|
||||
)
|
||||
(f64.store offset=24
|
||||
(get_local $8)
|
||||
(get_local $4)
|
||||
)
|
||||
(f64.store offset=32
|
||||
(get_local $8)
|
||||
(get_local $5)
|
||||
)
|
||||
(f64.store offset=40
|
||||
(get_local $8)
|
||||
(get_local $6)
|
||||
)
|
||||
(f64.store offset=48
|
||||
(get_local $8)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/set_memory (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i64)
|
||||
(local $4 i32)
|
||||
@ -2531,26 +2530,14 @@
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#push (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(func $~lib/array/Array<Body>#__set (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(set_local $3
|
||||
(i32.add
|
||||
(tee_local $2
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(tee_local $4
|
||||
(tee_local $3
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
@ -2562,48 +2549,53 @@
|
||||
(block
|
||||
(if
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.const 268435454)
|
||||
)
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 4)
|
||||
(i32.const 128)
|
||||
(i32.const 42)
|
||||
(i32.const 75)
|
||||
(i32.const 41)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(get_local $0)
|
||||
(tee_local $4
|
||||
(tee_local $3
|
||||
(call $~lib/internal/arraybuffer/reallocUnsafe
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $3)
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store offset=4
|
||||
(get_local $0)
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store offset=4
|
||||
(get_local $0)
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.store offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
)
|
||||
(get_local $3)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#__get (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
@ -2774,105 +2766,87 @@
|
||||
)
|
||||
(func $assembly/index/init (; 12 ;) (type $v)
|
||||
(local $0 i32)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(block (result i32)
|
||||
(set_global $~argc
|
||||
(i32.const 0)
|
||||
)
|
||||
(block $1of1
|
||||
(block $0of1
|
||||
(block $oob
|
||||
(br_table $0of1 $1of1 $oob
|
||||
(get_global $~argc)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(tee_local $0
|
||||
(call $~lib/array/Array<Body>#constructor
|
||||
(i32.const 0)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(get_local $0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 4.841431442464721)
|
||||
(f64.const -1.1603200440274284)
|
||||
(f64.const -0.10362204447112311)
|
||||
(f64.const 0.606326392995832)
|
||||
(f64.const 2.81198684491626)
|
||||
(f64.const -0.02521836165988763)
|
||||
(f64.const 0.03769367487038949)
|
||||
)
|
||||
)
|
||||
)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(get_local $0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 8.34336671824458)
|
||||
(f64.const 4.124798564124305)
|
||||
(f64.const -0.4035234171143214)
|
||||
(f64.const -1.0107743461787924)
|
||||
(f64.const 1.8256623712304119)
|
||||
(f64.const 0.008415761376584154)
|
||||
(f64.const 0.011286326131968767)
|
||||
)
|
||||
)
|
||||
)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(get_local $0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 12.894369562139131)
|
||||
(f64.const -15.111151401698631)
|
||||
(f64.const -0.22330757889265573)
|
||||
(f64.const 1.0827910064415354)
|
||||
(f64.const 0.8687130181696082)
|
||||
(f64.const -0.010832637401363636)
|
||||
(f64.const 1.7237240570597112e-03)
|
||||
)
|
||||
)
|
||||
)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(get_local $0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 15.379697114850917)
|
||||
(f64.const -25.919314609987964)
|
||||
(f64.const 0.17925877295037118)
|
||||
(f64.const 0.979090732243898)
|
||||
(f64.const 0.5946989986476762)
|
||||
(f64.const -0.034755955504078104)
|
||||
(f64.const 2.0336868699246304e-03)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_global $assembly/index/system
|
||||
(call $assembly/index/NBodySystem#constructor
|
||||
(i32.const 0)
|
||||
(get_local $0)
|
||||
(block (result i32)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(tee_local $0
|
||||
(call $~lib/array/Array<Body>#constructor
|
||||
(i32.const 0)
|
||||
(i32.const 5)
|
||||
)
|
||||
)
|
||||
(i32.const 0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 4.841431442464721)
|
||||
(f64.const -1.1603200440274284)
|
||||
(f64.const -0.10362204447112311)
|
||||
(f64.const 0.606326392995832)
|
||||
(f64.const 2.81198684491626)
|
||||
(f64.const -0.02521836165988763)
|
||||
(f64.const 0.03769367487038949)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 2)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 8.34336671824458)
|
||||
(f64.const 4.124798564124305)
|
||||
(f64.const -0.4035234171143214)
|
||||
(f64.const -1.0107743461787924)
|
||||
(f64.const 1.8256623712304119)
|
||||
(f64.const 0.008415761376584154)
|
||||
(f64.const 0.011286326131968767)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 3)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 12.894369562139131)
|
||||
(f64.const -15.111151401698631)
|
||||
(f64.const -0.22330757889265573)
|
||||
(f64.const 1.0827910064415354)
|
||||
(f64.const 0.8687130181696082)
|
||||
(f64.const -0.010832637401363636)
|
||||
(f64.const 1.7237240570597112e-03)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 4)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 15.379697114850917)
|
||||
(f64.const -25.919314609987964)
|
||||
(f64.const 0.17925877295037118)
|
||||
(f64.const 0.979090732243898)
|
||||
(f64.const 0.5946989986476762)
|
||||
(f64.const -0.034755955504078104)
|
||||
(f64.const 2.0336868699246304e-03)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -2,10 +2,10 @@
|
||||
(type $i (func (result i32)))
|
||||
(type $F (func (result f64)))
|
||||
(type $v (func))
|
||||
(type $iFFFFFFFi (func (param i32 f64 f64 f64 f64 f64 f64 f64) (result i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $iFFFFFFFi (func (param i32 f64 f64 f64 f64 f64 f64 f64) (result i32)))
|
||||
(type $iiiv (func (param i32 i32 i32)))
|
||||
(type $iFFFi (func (param i32 f64 f64 f64) (result i32)))
|
||||
(type $iFv (func (param i32 f64)))
|
||||
@ -23,7 +23,6 @@
|
||||
(global $assembly/index/system (mut i32) (i32.const 0))
|
||||
(global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8))
|
||||
(global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 96))
|
||||
(memory $0 1)
|
||||
(data (i32.const 4) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00")
|
||||
@ -34,34 +33,7 @@
|
||||
(export "bench" (func $assembly/index/bench))
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $~lib/internal/arraybuffer/computeSize (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:77
|
||||
(return
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:9
|
||||
(i32.shl
|
||||
(i32.const 1)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:21
|
||||
(i32.sub
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:29
|
||||
(i32.const 32)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:39
|
||||
(i32.clz
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:48
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:61
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:75
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@ -220,7 +192,263 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $assembly/index/Body#constructor (; 2 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32)
|
||||
(local $8 i32)
|
||||
;;@ assembly/index.ts:16:4
|
||||
(block
|
||||
)
|
||||
(tee_local $0
|
||||
(if (result i32)
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
(tee_local $0
|
||||
(block (result i32)
|
||||
(set_local $8
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 56)
|
||||
)
|
||||
)
|
||||
(f64.store
|
||||
(get_local $8)
|
||||
(get_local $1)
|
||||
)
|
||||
(f64.store offset=8
|
||||
(get_local $8)
|
||||
(get_local $2)
|
||||
)
|
||||
(f64.store offset=16
|
||||
(get_local $8)
|
||||
(get_local $3)
|
||||
)
|
||||
(f64.store offset=24
|
||||
(get_local $8)
|
||||
(get_local $4)
|
||||
)
|
||||
(f64.store offset=32
|
||||
(get_local $8)
|
||||
(get_local $5)
|
||||
)
|
||||
(f64.store offset=40
|
||||
(get_local $8)
|
||||
(get_local $6)
|
||||
)
|
||||
(f64.store offset=48
|
||||
(get_local $8)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Sun (; 3 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:29:2
|
||||
(return
|
||||
;;@ assembly/index.ts:27:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:28:4
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:9
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:14
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:19
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:24
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:29
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:34
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Jupiter (; 4 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:41:2
|
||||
(return
|
||||
;;@ assembly/index.ts:33:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:34:4
|
||||
(f64.const 4.841431442464721)
|
||||
;;@ assembly/index.ts:35:4
|
||||
(f64.const -1.1603200440274284)
|
||||
;;@ assembly/index.ts:36:4
|
||||
(f64.const -0.10362204447112311)
|
||||
;;@ assembly/index.ts:37:4
|
||||
(f64.mul
|
||||
(f64.const 0.001660076642744037)
|
||||
;;@ assembly/index.ts:37:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:38:4
|
||||
(f64.mul
|
||||
(f64.const 0.007699011184197404)
|
||||
;;@ assembly/index.ts:38:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:39:4
|
||||
(f64.mul
|
||||
(f64.const -6.90460016972063e-05)
|
||||
;;@ assembly/index.ts:39:31
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:40:4
|
||||
(f64.mul
|
||||
(f64.const 9.547919384243266e-04)
|
||||
;;@ assembly/index.ts:40:30
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Saturn (; 5 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:53:2
|
||||
(return
|
||||
;;@ assembly/index.ts:45:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:46:4
|
||||
(f64.const 8.34336671824458)
|
||||
;;@ assembly/index.ts:47:4
|
||||
(f64.const 4.124798564124305)
|
||||
;;@ assembly/index.ts:48:4
|
||||
(f64.const -0.4035234171143214)
|
||||
;;@ assembly/index.ts:49:4
|
||||
(f64.mul
|
||||
(f64.const -0.002767425107268624)
|
||||
;;@ assembly/index.ts:49:31
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:50:4
|
||||
(f64.mul
|
||||
(f64.const 0.004998528012349172)
|
||||
;;@ assembly/index.ts:50:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:51:4
|
||||
(f64.mul
|
||||
(f64.const 2.3041729757376393e-05)
|
||||
;;@ assembly/index.ts:51:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:52:4
|
||||
(f64.mul
|
||||
(f64.const 2.858859806661308e-04)
|
||||
;;@ assembly/index.ts:52:30
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Uranus (; 6 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:65:2
|
||||
(return
|
||||
;;@ assembly/index.ts:57:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:58:4
|
||||
(f64.const 12.894369562139131)
|
||||
;;@ assembly/index.ts:59:4
|
||||
(f64.const -15.111151401698631)
|
||||
;;@ assembly/index.ts:60:4
|
||||
(f64.const -0.22330757889265573)
|
||||
;;@ assembly/index.ts:61:4
|
||||
(f64.mul
|
||||
(f64.const 0.002964601375647616)
|
||||
;;@ assembly/index.ts:61:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:62:4
|
||||
(f64.mul
|
||||
(f64.const 2.3784717395948095e-03)
|
||||
;;@ assembly/index.ts:62:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:63:4
|
||||
(f64.mul
|
||||
(f64.const -2.9658956854023756e-05)
|
||||
;;@ assembly/index.ts:63:31
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:64:4
|
||||
(f64.mul
|
||||
(f64.const 4.366244043351563e-05)
|
||||
;;@ assembly/index.ts:64:30
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Neptune (; 7 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:77:2
|
||||
(return
|
||||
;;@ assembly/index.ts:69:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:70:4
|
||||
(f64.const 15.379697114850917)
|
||||
;;@ assembly/index.ts:71:4
|
||||
(f64.const -25.919314609987964)
|
||||
;;@ assembly/index.ts:72:4
|
||||
(f64.const 0.17925877295037118)
|
||||
;;@ assembly/index.ts:73:4
|
||||
(f64.mul
|
||||
(f64.const 2.6806777249038932e-03)
|
||||
;;@ assembly/index.ts:73:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:74:4
|
||||
(f64.mul
|
||||
(f64.const 0.001628241700382423)
|
||||
;;@ assembly/index.ts:74:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:75:4
|
||||
(f64.mul
|
||||
(f64.const -9.515922545197159e-05)
|
||||
;;@ assembly/index.ts:75:31
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:76:4
|
||||
(f64.mul
|
||||
(f64.const 5.1513890204661145e-05)
|
||||
;;@ assembly/index.ts:76:30
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/computeSize (; 8 ;) (type $ii) (param $0 i32) (result i32)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:77
|
||||
(return
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:9
|
||||
(i32.shl
|
||||
(i32.const 1)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:21
|
||||
(i32.sub
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:29
|
||||
(i32.const 32)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:39
|
||||
(i32.clz
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:48
|
||||
(i32.sub
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:61
|
||||
(i32.const 8)
|
||||
)
|
||||
;;@ ~lib/internal/arraybuffer.ts:17:75
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/allocUnsafe (; 9 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
;;@ ~lib/internal/arraybuffer.ts:22:2
|
||||
(if
|
||||
@ -266,7 +494,7 @@
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#constructor (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/array/Array<Body>#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
;;@ ~lib/array.ts:21:31
|
||||
(block
|
||||
@ -336,100 +564,7 @@
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#constructor|trampoline (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(block $1of1
|
||||
(block $0of1
|
||||
(block $oob
|
||||
(br_table $0of1 $1of1 $oob
|
||||
(get_global $~argc)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
(set_local $1
|
||||
;;@ ~lib/array.ts:21:28
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#constructor
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Body#constructor (; 6 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32)
|
||||
(local $8 i32)
|
||||
;;@ assembly/index.ts:16:4
|
||||
(block
|
||||
)
|
||||
(tee_local $0
|
||||
(if (result i32)
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
(tee_local $0
|
||||
(block (result i32)
|
||||
(set_local $8
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 56)
|
||||
)
|
||||
)
|
||||
(f64.store
|
||||
(get_local $8)
|
||||
(get_local $1)
|
||||
)
|
||||
(f64.store offset=8
|
||||
(get_local $8)
|
||||
(get_local $2)
|
||||
)
|
||||
(f64.store offset=16
|
||||
(get_local $8)
|
||||
(get_local $3)
|
||||
)
|
||||
(f64.store offset=24
|
||||
(get_local $8)
|
||||
(get_local $4)
|
||||
)
|
||||
(f64.store offset=32
|
||||
(get_local $8)
|
||||
(get_local $5)
|
||||
)
|
||||
(f64.store offset=40
|
||||
(get_local $8)
|
||||
(get_local $6)
|
||||
)
|
||||
(f64.store offset=48
|
||||
(get_local $8)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Sun (; 7 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:29:2
|
||||
(return
|
||||
;;@ assembly/index.ts:27:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:28:4
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:9
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:14
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:19
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:24
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:29
|
||||
(f64.const 0)
|
||||
;;@ assembly/index.ts:28:34
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/set_memory (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/memory/set_memory (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i64)
|
||||
@ -949,7 +1084,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/copy_memory (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/memory/copy_memory (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
@ -3202,7 +3337,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/move_memory (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/memory/move_memory (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
;;@ ~lib/memory.ts:151:2
|
||||
(if
|
||||
@ -3631,7 +3766,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/reallocUnsafe (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/internal/arraybuffer/reallocUnsafe (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
;;@ ~lib/internal/arraybuffer.ts:30:2
|
||||
@ -3820,300 +3955,131 @@
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#push (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(func $~lib/array/Array<Body>#__set (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 i32)
|
||||
;;@ ~lib/array.ts:122:4
|
||||
(set_local $2
|
||||
;;@ ~lib/array.ts:122:17
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
;;@ ~lib/array.ts:123:4
|
||||
;;@ ~lib/array.ts:71:4
|
||||
(set_local $3
|
||||
;;@ ~lib/array.ts:123:17
|
||||
;;@ ~lib/array.ts:71:17
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
;;@ ~lib/array.ts:124:4
|
||||
;;@ ~lib/array.ts:72:4
|
||||
(set_local $4
|
||||
;;@ ~lib/array.ts:124:19
|
||||
;;@ ~lib/array.ts:72:19
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ ~lib/array.ts:124:41
|
||||
;;@ ~lib/array.ts:72:41
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ ~lib/array.ts:125:4
|
||||
(set_local $5
|
||||
;;@ ~lib/array.ts:125:20
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
;;@ ~lib/array.ts:125:29
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
;;@ ~lib/array.ts:126:4
|
||||
;;@ ~lib/array.ts:73:4
|
||||
(if
|
||||
;;@ ~lib/array.ts:126:8
|
||||
;;@ ~lib/array.ts:73:8
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
;;@ ~lib/array.ts:126:23
|
||||
(get_local $1)
|
||||
;;@ ~lib/array.ts:73:22
|
||||
(get_local $4)
|
||||
)
|
||||
;;@ ~lib/array.ts:126:38
|
||||
;;@ ~lib/array.ts:73:37
|
||||
(block
|
||||
;;@ ~lib/array.ts:127:6
|
||||
;;@ ~lib/array.ts:74:6
|
||||
(nop)
|
||||
;;@ ~lib/array.ts:128:6
|
||||
;;@ ~lib/array.ts:75:6
|
||||
(if
|
||||
;;@ ~lib/array.ts:128:10
|
||||
;;@ ~lib/array.ts:75:10
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
;;@ ~lib/array.ts:128:25
|
||||
(get_local $1)
|
||||
;;@ ~lib/array.ts:75:24
|
||||
(i32.const 268435454)
|
||||
)
|
||||
;;@ ~lib/array.ts:128:42
|
||||
;;@ ~lib/array.ts:75:41
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 4)
|
||||
(i32.const 128)
|
||||
(i32.const 42)
|
||||
(i32.const 75)
|
||||
(i32.const 41)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
;;@ ~lib/array.ts:129:6
|
||||
;;@ ~lib/array.ts:76:6
|
||||
(set_local $3
|
||||
;;@ ~lib/array.ts:129:15
|
||||
;;@ ~lib/array.ts:76:15
|
||||
(call $~lib/internal/arraybuffer/reallocUnsafe
|
||||
;;@ ~lib/array.ts:129:29
|
||||
;;@ ~lib/array.ts:76:29
|
||||
(get_local $3)
|
||||
;;@ ~lib/array.ts:129:37
|
||||
;;@ ~lib/array.ts:76:37
|
||||
(i32.shl
|
||||
(get_local $5)
|
||||
;;@ ~lib/array.ts:129:50
|
||||
(i32.add
|
||||
;;@ ~lib/array.ts:76:38
|
||||
(get_local $1)
|
||||
;;@ ~lib/array.ts:76:46
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ ~lib/array.ts:76:52
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ ~lib/array.ts:130:6
|
||||
;;@ ~lib/array.ts:77:6
|
||||
(i32.store
|
||||
(get_local $0)
|
||||
;;@ ~lib/array.ts:130:21
|
||||
;;@ ~lib/array.ts:77:21
|
||||
(get_local $3)
|
||||
)
|
||||
;;@ ~lib/array.ts:78:6
|
||||
(i32.store offset=4
|
||||
(get_local $0)
|
||||
;;@ ~lib/array.ts:78:21
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
;;@ ~lib/array.ts:78:29
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ ~lib/array.ts:132:4
|
||||
(i32.store offset=4
|
||||
(get_local $0)
|
||||
;;@ ~lib/array.ts:132:19
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ ~lib/array.ts:133:4
|
||||
;;@ ~lib/array.ts:81:4
|
||||
(block $~lib/internal/arraybuffer/storeUnsafe<Body>|inlined.0
|
||||
(set_local $6
|
||||
;;@ ~lib/array.ts:133:19
|
||||
(set_local $5
|
||||
;;@ ~lib/array.ts:81:19
|
||||
(get_local $3)
|
||||
)
|
||||
(set_local $7
|
||||
;;@ ~lib/array.ts:133:27
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $8
|
||||
;;@ ~lib/array.ts:133:35
|
||||
(set_local $6
|
||||
;;@ ~lib/array.ts:81:27
|
||||
(get_local $1)
|
||||
)
|
||||
(set_local $7
|
||||
;;@ ~lib/array.ts:81:34
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ ~lib/internal/arraybuffer.ts:69:2
|
||||
(i32.store offset=8
|
||||
;;@ ~lib/internal/arraybuffer.ts:69:11
|
||||
(i32.add
|
||||
(get_local $6)
|
||||
(get_local $5)
|
||||
;;@ ~lib/internal/arraybuffer.ts:69:39
|
||||
(i32.shl
|
||||
;;@ ~lib/internal/arraybuffer.ts:69:40
|
||||
(get_local $7)
|
||||
(get_local $6)
|
||||
;;@ ~lib/internal/arraybuffer.ts:69:56
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ ~lib/internal/arraybuffer.ts:69:71
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
;;@ ~lib/array.ts:134:11
|
||||
(return
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Jupiter (; 13 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:41:2
|
||||
(return
|
||||
;;@ assembly/index.ts:33:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:34:4
|
||||
(f64.const 4.841431442464721)
|
||||
;;@ assembly/index.ts:35:4
|
||||
(f64.const -1.1603200440274284)
|
||||
;;@ assembly/index.ts:36:4
|
||||
(f64.const -0.10362204447112311)
|
||||
;;@ assembly/index.ts:37:4
|
||||
(f64.mul
|
||||
(f64.const 0.001660076642744037)
|
||||
;;@ assembly/index.ts:37:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:38:4
|
||||
(f64.mul
|
||||
(f64.const 0.007699011184197404)
|
||||
;;@ assembly/index.ts:38:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:39:4
|
||||
(f64.mul
|
||||
(f64.const -6.90460016972063e-05)
|
||||
;;@ assembly/index.ts:39:31
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:40:4
|
||||
(f64.mul
|
||||
(f64.const 9.547919384243266e-04)
|
||||
;;@ assembly/index.ts:40:30
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
(get_local $7)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Saturn (; 14 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:53:2
|
||||
(return
|
||||
;;@ assembly/index.ts:45:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:46:4
|
||||
(f64.const 8.34336671824458)
|
||||
;;@ assembly/index.ts:47:4
|
||||
(f64.const 4.124798564124305)
|
||||
;;@ assembly/index.ts:48:4
|
||||
(f64.const -0.4035234171143214)
|
||||
;;@ assembly/index.ts:49:4
|
||||
(f64.mul
|
||||
(f64.const -0.002767425107268624)
|
||||
;;@ assembly/index.ts:49:31
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:50:4
|
||||
(f64.mul
|
||||
(f64.const 0.004998528012349172)
|
||||
;;@ assembly/index.ts:50:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:51:4
|
||||
(f64.mul
|
||||
(f64.const 2.3041729757376393e-05)
|
||||
;;@ assembly/index.ts:51:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:52:4
|
||||
(f64.mul
|
||||
(f64.const 2.858859806661308e-04)
|
||||
;;@ assembly/index.ts:52:30
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Uranus (; 15 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:65:2
|
||||
(return
|
||||
;;@ assembly/index.ts:57:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:58:4
|
||||
(f64.const 12.894369562139131)
|
||||
;;@ assembly/index.ts:59:4
|
||||
(f64.const -15.111151401698631)
|
||||
;;@ assembly/index.ts:60:4
|
||||
(f64.const -0.22330757889265573)
|
||||
;;@ assembly/index.ts:61:4
|
||||
(f64.mul
|
||||
(f64.const 0.002964601375647616)
|
||||
;;@ assembly/index.ts:61:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:62:4
|
||||
(f64.mul
|
||||
(f64.const 2.3784717395948095e-03)
|
||||
;;@ assembly/index.ts:62:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:63:4
|
||||
(f64.mul
|
||||
(f64.const -2.9658956854023756e-05)
|
||||
;;@ assembly/index.ts:63:31
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:64:4
|
||||
(f64.mul
|
||||
(f64.const 4.366244043351563e-05)
|
||||
;;@ assembly/index.ts:64:30
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Neptune (; 16 ;) (type $i) (result i32)
|
||||
;;@ assembly/index.ts:77:2
|
||||
(return
|
||||
;;@ assembly/index.ts:69:9
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:70:4
|
||||
(f64.const 15.379697114850917)
|
||||
;;@ assembly/index.ts:71:4
|
||||
(f64.const -25.919314609987964)
|
||||
;;@ assembly/index.ts:72:4
|
||||
(f64.const 0.17925877295037118)
|
||||
;;@ assembly/index.ts:73:4
|
||||
(f64.mul
|
||||
(f64.const 2.6806777249038932e-03)
|
||||
;;@ assembly/index.ts:73:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:74:4
|
||||
(f64.mul
|
||||
(f64.const 0.001628241700382423)
|
||||
;;@ assembly/index.ts:74:30
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:75:4
|
||||
(f64.mul
|
||||
(f64.const -9.515922545197159e-05)
|
||||
;;@ assembly/index.ts:75:31
|
||||
(f64.const 365.24)
|
||||
)
|
||||
;;@ assembly/index.ts:76:4
|
||||
(f64.mul
|
||||
(f64.const 5.1513890204661145e-05)
|
||||
;;@ assembly/index.ts:76:30
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#get:length (; 17 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/array/Array<Body>#get:length (; 16 ;) (type $ii) (param $0 i32) (result i32)
|
||||
;;@ ~lib/array.ts:29:16
|
||||
(return
|
||||
;;@ ~lib/array.ts:29:11
|
||||
@ -4122,7 +4088,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#__get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/array/Array<Body>#__get (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@ -4196,7 +4162,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/Body#offsetMomentum (; 19 ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32)
|
||||
(func $assembly/index/Body#offsetMomentum (; 18 ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32)
|
||||
;;@ assembly/index.ts:19:4
|
||||
(f64.store offset=24
|
||||
(get_local $0)
|
||||
@ -4241,7 +4207,7 @@
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/NBodySystem#constructor (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $assembly/index/NBodySystem#constructor (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 f64)
|
||||
(local $3 f64)
|
||||
(local $4 f64)
|
||||
@ -4408,77 +4374,57 @@
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $assembly/index/init (; 21 ;) (type $v)
|
||||
(func $assembly/index/init (; 20 ;) (type $v)
|
||||
(local $0 i32)
|
||||
;;@ assembly/index.ts:184:2
|
||||
(set_local $0
|
||||
;;@ assembly/index.ts:184:15
|
||||
(block (result i32)
|
||||
(set_global $~argc
|
||||
(i32.const 0)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#constructor|trampoline
|
||||
(i32.const 0)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:185:9
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
;;@ assembly/index.ts:185:2
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:185:14
|
||||
(call $assembly/index/Sun)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:186:9
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
;;@ assembly/index.ts:186:2
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:186:14
|
||||
(call $assembly/index/Jupiter)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:187:9
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
;;@ assembly/index.ts:187:2
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:187:14
|
||||
(call $assembly/index/Saturn)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:188:9
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
;;@ assembly/index.ts:188:2
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:188:14
|
||||
(call $assembly/index/Uranus)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:189:9
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
;;@ assembly/index.ts:189:2
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:189:14
|
||||
(call $assembly/index/Neptune)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:190:2
|
||||
(set_global $assembly/index/system
|
||||
;;@ assembly/index.ts:190:11
|
||||
;;@ assembly/index.ts:184:11
|
||||
(call $assembly/index/NBodySystem#constructor
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:190:27
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:184:27
|
||||
(block (result i32)
|
||||
(set_local $0
|
||||
(call $~lib/array/Array<Body>#constructor
|
||||
(i32.const 0)
|
||||
(i32.const 5)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:185:4
|
||||
(call $assembly/index/Sun)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
;;@ assembly/index.ts:186:4
|
||||
(call $assembly/index/Jupiter)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 2)
|
||||
;;@ assembly/index.ts:187:4
|
||||
(call $assembly/index/Saturn)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 3)
|
||||
;;@ assembly/index.ts:188:4
|
||||
(call $assembly/index/Uranus)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 4)
|
||||
;;@ assembly/index.ts:189:4
|
||||
(call $assembly/index/Neptune)
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/getBody (; 22 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $assembly/index/getBody (; 21 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
;;@ assembly/index.ts:194:2
|
||||
(set_local $1
|
||||
@ -4510,7 +4456,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/NBodySystem#advance (; 23 ;) (type $iFv) (param $0 i32) (param $1 f64)
|
||||
(func $assembly/index/NBodySystem#advance (; 22 ;) (type $iFv) (param $0 i32) (param $1 f64)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@ -4934,7 +4880,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/NBodySystem#energy (; 24 ;) (type $iF) (param $0 i32) (result f64)
|
||||
(func $assembly/index/NBodySystem#energy (; 23 ;) (type $iF) (param $0 i32) (result f64)
|
||||
(local $1 f64)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@ -5236,7 +5182,7 @@
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/step (; 25 ;) (type $F) (result f64)
|
||||
(func $assembly/index/step (; 24 ;) (type $F) (result f64)
|
||||
;;@ assembly/index.ts:199:9
|
||||
(call $assembly/index/NBodySystem#advance
|
||||
;;@ assembly/index.ts:199:2
|
||||
@ -5253,7 +5199,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/bench (; 26 ;) (type $iv) (param $0 i32)
|
||||
(func $assembly/index/bench (; 25 ;) (type $iv) (param $0 i32)
|
||||
(local $1 i32)
|
||||
;;@ assembly/index.ts:204:2
|
||||
(block $break|0
|
||||
@ -5291,7 +5237,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 27 ;) (type $v)
|
||||
(func $start (; 26 ;) (type $v)
|
||||
(set_global $~lib/allocator/arena/startOffset
|
||||
;;@ ~lib/allocator/arena.ts:12:25
|
||||
(i32.and
|
||||
|
321
src/compiler.ts
321
src/compiler.ts
@ -5511,7 +5511,7 @@ export class Compiler extends DiagnosticEmitter {
|
||||
classType &&
|
||||
classType.prototype == this.program.arrayPrototype
|
||||
) {
|
||||
return this.compileStaticArray(
|
||||
return this.compileArrayLiteral(
|
||||
assert(classType.typeArguments)[0],
|
||||
(<ArrayLiteralExpression>expression).elementExpressions,
|
||||
expression
|
||||
@ -5665,147 +5665,41 @@ export class Compiler extends DiagnosticEmitter {
|
||||
return module.createI32(i64_low(stringOffset));
|
||||
}
|
||||
|
||||
compileStaticArray(elementType: Type, expressions: (Expression | null)[], reportNode: Node): ExpressionRef {
|
||||
compileArrayLiteral(elementType: Type, expressions: (Expression | null)[], reportNode: Node): ExpressionRef {
|
||||
var isStatic = true;
|
||||
var module = this.module;
|
||||
|
||||
// obtain the array type
|
||||
var arrayPrototype = assert(this.program.arrayPrototype);
|
||||
if (!arrayPrototype || arrayPrototype.kind != ElementKind.CLASS_PROTOTYPE) return module.createUnreachable();
|
||||
var arrayType = (<ClassPrototype>arrayPrototype).resolve([ elementType ]);
|
||||
if (!arrayType) return module.createUnreachable();
|
||||
var arrayInstance = (<ClassPrototype>arrayPrototype).resolve([ elementType ]);
|
||||
if (!arrayInstance) return module.createUnreachable();
|
||||
var arrayType = arrayInstance.type;
|
||||
|
||||
var elementCount = expressions.length;
|
||||
var nativeType = elementType.toNativeType();
|
||||
var values: usize;
|
||||
var byteLength: usize;
|
||||
switch (nativeType) {
|
||||
case NativeType.I32: {
|
||||
values = changetype<usize>(new Int32Array(elementCount));
|
||||
byteLength = elementCount * 4;
|
||||
break;
|
||||
}
|
||||
case NativeType.I64: {
|
||||
values = changetype<usize>(new Array<I64>(elementCount));
|
||||
byteLength = elementCount * 8;
|
||||
break;
|
||||
}
|
||||
case NativeType.F32: {
|
||||
values = changetype<usize>(new Float32Array(elementCount));
|
||||
byteLength = elementCount * 4;
|
||||
break;
|
||||
}
|
||||
case NativeType.F64: {
|
||||
values = changetype<usize>(new Float64Array(elementCount));
|
||||
byteLength = elementCount * 8;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
assert(false);
|
||||
this.error(
|
||||
DiagnosticCode.Operation_not_supported,
|
||||
reportNode.range
|
||||
);
|
||||
return module.createUnreachable();
|
||||
}
|
||||
}
|
||||
|
||||
// precompute value expressions
|
||||
var exprs = new Array<ExpressionRef>(elementCount);
|
||||
var expr: BinaryenExpressionRef;
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
exprs[i] = expressions[i]
|
||||
? this.compileExpression(<Expression>expressions[i], elementType)
|
||||
: elementType.toNativeZero(module);
|
||||
if (isStatic) {
|
||||
expr = this.precomputeExpressionRef(exprs[i]);
|
||||
if (_BinaryenExpressionGetId(expr) == ExpressionId.Const) {
|
||||
assert(_BinaryenExpressionGetType(expr) == nativeType);
|
||||
switch (nativeType) {
|
||||
case NativeType.I32: {
|
||||
changetype<i32[]>(values)[i] = _BinaryenConstGetValueI32(expr);
|
||||
break;
|
||||
}
|
||||
case NativeType.I64: {
|
||||
changetype<I64[]>(values)[i] = i64_new(
|
||||
_BinaryenConstGetValueI64Low(expr),
|
||||
_BinaryenConstGetValueI64High(expr)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case NativeType.F32: {
|
||||
changetype<f32[]>(values)[i] = _BinaryenConstGetValueF32(expr);
|
||||
break;
|
||||
}
|
||||
case NativeType.F64: {
|
||||
changetype<f64[]>(values)[i] = _BinaryenConstGetValueF64(expr);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
assert(false); // checked above
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO: emit a warning if declared 'const'
|
||||
isStatic = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var usizeTypeSize = this.options.usizeType.byteSize;
|
||||
|
||||
if (isStatic) {
|
||||
// Create a combined static memory segment composed of:
|
||||
// Array struct + ArrayBuffer struct + aligned ArrayBuffer data
|
||||
|
||||
let arraySize = usizeTypeSize + 4; // buffer_ & length_
|
||||
let bufferHeaderSize = (4 + 7) & ~7; // aligned byteLength (8)
|
||||
let bufferTotalSize = 1 << (32 - clz(byteLength + bufferHeaderSize - 1)); // see internals
|
||||
let data = new Uint8Array(arraySize + bufferTotalSize);
|
||||
let segment = this.addMemorySegment(data);
|
||||
let offset = 0;
|
||||
|
||||
// write Array struct
|
||||
if (usizeTypeSize == 8) {
|
||||
writeI64(i64_add(segment.offset, i64_new(arraySize)), data, offset); // buffer_ @ segment[arSize]
|
||||
offset += 8;
|
||||
} else {
|
||||
assert(i64_high(segment.offset) == 0);
|
||||
writeI32(i64_low(segment.offset) + arraySize, data, offset); // buffer_ @ segment[arSize]
|
||||
offset += 4;
|
||||
}
|
||||
writeI32(elementCount, data, offset); // length_
|
||||
offset += 4;
|
||||
assert(offset == arraySize);
|
||||
|
||||
// write ArrayBuffer struct
|
||||
writeI32(byteLength, data, offset);
|
||||
offset += bufferHeaderSize; // incl. alignment
|
||||
|
||||
// write ArrayBuffer data
|
||||
switch (nativeType) {
|
||||
if (elementCount) { // non-empty static or dynamic
|
||||
let nativeElementType = elementType.toNativeType();
|
||||
let values: usize;
|
||||
let byteLength: usize;
|
||||
switch (nativeElementType) {
|
||||
case NativeType.I32: {
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
writeI32(changetype<i32[]>(values)[i], data, offset); offset += 4;
|
||||
}
|
||||
values = changetype<usize>(new Int32Array(elementCount));
|
||||
byteLength = elementCount * 4;
|
||||
break;
|
||||
}
|
||||
case NativeType.I64: {
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
writeI64(changetype<I64[]>(values)[i], data, offset); offset += 8;
|
||||
}
|
||||
values = changetype<usize>(new Array<I64>(elementCount));
|
||||
byteLength = elementCount * 8;
|
||||
break;
|
||||
}
|
||||
case NativeType.F32: {
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
writeF32(changetype<f32[]>(values)[i], data, offset); offset += 4;
|
||||
}
|
||||
values = changetype<usize>(new Float32Array(elementCount));
|
||||
byteLength = elementCount * 4;
|
||||
break;
|
||||
}
|
||||
case NativeType.F64: {
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
writeF64(changetype<f64[]>(values)[i], data, offset); offset += 8;
|
||||
}
|
||||
values = changetype<usize>(new Float64Array(elementCount));
|
||||
byteLength = elementCount * 8;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@ -5817,21 +5711,174 @@ export class Compiler extends DiagnosticEmitter {
|
||||
return module.createUnreachable();
|
||||
}
|
||||
}
|
||||
assert(offset <= arraySize + bufferTotalSize);
|
||||
|
||||
this.currentType = arrayType.type;
|
||||
return usizeTypeSize == 8
|
||||
? module.createI64(
|
||||
i64_low(segment.offset),
|
||||
i64_high(segment.offset)
|
||||
)
|
||||
: module.createI32(
|
||||
i64_low(segment.offset)
|
||||
// precompute value expressions
|
||||
let exprs = new Array<ExpressionRef>(elementCount);
|
||||
let expr: BinaryenExpressionRef;
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
exprs[i] = expressions[i]
|
||||
? this.compileExpression(<Expression>expressions[i], elementType)
|
||||
: elementType.toNativeZero(module);
|
||||
if (isStatic) {
|
||||
expr = this.precomputeExpressionRef(exprs[i]);
|
||||
if (_BinaryenExpressionGetId(expr) == ExpressionId.Const) {
|
||||
assert(_BinaryenExpressionGetType(expr) == nativeElementType);
|
||||
switch (nativeElementType) {
|
||||
case NativeType.I32: {
|
||||
changetype<i32[]>(values)[i] = _BinaryenConstGetValueI32(expr);
|
||||
break;
|
||||
}
|
||||
case NativeType.I64: {
|
||||
changetype<I64[]>(values)[i] = i64_new(
|
||||
_BinaryenConstGetValueI64Low(expr),
|
||||
_BinaryenConstGetValueI64High(expr)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case NativeType.F32: {
|
||||
changetype<f32[]>(values)[i] = _BinaryenConstGetValueF32(expr);
|
||||
break;
|
||||
}
|
||||
case NativeType.F64: {
|
||||
changetype<f64[]>(values)[i] = _BinaryenConstGetValueF64(expr);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
assert(false); // checked above
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO: emit a warning if declared 'const'
|
||||
// if (isConst) {
|
||||
// this.warn(
|
||||
// DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,
|
||||
// reportNode.range
|
||||
// );
|
||||
// }
|
||||
isStatic = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let usizeTypeSize = this.options.usizeType.byteSize;
|
||||
if (isStatic) { // non-empty, all elements can be precomputed
|
||||
|
||||
// Create a combined static memory segment composed of:
|
||||
// Array struct + ArrayBuffer struct + aligned ArrayBuffer data
|
||||
|
||||
let arraySize = usizeTypeSize + 4; // buffer_ & length_
|
||||
let bufferHeaderSize = (4 + 7) & ~7; // aligned byteLength (8)
|
||||
let bufferTotalSize = 1 << (32 - clz(byteLength + bufferHeaderSize - 1)); // see internals
|
||||
let data = new Uint8Array(arraySize + bufferTotalSize);
|
||||
let segment = this.addMemorySegment(data);
|
||||
let offset = 0;
|
||||
|
||||
// write Array struct
|
||||
if (usizeTypeSize == 8) {
|
||||
writeI64(i64_add(segment.offset, i64_new(arraySize)), data, offset); // buffer_ @ segment[arSize]
|
||||
offset += 8;
|
||||
} else {
|
||||
assert(i64_high(segment.offset) == 0);
|
||||
writeI32(i64_low(segment.offset) + arraySize, data, offset); // buffer_ @ segment[arSize]
|
||||
offset += 4;
|
||||
}
|
||||
writeI32(elementCount, data, offset); // length_
|
||||
offset += 4;
|
||||
assert(offset == arraySize);
|
||||
|
||||
// write ArrayBuffer struct
|
||||
writeI32(byteLength, data, offset);
|
||||
offset += bufferHeaderSize; // incl. alignment
|
||||
|
||||
// write ArrayBuffer data
|
||||
switch (nativeElementType) {
|
||||
case NativeType.I32: {
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
writeI32(changetype<i32[]>(values)[i], data, offset); offset += 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NativeType.I64: {
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
writeI64(changetype<I64[]>(values)[i], data, offset); offset += 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NativeType.F32: {
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
writeF32(changetype<f32[]>(values)[i], data, offset); offset += 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NativeType.F64: {
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
writeF64(changetype<f64[]>(values)[i], data, offset); offset += 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
assert(false);
|
||||
this.error(
|
||||
DiagnosticCode.Operation_not_supported,
|
||||
reportNode.range
|
||||
);
|
||||
return module.createUnreachable();
|
||||
}
|
||||
}
|
||||
assert(offset <= arraySize + bufferTotalSize);
|
||||
|
||||
this.currentType = arrayType;
|
||||
return usizeTypeSize == 8
|
||||
? module.createI64(
|
||||
i64_low(segment.offset),
|
||||
i64_high(segment.offset)
|
||||
)
|
||||
: module.createI32(
|
||||
i64_low(segment.offset)
|
||||
);
|
||||
|
||||
} else { // non-empty, some elements can't be precomputed
|
||||
|
||||
this.currentType = arrayType;
|
||||
let setter = arrayInstance.lookupOverload(OperatorKind.INDEXED_SET);
|
||||
if (!setter) {
|
||||
this.error(
|
||||
DiagnosticCode.Index_signature_in_type_0_only_permits_reading,
|
||||
reportNode.range, arrayInstance.internalName
|
||||
);
|
||||
} else {
|
||||
// TODO: static elements *could* go into data segments while dynamic ones are initialized
|
||||
// on top? any benefits?
|
||||
throw new Error("not implemented");
|
||||
return module.createUnreachable();
|
||||
}
|
||||
let nativeArrayType = arrayType.toNativeType();
|
||||
let currentFunction = this.currentFunction;
|
||||
let tempLocal = currentFunction.getTempLocal(arrayType);
|
||||
let stmts = new Array<ExpressionRef>(2 + elementCount);
|
||||
let index = 0;
|
||||
stmts[index++] = module.createSetLocal(tempLocal.index,
|
||||
this.makeCallDirect(assert(arrayInstance.constructorInstance), [
|
||||
module.createI32(0), // this
|
||||
module.createI32(elementCount)
|
||||
])
|
||||
);
|
||||
for (let i = 0; i < elementCount; ++i) {
|
||||
stmts[index++] = this.makeCallDirect(setter, [
|
||||
module.createGetLocal(tempLocal.index, nativeArrayType), // this
|
||||
module.createI32(i),
|
||||
exprs[i]
|
||||
]);
|
||||
}
|
||||
assert(index + 1 == stmts.length);
|
||||
stmts[index] = module.createGetLocal(tempLocal.index, nativeArrayType);
|
||||
currentFunction.freeTempLocal(tempLocal);
|
||||
this.currentType = arrayType;
|
||||
return module.createBlock(null, stmts, nativeArrayType);
|
||||
}
|
||||
|
||||
} else { // empty, TBD: cache this somehow?
|
||||
this.currentType = arrayType;
|
||||
return this.makeCallDirect(assert(arrayInstance.constructorInstance), [
|
||||
module.createI32(0), // this
|
||||
module.createI32(0)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
2849
tests/compiler/std/array-literal.optimized.wat
Normal file
2849
tests/compiler/std/array-literal.optimized.wat
Normal file
File diff suppressed because it is too large
Load Diff
17
tests/compiler/std/array-literal.ts
Normal file
17
tests/compiler/std/array-literal.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import "allocator/arena";
|
||||
|
||||
const staticArray: i32[] = [0, 1, 2];
|
||||
assert(staticArray.length == 3);
|
||||
assert(staticArray[0] == 0);
|
||||
assert(staticArray[1] == 1);
|
||||
assert(staticArray[2] == 2);
|
||||
|
||||
var emptyArray: i32[] = []; // not static atm
|
||||
assert(emptyArray.length == 0);
|
||||
|
||||
var i = 0;
|
||||
var dynamicArray: i32[] = [i, ++i, ++i];
|
||||
assert(dynamicArray.length == 3);
|
||||
assert(dynamicArray[0] == 0);
|
||||
assert(dynamicArray[1] == 1);
|
||||
assert(dynamicArray[2] == 2);
|
3250
tests/compiler/std/array-literal.untouched.wat
Normal file
3250
tests/compiler/std/array-literal.untouched.wat
Normal file
File diff suppressed because it is too large
Load Diff
@ -29,11 +29,11 @@
|
||||
(global $~lib/math/random_seeded (mut i32) (i32.const 0))
|
||||
(global $~lib/math/random_state0 (mut i64) (i64.const 0))
|
||||
(global $~lib/math/random_state1 (mut i64) (i64.const 0))
|
||||
(global $std/array/reversed0 (mut i32) (i32.const 328))
|
||||
(global $std/array/reversed1 (mut i32) (i32.const 344))
|
||||
(global $std/array/reversed2 (mut i32) (i32.const 368))
|
||||
(global $std/array/reversed4 (mut i32) (i32.const 392))
|
||||
(global $std/array/expected4 (mut i32) (i32.const 432))
|
||||
(global $std/array/reversed0 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversed1 (mut i32) (i32.const 328))
|
||||
(global $std/array/reversed2 (mut i32) (i32.const 352))
|
||||
(global $std/array/reversed4 (mut i32) (i32.const 376))
|
||||
(global $std/array/expected4 (mut i32) (i32.const 416))
|
||||
(global $std/array/reversed64 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversed128 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversed1024 (mut i32) (i32.const 0))
|
||||
@ -43,10 +43,10 @@
|
||||
(global $std/array/randomized257 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversedNested512 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversedElements512 (mut i32) (i32.const 0))
|
||||
(global $std/array/randomStringsActual (mut i32) (i32.const 560))
|
||||
(global $std/array/randomStringsExpected (mut i32) (i32.const 632))
|
||||
(global $std/array/randomStringsActual (mut i32) (i32.const 544))
|
||||
(global $std/array/randomStringsExpected (mut i32) (i32.const 616))
|
||||
(global $std/array/randomStrings400 (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 800))
|
||||
(global $HEAP_BASE i32 (i32.const 784))
|
||||
(table 51 51 anyfunc)
|
||||
(elem (i32.const 0) $start~anonymous|0 $start~anonymous|1 $start~anonymous|2 $start~anonymous|3 $start~anonymous|2 $start~anonymous|5 $start~anonymous|6 $start~anonymous|7 $start~anonymous|8 $start~anonymous|9 $start~anonymous|10 $start~anonymous|11 $start~anonymous|12 $start~anonymous|13 $start~anonymous|14 $start~anonymous|15 $start~anonymous|16 $start~anonymous|17 $start~anonymous|16 $start~anonymous|19 $start~anonymous|20 $start~anonymous|21 $start~anonymous|22 $start~anonymous|23 $start~anonymous|24 $start~anonymous|25 $start~anonymous|26 $start~anonymous|27 $start~anonymous|28 $start~anonymous|28 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|28 $start~anonymous|34 $start~anonymous|28 $start~anonymous|28 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|28 $start~anonymous|34 $std/array/assertSortedDefault<i32>~anonymous|42 $start~anonymous|43 $start~anonymous|44 $start~anonymous|43 $start~anonymous|44 $start~anonymous|47 $start~anonymous|48 $start~anonymous|49 $start~anonymous|49)
|
||||
(memory $0 1)
|
||||
@ -55,23 +55,22 @@
|
||||
(data (i32.const 96) "\0c\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00.\00t\00s")
|
||||
(data (i32.const 124) "\0c\00\00\00~\00l\00i\00b\00/\00m\00a\00t\00h\00.\00t\00s")
|
||||
(data (i32.const 152) "V\00\00\00A\00B\00C\00D\00E\00F\00G\00H\00I\00J\00K\00L\00M\00N\00O\00P\00Q\00R\00S\00T\00U\00V\00W\00X\00Y\00Z\00a\00b\00c\00d\00e\00f\00g\00h\00i\00j\00k\00l\00m\00n\00o\00p\00q\00r\00s\00t\00u\00v\00w\00x\00y\00z\000\001\002\003\004\005\006\007\008\009\00_\00-\00,\00.\00+\00/\00\\\00[\00]\00{\00}\00(\00)\00<\00>\00*\00&\00$\00%\00^\00@\00#\00!\00?")
|
||||
(data (i32.const 328) "P\01")
|
||||
(data (i32.const 344) "`\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01")
|
||||
(data (i32.const 368) "x\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\02\00\00\00\01")
|
||||
(data (i32.const 392) "\90\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\01")
|
||||
(data (i32.const 432) "\b8\01\00\00\04\00\00\00\10")
|
||||
(data (i32.const 452) "\01\00\00\00\02\00\00\00\03")
|
||||
(data (i32.const 472) "\e0\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01")
|
||||
(data (i32.const 496) "\f8\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02")
|
||||
(data (i32.const 520) "\01\00\00\00a")
|
||||
(data (i32.const 528) "\01\00\00\00b")
|
||||
(data (i32.const 536) "\02\00\00\00a\00b")
|
||||
(data (i32.const 544) "\02\00\00\00b\00a")
|
||||
(data (i32.const 560) "8\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00\08\02\00\00\10\02\00\00\08\02\00\00\18\02\00\00 \02\00\00(\02")
|
||||
(data (i32.const 632) "\80\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00(\02\00\00\08\02\00\00\08\02\00\00\18\02\00\00\10\02\00\00 \02")
|
||||
(data (i32.const 704) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
|
||||
(data (i32.const 736) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
|
||||
(data (i32.const 788) "\04\00\00\00n\00u\00l\00l")
|
||||
(data (i32.const 328) "P\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01")
|
||||
(data (i32.const 352) "h\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\02\00\00\00\01")
|
||||
(data (i32.const 376) "\80\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\01")
|
||||
(data (i32.const 416) "\a8\01\00\00\04\00\00\00\10")
|
||||
(data (i32.const 436) "\01\00\00\00\02\00\00\00\03")
|
||||
(data (i32.const 456) "\d0\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01")
|
||||
(data (i32.const 480) "\e8\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02")
|
||||
(data (i32.const 504) "\01\00\00\00a")
|
||||
(data (i32.const 512) "\01\00\00\00b")
|
||||
(data (i32.const 520) "\02\00\00\00a\00b")
|
||||
(data (i32.const 528) "\02\00\00\00b\00a")
|
||||
(data (i32.const 544) "(\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00\f8\01\00\00\00\02\00\00\f8\01\00\00\08\02\00\00\10\02\00\00\18\02")
|
||||
(data (i32.const 616) "p\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00\18\02\00\00\f8\01\00\00\f8\01\00\00\08\02\00\00\00\02\00\00\10\02")
|
||||
(data (i32.const 688) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
|
||||
(data (i32.const 720) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
|
||||
(data (i32.const 772) "\04\00\00\00n\00u\00l\00l")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
@ -6034,7 +6033,7 @@
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 736)
|
||||
(i32.const 720)
|
||||
(i32.const 20)
|
||||
(i32.const 2)
|
||||
)
|
||||
@ -6066,7 +6065,7 @@
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 704)
|
||||
(i32.const 688)
|
||||
(i32.const 18)
|
||||
(i32.const 4)
|
||||
)
|
||||
@ -6081,7 +6080,7 @@
|
||||
)
|
||||
)
|
||||
(return
|
||||
(i32.const 552)
|
||||
(i32.const 536)
|
||||
)
|
||||
)
|
||||
(i32.store16 offset=4
|
||||
@ -6113,7 +6112,7 @@
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 704)
|
||||
(i32.const 688)
|
||||
(i32.const 74)
|
||||
(i32.const 4)
|
||||
)
|
||||
@ -6125,7 +6124,7 @@
|
||||
(get_local $1)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.const 788)
|
||||
(i32.const 772)
|
||||
)
|
||||
)
|
||||
(if
|
||||
@ -6146,7 +6145,7 @@
|
||||
)
|
||||
)
|
||||
(return
|
||||
(i32.const 552)
|
||||
(i32.const 536)
|
||||
)
|
||||
)
|
||||
(call $~lib/memory/move_memory
|
||||
@ -6195,7 +6194,7 @@
|
||||
(get_local $0)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.const 788)
|
||||
(i32.const 772)
|
||||
)
|
||||
)
|
||||
(call $~lib/string/String#concat
|
||||
@ -6207,7 +6206,7 @@
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(set_local $1
|
||||
(i32.const 552)
|
||||
(i32.const 536)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
@ -9281,6 +9280,12 @@
|
||||
(call $~lib/math/JSMath.random)
|
||||
)
|
||||
)
|
||||
(set_global $std/array/reversed0
|
||||
(call $~lib/array/Array<i32>#constructor
|
||||
(i32.const 0)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(set_global $std/array/reversed64
|
||||
(call $std/array/createReverseOrderedArray
|
||||
(i32.const 64)
|
||||
@ -9320,7 +9325,7 @@
|
||||
(i32.eqz
|
||||
(call $std/array/isArraysEqual<i32>|trampoline
|
||||
(get_global $std/array/reversed1)
|
||||
(i32.const 472)
|
||||
(i32.const 456)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -9346,7 +9351,7 @@
|
||||
(i32.eqz
|
||||
(call $std/array/isArraysEqual<i32>|trampoline
|
||||
(get_global $std/array/reversed2)
|
||||
(i32.const 496)
|
||||
(i32.const 480)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
|
@ -37,11 +37,11 @@
|
||||
(global $~lib/math/random_state0 (mut i64) (i64.const 0))
|
||||
(global $~lib/math/random_state1 (mut i64) (i64.const 0))
|
||||
(global $std/array/charset i32 (i32.const 152))
|
||||
(global $std/array/reversed0 (mut i32) (i32.const 328))
|
||||
(global $std/array/reversed1 (mut i32) (i32.const 344))
|
||||
(global $std/array/reversed2 (mut i32) (i32.const 368))
|
||||
(global $std/array/reversed4 (mut i32) (i32.const 392))
|
||||
(global $std/array/expected4 (mut i32) (i32.const 432))
|
||||
(global $std/array/reversed0 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversed1 (mut i32) (i32.const 328))
|
||||
(global $std/array/reversed2 (mut i32) (i32.const 352))
|
||||
(global $std/array/reversed4 (mut i32) (i32.const 376))
|
||||
(global $std/array/expected4 (mut i32) (i32.const 416))
|
||||
(global $std/array/reversed64 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversed128 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversed1024 (mut i32) (i32.const 0))
|
||||
@ -51,13 +51,13 @@
|
||||
(global $std/array/randomized257 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversedNested512 (mut i32) (i32.const 0))
|
||||
(global $std/array/reversedElements512 (mut i32) (i32.const 0))
|
||||
(global $std/array/randomStringsActual (mut i32) (i32.const 560))
|
||||
(global $std/array/randomStringsExpected (mut i32) (i32.const 632))
|
||||
(global $std/array/randomStringsActual (mut i32) (i32.const 544))
|
||||
(global $std/array/randomStringsExpected (mut i32) (i32.const 616))
|
||||
(global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4))
|
||||
(global $~lib/internal/string/EMPTY i32 (i32.const 552))
|
||||
(global $~lib/internal/string/EMPTY i32 (i32.const 536))
|
||||
(global $~lib/internal/string/MAX_LENGTH i32 (i32.const 536870910))
|
||||
(global $std/array/randomStrings400 (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 800))
|
||||
(global $HEAP_BASE i32 (i32.const 784))
|
||||
(table 51 51 anyfunc)
|
||||
(elem (i32.const 0) $start~anonymous|0 $start~anonymous|1 $start~anonymous|2 $start~anonymous|3 $start~anonymous|4 $start~anonymous|5 $start~anonymous|6 $start~anonymous|7 $start~anonymous|8 $start~anonymous|9 $start~anonymous|10 $start~anonymous|11 $start~anonymous|12 $start~anonymous|13 $start~anonymous|14 $start~anonymous|15 $start~anonymous|16 $start~anonymous|17 $start~anonymous|18 $start~anonymous|19 $start~anonymous|20 $start~anonymous|21 $start~anonymous|22 $start~anonymous|23 $start~anonymous|24 $start~anonymous|25 $start~anonymous|26 $start~anonymous|27 $start~anonymous|28 $start~anonymous|29 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|33 $start~anonymous|34 $start~anonymous|35 $start~anonymous|36 $start~anonymous|37 $start~anonymous|38 $start~anonymous|39 $start~anonymous|40 $start~anonymous|41 $std/array/assertSortedDefault<i32>~anonymous|42 $start~anonymous|43 $start~anonymous|44 $start~anonymous|45 $start~anonymous|46 $start~anonymous|47 $start~anonymous|48 $start~anonymous|49 $start~anonymous|50)
|
||||
(memory $0 1)
|
||||
@ -66,23 +66,22 @@
|
||||
(data (i32.const 96) "\0c\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00.\00t\00s\00")
|
||||
(data (i32.const 124) "\0c\00\00\00~\00l\00i\00b\00/\00m\00a\00t\00h\00.\00t\00s\00")
|
||||
(data (i32.const 152) "V\00\00\00A\00B\00C\00D\00E\00F\00G\00H\00I\00J\00K\00L\00M\00N\00O\00P\00Q\00R\00S\00T\00U\00V\00W\00X\00Y\00Z\00a\00b\00c\00d\00e\00f\00g\00h\00i\00j\00k\00l\00m\00n\00o\00p\00q\00r\00s\00t\00u\00v\00w\00x\00y\00z\000\001\002\003\004\005\006\007\008\009\00_\00-\00,\00.\00+\00/\00\\\00[\00]\00{\00}\00(\00)\00<\00>\00*\00&\00$\00%\00^\00@\00#\00!\00?\00")
|
||||
(data (i32.const 328) "P\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 344) "`\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00")
|
||||
(data (i32.const 368) "x\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00")
|
||||
(data (i32.const 392) "\90\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 432) "\b8\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00\03\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 472) "\e0\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00")
|
||||
(data (i32.const 496) "\f8\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00")
|
||||
(data (i32.const 520) "\01\00\00\00a\00")
|
||||
(data (i32.const 528) "\01\00\00\00b\00")
|
||||
(data (i32.const 536) "\02\00\00\00a\00b\00")
|
||||
(data (i32.const 544) "\02\00\00\00b\00a\00")
|
||||
(data (i32.const 552) "\00\00\00\00")
|
||||
(data (i32.const 560) "8\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00\08\02\00\00\10\02\00\00\08\02\00\00\18\02\00\00 \02\00\00(\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 632) "\80\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00(\02\00\00\08\02\00\00\08\02\00\00\18\02\00\00\10\02\00\00 \02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 704) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(data (i32.const 736) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(data (i32.const 788) "\04\00\00\00n\00u\00l\00l\00")
|
||||
(data (i32.const 328) "P\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00")
|
||||
(data (i32.const 352) "h\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00")
|
||||
(data (i32.const 376) "\80\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 416) "\a8\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00\03\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 456) "\d0\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00")
|
||||
(data (i32.const 480) "\e8\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00")
|
||||
(data (i32.const 504) "\01\00\00\00a\00")
|
||||
(data (i32.const 512) "\01\00\00\00b\00")
|
||||
(data (i32.const 520) "\02\00\00\00a\00b\00")
|
||||
(data (i32.const 528) "\02\00\00\00b\00a\00")
|
||||
(data (i32.const 536) "\00\00\00\00")
|
||||
(data (i32.const 544) "(\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00\f8\01\00\00\00\02\00\00\f8\01\00\00\08\02\00\00\10\02\00\00\18\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 616) "p\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00\18\02\00\00\f8\01\00\00\f8\01\00\00\08\02\00\00\00\02\00\00\10\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00")
|
||||
(data (i32.const 688) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(data (i32.const 720) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
|
||||
(data (i32.const 772) "\04\00\00\00n\00u\00l\00l\00")
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
@ -11576,7 +11575,7 @@
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 736)
|
||||
(i32.const 720)
|
||||
(i32.const 20)
|
||||
(i32.const 2)
|
||||
)
|
||||
@ -11614,7 +11613,7 @@
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 704)
|
||||
(i32.const 688)
|
||||
(i32.const 18)
|
||||
(i32.const 4)
|
||||
)
|
||||
@ -11629,7 +11628,7 @@
|
||||
)
|
||||
)
|
||||
(return
|
||||
(i32.const 552)
|
||||
(i32.const 536)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
@ -11668,7 +11667,7 @@
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 704)
|
||||
(i32.const 688)
|
||||
(i32.const 74)
|
||||
(i32.const 4)
|
||||
)
|
||||
@ -11681,7 +11680,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.const 788)
|
||||
(i32.const 772)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
@ -11706,7 +11705,7 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
(return
|
||||
(i32.const 552)
|
||||
(i32.const 536)
|
||||
)
|
||||
)
|
||||
(set_local $5
|
||||
@ -11758,7 +11757,7 @@
|
||||
(get_local $0)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.const 788)
|
||||
(i32.const 772)
|
||||
)
|
||||
)
|
||||
(return
|
||||
@ -11773,7 +11772,7 @@
|
||||
(local $2 i32)
|
||||
(local $3 f64)
|
||||
(set_local $1
|
||||
(i32.const 552)
|
||||
(i32.const 536)
|
||||
)
|
||||
(block $break|0
|
||||
(set_local $2
|
||||
@ -15286,6 +15285,12 @@
|
||||
(call $~lib/math/JSMath.random)
|
||||
)
|
||||
)
|
||||
(set_global $std/array/reversed0
|
||||
(call $~lib/array/Array<i32>#constructor
|
||||
(i32.const 0)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(set_global $std/array/reversed64
|
||||
(call $std/array/createReverseOrderedArray
|
||||
(i32.const 64)
|
||||
@ -15325,7 +15330,7 @@
|
||||
)
|
||||
(call $std/array/isArraysEqual<i32>|trampoline
|
||||
(get_global $std/array/reversed1)
|
||||
(i32.const 472)
|
||||
(i32.const 456)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -15351,7 +15356,7 @@
|
||||
)
|
||||
(call $std/array/isArraysEqual<i32>|trampoline
|
||||
(get_global $std/array/reversed2)
|
||||
(i32.const 496)
|
||||
(i32.const 480)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user