mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-31 06:02:11 +00:00
Implement dynamic array literals
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
(module
|
||||
(type $F (func (result f64)))
|
||||
(type $v (func))
|
||||
(type $iFFFFFFFi (func (param i32 f64 f64 f64 f64 f64 f64 f64) (result i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $iFFFFFFFi (func (param i32 f64 f64 f64 f64 f64 f64 f64) (result i32)))
|
||||
(type $iiiv (func (param i32 i32 i32)))
|
||||
(type $iFv (func (param i32 f64)))
|
||||
(type $iF (func (param i32) (result f64)))
|
||||
@@ -13,7 +13,6 @@
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
(global $assembly/index/system (mut i32) (i32.const 0))
|
||||
(global $~argc (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 36))
|
||||
(memory $0 1)
|
||||
(data (i32.const 4) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s")
|
||||
@@ -112,7 +111,49 @@
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/allocUnsafe (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $assembly/index/Body#constructor (; 2 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32)
|
||||
(local $8 i32)
|
||||
(if (result i32)
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
(block (result i32)
|
||||
(f64.store
|
||||
(tee_local $8
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 56)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(f64.store offset=8
|
||||
(get_local $8)
|
||||
(get_local $2)
|
||||
)
|
||||
(f64.store offset=16
|
||||
(get_local $8)
|
||||
(get_local $3)
|
||||
)
|
||||
(f64.store offset=24
|
||||
(get_local $8)
|
||||
(get_local $4)
|
||||
)
|
||||
(f64.store offset=32
|
||||
(get_local $8)
|
||||
(get_local $5)
|
||||
)
|
||||
(f64.store offset=40
|
||||
(get_local $8)
|
||||
(get_local $6)
|
||||
)
|
||||
(f64.store offset=48
|
||||
(get_local $8)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(i32.store
|
||||
(tee_local $1
|
||||
@@ -137,7 +178,7 @@
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#constructor (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/array/Array<Body>#constructor (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(if
|
||||
(i32.gt_u
|
||||
@@ -189,48 +230,6 @@
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $assembly/index/Body#constructor (; 4 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32)
|
||||
(local $8 i32)
|
||||
(if (result i32)
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
(block (result i32)
|
||||
(f64.store
|
||||
(tee_local $8
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 56)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(f64.store offset=8
|
||||
(get_local $8)
|
||||
(get_local $2)
|
||||
)
|
||||
(f64.store offset=16
|
||||
(get_local $8)
|
||||
(get_local $3)
|
||||
)
|
||||
(f64.store offset=24
|
||||
(get_local $8)
|
||||
(get_local $4)
|
||||
)
|
||||
(f64.store offset=32
|
||||
(get_local $8)
|
||||
(get_local $5)
|
||||
)
|
||||
(f64.store offset=40
|
||||
(get_local $8)
|
||||
(get_local $6)
|
||||
)
|
||||
(f64.store offset=48
|
||||
(get_local $8)
|
||||
(get_local $7)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/set_memory (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i64)
|
||||
(local $4 i32)
|
||||
@@ -2531,26 +2530,14 @@
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#push (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(func $~lib/array/Array<Body>#__set (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(set_local $3
|
||||
(i32.add
|
||||
(tee_local $2
|
||||
(i32.load offset=4
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.shr_u
|
||||
(i32.load
|
||||
(tee_local $4
|
||||
(tee_local $3
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
@@ -2562,48 +2549,53 @@
|
||||
(block
|
||||
(if
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.const 268435454)
|
||||
)
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 4)
|
||||
(i32.const 128)
|
||||
(i32.const 42)
|
||||
(i32.const 75)
|
||||
(i32.const 41)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(get_local $0)
|
||||
(tee_local $4
|
||||
(tee_local $3
|
||||
(call $~lib/internal/arraybuffer/reallocUnsafe
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $3)
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store offset=4
|
||||
(get_local $0)
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store offset=4
|
||||
(get_local $0)
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.store offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
)
|
||||
(get_local $3)
|
||||
)
|
||||
(func $~lib/array/Array<Body>#__get (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
@@ -2774,105 +2766,87 @@
|
||||
)
|
||||
(func $assembly/index/init (; 12 ;) (type $v)
|
||||
(local $0 i32)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(block (result i32)
|
||||
(set_global $~argc
|
||||
(i32.const 0)
|
||||
)
|
||||
(block $1of1
|
||||
(block $0of1
|
||||
(block $oob
|
||||
(br_table $0of1 $1of1 $oob
|
||||
(get_global $~argc)
|
||||
)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(tee_local $0
|
||||
(call $~lib/array/Array<Body>#constructor
|
||||
(i32.const 0)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(get_local $0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 4.841431442464721)
|
||||
(f64.const -1.1603200440274284)
|
||||
(f64.const -0.10362204447112311)
|
||||
(f64.const 0.606326392995832)
|
||||
(f64.const 2.81198684491626)
|
||||
(f64.const -0.02521836165988763)
|
||||
(f64.const 0.03769367487038949)
|
||||
)
|
||||
)
|
||||
)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(get_local $0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 8.34336671824458)
|
||||
(f64.const 4.124798564124305)
|
||||
(f64.const -0.4035234171143214)
|
||||
(f64.const -1.0107743461787924)
|
||||
(f64.const 1.8256623712304119)
|
||||
(f64.const 0.008415761376584154)
|
||||
(f64.const 0.011286326131968767)
|
||||
)
|
||||
)
|
||||
)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(get_local $0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 12.894369562139131)
|
||||
(f64.const -15.111151401698631)
|
||||
(f64.const -0.22330757889265573)
|
||||
(f64.const 1.0827910064415354)
|
||||
(f64.const 0.8687130181696082)
|
||||
(f64.const -0.010832637401363636)
|
||||
(f64.const 1.7237240570597112e-03)
|
||||
)
|
||||
)
|
||||
)
|
||||
(drop
|
||||
(call $~lib/array/Array<Body>#push
|
||||
(get_local $0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 15.379697114850917)
|
||||
(f64.const -25.919314609987964)
|
||||
(f64.const 0.17925877295037118)
|
||||
(f64.const 0.979090732243898)
|
||||
(f64.const 0.5946989986476762)
|
||||
(f64.const -0.034755955504078104)
|
||||
(f64.const 2.0336868699246304e-03)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_global $assembly/index/system
|
||||
(call $assembly/index/NBodySystem#constructor
|
||||
(i32.const 0)
|
||||
(get_local $0)
|
||||
(block (result i32)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(tee_local $0
|
||||
(call $~lib/array/Array<Body>#constructor
|
||||
(i32.const 0)
|
||||
(i32.const 5)
|
||||
)
|
||||
)
|
||||
(i32.const 0)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 0)
|
||||
(f64.const 39.47841760435743)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 4.841431442464721)
|
||||
(f64.const -1.1603200440274284)
|
||||
(f64.const -0.10362204447112311)
|
||||
(f64.const 0.606326392995832)
|
||||
(f64.const 2.81198684491626)
|
||||
(f64.const -0.02521836165988763)
|
||||
(f64.const 0.03769367487038949)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 2)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 8.34336671824458)
|
||||
(f64.const 4.124798564124305)
|
||||
(f64.const -0.4035234171143214)
|
||||
(f64.const -1.0107743461787924)
|
||||
(f64.const 1.8256623712304119)
|
||||
(f64.const 0.008415761376584154)
|
||||
(f64.const 0.011286326131968767)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 3)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 12.894369562139131)
|
||||
(f64.const -15.111151401698631)
|
||||
(f64.const -0.22330757889265573)
|
||||
(f64.const 1.0827910064415354)
|
||||
(f64.const 0.8687130181696082)
|
||||
(f64.const -0.010832637401363636)
|
||||
(f64.const 1.7237240570597112e-03)
|
||||
)
|
||||
)
|
||||
(call $~lib/array/Array<Body>#__set
|
||||
(get_local $0)
|
||||
(i32.const 4)
|
||||
(call $assembly/index/Body#constructor
|
||||
(i32.const 0)
|
||||
(f64.const 15.379697114850917)
|
||||
(f64.const -25.919314609987964)
|
||||
(f64.const 0.17925877295037118)
|
||||
(f64.const 0.979090732243898)
|
||||
(f64.const 0.5946989986476762)
|
||||
(f64.const -0.034755955504078104)
|
||||
(f64.const 2.0336868699246304e-03)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user