mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-28 22:21:50 +00:00
Implement reference counting (#592)
This commit is contained in:
15
examples/game-of-life/build/optimized.d.ts
vendored
15
examples/game-of-life/build/optimized.d.ts
vendored
@ -8,17 +8,8 @@ declare module ASModule {
|
||||
type f32 = number;
|
||||
type f64 = number;
|
||||
type bool = any;
|
||||
namespace JSMath {
|
||||
function random(): f64;
|
||||
}
|
||||
var w: i32;
|
||||
var h: i32;
|
||||
var s: i32;
|
||||
function init(width: i32, height: i32): void;
|
||||
function step(): void;
|
||||
function fill(x: u32, y: u32, p: f64): void;
|
||||
var BGR_ALIVE: u32;
|
||||
var BGR_DEAD: u32;
|
||||
var BIT_ROT: u32;
|
||||
export function init(width: i32, height: i32): void;
|
||||
export function step(): void;
|
||||
export function fill(x: u32, y: u32, p: f64): void;
|
||||
}
|
||||
export default ASModule;
|
||||
|
Binary file not shown.
@ -8,13 +8,10 @@
|
||||
(import "config" "BGR_ALIVE" (global $assembly/config/BGR_ALIVE i32))
|
||||
(import "config" "BIT_ROT" (global $assembly/config/BIT_ROT i32))
|
||||
(import "Math" "random" (func $~lib/bindings/Math/random (result f64)))
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $assembly/index/w (mut i32) (i32.const 0))
|
||||
(global $assembly/index/h (mut i32) (i32.const 0))
|
||||
(global $assembly/index/s (mut i32) (i32.const 0))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "init" (func $assembly/index/init))
|
||||
(export "step" (func $assembly/index/step))
|
||||
(export "fill" (func $assembly/index/fill))
|
||||
@ -136,7 +133,7 @@
|
||||
local.get $7
|
||||
local.get $1
|
||||
select
|
||||
local.tee $2
|
||||
local.tee $3
|
||||
global.get $assembly/index/w
|
||||
local.get $4
|
||||
i32.mul
|
||||
@ -165,7 +162,7 @@
|
||||
local.get $7
|
||||
i32.eq
|
||||
select
|
||||
local.tee $3
|
||||
local.tee $2
|
||||
global.get $assembly/index/w
|
||||
local.get $4
|
||||
i32.mul
|
||||
@ -179,17 +176,6 @@
|
||||
global.get $assembly/index/w
|
||||
local.get $0
|
||||
i32.mul
|
||||
local.get $2
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
global.get $assembly/index/w
|
||||
local.get $0
|
||||
i32.mul
|
||||
local.get $3
|
||||
i32.add
|
||||
i32.const 2
|
||||
@ -199,7 +185,7 @@
|
||||
i32.and
|
||||
i32.add
|
||||
global.get $assembly/index/w
|
||||
local.get $5
|
||||
local.get $0
|
||||
i32.mul
|
||||
local.get $2
|
||||
i32.add
|
||||
@ -212,6 +198,17 @@
|
||||
global.get $assembly/index/w
|
||||
local.get $5
|
||||
i32.mul
|
||||
local.get $3
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
global.get $assembly/index/w
|
||||
local.get $5
|
||||
i32.mul
|
||||
local.get $1
|
||||
i32.add
|
||||
i32.const 2
|
||||
@ -223,7 +220,7 @@
|
||||
global.get $assembly/index/w
|
||||
local.get $5
|
||||
i32.mul
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
|
@ -13,9 +13,7 @@
|
||||
(global $assembly/index/w (mut i32) (i32.const 0))
|
||||
(global $assembly/index/h (mut i32) (i32.const 0))
|
||||
(global $assembly/index/s (mut i32) (i32.const 0))
|
||||
(global $~lib/memory/HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "init" (func $assembly/index/init))
|
||||
(export "step" (func $assembly/index/step))
|
||||
(export "fill" (func $assembly/index/fill))
|
||||
@ -53,7 +51,7 @@
|
||||
br_if $break|1
|
||||
block $assembly/index/set|inlined.0
|
||||
local.get $3
|
||||
local.set $4
|
||||
local.set $6
|
||||
local.get $2
|
||||
local.set $5
|
||||
call $~lib/bindings/Math/random
|
||||
@ -68,17 +66,17 @@
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
end
|
||||
local.set $6
|
||||
local.set $4
|
||||
global.get $assembly/index/s
|
||||
local.get $5
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $4
|
||||
local.get $6
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $6
|
||||
local.get $4
|
||||
i32.store
|
||||
end
|
||||
local.get $3
|
||||
@ -135,368 +133,364 @@
|
||||
i32.lt_s
|
||||
i32.eqz
|
||||
br_if $break|0
|
||||
block
|
||||
local.get $2
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
local.get $0
|
||||
else
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.sub
|
||||
end
|
||||
local.set $3
|
||||
local.get $2
|
||||
local.get $2
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
local.get $0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
else
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.sub
|
||||
end
|
||||
local.set $3
|
||||
local.get $2
|
||||
local.get $0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
else
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
end
|
||||
local.set $4
|
||||
block $break|1
|
||||
i32.const 0
|
||||
local.set $5
|
||||
loop $repeat|1
|
||||
local.get $5
|
||||
global.get $assembly/index/w
|
||||
i32.lt_s
|
||||
i32.eqz
|
||||
br_if $break|1
|
||||
local.get $5
|
||||
i32.const 0
|
||||
else
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
end
|
||||
local.set $4
|
||||
block $break|1
|
||||
i32.const 0
|
||||
local.set $5
|
||||
loop $repeat|1
|
||||
i32.eq
|
||||
if (result i32)
|
||||
local.get $1
|
||||
else
|
||||
local.get $5
|
||||
global.get $assembly/index/w
|
||||
i32.lt_s
|
||||
i32.eqz
|
||||
br_if $break|1
|
||||
block
|
||||
local.get $5
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
local.get $1
|
||||
else
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.sub
|
||||
end
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $1
|
||||
i32.eq
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
else
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.add
|
||||
end
|
||||
local.set $7
|
||||
block $assembly/index/get|inlined.0 (result i32)
|
||||
local.get $6
|
||||
local.set $8
|
||||
local.get $3
|
||||
local.set $9
|
||||
local.get $9
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $8
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
block $assembly/index/get|inlined.1 (result i32)
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.2 (result i32)
|
||||
local.get $7
|
||||
local.set $8
|
||||
local.get $3
|
||||
local.set $9
|
||||
local.get $9
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $8
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.3 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.4 (result i32)
|
||||
local.get $7
|
||||
local.set $8
|
||||
local.get $2
|
||||
local.set $9
|
||||
local.get $9
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $8
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.5 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.6 (result i32)
|
||||
local.get $5
|
||||
local.set $8
|
||||
local.get $4
|
||||
local.set $9
|
||||
local.get $9
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $8
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.7 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
local.set $8
|
||||
block $assembly/index/get|inlined.8 (result i32)
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.get $2
|
||||
local.set $10
|
||||
local.get $10
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
local.set $10
|
||||
local.get $10
|
||||
i32.const 1
|
||||
i32.and
|
||||
if
|
||||
local.get $8
|
||||
i32.const 14
|
||||
i32.and
|
||||
i32.const 2
|
||||
i32.eq
|
||||
if
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.get $2
|
||||
local.set $11
|
||||
local.get $10
|
||||
local.set $12
|
||||
local.get $12
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
i32.sub
|
||||
local.tee $13
|
||||
i32.const 0
|
||||
local.tee $14
|
||||
local.get $13
|
||||
local.get $14
|
||||
i32.gt_s
|
||||
select
|
||||
local.set $13
|
||||
block $assembly/index/set|inlined.1
|
||||
local.get $9
|
||||
local.set $14
|
||||
local.get $11
|
||||
local.set $15
|
||||
local.get $13
|
||||
i32.const 24
|
||||
i32.shl
|
||||
local.get $12
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $16
|
||||
global.get $assembly/index/s
|
||||
local.get $15
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $14
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $16
|
||||
i32.store
|
||||
end
|
||||
else
|
||||
local.get $5
|
||||
local.set $13
|
||||
local.get $2
|
||||
local.set $12
|
||||
global.get $assembly/config/BGR_DEAD
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $11
|
||||
global.get $assembly/index/s
|
||||
local.get $12
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $13
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $11
|
||||
i32.store
|
||||
end
|
||||
else
|
||||
local.get $8
|
||||
i32.const 3
|
||||
i32.eq
|
||||
if
|
||||
local.get $5
|
||||
local.set $11
|
||||
local.get $2
|
||||
local.set $12
|
||||
global.get $assembly/config/BGR_ALIVE
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $13
|
||||
global.get $assembly/index/s
|
||||
local.get $12
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $11
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $13
|
||||
i32.store
|
||||
else
|
||||
local.get $5
|
||||
local.set $13
|
||||
local.get $2
|
||||
local.set $12
|
||||
local.get $10
|
||||
local.set $11
|
||||
local.get $11
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
i32.sub
|
||||
local.tee $9
|
||||
i32.const 0
|
||||
local.tee $16
|
||||
local.get $9
|
||||
local.get $16
|
||||
i32.gt_s
|
||||
select
|
||||
local.set $9
|
||||
block $assembly/index/set|inlined.4
|
||||
local.get $13
|
||||
local.set $16
|
||||
local.get $12
|
||||
local.set $15
|
||||
local.get $9
|
||||
i32.const 24
|
||||
i32.shl
|
||||
local.get $11
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $14
|
||||
global.get $assembly/index/s
|
||||
local.get $15
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $16
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $14
|
||||
i32.store
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
i32.const 1
|
||||
i32.sub
|
||||
end
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $1
|
||||
i32.eq
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
else
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $5
|
||||
br $repeat|1
|
||||
unreachable
|
||||
end
|
||||
local.set $7
|
||||
block $assembly/index/get|inlined.0 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
block $assembly/index/get|inlined.1 (result i32)
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.2 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.3 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.4 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.5 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.6 (result i32)
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.7 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
local.set $9
|
||||
block $assembly/index/get|inlined.8 (result i32)
|
||||
local.get $5
|
||||
local.set $10
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $10
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
local.set $10
|
||||
local.get $10
|
||||
i32.const 1
|
||||
i32.and
|
||||
if
|
||||
local.get $9
|
||||
i32.const 14
|
||||
i32.and
|
||||
i32.const 2
|
||||
i32.eq
|
||||
if
|
||||
local.get $5
|
||||
local.set $12
|
||||
local.get $2
|
||||
local.set $11
|
||||
local.get $10
|
||||
local.set $8
|
||||
local.get $8
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
i32.sub
|
||||
local.tee $13
|
||||
i32.const 0
|
||||
local.tee $14
|
||||
local.get $13
|
||||
local.get $14
|
||||
i32.gt_s
|
||||
select
|
||||
local.set $13
|
||||
block $assembly/index/set|inlined.1
|
||||
local.get $12
|
||||
local.set $16
|
||||
local.get $11
|
||||
local.set $15
|
||||
local.get $13
|
||||
i32.const 24
|
||||
i32.shl
|
||||
local.get $8
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $14
|
||||
global.get $assembly/index/s
|
||||
local.get $15
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $16
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $14
|
||||
i32.store
|
||||
end
|
||||
else
|
||||
local.get $5
|
||||
local.set $16
|
||||
local.get $2
|
||||
local.set $15
|
||||
global.get $assembly/config/BGR_DEAD
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $14
|
||||
global.get $assembly/index/s
|
||||
local.get $15
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $16
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $14
|
||||
i32.store
|
||||
end
|
||||
else
|
||||
local.get $9
|
||||
i32.const 3
|
||||
i32.eq
|
||||
if
|
||||
local.get $5
|
||||
local.set $12
|
||||
local.get $2
|
||||
local.set $11
|
||||
global.get $assembly/config/BGR_ALIVE
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $8
|
||||
global.get $assembly/index/s
|
||||
local.get $11
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $12
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $8
|
||||
i32.store
|
||||
else
|
||||
local.get $5
|
||||
local.set $15
|
||||
local.get $2
|
||||
local.set $14
|
||||
local.get $10
|
||||
local.set $13
|
||||
local.get $13
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
i32.sub
|
||||
local.tee $12
|
||||
i32.const 0
|
||||
local.tee $11
|
||||
local.get $12
|
||||
local.get $11
|
||||
i32.gt_s
|
||||
select
|
||||
local.set $12
|
||||
block $assembly/index/set|inlined.4
|
||||
local.get $15
|
||||
local.set $11
|
||||
local.get $14
|
||||
local.set $8
|
||||
local.get $12
|
||||
i32.const 24
|
||||
i32.shl
|
||||
local.get $13
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $16
|
||||
global.get $assembly/index/s
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $11
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $16
|
||||
i32.store
|
||||
end
|
||||
end
|
||||
end
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $5
|
||||
br $repeat|1
|
||||
unreachable
|
||||
end
|
||||
unreachable
|
||||
end
|
||||
local.get $2
|
||||
i32.const 1
|
||||
@ -527,23 +521,23 @@
|
||||
f64.lt
|
||||
if
|
||||
local.get $3
|
||||
local.set $4
|
||||
local.set $6
|
||||
local.get $1
|
||||
local.set $5
|
||||
global.get $assembly/config/BGR_ALIVE
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $6
|
||||
local.set $4
|
||||
global.get $assembly/index/s
|
||||
local.get $5
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $4
|
||||
local.get $6
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $6
|
||||
local.get $4
|
||||
i32.store
|
||||
end
|
||||
local.get $3
|
||||
|
@ -3,8 +3,8 @@
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --importMemory --sourceMap --debug --validate --measure",
|
||||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath -O3 --importMemory --sourceMap --validate --measure",
|
||||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime none --importMemory --sourceMap --debug --validate --measure",
|
||||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath -O3 --runtime none --importMemory --sourceMap --validate --measure",
|
||||
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
|
||||
"server": "http-server . -o -c-1"
|
||||
},
|
||||
|
@ -1,132 +0,0 @@
|
||||
@assemblyscript/i64
|
||||
===================
|
||||
|
||||
Exposes WebAssembly's i64 operations to JavaScript using 32-bit integers (low and high bits).
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```
|
||||
$> npm install @assemblyscript/i64
|
||||
```
|
||||
|
||||
```ts
|
||||
import * as i64 from "@assemblyscript/i64";
|
||||
|
||||
i64.div(10, 0, 2, 0);
|
||||
|
||||
console.log("result: lo=" + i64.getLo() + ", hi=" + i64.getHi());
|
||||
```
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
**Note** that `u32` is just an alias of `number` in JavaScript with values in 32-bit integer range.
|
||||
|
||||
* **getLo**(): `u32`<br />
|
||||
Gets the low 32 bits of the computed 64-bit value.
|
||||
|
||||
* **getHi**(): `u32`<br />
|
||||
Gets the high 32 bits of the computed 64-bit value.
|
||||
|
||||
* **clz**(loLeft: `u32`, hiLeft: `u32`): `void`<br />
|
||||
Performs the sign-agnostic count leading zero bits operation. All zero bits are considered leading if the value is zero.
|
||||
|
||||
* **ctz**(loLeft: `u32`, hiLeft: `u32`): `void`<br />
|
||||
Performs the sign-agnostic count tailing zero bits operation. All zero bits are considered trailing if the value is zero.
|
||||
|
||||
* **popcnt**(loLeft: `u32`, hiLeft: `u32`): `void`<br />
|
||||
Performs the sign-agnostic count number of one bits operation.
|
||||
|
||||
* **eqz**(loLeft: `u32`, hiLeft: `u32`): `void`<br />
|
||||
Performs the sign-agnostic equals-zero operation.
|
||||
|
||||
* **add**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic addition operation.
|
||||
|
||||
* **sub**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic subtraction operation.
|
||||
|
||||
* **mul**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic multiplication operation.
|
||||
|
||||
* **div_s**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the signed division operation.
|
||||
|
||||
* **div_u**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the unsigned division operation.
|
||||
|
||||
* **rem_s**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the signed remainder operation.
|
||||
|
||||
* **rem_u**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the unsigned remainder operation.
|
||||
|
||||
* **and**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic bitwise and operation.
|
||||
|
||||
* **or**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic bitwise or operation.
|
||||
|
||||
* **xor**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic bitwise xor operation.
|
||||
|
||||
* **shl**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic bitwise shift left operation.
|
||||
|
||||
* **shr_s**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the signed bitwise shift right operation.
|
||||
|
||||
* **shr_u**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the unsigned bitwise shift right operation.
|
||||
|
||||
* **rotl**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic rotate left operation.
|
||||
|
||||
* **rotr**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic rotate right operation.
|
||||
|
||||
* **eq**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic compare equal operation.
|
||||
|
||||
* **ne**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the sign-agnostic compare unequal operation.
|
||||
|
||||
* **lt_s**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the signed less than operation.
|
||||
|
||||
* **lt_u**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the unsigned less than operation.
|
||||
|
||||
* **le_s**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the signed less than or equal operation.
|
||||
|
||||
* **le_u**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the unsigned less than or equal operation.
|
||||
|
||||
* **gt_s**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the signed greater than operation.
|
||||
|
||||
* **gt_u**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the unsigned greater than operation.
|
||||
|
||||
* **ge_s**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the signed greater than or equal operation.
|
||||
|
||||
* **ge_u**(loLeft: `u32`, hiLeft: `u32`, loRight: `u32`, hiRight: `u32`): `void`<br />
|
||||
Performs the unsigned greater than or equal operation.
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
To build [assembly/i64.ts](./assembly/i64.ts) to an untouched and an optimized `.wasm` including their respective `.wat` representations, run:
|
||||
|
||||
```
|
||||
$> npm run asbuild
|
||||
```
|
||||
|
||||
Afterwards, to run the included [test](./tests/index.js):
|
||||
|
||||
```
|
||||
$> npm test
|
||||
```
|
@ -1,193 +0,0 @@
|
||||
var lo: u32, hi: u32;
|
||||
|
||||
export function getLo(): u32 {
|
||||
return lo;
|
||||
}
|
||||
|
||||
export function getHi(): u32 {
|
||||
return hi;
|
||||
}
|
||||
|
||||
import { clz as builtin_clz } from "builtins";
|
||||
|
||||
export function clz(loLeft: u32, hiLeft: u32): void {
|
||||
var ret = builtin_clz<u64>(<u64>loLeft | <u64>hiLeft << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
import { ctz as builtin_ctz } from "builtins";
|
||||
|
||||
export function ctz(loLeft: u32, hiLeft: u32): void {
|
||||
var ret = builtin_ctz<u64>(<u64>loLeft | <u64>hiLeft << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
import { popcnt as builtin_popcnt } from "builtins";
|
||||
|
||||
export function popcnt(loLeft: u32, hiLeft: u32): void {
|
||||
var ret = builtin_popcnt<u64>(<u64>loLeft | <u64>hiLeft << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function eqz(loLeft: u32, hiLeft: u32): void {
|
||||
var ret: bool = !(<u64>loLeft | <u64>hiLeft << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function add(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) + (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >> 32);
|
||||
}
|
||||
|
||||
export function sub(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) - (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >> 32);
|
||||
}
|
||||
|
||||
export function mul(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) * (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >> 32);
|
||||
}
|
||||
|
||||
export function div_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = <u64>(<i64>(<u64>loLeft | <u64>hiLeft << 32) / <i64>(<u64>loRight | <u64>hiRight << 32));
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >> 32);
|
||||
}
|
||||
|
||||
export function div_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) / (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >> 32);
|
||||
}
|
||||
|
||||
export function rem_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = <u64>(<i64>(<u64>loLeft | <u64>hiLeft << 32) % <i64>(<u64>loRight | <u64>hiRight << 32));
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >> 32);
|
||||
}
|
||||
|
||||
export function rem_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) % (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >>> 32);
|
||||
}
|
||||
|
||||
export function and(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) & (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >>> 32);
|
||||
}
|
||||
|
||||
export function or(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) | (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >>> 32);
|
||||
}
|
||||
|
||||
export function xor(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) ^ (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >>> 32);
|
||||
}
|
||||
|
||||
export function shl(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) << (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >>> 32);
|
||||
}
|
||||
|
||||
export function shr_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = <u64>(<i64>(<u64>loLeft | <u64>hiLeft << 32) >> <i64>(<u64>loRight | <u64>hiRight << 32));
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >>> 32);
|
||||
}
|
||||
|
||||
export function shr_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = (<u64>loLeft | <u64>hiLeft << 32) >> (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >>> 32);
|
||||
}
|
||||
|
||||
import { rotl as builtin_rotl } from "builtins";
|
||||
|
||||
export function rotl(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = builtin_rotl<u64>(<u64>loLeft | <u64>hiLeft << 32, <u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >>> 32);
|
||||
}
|
||||
|
||||
import { rotr as builtin_rotr } from "builtins";
|
||||
|
||||
export function rotr(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret = builtin_rotr<u64>(<u64>loLeft | <u64>hiLeft << 32, <u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = <u32>(ret >>> 32);
|
||||
}
|
||||
|
||||
export function eq(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = (<u64>loLeft | <u64>hiLeft << 32) == (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function ne(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = (<u64>loLeft | <u64>hiLeft << 32) != (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function lt_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = <i64>(<u64>loLeft | <u64>hiLeft << 32) < <i64>(<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function lt_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = (<u64>loLeft | <u64>hiLeft << 32) < (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function le_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = <i64>(<u64>loLeft | <u64>hiLeft << 32) <= <i64>(<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function le_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = (<u64>loLeft | <u64>hiLeft << 32) <= (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function gt_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = <i64>(<u64>loLeft | <u64>hiLeft << 32) > <i64>(<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function gt_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = (<u64>loLeft | <u64>hiLeft << 32) > (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function ge_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = <i64>(<u64>loLeft | <u64>hiLeft << 32) >= <i64>(<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
||||
|
||||
export function ge_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
|
||||
var ret: bool = (<u64>loLeft | <u64>hiLeft << 32) >= (<u64>loRight | <u64>hiRight << 32);
|
||||
lo = <u32>ret;
|
||||
hi = 0;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "../../../std/assembly.json",
|
||||
"include": [
|
||||
"./**/*.ts"
|
||||
]
|
||||
}
|
3
examples/i64-polyfill/build/.gitignore
vendored
3
examples/i64-polyfill/build/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
*.wasm
|
||||
*.wasm.map
|
||||
*.asm.js
|
47
examples/i64-polyfill/build/optimized.d.ts
vendored
47
examples/i64-polyfill/build/optimized.d.ts
vendored
@ -1,47 +0,0 @@
|
||||
declare module ASModule {
|
||||
type i8 = number;
|
||||
type i16 = number;
|
||||
type i32 = number;
|
||||
type u8 = number;
|
||||
type u16 = number;
|
||||
type u32 = number;
|
||||
type f32 = number;
|
||||
type f64 = number;
|
||||
type bool = any;
|
||||
const NaN: f64;
|
||||
const Infinity: f64;
|
||||
var lo: u32;
|
||||
var hi: u32;
|
||||
function getLo(): u32;
|
||||
function getHi(): u32;
|
||||
function clz(loLeft: u32, hiLeft: u32): void;
|
||||
function ctz(loLeft: u32, hiLeft: u32): void;
|
||||
function popcnt(loLeft: u32, hiLeft: u32): void;
|
||||
function eqz(loLeft: u32, hiLeft: u32): void;
|
||||
function add(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function sub(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function mul(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function div_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function div_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function rem_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function rem_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function and(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function or(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function xor(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function shl(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function shr_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function shr_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function rotl(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function rotr(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function eq(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function ne(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function lt_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function lt_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function le_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function le_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function gt_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function gt_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function ge_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
function ge_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
}
|
||||
export default ASModule;
|
@ -1,698 +0,0 @@
|
||||
(module
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(type $FUNCSIG$vii (func (param i32 i32)))
|
||||
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
|
||||
(type $FUNCSIG$v (func))
|
||||
(memory $0 0)
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $assembly/i64/lo (mut i32) (i32.const 0))
|
||||
(global $assembly/i64/hi (mut i32) (i32.const 0))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "getLo" (func $assembly/i64/getLo))
|
||||
(export "getHi" (func $assembly/i64/getHi))
|
||||
(export "clz" (func $assembly/i64/clz))
|
||||
(export "ctz" (func $assembly/i64/ctz))
|
||||
(export "popcnt" (func $assembly/i64/popcnt))
|
||||
(export "eqz" (func $assembly/i64/eqz))
|
||||
(export "add" (func $assembly/i64/add))
|
||||
(export "sub" (func $assembly/i64/sub))
|
||||
(export "mul" (func $assembly/i64/mul))
|
||||
(export "div_s" (func $assembly/i64/div_s))
|
||||
(export "div_u" (func $assembly/i64/div_u))
|
||||
(export "rem_s" (func $assembly/i64/rem_s))
|
||||
(export "rem_u" (func $assembly/i64/rem_u))
|
||||
(export "and" (func $assembly/i64/and))
|
||||
(export "or" (func $assembly/i64/or))
|
||||
(export "xor" (func $assembly/i64/xor))
|
||||
(export "shl" (func $assembly/i64/shl))
|
||||
(export "shr_s" (func $assembly/i64/shr_s))
|
||||
(export "shr_u" (func $assembly/i64/shr_u))
|
||||
(export "rotl" (func $assembly/i64/rotl))
|
||||
(export "rotr" (func $assembly/i64/rotr))
|
||||
(export "eq" (func $assembly/i64/eq))
|
||||
(export "ne" (func $assembly/i64/ne))
|
||||
(export "lt_s" (func $assembly/i64/lt_s))
|
||||
(export "lt_u" (func $assembly/i64/lt_u))
|
||||
(export "le_s" (func $assembly/i64/le_s))
|
||||
(export "le_u" (func $assembly/i64/le_u))
|
||||
(export "gt_s" (func $assembly/i64/gt_s))
|
||||
(export "gt_u" (func $assembly/i64/gt_u))
|
||||
(export "ge_s" (func $assembly/i64/ge_s))
|
||||
(export "ge_u" (func $assembly/i64/ge_u))
|
||||
(func $assembly/i64/getLo (; 0 ;) (type $FUNCSIG$i) (result i32)
|
||||
global.get $assembly/i64/lo
|
||||
)
|
||||
(func $assembly/i64/getHi (; 1 ;) (type $FUNCSIG$i) (result i32)
|
||||
global.get $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/clz (; 2 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.clz
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/ctz (; 3 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.ctz
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/popcnt (; 4 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.popcnt
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/eqz (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.eqz
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/add (; 6 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.add
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/sub (; 7 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.sub
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/mul (; 8 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.mul
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/div_s (; 9 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.div_s
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/div_u (; 10 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.div_u
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/rem_s (; 11 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.rem_s
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/rem_u (; 12 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.rem_u
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/and (; 13 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.and
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/or (; 14 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.or
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/xor (; 15 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.xor
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/shl (; 16 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.shl
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/shr_s (; 17 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.shr_s
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/shr_u (; 18 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.shr_u
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/rotl (; 19 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.rotl
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/rotr (; 20 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.rotr
|
||||
local.tee $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/eq (; 21 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.eq
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/ne (; 22 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.ne
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/lt_s (; 23 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.lt_s
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/lt_u (; 24 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.lt_u
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/le_s (; 25 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.le_s
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/le_u (; 26 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.le_u
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/gt_s (; 27 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.gt_s
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/gt_u (; 28 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.gt_u
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/ge_s (; 29 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.ge_s
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/ge_u (; 30 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.ge_u
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $null (; 31 ;) (type $FUNCSIG$v)
|
||||
nop
|
||||
)
|
||||
)
|
@ -1,755 +0,0 @@
|
||||
(module
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(type $FUNCSIG$vii (func (param i32 i32)))
|
||||
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
|
||||
(type $FUNCSIG$v (func))
|
||||
(memory $0 0)
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $assembly/i64/lo (mut i32) (i32.const 0))
|
||||
(global $assembly/i64/hi (mut i32) (i32.const 0))
|
||||
(global $~lib/memory/HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "getLo" (func $assembly/i64/getLo))
|
||||
(export "getHi" (func $assembly/i64/getHi))
|
||||
(export "clz" (func $assembly/i64/clz))
|
||||
(export "ctz" (func $assembly/i64/ctz))
|
||||
(export "popcnt" (func $assembly/i64/popcnt))
|
||||
(export "eqz" (func $assembly/i64/eqz))
|
||||
(export "add" (func $assembly/i64/add))
|
||||
(export "sub" (func $assembly/i64/sub))
|
||||
(export "mul" (func $assembly/i64/mul))
|
||||
(export "div_s" (func $assembly/i64/div_s))
|
||||
(export "div_u" (func $assembly/i64/div_u))
|
||||
(export "rem_s" (func $assembly/i64/rem_s))
|
||||
(export "rem_u" (func $assembly/i64/rem_u))
|
||||
(export "and" (func $assembly/i64/and))
|
||||
(export "or" (func $assembly/i64/or))
|
||||
(export "xor" (func $assembly/i64/xor))
|
||||
(export "shl" (func $assembly/i64/shl))
|
||||
(export "shr_s" (func $assembly/i64/shr_s))
|
||||
(export "shr_u" (func $assembly/i64/shr_u))
|
||||
(export "rotl" (func $assembly/i64/rotl))
|
||||
(export "rotr" (func $assembly/i64/rotr))
|
||||
(export "eq" (func $assembly/i64/eq))
|
||||
(export "ne" (func $assembly/i64/ne))
|
||||
(export "lt_s" (func $assembly/i64/lt_s))
|
||||
(export "lt_u" (func $assembly/i64/lt_u))
|
||||
(export "le_s" (func $assembly/i64/le_s))
|
||||
(export "le_u" (func $assembly/i64/le_u))
|
||||
(export "gt_s" (func $assembly/i64/gt_s))
|
||||
(export "gt_u" (func $assembly/i64/gt_u))
|
||||
(export "ge_s" (func $assembly/i64/ge_s))
|
||||
(export "ge_u" (func $assembly/i64/ge_u))
|
||||
(func $assembly/i64/getLo (; 0 ;) (type $FUNCSIG$i) (result i32)
|
||||
global.get $assembly/i64/lo
|
||||
)
|
||||
(func $assembly/i64/getHi (; 1 ;) (type $FUNCSIG$i) (result i32)
|
||||
global.get $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/clz (; 2 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
(local $2 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.clz
|
||||
local.set $2
|
||||
local.get $2
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/ctz (; 3 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
(local $2 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.ctz
|
||||
local.set $2
|
||||
local.get $2
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/popcnt (; 4 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
(local $2 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.popcnt
|
||||
local.set $2
|
||||
local.get $2
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/eqz (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.eqz
|
||||
local.set $2
|
||||
local.get $2
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/add (; 6 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.add
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/sub (; 7 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.sub
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/mul (; 8 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.mul
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/div_s (; 9 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.div_s
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/div_u (; 10 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.div_u
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/rem_s (; 11 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.rem_s
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/rem_u (; 12 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.rem_u
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/and (; 13 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.and
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/or (; 14 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.or
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/xor (; 15 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.xor
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/shl (; 16 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.shl
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/shr_s (; 17 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.shr_s
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/shr_u (; 18 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.shr_u
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/rotl (; 19 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.rotl
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/rotr (; 20 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i64)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.rotr
|
||||
local.set $4
|
||||
local.get $4
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/lo
|
||||
local.get $4
|
||||
i64.const 32
|
||||
i64.shr_u
|
||||
i32.wrap_i64
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/eq (; 21 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.eq
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/ne (; 22 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.ne
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/lt_s (; 23 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.lt_s
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/lt_u (; 24 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.lt_u
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/le_s (; 25 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.le_s
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/le_u (; 26 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.le_u
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/gt_s (; 27 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.gt_s
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/gt_u (; 28 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.gt_u
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/ge_s (; 29 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.ge_s
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $assembly/i64/ge_u (; 30 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 i32)
|
||||
local.get $0
|
||||
i64.extend_i32_u
|
||||
local.get $1
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
local.get $2
|
||||
i64.extend_i32_u
|
||||
local.get $3
|
||||
i64.extend_i32_u
|
||||
i64.const 32
|
||||
i64.shl
|
||||
i64.or
|
||||
i64.ge_u
|
||||
local.set $4
|
||||
local.get $4
|
||||
global.set $assembly/i64/lo
|
||||
i32.const 0
|
||||
global.set $assembly/i64/hi
|
||||
)
|
||||
(func $null (; 31 ;) (type $FUNCSIG$v)
|
||||
)
|
||||
)
|
63
examples/i64-polyfill/index.d.ts
vendored
63
examples/i64-polyfill/index.d.ts
vendored
@ -1,63 +0,0 @@
|
||||
type u32 = number;
|
||||
/** Gets the low 32 bits of the computed 64-bit value. */
|
||||
export function getLo(): u32;
|
||||
/** Gets the high 32 bits of the computed 64-bit value. */
|
||||
export function getHi(): u32;
|
||||
/** Performs the sign-agnostic count leading zero bits operation. All zero bits are considered leading if the value is zero. */
|
||||
export function clz(loLeft: u32, hiLeft: u32): void;
|
||||
/** Performs the sign-agnostic count tailing zero bits operation. All zero bits are considered trailing if the value is zero. */
|
||||
export function ctz(loLeft: u32, hiLeft: u32): void;
|
||||
/** Performs the sign-agnostic count number of one bits operation. */
|
||||
export function popcnt(loLeft: u32, hiLeft: u32): void;
|
||||
/** Performs the sign-agnostic equals-zero operation. */
|
||||
export function eqz(loLeft: u32, hiLeft: u32): void;
|
||||
/** Performs the sign-agnostic addition operation. */
|
||||
export function add(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic subtraction operation. */
|
||||
export function sub(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic multiplication operation. */
|
||||
export function mul(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the signed division operation. */
|
||||
export function div_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the unsigned division operation. */
|
||||
export function div_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the signed remainder operation. */
|
||||
export function rem_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the unsigned remainder operation. */
|
||||
export function rem_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic bitwise and operation. */
|
||||
export function and(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic bitwise or operation. */
|
||||
export function or(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic bitwise xor operation. */
|
||||
export function xor(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic bitwise shift left operation. */
|
||||
export function shl(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the signed bitwise shift right operation. */
|
||||
export function shr_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the unsigned bitwise shift right operation. */
|
||||
export function shr_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic rotate left operation. */
|
||||
export function rotl(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic rotate right operation. */
|
||||
export function rotr(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic compare equal operation. */
|
||||
export function eq(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the sign-agnostic compare unequal operation. */
|
||||
export function ne(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the signed less than operation. */
|
||||
export function lt_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the unsigned less than operation. */
|
||||
export function lt_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the signed less than or equal operation. */
|
||||
export function le_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the unsigned less than or equal operation. */
|
||||
export function le_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the signed greater than operation.*/
|
||||
export function gt_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the unsigned greater than operation.*/
|
||||
export function gt_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the signed greater than or equal operation. */
|
||||
export function ge_s(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
||||
/** Performs the unsigned greater than or equal operation. */
|
||||
export function ge_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void;
|
@ -1,8 +0,0 @@
|
||||
var fs = require("fs");
|
||||
|
||||
// Instantiate the module
|
||||
var mod = new WebAssembly.Module(fs.readFileSync(__dirname + "/build/optimized.wasm"));
|
||||
var ins = new WebAssembly.Instance(mod, { /* no imports */ });
|
||||
|
||||
// Export its exports
|
||||
module.exports = ins.exports;
|
@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "@assemblyscript/i64",
|
||||
"version": "1.0.0",
|
||||
"author": "Daniel Wirtz <dcode+assemblyscript@dcode.io>",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/AssemblyScript/assemblyscript.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/AssemblyScript/assemblyscript/issues"
|
||||
},
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
|
||||
"asbuild:untouched": "asc assembly/i64.ts -t build/untouched.wat -b build/untouched.wasm --validate --sourceMap --debug --measure",
|
||||
"asbuild:optimized": "asc -O assembly/i64.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --validate --sourceMap --measure",
|
||||
"test": "node tests"
|
||||
},
|
||||
"files": [
|
||||
"assembly/",
|
||||
"build/optimized.wasm",
|
||||
"build/optimized.wasm.map",
|
||||
"index.d.ts",
|
||||
"index.js",
|
||||
"README.md"
|
||||
]
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
var assert = require("assert");
|
||||
|
||||
function assertUnary(op, loLeft, hiLeft, loResult, hiResult) {
|
||||
op(loLeft, hiLeft);
|
||||
assert.strictEqual(i64.getLo(), loResult);
|
||||
assert.strictEqual(i64.getHi(), hiResult);
|
||||
}
|
||||
|
||||
function assertBinary(op, loLeft, hiLeft, loRight, hiRight, loResult, hiResult) {
|
||||
op(loLeft, hiLeft, loLeft, loRight);
|
||||
assert.strictEqual(i64.getLo(), loResult);
|
||||
assert.strictEqual(i64.getHi(), hiResult);
|
||||
}
|
||||
|
||||
var i64 = require("..");
|
||||
|
||||
assertUnary(i64.clz, 1, 0, 63, 0);
|
||||
assertUnary(i64.clz, 0, 1, 31, 0);
|
||||
assertUnary(i64.clz, 1, 1, 31, 0);
|
||||
assertUnary(i64.clz, 0, 0, 64, 0);
|
||||
|
||||
assertUnary(i64.ctz, 0, 0x80000000, 63, 0);
|
||||
assertUnary(i64.ctz, 0x80000000, 0x80000000, 31, 0);
|
||||
assertUnary(i64.ctz, 0, 1, 32, 0);
|
||||
assertUnary(i64.ctz, 1, 0, 0, 0);
|
||||
assertUnary(i64.ctz, 0, 0, 64, 0);
|
||||
|
||||
assertUnary(i64.popcnt, 0x55555555, 0x55555555, 32, 0);
|
||||
assertUnary(i64.popcnt, -1, -1, 64, 0);
|
||||
assertUnary(i64.popcnt, 0, 0, 0, 0);
|
||||
assertUnary(i64.popcnt, 0x55, 0, 4, 0);
|
||||
assertUnary(i64.popcnt, 0, 0x55, 4, 0);
|
||||
assertUnary(i64.popcnt, 0x55, 0x55, 8, 0);
|
||||
|
||||
assertUnary(i64.eqz, 0, 0, 1, 0);
|
||||
assertUnary(i64.eqz, 0, 1, 0, 0);
|
||||
assertUnary(i64.eqz, 1, 0, 0, 0);
|
||||
assertUnary(i64.eqz, 1, 1, 0, 0);
|
||||
|
||||
// TODO...
|
||||
|
||||
console.log("ok");
|
@ -43,7 +43,7 @@ export function computeLine(y: u32, width: u32, height: u32, limit: u32): void {
|
||||
let sqd = ix * ix + iy * iy;
|
||||
if (sqd > 1.0) {
|
||||
let frac = Math.log2(0.5 * Math.log(sqd));
|
||||
col = <u32>((NUM_COLORS - 1) * clamp((iteration + 1 - frac) * invLimit, 0.0, 1.0));
|
||||
col = <u32>((NUM_COLORS - 1) * clamp<f64>((iteration + 1 - frac) * invLimit, 0.0, 1.0));
|
||||
}
|
||||
store<u16>(stride + (x << 1), col);
|
||||
}
|
||||
|
6
examples/mandelbrot/build/optimized.d.ts
vendored
6
examples/mandelbrot/build/optimized.d.ts
vendored
@ -8,12 +8,6 @@ declare module ASModule {
|
||||
type f32 = number;
|
||||
type f64 = number;
|
||||
type bool = any;
|
||||
namespace JSMath {
|
||||
function log(x: f64): f64;
|
||||
function log2(x: f64): f64;
|
||||
}
|
||||
var NUM_COLORS: i32;
|
||||
function computeLine(y: u32, width: u32, height: u32, limit: u32): void;
|
||||
function clamp<f64>(value: f64, minValue: f64, maxValue: f64): f64;
|
||||
}
|
||||
export default ASModule;
|
||||
|
Binary file not shown.
@ -5,52 +5,51 @@
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(import "Math" "log" (func $~lib/bindings/Math/log (param f64) (result f64)))
|
||||
(import "Math" "log2" (func $~lib/bindings/Math/log2 (param f64) (result f64)))
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "computeLine" (func $assembly/index/computeLine))
|
||||
(func $assembly/index/computeLine (; 2 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 f64)
|
||||
(local $5 f64)
|
||||
(local $6 f64)
|
||||
(local $7 i32)
|
||||
(local $8 f64)
|
||||
(local $8 i32)
|
||||
(local $9 f64)
|
||||
(local $10 f64)
|
||||
(local $11 f64)
|
||||
(local $12 f64)
|
||||
(local $13 f64)
|
||||
(local $14 f64)
|
||||
f64.const 10
|
||||
f64.const 3
|
||||
(local $15 f64)
|
||||
local.get $1
|
||||
f64.convert_i32_u
|
||||
local.tee $8
|
||||
local.tee $9
|
||||
f64.const 0.625
|
||||
f64.mul
|
||||
f64.const 4
|
||||
local.get $2
|
||||
f64.convert_i32_u
|
||||
local.tee $4
|
||||
f64.mul
|
||||
f64.min
|
||||
f64.div
|
||||
local.set $9
|
||||
local.set $4
|
||||
local.get $0
|
||||
f64.convert_i32_u
|
||||
local.get $4
|
||||
local.get $2
|
||||
f64.convert_i32_u
|
||||
local.tee $6
|
||||
f64.const 0.5
|
||||
f64.mul
|
||||
f64.sub
|
||||
f64.const 10
|
||||
f64.const 3
|
||||
local.get $9
|
||||
f64.mul
|
||||
local.set $10
|
||||
local.get $8
|
||||
f64.const 0.625
|
||||
f64.const 4
|
||||
local.get $6
|
||||
f64.mul
|
||||
local.get $9
|
||||
f64.min
|
||||
f64.div
|
||||
local.tee $10
|
||||
f64.mul
|
||||
local.set $12
|
||||
local.set $11
|
||||
local.get $4
|
||||
local.get $10
|
||||
f64.mul
|
||||
local.set $13
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.mul
|
||||
@ -62,34 +61,35 @@
|
||||
f64.convert_i32_u
|
||||
local.tee $6
|
||||
f64.div
|
||||
local.set $13
|
||||
local.set $14
|
||||
f64.const 8
|
||||
local.get $6
|
||||
f64.min
|
||||
local.set $8
|
||||
local.set $15
|
||||
loop $repeat|0
|
||||
local.get $7
|
||||
local.get $1
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $7
|
||||
block $break|0
|
||||
local.get $8
|
||||
local.get $1
|
||||
i32.ge_u
|
||||
br_if $break|0
|
||||
local.get $8
|
||||
f64.convert_i32_u
|
||||
local.get $9
|
||||
local.get $10
|
||||
f64.mul
|
||||
local.get $12
|
||||
local.get $13
|
||||
f64.sub
|
||||
local.set $11
|
||||
local.set $12
|
||||
f64.const 0
|
||||
local.set $4
|
||||
f64.const 0
|
||||
local.set $5
|
||||
i32.const 0
|
||||
local.set $2
|
||||
local.set $7
|
||||
loop $continue|1
|
||||
local.get $4
|
||||
local.get $4
|
||||
f64.mul
|
||||
local.tee $14
|
||||
local.tee $9
|
||||
local.get $5
|
||||
local.get $5
|
||||
f64.mul
|
||||
@ -104,31 +104,31 @@
|
||||
f64.mul
|
||||
local.get $5
|
||||
f64.mul
|
||||
local.get $10
|
||||
f64.add
|
||||
local.set $5
|
||||
local.get $14
|
||||
local.get $6
|
||||
f64.sub
|
||||
local.get $11
|
||||
f64.add
|
||||
local.set $5
|
||||
local.get $9
|
||||
local.get $6
|
||||
f64.sub
|
||||
local.get $12
|
||||
f64.add
|
||||
local.set $4
|
||||
local.get $2
|
||||
local.get $7
|
||||
local.get $3
|
||||
i32.ge_u
|
||||
br_if $break|1
|
||||
local.get $2
|
||||
local.get $7
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $2
|
||||
local.set $7
|
||||
br $continue|1
|
||||
end
|
||||
end
|
||||
end
|
||||
loop $continue|2
|
||||
local.get $2
|
||||
local.get $7
|
||||
f64.convert_i32_u
|
||||
local.get $8
|
||||
local.get $15
|
||||
f64.lt
|
||||
if
|
||||
local.get $4
|
||||
@ -138,7 +138,7 @@
|
||||
local.get $5
|
||||
f64.mul
|
||||
f64.sub
|
||||
local.get $11
|
||||
local.get $12
|
||||
f64.add
|
||||
local.set $6
|
||||
f64.const 2
|
||||
@ -146,19 +146,21 @@
|
||||
f64.mul
|
||||
local.get $5
|
||||
f64.mul
|
||||
local.get $10
|
||||
local.get $11
|
||||
f64.add
|
||||
local.set $5
|
||||
local.get $6
|
||||
local.set $4
|
||||
local.get $2
|
||||
local.get $7
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $2
|
||||
local.set $7
|
||||
br $continue|2
|
||||
end
|
||||
end
|
||||
local.get $7
|
||||
i32.const 2047
|
||||
local.set $2
|
||||
local.get $8
|
||||
i32.const 1
|
||||
i32.shl
|
||||
local.get $0
|
||||
@ -175,7 +177,7 @@
|
||||
f64.gt
|
||||
if (result i32)
|
||||
f64.const 2047
|
||||
local.get $2
|
||||
local.get $7
|
||||
i32.const 1
|
||||
i32.add
|
||||
f64.convert_i32_u
|
||||
@ -185,7 +187,7 @@
|
||||
f64.mul
|
||||
call $~lib/bindings/Math/log2
|
||||
f64.sub
|
||||
local.get $13
|
||||
local.get $14
|
||||
f64.mul
|
||||
f64.const 0
|
||||
f64.max
|
||||
@ -197,10 +199,10 @@
|
||||
i32.const 2047
|
||||
end
|
||||
i32.store16
|
||||
local.get $7
|
||||
local.get $8
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $7
|
||||
local.set $8
|
||||
br $repeat|0
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,6 @@
|
||||
(module
|
||||
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
|
||||
(type $FUNCSIG$dd (func (param f64) (result f64)))
|
||||
(type $FUNCSIG$dddd (func (param f64 f64 f64) (result f64)))
|
||||
(type $FUNCSIG$v (func))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(import "Math" "log" (func $~lib/bindings/Math/log (param f64) (result f64)))
|
||||
@ -9,18 +8,9 @@
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $assembly/index/NUM_COLORS i32 (i32.const 2048))
|
||||
(global $~lib/memory/HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "computeLine" (func $assembly/index/computeLine))
|
||||
(func $assembly/index/clamp<f64> (; 2 ;) (type $FUNCSIG$dddd) (param $0 f64) (param $1 f64) (param $2 f64) (result f64)
|
||||
local.get $0
|
||||
local.get $1
|
||||
f64.max
|
||||
local.get $2
|
||||
f64.min
|
||||
)
|
||||
(func $assembly/index/computeLine (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $assembly/index/computeLine (; 2 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(local $4 f64)
|
||||
(local $5 f64)
|
||||
(local $6 f64)
|
||||
@ -39,6 +29,9 @@
|
||||
(local $19 f64)
|
||||
(local $20 i32)
|
||||
(local $21 f64)
|
||||
(local $22 f64)
|
||||
(local $23 f64)
|
||||
(local $24 f64)
|
||||
local.get $1
|
||||
f64.convert_i32_u
|
||||
f64.const 1
|
||||
@ -101,127 +94,123 @@
|
||||
i32.lt_u
|
||||
i32.eqz
|
||||
br_if $break|0
|
||||
block
|
||||
local.get $12
|
||||
f64.convert_i32_u
|
||||
local.get $6
|
||||
f64.mul
|
||||
local.get $8
|
||||
f64.sub
|
||||
local.set $13
|
||||
f64.const 0
|
||||
local.set $14
|
||||
f64.const 0
|
||||
local.set $15
|
||||
i32.const 0
|
||||
local.set $18
|
||||
block $break|1
|
||||
loop $continue|1
|
||||
local.get $14
|
||||
local.get $12
|
||||
f64.convert_i32_u
|
||||
local.get $6
|
||||
f64.mul
|
||||
local.get $8
|
||||
f64.sub
|
||||
local.set $13
|
||||
f64.const 0
|
||||
local.set $14
|
||||
f64.const 0
|
||||
local.set $15
|
||||
i32.const 0
|
||||
local.set $18
|
||||
block $break|1
|
||||
loop $continue|1
|
||||
local.get $14
|
||||
local.get $14
|
||||
f64.mul
|
||||
local.tee $16
|
||||
local.get $15
|
||||
local.get $15
|
||||
f64.mul
|
||||
local.tee $17
|
||||
f64.add
|
||||
f64.const 4
|
||||
f64.le
|
||||
if
|
||||
f64.const 2
|
||||
local.get $14
|
||||
f64.mul
|
||||
local.tee $16
|
||||
local.get $15
|
||||
local.get $15
|
||||
f64.mul
|
||||
local.tee $17
|
||||
local.get $7
|
||||
f64.add
|
||||
f64.const 4
|
||||
f64.le
|
||||
if
|
||||
block
|
||||
f64.const 2
|
||||
local.get $14
|
||||
f64.mul
|
||||
local.get $15
|
||||
f64.mul
|
||||
local.get $7
|
||||
f64.add
|
||||
local.set $15
|
||||
local.get $16
|
||||
local.get $17
|
||||
f64.sub
|
||||
local.get $13
|
||||
f64.add
|
||||
local.set $14
|
||||
local.get $18
|
||||
local.get $3
|
||||
i32.ge_u
|
||||
if
|
||||
br $break|1
|
||||
end
|
||||
local.get $18
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $18
|
||||
end
|
||||
br $continue|1
|
||||
end
|
||||
end
|
||||
end
|
||||
block $break|2
|
||||
loop $continue|2
|
||||
local.set $15
|
||||
local.get $16
|
||||
local.get $17
|
||||
f64.sub
|
||||
local.get $13
|
||||
f64.add
|
||||
local.set $14
|
||||
local.get $18
|
||||
f64.convert_i32_u
|
||||
local.get $11
|
||||
f64.lt
|
||||
local.get $3
|
||||
i32.ge_u
|
||||
if
|
||||
block
|
||||
local.get $14
|
||||
local.get $14
|
||||
f64.mul
|
||||
local.get $15
|
||||
local.get $15
|
||||
f64.mul
|
||||
f64.sub
|
||||
local.get $13
|
||||
f64.add
|
||||
local.set $19
|
||||
f64.const 2
|
||||
local.get $14
|
||||
f64.mul
|
||||
local.get $15
|
||||
f64.mul
|
||||
local.get $7
|
||||
f64.add
|
||||
local.set $15
|
||||
local.get $19
|
||||
local.set $14
|
||||
local.get $18
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $18
|
||||
end
|
||||
br $continue|2
|
||||
br $break|1
|
||||
end
|
||||
local.get $18
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $18
|
||||
br $continue|1
|
||||
end
|
||||
end
|
||||
end
|
||||
block $break|2
|
||||
loop $continue|2
|
||||
local.get $18
|
||||
f64.convert_i32_u
|
||||
local.get $11
|
||||
f64.lt
|
||||
if
|
||||
local.get $14
|
||||
local.get $14
|
||||
f64.mul
|
||||
local.get $15
|
||||
local.get $15
|
||||
f64.mul
|
||||
f64.sub
|
||||
local.get $13
|
||||
f64.add
|
||||
local.set $19
|
||||
f64.const 2
|
||||
local.get $14
|
||||
f64.mul
|
||||
local.get $15
|
||||
f64.mul
|
||||
local.get $7
|
||||
f64.add
|
||||
local.set $15
|
||||
local.get $19
|
||||
local.set $14
|
||||
local.get $18
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $18
|
||||
br $continue|2
|
||||
end
|
||||
end
|
||||
end
|
||||
global.get $assembly/index/NUM_COLORS
|
||||
i32.const 1
|
||||
i32.sub
|
||||
local.set $20
|
||||
local.get $14
|
||||
local.get $14
|
||||
f64.mul
|
||||
local.get $15
|
||||
local.get $15
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $19
|
||||
local.get $19
|
||||
f64.const 1
|
||||
f64.gt
|
||||
if
|
||||
f64.const 0.5
|
||||
local.get $19
|
||||
call $~lib/bindings/Math/log
|
||||
f64.mul
|
||||
call $~lib/bindings/Math/log2
|
||||
local.set $21
|
||||
global.get $assembly/index/NUM_COLORS
|
||||
i32.const 1
|
||||
i32.sub
|
||||
local.set $20
|
||||
local.get $14
|
||||
local.get $14
|
||||
f64.mul
|
||||
local.get $15
|
||||
local.get $15
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $19
|
||||
local.get $19
|
||||
f64.const 1
|
||||
f64.gt
|
||||
if
|
||||
f64.const 0.5
|
||||
local.get $19
|
||||
call $~lib/bindings/Math/log
|
||||
f64.mul
|
||||
call $~lib/bindings/Math/log2
|
||||
local.set $21
|
||||
global.get $assembly/index/NUM_COLORS
|
||||
i32.const 1
|
||||
i32.sub
|
||||
f64.convert_i32_s
|
||||
f64.convert_i32_s
|
||||
block $assembly/index/clamp<f64>|inlined.0 (result f64)
|
||||
local.get $18
|
||||
i32.const 1
|
||||
i32.add
|
||||
@ -230,21 +219,28 @@
|
||||
f64.sub
|
||||
local.get $10
|
||||
f64.mul
|
||||
local.set $24
|
||||
f64.const 0
|
||||
local.set $23
|
||||
f64.const 1
|
||||
call $assembly/index/clamp<f64>
|
||||
f64.mul
|
||||
i32.trunc_f64_u
|
||||
local.set $20
|
||||
local.set $22
|
||||
local.get $24
|
||||
local.get $23
|
||||
f64.max
|
||||
local.get $22
|
||||
f64.min
|
||||
end
|
||||
local.get $9
|
||||
local.get $12
|
||||
i32.const 1
|
||||
i32.shl
|
||||
i32.add
|
||||
local.get $20
|
||||
i32.store16
|
||||
f64.mul
|
||||
i32.trunc_f64_u
|
||||
local.set $20
|
||||
end
|
||||
local.get $9
|
||||
local.get $12
|
||||
i32.const 1
|
||||
i32.shl
|
||||
i32.add
|
||||
local.get $20
|
||||
i32.store16
|
||||
local.get $12
|
||||
i32.const 1
|
||||
i32.add
|
||||
@ -255,6 +251,6 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $null (; 4 ;) (type $FUNCSIG$v)
|
||||
(func $null (; 3 ;) (type $FUNCSIG$v)
|
||||
)
|
||||
)
|
||||
|
@ -3,8 +3,8 @@
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --importMemory --sourceMap --debug --validate --measure",
|
||||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath -O3 --importMemory --sourceMap --validate --measure",
|
||||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime none --importMemory --sourceMap --debug --validate --measure",
|
||||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath --runtime none -O3 --importMemory --sourceMap --validate --measure",
|
||||
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
|
||||
"server": "http-server . -o -c-1"
|
||||
},
|
||||
|
@ -9,7 +9,7 @@ const imports = {
|
||||
env: {
|
||||
memory: new WebAssembly.Memory({ initial: 10 }),
|
||||
abort: (filename, line, column) => {
|
||||
throw Error("abort called at " + line + ":" + colum);
|
||||
throw Error("abort called at " + line + ":" + column);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,3 @@
|
||||
import "allocator/arena";
|
||||
|
||||
// From The Computer Language Benchmarks Game
|
||||
// http://benchmarksgame.alioth.debian.org
|
||||
|
||||
@ -96,7 +94,7 @@ class NBodySystem {
|
||||
py += b.vy * m;
|
||||
pz += b.vz * m;
|
||||
}
|
||||
bodies[0].offsetMomentum(px, py, pz);
|
||||
unchecked(bodies[0]).offsetMomentum(px, py, pz);
|
||||
}
|
||||
|
||||
advance(dt: float): void {
|
||||
@ -206,5 +204,5 @@ export function bench(steps: u32): void {
|
||||
|
||||
export function getBody(index: i32): Body | null {
|
||||
var bodies = system.bodies;
|
||||
return <u32>index < <u32>bodies.length ? bodies[index] : null;
|
||||
return <u32>index < <u32>bodies.length ? unchecked(bodies[index]) : null;
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
function asmFunc(global, env, buffer) {
|
||||
"almost asm";
|
||||
var HEAP8 = new global.Int8Array(buffer);
|
||||
@ -20,427 +21,231 @@ function asmFunc(global, env, buffer) {
|
||||
var abort = env.abort;
|
||||
var nan = global.NaN;
|
||||
var infinity = global.Infinity;
|
||||
var $lib_allocator_arena_startOffset = 0;
|
||||
var $lib_allocator_arena_offset = 0;
|
||||
var assembly_index_system = 0;
|
||||
var i64toi32_i32$HIGH_BITS = 0;
|
||||
function $lib_allocator_arena___memory_allocate($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, $2 = 0, $3 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_i32$2 = 0;
|
||||
if ($0 >>> 0 > 1073741824 >>> 0) abort();
|
||||
$1 = $lib_allocator_arena_offset;
|
||||
$2 = (($1 + (wasm2js_i32$0 = $0, wasm2js_i32$1 = 1, wasm2js_i32$2 = $0 >>> 0 > 1 >>> 0, wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0) + 7 | 0) & 4294967288 | 0;
|
||||
$3 = __wasm_current_memory();
|
||||
if ($2 >>> 0 > ($3 << 16 | 0) >>> 0) {
|
||||
$0 = ((($2 - $1 | 0) + 65535 | 0) & 4294901760 | 0) >>> 16 | 0;
|
||||
if ((__wasm_grow_memory((wasm2js_i32$0 = $3, wasm2js_i32$1 = $0, wasm2js_i32$2 = ($3 | 0) > ($0 | 0), wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0) | 0) < (0 | 0)) if ((__wasm_grow_memory($0 | 0) | 0) < (0 | 0)) abort();;
|
||||
var $lib_rt_stub_startOffset = 0;
|
||||
var $lib_rt_stub_offset = 0;
|
||||
function $lib_rt_stub___alloc($0, $1) {
|
||||
var $2 = 0, $3 = 0, $4 = 0, $5 = 0;
|
||||
if ($0 >>> 0 > 1073741808 >>> 0) {
|
||||
abort()
|
||||
}
|
||||
$lib_allocator_arena_offset = $2;
|
||||
return $1 | 0;
|
||||
$3 = $lib_rt_stub_offset + 16 | 0;
|
||||
$2 = (($3 + ($0 >>> 0 > 1 >>> 0 ? $0 : 1) | 0) + 15 | 0) & -16 | 0;
|
||||
$4 = __wasm_memory_size();
|
||||
if ($2 >>> 0 > ($4 << 16 | 0) >>> 0) {
|
||||
$5 = ((($2 - $3 | 0) + 65535 | 0) & -65536 | 0) >>> 16 | 0;
|
||||
if ((__wasm_memory_grow((($4 | 0) > ($5 | 0) ? $4 : $5) | 0) | 0) < (0 | 0)) {
|
||||
if ((__wasm_memory_grow($5 | 0) | 0) < (0 | 0)) {
|
||||
abort()
|
||||
}
|
||||
}
|
||||
}
|
||||
$lib_rt_stub_offset = $2;
|
||||
$2 = $3 - 16 | 0;
|
||||
HEAP32[($2 + 8 | 0) >> 2] = $1;
|
||||
HEAP32[($2 + 12 | 0) >> 2] = $0;
|
||||
return $3;
|
||||
}
|
||||
|
||||
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, $49 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0, wasm2js_i32$1 = 0;
|
||||
$7 = HEAP32[($0 + 4 | 0) >> 2] | 0;
|
||||
repeat_0 : do {
|
||||
var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0;
|
||||
$7 = HEAP32[($0 + 12 | 0) >> 2];
|
||||
repeat_0 : while (1) {
|
||||
if (($1 | 0) < ($7 | 0)) {
|
||||
$2 = HEAPU32[(((HEAPU32[$0 >> 2] | 0) + ($1 << 2 | 0) | 0) + 8 | 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;
|
||||
$2 = HEAP32[(HEAP32[($0 + 4 | 0) >> 2] + ($1 << 2 | 0) | 0) >> 2];
|
||||
$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;
|
||||
if (0 >>> 0 < ((HEAP32[$1 >> 2] | 0) >>> 2 | 0) >>> 0) $49 = HEAPU32[($1 + 8 | 0) >> 2] | 0; else abort();
|
||||
$1 = $49;
|
||||
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_allocator_arena___memory_allocate(4 | 0) | 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
return $1 | 0;
|
||||
};
|
||||
$1 = HEAP32[HEAP32[($0 + 4 | 0) >> 2] >> 2];
|
||||
HEAPF64[($1 + 24 | 0) >> 3] = -$4 / 39.47841760435743;
|
||||
HEAPF64[($1 + 32 | 0) >> 3] = -$5 / 39.47841760435743;
|
||||
HEAPF64[($1 + 40 | 0) >> 3] = -$6 / 39.47841760435743;
|
||||
$1 = $lib_rt_stub___alloc(4, 3);
|
||||
HEAP32[$1 >> 2] = $0;
|
||||
return $1;
|
||||
}
|
||||
|
||||
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_f64$0 = 0.0;
|
||||
$7 = $lib_allocator_arena___memory_allocate(56 | 0) | 0;
|
||||
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;
|
||||
var $7 = 0;
|
||||
$7 = $lib_rt_stub___alloc(56, 4);
|
||||
HEAPF64[$7 >> 3] = $0;
|
||||
HEAPF64[($7 + 8 | 0) >> 3] = $1;
|
||||
HEAPF64[($7 + 16 | 0) >> 3] = $2;
|
||||
HEAPF64[($7 + 24 | 0) >> 3] = $3;
|
||||
HEAPF64[($7 + 32 | 0) >> 3] = $4;
|
||||
HEAPF64[($7 + 40 | 0) >> 3] = $5;
|
||||
HEAPF64[($7 + 48 | 0) >> 3] = $6;
|
||||
return $7;
|
||||
}
|
||||
|
||||
function $lib_internal_memory_memset($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;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
$1 = $0 + 20 | 0;
|
||||
wasm2js_i32$0 = $1 - 1 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 1 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 2 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1 - 2 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1 - 3 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 3 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1 - 4 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP8[wasm2js_i32$0 >> 0] = wasm2js_i32$1;
|
||||
$1 = (0 - $0 | 0) & 3 | 0;
|
||||
$0 = $1 + $0 | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$2 = (20 - $1 | 0) & 4294967292 | 0;
|
||||
wasm2js_i32$0 = ($2 + $0 | 0) - 4 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
if ($2 >>> 0 <= 8 >>> 0) return;
|
||||
wasm2js_i32$0 = $0 + 4 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 8 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$1 = $0 + $2 | 0;
|
||||
wasm2js_i32$0 = $1 - 12 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1 - 8 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
if ($2 >>> 0 <= 24 >>> 0) return;
|
||||
wasm2js_i32$0 = $0 + 12 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 16 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 20 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 24 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$1 = $0 + $2 | 0;
|
||||
wasm2js_i32$0 = $1 - 28 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1 - 24 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1 - 20 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1 - 16 | 0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$1 = ($0 & 4 | 0) + 24 | 0;
|
||||
$0 = $1 + $0 | 0;
|
||||
$2 = $2 - $1 | 0;
|
||||
continue_0 : do {
|
||||
if ($2 >>> 0 >= 32 >>> 0) {
|
||||
i64toi32_i32$1 = $0;
|
||||
i64toi32_i32$0 = 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = i64toi32_i32$0;
|
||||
(wasm2js_i32$2 = wasm2js_i32$0, wasm2js_i32$3 = wasm2js_i32$1), ((HEAP8[(wasm2js_i32$2 + 4 | 0) >> 0] = wasm2js_i32$3 & 255 | 0, HEAP8[(wasm2js_i32$2 + 5 | 0) >> 0] = (wasm2js_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 6 | 0) >> 0] = (wasm2js_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 7 | 0) >> 0] = (wasm2js_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
i64toi32_i32$1 = $0 + 8 | 0;
|
||||
i64toi32_i32$0 = 0;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = i64toi32_i32$0;
|
||||
(wasm2js_i32$2 = wasm2js_i32$0, wasm2js_i32$3 = wasm2js_i32$1), ((HEAP8[(wasm2js_i32$2 + 4 | 0) >> 0] = wasm2js_i32$3 & 255 | 0, HEAP8[(wasm2js_i32$2 + 5 | 0) >> 0] = (wasm2js_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 6 | 0) >> 0] = (wasm2js_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 7 | 0) >> 0] = (wasm2js_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
i64toi32_i32$1 = $0 + 16 | 0;
|
||||
i64toi32_i32$0 = 0;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = i64toi32_i32$0;
|
||||
(wasm2js_i32$2 = wasm2js_i32$0, wasm2js_i32$3 = wasm2js_i32$1), ((HEAP8[(wasm2js_i32$2 + 4 | 0) >> 0] = wasm2js_i32$3 & 255 | 0, HEAP8[(wasm2js_i32$2 + 5 | 0) >> 0] = (wasm2js_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 6 | 0) >> 0] = (wasm2js_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 7 | 0) >> 0] = (wasm2js_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
i64toi32_i32$1 = $0 + 24 | 0;
|
||||
i64toi32_i32$0 = 0;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = i64toi32_i32$1;
|
||||
wasm2js_i32$1 = i64toi32_i32$0;
|
||||
(wasm2js_i32$2 = wasm2js_i32$0, wasm2js_i32$3 = wasm2js_i32$1), ((HEAP8[(wasm2js_i32$2 + 4 | 0) >> 0] = wasm2js_i32$3 & 255 | 0, HEAP8[(wasm2js_i32$2 + 5 | 0) >> 0] = (wasm2js_i32$3 >>> 8 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 6 | 0) >> 0] = (wasm2js_i32$3 >>> 16 | 0) & 255 | 0), HEAP8[(wasm2js_i32$2 + 7 | 0) >> 0] = (wasm2js_i32$3 >>> 24 | 0) & 255 | 0;
|
||||
$2 = $2 - 32 | 0;
|
||||
$0 = $0 + 32 | 0;
|
||||
continue continue_0;
|
||||
}
|
||||
break continue_0;
|
||||
} while (1);
|
||||
}
|
||||
|
||||
function $lib_array_Array_Body__constructor() {
|
||||
var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$1 = $lib_allocator_arena___memory_allocate(32 | 0) | 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = 20;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$0 = $lib_allocator_arena___memory_allocate(8 | 0) | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
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 = $1;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 5;
|
||||
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
|
||||
$lib_internal_memory_memset($1 + 8 | 0 | 0);
|
||||
return $0 | 0;
|
||||
function $lib_rt___allocArray() {
|
||||
var $0 = 0, $1 = 0;
|
||||
$0 = $lib_rt_stub___alloc(16, 5);
|
||||
$1 = $lib_rt_stub___alloc(20, 0);
|
||||
HEAP32[$0 >> 2] = $1;
|
||||
HEAP32[($0 + 4 | 0) >> 2] = $1;
|
||||
HEAP32[($0 + 8 | 0) >> 2] = 20;
|
||||
HEAP32[($0 + 12 | 0) >> 2] = 5;
|
||||
return $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 = assembly_index_Body_constructor(+(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0;
|
||||
wasm2js_i32$0 = HEAPU32[$1 >> 2] | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
$0 = assembly_index_Body_constructor(+(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0;
|
||||
wasm2js_i32$0 = (HEAPU32[$1 >> 2] | 0) + 4 | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
$0 = assembly_index_Body_constructor(+(8.34336671824458), +(4.124798564124305), +(-.4035234171143214), +(-1.0107743461787924), +(1.8256623712304119), +(.008415761376584154), +(.011286326131968767)) | 0;
|
||||
wasm2js_i32$0 = (HEAPU32[$1 >> 2] | 0) + 8 | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
$0 = assembly_index_Body_constructor(+(12.894369562139131), +(-15.111151401698631), +(-.22330757889265573), +(1.0827910064415354), +(.8687130181696082), +(-.010832637401363636), +(1.7237240570597112e-03)) | 0;
|
||||
wasm2js_i32$0 = (HEAPU32[$1 >> 2] | 0) + 12 | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
$0 = assembly_index_Body_constructor(+(15.379697114850917), +(-25.919314609987964), +(.17925877295037118), +(.979090732243898), +(.5946989986476762), +(-.034755955504078104), +(2.0336868699246304e-03)) | 0;
|
||||
wasm2js_i32$0 = (HEAPU32[$1 >> 2] | 0) + 16 | 0;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
assembly_index_system = assembly_index_NBodySystem_constructor($1 | 0) | 0;
|
||||
$1 = $lib_rt___allocArray();
|
||||
$0 = HEAP32[($1 + 4 | 0) >> 2];
|
||||
(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)), HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
(wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(4.841431442464721, -1.1603200440274284, -.10362204447112311, .606326392995832, 2.81198684491626, -.02521836165988763, .03769367487038949)), HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
|
||||
(wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(8.34336671824458, 4.124798564124305, -.4035234171143214, -1.0107743461787924, 1.8256623712304119, .008415761376584154, .011286326131968767)), HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
(wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(12.894369562139131, -15.111151401698631, -.22330757889265573, 1.0827910064415354, .8687130181696082, -.010832637401363636, 1.7237240570597112e-03)), HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1;
|
||||
(wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(15.379697114850917, -25.919314609987964, .17925877295037118, .979090732243898, .5946989986476762, -.034755955504078104, 2.0336868699246304e-03)), HEAP32[(wasm2js_i32$0 + 16 | 0) >> 2] = wasm2js_i32$1;
|
||||
assembly_index_system = assembly_index_NBodySystem_constructor($1);
|
||||
}
|
||||
|
||||
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 + 4 | 0) >> 2] | 0;
|
||||
repeat_0 : do {
|
||||
if ($3 >>> 0 < $13 >>> 0) {
|
||||
$0 = HEAPU32[(((HEAPU32[$12 >> 2] | 0) + ($3 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$14 = +HEAPF64[$0 >> 3];
|
||||
$15 = +HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$16 = +HEAPF64[($0 + 16 | 0) >> 3];
|
||||
$4 = +HEAPF64[($0 + 24 | 0) >> 3];
|
||||
$5 = +HEAPF64[($0 + 32 | 0) >> 3];
|
||||
$6 = +HEAPF64[($0 + 40 | 0) >> 3];
|
||||
$17 = +HEAPF64[($0 + 48 | 0) >> 3];
|
||||
$7 = $3 + 1 | 0;
|
||||
repeat_1 : do {
|
||||
if ($7 >>> 0 < $13 >>> 0) {
|
||||
$1 = HEAPU32[(((HEAPU32[$12 >> 2] | 0) + ($7 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$18 = $14 - +HEAPF64[$1 >> 3];
|
||||
$2 = $18;
|
||||
$9 = $15 - +HEAPF64[($1 + 8 | 0) >> 3];
|
||||
$10 = $16 - +HEAPF64[($1 + 16 | 0) >> 3];
|
||||
$8 = $2 * $2 + $9 * $9 + $10 * $10;
|
||||
$11 = Math_sqrt($8);
|
||||
$11 = .01 / ($8 * $11);
|
||||
$8 = +HEAPF64[($1 + 48 | 0) >> 3] * $11;
|
||||
$4 = $4 - $2 * $8;
|
||||
$5 = $5 - $9 * $8;
|
||||
$6 = $6 - $10 * $8;
|
||||
var $1 = 0, $2 = 0.0, $3 = 0.0, $4 = 0, $5 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0, $9 = 0.0, $10 = 0.0, $11 = 0.0, $12 = 0, $13 = 0, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0;
|
||||
$12 = HEAP32[$0 >> 2];
|
||||
$13 = HEAP32[($12 + 12 | 0) >> 2];
|
||||
repeat_0 : while (1) {
|
||||
if ($4 >>> 0 < $13 >>> 0) {
|
||||
$0 = HEAP32[(HEAP32[($12 + 4 | 0) >> 2] + ($4 << 2 | 0) | 0) >> 2];
|
||||
$14 = HEAPF64[$0 >> 3];
|
||||
$15 = HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$16 = HEAPF64[($0 + 16 | 0) >> 3];
|
||||
$5 = HEAPF64[($0 + 24 | 0) >> 3];
|
||||
$6 = HEAPF64[($0 + 32 | 0) >> 3];
|
||||
$7 = HEAPF64[($0 + 40 | 0) >> 3];
|
||||
$17 = HEAPF64[($0 + 48 | 0) >> 3];
|
||||
$8 = $4 + 1 | 0;
|
||||
repeat_1 : while (1) {
|
||||
if ($8 >>> 0 < $13 >>> 0) {
|
||||
$1 = HEAP32[(HEAP32[($12 + 4 | 0) >> 2] + ($8 << 2 | 0) | 0) >> 2];
|
||||
$2 = $14 - HEAPF64[$1 >> 3];
|
||||
$9 = $15 - HEAPF64[($1 + 8 | 0) >> 3];
|
||||
$10 = $16 - HEAPF64[($1 + 16 | 0) >> 3];
|
||||
$3 = $2 * $2 + $9 * $9 + $10 * $10;
|
||||
$11 = Math_sqrt($3);
|
||||
$11 = .01 / ($3 * $11);
|
||||
$3 = HEAPF64[($1 + 48 | 0) >> 3] * $11;
|
||||
$5 = $5 - $2 * $3;
|
||||
$6 = $6 - $9 * $3;
|
||||
$7 = $7 - $10 * $3;
|
||||
$3 = $2;
|
||||
$2 = $17 * $11;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = +HEAPF64[($1 + 24 | 0) >> 3] + $18 * $2;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = +HEAPF64[($1 + 32 | 0) >> 3] + $9 * $2;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = +HEAPF64[($1 + 40 | 0) >> 3] + $10 * $2;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
$7 = $7 + 1 | 0;
|
||||
HEAPF64[($1 + 24 | 0) >> 3] = HEAPF64[($1 + 24 | 0) >> 3] + $3 * $2;
|
||||
HEAPF64[($1 + 32 | 0) >> 3] = HEAPF64[($1 + 32 | 0) >> 3] + $9 * $2;
|
||||
HEAPF64[($1 + 40 | 0) >> 3] = HEAPF64[($1 + 40 | 0) >> 3] + $10 * $2;
|
||||
$8 = $8 + 1 | 0;
|
||||
continue repeat_1;
|
||||
}
|
||||
break repeat_1;
|
||||
} while (1);
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = $4;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = $5;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = $6;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = +HEAPF64[$0 >> 3] + .01 * $4;
|
||||
HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = +HEAPF64[($0 + 8 | 0) >> 3] + .01 * $5;
|
||||
HEAPF64[(wasm2js_i32$0 + 8 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_f64$0 = +HEAPF64[($0 + 16 | 0) >> 3] + .01 * $6;
|
||||
HEAPF64[(wasm2js_i32$0 + 16 | 0) >> 3] = wasm2js_f64$0;
|
||||
$3 = $3 + 1 | 0;
|
||||
};
|
||||
HEAPF64[($0 + 24 | 0) >> 3] = $5;
|
||||
HEAPF64[($0 + 32 | 0) >> 3] = $6;
|
||||
HEAPF64[($0 + 40 | 0) >> 3] = $7;
|
||||
HEAPF64[$0 >> 3] = HEAPF64[$0 >> 3] + .01 * $5;
|
||||
HEAPF64[($0 + 8 | 0) >> 3] = HEAPF64[($0 + 8 | 0) >> 3] + .01 * $6;
|
||||
HEAPF64[($0 + 16 | 0) >> 3] = HEAPF64[($0 + 16 | 0) >> 3] + .01 * $7;
|
||||
$4 = $4 + 1 | 0;
|
||||
continue repeat_0;
|
||||
}
|
||||
break repeat_0;
|
||||
} while (1);
|
||||
};
|
||||
}
|
||||
|
||||
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, $30 = 0.0, $39 = 0.0, $45 = 0.0, $69 = 0.0, $84 = 0.0;
|
||||
$4 = HEAPU32[$0 >> 2] | 0;
|
||||
$5 = HEAP32[($4 + 4 | 0) >> 2] | 0;
|
||||
repeat_0 : do {
|
||||
if ($2 >>> 0 < $5 >>> 0) {
|
||||
$0 = HEAPU32[(((HEAPU32[$4 >> 2] | 0) + ($2 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$7 = +HEAPF64[$0 >> 3];
|
||||
$8 = +HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$9 = +HEAPF64[($0 + 16 | 0) >> 3];
|
||||
$30 = $1;
|
||||
$10 = +HEAPF64[($0 + 48 | 0) >> 3];
|
||||
$1 = +HEAPF64[($0 + 24 | 0) >> 3];
|
||||
$39 = $1 * $1;
|
||||
$1 = +HEAPF64[($0 + 32 | 0) >> 3];
|
||||
$45 = $39 + $1 * $1;
|
||||
$1 = +HEAPF64[($0 + 40 | 0) >> 3];
|
||||
$1 = $30 + .5 * $10 * ($45 + $1 * $1);
|
||||
$0 = $2 + 1 | 0;
|
||||
repeat_1 : do {
|
||||
if ($0 >>> 0 < $5 >>> 0) {
|
||||
$3 = HEAPU32[(((HEAPU32[$4 >> 2] | 0) + ($0 << 2 | 0) | 0) + 8 | 0) >> 2] | 0;
|
||||
$6 = $7 - +HEAPF64[$3 >> 3];
|
||||
$69 = $1;
|
||||
$1 = $8 - +HEAPF64[($3 + 8 | 0) >> 3];
|
||||
$84 = $6 * $6 + $1 * $1;
|
||||
$1 = $9 - +HEAPF64[($3 + 16 | 0) >> 3];
|
||||
$1 = $69 - $10 * +HEAPF64[($3 + 48 | 0) >> 3] / Math_sqrt($84 + $1 * $1);
|
||||
var $1 = 0.0, $2 = 0.0, $3 = 0, $4 = 0, $5 = 0, $6 = 0.0, $7 = 0, $8 = 0.0, $9 = 0.0, $10 = 0.0, $11 = 0.0;
|
||||
$5 = HEAP32[$0 >> 2];
|
||||
$7 = HEAP32[($5 + 12 | 0) >> 2];
|
||||
repeat_0 : while (1) {
|
||||
if ($3 >>> 0 < $7 >>> 0) {
|
||||
$0 = HEAP32[(HEAP32[($5 + 4 | 0) >> 2] + ($3 << 2 | 0) | 0) >> 2];
|
||||
$9 = HEAPF64[$0 >> 3];
|
||||
$10 = HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$11 = HEAPF64[($0 + 16 | 0) >> 3];
|
||||
$6 = $1;
|
||||
$8 = HEAPF64[($0 + 48 | 0) >> 3];
|
||||
$1 = HEAPF64[($0 + 24 | 0) >> 3];
|
||||
$2 = $1 * $1;
|
||||
$1 = HEAPF64[($0 + 32 | 0) >> 3];
|
||||
$2 = $2 + $1 * $1;
|
||||
$1 = HEAPF64[($0 + 40 | 0) >> 3];
|
||||
$1 = $6 + .5 * $8 * ($2 + $1 * $1);
|
||||
$0 = $3 + 1 | 0;
|
||||
repeat_1 : while (1) {
|
||||
if ($0 >>> 0 < $7 >>> 0) {
|
||||
$4 = HEAP32[(HEAP32[($5 + 4 | 0) >> 2] + ($0 << 2 | 0) | 0) >> 2];
|
||||
$6 = $1;
|
||||
$1 = $9 - HEAPF64[$4 >> 3];
|
||||
$2 = $1 * $1;
|
||||
$1 = $10 - HEAPF64[($4 + 8 | 0) >> 3];
|
||||
$2 = $2 + $1 * $1;
|
||||
$1 = $11 - HEAPF64[($4 + 16 | 0) >> 3];
|
||||
$1 = $6 - $8 * HEAPF64[($4 + 48 | 0) >> 3] / Math_sqrt($2 + $1 * $1);
|
||||
$0 = $0 + 1 | 0;
|
||||
continue repeat_1;
|
||||
}
|
||||
break repeat_1;
|
||||
} while (1);
|
||||
$2 = $2 + 1 | 0;
|
||||
};
|
||||
$3 = $3 + 1 | 0;
|
||||
continue repeat_0;
|
||||
}
|
||||
break repeat_0;
|
||||
} while (1);
|
||||
return +$1;
|
||||
};
|
||||
return $1;
|
||||
}
|
||||
|
||||
function assembly_index_step() {
|
||||
assembly_index_NBodySystem_advance(assembly_index_system | 0);
|
||||
return +(+assembly_index_NBodySystem_energy(assembly_index_system | 0));
|
||||
assembly_index_NBodySystem_advance(assembly_index_system);
|
||||
return +assembly_index_NBodySystem_energy(assembly_index_system);
|
||||
}
|
||||
|
||||
function assembly_index_bench($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0;
|
||||
break_0 : {
|
||||
repeat_0 : do {
|
||||
if ($1 >>> 0 >= $0 >>> 0) break break_0;
|
||||
assembly_index_NBodySystem_advance(assembly_index_system | 0);
|
||||
repeat_0 : while (1) {
|
||||
if (!($1 >>> 0 >= $0 >>> 0)) {
|
||||
assembly_index_NBodySystem_advance(assembly_index_system);
|
||||
$1 = $1 + 1 | 0;
|
||||
continue repeat_0;
|
||||
break repeat_0;
|
||||
} while (1);
|
||||
}
|
||||
break repeat_0;
|
||||
};
|
||||
}
|
||||
|
||||
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[((($0 << 2 | 0) + $1 | 0) + 8 | 0) >> 2] | 0; else abort();
|
||||
$22 = $20;
|
||||
} else $22 = 0;
|
||||
return $22 | 0;
|
||||
var $1 = 0;
|
||||
$1 = HEAP32[assembly_index_system >> 2];
|
||||
if ($0 >>> 0 < HEAP32[($1 + 12 | 0) >> 2] >>> 0) {
|
||||
$0 = HEAP32[(HEAP32[($1 + 4 | 0) >> 2] + ($0 << 2 | 0) | 0) >> 2]
|
||||
} else {
|
||||
$0 = 0
|
||||
}
|
||||
return $0 | 0;
|
||||
}
|
||||
|
||||
function start() {
|
||||
$lib_allocator_arena_startOffset = 40;
|
||||
$lib_allocator_arena_offset = $lib_allocator_arena_startOffset;
|
||||
$lib_rt_stub_startOffset = 16;
|
||||
$lib_rt_stub_offset = $lib_rt_stub_startOffset;
|
||||
}
|
||||
|
||||
function null_() {
|
||||
|
||||
}
|
||||
|
||||
var FUNCTION_TABLE_v = [null_];
|
||||
function __wasm_grow_memory(pagesToAdd) {
|
||||
var FUNCTION_TABLE = [];
|
||||
function __wasm_memory_grow(pagesToAdd) {
|
||||
pagesToAdd = pagesToAdd | 0;
|
||||
var oldPages = __wasm_current_memory() | 0;
|
||||
var oldPages = __wasm_memory_size() | 0;
|
||||
var newPages = oldPages + pagesToAdd | 0;
|
||||
if ((oldPages < newPages) && (newPages < 65536)) {
|
||||
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
|
||||
var newHEAP8 = new global.Int8Array(newBuffer);
|
||||
newHEAP8.set(HEAP8);
|
||||
HEAP8 = newHEAP8;
|
||||
HEAP8 = new global.Int8Array(newBuffer);
|
||||
HEAP16 = new global.Int16Array(newBuffer);
|
||||
HEAP32 = new global.Int32Array(newBuffer);
|
||||
HEAPU8 = new global.Uint8Array(newBuffer);
|
||||
@ -453,49 +258,33 @@ function asmFunc(global, env, buffer) {
|
||||
return oldPages;
|
||||
}
|
||||
|
||||
function __wasm_current_memory() {
|
||||
function __wasm_memory_size() {
|
||||
return buffer.byteLength / 65536 | 0;
|
||||
}
|
||||
|
||||
return {
|
||||
memory: Object.create(Object.prototype, {
|
||||
grow: {
|
||||
value: __wasm_grow_memory
|
||||
"memory": Object.create(Object.prototype, {
|
||||
"grow": {
|
||||
"value": __wasm_memory_grow
|
||||
},
|
||||
buffer: {
|
||||
get: function () {
|
||||
"buffer": {
|
||||
"get": function () {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
}
|
||||
}),
|
||||
init: assembly_index_init,
|
||||
step: assembly_index_step,
|
||||
bench: assembly_index_bench,
|
||||
getBody: assembly_index_getBody
|
||||
"init": assembly_index_init,
|
||||
"step": assembly_index_step,
|
||||
"bench": assembly_index_bench,
|
||||
"getBody": assembly_index_getBody
|
||||
};
|
||||
}
|
||||
|
||||
const memasmFunc = new ArrayBuffer(65536);
|
||||
const assignasmFunc = (
|
||||
function(mem) {
|
||||
const _mem = new Uint8Array(mem);
|
||||
return function(offset, s) {
|
||||
if (typeof Buffer === 'undefined') {
|
||||
const bytes = atob(s);
|
||||
for (let i = 0; i < bytes.length; i++)
|
||||
_mem[offset + i] = bytes.charCodeAt(i);
|
||||
} else {
|
||||
const bytes = Buffer.from(s, 'base64');
|
||||
for (let i = 0; i < bytes.length; i++)
|
||||
_mem[offset + i] = bytes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
)(memasmFunc);
|
||||
assignasmFunc(8, "DQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHM=");
|
||||
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;
|
||||
export const step = retasmFunc.step;
|
||||
export const bench = retasmFunc.bench;
|
||||
var memasmFunc = new ArrayBuffer(65536);
|
||||
var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc);
|
||||
exports.memory = retasmFunc.memory;
|
||||
exports.init = retasmFunc.init;
|
||||
exports.step = retasmFunc.step;
|
||||
exports.bench = retasmFunc.bench;
|
||||
exports.getBody = retasmFunc.getBody;
|
||||
|
@ -49,7 +49,7 @@ class NBodySystem {
|
||||
py += b.vy * m;
|
||||
pz += b.vz * m;
|
||||
}
|
||||
bodies[0].offsetMomentum(px, py, pz);
|
||||
unchecked(bodies[0]).offsetMomentum(px, py, pz);
|
||||
}
|
||||
advance(dt) {
|
||||
var bodies = this.bodies;
|
||||
@ -139,6 +139,6 @@ function bench(steps) {
|
||||
exports.bench = bench;
|
||||
function getBody(index) {
|
||||
var bodies = system.bodies;
|
||||
return index < bodies.length ? bodies[index] : null;
|
||||
return index < bodies.length ? unchecked(bodies[index]) : null;
|
||||
}
|
||||
exports.getBody = getBody;
|
||||
|
Binary file not shown.
@ -1,37 +1,37 @@
|
||||
(module
|
||||
(type $FUNCSIG$v (func))
|
||||
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
|
||||
(type $FUNCSIG$ii (func (param i32) (result i32)))
|
||||
(type $FUNCSIG$vi (func (param i32)))
|
||||
(type $FUNCSIG$d (func (result f64)))
|
||||
(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) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s")
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(global $assembly/index/system (mut i32) (i32.const 0))
|
||||
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(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 (; 0 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
local.get $0
|
||||
i32.const 1073741824
|
||||
i32.const 1073741808
|
||||
i32.gt_u
|
||||
if
|
||||
unreachable
|
||||
end
|
||||
global.get $~lib/allocator/arena/offset
|
||||
local.tee $1
|
||||
global.get $~lib/rt/stub/offset
|
||||
i32.const 16
|
||||
i32.add
|
||||
local.tee $3
|
||||
local.get $0
|
||||
i32.const 1
|
||||
local.get $0
|
||||
@ -39,20 +39,20 @@
|
||||
i32.gt_u
|
||||
select
|
||||
i32.add
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.add
|
||||
i32.const -8
|
||||
i32.const -16
|
||||
i32.and
|
||||
local.tee $2
|
||||
current_memory
|
||||
local.tee $3
|
||||
memory.size
|
||||
local.tee $4
|
||||
i32.const 16
|
||||
i32.shl
|
||||
i32.gt_u
|
||||
if
|
||||
local.get $3
|
||||
local.get $4
|
||||
local.get $2
|
||||
local.get $1
|
||||
local.get $3
|
||||
i32.sub
|
||||
i32.const 65535
|
||||
i32.add
|
||||
@ -60,17 +60,17 @@
|
||||
i32.and
|
||||
i32.const 16
|
||||
i32.shr_u
|
||||
local.tee $0
|
||||
local.get $3
|
||||
local.get $0
|
||||
local.tee $5
|
||||
local.get $4
|
||||
local.get $5
|
||||
i32.gt_s
|
||||
select
|
||||
grow_memory
|
||||
memory.grow
|
||||
i32.const 0
|
||||
i32.lt_s
|
||||
if
|
||||
local.get $0
|
||||
grow_memory
|
||||
local.get $5
|
||||
memory.grow
|
||||
i32.const 0
|
||||
i32.lt_s
|
||||
if
|
||||
@ -79,8 +79,17 @@
|
||||
end
|
||||
end
|
||||
local.get $2
|
||||
global.set $~lib/allocator/arena/offset
|
||||
global.set $~lib/rt/stub/offset
|
||||
local.get $3
|
||||
i32.const 16
|
||||
i32.sub
|
||||
local.tee $2
|
||||
local.get $1
|
||||
i32.store offset=8
|
||||
local.get $2
|
||||
local.get $0
|
||||
i32.store offset=12
|
||||
local.get $3
|
||||
)
|
||||
(func $assembly/index/NBodySystem#constructor (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
@ -91,7 +100,7 @@
|
||||
(local $6 f64)
|
||||
(local $7 i32)
|
||||
local.get $0
|
||||
i32.load offset=4
|
||||
i32.load offset=12
|
||||
local.set $7
|
||||
loop $repeat|0
|
||||
local.get $1
|
||||
@ -99,12 +108,12 @@
|
||||
i32.lt_s
|
||||
if
|
||||
local.get $0
|
||||
i32.load
|
||||
i32.load offset=4
|
||||
local.get $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
i32.load
|
||||
local.tee $2
|
||||
f64.load offset=48
|
||||
local.set $3
|
||||
@ -136,21 +145,10 @@
|
||||
br $repeat|0
|
||||
end
|
||||
end
|
||||
i32.const 0
|
||||
local.get $0
|
||||
i32.load offset=4
|
||||
i32.load
|
||||
local.tee $1
|
||||
i32.load
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $1
|
||||
i32.load offset=8
|
||||
else
|
||||
unreachable
|
||||
end
|
||||
local.tee $1
|
||||
local.get $4
|
||||
f64.neg
|
||||
f64.const 39.47841760435743
|
||||
@ -169,7 +167,8 @@
|
||||
f64.div
|
||||
f64.store offset=40
|
||||
i32.const 4
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
i32.const 3
|
||||
call $~lib/rt/stub/__alloc
|
||||
local.tee $1
|
||||
local.get $0
|
||||
i32.store
|
||||
@ -178,7 +177,8 @@
|
||||
(func $assembly/index/Body#constructor (; 2 ;) (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/allocator/arena/__memory_allocate
|
||||
i32.const 4
|
||||
call $~lib/rt/stub/__alloc
|
||||
local.tee $7
|
||||
local.get $0
|
||||
f64.store
|
||||
@ -202,232 +202,36 @@
|
||||
f64.store offset=48
|
||||
local.get $7
|
||||
)
|
||||
(func $~lib/internal/memory/memset (; 3 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store8
|
||||
local.get $0
|
||||
i32.const 20
|
||||
i32.add
|
||||
local.tee $1
|
||||
i32.const 1
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store8
|
||||
local.get $0
|
||||
i32.const 1
|
||||
i32.add
|
||||
i32.const 0
|
||||
i32.store8
|
||||
local.get $0
|
||||
i32.const 2
|
||||
i32.add
|
||||
i32.const 0
|
||||
i32.store8
|
||||
local.get $1
|
||||
i32.const 2
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store8
|
||||
local.get $1
|
||||
i32.const 3
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store8
|
||||
local.get $0
|
||||
i32.const 3
|
||||
i32.add
|
||||
i32.const 0
|
||||
i32.store8
|
||||
local.get $1
|
||||
i32.const 4
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store8
|
||||
i32.const 0
|
||||
local.get $0
|
||||
i32.sub
|
||||
i32.const 3
|
||||
i32.and
|
||||
local.tee $1
|
||||
local.get $0
|
||||
i32.add
|
||||
local.tee $0
|
||||
i32.const 0
|
||||
i32.store
|
||||
i32.const 20
|
||||
local.get $1
|
||||
i32.sub
|
||||
i32.const -4
|
||||
i32.and
|
||||
local.tee $2
|
||||
local.get $0
|
||||
i32.add
|
||||
i32.const 4
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $2
|
||||
i32.const 8
|
||||
i32.le_u
|
||||
if
|
||||
return
|
||||
end
|
||||
local.get $0
|
||||
i32.const 4
|
||||
i32.add
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 8
|
||||
i32.add
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $0
|
||||
local.get $2
|
||||
i32.add
|
||||
local.tee $1
|
||||
i32.const 12
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $1
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $2
|
||||
i32.const 24
|
||||
i32.le_u
|
||||
if
|
||||
return
|
||||
end
|
||||
local.get $0
|
||||
i32.const 12
|
||||
i32.add
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 16
|
||||
i32.add
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 20
|
||||
i32.add
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 24
|
||||
i32.add
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $0
|
||||
local.get $2
|
||||
i32.add
|
||||
local.tee $1
|
||||
i32.const 28
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $1
|
||||
i32.const 24
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $1
|
||||
i32.const 20
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $1
|
||||
i32.const 16
|
||||
i32.sub
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 4
|
||||
i32.and
|
||||
i32.const 24
|
||||
i32.add
|
||||
local.tee $1
|
||||
local.get $0
|
||||
i32.add
|
||||
local.set $0
|
||||
local.get $2
|
||||
local.get $1
|
||||
i32.sub
|
||||
local.set $2
|
||||
loop $continue|0
|
||||
local.get $2
|
||||
i32.const 32
|
||||
i32.ge_u
|
||||
if
|
||||
local.get $0
|
||||
i64.const 0
|
||||
i64.store
|
||||
local.get $0
|
||||
i32.const 8
|
||||
i32.add
|
||||
i64.const 0
|
||||
i64.store
|
||||
local.get $0
|
||||
i32.const 16
|
||||
i32.add
|
||||
i64.const 0
|
||||
i64.store
|
||||
local.get $0
|
||||
i32.const 24
|
||||
i32.add
|
||||
i64.const 0
|
||||
i64.store
|
||||
local.get $2
|
||||
i32.const 32
|
||||
i32.sub
|
||||
local.set $2
|
||||
local.get $0
|
||||
i32.const 32
|
||||
i32.add
|
||||
local.set $0
|
||||
br $continue|0
|
||||
end
|
||||
end
|
||||
)
|
||||
(func $~lib/array/Array<Body>#constructor (; 4 ;) (type $FUNCSIG$i) (result i32)
|
||||
(func $~lib/rt/__allocArray (; 3 ;) (type $FUNCSIG$i) (result i32)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
i32.const 32
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
local.tee $1
|
||||
i32.const 20
|
||||
i32.store
|
||||
i32.const 8
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
i32.const 16
|
||||
i32.const 5
|
||||
call $~lib/rt/stub/__alloc
|
||||
local.tee $0
|
||||
i32.const 20
|
||||
i32.const 0
|
||||
call $~lib/rt/stub/__alloc
|
||||
local.tee $1
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 0
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
i32.const 20
|
||||
i32.store offset=8
|
||||
local.get $0
|
||||
i32.const 5
|
||||
i32.store offset=4
|
||||
local.get $1
|
||||
i32.const 8
|
||||
i32.add
|
||||
call $~lib/internal/memory/memset
|
||||
i32.store offset=12
|
||||
local.get $0
|
||||
)
|
||||
(func $assembly/index/init (; 5 ;) (type $FUNCSIG$v)
|
||||
(func $assembly/index/init (; 4 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
call $~lib/array/Array<Body>#constructor
|
||||
local.set $1
|
||||
call $~lib/rt/__allocArray
|
||||
local.tee $1
|
||||
i32.load offset=4
|
||||
local.tee $0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
@ -436,11 +240,8 @@
|
||||
f64.const 0
|
||||
f64.const 39.47841760435743
|
||||
call $assembly/index/Body#constructor
|
||||
local.set $0
|
||||
local.get $1
|
||||
i32.load
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.store offset=8
|
||||
f64.const 4.841431442464721
|
||||
f64.const -1.1603200440274284
|
||||
f64.const -0.10362204447112311
|
||||
@ -449,13 +250,8 @@
|
||||
f64.const -0.02521836165988763
|
||||
f64.const 0.03769367487038949
|
||||
call $assembly/index/Body#constructor
|
||||
local.set $0
|
||||
local.get $1
|
||||
i32.load
|
||||
i32.const 4
|
||||
i32.add
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
i32.store offset=8
|
||||
f64.const 8.34336671824458
|
||||
f64.const 4.124798564124305
|
||||
f64.const -0.4035234171143214
|
||||
@ -464,13 +260,8 @@
|
||||
f64.const 0.008415761376584154
|
||||
f64.const 0.011286326131968767
|
||||
call $assembly/index/Body#constructor
|
||||
local.set $0
|
||||
local.get $1
|
||||
i32.load
|
||||
i32.const 8
|
||||
i32.add
|
||||
local.get $0
|
||||
i32.store offset=8
|
||||
local.get $0
|
||||
f64.const 12.894369562139131
|
||||
f64.const -15.111151401698631
|
||||
f64.const -0.22330757889265573
|
||||
@ -479,13 +270,8 @@
|
||||
f64.const -0.010832637401363636
|
||||
f64.const 1.7237240570597112e-03
|
||||
call $assembly/index/Body#constructor
|
||||
local.set $0
|
||||
local.get $1
|
||||
i32.load
|
||||
i32.const 12
|
||||
i32.add
|
||||
i32.store offset=12
|
||||
local.get $0
|
||||
i32.store offset=8
|
||||
f64.const 15.379697114850917
|
||||
f64.const -25.919314609987964
|
||||
f64.const 0.17925877295037118
|
||||
@ -494,18 +280,12 @@
|
||||
f64.const -0.034755955504078104
|
||||
f64.const 2.0336868699246304e-03
|
||||
call $assembly/index/Body#constructor
|
||||
local.set $0
|
||||
local.get $1
|
||||
i32.load
|
||||
i32.const 16
|
||||
i32.add
|
||||
local.get $0
|
||||
i32.store offset=8
|
||||
i32.store offset=16
|
||||
local.get $1
|
||||
call $assembly/index/NBodySystem#constructor
|
||||
global.set $assembly/index/system
|
||||
)
|
||||
(func $assembly/index/NBodySystem#advance (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(func $assembly/index/NBodySystem#advance (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 f64)
|
||||
(local $3 i32)
|
||||
@ -523,11 +303,10 @@
|
||||
(local $15 f64)
|
||||
(local $16 f64)
|
||||
(local $17 f64)
|
||||
(local $18 f64)
|
||||
local.get $0
|
||||
i32.load
|
||||
local.tee $12
|
||||
i32.load offset=4
|
||||
i32.load offset=12
|
||||
local.set $13
|
||||
loop $repeat|0
|
||||
local.get $3
|
||||
@ -535,12 +314,12 @@
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $12
|
||||
i32.load
|
||||
i32.load offset=4
|
||||
local.get $3
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
i32.load
|
||||
local.tee $0
|
||||
f64.load
|
||||
local.set $14
|
||||
@ -573,16 +352,15 @@
|
||||
if
|
||||
local.get $14
|
||||
local.get $12
|
||||
i32.load
|
||||
i32.load offset=4
|
||||
local.get $7
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
i32.load
|
||||
local.tee $1
|
||||
f64.load
|
||||
f64.sub
|
||||
local.tee $18
|
||||
local.tee $2
|
||||
local.get $2
|
||||
f64.mul
|
||||
@ -635,7 +413,7 @@
|
||||
local.get $1
|
||||
local.get $1
|
||||
f64.load offset=24
|
||||
local.get $18
|
||||
local.get $2
|
||||
local.get $17
|
||||
local.get $11
|
||||
f64.mul
|
||||
@ -707,7 +485,7 @@
|
||||
end
|
||||
end
|
||||
)
|
||||
(func $assembly/index/NBodySystem#energy (; 7 ;) (type $FUNCSIG$di) (param $0 i32) (result f64)
|
||||
(func $assembly/index/NBodySystem#energy (; 6 ;) (type $FUNCSIG$di) (param $0 i32) (result f64)
|
||||
(local $1 f64)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@ -721,7 +499,7 @@
|
||||
local.get $0
|
||||
i32.load
|
||||
local.tee $4
|
||||
i32.load offset=4
|
||||
i32.load offset=12
|
||||
local.set $5
|
||||
loop $repeat|0
|
||||
local.get $2
|
||||
@ -729,12 +507,12 @@
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $4
|
||||
i32.load
|
||||
i32.load offset=4
|
||||
local.get $2
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
i32.load
|
||||
local.tee $0
|
||||
f64.load
|
||||
local.set $7
|
||||
@ -781,12 +559,12 @@
|
||||
if
|
||||
local.get $7
|
||||
local.get $4
|
||||
i32.load
|
||||
i32.load offset=4
|
||||
local.get $0
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
i32.load
|
||||
local.tee $3
|
||||
f64.load
|
||||
f64.sub
|
||||
@ -835,13 +613,13 @@
|
||||
end
|
||||
local.get $1
|
||||
)
|
||||
(func $assembly/index/step (; 8 ;) (type $FUNCSIG$d) (result f64)
|
||||
(func $assembly/index/step (; 7 ;) (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 (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(func $assembly/index/bench (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(local $1 i32)
|
||||
block $break|0
|
||||
loop $repeat|0
|
||||
@ -861,44 +639,33 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $assembly/index/getBody (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $assembly/index/getBody (; 9 ;) (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=4
|
||||
i32.load offset=12
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.load
|
||||
local.tee $1
|
||||
i32.load
|
||||
i32.load offset=4
|
||||
local.get $0
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $0
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $1
|
||||
i32.add
|
||||
i32.load offset=8
|
||||
else
|
||||
unreachable
|
||||
end
|
||||
i32.shl
|
||||
i32.add
|
||||
i32.load
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
)
|
||||
(func $start (; 11 ;) (type $FUNCSIG$v)
|
||||
i32.const 40
|
||||
global.set $~lib/allocator/arena/startOffset
|
||||
global.get $~lib/allocator/arena/startOffset
|
||||
global.set $~lib/allocator/arena/offset
|
||||
(func $start (; 10 ;) (type $FUNCSIG$v)
|
||||
i32.const 16
|
||||
global.set $~lib/rt/stub/startOffset
|
||||
global.get $~lib/rt/stub/startOffset
|
||||
global.set $~lib/rt/stub/offset
|
||||
)
|
||||
(func $null (; 12 ;) (type $FUNCSIG$v)
|
||||
(func $null (; 11 ;) (type $FUNCSIG$v)
|
||||
nop
|
||||
)
|
||||
)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,9 +3,9 @@
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug --validate --importMemory",
|
||||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --validate --noAssert --importMemory",
|
||||
"asbuild:asmjs": "asc assembly/index.ts -a build/index.asm.js -O3 --validate --noAssert",
|
||||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug --validate --runtime none --importMemory",
|
||||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --validate --runtime none --noAssert --importMemory",
|
||||
"asbuild:asmjs": "asc assembly/index.ts -a build/index.asm.js -O3 --validate --runtime none --noAssert && node scripts/postprocess-asmjs",
|
||||
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized && npm run asbuild:asmjs",
|
||||
"tsbuild": "tsc -p assembly -t ES2017 -m commonjs --outDir build",
|
||||
"build": "npm run asbuild && npm run tsbuild",
|
||||
|
7
examples/n-body/scripts/postprocess-asmjs.js
Normal file
7
examples/n-body/scripts/postprocess-asmjs.js
Normal file
@ -0,0 +1,7 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const filename = path.join(__dirname, "..", "build" , "index.asm.js");
|
||||
var source = fs.readFileSync(filename, { encoding: "utf8" });
|
||||
source = source.replace(/^export var ([^ ]+) =/mg, ($0, $1) => "exports." + $1 + " = ");
|
||||
fs.writeFileSync(filename, source);
|
@ -21,11 +21,8 @@
|
||||
(import "pson" "onString" (func $assembly/pson/onString (param i32 i32)))
|
||||
(import "pson" "onBinary" (func $assembly/pson/onBinary (param i32 i32)))
|
||||
(memory $0 0)
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $assembly/pson/offset (mut i32) (i32.const 0))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "onNull" (func $assembly/pson/onNull))
|
||||
(export "onTrue" (func $assembly/pson/onTrue))
|
||||
(export "onFalse" (func $assembly/pson/onFalse))
|
||||
@ -120,7 +117,7 @@
|
||||
(local $2 i64)
|
||||
block $break|0
|
||||
global.get $assembly/pson/offset
|
||||
local.tee $1
|
||||
local.tee $0
|
||||
i32.const 1
|
||||
i32.add
|
||||
global.set $assembly/pson/offset
|
||||
@ -141,7 +138,7 @@
|
||||
block $case1|0
|
||||
block $case0|0
|
||||
block $tablify|0
|
||||
local.get $1
|
||||
local.get $0
|
||||
i32.load8_u
|
||||
local.tee $0
|
||||
local.tee $1
|
||||
|
@ -24,9 +24,7 @@
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $assembly/pson/offset (mut i32) (i32.const 0))
|
||||
(global $~lib/memory/HEAP_BASE i32 (i32.const 8))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "onNull" (func $assembly/pson/onNull))
|
||||
(export "onTrue" (func $assembly/pson/onTrue))
|
||||
(export "onFalse" (func $assembly/pson/onFalse))
|
||||
|
Reference in New Issue
Block a user