Slim down indexed access as far as currently possible

Interestingly, the same code written as statements is significantly slower. See notes.
This commit is contained in:
dcodeIO 2018-04-23 23:57:15 +02:00
parent de98a19eb8
commit 63aa648ace
16 changed files with 964 additions and 1384 deletions

2
dist/asc.js vendored

File diff suppressed because one or more lines are too long

2
dist/asc.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -666,7 +666,7 @@ function asmFunc(global, env, buffer) {
$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(0 | 0, 4 | 0, 81 | 0, 41 | 0);
abort();
}
$3 = $lib_internal_arraybuffer_reallocUnsafe($3 | 0, ($1 + 1 | 0) << 2 | 0 | 0) | 0;
@ -676,47 +676,42 @@ function asmFunc(global, env, buffer) {
HEAP32[(($3 + ($1 << 2 | 0) | 0) + 8 | 0) >> 2] = $2;
}
function $lib_array_Array_Body____get($0, $1) {
$0 = $0 | 0;
$1 = $1 | 0;
var $2 = 0;
$2 = HEAPU32[$0 >> 2] | 0;
if ($1 >>> 0 >= ((HEAP32[$2 >> 2] | 0) >>> 2 | 0) >>> 0) {
abort(0 | 0, 4 | 0, 64 | 0, 37 | 0);
abort();
}
return HEAPU32[(($2 + ($1 << 2 | 0) | 0) + 8 | 0) >> 2] | 0 | 0;
}
function assembly_index_NBodySystem_constructor($0, $1) {
$0 = $0 | 0;
$1 = $1 | 0;
var $3 = 0, $2 = 0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0, $8 = 0;
$3 = $1;
$8 = HEAP32[($3 + 4 | 0) >> 2] | 0;
var $2 = 0, $3 = 0, $5 = 0, $4 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $9 = 0, $9 = 0, $11 = 0, $12 = 0;
$2 = $1;
$9 = HEAP32[($2 + 4 | 0) >> 2] | 0;
continue_0 : do {
if (($2 | 0) < ($8 | 0)) {
$3 = $lib_array_Array_Body____get($1 | 0, $2 | 0) | 0;
$4 = +HEAPF64[($3 + 48 | 0) >> 3];
$5 = $5 + +HEAPF64[($3 + 24 | 0) >> 3] * $4;
$6 = $6 + +HEAPF64[($3 + 32 | 0) >> 3] * $4;
$7 = $7 + +HEAPF64[($3 + 40 | 0) >> 3] * $4;
$2 = $2 + 1 | 0;
if (($3 | 0) < ($9 | 0)) {
$2 = $3;
$5 = $1;
$5 = HEAPU32[$5 >> 2] | 0;
if ($2 >>> 0 < ((HEAP32[$5 >> 2] | 0) >>> 2 | 0) >>> 0) $11 = HEAPU32[(($5 + ($2 << 2 | 0) | 0) + 8 | 0) >> 2] | 0; else abort();
$2 = $11;
$4 = +HEAPF64[($2 + 48 | 0) >> 3];
$6 = $6 + +HEAPF64[($2 + 24 | 0) >> 3] * $4;
$7 = $7 + +HEAPF64[($2 + 32 | 0) >> 3] * $4;
$8 = $8 + +HEAPF64[($2 + 40 | 0) >> 3] * $4;
$3 = $3 + 1 | 0;
continue continue_0;
}
break continue_0;
} while (1);
if ($0) $8 = $0; else {
$2 = $lib_allocator_arena_allocate_memory(4 | 0) | 0;
HEAP32[$2 >> 2] = 0;
$0 = $2;
$8 = $0;
if ($0) $9 = $0; else {
$3 = $lib_allocator_arena_allocate_memory(4 | 0) | 0;
HEAP32[$3 >> 2] = 0;
$0 = $3;
$9 = $0;
}
HEAP32[$8 >> 2] = $1;
$1 = $lib_array_Array_Body____get(HEAPU32[$0 >> 2] | 0 | 0, 0 | 0) | 0;
HEAPF64[($1 + 24 | 0) >> 3] = -$5 / 39.47841760435743;
HEAPF64[($1 + 32 | 0) >> 3] = -$6 / 39.47841760435743;
HEAPF64[($1 + 40 | 0) >> 3] = -$7 / 39.47841760435743;
HEAP32[$9 >> 2] = $1;
$1 = HEAPU32[$0 >> 2] | 0;
$1 = HEAPU32[$1 >> 2] | 0;
if (0 >>> 0 < ((HEAP32[$1 >> 2] | 0) >>> 2 | 0) >>> 0) $12 = HEAPU32[(($1 + 0 | 0) + 8 | 0) >> 2] | 0; else abort();
$1 = $12;
HEAPF64[($1 + 24 | 0) >> 3] = -$6 / 39.47841760435743;
HEAPF64[($1 + 32 | 0) >> 3] = -$7 / 39.47841760435743;
HEAPF64[($1 + 40 | 0) >> 3] = -$8 / 39.47841760435743;
return $0 | 0;
}
@ -733,59 +728,72 @@ function asmFunc(global, env, buffer) {
function assembly_index_getBody($0) {
$0 = $0 | 0;
var $1 = 0, $2 = 0;
var $1 = 0, $2 = 0, $3 = 0;
$1 = HEAPU32[assembly_index_system >> 2] | 0;
if ($0 >>> 0 < (HEAP32[($1 + 4 | 0) >> 2] | 0) >>> 0) $2 = $lib_array_Array_Body____get($1 | 0, $0 | 0) | 0; else $2 = 0;
if ($0 >>> 0 < (HEAP32[($1 + 4 | 0) >> 2] | 0) >>> 0) {
$1 = HEAPU32[$1 >> 2] | 0;
if ($0 >>> 0 < ((HEAP32[$1 >> 2] | 0) >>> 2 | 0) >>> 0) $3 = HEAPU32[(($1 + ($0 << 2 | 0) | 0) + 8 | 0) >> 2] | 0; else abort();
$2 = $3;
} else $2 = 0;
return $2 | 0;
}
function assembly_index_NBodySystem_advance($0, $1) {
$0 = $0 | 0;
$1 = +$1;
var $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $9 = 0, $10 = 0.0, $11 = 0.0, $12 = 0.0, $13 = 0, $14 = 0, $15 = 0.0, $16 = 0.0, $17 = 0.0, $18 = 0.0;
var $2 = 0, $4 = 0.0, $3 = 0, $5 = 0.0, $6 = 0, $7 = 0.0, $8 = 0.0, $9 = 0.0, $10 = 0.0, $11 = 0.0, $12 = 0.0, $13 = 0, $14 = 0, $19 = 0, $16 = 0, $15 = 0.0, $16 = 0.0, $17 = 0.0, $18 = 0.0, $21 = 0.0, $22 = 0;
$13 = HEAPU32[$0 >> 2] | 0;
$0 = $13;
$14 = HEAP32[($0 + 4 | 0) >> 2] | 0;
continue_0 : do {
if (($5 | 0) < ($14 | 0)) {
$0 = $lib_array_Array_Body____get($13 | 0, $5 | 0) | 0;
if (($6 | 0) < ($14 | 0)) {
$3 = $6;
$0 = $13;
$0 = HEAPU32[$0 >> 2] | 0;
if ($3 >>> 0 < ((HEAP32[$0 >> 2] | 0) >>> 2 | 0) >>> 0) $16 = HEAPU32[(($0 + ($3 << 2 | 0) | 0) + 8 | 0) >> 2] | 0; else abort();
$0 = $16;
$15 = +HEAPF64[$0 >> 3];
$16 = +HEAPF64[($0 + 8 | 0) >> 3];
$17 = +HEAPF64[($0 + 16 | 0) >> 3];
$6 = +HEAPF64[($0 + 24 | 0) >> 3];
$7 = +HEAPF64[($0 + 32 | 0) >> 3];
$8 = +HEAPF64[($0 + 40 | 0) >> 3];
$7 = +HEAPF64[($0 + 24 | 0) >> 3];
$8 = +HEAPF64[($0 + 32 | 0) >> 3];
$9 = +HEAPF64[($0 + 40 | 0) >> 3];
$18 = +HEAPF64[($0 + 48 | 0) >> 3];
$9 = $5 + 1 | 0;
$3 = $6 + 1 | 0;
continue_1 : do {
if (($9 | 0) < ($14 | 0)) {
$2 = $lib_array_Array_Body____get($13 | 0, $9 | 0) | 0;
$10 = $15 - +HEAPF64[$2 >> 3];
if (($3 | 0) < ($14 | 0)) {
$21 = $15;
$19 = $3;
$2 = $13;
$2 = HEAPU32[$2 >> 2] | 0;
if ($19 >>> 0 < ((HEAP32[$2 >> 2] | 0) >>> 2 | 0) >>> 0) $22 = HEAPU32[(($2 + ($19 << 2 | 0) | 0) + 8 | 0) >> 2] | 0; else abort();
$2 = $22;
$10 = $21 - +HEAPF64[$2 >> 3];
$11 = $16 - +HEAPF64[($2 + 8 | 0) >> 3];
$12 = $17 - +HEAPF64[($2 + 16 | 0) >> 3];
$3 = $10 * $10 + $11 * $11 + $12 * $12;
$4 = Math_sqrt($3);
$3 = $1 / ($3 * $4);
$4 = $18 * $3;
$3 = +HEAPF64[($2 + 48 | 0) >> 3] * $3;
$6 = $6 - $10 * $3;
$7 = $7 - $11 * $3;
$8 = $8 - $12 * $3;
HEAPF64[($2 + 24 | 0) >> 3] = +HEAPF64[($2 + 24 | 0) >> 3] + $10 * $4;
HEAPF64[($2 + 32 | 0) >> 3] = +HEAPF64[($2 + 32 | 0) >> 3] + $11 * $4;
HEAPF64[($2 + 40 | 0) >> 3] = +HEAPF64[($2 + 40 | 0) >> 3] + $12 * $4;
$9 = $9 + 1 | 0;
$4 = $10 * $10 + $11 * $11 + $12 * $12;
$5 = Math_sqrt($4);
$4 = $1 / ($4 * $5);
$5 = $18 * $4;
$4 = +HEAPF64[($2 + 48 | 0) >> 3] * $4;
$7 = $7 - $10 * $4;
$8 = $8 - $11 * $4;
$9 = $9 - $12 * $4;
HEAPF64[($2 + 24 | 0) >> 3] = +HEAPF64[($2 + 24 | 0) >> 3] + $10 * $5;
HEAPF64[($2 + 32 | 0) >> 3] = +HEAPF64[($2 + 32 | 0) >> 3] + $11 * $5;
HEAPF64[($2 + 40 | 0) >> 3] = +HEAPF64[($2 + 40 | 0) >> 3] + $12 * $5;
$3 = $3 + 1 | 0;
continue continue_1;
}
break continue_1;
} while (1);
HEAPF64[($0 + 24 | 0) >> 3] = $6;
HEAPF64[($0 + 32 | 0) >> 3] = $7;
HEAPF64[($0 + 40 | 0) >> 3] = $8;
HEAPF64[$0 >> 3] = +HEAPF64[$0 >> 3] + $1 * $6;
HEAPF64[($0 + 8 | 0) >> 3] = +HEAPF64[($0 + 8 | 0) >> 3] + $1 * $7;
HEAPF64[($0 + 16 | 0) >> 3] = +HEAPF64[($0 + 16 | 0) >> 3] + $1 * $8;
$5 = $5 + 1 | 0;
HEAPF64[($0 + 24 | 0) >> 3] = $7;
HEAPF64[($0 + 32 | 0) >> 3] = $8;
HEAPF64[($0 + 40 | 0) >> 3] = $9;
HEAPF64[$0 >> 3] = +HEAPF64[$0 >> 3] + $1 * $7;
HEAPF64[($0 + 8 | 0) >> 3] = +HEAPF64[($0 + 8 | 0) >> 3] + $1 * $8;
HEAPF64[($0 + 16 | 0) >> 3] = +HEAPF64[($0 + 16 | 0) >> 3] + $1 * $9;
$6 = $6 + 1 | 0;
continue continue_0;
}
break continue_0;
@ -794,40 +802,49 @@ function asmFunc(global, env, buffer) {
function assembly_index_NBodySystem_energy($0) {
$0 = $0 | 0;
var $1 = 0.0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $10 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $9 = 0.0, $11 = 0.0, $12 = 0.0, $13 = 0.0, $14 = 0.0, $15 = 0.0;
var $1 = 0.0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $10 = 0.0, $11 = 0, $6 = 0.0, $9 = 0, $7 = 0.0, $8 = 0.0, $9 = 0.0, $13 = 0.0, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0, $18 = 0.0, $19 = 0.0;
$4 = HEAPU32[$0 >> 2] | 0;
$0 = $4;
$5 = HEAP32[($0 + 4 | 0) >> 2] | 0;
continue_0 : do {
if (($2 | 0) < ($5 | 0)) {
$0 = $lib_array_Array_Body____get($4 | 0, $2 | 0) | 0;
if (($3 | 0) < ($5 | 0)) {
$2 = $3;
$0 = $4;
$0 = HEAPU32[$0 >> 2] | 0;
if ($2 >>> 0 < ((HEAP32[$0 >> 2] | 0) >>> 2 | 0) >>> 0) $9 = HEAPU32[(($0 + ($2 << 2 | 0) | 0) + 8 | 0) >> 2] | 0; else abort();
$0 = $9;
$7 = +HEAPF64[$0 >> 3];
$8 = +HEAPF64[($0 + 8 | 0) >> 3];
$9 = +HEAPF64[($0 + 16 | 0) >> 3];
$11 = $1;
$13 = $1;
$10 = +HEAPF64[($0 + 48 | 0) >> 3];
$1 = +HEAPF64[($0 + 24 | 0) >> 3];
$12 = $1 * $1;
$14 = $1 * $1;
$1 = +HEAPF64[($0 + 32 | 0) >> 3];
$13 = $12 + $1 * $1;
$15 = $14 + $1 * $1;
$1 = +HEAPF64[($0 + 40 | 0) >> 3];
$1 = $11 + .5 * $10 * ($13 + $1 * $1);
$0 = $2 + 1 | 0;
$1 = $13 + .5 * $10 * ($15 + $1 * $1);
$0 = $3 + 1 | 0;
continue_1 : do {
if (($0 | 0) < ($5 | 0)) {
$3 = $lib_array_Array_Body____get($4 | 0, $0 | 0) | 0;
$6 = $7 - +HEAPF64[$3 >> 3];
$14 = $1;
$1 = $8 - +HEAPF64[($3 + 8 | 0) >> 3];
$15 = $6 * $6 + $1 * $1;
$1 = $9 - +HEAPF64[($3 + 16 | 0) >> 3];
$1 = $14 - $10 * +HEAPF64[($3 + 48 | 0) >> 3] / Math_sqrt($15 + $1 * $1);
$16 = $7;
$11 = $0;
$2 = $4;
$2 = HEAPU32[$2 >> 2] | 0;
if ($11 >>> 0 < ((HEAP32[$2 >> 2] | 0) >>> 2 | 0) >>> 0) $17 = HEAPU32[(($2 + ($11 << 2 | 0) | 0) + 8 | 0) >> 2] | 0; else abort();
$2 = $17;
$6 = $16 - +HEAPF64[$2 >> 3];
$18 = $1;
$1 = $8 - +HEAPF64[($2 + 8 | 0) >> 3];
$19 = $6 * $6 + $1 * $1;
$1 = $9 - +HEAPF64[($2 + 16 | 0) >> 3];
$1 = $18 - $10 * +HEAPF64[($2 + 48 | 0) >> 3] / Math_sqrt($19 + $1 * $1);
$0 = $0 + 1 | 0;
continue continue_1;
}
break continue_1;
} while (1);
$2 = $2 + 1 | 0;
$3 = $3 + 1 | 0;
continue continue_0;
}
break continue_0;

Binary file not shown.

View File

@ -2556,7 +2556,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -2597,53 +2597,18 @@
(get_local $2)
)
)
(func $~lib/array/Array<Body>#__get (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(if
(i32.ge_u
(get_local $1)
(i32.shr_u
(i32.load
(tee_local $2
(i32.load
(get_local $0)
)
)
)
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
)
(func $assembly/index/NBodySystem#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func $assembly/index/NBodySystem#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 f64)
(local $5 f64)
(local $5 i32)
(local $6 f64)
(local $7 f64)
(local $8 i32)
(set_local $8
(local $8 f64)
(local $9 i32)
(set_local $9
(i32.load offset=4
(tee_local $3
(tee_local $2
(get_local $1)
)
)
@ -2651,37 +2616,51 @@
(loop $continue|0
(if
(i32.lt_s
(get_local $2)
(get_local $8)
(get_local $3)
(get_local $9)
)
(block
(set_local $4
(f64.load offset=48
(tee_local $3
(call $~lib/array/Array<Body>#__get
(get_local $1)
(get_local $2)
(tee_local $2
(if (result i32)
(i32.lt_u
(tee_local $2
(get_local $3)
)
(i32.shr_u
(i32.load
(tee_local $5
(i32.load
(tee_local $5
(get_local $1)
)
)
)
)
(i32.const 2)
)
)
(i32.load offset=8
(i32.add
(get_local $5)
(i32.shl
(get_local $2)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
)
(set_local $5
(f64.add
(get_local $5)
(f64.mul
(f64.load offset=24
(get_local $3)
)
(get_local $4)
)
)
)
(set_local $6
(f64.add
(get_local $6)
(f64.mul
(f64.load offset=32
(get_local $3)
(f64.load offset=24
(get_local $2)
)
(get_local $4)
)
@ -2691,16 +2670,27 @@
(f64.add
(get_local $7)
(f64.mul
(f64.load offset=40
(get_local $3)
(f64.load offset=32
(get_local $2)
)
(get_local $4)
)
)
)
(set_local $2
(set_local $8
(f64.add
(get_local $8)
(f64.mul
(f64.load offset=40
(get_local $2)
)
(get_local $4)
)
)
)
(set_local $3
(i32.add
(get_local $2)
(get_local $3)
(i32.const 1)
)
)
@ -2714,7 +2704,7 @@
(get_local $0)
(block (result i32)
(i32.store
(tee_local $2
(tee_local $3
(call $~lib/allocator/arena/allocate_memory
(i32.const 4)
)
@ -2722,7 +2712,7 @@
(i32.const 0)
)
(tee_local $0
(get_local $2)
(get_local $3)
)
)
)
@ -2730,16 +2720,36 @@
)
(f64.store offset=24
(tee_local $1
(call $~lib/array/Array<Body>#__get
(i32.load
(get_local $0)
(if (result i32)
(i32.lt_u
(i32.const 0)
(i32.shr_u
(i32.load
(tee_local $1
(i32.load
(tee_local $1
(i32.load
(get_local $0)
)
)
)
)
)
(i32.const 2)
)
)
(i32.const 0)
(i32.load offset=8
(i32.add
(get_local $1)
(i32.const 0)
)
)
(unreachable)
)
)
(f64.div
(f64.neg
(get_local $5)
(get_local $6)
)
(f64.const 39.47841760435743)
)
@ -2748,7 +2758,7 @@
(get_local $1)
(f64.div
(f64.neg
(get_local $6)
(get_local $7)
)
(f64.const 39.47841760435743)
)
@ -2757,14 +2767,14 @@
(get_local $1)
(f64.div
(f64.neg
(get_local $7)
(get_local $8)
)
(f64.const 39.47841760435743)
)
)
(get_local $0)
)
(func $assembly/index/init (; 12 ;) (type $v)
(func $assembly/index/init (; 11 ;) (type $v)
(local $0 i32)
(set_global $assembly/index/system
(call $assembly/index/NBodySystem#constructor
@ -2850,7 +2860,7 @@
)
)
)
(func $assembly/index/getBody (; 13 ;) (type $ii) (param $0 i32) (result i32)
(func $assembly/index/getBody (; 12 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(if (result i32)
(i32.lt_u
@ -2863,22 +2873,43 @@
)
)
)
(call $~lib/array/Array<Body>#__get
(get_local $1)
(get_local $0)
(if (result i32)
(i32.lt_u
(get_local $0)
(i32.shr_u
(i32.load
(tee_local $1
(i32.load
(get_local $1)
)
)
)
(i32.const 2)
)
)
(i32.load offset=8
(i32.add
(get_local $1)
(i32.shl
(get_local $0)
(i32.const 2)
)
)
)
(unreachable)
)
(i32.const 0)
)
)
(func $assembly/index/NBodySystem#advance (; 14 ;) (type $iFv) (param $0 i32) (param $1 f64)
(func $assembly/index/NBodySystem#advance (; 13 ;) (type $iFv) (param $0 i32) (param $1 f64)
(local $2 i32)
(local $3 f64)
(local $3 i32)
(local $4 f64)
(local $5 i32)
(local $6 f64)
(local $5 f64)
(local $6 i32)
(local $7 f64)
(local $8 f64)
(local $9 i32)
(local $9 f64)
(local $10 f64)
(local $11 f64)
(local $12 f64)
@ -2888,6 +2919,7 @@
(local $16 f64)
(local $17 f64)
(local $18 f64)
(local $19 i32)
(set_local $14
(i32.load offset=4
(tee_local $0
@ -2902,16 +2934,41 @@
(loop $continue|0
(if
(i32.lt_s
(get_local $5)
(get_local $6)
(get_local $14)
)
(block
(set_local $15
(f64.load
(tee_local $0
(call $~lib/array/Array<Body>#__get
(get_local $13)
(get_local $5)
(if (result i32)
(i32.lt_u
(tee_local $3
(get_local $6)
)
(i32.shr_u
(i32.load
(tee_local $0
(i32.load
(tee_local $0
(get_local $13)
)
)
)
)
(i32.const 2)
)
)
(i32.load offset=8
(i32.add
(get_local $0)
(i32.shl
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
@ -2926,17 +2983,17 @@
(get_local $0)
)
)
(set_local $6
(set_local $7
(f64.load offset=24
(get_local $0)
)
)
(set_local $7
(set_local $8
(f64.load offset=32
(get_local $0)
)
)
(set_local $8
(set_local $9
(f64.load offset=40
(get_local $0)
)
@ -2946,22 +3003,22 @@
(get_local $0)
)
)
(set_local $9
(set_local $3
(i32.add
(get_local $5)
(get_local $6)
(i32.const 1)
)
)
(loop $continue|1
(if
(i32.lt_s
(get_local $9)
(get_local $3)
(get_local $14)
)
(block
(set_local $4
(set_local $5
(f64.sqrt
(tee_local $3
(tee_local $4
(f64.add
(f64.add
(f64.mul
@ -2970,9 +3027,34 @@
(get_local $15)
(f64.load
(tee_local $2
(call $~lib/array/Array<Body>#__get
(get_local $13)
(get_local $9)
(if (result i32)
(i32.lt_u
(tee_local $19
(get_local $3)
)
(i32.shr_u
(i32.load
(tee_local $2
(i32.load
(tee_local $2
(get_local $13)
)
)
)
)
(i32.const 2)
)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $19)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
@ -3007,31 +3089,15 @@
)
)
)
(set_local $4
(set_local $5
(f64.mul
(get_local $18)
(tee_local $3
(tee_local $4
(f64.div
(get_local $1)
(f64.mul
(get_local $3)
(get_local $4)
)
)
)
)
)
(set_local $6
(f64.sub
(get_local $6)
(f64.mul
(get_local $10)
(tee_local $3
(f64.mul
(f64.load offset=48
(get_local $2)
)
(get_local $3)
(get_local $5)
)
)
)
@ -3041,17 +3107,33 @@
(f64.sub
(get_local $7)
(f64.mul
(get_local $11)
(get_local $3)
(get_local $10)
(tee_local $4
(f64.mul
(f64.load offset=48
(get_local $2)
)
(get_local $4)
)
)
)
)
)
(set_local $8
(f64.sub
(get_local $8)
(f64.mul
(get_local $11)
(get_local $4)
)
)
)
(set_local $9
(f64.sub
(get_local $9)
(f64.mul
(get_local $12)
(get_local $3)
(get_local $4)
)
)
)
@ -3063,7 +3145,7 @@
)
(f64.mul
(get_local $10)
(get_local $4)
(get_local $5)
)
)
)
@ -3075,7 +3157,7 @@
)
(f64.mul
(get_local $11)
(get_local $4)
(get_local $5)
)
)
)
@ -3087,13 +3169,13 @@
)
(f64.mul
(get_local $12)
(get_local $4)
(get_local $5)
)
)
)
(set_local $9
(set_local $3
(i32.add
(get_local $9)
(get_local $3)
(i32.const 1)
)
)
@ -3103,15 +3185,15 @@
)
(f64.store offset=24
(get_local $0)
(get_local $6)
(get_local $7)
)
(f64.store offset=32
(get_local $0)
(get_local $7)
(get_local $8)
)
(f64.store offset=40
(get_local $0)
(get_local $8)
(get_local $9)
)
(f64.store
(get_local $0)
@ -3121,7 +3203,7 @@
)
(f64.mul
(get_local $1)
(get_local $6)
(get_local $7)
)
)
)
@ -3133,7 +3215,7 @@
)
(f64.mul
(get_local $1)
(get_local $7)
(get_local $8)
)
)
)
@ -3145,13 +3227,13 @@
)
(f64.mul
(get_local $1)
(get_local $8)
(get_local $9)
)
)
)
(set_local $5
(set_local $6
(i32.add
(get_local $5)
(get_local $6)
(i32.const 1)
)
)
@ -3160,7 +3242,7 @@
)
)
)
(func $assembly/index/NBodySystem#energy (; 15 ;) (type $iF) (param $0 i32) (result f64)
(func $assembly/index/NBodySystem#energy (; 14 ;) (type $iF) (param $0 i32) (result f64)
(local $1 f64)
(local $2 i32)
(local $3 i32)
@ -3171,6 +3253,7 @@
(local $8 f64)
(local $9 f64)
(local $10 f64)
(local $11 i32)
(set_local $5
(i32.load offset=4
(tee_local $0
@ -3185,16 +3268,41 @@
(loop $continue|0
(if
(i32.lt_s
(get_local $2)
(get_local $3)
(get_local $5)
)
(block
(set_local $7
(f64.load
(tee_local $0
(call $~lib/array/Array<Body>#__get
(get_local $4)
(get_local $2)
(if (result i32)
(i32.lt_u
(tee_local $2
(get_local $3)
)
(i32.shr_u
(i32.load
(tee_local $0
(i32.load
(tee_local $0
(get_local $4)
)
)
)
)
(i32.const 2)
)
)
(i32.load offset=8
(i32.add
(get_local $0)
(i32.shl
(get_local $2)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
@ -3254,7 +3362,7 @@
)
(set_local $0
(i32.add
(get_local $2)
(get_local $3)
(i32.const 1)
)
)
@ -3269,10 +3377,35 @@
(f64.sub
(get_local $7)
(f64.load
(tee_local $3
(call $~lib/array/Array<Body>#__get
(get_local $4)
(get_local $0)
(tee_local $2
(if (result i32)
(i32.lt_u
(tee_local $11
(get_local $0)
)
(i32.shr_u
(i32.load
(tee_local $2
(i32.load
(tee_local $2
(get_local $4)
)
)
)
)
(i32.const 2)
)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $11)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
@ -3285,7 +3418,7 @@
(f64.mul
(get_local $10)
(f64.load offset=48
(get_local $3)
(get_local $2)
)
)
(f64.sqrt
@ -3300,7 +3433,7 @@
(f64.sub
(get_local $8)
(f64.load offset=8
(get_local $3)
(get_local $2)
)
)
)
@ -3312,7 +3445,7 @@
(f64.sub
(get_local $9)
(f64.load offset=16
(get_local $3)
(get_local $2)
)
)
)
@ -3333,9 +3466,9 @@
)
)
)
(set_local $2
(set_local $3
(i32.add
(get_local $2)
(get_local $3)
(i32.const 1)
)
)
@ -3345,7 +3478,7 @@
)
(get_local $1)
)
(func $assembly/index/step (; 16 ;) (type $F) (result f64)
(func $assembly/index/step (; 15 ;) (type $F) (result f64)
(call $assembly/index/NBodySystem#advance
(get_global $assembly/index/system)
(f64.const 0.01)
@ -3354,7 +3487,7 @@
(get_global $assembly/index/system)
)
)
(func $assembly/index/bench (; 17 ;) (type $iv) (param $0 i32)
(func $assembly/index/bench (; 16 ;) (type $iv) (param $0 i32)
(local $1 i32)
(loop $continue|0
(if
@ -3378,7 +3511,7 @@
)
)
)
(func $start (; 18 ;) (type $v)
(func $start (; 17 ;) (type $v)
(set_global $~lib/allocator/arena/startOffset
(i32.and
(i32.add

View File

@ -3958,125 +3958,107 @@
(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)
;;@ ~lib/array.ts:71:4
;;@ ~lib/array.ts:77:4
(set_local $3
;;@ ~lib/array.ts:71:17
;;@ ~lib/array.ts:77:17
(i32.load
(get_local $0)
)
)
;;@ ~lib/array.ts:72:4
;;@ ~lib/array.ts:78:4
(set_local $4
;;@ ~lib/array.ts:72:19
;;@ ~lib/array.ts:78:19
(i32.shr_u
(i32.load
(get_local $3)
)
;;@ ~lib/array.ts:72:41
;;@ ~lib/array.ts:78:41
(i32.const 2)
)
)
;;@ ~lib/array.ts:73:4
;;@ ~lib/array.ts:79:4
(if
;;@ ~lib/array.ts:73:8
;;@ ~lib/array.ts:79:8
(i32.ge_u
(get_local $1)
;;@ ~lib/array.ts:73:22
;;@ ~lib/array.ts:79:22
(get_local $4)
)
;;@ ~lib/array.ts:73:37
;;@ ~lib/array.ts:79:37
(block
;;@ ~lib/array.ts:74:6
;;@ ~lib/array.ts:80:6
(nop)
;;@ ~lib/array.ts:75:6
;;@ ~lib/array.ts:81:6
(if
;;@ ~lib/array.ts:75:10
;;@ ~lib/array.ts:81:10
(i32.ge_u
(get_local $1)
;;@ ~lib/array.ts:75:24
;;@ ~lib/array.ts:81:24
(i32.const 268435454)
)
;;@ ~lib/array.ts:75:41
;;@ ~lib/array.ts:81:41
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
)
)
;;@ ~lib/array.ts:76:6
;;@ ~lib/array.ts:82:6
(set_local $3
;;@ ~lib/array.ts:76:15
;;@ ~lib/array.ts:82:15
(call $~lib/internal/arraybuffer/reallocUnsafe
;;@ ~lib/array.ts:76:29
;;@ ~lib/array.ts:82:29
(get_local $3)
;;@ ~lib/array.ts:76:37
;;@ ~lib/array.ts:82:37
(i32.shl
(i32.add
;;@ ~lib/array.ts:76:38
;;@ ~lib/array.ts:82:38
(get_local $1)
;;@ ~lib/array.ts:76:46
;;@ ~lib/array.ts:82:46
(i32.const 1)
)
;;@ ~lib/array.ts:76:52
;;@ ~lib/array.ts:82:52
(i32.const 2)
)
)
)
;;@ ~lib/array.ts:77:6
;;@ ~lib/array.ts:83:6
(i32.store
(get_local $0)
;;@ ~lib/array.ts:77:21
;;@ ~lib/array.ts:83:21
(get_local $3)
)
;;@ ~lib/array.ts:78:6
;;@ ~lib/array.ts:84:6
(i32.store offset=4
(get_local $0)
;;@ ~lib/array.ts:78:21
;;@ ~lib/array.ts:84:21
(i32.add
(get_local $1)
;;@ ~lib/array.ts:78:29
;;@ ~lib/array.ts:84:29
(i32.const 1)
)
)
)
)
;;@ ~lib/array.ts:81:4
(block $~lib/internal/arraybuffer/storeUnsafe<Body>|inlined.0
(set_local $5
;;@ ~lib/array.ts:81:19
;;@ ~lib/array.ts:86:4
(i32.store offset=8
;;@ ~lib/array.ts:86:13
(i32.add
(get_local $3)
)
(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 $5)
;;@ ~lib/internal/arraybuffer.ts:69:39
(i32.shl
;;@ ~lib/internal/arraybuffer.ts:69:40
(get_local $6)
;;@ ~lib/internal/arraybuffer.ts:69:56
(i32.const 2)
)
;;@ ~lib/array.ts:86:41
(i32.shl
;;@ ~lib/array.ts:86:42
(get_local $1)
;;@ ~lib/array.ts:86:58
(i32.const 2)
)
;;@ ~lib/internal/arraybuffer.ts:69:71
(get_local $7)
)
;;@ ~lib/array.ts:86:73
(get_local $2)
)
)
(func $~lib/array/Array<Body>#get:length (; 16 ;) (type $ii) (param $0 i32) (result i32)
@ -4090,9 +4072,6 @@
)
(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)
(local $5 i32)
;;@ ~lib/array.ts:62:4
(set_local $2
;;@ ~lib/array.ts:62:17
@ -4100,65 +4079,38 @@
(get_local $0)
)
)
;;@ ~lib/array.ts:63:4
(set_local $3
;;@ ~lib/array.ts:63:19
(i32.shr_u
(i32.load
(get_local $2)
)
;;@ ~lib/array.ts:63:41
(i32.const 2)
)
)
;;@ ~lib/array.ts:64:4
(if
;;@ ~lib/array.ts:64:8
(i32.ge_u
(get_local $1)
;;@ ~lib/array.ts:64:22
(get_local $3)
)
;;@ ~lib/array.ts:64:37
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
;;@ ~lib/array.ts:66:38
;;@ ~lib/array.ts:66:20
(return
;;@ ~lib/array.ts:66:11
(block $~lib/internal/arraybuffer/loadUnsafe<Body>|inlined.0 (result i32)
(set_local $4
;;@ ~lib/array.ts:66:25
(get_local $2)
)
(set_local $5
;;@ ~lib/array.ts:66:33
;;@ ~lib/array.ts:63:11
(if (result i32)
(i32.lt_u
(get_local $1)
;;@ ~lib/array.ts:63:24
(i32.shr_u
;;@ ~lib/array.ts:63:30
(i32.load
(get_local $2)
)
;;@ ~lib/array.ts:63:52
(i32.const 2)
)
)
;;@ ~lib/internal/arraybuffer.ts:64:88
(br $~lib/internal/arraybuffer/loadUnsafe<Body>|inlined.0
;;@ ~lib/internal/arraybuffer.ts:64:9
(i32.load offset=8
;;@ ~lib/internal/arraybuffer.ts:64:17
(i32.add
(get_local $4)
;;@ ~lib/internal/arraybuffer.ts:64:45
(i32.shl
;;@ ~lib/internal/arraybuffer.ts:64:46
(get_local $5)
;;@ ~lib/internal/arraybuffer.ts:64:62
(i32.const 2)
)
;;@ ~lib/array.ts:64:8
(i32.load offset=8
;;@ ~lib/array.ts:64:16
(i32.add
(get_local $2)
;;@ ~lib/array.ts:64:44
(i32.shl
;;@ ~lib/array.ts:64:45
(get_local $1)
;;@ ~lib/array.ts:64:61
(i32.const 2)
)
)
)
;;@ ~lib/array.ts:66:8
(unreachable)
)
)
)

View File

@ -34,7 +34,7 @@ function test(nbody, steps) {
return process.hrtime(start);
}
var steps = process.argv.length > 2 ? parseInt(process.argv[2], 10) : 10000000;
var steps = process.argv.length > 2 ? parseInt(process.argv[2], 10) : 20000000;
console.log("Warming up ...");
test(nbodyWASM, 100000);

View File

@ -60,10 +60,16 @@ export class Array<T> {
@operator("[]")
private __get(index: i32): T {
var buffer = this.buffer_;
var capacity = buffer.byteLength >>> alignof<T>();
if (<u32>index >= <u32>capacity) throw new Error("Index out of bounds");
// return load<T>(changetype<usize>(buffer) + (<usize>index << alignof<T>()), HEADER_SIZE_AB);
return loadUnsafe<T>(buffer, index);
return <u32>index < <u32>(buffer.byteLength >>> alignof<T>())
? load<T>(changetype<usize>(buffer) + (<usize>index << alignof<T>()), HEADER_SIZE_AB)
// ^= loadUnsafe<T>(buffer, index)
: <T>unreachable();
// FIXME: using a plain if-else here (as below) results in n-body being about 25% slower?
// if (<u32>index < <u32>(buffer.byteLength >>> alignof<T>())) {
// return load<T>(changetype<usize>(buffer) + (<usize>index << alignof<T>()), HEADER_SIZE_AB);
// } else {
// throw new Error("Index out of bounds");
// }
}
@operator("[]=")
@ -77,8 +83,8 @@ export class Array<T> {
this.buffer_ = buffer;
this.length_ = index + 1;
}
// store<T>(changetype<usize>(buffer) + (<usize>index << alignof<T>()), value, HEADER_SIZE_AB);
storeUnsafe<T>(buffer, index, value);
store<T>(changetype<usize>(buffer) + (<usize>index << alignof<T>()), value, HEADER_SIZE_AB);
// ^= storeUnsafe<T>(buffer, index, value)
}
includes(searchElement: T, fromIndex: i32 = 0): bool {

View File

@ -1,14 +1,13 @@
(module
(type $ii (func (param i32) (result i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~argc (mut i32) (i32.const 0))
(memory $0 1)
(data (i32.const 4) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s")
(data (i32.const 40) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
(data (i32.const 72) "\04\00\00\00n\00u\00l\00l")
(data (i32.const 8) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s")
(data (i32.const 40) "\04\00\00\00n\00u\00l\00l")
(export "i32ArrayArrayElementAccess" (func $std/array-access/i32ArrayArrayElementAccess))
(export "stringArrayPropertyAccess" (func $std/array-access/stringArrayPropertyAccess))
(export "stringArrayMethodCall" (func $std/array-access/stringArrayMethodCall))
@ -17,8 +16,8 @@
(export "memory" (memory $0))
(func $~lib/array/Array<Array<i32>>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(if
(i32.ge_u
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
@ -31,24 +30,16 @@
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
(func $std/array-access/i32ArrayArrayElementAccess (; 2 ;) (type $ii) (param $0 i32) (result i32)
@ -139,7 +130,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 40)
(i32.const 8)
(i32.const 231)
(i32.const 4)
)
@ -151,7 +142,7 @@
(get_local $1)
)
(set_local $1
(i32.const 72)
(i32.const 40)
)
)
(if
@ -249,7 +240,7 @@
(get_local $0)
(i32.const 0)
)
(i32.const 36)
(i32.const 4)
(i32.const 0)
)
)
@ -276,7 +267,7 @@
)
(i32.const 1)
)
(i32.const 36)
(i32.const 4)
(i32.const 0)
)
)

View File

@ -2,8 +2,8 @@
(type $ii (func (param i32) (result i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $i (func (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
@ -11,12 +11,11 @@
(global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8))
(global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4))
(global $~argc (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 84))
(global $HEAP_BASE i32 (i32.const 52))
(memory $0 1)
(data (i32.const 4) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00")
(data (i32.const 36) "\00\00\00\00")
(data (i32.const 40) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
(data (i32.const 72) "\04\00\00\00n\00u\00l\00l\00")
(data (i32.const 4) "\00\00\00\00")
(data (i32.const 8) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00")
(data (i32.const 40) "\04\00\00\00n\00u\00l\00l\00")
(export "i32ArrayArrayElementAccess" (func $std/array-access/i32ArrayArrayElementAccess))
(export "stringArrayPropertyAccess" (func $std/array-access/stringArrayPropertyAccess))
(export "stringArrayMethodCall" (func $std/array-access/stringArrayMethodCall))
@ -25,111 +24,63 @@
(export "memory" (memory $0))
(func $~lib/array/Array<Array<i32>>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(if
(i32.ge_u
(get_local $1)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(return
(block $~lib/internal/arraybuffer/loadUnsafe<Array<i32>>|inlined.0 (result i32)
(set_local $4
(get_local $2)
)
(set_local $5
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(br $~lib/internal/arraybuffer/loadUnsafe<Array<i32>>|inlined.0
(i32.load offset=8
(i32.add
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 2)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(if
(i32.ge_u
(get_local $1)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(return
(block $~lib/internal/arraybuffer/loadUnsafe<i32>|inlined.0 (result i32)
(set_local $4
(get_local $2)
)
(set_local $5
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(br $~lib/internal/arraybuffer/loadUnsafe<i32>|inlined.0
(i32.load offset=8
(i32.add
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 2)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
@ -146,56 +97,32 @@
)
(func $~lib/array/Array<String>#__get (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(if
(i32.ge_u
(get_local $1)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(return
(block $~lib/internal/arraybuffer/loadUnsafe<String>|inlined.0 (result i32)
(set_local $4
(get_local $2)
)
(set_local $5
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(br $~lib/internal/arraybuffer/loadUnsafe<String>|inlined.0
(i32.load offset=8
(i32.add
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 2)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
@ -292,7 +219,7 @@
(block
(call $abort
(i32.const 0)
(i32.const 40)
(i32.const 8)
(i32.const 231)
(i32.const 4)
)
@ -305,7 +232,7 @@
(i32.const 0)
)
(set_local $1
(i32.const 72)
(i32.const 40)
)
)
(set_local $3
@ -417,7 +344,7 @@
(get_local $0)
(i32.const 0)
)
(i32.const 36)
(i32.const 4)
(i32.const 0)
)
)
@ -425,56 +352,32 @@
)
(func $~lib/array/Array<Array<String>>#__get (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(if
(i32.ge_u
(get_local $1)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(return
(block $~lib/internal/arraybuffer/loadUnsafe<Array<String>>|inlined.0 (result i32)
(set_local $4
(get_local $2)
)
(set_local $5
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(br $~lib/internal/arraybuffer/loadUnsafe<Array<String>>|inlined.0
(i32.load offset=8
(i32.add
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 2)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
@ -505,7 +408,7 @@
)
(i32.const 1)
)
(i32.const 36)
(i32.const 4)
(i32.const 0)
)
)

View File

@ -26,8 +26,8 @@
)
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(if
(i32.ge_u
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
@ -40,24 +40,16 @@
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 92)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
(func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32)
@ -2593,7 +2585,7 @@
(call $abort
(i32.const 0)
(i32.const 92)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)

View File

@ -35,56 +35,32 @@
)
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(if
(i32.ge_u
(get_local $1)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 92)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(return
(block $~lib/internal/arraybuffer/loadUnsafe<i32>|inlined.0 (result i32)
(set_local $4
(get_local $2)
)
(set_local $5
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(br $~lib/internal/arraybuffer/loadUnsafe<i32>|inlined.0
(i32.load offset=8
(i32.add
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 2)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
@ -2919,9 +2895,6 @@
(func $~lib/array/Array<i32>#__set (; 11 ;) (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)
(set_local $3
(i32.load
(get_local $0)
@ -2951,7 +2924,7 @@
(call $abort
(i32.const 0)
(i32.const 92)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -2982,26 +2955,15 @@
)
)
)
(block $~lib/internal/arraybuffer/storeUnsafe<i32>|inlined.0
(set_local $5
(i32.store offset=8
(i32.add
(get_local $3)
)
(set_local $6
(get_local $1)
)
(set_local $7
(get_local $2)
)
(i32.store offset=8
(i32.add
(get_local $5)
(i32.shl
(get_local $6)
(i32.const 2)
)
(i32.shl
(get_local $1)
(i32.const 2)
)
(get_local $7)
)
(get_local $2)
)
)
(func $start (; 12 ;) (type $v)

View File

@ -2653,7 +2653,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 128)
(i32.const 134)
(i32.const 42)
)
(unreachable)
@ -2691,8 +2691,8 @@
)
(func $~lib/array/Array<i32>#__get (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(if
(i32.ge_u
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
@ -2705,24 +2705,16 @@
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
(func $~lib/array/Array<i32>#pop (; 15 ;) (type $ii) (param $0 i32) (result i32)
@ -2741,7 +2733,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 139)
(i32.const 145)
(i32.const 20)
)
(unreachable)
@ -2812,7 +2804,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 229)
(i32.const 235)
(i32.const 42)
)
(unreachable)
@ -2884,7 +2876,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 200)
(i32.const 206)
(i32.const 20)
)
(unreachable)
@ -3372,7 +3364,7 @@
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -3944,8 +3936,8 @@
)
(func $~lib/array/Array<f32>#__get (; 49 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32)
(local $2 i32)
(if
(i32.ge_u
(if (result f32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
@ -3958,24 +3950,16 @@
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 4)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(f32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
(f32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
(func $start~anonymous|21 (; 50 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)

File diff suppressed because it is too large Load Diff

View File

@ -33,8 +33,8 @@
)
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(if
(i32.ge_u
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
@ -47,24 +47,16 @@
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
(func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32)
@ -2548,7 +2540,7 @@
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -2591,8 +2583,8 @@
)
(func $~lib/array/Array<i64>#__get (; 11 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64)
(local $2 i32)
(if
(i32.ge_u
(if (result i64)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
@ -2605,24 +2597,16 @@
(i32.const 3)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(i64.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 3)
(i64.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 3)
)
)
)
(unreachable)
)
)
(func $~lib/array/Array<i64>#__set (; 12 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64)
@ -2651,7 +2635,7 @@
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -2694,8 +2678,8 @@
)
(func $~lib/array/Array<f32>#__get (; 13 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32)
(local $2 i32)
(if
(i32.ge_u
(if (result f32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
@ -2708,24 +2692,16 @@
(i32.const 2)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(f32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
(f32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
(func $~lib/array/Array<f32>#__set (; 14 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32)
@ -2754,7 +2730,7 @@
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -2797,8 +2773,8 @@
)
(func $~lib/array/Array<f64>#__get (; 15 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(local $2 i32)
(if
(i32.ge_u
(if (result f64)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
@ -2811,24 +2787,16 @@
(i32.const 3)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(f64.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 3)
(f64.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 3)
)
)
)
(unreachable)
)
)
(func $~lib/array/Array<f64>#__set (; 16 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
@ -2857,7 +2825,7 @@
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)

View File

@ -47,56 +47,32 @@
)
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(if
(i32.ge_u
(get_local $1)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(return
(block $~lib/internal/arraybuffer/loadUnsafe<i32>|inlined.0 (result i32)
(set_local $4
(get_local $2)
)
(set_local $5
(if (result i32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(br $~lib/internal/arraybuffer/loadUnsafe<i32>|inlined.0
(i32.load offset=8
(i32.add
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 2)
)
(i32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
@ -2873,9 +2849,6 @@
(func $~lib/array/Array<i32>#__set (; 10 ;) (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)
(set_local $3
(i32.load
(get_local $0)
@ -2905,7 +2878,7 @@
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -2936,26 +2909,15 @@
)
)
)
(block $~lib/internal/arraybuffer/storeUnsafe<i32>|inlined.0
(set_local $5
(i32.store offset=8
(i32.add
(get_local $3)
)
(set_local $6
(get_local $1)
)
(set_local $7
(get_local $2)
)
(i32.store offset=8
(i32.add
(get_local $5)
(i32.shl
(get_local $6)
(i32.const 2)
)
(i32.shl
(get_local $1)
(i32.const 2)
)
(get_local $7)
)
(get_local $2)
)
)
(func $~lib/array/Array<i64>#get:length (; 11 ;) (type $ii) (param $0 i32) (result i32)
@ -2967,65 +2929,38 @@
)
(func $~lib/array/Array<i64>#__get (; 12 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 3)
)
)
(if
(i32.ge_u
(get_local $1)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(return
(block $~lib/internal/arraybuffer/loadUnsafe<i64>|inlined.0 (result i64)
(set_local $4
(get_local $2)
)
(set_local $5
(if (result i64)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 3)
)
)
(br $~lib/internal/arraybuffer/loadUnsafe<i64>|inlined.0
(i64.load offset=8
(i32.add
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 3)
)
(i64.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 3)
)
)
)
(unreachable)
)
)
)
(func $~lib/array/Array<i64>#__set (; 13 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
(local $7 i64)
(set_local $3
(i32.load
(get_local $0)
@ -3055,7 +2990,7 @@
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -3086,26 +3021,15 @@
)
)
)
(block $~lib/internal/arraybuffer/storeUnsafe<i64>|inlined.0
(set_local $5
(i64.store offset=8
(i32.add
(get_local $3)
)
(set_local $6
(get_local $1)
)
(set_local $7
(get_local $2)
)
(i64.store offset=8
(i32.add
(get_local $5)
(i32.shl
(get_local $6)
(i32.const 3)
)
(i32.shl
(get_local $1)
(i32.const 3)
)
(get_local $7)
)
(get_local $2)
)
)
(func $~lib/array/Array<f32>#get:length (; 14 ;) (type $ii) (param $0 i32) (result i32)
@ -3117,65 +3041,38 @@
)
(func $~lib/array/Array<f32>#__get (; 15 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(if
(i32.ge_u
(get_local $1)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(return
(block $~lib/internal/arraybuffer/loadUnsafe<f32>|inlined.0 (result f32)
(set_local $4
(get_local $2)
)
(set_local $5
(if (result f32)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 2)
)
)
(br $~lib/internal/arraybuffer/loadUnsafe<f32>|inlined.0
(f32.load offset=8
(i32.add
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 2)
)
(f32.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 2)
)
)
)
(unreachable)
)
)
)
(func $~lib/array/Array<f32>#__set (; 16 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
(local $7 f32)
(set_local $3
(i32.load
(get_local $0)
@ -3205,7 +3102,7 @@
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -3236,26 +3133,15 @@
)
)
)
(block $~lib/internal/arraybuffer/storeUnsafe<f32>|inlined.0
(set_local $5
(f32.store offset=8
(i32.add
(get_local $3)
)
(set_local $6
(get_local $1)
)
(set_local $7
(get_local $2)
)
(f32.store offset=8
(i32.add
(get_local $5)
(i32.shl
(get_local $6)
(i32.const 2)
)
(i32.shl
(get_local $1)
(i32.const 2)
)
(get_local $7)
)
(get_local $2)
)
)
(func $~lib/array/Array<f64>#get:length (; 17 ;) (type $ii) (param $0 i32) (result i32)
@ -3267,65 +3153,38 @@
)
(func $~lib/array/Array<f64>#__get (; 18 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 3)
)
)
(if
(i32.ge_u
(get_local $1)
(get_local $3)
)
(block
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 64)
(i32.const 37)
)
(unreachable)
)
)
(return
(block $~lib/internal/arraybuffer/loadUnsafe<f64>|inlined.0 (result f64)
(set_local $4
(get_local $2)
)
(set_local $5
(if (result f64)
(i32.lt_u
(get_local $1)
(i32.shr_u
(i32.load
(get_local $2)
)
(i32.const 3)
)
)
(br $~lib/internal/arraybuffer/loadUnsafe<f64>|inlined.0
(f64.load offset=8
(i32.add
(get_local $4)
(i32.shl
(get_local $5)
(i32.const 3)
)
(f64.load offset=8
(i32.add
(get_local $2)
(i32.shl
(get_local $1)
(i32.const 3)
)
)
)
(unreachable)
)
)
)
(func $~lib/array/Array<f64>#__set (; 19 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
(local $7 f64)
(set_local $3
(i32.load
(get_local $0)
@ -3355,7 +3214,7 @@
(call $abort
(i32.const 0)
(i32.const 180)
(i32.const 75)
(i32.const 81)
(i32.const 41)
)
(unreachable)
@ -3386,26 +3245,15 @@
)
)
)
(block $~lib/internal/arraybuffer/storeUnsafe<f64>|inlined.0
(set_local $5
(f64.store offset=8
(i32.add
(get_local $3)
)
(set_local $6
(get_local $1)
)
(set_local $7
(get_local $2)
)
(f64.store offset=8
(i32.add
(get_local $5)
(i32.shl
(get_local $6)
(i32.const 3)
)
(i32.shl
(get_local $1)
(i32.const 3)
)
(get_local $7)
)
(get_local $2)
)
)
(func $start (; 20 ;) (type $v)