mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-05-23 12:41:26 +00:00
Runtime 'none' by default
This commit is contained in:
parent
eb6c4c09ee
commit
bb659bbdcd
@ -85,13 +85,13 @@
|
||||
"description": [
|
||||
"Specifies the runtime template to include in the program.",
|
||||
"",
|
||||
" default TLSF memory allocator and ITCM garbage collector.",
|
||||
" arena Just the arena memory allocator. No free/GC.",
|
||||
" none No allocator/GC or compose your own.",
|
||||
" none No allocator/GC or compose your own. [default]",
|
||||
" trace TLSF memory allocator and ITCM garbage collector.",
|
||||
" arena Just the arena memory allocator. No free/GC.",
|
||||
""
|
||||
],
|
||||
"type": "s",
|
||||
"default": "default"
|
||||
"default": "none"
|
||||
},
|
||||
"debug": {
|
||||
"description": "Enables debug information in emitted binaries.",
|
||||
|
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
|
||||
@ -192,13 +190,13 @@
|
||||
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
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $8
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
@ -225,13 +223,13 @@
|
||||
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
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $8
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
@ -259,13 +257,13 @@
|
||||
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
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $8
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
@ -293,13 +291,13 @@
|
||||
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
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $8
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
@ -328,20 +326,20 @@
|
||||
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
|
||||
local.get $2
|
||||
local.set $9
|
||||
local.get $9
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
local.get $10
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
local.set $10
|
||||
local.get $10
|
||||
local.set $9
|
||||
local.get $9
|
||||
i32.const 1
|
||||
i32.and
|
||||
if
|
||||
@ -352,12 +350,12 @@
|
||||
i32.eq
|
||||
if
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.set $12
|
||||
local.get $2
|
||||
local.set $11
|
||||
local.get $9
|
||||
local.set $10
|
||||
local.get $10
|
||||
local.set $12
|
||||
local.get $12
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
@ -371,24 +369,20 @@
|
||||
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
|
||||
local.get $10
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $16
|
||||
global.get $assembly/index/s
|
||||
local.get $15
|
||||
local.get $11
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $14
|
||||
local.get $12
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
@ -397,23 +391,23 @@
|
||||
end
|
||||
else
|
||||
local.get $5
|
||||
local.set $13
|
||||
local.set $11
|
||||
local.get $2
|
||||
local.set $12
|
||||
local.set $10
|
||||
global.get $assembly/config/BGR_DEAD
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $11
|
||||
local.set $13
|
||||
global.get $assembly/index/s
|
||||
local.get $12
|
||||
local.get $10
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $13
|
||||
local.get $11
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $11
|
||||
local.get $13
|
||||
i32.store
|
||||
end
|
||||
else
|
||||
@ -424,13 +418,13 @@
|
||||
local.get $5
|
||||
local.set $11
|
||||
local.get $2
|
||||
local.set $12
|
||||
local.set $10
|
||||
global.get $assembly/config/BGR_ALIVE
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $13
|
||||
global.get $assembly/index/s
|
||||
local.get $12
|
||||
local.get $10
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
@ -442,43 +436,39 @@
|
||||
i32.store
|
||||
else
|
||||
local.get $5
|
||||
local.set $13
|
||||
local.get $2
|
||||
local.set $12
|
||||
local.get $10
|
||||
local.set $11
|
||||
local.get $11
|
||||
local.get $2
|
||||
local.set $10
|
||||
local.get $9
|
||||
local.set $13
|
||||
local.get $13
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
i32.sub
|
||||
local.tee $9
|
||||
local.tee $12
|
||||
i32.const 0
|
||||
local.tee $16
|
||||
local.get $9
|
||||
local.get $12
|
||||
local.get $16
|
||||
i32.gt_s
|
||||
select
|
||||
local.set $9
|
||||
local.set $12
|
||||
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
|
||||
local.get $13
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $14
|
||||
global.get $assembly/index/s
|
||||
local.get $15
|
||||
local.get $10
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $16
|
||||
local.get $11
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
@ -527,23 +517,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
|
||||
|
@ -4,12 +4,9 @@
|
||||
(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))
|
||||
|
@ -8,9 +8,7 @@
|
||||
(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))
|
||||
|
@ -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);
|
||||
}
|
||||
|
1
examples/mandelbrot/build/optimized.d.ts
vendored
1
examples/mandelbrot/build/optimized.d.ts
vendored
@ -14,6 +14,5 @@ declare module ASModule {
|
||||
}
|
||||
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
|
||||
@ -222,17 +215,26 @@
|
||||
i32.const 1
|
||||
i32.sub
|
||||
f64.convert_i32_s
|
||||
local.get $18
|
||||
i32.const 1
|
||||
i32.add
|
||||
f64.convert_i32_u
|
||||
local.get $21
|
||||
f64.sub
|
||||
local.get $10
|
||||
f64.mul
|
||||
f64.const 0
|
||||
f64.const 1
|
||||
call $assembly/index/clamp<f64>
|
||||
block $assembly/index/clamp<f64>|inlined.0 (result f64)
|
||||
local.get $18
|
||||
i32.const 1
|
||||
i32.add
|
||||
f64.convert_i32_u
|
||||
local.get $21
|
||||
f64.sub
|
||||
local.get $10
|
||||
f64.mul
|
||||
local.set $24
|
||||
f64.const 0
|
||||
local.set $23
|
||||
f64.const 1
|
||||
local.set $22
|
||||
local.get $24
|
||||
local.get $23
|
||||
f64.max
|
||||
local.get $22
|
||||
f64.min
|
||||
end
|
||||
f64.mul
|
||||
i32.trunc_f64_u
|
||||
local.set $20
|
||||
@ -255,6 +257,6 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $null (; 4 ;) (type $FUNCSIG$v)
|
||||
(func $null (; 3 ;) (type $FUNCSIG$v)
|
||||
)
|
||||
)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ function Neptune(): Body {
|
||||
|
||||
class NBodySystem {
|
||||
|
||||
constructor(public bodies: FixedArray<Body>) {
|
||||
constructor(public bodies: Body[]) {
|
||||
var px: float = 0.0;
|
||||
var py: float = 0.0;
|
||||
var pz: float = 0.0;
|
||||
@ -186,15 +186,13 @@ class NBodySystem {
|
||||
var system: NBodySystem;
|
||||
|
||||
export function init(): void {
|
||||
var bodies = new FixedArray<Body>(5);
|
||||
unchecked((
|
||||
bodies[0] = Sun(),
|
||||
bodies[1] = Jupiter(),
|
||||
bodies[2] = Saturn(),
|
||||
bodies[3] = Uranus(),
|
||||
bodies[4] = Neptune()
|
||||
));
|
||||
system = new NBodySystem(bodies);
|
||||
system = new NBodySystem([
|
||||
Sun(),
|
||||
Jupiter(),
|
||||
Saturn(),
|
||||
Uranus(),
|
||||
Neptune()
|
||||
]);
|
||||
}
|
||||
|
||||
export function step(): float {
|
||||
|
@ -24,7 +24,7 @@ function asmFunc(global, env, buffer) {
|
||||
var $lib_allocator_arena_startOffset = 0;
|
||||
var $lib_allocator_arena_offset = 0;
|
||||
var i64toi32_i32$HIGH_BITS = 0;
|
||||
function $lib_memory_memory_allocate($0) {
|
||||
function $lib_allocator_arena___mem_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();
|
||||
@ -39,142 +39,53 @@ function asmFunc(global, env, buffer) {
|
||||
return $1 | 0;
|
||||
}
|
||||
|
||||
function $lib_runtime_doAllocate($0) {
|
||||
function $lib_util_runtime_allocate($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$1 = $lib_memory_memory_allocate(1 << (32 - Math_clz32($0 + 7 | 0) | 0) | 0 | 0) | 0;
|
||||
$1 = $lib_allocator_arena___mem_allocate(1 << (32 - Math_clz32($0 + 15 | 0) | 0) | 0 | 0) | 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = 2774420247;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
|
||||
return $1 + 8 | 0 | 0;
|
||||
return $1 + 16 | 0 | 0;
|
||||
}
|
||||
|
||||
function $lib_memory_memory_fill($0) {
|
||||
function assembly_index_NBodySystem_constructor($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;
|
||||
$lib_util_memory_memset_inlined_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;
|
||||
$2 = 20 - $1 | 0;
|
||||
$0 = $0 + $1 | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
$2 = $2 & 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) break $lib_util_memory_memset_inlined_0;
|
||||
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) break $lib_util_memory_memset_inlined_0;
|
||||
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);
|
||||
};
|
||||
var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0, wasm2js_i32$1 = 0;
|
||||
$7 = HEAP32[($0 + 12 | 0) >> 2] | 0;
|
||||
repeat_0 : do {
|
||||
if (($1 | 0) < ($7 | 0)) {
|
||||
$2 = HEAPU32[((HEAPU32[($0 + 4 | 0) >> 2] | 0) + ($1 << 2 | 0) | 0) >> 2] | 0;
|
||||
$3 = +HEAPF64[($2 + 48 | 0) >> 3];
|
||||
$4 = $4 + +HEAPF64[($2 + 24 | 0) >> 3] * $3;
|
||||
$5 = $5 + +HEAPF64[($2 + 32 | 0) >> 3] * $3;
|
||||
$6 = $6 + +HEAPF64[($2 + 40 | 0) >> 3] * $3;
|
||||
$1 = $1 + 1 | 0;
|
||||
continue repeat_0;
|
||||
}
|
||||
break repeat_0;
|
||||
} while (1);
|
||||
$1 = HEAPU32[(HEAPU32[($0 + 4 | 0) >> 2] | 0) >> 2] | 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$4 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$5 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$6 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
$1 = $lib_util_runtime_allocate(4 | 0) | 0;
|
||||
wasm2js_i32$0 = $1 - 16 | 0;
|
||||
wasm2js_i32$1 = 17;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = $0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
return $1 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6) {
|
||||
@ -186,9 +97,9 @@ function asmFunc(global, env, buffer) {
|
||||
$5 = +$5;
|
||||
$6 = +$6;
|
||||
var $7 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_f64$0 = 0.0;
|
||||
$7 = $lib_runtime_doAllocate(56 | 0) | 0;
|
||||
wasm2js_i32$0 = $7 - 8 | 0;
|
||||
wasm2js_i32$1 = 3;
|
||||
$7 = $lib_util_runtime_allocate(56 | 0) | 0;
|
||||
wasm2js_i32$0 = $7 - 16 | 0;
|
||||
wasm2js_i32$1 = 18;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $7;
|
||||
wasm2js_f64$0 = $0;
|
||||
@ -214,75 +125,61 @@ function asmFunc(global, env, buffer) {
|
||||
return $7 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_NBodySystem_constructor($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0, wasm2js_i32$1 = 0;
|
||||
$7 = (HEAPU32[(($0 - 8 | 0) + 4 | 0) >> 2] | 0) >>> 2 | 0;
|
||||
repeat_0 : do {
|
||||
if (($1 | 0) < ($7 | 0)) {
|
||||
$2 = HEAPU32[(($1 << 2 | 0) + $0 | 0) >> 2] | 0;
|
||||
$3 = +HEAPF64[($2 + 48 | 0) >> 3];
|
||||
$4 = $4 + +HEAPF64[($2 + 24 | 0) >> 3] * $3;
|
||||
$5 = $5 + +HEAPF64[($2 + 32 | 0) >> 3] * $3;
|
||||
$6 = $6 + +HEAPF64[($2 + 40 | 0) >> 3] * $3;
|
||||
$1 = $1 + 1 | 0;
|
||||
continue repeat_0;
|
||||
}
|
||||
break repeat_0;
|
||||
} while (1);
|
||||
$1 = HEAPU32[$0 >> 2] | 0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$4 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$5 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = -$6 / 39.47841760435743;
|
||||
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
|
||||
$1 = $lib_runtime_doAllocate(4 | 0) | 0;
|
||||
wasm2js_i32$0 = $1 - 8 | 0;
|
||||
wasm2js_i32$1 = 4;
|
||||
function $lib_util_runtime_makeArray() {
|
||||
var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$0 = $lib_util_runtime_allocate(16 | 0) | 0;
|
||||
wasm2js_i32$0 = $0 - 16 | 0;
|
||||
wasm2js_i32$1 = 19;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_i32$1 = $0;
|
||||
$1 = $lib_util_runtime_allocate(20 | 0) | 0;
|
||||
wasm2js_i32$0 = $1 - 16 | 0;
|
||||
wasm2js_i32$1 = 15;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
return $1 | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = $1;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = $1;
|
||||
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 20;
|
||||
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = 5;
|
||||
HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1;
|
||||
return $0 | 0;
|
||||
}
|
||||
|
||||
function assembly_index_init() {
|
||||
var $0 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$0 = $lib_runtime_doAllocate(20 | 0) | 0;
|
||||
$lib_memory_memory_fill($0 | 0);
|
||||
wasm2js_i32$0 = $0 - 8 | 0;
|
||||
wasm2js_i32$1 = 2;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
|
||||
$1 = $lib_util_runtime_makeArray() | 0;
|
||||
$0 = HEAPU32[($1 + 4 | 0) >> 2] | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = assembly_index_Body_constructor(+(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 4 | 0;
|
||||
wasm2js_i32$0 = $0;
|
||||
wasm2js_i32$1 = assembly_index_Body_constructor(+(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 8 | 0;
|
||||
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)) | 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 12 | 0;
|
||||
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)) | 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
wasm2js_i32$0 = $0 + 16 | 0;
|
||||
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)) | 0;
|
||||
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
|
||||
assembly_index_system = assembly_index_NBodySystem_constructor($0 | 0) | 0;
|
||||
HEAP32[(wasm2js_i32$0 + 16 | 0) >> 2] = wasm2js_i32$1;
|
||||
assembly_index_system = assembly_index_NBodySystem_constructor($1 | 0) | 0;
|
||||
}
|
||||
|
||||
function assembly_index_NBodySystem_advance($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, $2 = 0.0, $8 = 0.0, $3 = 0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, $9 = 0.0, $10 = 0.0, $11 = 0.0, $12 = 0, $13 = 0, $18 = 0.0, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0;
|
||||
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, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0, $107 = 0.0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0;
|
||||
$12 = HEAPU32[$0 >> 2] | 0;
|
||||
$13 = (HEAPU32[(($12 - 8 | 0) + 4 | 0) >> 2] | 0) >>> 2 | 0;
|
||||
$13 = HEAP32[($12 + 12 | 0) >> 2] | 0;
|
||||
repeat_0 : do {
|
||||
if ($3 >>> 0 < $13 >>> 0) {
|
||||
$0 = HEAPU32[(($3 << 2 | 0) + $12 | 0) >> 2] | 0;
|
||||
$0 = HEAPU32[((HEAPU32[($12 + 4 | 0) >> 2] | 0) + ($3 << 2 | 0) | 0) >> 2] | 0;
|
||||
$14 = +HEAPF64[$0 >> 3];
|
||||
$15 = +HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$16 = +HEAPF64[($0 + 16 | 0) >> 3];
|
||||
@ -293,9 +190,8 @@ function asmFunc(global, env, buffer) {
|
||||
$7 = $3 + 1 | 0;
|
||||
repeat_1 : do {
|
||||
if ($7 >>> 0 < $13 >>> 0) {
|
||||
$1 = HEAPU32[(($7 << 2 | 0) + $12 | 0) >> 2] | 0;
|
||||
$18 = $14 - +HEAPF64[$1 >> 3];
|
||||
$2 = $18;
|
||||
$1 = HEAPU32[((HEAPU32[($12 + 4 | 0) >> 2] | 0) + ($7 << 2 | 0) | 0) >> 2] | 0;
|
||||
$2 = $14 - +HEAPF64[$1 >> 3];
|
||||
$9 = $15 - +HEAPF64[($1 + 8 | 0) >> 3];
|
||||
$10 = $16 - +HEAPF64[($1 + 16 | 0) >> 3];
|
||||
$8 = $2 * $2 + $9 * $9 + $10 * $10;
|
||||
@ -305,9 +201,10 @@ function asmFunc(global, env, buffer) {
|
||||
$4 = $4 - $2 * $8;
|
||||
$5 = $5 - $9 * $8;
|
||||
$6 = $6 - $10 * $8;
|
||||
$107 = $2;
|
||||
$2 = $17 * $11;
|
||||
wasm2js_i32$0 = $1;
|
||||
wasm2js_f64$0 = +HEAPF64[($1 + 24 | 0) >> 3] + $18 * $2;
|
||||
wasm2js_f64$0 = +HEAPF64[($1 + 24 | 0) >> 3] + $107 * $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;
|
||||
@ -347,35 +244,33 @@ function asmFunc(global, env, buffer) {
|
||||
|
||||
function assembly_index_NBodySystem_energy($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0.0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $9 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $31 = 0.0, $40 = 0.0, $46 = 0.0, $10 = 0.0, $72 = 0.0, $86 = 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 = (HEAPU32[(($4 - 8 | 0) + 4 | 0) >> 2] | 0) >>> 2 | 0;
|
||||
$5 = HEAP32[($4 + 12 | 0) >> 2] | 0;
|
||||
repeat_0 : do {
|
||||
if ($2 >>> 0 < $5 >>> 0) {
|
||||
$0 = HEAPU32[(($2 << 2 | 0) + $4 | 0) >> 2] | 0;
|
||||
$6 = +HEAPF64[$0 >> 3];
|
||||
$7 = +HEAPF64[($0 + 8 | 0) >> 3];
|
||||
$8 = +HEAPF64[($0 + 16 | 0) >> 3];
|
||||
$31 = $1;
|
||||
$9 = +HEAPF64[($0 + 48 | 0) >> 3];
|
||||
$0 = HEAPU32[((HEAPU32[($4 + 4 | 0) >> 2] | 0) + ($2 << 2 | 0) | 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];
|
||||
$40 = $1 * $1;
|
||||
$39 = $1 * $1;
|
||||
$1 = +HEAPF64[($0 + 32 | 0) >> 3];
|
||||
$46 = $40 + $1 * $1;
|
||||
$45 = $39 + $1 * $1;
|
||||
$1 = +HEAPF64[($0 + 40 | 0) >> 3];
|
||||
$1 = $31 + .5 * $9 * ($46 + $1 * $1);
|
||||
$1 = $30 + .5 * $10 * ($45 + $1 * $1);
|
||||
$0 = $2 + 1 | 0;
|
||||
repeat_1 : do {
|
||||
if ($0 >>> 0 < $5 >>> 0) {
|
||||
$10 = $1;
|
||||
$3 = HEAPU32[(($0 << 2 | 0) + $4 | 0) >> 2] | 0;
|
||||
$1 = $6 - +HEAPF64[$3 >> 3];
|
||||
$72 = $1 * $1;
|
||||
$1 = $7 - +HEAPF64[($3 + 8 | 0) >> 3];
|
||||
$1 = $72 + $1 * $1;
|
||||
$86 = $1;
|
||||
$1 = $8 - +HEAPF64[($3 + 16 | 0) >> 3];
|
||||
$1 = $10 - $9 * +HEAPF64[($3 + 48 | 0) >> 3] / Math_sqrt($86 + $1 * $1);
|
||||
$3 = HEAPU32[((HEAPU32[($4 + 4 | 0) >> 2] | 0) + ($0 << 2 | 0) | 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);
|
||||
$0 = $0 + 1 | 0;
|
||||
continue repeat_1;
|
||||
}
|
||||
@ -410,14 +305,14 @@ function asmFunc(global, env, buffer) {
|
||||
|
||||
function assembly_index_getBody($0) {
|
||||
$0 = $0 | 0;
|
||||
var $1 = 0, $15 = 0;
|
||||
var $1 = 0, $14 = 0;
|
||||
$1 = HEAPU32[assembly_index_system >> 2] | 0;
|
||||
if ($0 >>> 0 < ((HEAPU32[(($1 - 8 | 0) + 4 | 0) >> 2] | 0) >>> 2 | 0) >>> 0) $15 = HEAPU32[(($0 << 2 | 0) + $1 | 0) >> 2] | 0; else $15 = 0;
|
||||
return $15 | 0;
|
||||
if ($0 >>> 0 < (HEAP32[($1 + 12 | 0) >> 2] | 0) >>> 0) $14 = HEAPU32[((HEAPU32[($1 + 4 | 0) >> 2] | 0) + ($0 << 2 | 0) | 0) >> 2] | 0; else $14 = 0;
|
||||
return $14 | 0;
|
||||
}
|
||||
|
||||
function start() {
|
||||
$lib_allocator_arena_startOffset = 56;
|
||||
$lib_allocator_arena_startOffset = 8;
|
||||
$lib_allocator_arena_offset = $lib_allocator_arena_startOffset;
|
||||
}
|
||||
|
||||
@ -425,7 +320,6 @@ function asmFunc(global, env, buffer) {
|
||||
|
||||
}
|
||||
|
||||
var FUNCTION_TABLE_v = [null_];
|
||||
function __wasm_grow_memory(pagesToAdd) {
|
||||
pagesToAdd = pagesToAdd | 0;
|
||||
var oldPages = __wasm_current_memory() | 0;
|
||||
@ -471,23 +365,6 @@ function asmFunc(global, env, buffer) {
|
||||
}
|
||||
|
||||
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, "AQAAACQAAAB+AGwAaQBiAC8AZgBpAHgAZQBkAGEAcgByAGEAeQAuAHQAcw==");
|
||||
const retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc);
|
||||
export const memory = retasmFunc.memory;
|
||||
export const init = retasmFunc.init;
|
||||
|
@ -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.
@ -5,21 +5,18 @@
|
||||
(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)))
|
||||
(import "env" "memory" (memory $0 1))
|
||||
(data (i32.const 8) "\01\00\00\00$\00\00\00~\00l\00i\00b\00/\00f\00i\00x\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s")
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(type $FUNCSIG$i (func (result i32)))
|
||||
(import "env" "memory" (memory $0 0))
|
||||
(global $assembly/index/system (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/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/memory/memory.allocate (; 0 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $~lib/allocator/arena/__mem_allocate (; 0 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@ -81,17 +78,17 @@
|
||||
global.set $~lib/allocator/arena/offset
|
||||
local.get $1
|
||||
)
|
||||
(func $~lib/runtime/doAllocate (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $~lib/util/runtime/allocate (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
i32.const 1
|
||||
i32.const 32
|
||||
local.get $0
|
||||
i32.const 7
|
||||
i32.const 15
|
||||
i32.add
|
||||
i32.clz
|
||||
i32.sub
|
||||
i32.shl
|
||||
call $~lib/memory/memory.allocate
|
||||
call $~lib/allocator/arena/__mem_allocate
|
||||
local.tee $1
|
||||
i32.const -1520547049
|
||||
i32.store
|
||||
@ -99,235 +96,10 @@
|
||||
local.get $0
|
||||
i32.store offset=4
|
||||
local.get $1
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.add
|
||||
)
|
||||
(func $~lib/memory/memory.fill (; 2 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
block $~lib/util/memory/memset|inlined.0
|
||||
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 20
|
||||
i32.const 0
|
||||
local.get $0
|
||||
i32.sub
|
||||
i32.const 3
|
||||
i32.and
|
||||
local.tee $1
|
||||
i32.sub
|
||||
local.set $2
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.add
|
||||
local.tee $0
|
||||
i32.const 0
|
||||
i32.store
|
||||
local.get $2
|
||||
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
|
||||
br_if $~lib/util/memory/memset|inlined.0
|
||||
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
|
||||
br_if $~lib/util/memory/memset|inlined.0
|
||||
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
|
||||
end
|
||||
)
|
||||
(func $assembly/index/Body#constructor (; 3 ;) (type $FUNCSIG$iddddddd) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32)
|
||||
(local $7 i32)
|
||||
i32.const 56
|
||||
call $~lib/runtime/doAllocate
|
||||
local.tee $7
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.const 3
|
||||
i32.store
|
||||
local.get $7
|
||||
local.get $0
|
||||
f64.store
|
||||
local.get $7
|
||||
local.get $1
|
||||
f64.store offset=8
|
||||
local.get $7
|
||||
local.get $2
|
||||
f64.store offset=16
|
||||
local.get $7
|
||||
local.get $3
|
||||
f64.store offset=24
|
||||
local.get $7
|
||||
local.get $4
|
||||
f64.store offset=32
|
||||
local.get $7
|
||||
local.get $5
|
||||
f64.store offset=40
|
||||
local.get $7
|
||||
local.get $6
|
||||
f64.store offset=48
|
||||
local.get $7
|
||||
)
|
||||
(func $assembly/index/NBodySystem#constructor (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(func $assembly/index/NBodySystem#constructor (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 f64)
|
||||
@ -336,21 +108,18 @@
|
||||
(local $6 f64)
|
||||
(local $7 i32)
|
||||
local.get $0
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.load offset=4
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.load offset=12
|
||||
local.set $7
|
||||
loop $repeat|0
|
||||
local.get $1
|
||||
local.get $7
|
||||
i32.lt_s
|
||||
if
|
||||
local.get $0
|
||||
i32.load offset=4
|
||||
local.get $1
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $0
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $2
|
||||
@ -385,6 +154,7 @@
|
||||
end
|
||||
end
|
||||
local.get $0
|
||||
i32.load offset=4
|
||||
i32.load
|
||||
local.tee $1
|
||||
local.get $4
|
||||
@ -405,29 +175,87 @@
|
||||
f64.div
|
||||
f64.store offset=40
|
||||
i32.const 4
|
||||
call $~lib/runtime/doAllocate
|
||||
call $~lib/util/runtime/allocate
|
||||
local.tee $1
|
||||
i32.const 8
|
||||
i32.const 16
|
||||
i32.sub
|
||||
i32.const 4
|
||||
i32.const 17
|
||||
i32.store
|
||||
local.get $1
|
||||
local.get $0
|
||||
i32.store
|
||||
local.get $1
|
||||
)
|
||||
(func $assembly/index/init (; 5 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
i32.const 20
|
||||
call $~lib/runtime/doAllocate
|
||||
local.tee $0
|
||||
call $~lib/memory/memory.fill
|
||||
local.get $0
|
||||
i32.const 8
|
||||
(func $assembly/index/Body#constructor (; 3 ;) (type $FUNCSIG$iddddddd) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32)
|
||||
(local $7 i32)
|
||||
i32.const 56
|
||||
call $~lib/util/runtime/allocate
|
||||
local.tee $7
|
||||
i32.const 16
|
||||
i32.sub
|
||||
i32.const 2
|
||||
i32.const 18
|
||||
i32.store
|
||||
local.get $7
|
||||
local.get $0
|
||||
f64.store
|
||||
local.get $7
|
||||
local.get $1
|
||||
f64.store offset=8
|
||||
local.get $7
|
||||
local.get $2
|
||||
f64.store offset=16
|
||||
local.get $7
|
||||
local.get $3
|
||||
f64.store offset=24
|
||||
local.get $7
|
||||
local.get $4
|
||||
f64.store offset=32
|
||||
local.get $7
|
||||
local.get $5
|
||||
f64.store offset=40
|
||||
local.get $7
|
||||
local.get $6
|
||||
f64.store offset=48
|
||||
local.get $7
|
||||
)
|
||||
(func $~lib/util/runtime/makeArray (; 4 ;) (type $FUNCSIG$i) (result i32)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
i32.const 16
|
||||
call $~lib/util/runtime/allocate
|
||||
local.tee $0
|
||||
i32.const 16
|
||||
i32.sub
|
||||
i32.const 19
|
||||
i32.store
|
||||
i32.const 20
|
||||
call $~lib/util/runtime/allocate
|
||||
local.tee $1
|
||||
i32.const 16
|
||||
i32.sub
|
||||
i32.const 15
|
||||
i32.store
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
i32.const 20
|
||||
i32.store offset=8
|
||||
local.get $0
|
||||
i32.const 5
|
||||
i32.store offset=12
|
||||
local.get $0
|
||||
)
|
||||
(func $assembly/index/init (; 5 ;) (type $FUNCSIG$v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
call $~lib/util/runtime/makeArray
|
||||
local.tee $1
|
||||
i32.load offset=4
|
||||
local.tee $0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
f64.const 0
|
||||
@ -438,8 +266,6 @@
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.const 4
|
||||
i32.add
|
||||
f64.const 4.841431442464721
|
||||
f64.const -1.1603200440274284
|
||||
f64.const -0.10362204447112311
|
||||
@ -448,10 +274,8 @@
|
||||
f64.const -0.02521836165988763
|
||||
f64.const 0.03769367487038949
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store
|
||||
i32.store offset=4
|
||||
local.get $0
|
||||
i32.const 8
|
||||
i32.add
|
||||
f64.const 8.34336671824458
|
||||
f64.const 4.124798564124305
|
||||
f64.const -0.4035234171143214
|
||||
@ -460,10 +284,8 @@
|
||||
f64.const 0.008415761376584154
|
||||
f64.const 0.011286326131968767
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store
|
||||
i32.store offset=8
|
||||
local.get $0
|
||||
i32.const 12
|
||||
i32.add
|
||||
f64.const 12.894369562139131
|
||||
f64.const -15.111151401698631
|
||||
f64.const -0.22330757889265573
|
||||
@ -472,10 +294,8 @@
|
||||
f64.const -0.010832637401363636
|
||||
f64.const 1.7237240570597112e-03
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store
|
||||
i32.store offset=12
|
||||
local.get $0
|
||||
i32.const 16
|
||||
i32.add
|
||||
f64.const 15.379697114850917
|
||||
f64.const -25.919314609987964
|
||||
f64.const 0.17925877295037118
|
||||
@ -484,8 +304,8 @@
|
||||
f64.const -0.034755955504078104
|
||||
f64.const 2.0336868699246304e-03
|
||||
call $assembly/index/Body#constructor
|
||||
i32.store
|
||||
local.get $0
|
||||
i32.store offset=16
|
||||
local.get $1
|
||||
call $assembly/index/NBodySystem#constructor
|
||||
global.set $assembly/index/system
|
||||
)
|
||||
@ -507,25 +327,21 @@
|
||||
(local $15 f64)
|
||||
(local $16 f64)
|
||||
(local $17 f64)
|
||||
(local $18 f64)
|
||||
local.get $0
|
||||
i32.load
|
||||
local.tee $12
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.load offset=4
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.load offset=12
|
||||
local.set $13
|
||||
loop $repeat|0
|
||||
local.get $3
|
||||
local.get $13
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $12
|
||||
i32.load offset=4
|
||||
local.get $3
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $12
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $0
|
||||
@ -559,16 +375,16 @@
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $14
|
||||
local.get $12
|
||||
i32.load offset=4
|
||||
local.get $7
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $12
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $1
|
||||
f64.load
|
||||
f64.sub
|
||||
local.tee $18
|
||||
local.tee $2
|
||||
local.get $2
|
||||
f64.mul
|
||||
@ -621,7 +437,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,37 +523,34 @@
|
||||
local.get $0
|
||||
i32.load
|
||||
local.tee $4
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.load offset=4
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.load offset=12
|
||||
local.set $5
|
||||
loop $repeat|0
|
||||
local.get $2
|
||||
local.get $5
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $4
|
||||
i32.load offset=4
|
||||
local.get $2
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $4
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $0
|
||||
f64.load
|
||||
local.set $6
|
||||
local.get $0
|
||||
f64.load offset=8
|
||||
local.set $7
|
||||
local.get $0
|
||||
f64.load offset=16
|
||||
f64.load offset=8
|
||||
local.set $8
|
||||
local.get $0
|
||||
f64.load offset=16
|
||||
local.set $9
|
||||
local.get $1
|
||||
f64.const 0.5
|
||||
local.get $0
|
||||
f64.load offset=48
|
||||
local.tee $9
|
||||
local.tee $10
|
||||
f64.mul
|
||||
local.get $0
|
||||
f64.load offset=24
|
||||
@ -768,22 +581,27 @@
|
||||
local.get $5
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $1
|
||||
local.set $10
|
||||
local.get $6
|
||||
local.get $7
|
||||
local.get $4
|
||||
i32.load offset=4
|
||||
local.get $0
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $4
|
||||
i32.add
|
||||
i32.load
|
||||
local.tee $3
|
||||
f64.load
|
||||
f64.sub
|
||||
local.tee $1
|
||||
local.set $6
|
||||
local.get $1
|
||||
local.get $10
|
||||
local.get $3
|
||||
f64.load offset=48
|
||||
f64.mul
|
||||
local.get $7
|
||||
local.get $6
|
||||
local.get $6
|
||||
f64.mul
|
||||
local.get $8
|
||||
local.get $3
|
||||
f64.load offset=8
|
||||
f64.sub
|
||||
@ -791,15 +609,8 @@
|
||||
local.get $1
|
||||
f64.mul
|
||||
f64.add
|
||||
local.set $1
|
||||
local.get $10
|
||||
local.get $9
|
||||
local.get $3
|
||||
f64.load offset=48
|
||||
f64.mul
|
||||
local.get $1
|
||||
local.get $8
|
||||
local.get $3
|
||||
f64.load offset=16
|
||||
f64.sub
|
||||
local.tee $1
|
||||
@ -858,17 +669,14 @@
|
||||
global.get $assembly/index/system
|
||||
i32.load
|
||||
local.tee $1
|
||||
i32.const 8
|
||||
i32.sub
|
||||
i32.load offset=4
|
||||
i32.const 2
|
||||
i32.shr_u
|
||||
i32.load offset=12
|
||||
i32.lt_u
|
||||
if (result i32)
|
||||
local.get $1
|
||||
i32.load offset=4
|
||||
local.get $0
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $1
|
||||
i32.add
|
||||
i32.load
|
||||
else
|
||||
@ -876,7 +684,7 @@
|
||||
end
|
||||
)
|
||||
(func $start (; 11 ;) (type $FUNCSIG$v)
|
||||
i32.const 56
|
||||
i32.const 8
|
||||
global.set $~lib/allocator/arena/startOffset
|
||||
global.get $~lib/allocator/arena/startOffset
|
||||
global.set $~lib/allocator/arena/offset
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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))
|
||||
|
@ -29,36 +29,8 @@
|
||||
(import "options" "onFunctionName" (func $assembly/options/onFunctionName (param i32 i32 i32)))
|
||||
(import "options" "onLocalName" (func $assembly/options/onLocalName (param i32 i32 i32 i32)))
|
||||
(import "options" "onSourceMappingURL" (func $assembly/options/onSourceMappingURL (param i32 i32)))
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $src/common/SectionId.Custom (mut i32) (i32.const 0))
|
||||
(global $src/common/SectionId.Type (mut i32) (i32.const 1))
|
||||
(global $src/common/SectionId.Import (mut i32) (i32.const 2))
|
||||
(global $src/common/SectionId.Function (mut i32) (i32.const 3))
|
||||
(global $src/common/SectionId.Table (mut i32) (i32.const 4))
|
||||
(global $src/common/SectionId.Memory (mut i32) (i32.const 5))
|
||||
(global $src/common/SectionId.Global (mut i32) (i32.const 6))
|
||||
(global $src/common/SectionId.Export (mut i32) (i32.const 7))
|
||||
(global $src/common/SectionId.Start (mut i32) (i32.const 8))
|
||||
(global $src/common/SectionId.Element (mut i32) (i32.const 9))
|
||||
(global $src/common/SectionId.Code (mut i32) (i32.const 10))
|
||||
(global $src/common/SectionId.Data (mut i32) (i32.const 11))
|
||||
(global $src/common/ExternalKind.Function (mut i32) (i32.const 0))
|
||||
(global $src/common/ExternalKind.Table (mut i32) (i32.const 1))
|
||||
(global $src/common/ExternalKind.Memory (mut i32) (i32.const 2))
|
||||
(global $src/common/ExternalKind.Global (mut i32) (i32.const 3))
|
||||
(global $src/common/NameType.Module (mut i32) (i32.const 0))
|
||||
(global $src/common/NameType.Function (mut i32) (i32.const 1))
|
||||
(global $src/common/NameType.Local (mut i32) (i32.const 2))
|
||||
(global $src/common/Opcode.end (mut i32) (i32.const 11))
|
||||
(global $src/common/Opcode.get_global (mut i32) (i32.const 35))
|
||||
(global $src/common/Opcode.i32_const (mut i32) (i32.const 65))
|
||||
(global $src/common/Opcode.i64_const (mut i32) (i32.const 66))
|
||||
(global $src/common/Opcode.f32_const (mut i32) (i32.const 67))
|
||||
(global $src/common/Opcode.f64_const (mut i32) (i32.const 68))
|
||||
(global $assembly/index/off (mut i32) (i32.const 0))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "parse" (func $assembly/index/parse))
|
||||
(func $assembly/index/readVaruint (; 19 ;) (type $FUNCSIG$i) (result i32)
|
||||
(local $0 i32)
|
||||
@ -103,57 +75,51 @@
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
global.get $assembly/index/off
|
||||
local.set $2
|
||||
local.set $4
|
||||
loop $continue|0
|
||||
local.get $2
|
||||
local.tee $4
|
||||
local.get $4
|
||||
local.tee $3
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $2
|
||||
local.get $4
|
||||
local.set $4
|
||||
local.get $3
|
||||
i32.load8_u
|
||||
local.tee $5
|
||||
local.tee $3
|
||||
i32.const 127
|
||||
i32.and
|
||||
local.get $1
|
||||
i32.shl
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.or
|
||||
local.set $3
|
||||
local.set $2
|
||||
local.get $1
|
||||
i32.const 7
|
||||
i32.add
|
||||
local.set $1
|
||||
local.get $5
|
||||
local.get $3
|
||||
i32.const 128
|
||||
i32.and
|
||||
br_if $continue|0
|
||||
end
|
||||
local.get $2
|
||||
local.get $4
|
||||
global.set $assembly/index/off
|
||||
i32.const -1
|
||||
local.get $1
|
||||
i32.shl
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.or
|
||||
local.set $2
|
||||
local.get $2
|
||||
local.get $3
|
||||
i32.const 64
|
||||
i32.and
|
||||
i32.const 0
|
||||
i32.ne
|
||||
i32.const 0
|
||||
local.get $1
|
||||
local.get $0
|
||||
i32.lt_u
|
||||
local.tee $4
|
||||
if
|
||||
local.get $5
|
||||
i32.const 64
|
||||
i32.and
|
||||
i32.const 0
|
||||
i32.ne
|
||||
local.set $4
|
||||
end
|
||||
local.get $2
|
||||
local.get $3
|
||||
local.get $4
|
||||
select
|
||||
select
|
||||
)
|
||||
(func $assembly/index/readVarint64 (; 21 ;) (type $FUNCSIG$v)
|
||||
@ -211,24 +177,24 @@
|
||||
block $case3|0
|
||||
block $case2|0
|
||||
block $case1|0
|
||||
global.get $src/common/Opcode.i32_const
|
||||
local.get $0
|
||||
i32.const 65
|
||||
i32.ne
|
||||
if
|
||||
global.get $src/common/Opcode.i64_const
|
||||
local.get $0
|
||||
i32.const 66
|
||||
i32.eq
|
||||
br_if $case1|0
|
||||
global.get $src/common/Opcode.f32_const
|
||||
local.get $0
|
||||
i32.const 67
|
||||
i32.eq
|
||||
br_if $case2|0
|
||||
global.get $src/common/Opcode.f64_const
|
||||
local.get $0
|
||||
i32.const 68
|
||||
i32.eq
|
||||
br_if $case3|0
|
||||
global.get $src/common/Opcode.get_global
|
||||
local.get $0
|
||||
i32.const 35
|
||||
i32.eq
|
||||
br_if $case4|0
|
||||
br $case5|0
|
||||
@ -275,8 +241,8 @@
|
||||
i32.const 1
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
global.get $src/common/Opcode.end
|
||||
local.get $0
|
||||
i32.const 11
|
||||
i32.ne
|
||||
if
|
||||
unreachable
|
||||
@ -301,12 +267,12 @@
|
||||
global.get $assembly/index/off
|
||||
local.tee $0
|
||||
i32.load
|
||||
local.set $6
|
||||
local.set $2
|
||||
local.get $0
|
||||
i32.const 4
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
local.get $6
|
||||
local.get $2
|
||||
i32.const 1836278016
|
||||
i32.ne
|
||||
if
|
||||
@ -315,17 +281,19 @@
|
||||
global.get $assembly/index/off
|
||||
local.tee $0
|
||||
i32.load
|
||||
local.set $6
|
||||
local.set $2
|
||||
local.get $0
|
||||
i32.const 4
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
local.get $6
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.ne
|
||||
if
|
||||
unreachable
|
||||
end
|
||||
i32.const 0
|
||||
local.set $0
|
||||
loop $continue|0
|
||||
global.get $assembly/index/off
|
||||
local.get $1
|
||||
@ -334,41 +302,42 @@
|
||||
call $assembly/index/readVaruint
|
||||
local.set $2
|
||||
call $assembly/index/readVaruint
|
||||
local.set $8
|
||||
local.set $3
|
||||
i32.const 0
|
||||
local.set $4
|
||||
i32.const 0
|
||||
local.set $0
|
||||
local.set $5
|
||||
local.get $2
|
||||
if
|
||||
local.get $2
|
||||
global.get $src/common/SectionId.Data
|
||||
i32.const 11
|
||||
i32.gt_u
|
||||
if
|
||||
unreachable
|
||||
end
|
||||
else
|
||||
global.get $assembly/index/off
|
||||
local.set $5
|
||||
local.set $6
|
||||
call $assembly/index/readVaruint
|
||||
local.tee $0
|
||||
local.set $5
|
||||
local.get $5
|
||||
global.get $assembly/index/off
|
||||
local.tee $4
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
local.get $8
|
||||
local.get $3
|
||||
global.get $assembly/index/off
|
||||
local.get $5
|
||||
local.get $6
|
||||
i32.sub
|
||||
i32.sub
|
||||
local.set $8
|
||||
local.set $3
|
||||
end
|
||||
local.get $2
|
||||
global.get $assembly/index/off
|
||||
local.tee $5
|
||||
local.get $8
|
||||
local.tee $6
|
||||
local.get $3
|
||||
local.get $4
|
||||
local.get $0
|
||||
local.get $5
|
||||
call $assembly/options/onSection
|
||||
if
|
||||
block $break|1
|
||||
@ -382,63 +351,27 @@
|
||||
block $case3|1
|
||||
block $case2|1
|
||||
block $case1|1
|
||||
global.get $src/common/SectionId.Type
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.ne
|
||||
if
|
||||
global.get $src/common/SectionId.Import
|
||||
local.get $2
|
||||
i32.const 2
|
||||
i32.eq
|
||||
br_if $case1|1
|
||||
global.get $src/common/SectionId.Function
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case2|1
|
||||
global.get $src/common/SectionId.Table
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case3|1
|
||||
global.get $src/common/SectionId.Memory
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case4|1
|
||||
global.get $src/common/SectionId.Global
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case5|1
|
||||
global.get $src/common/SectionId.Export
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case6|1
|
||||
global.get $src/common/SectionId.Start
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case7|1
|
||||
global.get $src/common/SectionId.Custom
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case8|1
|
||||
global.get $src/common/SectionId.Element
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case11|1
|
||||
global.get $src/common/SectionId.Code
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case11|1
|
||||
global.get $src/common/SectionId.Data
|
||||
local.get $2
|
||||
i32.eq
|
||||
br_if $case11|1
|
||||
block $tablify|0
|
||||
local.get $2
|
||||
br_table $case8|1 $tablify|0 $tablify|0 $case2|1 $case3|1 $case4|1 $case5|1 $case6|1 $case7|1 $case11|1 $case11|1 $case11|1 $tablify|0
|
||||
end
|
||||
br $case12|1
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $2
|
||||
local.set $4
|
||||
i32.const 0
|
||||
local.set $3
|
||||
loop $repeat|2
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $4
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $3
|
||||
@ -450,46 +383,46 @@
|
||||
call $assembly/index/readVaruint
|
||||
local.set $5
|
||||
i32.const 0
|
||||
local.set $7
|
||||
local.set $2
|
||||
loop $repeat|3
|
||||
local.get $7
|
||||
local.get $2
|
||||
local.get $5
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $3
|
||||
local.get $7
|
||||
local.get $2
|
||||
i32.const 7
|
||||
call $assembly/index/readVarint
|
||||
i32.const 127
|
||||
i32.and
|
||||
call $assembly/options/onTypeParam
|
||||
local.get $7
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $7
|
||||
local.set $2
|
||||
br $repeat|3
|
||||
end
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $7
|
||||
local.set $5
|
||||
i32.const 0
|
||||
local.set $4
|
||||
local.set $2
|
||||
loop $repeat|4
|
||||
local.get $4
|
||||
local.get $7
|
||||
local.get $2
|
||||
local.get $5
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $3
|
||||
local.get $4
|
||||
local.get $2
|
||||
i32.const 7
|
||||
call $assembly/index/readVarint
|
||||
i32.const 127
|
||||
i32.and
|
||||
call $assembly/options/onTypeReturn
|
||||
local.get $4
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $4
|
||||
local.set $2
|
||||
br $repeat|4
|
||||
end
|
||||
end
|
||||
@ -503,73 +436,59 @@
|
||||
br $break|1
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $2
|
||||
local.set $7
|
||||
i32.const 0
|
||||
local.set $3
|
||||
loop $repeat|5
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $7
|
||||
i32.lt_u
|
||||
if
|
||||
call $assembly/index/readVaruint
|
||||
local.set $7
|
||||
local.get $7
|
||||
local.tee $4
|
||||
global.get $assembly/index/off
|
||||
local.tee $5
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
call $assembly/index/readVaruint
|
||||
local.set $9
|
||||
local.get $9
|
||||
local.tee $6
|
||||
global.get $assembly/index/off
|
||||
local.tee $4
|
||||
local.tee $8
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
global.get $assembly/index/off
|
||||
local.tee $6
|
||||
local.tee $9
|
||||
i32.load8_u
|
||||
local.set $0
|
||||
local.get $6
|
||||
local.set $2
|
||||
local.get $9
|
||||
i32.const 1
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
local.get $3
|
||||
local.get $0
|
||||
local.get $2
|
||||
local.get $5
|
||||
local.get $7
|
||||
local.get $4
|
||||
local.get $9
|
||||
local.get $8
|
||||
local.get $6
|
||||
call $assembly/options/onImport
|
||||
block $break|6
|
||||
block $case4|6
|
||||
block $case3|6
|
||||
block $case2|6
|
||||
block $case1|6
|
||||
local.get $0
|
||||
local.tee $6
|
||||
global.get $src/common/ExternalKind.Function
|
||||
i32.ne
|
||||
local.get $2
|
||||
if
|
||||
global.get $src/common/ExternalKind.Table
|
||||
local.get $6
|
||||
i32.eq
|
||||
br_if $case1|6
|
||||
global.get $src/common/ExternalKind.Memory
|
||||
local.get $6
|
||||
i32.eq
|
||||
br_if $case2|6
|
||||
global.get $src/common/ExternalKind.Global
|
||||
local.get $6
|
||||
i32.eq
|
||||
br_if $case3|6
|
||||
br $case4|6
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.sub
|
||||
br_table $case1|6 $case2|6 $case3|6 $case4|6
|
||||
end
|
||||
local.get $11
|
||||
local.tee $10
|
||||
local.get $0
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $11
|
||||
local.get $10
|
||||
local.set $0
|
||||
local.get $2
|
||||
call $assembly/index/readVaruint
|
||||
call $assembly/options/onFunctionImport
|
||||
br $break|6
|
||||
@ -578,18 +497,18 @@
|
||||
call $assembly/index/readVarint
|
||||
i32.const 127
|
||||
i32.and
|
||||
local.set $6
|
||||
local.set $4
|
||||
call $assembly/index/readVaruint
|
||||
local.set $10
|
||||
local.get $12
|
||||
local.tee $0
|
||||
local.set $5
|
||||
local.get $10
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $12
|
||||
local.get $0
|
||||
local.get $6
|
||||
local.set $10
|
||||
local.get $2
|
||||
local.get $4
|
||||
call $assembly/index/readVaruint
|
||||
local.get $10
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.and
|
||||
if (result i32)
|
||||
@ -597,20 +516,20 @@
|
||||
else
|
||||
i32.const -1
|
||||
end
|
||||
local.get $10
|
||||
local.get $5
|
||||
call $assembly/options/onTableImport
|
||||
br $break|6
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $8
|
||||
local.get $13
|
||||
local.tee $6
|
||||
local.set $4
|
||||
local.get $11
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $13
|
||||
local.get $6
|
||||
local.set $11
|
||||
local.get $2
|
||||
call $assembly/index/readVaruint
|
||||
local.get $8
|
||||
local.get $4
|
||||
i32.const 1
|
||||
i32.and
|
||||
if (result i32)
|
||||
@ -618,16 +537,16 @@
|
||||
else
|
||||
i32.const 65535
|
||||
end
|
||||
local.get $8
|
||||
local.get $4
|
||||
call $assembly/options/onMemoryImport
|
||||
br $break|6
|
||||
end
|
||||
local.get $14
|
||||
local.tee $8
|
||||
local.get $12
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $14
|
||||
local.get $8
|
||||
local.set $12
|
||||
local.get $2
|
||||
i32.const 7
|
||||
call $assembly/index/readVarint
|
||||
i32.const 127
|
||||
@ -648,20 +567,20 @@
|
||||
br $break|1
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $2
|
||||
local.set $4
|
||||
i32.const 0
|
||||
local.set $3
|
||||
loop $repeat|7
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $4
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $11
|
||||
local.tee $4
|
||||
local.get $0
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $11
|
||||
local.get $4
|
||||
local.set $0
|
||||
local.get $2
|
||||
call $assembly/index/readVaruint
|
||||
call $assembly/options/onFunction
|
||||
local.get $3
|
||||
@ -674,29 +593,29 @@
|
||||
br $break|1
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $2
|
||||
local.set $7
|
||||
i32.const 0
|
||||
local.set $3
|
||||
loop $repeat|8
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $7
|
||||
i32.lt_u
|
||||
if
|
||||
call $assembly/index/readVaruint
|
||||
i32.const 127
|
||||
i32.and
|
||||
local.set $0
|
||||
call $assembly/index/readVaruint
|
||||
local.set $4
|
||||
local.get $12
|
||||
local.tee $7
|
||||
call $assembly/index/readVaruint
|
||||
local.set $5
|
||||
local.get $10
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $12
|
||||
local.get $7
|
||||
local.get $0
|
||||
call $assembly/index/readVaruint
|
||||
local.set $10
|
||||
local.get $2
|
||||
local.get $4
|
||||
call $assembly/index/readVaruint
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.and
|
||||
if (result i32)
|
||||
@ -704,7 +623,7 @@
|
||||
else
|
||||
i32.const -1
|
||||
end
|
||||
local.get $4
|
||||
local.get $5
|
||||
call $assembly/options/onTable
|
||||
local.get $3
|
||||
i32.const 1
|
||||
@ -716,24 +635,24 @@
|
||||
br $break|1
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $2
|
||||
local.set $6
|
||||
i32.const 0
|
||||
local.set $3
|
||||
loop $repeat|9
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $6
|
||||
i32.lt_u
|
||||
if
|
||||
call $assembly/index/readVaruint
|
||||
local.set $5
|
||||
local.get $13
|
||||
local.tee $0
|
||||
local.set $4
|
||||
local.get $11
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $13
|
||||
local.get $0
|
||||
local.set $11
|
||||
local.get $2
|
||||
call $assembly/index/readVaruint
|
||||
local.get $5
|
||||
local.get $4
|
||||
i32.const 1
|
||||
i32.and
|
||||
if (result i32)
|
||||
@ -741,7 +660,7 @@
|
||||
else
|
||||
i32.const 65535
|
||||
end
|
||||
local.get $5
|
||||
local.get $4
|
||||
call $assembly/options/onMemory
|
||||
local.get $3
|
||||
i32.const 1
|
||||
@ -753,30 +672,30 @@
|
||||
br $break|1
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $2
|
||||
local.set $4
|
||||
i32.const 0
|
||||
local.set $3
|
||||
loop $repeat|10
|
||||
local.get $3
|
||||
local.get $2
|
||||
local.get $4
|
||||
i32.lt_u
|
||||
if
|
||||
i32.const 7
|
||||
call $assembly/index/readVarint
|
||||
i32.const 127
|
||||
i32.and
|
||||
local.set $4
|
||||
local.set $5
|
||||
call $assembly/index/readVaruint
|
||||
local.set $9
|
||||
local.set $6
|
||||
call $assembly/index/skipInitExpr
|
||||
local.get $14
|
||||
local.tee $5
|
||||
local.get $12
|
||||
local.tee $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $14
|
||||
local.set $12
|
||||
local.get $2
|
||||
local.get $5
|
||||
local.get $4
|
||||
local.get $9
|
||||
local.get $6
|
||||
call $assembly/options/onGlobal
|
||||
local.get $3
|
||||
i32.const 1
|
||||
@ -797,25 +716,24 @@
|
||||
i32.lt_u
|
||||
if
|
||||
call $assembly/index/readVaruint
|
||||
local.set $9
|
||||
local.get $9
|
||||
global.get $assembly/index/off
|
||||
local.tee $4
|
||||
global.get $assembly/index/off
|
||||
local.tee $5
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
global.get $assembly/index/off
|
||||
local.tee $0
|
||||
local.tee $6
|
||||
i32.load8_u
|
||||
local.set $6
|
||||
local.get $0
|
||||
local.set $7
|
||||
local.get $6
|
||||
i32.const 1
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
local.get $3
|
||||
local.get $6
|
||||
local.get $7
|
||||
call $assembly/index/readVaruint
|
||||
local.get $5
|
||||
local.get $4
|
||||
local.get $9
|
||||
call $assembly/options/onExport
|
||||
local.get $3
|
||||
i32.const 1
|
||||
@ -830,126 +748,121 @@
|
||||
call $assembly/options/onStart
|
||||
br $break|1
|
||||
end
|
||||
local.get $0
|
||||
local.get $5
|
||||
i32.const 4
|
||||
i32.eq
|
||||
local.tee $2
|
||||
if (result i32)
|
||||
local.get $4
|
||||
i32.load
|
||||
i32.const 1701667182
|
||||
i32.eq
|
||||
else
|
||||
local.get $2
|
||||
i32.const 0
|
||||
end
|
||||
if
|
||||
call $assembly/index/readVaruint
|
||||
local.set $2
|
||||
call $assembly/index/readVaruint
|
||||
local.set $3
|
||||
local.set $4
|
||||
global.get $assembly/index/off
|
||||
local.set $0
|
||||
local.set $5
|
||||
block $break|12
|
||||
block $case3|12
|
||||
block $case2|12
|
||||
block $case1|12
|
||||
local.get $2
|
||||
local.tee $5
|
||||
global.get $src/common/NameType.Module
|
||||
i32.ne
|
||||
if
|
||||
global.get $src/common/NameType.Function
|
||||
local.get $5
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.eq
|
||||
br_if $case1|12
|
||||
global.get $src/common/NameType.Local
|
||||
local.get $5
|
||||
local.get $2
|
||||
i32.const 2
|
||||
i32.eq
|
||||
br_if $case2|12
|
||||
br $case3|12
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $5
|
||||
local.set $2
|
||||
global.get $assembly/index/off
|
||||
local.get $5
|
||||
local.get $2
|
||||
call $assembly/options/onModuleName
|
||||
br $break|12
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $4
|
||||
local.set $3
|
||||
i32.const 0
|
||||
local.set $5
|
||||
local.set $2
|
||||
loop $repeat|13
|
||||
local.get $5
|
||||
local.get $4
|
||||
local.get $2
|
||||
local.get $3
|
||||
i32.lt_u
|
||||
if
|
||||
call $assembly/index/readVaruint
|
||||
local.set $9
|
||||
local.set $6
|
||||
call $assembly/index/readVaruint
|
||||
local.set $7
|
||||
local.get $7
|
||||
local.tee $7
|
||||
global.get $assembly/index/off
|
||||
local.tee $2
|
||||
local.tee $8
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
local.get $9
|
||||
local.get $2
|
||||
local.get $6
|
||||
local.get $8
|
||||
local.get $7
|
||||
call $assembly/options/onFunctionName
|
||||
local.get $5
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $5
|
||||
local.set $2
|
||||
br $repeat|13
|
||||
end
|
||||
end
|
||||
br $break|12
|
||||
end
|
||||
call $assembly/index/readVaruint
|
||||
local.set $4
|
||||
local.set $6
|
||||
i32.const 0
|
||||
local.set $5
|
||||
local.set $2
|
||||
loop $repeat|14
|
||||
local.get $5
|
||||
local.get $4
|
||||
local.get $2
|
||||
local.get $6
|
||||
i32.lt_u
|
||||
if
|
||||
call $assembly/index/readVaruint
|
||||
local.set $2
|
||||
call $assembly/index/readVaruint
|
||||
local.set $7
|
||||
call $assembly/index/readVaruint
|
||||
local.set $8
|
||||
i32.const 0
|
||||
local.set $9
|
||||
local.set $3
|
||||
loop $repeat|15
|
||||
local.get $9
|
||||
local.get $7
|
||||
local.get $3
|
||||
local.get $8
|
||||
i32.lt_u
|
||||
if
|
||||
call $assembly/index/readVaruint
|
||||
local.set $10
|
||||
local.set $9
|
||||
call $assembly/index/readVaruint
|
||||
local.tee $8
|
||||
local.tee $13
|
||||
global.get $assembly/index/off
|
||||
local.tee $6
|
||||
local.tee $14
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
local.get $2
|
||||
local.get $10
|
||||
local.get $6
|
||||
local.get $8
|
||||
call $assembly/options/onLocalName
|
||||
local.get $7
|
||||
local.get $9
|
||||
local.get $14
|
||||
local.get $13
|
||||
call $assembly/options/onLocalName
|
||||
local.get $3
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $9
|
||||
local.set $3
|
||||
br $repeat|15
|
||||
end
|
||||
end
|
||||
local.get $5
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $5
|
||||
local.set $2
|
||||
br $repeat|14
|
||||
end
|
||||
end
|
||||
@ -957,25 +870,22 @@
|
||||
end
|
||||
unreachable
|
||||
end
|
||||
local.get $0
|
||||
local.get $3
|
||||
local.get $4
|
||||
local.get $5
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
br $break|1
|
||||
else
|
||||
block (result i32)
|
||||
local.get $0
|
||||
i32.const 16
|
||||
i32.eq
|
||||
local.tee $0
|
||||
if
|
||||
local.get $4
|
||||
i64.load
|
||||
i64.const 7011371672682196851
|
||||
i64.eq
|
||||
local.set $0
|
||||
end
|
||||
local.get $0
|
||||
local.get $5
|
||||
i32.const 16
|
||||
i32.eq
|
||||
if (result i32)
|
||||
local.get $4
|
||||
i64.load
|
||||
i64.const 7011371672682196851
|
||||
i64.eq
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
if (result i32)
|
||||
local.get $4
|
||||
@ -985,28 +895,28 @@
|
||||
i64.const 5499551997695193200
|
||||
i64.eq
|
||||
else
|
||||
local.get $0
|
||||
i32.const 0
|
||||
end
|
||||
if
|
||||
call $assembly/index/readVaruint
|
||||
local.tee $0
|
||||
local.tee $2
|
||||
global.get $assembly/index/off
|
||||
local.tee $3
|
||||
local.tee $4
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
local.get $3
|
||||
local.get $0
|
||||
local.get $4
|
||||
local.get $2
|
||||
call $assembly/options/onSourceMappingURL
|
||||
end
|
||||
end
|
||||
local.get $5
|
||||
local.get $8
|
||||
local.get $3
|
||||
local.get $6
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
br $break|1
|
||||
end
|
||||
global.get $assembly/index/off
|
||||
local.get $8
|
||||
local.get $3
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
br $break|1
|
||||
@ -1015,7 +925,7 @@
|
||||
end
|
||||
else
|
||||
global.get $assembly/index/off
|
||||
local.get $8
|
||||
local.get $3
|
||||
i32.add
|
||||
global.set $assembly/index/off
|
||||
end
|
||||
|
@ -2890,7 +2890,7 @@ export class Compiler extends DiagnosticEmitter {
|
||||
assert(!expression.toType);
|
||||
let expr = this.compileExpressionRetainType(expression.expression, contextualType, WrapMode.NONE);
|
||||
let type = this.currentType;
|
||||
if (!type.is(TypeFlags.NULLABLE | TypeFlags.REFERENCE)) {
|
||||
if (!type.is(TypeFlags.NULLABLE | TypeFlags.REFERENCE) || this.currentFlow.isNonnull(type, expr)) {
|
||||
this.info(
|
||||
DiagnosticCode.Expression_is_never_null,
|
||||
expression.expression.range
|
||||
|
@ -1,14 +1,26 @@
|
||||
AssemblyScript runtimes
|
||||
=======================
|
||||
|
||||
Default
|
||||
-------
|
||||
None
|
||||
----
|
||||
|
||||
```
|
||||
$> asc ... --runtime none
|
||||
```
|
||||
|
||||
[No runtime](./none.ts) features at all. Useful for building low-level modules that do not require language features like managed classes, or if you'd like to compose your own runtime by including a custom memory allocator and garbage collector.
|
||||
|
||||
* No memory allocator
|
||||
* No garbage collector
|
||||
|
||||
Trace
|
||||
-----
|
||||
|
||||
```
|
||||
$> asc ...
|
||||
```
|
||||
|
||||
The [default runtime](./default.ts) adds proper support for dynamic memory management and garbage collection to your program.
|
||||
The [trace runtime](./trace.ts) adds support for dynamic memory management and garbage collection to your program.
|
||||
|
||||
* [TLSF memory allocator](../allocator/tlsf.ts)
|
||||
* [ITCM garbage collector](../collector/itcm.ts)
|
||||
@ -24,15 +36,3 @@ The [arena runtime](./arena.ts) is just enough to make most language features wo
|
||||
|
||||
* [Arena memory allocator](../allocator/arena.ts) with `memory.reset()`
|
||||
* No garbage collector
|
||||
|
||||
None
|
||||
-----------------
|
||||
|
||||
```
|
||||
$> asc ... --runtime none
|
||||
```
|
||||
|
||||
[No runtime](./none.ts) features at all. Useful for building low-level modules that do not require language features like managed classes, or if you'd like to compose your own runtime by including a custom memory allocator and garbage collector.
|
||||
|
||||
* No memory allocator
|
||||
* No garbage collector
|
||||
|
@ -377,81 +377,84 @@
|
||||
(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 $4
|
||||
local.tee $9
|
||||
f64.const 0.625
|
||||
f64.mul
|
||||
f64.const 4
|
||||
local.set $4
|
||||
local.get $0
|
||||
f64.convert_i32_u
|
||||
local.get $2
|
||||
f64.convert_i32_u
|
||||
local.tee $6
|
||||
f64.mul
|
||||
f64.min
|
||||
f64.div
|
||||
local.set $8
|
||||
local.get $0
|
||||
f64.convert_i32_u
|
||||
local.get $6
|
||||
f64.const 0.5
|
||||
f64.mul
|
||||
f64.sub
|
||||
local.get $8
|
||||
f64.const 10
|
||||
f64.const 3
|
||||
local.get $9
|
||||
f64.mul
|
||||
local.set $9
|
||||
local.get $4
|
||||
f64.const 0.625
|
||||
f64.const 4
|
||||
local.get $6
|
||||
f64.mul
|
||||
local.get $8
|
||||
f64.min
|
||||
f64.div
|
||||
local.tee $10
|
||||
f64.mul
|
||||
local.set $11
|
||||
local.get $4
|
||||
local.get $10
|
||||
f64.mul
|
||||
local.set $13
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.mul
|
||||
i32.const 1
|
||||
i32.shl
|
||||
local.set $2
|
||||
local.set $0
|
||||
f64.const 1
|
||||
local.get $3
|
||||
f64.convert_i32_u
|
||||
local.tee $6
|
||||
f64.div
|
||||
local.set $12
|
||||
local.set $14
|
||||
f64.const 8
|
||||
local.get $6
|
||||
f64.min
|
||||
local.set $13
|
||||
local.set $15
|
||||
loop $repeat|0
|
||||
local.get $7
|
||||
local.get $1
|
||||
i32.lt_u
|
||||
if
|
||||
local.get $7
|
||||
f64.convert_i32_u
|
||||
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 $10
|
||||
f64.mul
|
||||
local.get $11
|
||||
local.get $13
|
||||
f64.sub
|
||||
local.set $10
|
||||
local.set $12
|
||||
f64.const 0
|
||||
local.set $4
|
||||
f64.const 0
|
||||
local.set $5
|
||||
i32.const 0
|
||||
local.set $0
|
||||
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
|
||||
@ -466,31 +469,31 @@
|
||||
f64.mul
|
||||
local.get $5
|
||||
f64.mul
|
||||
local.get $9
|
||||
local.get $11
|
||||
f64.add
|
||||
local.set $5
|
||||
local.get $14
|
||||
local.get $9
|
||||
local.get $6
|
||||
f64.sub
|
||||
local.get $10
|
||||
local.get $12
|
||||
f64.add
|
||||
local.set $4
|
||||
local.get $0
|
||||
local.get $7
|
||||
local.get $3
|
||||
i32.ge_u
|
||||
br_if $break|1
|
||||
local.get $0
|
||||
local.get $7
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $0
|
||||
local.set $7
|
||||
br $continue|1
|
||||
end
|
||||
end
|
||||
end
|
||||
loop $continue|2
|
||||
local.get $0
|
||||
local.get $7
|
||||
f64.convert_i32_u
|
||||
local.get $13
|
||||
local.get $15
|
||||
f64.lt
|
||||
if
|
||||
local.get $4
|
||||
@ -500,7 +503,7 @@
|
||||
local.get $5
|
||||
f64.mul
|
||||
f64.sub
|
||||
local.get $10
|
||||
local.get $12
|
||||
f64.add
|
||||
local.set $6
|
||||
f64.const 2
|
||||
@ -508,22 +511,24 @@
|
||||
f64.mul
|
||||
local.get $5
|
||||
f64.mul
|
||||
local.get $9
|
||||
local.get $11
|
||||
f64.add
|
||||
local.set $5
|
||||
local.get $6
|
||||
local.set $4
|
||||
local.get $0
|
||||
local.get $7
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $0
|
||||
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 $2
|
||||
local.get $0
|
||||
i32.add
|
||||
local.get $4
|
||||
local.get $4
|
||||
@ -537,7 +542,7 @@
|
||||
f64.gt
|
||||
if (result i32)
|
||||
f64.const 2047
|
||||
local.get $0
|
||||
local.get $7
|
||||
i32.const 1
|
||||
i32.add
|
||||
f64.convert_i32_u
|
||||
@ -547,7 +552,7 @@
|
||||
f64.mul
|
||||
call $~lib/math/NativeMath.log2
|
||||
f64.sub
|
||||
local.get $12
|
||||
local.get $14
|
||||
f64.mul
|
||||
f64.const 0
|
||||
f64.max
|
||||
@ -559,10 +564,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))
|
||||
(memory $0 0)
|
||||
(table $0 1 funcref)
|
||||
@ -472,14 +471,7 @@
|
||||
local.get $14
|
||||
f64.add
|
||||
)
|
||||
(func $../../examples/mandelbrot/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 $../../examples/mandelbrot/assembly/index/computeLine (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
|
||||
(func $../../examples/mandelbrot/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)
|
||||
@ -498,6 +490,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
|
||||
@ -681,17 +676,26 @@
|
||||
i32.const 1
|
||||
i32.sub
|
||||
f64.convert_i32_s
|
||||
local.get $18
|
||||
i32.const 1
|
||||
i32.add
|
||||
f64.convert_i32_u
|
||||
local.get $21
|
||||
f64.sub
|
||||
local.get $10
|
||||
f64.mul
|
||||
f64.const 0
|
||||
f64.const 1
|
||||
call $../../examples/mandelbrot/assembly/index/clamp<f64>
|
||||
block $../../examples/mandelbrot/assembly/index/clamp<f64>|inlined.0 (result f64)
|
||||
local.get $18
|
||||
i32.const 1
|
||||
i32.add
|
||||
f64.convert_i32_u
|
||||
local.get $21
|
||||
f64.sub
|
||||
local.get $10
|
||||
f64.mul
|
||||
local.set $24
|
||||
f64.const 0
|
||||
local.set $23
|
||||
f64.const 1
|
||||
local.set $22
|
||||
local.get $24
|
||||
local.get $23
|
||||
f64.max
|
||||
local.get $22
|
||||
f64.min
|
||||
end
|
||||
f64.mul
|
||||
i32.trunc_f64_u
|
||||
local.set $20
|
||||
@ -714,6 +718,6 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $null (; 4 ;) (type $FUNCSIG$v)
|
||||
(func $null (; 3 ;) (type $FUNCSIG$v)
|
||||
)
|
||||
)
|
||||
|
@ -21,6 +21,7 @@
|
||||
(export "testLogicalAndMulti" (func $possibly-null/testLogicalAndMulti))
|
||||
(export "testLogicalOrMulti" (func $possibly-null/testLogicalAndMulti))
|
||||
(export "testAssign" (func $possibly-null/testLogicalAndMulti))
|
||||
(export "testNeverNull" (func $possibly-null/testTrue))
|
||||
(func $possibly-null/testTrue (; 0 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
nop
|
||||
)
|
||||
|
@ -119,3 +119,9 @@ export function testAssign(a: Ref | null, b: Ref): void {
|
||||
a = b;
|
||||
if (isNullable(a)) ERROR("should be non-nullable");
|
||||
}
|
||||
|
||||
export function testNeverNull(a: Ref | null): void {
|
||||
if (a) {
|
||||
a!; // INFO AS225: Expression is never 'null'.
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
(export "testLogicalAndMulti" (func $possibly-null/testLogicalAndMulti))
|
||||
(export "testLogicalOrMulti" (func $possibly-null/testLogicalOrMulti))
|
||||
(export "testAssign" (func $possibly-null/testAssign))
|
||||
(export "testNeverNull" (func $possibly-null/testNeverNull))
|
||||
(func $possibly-null/testTrue (; 0 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
local.get $0
|
||||
if
|
||||
@ -192,6 +193,13 @@
|
||||
local.get $1
|
||||
local.set $0
|
||||
)
|
||||
(func $null (; 18 ;) (type $FUNCSIG$v)
|
||||
(func $possibly-null/testNeverNull (; 18 ;) (type $FUNCSIG$vi) (param $0 i32)
|
||||
local.get $0
|
||||
if
|
||||
local.get $0
|
||||
drop
|
||||
end
|
||||
)
|
||||
(func $null (; 19 ;) (type $FUNCSIG$v)
|
||||
)
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"asc_flags": [
|
||||
"--runtime default"
|
||||
"--runtime trace"
|
||||
]
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
{
|
||||
"features": [
|
||||
"simd"
|
||||
],
|
||||
"asc_flags": [
|
||||
"--runtime trace"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user