Fix n-body visualization

This commit is contained in:
dcodeIO
2018-07-22 02:55:46 +02:00
parent 813d2e33c8
commit a1e2071da6
15 changed files with 134 additions and 43 deletions

View File

@ -477,6 +477,19 @@ function asmFunc(global, env, buffer) {
};
}
function assembly_index_getBody($0) {
$0 = $0 | 0;
var $1 = 0, $22 = 0, $20 = 0;
$1 = HEAPU32[assembly_index_system >> 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) $20 = HEAPU32[(($1 + ($0 << 2 | 0) | 0) + 8 | 0) >> 2] | 0; else abort();
$22 = $20;
} else $22 = 0;
$0 = $22;
return $0 | 0;
}
function start() {
$lib_allocator_arena_startOffset = 40;
$lib_allocator_arena_offset = $lib_allocator_arena_startOffset;
@ -521,6 +534,7 @@ function asmFunc(global, env, buffer) {
}),
init: assembly_index_init,
step: assembly_index_step,
bench: assembly_index_bench
bench: assembly_index_bench,
getBody: assembly_index_getBody
};
}

Binary file not shown.

View File

@ -19,6 +19,7 @@
(export "init" (func $assembly/index/init))
(export "step" (func $assembly/index/step))
(export "bench" (func $assembly/index/bench))
(export "getBody" (func $assembly/index/getBody))
(start $start)
(func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
@ -1356,7 +1357,50 @@
)
)
)
(func $start (; 11 ;) (type $v)
(func $assembly/index/getBody (; 11 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(tee_local $0
(if (result i32)
(i32.lt_u
(get_local $0)
(i32.load offset=4
(tee_local $1
(i32.load
(get_global $assembly/index/system)
)
)
)
)
(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 $start (; 12 ;) (type $v)
(set_global $~lib/allocator/arena/startOffset
(i32.const 40)
)

View File

@ -32,6 +32,7 @@
(export "init" (func $assembly/index/init))
(export "step" (func $assembly/index/step))
(export "bench" (func $assembly/index/bench))
(export "getBody" (func $assembly/index/getBody))
(start $start)
(func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
@ -2238,7 +2239,37 @@
)
)
)
(func $start (; 25 ;) (type $v)
(func $assembly/index/getBody (; 25 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
;;@ assembly/index.ts:208:2
(set_local $1
;;@ assembly/index.ts:208:15
(i32.load
(get_global $assembly/index/system)
)
)
;;@ assembly/index.ts:209:59
(if (result i32)
;;@ assembly/index.ts:209:9
(i32.lt_u
(get_local $0)
;;@ assembly/index.ts:209:22
(call $~lib/array/Array<Body>#get:length
;;@ assembly/index.ts:209:27
(get_local $1)
)
)
;;@ assembly/index.ts:209:43
(call $~lib/array/Array<Body>#__get
(get_local $1)
;;@ assembly/index.ts:209:50
(get_local $0)
)
;;@ assembly/index.ts:209:59
(i32.const 0)
)
)
(func $start (; 26 ;) (type $v)
(set_global $~lib/allocator/arena/startOffset
;;@ ~lib/allocator/arena.ts:12:25
(i32.and