mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-30 21:52:18 +00:00
FixedArray experimentation
This commit is contained in:
@@ -84,7 +84,7 @@ function Neptune(): Body {
|
||||
|
||||
class NBodySystem {
|
||||
|
||||
constructor(public bodies: Body[]) {
|
||||
constructor(public bodies: FixedArray<Body>) {
|
||||
var px: float = 0.0;
|
||||
var py: float = 0.0;
|
||||
var pz: float = 0.0;
|
||||
@@ -186,13 +186,15 @@ class NBodySystem {
|
||||
var system: NBodySystem;
|
||||
|
||||
export function init(): void {
|
||||
system = new NBodySystem([
|
||||
Sun(),
|
||||
Jupiter(),
|
||||
Saturn(),
|
||||
Uranus(),
|
||||
Neptune()
|
||||
]);
|
||||
var bodies = new FixedArray<Body>(5);
|
||||
unchecked((
|
||||
bodies[0] = Sun(),
|
||||
bodies[1] = Jupiter(),
|
||||
bodies[2] = Saturn(),
|
||||
bodies[3] = Uranus(),
|
||||
bodies[4] = Neptune()
|
||||
));
|
||||
system = new NBodySystem(bodies);
|
||||
}
|
||||
|
||||
export function step(): float {
|
||||
|
@@ -52,79 +52,6 @@ function asmFunc(global, env, buffer) {
|
||||
return $1 + 8 | 0 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_NBodySystem_constructor($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0, wasm2js_i32$1 = 0;
|
||||
$7 = HEAP32[($0 + 12 | 0) >> 2] | 0;
|
||||
repeat_0 : do {
|
||||
if (($1 | 0) < ($7 | 0)) {
|
||||
$2 = HEAPU32[((HEAP32[($0 + 4 | 0) >> 2] | 0) + ($1 << 2 | 0) | 0) >> 2] | 0;
|
||||
$3 = +HEAPF64[($2 + 48 | 0) >> 3];
|
||||
$4 = $4 + +HEAPF64[($2 + 24 | 0) >> 3] * $3;
|
||||
$5 = $5 + +HEAPF64[($2 + 32 | 0) >> 3] * $3;
|
||||
$6 = $6 + +HEAPF64[($2 + 40 | 0) >> 3] * $3;
|
||||
$1 = $1 + 1 | 0;
|
||||
continue repeat_0;
|
||||
}
|
||||
break repeat_0;
|
||||
} while (1);
|
||||
$1 = HEAPU32[(HEAP32[($0 + 4 | 0) >> 2] | 0) >> 2] | 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$4 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$5 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$6 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
$1 = $lib_runtime_doAllocate(4 | 0) | 0;
|
||||
wasm2js_i32$0 = $1 - 8 | 0;
|
||||
wasm2js_i32$1 = 1;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
return $1 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6) {
|
||||
$0 = +$0;
|
||||
$1 = +$1;
|
||||
$2 = +$2;
|
||||
$3 = +$3;
|
||||
$4 = +$4;
|
||||
$5 = +$5;
|
||||
$6 = +$6;
|
||||
var $7 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_f64$0 = 0.0;
|
||||
$7 = $lib_runtime_doAllocate(56 | 0) | 0;
|
||||
wasm2js_i32$0 = $7 - 8 | 0;
|
||||
wasm2js_i32$1 = 2;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $0;
|
||||
HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $1;
|
||||
HEAPF64[(wasm2js_i32$0 + 8 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $2;
|
||||
HEAPF64[(wasm2js_i32$0 + 16 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $3;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $4;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $5;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $6;
|
||||
HEAPF64[(wasm2js_i32$0 + 48 | 0) >> 3] = wasm2js_f64$0;
|
||||
return $7 | 0;
|
||||
}
|
||||
|
||||
function $lib_memory_memory_fill($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, $2 = 0, i64toi32_i32$1 = 0, i64toi32_i32$0 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_i32$2 = 0, wasm2js_i32$3 = 0;
|
||||
@@ -250,87 +177,112 @@ function asmFunc(global, env, buffer) {
|
||||
};
|
||||
}
|
||||
|
||||
function $lib_runtime_ArrayBufferView_constructor($0) {
|
||||
function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6) {
|
||||
$0 = +$0;
|
||||
$1 = +$1;
|
||||
$2 = +$2;
|
||||
$3 = +$3;
|
||||
$4 = +$4;
|
||||
$5 = +$5;
|
||||
$6 = +$6;
|
||||
var $7 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_f64$0 = 0.0;
|
||||
$7 = $lib_runtime_doAllocate(56 | 0) | 0;
|
||||
wasm2js_i32$0 = $7 - 8 | 0;
|
||||
wasm2js_i32$1 = 3;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $0;
|
||||
HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $1;
|
||||
HEAPF64[(wasm2js_i32$0 + 8 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $2;
|
||||
HEAPF64[(wasm2js_i32$0 + 16 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $3;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $4;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $5;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $6;
|
||||
HEAPF64[(wasm2js_i32$0 + 48 | 0) >> 3] = wasm2js_f64$0;
|
||||
return $7 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_NBodySystem_constructor($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$1 = $lib_runtime_doAllocate(20 | 0) | 0;
|
||||
$lib_memory_memory_fill($1 | 0);
|
||||
var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0, wasm2js_i32$1 = 0;
|
||||
$7 = (HEAPU32[(($0 - 8 | 0) + 4 | 0) >> 2] | 0) >>> 2 | 0;
|
||||
repeat_0 : do {
|
||||
if (($1 | 0) < ($7 | 0)) {
|
||||
$2 = HEAPU32[(($1 << 2 | 0) + $0 | 0) >> 2] | 0;
|
||||
$3 = +HEAPF64[($2 + 48 | 0) >> 3];
|
||||
$4 = $4 + +HEAPF64[($2 + 24 | 0) >> 3] * $3;
|
||||
$5 = $5 + +HEAPF64[($2 + 32 | 0) >> 3] * $3;
|
||||
$6 = $6 + +HEAPF64[($2 + 40 | 0) >> 3] * $3;
|
||||
$1 = $1 + 1 | 0;
|
||||
continue repeat_0;
|
||||
}
|
||||
break repeat_0;
|
||||
} while (1);
|
||||
$1 = HEAPU32[$0 >> 2] | 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$4 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$5 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$6 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
$1 = $lib_runtime_doAllocate(4 | 0) | 0;
|
||||
wasm2js_i32$0 = $1 - 8 | 0;
|
||||
wasm2js_i32$1 = 4;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
if (($0 | 0) == (0 | 0)) {
|
||||
$0 = $lib_runtime_doAllocate(12 | 0) | 0;
|
||||
wasm2js_i32$0 = $0 - 8 | 0;
|
||||
wasm2js_i32$1 = 5;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
}
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = $1;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = $1;
|
||||
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 20;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
return $0 | 0;
|
||||
}
|
||||
|
||||
function $lib_array_Array_Body__constructor() {
|
||||
var $0 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$0 = $lib_runtime_doAllocate(16 | 0) | 0;
|
||||
wasm2js_i32$0 = $0 - 8 | 0;
|
||||
wasm2js_i32$1 = 6;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$0 = $lib_runtime_ArrayBufferView_constructor($0 | 0) | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 5;
|
||||
HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1;
|
||||
return $0 | 0;
|
||||
return $1 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_init() {
|
||||
var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$1 = $lib_array_Array_Body__constructor() | 0;
|
||||
$0 = HEAPU32[($1 + 4 | 0) >> 2] | 0;
|
||||
var $0 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$0 = $lib_runtime_doAllocate(20 | 0) | 0;
|
||||
$lib_memory_memory_fill($0 | 0);
|
||||
wasm2js_i32$0 = $0 - 8 | 0;
|
||||
wasm2js_i32$1 = 2;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = assembly_index_Body_constructor(+(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$0 = $0 + 4 | 0;
|
||||
wasm2js_i32$1 = assembly_index_Body_constructor(+(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0;
|
||||
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 8 | 0;
|
||||
wasm2js_i32$1 = assembly_index_Body_constructor(+(8.34336671824458), +(4.124798564124305), +(-.4035234171143214), +(-1.0107743461787924), +(1.8256623712304119), +(.008415761376584154), +(.011286326131968767)) | 0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 12 | 0;
|
||||
wasm2js_i32$1 = assembly_index_Body_constructor(+(12.894369562139131), +(-15.111151401698631), +(-.22330757889265573), +(1.0827910064415354), +(.8687130181696082), +(-.010832637401363636), +(1.7237240570597112e-03)) | 0;
|
||||
HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 16 | 0;
|
||||
wasm2js_i32$1 = assembly_index_Body_constructor(+(15.379697114850917), +(-25.919314609987964), +(.17925877295037118), +(.979090732243898), +(.5946989986476762), +(-.034755955504078104), +(2.0336868699246304e-03)) | 0;
|
||||
HEAP32[(wasm2js_i32$0 + 16 | 0) >> 2] = wasm2js_i32$1;
|
||||
assembly_index_system = assembly_index_NBodySystem_constructor($1 | 0) | 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
assembly_index_system = assembly_index_NBodySystem_constructor($0 | 0) | 0;
|
||||
}
|
||||
|
||||
function assembly_index_NBodySystem_advance($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, $2 = 0.0, $8 = 0.0, $3 = 0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, $9 = 0.0, $10 = 0.0, $11 = 0.0, $12 = 0, $13 = 0, $18 = 0.0, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0;
|
||||
$12 = HEAPU32[$0 >> 2] | 0;
|
||||
$13 = HEAP32[($12 + 12 | 0) >> 2] | 0;
|
||||
$13 = (HEAPU32[(($12 - 8 | 0) + 4 | 0) >> 2] | 0) >>> 2 | 0;
|
||||
repeat_0 : do {
|
||||
if ($3 >>> 0 < $13 >>> 0) {
|
||||
$0 = HEAPU32[((HEAP32[($12 + 4 | 0) >> 2] | 0) + ($3 << 2 | 0) | 0) >> 2] | 0;
|
||||
$0 = HEAPU32[(($3 << 2 | 0) + $12 | 0) >> 2] | 0;
|
||||
$14 = +HEAPF64[$0 >> 3];
|
||||
$15 = +HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$16 = +HEAPF64[($0 + 16 | 0) >> 3];
|
||||
@@ -341,7 +293,7 @@ function asmFunc(global, env, buffer) {
|
||||
$7 = $3 + 1 | 0;
|
||||
repeat_1 : do {
|
||||
if ($7 >>> 0 < $13 >>> 0) {
|
||||
$1 = HEAPU32[((HEAP32[($12 + 4 | 0) >> 2] | 0) + ($7 << 2 | 0) | 0) >> 2] | 0;
|
||||
$1 = HEAPU32[(($7 << 2 | 0) + $12 | 0) >> 2] | 0;
|
||||
$18 = $14 - +HEAPF64[$1 >> 3];
|
||||
$2 = $18;
|
||||
$9 = $15 - +HEAPF64[($1 + 8 | 0) >> 3];
|
||||
@@ -395,28 +347,28 @@ 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, $9 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $30 = 0.0, $39 = 0.0, $45 = 0.0, $10 = 0.0, $72 = 0.0, $86 = 0.0;
|
||||
var $1 = 0.0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $9 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $31 = 0.0, $40 = 0.0, $46 = 0.0, $10 = 0.0, $72 = 0.0, $86 = 0.0;
|
||||
$4 = HEAPU32[$0 >> 2] | 0;
|
||||
$5 = HEAP32[($4 + 12 | 0) >> 2] | 0;
|
||||
$5 = (HEAPU32[(($4 - 8 | 0) + 4 | 0) >> 2] | 0) >>> 2 | 0;
|
||||
repeat_0 : do {
|
||||
if ($2 >>> 0 < $5 >>> 0) {
|
||||
$0 = HEAPU32[((HEAP32[($4 + 4 | 0) >> 2] | 0) + ($2 << 2 | 0) | 0) >> 2] | 0;
|
||||
$0 = HEAPU32[(($2 << 2 | 0) + $4 | 0) >> 2] | 0;
|
||||
$6 = +HEAPF64[$0 >> 3];
|
||||
$7 = +HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$8 = +HEAPF64[($0 + 16 | 0) >> 3];
|
||||
$30 = $1;
|
||||
$31 = $1;
|
||||
$9 = +HEAPF64[($0 + 48 | 0) >> 3];
|
||||
$1 = +HEAPF64[($0 + 24 | 0) >> 3];
|
||||
$39 = $1 * $1;
|
||||
$40 = $1 * $1;
|
||||
$1 = +HEAPF64[($0 + 32 | 0) >> 3];
|
||||
$45 = $39 + $1 * $1;
|
||||
$46 = $40 + $1 * $1;
|
||||
$1 = +HEAPF64[($0 + 40 | 0) >> 3];
|
||||
$1 = $30 + .5 * $9 * ($45 + $1 * $1);
|
||||
$1 = $31 + .5 * $9 * ($46 + $1 * $1);
|
||||
$0 = $2 + 1 | 0;
|
||||
repeat_1 : do {
|
||||
if ($0 >>> 0 < $5 >>> 0) {
|
||||
$10 = $1;
|
||||
$3 = HEAPU32[((HEAP32[($4 + 4 | 0) >> 2] | 0) + ($0 << 2 | 0) | 0) >> 2] | 0;
|
||||
$3 = HEAPU32[(($0 << 2 | 0) + $4 | 0) >> 2] | 0;
|
||||
$1 = $6 - +HEAPF64[$3 >> 3];
|
||||
$72 = $1 * $1;
|
||||
$1 = $7 - +HEAPF64[($3 + 8 | 0) >> 3];
|
||||
@@ -458,14 +410,14 @@ function asmFunc(global, env, buffer) {
|
||||
|
||||
function assembly_index_getBody($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, $14 = 0;
|
||||
var $1 = 0, $15 = 0;
|
||||
$1 = HEAPU32[assembly_index_system >> 2] | 0;
|
||||
if ($0 >>> 0 < (HEAP32[($1 + 12 | 0) >> 2] | 0) >>> 0) $14 = HEAPU32[((HEAP32[($1 + 4 | 0) >> 2] | 0) + ($0 << 2 | 0) | 0) >> 2] | 0; else $14 = 0;
|
||||
return $14 | 0;
|
||||
if ($0 >>> 0 < ((HEAPU32[(($1 - 8 | 0) + 4 | 0) >> 2] | 0) >>> 2 | 0) >>> 0) $15 = HEAPU32[(($0 << 2 | 0) + $1 | 0) >> 2] | 0; else $15 = 0;
|
||||
return $15 | 0;
|
||||
}
|
||||
|
||||
function start() {
|
||||
$lib_allocator_arena_startOffset = 96;
|
||||
$lib_allocator_arena_startOffset = 56;
|
||||
$lib_allocator_arena_offset = $lib_allocator_arena_startOffset;
|
||||
}
|
||||
|
||||
@@ -535,8 +487,7 @@ const assignasmFunc = (
|
||||
}
|
||||
}
|
||||
)(memasmFunc);
|
||||
assignasmFunc(8, "AwAAAB4AAAB+AGwAaQBiAC8AcgB1AG4AdABpAG0AZQAuAHQAcw==");
|
||||
assignasmFunc(48, "AwAAACYAAAB+AGwAaQBiAC8AYQByAHIAYQB5AGIAdQBmAGYAZQByAC4AdABz");
|
||||
assignasmFunc(8, "AQAAACQAAAB+AGwAaQBiAC8AZgBpAHgAZQBkAGEAcgByAGEAeQAuAHQAcw==");
|
||||
const retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc);
|
||||
export const memory = retasmFunc.memory;
|
||||
export const init = retasmFunc.init;
|
||||
|
Binary file not shown.
@@ -5,10 +5,8 @@
|
||||
(type $FUNCSIG$di (func (param i32) (result f64)))
|
||||
(type $FUNCSIG$vi (func (param i32)))
|
||||
(type $FUNCSIG$iddddddd (func (param f64 f64 f64 f64 f64 f64 f64) (result i32)))
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(import "env" "memory" (memory $0 1))
|
||||
(data (i32.const 8) "\03\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
|
||||
(data (i32.const 48) "\03\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s")
|
||||
(data (i32.const 8) "\01\00\00\00$\00\00\00~\00l\00i\00b\00/\00f\00i\00x\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s")
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $assembly/index/system (mut i32) (i32.const 0))
|
||||
@@ -104,126 +102,7 @@
|
||||
i32.const 8
|
||||
i32.add
|
||||
)
|
||||
(func $assembly/index/NBodySystem#constructor (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 f64)
|
||||
(local $4 f64)
|
||||
(local $5 f64)
|
||||
(local $6 f64)
|
||||
(local $7 i32)
|
||||
local.get $0
|
||||
i32.load offset=12
|
||||
local.set $7
|
||||
loop $repeat|0
|
||||
local.get $1
|
||||
local.get $7
|
||||
i32.lt_s
|
||||
if
|
||||
local.get $0
|
||||
i32.load offset=4
|
||||
local.get $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $2
|
||||
f64.load offset=48
|
||||
local.set $3
|
||||
local.get $4
|
||||
local.get $2
|
||||
f64.load offset=24
|
||||
local.get $3
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $4
|
||||
local.get $5
|
||||
local.get $2
|
||||
f64.load offset=32
|
||||
local.get $3
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $5
|
||||
local.get $6
|
||||
local.get $2
|
||||
f64.load offset=40
|
||||
local.get $3
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $6
|
||||
local.get $1
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $1
|
||||
br $repeat|0
|
||||
end
|
||||
end
|
||||
local.get $0
|
||||
i32.load offset=4
|
||||
i32.load
|
||||
local.tee $1
|
||||
local.get $4
|
||||
f64.neg
|
||||
f64.const 39.47841760435743
|
||||
f64.div
|
||||
f64.store offset=24
|
||||
local.get $1
|
||||
local.get $5
|
||||
f64.neg
|
||||
f64.const 39.47841760435743
|
||||
f64.div
|
||||
f64.store offset=32
|
||||
local.get $1
|
||||
local.get $6
|
||||
f64.neg
|
||||
f64.const 39.47841760435743
|
||||
f64.div
|
||||
f64.store offset=40
|
||||
i32.const 4
|
||||
call $~lib/runtime/doAllocate
|
||||
local.tee $1
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 1
|
||||
i32.store
|
||||
local.get $1
|
||||
local.get $0
|
||||
i32.store
|
||||
local.get $1
|
||||
)
|
||||
(func $assembly/index/Body#constructor (; 3 ;) (type $FUNCSIG$iddddddd) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32)
|
||||
(local $7 i32)
|
||||
i32.const 56
|
||||
call $~lib/runtime/doAllocate
|
||||
local.tee $7
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 2
|
||||
i32.store
|
||||
local.get $7
|
||||
local.get $0
|
||||
f64.store
|
||||
local.get $7
|
||||
local.get $1
|
||||
f64.store offset=8
|
||||
local.get $7
|
||||
local.get $2
|
||||
f64.store offset=16
|
||||
local.get $7
|
||||
local.get $3
|
||||
f64.store offset=24
|
||||
local.get $7
|
||||
local.get $4
|
||||
f64.store offset=32
|
||||
local.get $7
|
||||
local.get $5
|
||||
f64.store offset=40
|
||||
local.get $7
|
||||
local.get $6
|
||||
f64.store offset=48
|
||||
local.get $7
|
||||
)
|
||||
(func $~lib/memory/memory.fill (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(func $~lib/memory/memory.fill (; 2 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
block $~lib/util/memory/memset|inlined.0
|
||||
@@ -416,74 +295,139 @@
|
||||
end
|
||||
end
|
||||
)
|
||||
(func $~lib/runtime/ArrayBufferView#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $assembly/index/Body#constructor (; 3 ;) (type $FUNCSIG$iddddddd) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32)
|
||||
(local $7 i32)
|
||||
i32.const 56
|
||||
call $~lib/runtime/doAllocate
|
||||
local.tee $7
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 3
|
||||
i32.store
|
||||
local.get $7
|
||||
local.get $0
|
||||
f64.store
|
||||
local.get $7
|
||||
local.get $1
|
||||
f64.store offset=8
|
||||
local.get $7
|
||||
local.get $2
|
||||
f64.store offset=16
|
||||
local.get $7
|
||||
local.get $3
|
||||
f64.store offset=24
|
||||
local.get $7
|
||||
local.get $4
|
||||
f64.store offset=32
|
||||
local.get $7
|
||||
local.get $5
|
||||
f64.store offset=40
|
||||
local.get $7
|
||||
local.get $6
|
||||
f64.store offset=48
|
||||
local.get $7
|
||||
)
|
||||
(func $assembly/index/NBodySystem#constructor (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
i32.const 20
|
||||
(local $2 i32)
|
||||
(local $3 f64)
|
||||
(local $4 f64)
|
||||
(local $5 f64)
|
||||
(local $6 f64)
|
||||
(local $7 i32)
|
||||
local.get $0
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.load offset=4
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
local.set $7
|
||||
loop $repeat|0
|
||||
local.get $1
|
||||
local.get $7
|
||||
i32.lt_s
|
||||
if
|
||||
local.get $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $0
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $2
|
||||
f64.load offset=48
|
||||
local.set $3
|
||||
local.get $4
|
||||
local.get $2
|
||||
f64.load offset=24
|
||||
local.get $3
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $4
|
||||
local.get $5
|
||||
local.get $2
|
||||
f64.load offset=32
|
||||
local.get $3
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $5
|
||||
local.get $6
|
||||
local.get $2
|
||||
f64.load offset=40
|
||||
local.get $3
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $6
|
||||
local.get $1
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $1
|
||||
br $repeat|0
|
||||
end
|
||||
end
|
||||
local.get $0
|
||||
i32.load
|
||||
local.tee $1
|
||||
local.get $4
|
||||
f64.neg
|
||||
f64.const 39.47841760435743
|
||||
f64.div
|
||||
f64.store offset=24
|
||||
local.get $1
|
||||
local.get $5
|
||||
f64.neg
|
||||
f64.const 39.47841760435743
|
||||
f64.div
|
||||
f64.store offset=32
|
||||
local.get $1
|
||||
local.get $6
|
||||
f64.neg
|
||||
f64.const 39.47841760435743
|
||||
f64.div
|
||||
f64.store offset=40
|
||||
i32.const 4
|
||||
call $~lib/runtime/doAllocate
|
||||
local.tee $1
|
||||
call $~lib/memory/memory.fill
|
||||
local.get $1
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 4
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 12
|
||||
call $~lib/runtime/doAllocate
|
||||
local.tee $0
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 5
|
||||
i32.store
|
||||
end
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store offset=8
|
||||
local.get $0
|
||||
local.get $1
|
||||
local.get $0
|
||||
i32.store
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
i32.const 20
|
||||
i32.store offset=8
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<Body>#constructor (; 6 ;) (type $FUNCSIG$i) (result i32)
|
||||
(func $assembly/index/init (; 5 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
i32.const 16
|
||||
i32.const 20
|
||||
call $~lib/runtime/doAllocate
|
||||
local.tee $0
|
||||
call $~lib/memory/memory.fill
|
||||
local.get $0
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 6
|
||||
i32.const 2
|
||||
i32.store
|
||||
local.get $0
|
||||
call $~lib/runtime/ArrayBufferView#constructor
|
||||
local.tee $0
|
||||
i32.const 0
|
||||
i32.store offset=12
|
||||
local.get $0
|
||||
i32.const 5
|
||||
i32.store offset=12
|
||||
local.get $0
|
||||
)
|
||||
(func $assembly/index/init (; 7 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
call $~lib/array/Array<Body>#constructor
|
||||
local.tee $1
|
||||
i32.load offset=4
|
||||
local.tee $0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
@@ -494,6 +438,8 @@
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 4
|
||||
i32.add
|
||||
f64.const 4.841431442464721
|
||||
f64.const -1.1603200440274284
|
||||
f64.const -0.10362204447112311
|
||||
@@ -502,8 +448,10 @@
|
||||
f64.const -0.02521836165988763
|
||||
f64.const 0.03769367487038949
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store offset=4
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 8
|
||||
i32.add
|
||||
f64.const 8.34336671824458
|
||||
f64.const 4.124798564124305
|
||||
f64.const -0.4035234171143214
|
||||
@@ -512,8 +460,10 @@
|
||||
f64.const 0.008415761376584154
|
||||
f64.const 0.011286326131968767
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store offset=8
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 12
|
||||
i32.add
|
||||
f64.const 12.894369562139131
|
||||
f64.const -15.111151401698631
|
||||
f64.const -0.22330757889265573
|
||||
@@ -522,8 +472,10 @@
|
||||
f64.const -0.010832637401363636
|
||||
f64.const 1.7237240570597112e-03
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store offset=12
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 16
|
||||
i32.add
|
||||
f64.const 15.379697114850917
|
||||
f64.const -25.919314609987964
|
||||
f64.const 0.17925877295037118
|
||||
@@ -532,12 +484,12 @@
|
||||
f64.const -0.034755955504078104
|
||||
f64.const 2.0336868699246304e-03
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store offset=16
|
||||
local.get $1
|
||||
i32.store
|
||||
local.get $0
|
||||
call $assembly/index/NBodySystem#constructor
|
||||
global.set $assembly/index/system
|
||||
)
|
||||
(func $assembly/index/NBodySystem#advance (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(func $assembly/index/NBodySystem#advance (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 f64)
|
||||
(local $3 i32)
|
||||
@@ -559,18 +511,21 @@
|
||||
local.get $0
|
||||
i32.load
|
||||
local.tee $12
|
||||
i32.load offset=12
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.load offset=4
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
local.set $13
|
||||
loop $repeat|0
|
||||
local.get $3
|
||||
local.get $13
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $12
|
||||
i32.load offset=4
|
||||
local.get $3
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $12
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $0
|
||||
@@ -604,11 +559,10 @@
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $14
|
||||
local.get $12
|
||||
i32.load offset=4
|
||||
local.get $7
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $12
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $1
|
||||
@@ -739,7 +693,7 @@
|
||||
end
|
||||
end
|
||||
)
|
||||
(func $assembly/index/NBodySystem#energy (; 9 ;) (type $FUNCSIG$di) (param $0 i32) (result f64)
|
||||
(func $assembly/index/NBodySystem#energy (; 7 ;) (type $FUNCSIG$di) (param $0 i32) (result f64)
|
||||
(local $1 f64)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@@ -753,18 +707,21 @@
|
||||
local.get $0
|
||||
i32.load
|
||||
local.tee $4
|
||||
i32.load offset=12
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.load offset=4
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
local.set $5
|
||||
loop $repeat|0
|
||||
local.get $2
|
||||
local.get $5
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $4
|
||||
i32.load offset=4
|
||||
local.get $2
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $4
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $0
|
||||
@@ -814,11 +771,10 @@
|
||||
local.get $1
|
||||
local.set $10
|
||||
local.get $6
|
||||
local.get $4
|
||||
i32.load offset=4
|
||||
local.get $0
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $4
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $3
|
||||
@@ -870,13 +826,13 @@
|
||||
end
|
||||
local.get $1
|
||||
)
|
||||
(func $assembly/index/step (; 10 ;) (type $FUNCSIG$d) (result f64)
|
||||
(func $assembly/index/step (; 8 ;) (type $FUNCSIG$d) (result f64)
|
||||
global.get $assembly/index/system
|
||||
call $assembly/index/NBodySystem#advance
|
||||
global.get $assembly/index/system
|
||||
call $assembly/index/NBodySystem#energy
|
||||
)
|
||||
(func $assembly/index/bench (; 11 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(func $assembly/index/bench (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(local $1 i32)
|
||||
block $break|0
|
||||
loop $repeat|0
|
||||
@@ -896,33 +852,36 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $assembly/index/getBody (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $assembly/index/getBody (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
local.get $0
|
||||
global.get $assembly/index/system
|
||||
i32.load
|
||||
local.tee $1
|
||||
i32.load offset=12
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.load offset=4
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $1
|
||||
i32.load offset=4
|
||||
local.get $0
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $1
|
||||
i32.add
|
||||
i32.load
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
)
|
||||
(func $start (; 13 ;) (type $FUNCSIG$v)
|
||||
i32.const 96
|
||||
(func $start (; 11 ;) (type $FUNCSIG$v)
|
||||
i32.const 56
|
||||
global.set $~lib/allocator/arena/startOffset
|
||||
global.get $~lib/allocator/arena/startOffset
|
||||
global.set $~lib/allocator/arena/offset
|
||||
)
|
||||
(func $null (; 14 ;) (type $FUNCSIG$v)
|
||||
(func $null (; 12 ;) (type $FUNCSIG$v)
|
||||
nop
|
||||
)
|
||||
)
|
||||
|
@@ -1,20 +1,19 @@
|
||||
(module
|
||||
(type $FUNCSIG$v (func))
|
||||
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
|
||||
(type $FUNCSIG$ii (func (param i32) (result i32)))
|
||||
(type $FUNCSIG$iiddd (func (param i32 f64 f64 f64) (result i32)))
|
||||
(type $FUNCSIG$vi (func (param i32)))
|
||||
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
|
||||
(type $FUNCSIG$ii (func (param i32) (result i32)))
|
||||
(type $FUNCSIG$viii (func (param i32 i32 i32)))
|
||||
(type $FUNCSIG$vi (func (param i32)))
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(type $FUNCSIG$iiddddddd (func (param i32 f64 f64 f64 f64 f64 f64 f64) (result i32)))
|
||||
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
|
||||
(type $FUNCSIG$viii (func (param i32 i32 i32)))
|
||||
(type $FUNCSIG$iiddd (func (param i32 f64 f64 f64) (result i32)))
|
||||
(type $FUNCSIG$d (func (result f64)))
|
||||
(type $FUNCSIG$vid (func (param i32 f64)))
|
||||
(type $FUNCSIG$di (func (param i32) (result f64)))
|
||||
(import "env" "memory" (memory $0 1))
|
||||
(data (i32.const 8) "\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
|
||||
(data (i32.const 48) "\02\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
|
||||
(data (i32.const 8) "\01\00\00\00$\00\00\00~\00l\00i\00b\00/\00f\00i\00x\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s\00")
|
||||
(data (i32.const 56) "\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
@@ -25,10 +24,10 @@
|
||||
(global $~lib/runtime/GC_IMPLEMENTED i32 (i32.const 0))
|
||||
(global $~lib/runtime/HEADER_SIZE i32 (i32.const 8))
|
||||
(global $~lib/runtime/HEADER_MAGIC i32 (i32.const -1520547049))
|
||||
(global $~lib/runtime/MAX_BYTELENGTH i32 (i32.const 1073741816))
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
(global $~lib/ASC_NO_ASSERT i32 (i32.const 0))
|
||||
(global $~lib/runtime/MAX_BYTELENGTH i32 (i32.const 1073741816))
|
||||
(global $~lib/memory/HEAP_BASE i32 (i32.const 96))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
@@ -37,32 +36,7 @@
|
||||
(export "bench" (func $assembly/index/bench))
|
||||
(export "getBody" (func $assembly/index/getBody))
|
||||
(start $start)
|
||||
(func $~lib/array/Array<Body>#get:length (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
i32.load offset=12
|
||||
)
|
||||
(func $assembly/index/Body#offsetMomentum (; 2 ;) (type $FUNCSIG$iiddd) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32)
|
||||
local.get $0
|
||||
local.get $1
|
||||
f64.neg
|
||||
global.get $assembly/index/SOLAR_MASS
|
||||
f64.div
|
||||
f64.store offset=24
|
||||
local.get $0
|
||||
local.get $2
|
||||
f64.neg
|
||||
global.get $assembly/index/SOLAR_MASS
|
||||
f64.div
|
||||
f64.store offset=32
|
||||
local.get $0
|
||||
local.get $3
|
||||
f64.neg
|
||||
global.get $assembly/index/SOLAR_MASS
|
||||
f64.div
|
||||
f64.store offset=40
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/runtime/ADJUSTOBLOCK (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $~lib/runtime/ADJUSTOBLOCK (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
i32.const 1
|
||||
i32.const 32
|
||||
local.get $0
|
||||
@@ -74,7 +48,7 @@
|
||||
i32.sub
|
||||
i32.shl
|
||||
)
|
||||
(func $~lib/memory/memory.allocate (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $~lib/memory/memory.allocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@@ -159,7 +133,7 @@
|
||||
end
|
||||
return
|
||||
)
|
||||
(func $~lib/runtime/doAllocate (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $~lib/runtime/doAllocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
local.get $0
|
||||
call $~lib/runtime/ADJUSTOBLOCK
|
||||
@@ -175,194 +149,7 @@
|
||||
global.get $~lib/runtime/HEADER_SIZE
|
||||
i32.add
|
||||
)
|
||||
(func $~lib/runtime/ALLOCATE (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
call $~lib/runtime/doAllocate
|
||||
)
|
||||
(func $~lib/runtime/assertUnregistered (; 7 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
local.get $0
|
||||
global.get $~lib/memory/HEAP_BASE
|
||||
i32.gt_u
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 16
|
||||
i32.const 192
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
local.get $0
|
||||
global.get $~lib/runtime/HEADER_SIZE
|
||||
i32.sub
|
||||
i32.load
|
||||
global.get $~lib/runtime/HEADER_MAGIC
|
||||
i32.eq
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 16
|
||||
i32.const 193
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $~lib/runtime/doRegister (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
local.get $0
|
||||
call $~lib/runtime/assertUnregistered
|
||||
local.get $0
|
||||
global.get $~lib/runtime/HEADER_SIZE
|
||||
i32.sub
|
||||
local.get $1
|
||||
i32.store
|
||||
local.get $0
|
||||
)
|
||||
(func $assembly/index/NBodySystem#constructor (; 9 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 f64)
|
||||
(local $3 f64)
|
||||
(local $4 f64)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 f64)
|
||||
f64.const 0
|
||||
local.set $2
|
||||
f64.const 0
|
||||
local.set $3
|
||||
f64.const 0
|
||||
local.set $4
|
||||
local.get $1
|
||||
call $~lib/array/Array<Body>#get:length
|
||||
local.set $5
|
||||
block $break|0
|
||||
i32.const 0
|
||||
local.set $6
|
||||
loop $repeat|0
|
||||
local.get $6
|
||||
local.get $5
|
||||
i32.lt_s
|
||||
i32.eqz
|
||||
br_if $break|0
|
||||
block
|
||||
local.get $1
|
||||
i32.load offset=4
|
||||
local.get $6
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load
|
||||
local.set $7
|
||||
local.get $7
|
||||
f64.load offset=48
|
||||
local.set $8
|
||||
local.get $2
|
||||
local.get $7
|
||||
f64.load offset=24
|
||||
local.get $8
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $2
|
||||
local.get $3
|
||||
local.get $7
|
||||
f64.load offset=32
|
||||
local.get $8
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $3
|
||||
local.get $4
|
||||
local.get $7
|
||||
f64.load offset=40
|
||||
local.get $8
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $4
|
||||
end
|
||||
local.get $6
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $6
|
||||
br $repeat|0
|
||||
unreachable
|
||||
end
|
||||
unreachable
|
||||
end
|
||||
local.get $1
|
||||
i32.load offset=4
|
||||
i32.load
|
||||
local.get $2
|
||||
local.get $3
|
||||
local.get $4
|
||||
call $assembly/index/Body#offsetMomentum
|
||||
drop
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
block $~lib/runtime/REGISTER<NBodySystem>|inlined.0 (result i32)
|
||||
i32.const 4
|
||||
call $~lib/runtime/ALLOCATE
|
||||
local.set $6
|
||||
local.get $6
|
||||
i32.const 1
|
||||
call $~lib/runtime/doRegister
|
||||
end
|
||||
local.set $0
|
||||
end
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store
|
||||
local.get $0
|
||||
)
|
||||
(func $assembly/index/Body#constructor (; 10 ;) (type $FUNCSIG$iiddddddd) (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)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
block $~lib/runtime/REGISTER<Body>|inlined.0 (result i32)
|
||||
i32.const 56
|
||||
call $~lib/runtime/ALLOCATE
|
||||
local.set $8
|
||||
local.get $8
|
||||
i32.const 3
|
||||
call $~lib/runtime/doRegister
|
||||
end
|
||||
local.set $0
|
||||
end
|
||||
local.get $0
|
||||
local.get $1
|
||||
f64.store
|
||||
local.get $0
|
||||
local.get $2
|
||||
f64.store offset=8
|
||||
local.get $0
|
||||
local.get $3
|
||||
f64.store offset=16
|
||||
local.get $0
|
||||
local.get $4
|
||||
f64.store offset=24
|
||||
local.get $0
|
||||
local.get $5
|
||||
f64.store offset=32
|
||||
local.get $0
|
||||
local.get $6
|
||||
f64.store offset=40
|
||||
local.get $0
|
||||
local.get $7
|
||||
f64.store offset=48
|
||||
local.get $0
|
||||
)
|
||||
(func $assembly/index/Sun (; 11 ;) (type $FUNCSIG$i) (result i32)
|
||||
i32.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
global.get $assembly/index/SOLAR_MASS
|
||||
call $assembly/index/Body#constructor
|
||||
)
|
||||
(func $~lib/memory/memory.fill (; 12 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/memory/memory.fill (; 4 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i64)
|
||||
@@ -618,123 +405,148 @@
|
||||
end
|
||||
end
|
||||
)
|
||||
(func $~lib/arraybuffer/ArrayBuffer#constructor (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
local.get $1
|
||||
global.get $~lib/runtime/MAX_BYTELENGTH
|
||||
(func $~lib/runtime/assertUnregistered (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
local.get $0
|
||||
global.get $~lib/memory/HEAP_BASE
|
||||
i32.gt_u
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 56
|
||||
i32.const 24
|
||||
i32.const 43
|
||||
i32.const 64
|
||||
i32.const 199
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
|
||||
local.get $1
|
||||
local.set $2
|
||||
local.get $2
|
||||
call $~lib/runtime/doAllocate
|
||||
end
|
||||
local.set $3
|
||||
local.get $3
|
||||
i32.const 0
|
||||
local.get $1
|
||||
call $~lib/memory/memory.fill
|
||||
block $~lib/runtime/REGISTER<ArrayBuffer>|inlined.0 (result i32)
|
||||
local.get $3
|
||||
local.set $2
|
||||
local.get $2
|
||||
i32.const 4
|
||||
call $~lib/runtime/doRegister
|
||||
local.get $0
|
||||
global.get $~lib/runtime/HEADER_SIZE
|
||||
i32.sub
|
||||
i32.load
|
||||
global.get $~lib/runtime/HEADER_MAGIC
|
||||
i32.eq
|
||||
i32.eqz
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 64
|
||||
i32.const 200
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $~lib/runtime/ArrayBufferView#constructor (; 14 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
||||
(func $~lib/runtime/doRegister (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
local.get $0
|
||||
call $~lib/runtime/assertUnregistered
|
||||
local.get $0
|
||||
global.get $~lib/runtime/HEADER_SIZE
|
||||
i32.sub
|
||||
local.get $1
|
||||
i32.store
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/fixedarray/FixedArray<Body>#constructor (; 7 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $1
|
||||
global.get $~lib/runtime/MAX_BYTELENGTH
|
||||
local.get $2
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.gt_u
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 16
|
||||
i32.const 227
|
||||
i32.const 57
|
||||
i32.const 12
|
||||
i32.const 60
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
local.get $1
|
||||
local.get $2
|
||||
i32.shl
|
||||
local.tee $1
|
||||
call $~lib/arraybuffer/ArrayBuffer#constructor
|
||||
local.set $3
|
||||
block (result i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
block $~lib/runtime/REGISTER<ArrayBufferView>|inlined.0 (result i32)
|
||||
i32.const 12
|
||||
call $~lib/runtime/ALLOCATE
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.const 5
|
||||
call $~lib/runtime/doRegister
|
||||
end
|
||||
local.set $0
|
||||
end
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store offset=8
|
||||
local.get $0
|
||||
end
|
||||
local.get $3
|
||||
i32.store
|
||||
local.get $0
|
||||
local.get $3
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=8
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<Body>#constructor (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
if (result i32)
|
||||
local.get $0
|
||||
else
|
||||
i32.const 16
|
||||
call $~lib/runtime/ALLOCATE
|
||||
local.set $2
|
||||
local.get $2
|
||||
i32.const 6
|
||||
call $~lib/runtime/doRegister
|
||||
end
|
||||
local.get $1
|
||||
i32.const 2
|
||||
call $~lib/runtime/ArrayBufferView#constructor
|
||||
local.set $0
|
||||
local.get $0
|
||||
i32.shl
|
||||
local.set $2
|
||||
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
|
||||
local.get $2
|
||||
local.set $3
|
||||
local.get $3
|
||||
call $~lib/runtime/doAllocate
|
||||
end
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.const 0
|
||||
i32.store offset=12
|
||||
local.get $2
|
||||
call $~lib/memory/memory.fill
|
||||
block $~lib/runtime/REGISTER<FixedArray<Body>>|inlined.0 (result i32)
|
||||
local.get $4
|
||||
local.set $3
|
||||
local.get $3
|
||||
i32.const 2
|
||||
call $~lib/runtime/doRegister
|
||||
end
|
||||
)
|
||||
(func $assembly/index/Body#constructor (; 8 ;) (type $FUNCSIG$iiddddddd) (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)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
block $~lib/runtime/REGISTER<Body>|inlined.0 (result i32)
|
||||
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
|
||||
i32.const 56
|
||||
local.set $8
|
||||
local.get $8
|
||||
call $~lib/runtime/doAllocate
|
||||
end
|
||||
local.set $8
|
||||
local.get $8
|
||||
i32.const 3
|
||||
call $~lib/runtime/doRegister
|
||||
end
|
||||
local.set $0
|
||||
end
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=12
|
||||
f64.store
|
||||
local.get $0
|
||||
local.get $2
|
||||
f64.store offset=8
|
||||
local.get $0
|
||||
local.get $3
|
||||
f64.store offset=16
|
||||
local.get $0
|
||||
local.get $4
|
||||
f64.store offset=24
|
||||
local.get $0
|
||||
local.get $5
|
||||
f64.store offset=32
|
||||
local.get $0
|
||||
local.get $6
|
||||
f64.store offset=40
|
||||
local.get $0
|
||||
local.get $7
|
||||
f64.store offset=48
|
||||
local.get $0
|
||||
)
|
||||
(func $assembly/index/Jupiter (; 16 ;) (type $FUNCSIG$i) (result i32)
|
||||
(func $assembly/index/Sun (; 9 ;) (type $FUNCSIG$i) (result i32)
|
||||
i32.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
global.get $assembly/index/SOLAR_MASS
|
||||
call $assembly/index/Body#constructor
|
||||
)
|
||||
(func $~lib/fixedarray/FixedArray<Body>#__unchecked_set (; 10 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
local.get $2
|
||||
i32.store
|
||||
)
|
||||
(func $assembly/index/Jupiter (; 11 ;) (type $FUNCSIG$i) (result i32)
|
||||
i32.const 0
|
||||
f64.const 4.841431442464721
|
||||
f64.const -1.1603200440274284
|
||||
@@ -753,7 +565,7 @@
|
||||
f64.mul
|
||||
call $assembly/index/Body#constructor
|
||||
)
|
||||
(func $assembly/index/Saturn (; 17 ;) (type $FUNCSIG$i) (result i32)
|
||||
(func $assembly/index/Saturn (; 12 ;) (type $FUNCSIG$i) (result i32)
|
||||
i32.const 0
|
||||
f64.const 8.34336671824458
|
||||
f64.const 4.124798564124305
|
||||
@@ -772,7 +584,7 @@
|
||||
f64.mul
|
||||
call $assembly/index/Body#constructor
|
||||
)
|
||||
(func $assembly/index/Uranus (; 18 ;) (type $FUNCSIG$i) (result i32)
|
||||
(func $assembly/index/Uranus (; 13 ;) (type $FUNCSIG$i) (result i32)
|
||||
i32.const 0
|
||||
f64.const 12.894369562139131
|
||||
f64.const -15.111151401698631
|
||||
@@ -791,7 +603,7 @@
|
||||
f64.mul
|
||||
call $assembly/index/Body#constructor
|
||||
)
|
||||
(func $assembly/index/Neptune (; 19 ;) (type $FUNCSIG$i) (result i32)
|
||||
(func $assembly/index/Neptune (; 14 ;) (type $FUNCSIG$i) (result i32)
|
||||
i32.const 0
|
||||
f64.const 15.379697114850917
|
||||
f64.const -25.919314609987964
|
||||
@@ -810,39 +622,170 @@
|
||||
f64.mul
|
||||
call $assembly/index/Body#constructor
|
||||
)
|
||||
(func $assembly/index/init (; 20 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
i32.const 0
|
||||
block (result i32)
|
||||
(func $~lib/fixedarray/FixedArray<Body>#get:length (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
global.get $~lib/runtime/HEADER_SIZE
|
||||
i32.sub
|
||||
i32.load offset=4
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
)
|
||||
(func $~lib/fixedarray/FixedArray<Body>#__unchecked_get (; 16 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load
|
||||
)
|
||||
(func $assembly/index/Body#offsetMomentum (; 17 ;) (type $FUNCSIG$iiddd) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32)
|
||||
local.get $0
|
||||
local.get $1
|
||||
f64.neg
|
||||
global.get $assembly/index/SOLAR_MASS
|
||||
f64.div
|
||||
f64.store offset=24
|
||||
local.get $0
|
||||
local.get $2
|
||||
f64.neg
|
||||
global.get $assembly/index/SOLAR_MASS
|
||||
f64.div
|
||||
f64.store offset=32
|
||||
local.get $0
|
||||
local.get $3
|
||||
f64.neg
|
||||
global.get $assembly/index/SOLAR_MASS
|
||||
f64.div
|
||||
f64.store offset=40
|
||||
local.get $0
|
||||
)
|
||||
(func $assembly/index/NBodySystem#constructor (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 f64)
|
||||
(local $3 f64)
|
||||
(local $4 f64)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 f64)
|
||||
f64.const 0
|
||||
local.set $2
|
||||
f64.const 0
|
||||
local.set $3
|
||||
f64.const 0
|
||||
local.set $4
|
||||
local.get $1
|
||||
call $~lib/fixedarray/FixedArray<Body>#get:length
|
||||
local.set $5
|
||||
block $break|0
|
||||
i32.const 0
|
||||
i32.const 5
|
||||
call $~lib/array/Array<Body>#constructor
|
||||
local.set $0
|
||||
local.get $0
|
||||
i32.load offset=4
|
||||
local.set $1
|
||||
local.get $1
|
||||
call $assembly/index/Sun
|
||||
i32.store
|
||||
local.get $1
|
||||
call $assembly/index/Jupiter
|
||||
i32.store offset=4
|
||||
local.get $1
|
||||
call $assembly/index/Saturn
|
||||
i32.store offset=8
|
||||
local.get $1
|
||||
call $assembly/index/Uranus
|
||||
i32.store offset=12
|
||||
local.get $1
|
||||
call $assembly/index/Neptune
|
||||
i32.store offset=16
|
||||
local.get $0
|
||||
local.set $6
|
||||
loop $repeat|0
|
||||
local.get $6
|
||||
local.get $5
|
||||
i32.lt_s
|
||||
i32.eqz
|
||||
br_if $break|0
|
||||
block
|
||||
local.get $1
|
||||
local.get $6
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_get
|
||||
local.set $7
|
||||
local.get $7
|
||||
f64.load offset=48
|
||||
local.set $8
|
||||
local.get $2
|
||||
local.get $7
|
||||
f64.load offset=24
|
||||
local.get $8
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $2
|
||||
local.get $3
|
||||
local.get $7
|
||||
f64.load offset=32
|
||||
local.get $8
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $3
|
||||
local.get $4
|
||||
local.get $7
|
||||
f64.load offset=40
|
||||
local.get $8
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $4
|
||||
end
|
||||
local.get $6
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $6
|
||||
br $repeat|0
|
||||
unreachable
|
||||
end
|
||||
unreachable
|
||||
end
|
||||
local.get $1
|
||||
i32.const 0
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_get
|
||||
local.get $2
|
||||
local.get $3
|
||||
local.get $4
|
||||
call $assembly/index/Body#offsetMomentum
|
||||
drop
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
block $~lib/runtime/REGISTER<NBodySystem>|inlined.0 (result i32)
|
||||
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
|
||||
i32.const 4
|
||||
local.set $6
|
||||
local.get $6
|
||||
call $~lib/runtime/doAllocate
|
||||
end
|
||||
local.set $6
|
||||
local.get $6
|
||||
i32.const 4
|
||||
call $~lib/runtime/doRegister
|
||||
end
|
||||
local.set $0
|
||||
end
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store
|
||||
local.get $0
|
||||
)
|
||||
(func $assembly/index/init (; 19 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
i32.const 0
|
||||
i32.const 5
|
||||
call $~lib/fixedarray/FixedArray<Body>#constructor
|
||||
local.set $0
|
||||
local.get $0
|
||||
i32.const 0
|
||||
call $assembly/index/Sun
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_set
|
||||
local.get $0
|
||||
i32.const 1
|
||||
call $assembly/index/Jupiter
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_set
|
||||
local.get $0
|
||||
i32.const 2
|
||||
call $assembly/index/Saturn
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_set
|
||||
local.get $0
|
||||
i32.const 3
|
||||
call $assembly/index/Uranus
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_set
|
||||
local.get $0
|
||||
i32.const 4
|
||||
call $assembly/index/Neptune
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_set
|
||||
i32.const 0
|
||||
local.get $0
|
||||
call $assembly/index/NBodySystem#constructor
|
||||
global.set $assembly/index/system
|
||||
)
|
||||
(func $assembly/index/NBodySystem#advance (; 21 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64)
|
||||
(func $assembly/index/NBodySystem#advance (; 20 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@@ -868,7 +811,7 @@
|
||||
i32.load
|
||||
local.set $2
|
||||
local.get $2
|
||||
call $~lib/array/Array<Body>#get:length
|
||||
call $~lib/fixedarray/FixedArray<Body>#get:length
|
||||
local.set $3
|
||||
block $break|0
|
||||
i32.const 0
|
||||
@@ -881,12 +824,8 @@
|
||||
br_if $break|0
|
||||
block
|
||||
local.get $2
|
||||
i32.load offset=4
|
||||
local.get $4
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_get
|
||||
local.set $5
|
||||
local.get $5
|
||||
f64.load
|
||||
@@ -922,12 +861,8 @@
|
||||
br_if $break|1
|
||||
block
|
||||
local.get $2
|
||||
i32.load offset=4
|
||||
local.get $13
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_get
|
||||
local.set $14
|
||||
local.get $6
|
||||
local.get $14
|
||||
@@ -1074,7 +1009,7 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $assembly/index/NBodySystem#energy (; 22 ;) (type $FUNCSIG$di) (param $0 i32) (result f64)
|
||||
(func $assembly/index/NBodySystem#energy (; 21 ;) (type $FUNCSIG$di) (param $0 i32) (result f64)
|
||||
(local $1 f64)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@@ -1103,7 +1038,7 @@
|
||||
i32.const 0
|
||||
local.set $3
|
||||
local.get $2
|
||||
call $~lib/array/Array<Body>#get:length
|
||||
call $~lib/fixedarray/FixedArray<Body>#get:length
|
||||
local.set $4
|
||||
end
|
||||
loop $repeat|0
|
||||
@@ -1114,12 +1049,8 @@
|
||||
br_if $break|0
|
||||
block
|
||||
local.get $2
|
||||
i32.load offset=4
|
||||
local.get $3
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_get
|
||||
local.set $5
|
||||
local.get $5
|
||||
f64.load
|
||||
@@ -1173,12 +1104,8 @@
|
||||
br_if $break|1
|
||||
block
|
||||
local.get $2
|
||||
i32.load offset=4
|
||||
local.get $13
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_get
|
||||
local.set $14
|
||||
local.get $6
|
||||
local.get $14
|
||||
@@ -1243,14 +1170,14 @@
|
||||
end
|
||||
local.get $1
|
||||
)
|
||||
(func $assembly/index/step (; 23 ;) (type $FUNCSIG$d) (result f64)
|
||||
(func $assembly/index/step (; 22 ;) (type $FUNCSIG$d) (result f64)
|
||||
global.get $assembly/index/system
|
||||
f64.const 0.01
|
||||
call $assembly/index/NBodySystem#advance
|
||||
global.get $assembly/index/system
|
||||
call $assembly/index/NBodySystem#energy
|
||||
)
|
||||
(func $assembly/index/bench (; 24 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(func $assembly/index/bench (; 23 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(local $1 i32)
|
||||
block $break|0
|
||||
i32.const 0
|
||||
@@ -1274,28 +1201,24 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $assembly/index/getBody (; 25 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $assembly/index/getBody (; 24 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
global.get $assembly/index/system
|
||||
i32.load
|
||||
local.set $1
|
||||
local.get $0
|
||||
local.get $1
|
||||
call $~lib/array/Array<Body>#get:length
|
||||
call $~lib/fixedarray/FixedArray<Body>#get:length
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $1
|
||||
i32.load offset=4
|
||||
local.get $0
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load
|
||||
call $~lib/fixedarray/FixedArray<Body>#__unchecked_get
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
)
|
||||
(func $start (; 26 ;) (type $FUNCSIG$v)
|
||||
(func $start (; 25 ;) (type $FUNCSIG$v)
|
||||
global.get $~lib/memory/HEAP_BASE
|
||||
i32.const 7
|
||||
i32.add
|
||||
@@ -1307,6 +1230,6 @@
|
||||
global.get $~lib/allocator/arena/startOffset
|
||||
global.set $~lib/allocator/arena/offset
|
||||
)
|
||||
(func $null (; 27 ;) (type $FUNCSIG$v)
|
||||
(func $null (; 26 ;) (type $FUNCSIG$v)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user