mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
Fix some diagnostic issues when skipping invalid statements, see #80; Make game-of-life example somewhat interactive; Update dist files
This commit is contained in:
parent
fac0fc59b5
commit
2ff1bb745a
2
dist/asc.js
vendored
2
dist/asc.js
vendored
File diff suppressed because one or more lines are too long
2
dist/asc.js.map
vendored
2
dist/asc.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/assemblyscript.js
vendored
2
dist/assemblyscript.js
vendored
File diff suppressed because one or more lines are too long
2
dist/assemblyscript.js.map
vendored
2
dist/assemblyscript.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
Conway's Game of Life
|
||||
=====================
|
||||
|
||||
An [AssemblyScript](http://assemblyscript.org) example. Continuously updates the cellular automaton and visualizes its state on a canvas. Compiles to ~750 bytes of optimized WASM.
|
||||
An [AssemblyScript](http://assemblyscript.org) example. Continuously updates the cellular automaton and visualizes its state on a canvas. Compiles to ~920 bytes of optimized WASM.
|
||||
|
||||
Instructions
|
||||
------------
|
||||
|
@ -1,8 +1,9 @@
|
||||
// see: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
|
||||
|
||||
const RGB_ALIVE = 0xE692D3; // LSB must be set
|
||||
const RGB_DEAD = 0x851BA6; // LSB must not be set
|
||||
const BIT_ROT = 10; // It's everywhere
|
||||
// Configuration imported from JS.
|
||||
declare const RGB_ALIVE: u32;
|
||||
declare const RGB_DEAD: u32;
|
||||
declare const BIT_ROT: u32;
|
||||
|
||||
var w: i32, h: i32, s: i32;
|
||||
|
||||
@ -76,3 +77,13 @@ export function step(): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Fills the row and column indicated by `x` and `y` with random live cells. */
|
||||
export function fill(x: u32, y: u32, p: f64): void {
|
||||
for (let ix = 0; ix < w; ++ix) {
|
||||
if (Math.random() < p) set(ix, y, RGB_ALIVE | 0xff000000);
|
||||
}
|
||||
for (let iy = 0; iy < h; ++iy) {
|
||||
if (Math.random() < p) set(x, iy, RGB_ALIVE | 0xff000000);
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -2,6 +2,10 @@
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $F (func (result f64)))
|
||||
(type $v (func))
|
||||
(type $iiFv (func (param i32 i32 f64)))
|
||||
(import "env" "RGB_ALIVE" (global $assembly/index/RGB_ALIVE i32))
|
||||
(import "env" "RGB_DEAD" (global $assembly/index/RGB_DEAD i32))
|
||||
(import "env" "BIT_ROT" (global $assembly/index/BIT_ROT i32))
|
||||
(import "JSMath" "random" (func $~lib/math/JSMath.random (result f64)))
|
||||
(import "env" "memory" (memory $0 1))
|
||||
(global $assembly/index/w (mut i32) (i32.const 0))
|
||||
@ -9,98 +13,108 @@
|
||||
(global $assembly/index/s (mut i32) (i32.const 0))
|
||||
(export "init" (func $assembly/index/init))
|
||||
(export "step" (func $assembly/index/step))
|
||||
(export "fill" (func $assembly/index/fill))
|
||||
(export "memory" (memory $0))
|
||||
(func $assembly/index/init (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(local $2 i32)
|
||||
;;@ assembly/index.ts:30:2
|
||||
;;@ assembly/index.ts:31:2
|
||||
(set_global $assembly/index/w
|
||||
;;@ assembly/index.ts:30:6
|
||||
;;@ assembly/index.ts:31:6
|
||||
(get_local $0)
|
||||
)
|
||||
;;@ assembly/index.ts:31:2
|
||||
;;@ assembly/index.ts:32:2
|
||||
(set_global $assembly/index/h
|
||||
;;@ assembly/index.ts:31:6
|
||||
;;@ assembly/index.ts:32:6
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ assembly/index.ts:32:2
|
||||
;;@ assembly/index.ts:33:2
|
||||
(set_global $assembly/index/s
|
||||
;;@ assembly/index.ts:32:6
|
||||
;;@ assembly/index.ts:33:6
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:32:14
|
||||
;;@ assembly/index.ts:33:14
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:35:7
|
||||
;;@ assembly/index.ts:36:7
|
||||
(set_local $0
|
||||
;;@ assembly/index.ts:35:15
|
||||
;;@ assembly/index.ts:36:15
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
;;@ assembly/index.ts:35:18
|
||||
;;@ assembly/index.ts:36:18
|
||||
(i32.lt_s
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:35:22
|
||||
;;@ assembly/index.ts:36:22
|
||||
(get_global $assembly/index/h)
|
||||
)
|
||||
(block
|
||||
;;@ assembly/index.ts:36:9
|
||||
;;@ assembly/index.ts:37:9
|
||||
(set_local $1
|
||||
;;@ assembly/index.ts:36:17
|
||||
;;@ assembly/index.ts:37:17
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|1
|
||||
(if
|
||||
;;@ assembly/index.ts:36:20
|
||||
;;@ assembly/index.ts:37:20
|
||||
(i32.lt_s
|
||||
(get_local $1)
|
||||
;;@ assembly/index.ts:36:24
|
||||
;;@ assembly/index.ts:37:24
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
;;@ assembly/index.ts:37:16
|
||||
;;@ assembly/index.ts:38:16
|
||||
(if (result i32)
|
||||
(f64.gt
|
||||
;;@ assembly/index.ts:37:21
|
||||
;;@ assembly/index.ts:38:21
|
||||
(call $~lib/math/JSMath.random)
|
||||
;;@ assembly/index.ts:37:32
|
||||
;;@ assembly/index.ts:38:32
|
||||
(f64.const 0.1)
|
||||
)
|
||||
;;@ assembly/index.ts:37:38
|
||||
(i32.const 8723366)
|
||||
(i32.const -1666349)
|
||||
;;@ assembly/index.ts:38:38
|
||||
(i32.and
|
||||
(get_global $assembly/index/RGB_DEAD)
|
||||
;;@ assembly/index.ts:38:49
|
||||
(i32.const 16777215)
|
||||
)
|
||||
;;@ assembly/index.ts:38:62
|
||||
(i32.or
|
||||
(get_global $assembly/index/RGB_ALIVE)
|
||||
;;@ assembly/index.ts:38:74
|
||||
(i32.const -16777216)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:18:2
|
||||
;;@ assembly/index.ts:19:2
|
||||
(i32.store
|
||||
;;@ assembly/index.ts:18:13
|
||||
;;@ assembly/index.ts:19:13
|
||||
(i32.shl
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:18:14
|
||||
;;@ assembly/index.ts:19:14
|
||||
(i32.add
|
||||
(get_global $assembly/index/s)
|
||||
;;@ assembly/index.ts:18:18
|
||||
;;@ assembly/index.ts:19:18
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:18:22
|
||||
;;@ assembly/index.ts:19:22
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:18:26
|
||||
;;@ assembly/index.ts:19:26
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ assembly/index.ts:18:32
|
||||
;;@ assembly/index.ts:19:32
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ assembly/index.ts:18:35
|
||||
;;@ assembly/index.ts:19:35
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ assembly/index.ts:36:27
|
||||
;;@ assembly/index.ts:37:27
|
||||
(set_local $1
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:36:29
|
||||
;;@ assembly/index.ts:37:29
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
@ -109,10 +123,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:35:25
|
||||
;;@ assembly/index.ts:36:25
|
||||
(set_local $0
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:35:27
|
||||
;;@ assembly/index.ts:36:27
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
@ -133,81 +147,81 @@
|
||||
(local $7 i32)
|
||||
(local $8 i32)
|
||||
(set_local $5
|
||||
;;@ assembly/index.ts:44:12
|
||||
;;@ assembly/index.ts:45:12
|
||||
(i32.sub
|
||||
(get_global $assembly/index/h)
|
||||
;;@ assembly/index.ts:44:16
|
||||
;;@ assembly/index.ts:45:16
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $6
|
||||
;;@ assembly/index.ts:45:12
|
||||
;;@ assembly/index.ts:46:12
|
||||
(i32.sub
|
||||
(get_global $assembly/index/w)
|
||||
;;@ assembly/index.ts:45:16
|
||||
;;@ assembly/index.ts:46:16
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
;;@ assembly/index.ts:49:18
|
||||
;;@ assembly/index.ts:50:18
|
||||
(i32.lt_s
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:49:22
|
||||
;;@ assembly/index.ts:50:22
|
||||
(get_global $assembly/index/h)
|
||||
)
|
||||
(block
|
||||
(set_local $7
|
||||
;;@ assembly/index.ts:50:14
|
||||
(if (result i32)
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:50:29
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:50:33
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ assembly/index.ts:50:23
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
(set_local $8
|
||||
;;@ assembly/index.ts:51:14
|
||||
(if (result i32)
|
||||
(i32.eq
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:51:19
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ assembly/index.ts:51:25
|
||||
(i32.const 0)
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:51:29
|
||||
(i32.add
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:51:33
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ assembly/index.ts:51:23
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:52:9
|
||||
(set_local $8
|
||||
;;@ assembly/index.ts:52:14
|
||||
(if (result i32)
|
||||
(i32.eq
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:52:19
|
||||
(get_local $5)
|
||||
)
|
||||
;;@ assembly/index.ts:52:25
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:52:29
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:52:33
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:53:9
|
||||
(set_local $1
|
||||
;;@ assembly/index.ts:52:17
|
||||
;;@ assembly/index.ts:53:17
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|1
|
||||
(if
|
||||
;;@ assembly/index.ts:52:20
|
||||
;;@ assembly/index.ts:53:20
|
||||
(i32.lt_s
|
||||
(get_local $1)
|
||||
;;@ assembly/index.ts:52:24
|
||||
;;@ assembly/index.ts:53:24
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
(block
|
||||
;;@ assembly/index.ts:58:6
|
||||
;;@ assembly/index.ts:59:6
|
||||
(set_local $0
|
||||
;;@ assembly/index.ts:58:27
|
||||
;;@ assembly/index.ts:59:27
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:59:8
|
||||
;;@ assembly/index.ts:60:8
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
@ -220,22 +234,22 @@
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(tee_local $0
|
||||
;;@ assembly/index.ts:59:18
|
||||
;;@ assembly/index.ts:60:18
|
||||
(get_local $7)
|
||||
)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
(tee_local $3
|
||||
;;@ assembly/index.ts:53:16
|
||||
;;@ assembly/index.ts:54:16
|
||||
(if (result i32)
|
||||
(get_local $1)
|
||||
;;@ assembly/index.ts:53:31
|
||||
;;@ assembly/index.ts:54:31
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
;;@ assembly/index.ts:53:35
|
||||
;;@ assembly/index.ts:54:35
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ assembly/index.ts:53:25
|
||||
;;@ assembly/index.ts:54:25
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
@ -243,53 +257,53 @@
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:59:25
|
||||
;;@ assembly/index.ts:60:25
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ assembly/index.ts:59:30
|
||||
;;@ assembly/index.ts:60:30
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:59:40
|
||||
;;@ assembly/index.ts:60:40
|
||||
(get_local $0)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
;;@ assembly/index.ts:59:35
|
||||
;;@ assembly/index.ts:60:35
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:59:47
|
||||
;;@ assembly/index.ts:60:47
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:59:52
|
||||
;;@ assembly/index.ts:60:52
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:59:62
|
||||
;;@ assembly/index.ts:60:62
|
||||
(get_local $0)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
(tee_local $4
|
||||
;;@ assembly/index.ts:54:16
|
||||
;;@ assembly/index.ts:55:16
|
||||
(if (result i32)
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
;;@ assembly/index.ts:54:21
|
||||
;;@ assembly/index.ts:55:21
|
||||
(get_local $6)
|
||||
)
|
||||
;;@ assembly/index.ts:54:27
|
||||
;;@ assembly/index.ts:55:27
|
||||
(i32.const 0)
|
||||
;;@ assembly/index.ts:54:31
|
||||
;;@ assembly/index.ts:55:31
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
;;@ assembly/index.ts:54:35
|
||||
;;@ assembly/index.ts:55:35
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -298,155 +312,155 @@
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:59:69
|
||||
;;@ assembly/index.ts:60:69
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:60:8
|
||||
;;@ assembly/index.ts:61:8
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(tee_local $0
|
||||
;;@ assembly/index.ts:60:18
|
||||
;;@ assembly/index.ts:61:18
|
||||
(get_local $2)
|
||||
)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
;;@ assembly/index.ts:60:13
|
||||
;;@ assembly/index.ts:61:13
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:60:25
|
||||
;;@ assembly/index.ts:61:25
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:60:52
|
||||
;;@ assembly/index.ts:61:52
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:60:62
|
||||
;;@ assembly/index.ts:61:62
|
||||
(get_local $0)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
;;@ assembly/index.ts:60:57
|
||||
;;@ assembly/index.ts:61:57
|
||||
(get_local $4)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:60:69
|
||||
;;@ assembly/index.ts:61:69
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:61:8
|
||||
;;@ assembly/index.ts:62:8
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(tee_local $0
|
||||
;;@ assembly/index.ts:61:18
|
||||
;;@ assembly/index.ts:62:18
|
||||
(get_local $8)
|
||||
)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
;;@ assembly/index.ts:61:13
|
||||
;;@ assembly/index.ts:62:13
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:61:25
|
||||
;;@ assembly/index.ts:62:25
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:61:30
|
||||
;;@ assembly/index.ts:62:30
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:61:40
|
||||
;;@ assembly/index.ts:62:40
|
||||
(get_local $0)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
;;@ assembly/index.ts:61:35
|
||||
;;@ assembly/index.ts:62:35
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:61:47
|
||||
;;@ assembly/index.ts:62:47
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:61:52
|
||||
;;@ assembly/index.ts:62:52
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:61:62
|
||||
;;@ assembly/index.ts:62:62
|
||||
(get_local $0)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
;;@ assembly/index.ts:61:57
|
||||
;;@ assembly/index.ts:62:57
|
||||
(get_local $4)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:61:69
|
||||
;;@ assembly/index.ts:62:69
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:65:6
|
||||
;;@ assembly/index.ts:66:6
|
||||
(if
|
||||
;;@ assembly/index.ts:65:10
|
||||
;;@ assembly/index.ts:66:10
|
||||
(i32.and
|
||||
;;@ assembly/index.ts:64:6
|
||||
;;@ assembly/index.ts:65:6
|
||||
(tee_local $3
|
||||
;;@ assembly/index.ts:12:9
|
||||
;;@ assembly/index.ts:13:9
|
||||
(i32.load
|
||||
;;@ assembly/index.ts:12:19
|
||||
;;@ assembly/index.ts:13:19
|
||||
(i32.shl
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:12:20
|
||||
;;@ assembly/index.ts:13:20
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:64:24
|
||||
;;@ assembly/index.ts:65:24
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:12:24
|
||||
;;@ assembly/index.ts:13:24
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
;;@ assembly/index.ts:64:21
|
||||
;;@ assembly/index.ts:65:21
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ assembly/index.ts:12:34
|
||||
;;@ assembly/index.ts:13:34
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:65:17
|
||||
;;@ assembly/index.ts:66:17
|
||||
(i32.const 1)
|
||||
)
|
||||
;;@ assembly/index.ts:67:8
|
||||
;;@ assembly/index.ts:68:8
|
||||
(if
|
||||
;;@ assembly/index.ts:67:12
|
||||
;;@ assembly/index.ts:68:12
|
||||
(i32.eq
|
||||
(i32.and
|
||||
;;@ assembly/index.ts:67:13
|
||||
;;@ assembly/index.ts:68:13
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:67:30
|
||||
;;@ assembly/index.ts:68:30
|
||||
(i32.const 14)
|
||||
)
|
||||
;;@ assembly/index.ts:67:41
|
||||
;;@ assembly/index.ts:68:41
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.store
|
||||
@ -455,12 +469,12 @@
|
||||
(i32.add
|
||||
(get_global $assembly/index/s)
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:67:56
|
||||
;;@ assembly/index.ts:68:56
|
||||
(get_local $2)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:67:53
|
||||
;;@ assembly/index.ts:68:53
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
@ -473,12 +487,12 @@
|
||||
(i32.sub
|
||||
(i32.shr_u
|
||||
(tee_local $0
|
||||
;;@ assembly/index.ts:67:59
|
||||
;;@ assembly/index.ts:68:59
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 24)
|
||||
)
|
||||
(i32.const 10)
|
||||
(get_global $assembly/index/BIT_ROT)
|
||||
)
|
||||
)
|
||||
(tee_local $4
|
||||
@ -504,25 +518,30 @@
|
||||
(i32.add
|
||||
(get_global $assembly/index/s)
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:69:20
|
||||
;;@ assembly/index.ts:70:20
|
||||
(get_local $2)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:69:17
|
||||
;;@ assembly/index.ts:70:17
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.const -8053850)
|
||||
;;@ assembly/index.ts:70:23
|
||||
(i32.or
|
||||
(get_global $assembly/index/RGB_DEAD)
|
||||
;;@ assembly/index.ts:70:34
|
||||
(i32.const -16777216)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:72:8
|
||||
;;@ assembly/index.ts:73:8
|
||||
(if
|
||||
;;@ assembly/index.ts:72:12
|
||||
;;@ assembly/index.ts:73:12
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
;;@ assembly/index.ts:72:30
|
||||
;;@ assembly/index.ts:73:30
|
||||
(i32.const 3)
|
||||
)
|
||||
(i32.store
|
||||
@ -531,62 +550,67 @@
|
||||
(i32.add
|
||||
(get_global $assembly/index/s)
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:72:40
|
||||
;;@ assembly/index.ts:73:40
|
||||
(get_local $2)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:72:37
|
||||
;;@ assembly/index.ts:73:37
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.const -1666349)
|
||||
;;@ assembly/index.ts:73:43
|
||||
(i32.or
|
||||
(get_global $assembly/index/RGB_ALIVE)
|
||||
;;@ assembly/index.ts:73:55
|
||||
(i32.const -16777216)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:18:2
|
||||
;;@ assembly/index.ts:19:2
|
||||
(i32.store
|
||||
;;@ assembly/index.ts:18:13
|
||||
;;@ assembly/index.ts:19:13
|
||||
(i32.shl
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:18:14
|
||||
;;@ assembly/index.ts:19:14
|
||||
(i32.add
|
||||
(get_global $assembly/index/s)
|
||||
;;@ assembly/index.ts:18:18
|
||||
;;@ assembly/index.ts:19:18
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:74:20
|
||||
;;@ assembly/index.ts:75:20
|
||||
(get_local $2)
|
||||
;;@ assembly/index.ts:18:22
|
||||
;;@ assembly/index.ts:19:22
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:74:17
|
||||
;;@ assembly/index.ts:75:17
|
||||
(get_local $1)
|
||||
)
|
||||
;;@ assembly/index.ts:18:32
|
||||
;;@ assembly/index.ts:19:32
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ assembly/index.ts:25:12
|
||||
;;@ assembly/index.ts:26:12
|
||||
(i32.or
|
||||
(i32.shl
|
||||
;;@ assembly/index.ts:24:2
|
||||
;;@ assembly/index.ts:25:2
|
||||
(tee_local $0
|
||||
;;@ assembly/index.ts:24:10
|
||||
;;@ assembly/index.ts:25:10
|
||||
(select
|
||||
(tee_local $0
|
||||
;;@ assembly/index.ts:24:19
|
||||
;;@ assembly/index.ts:25:19
|
||||
(i32.sub
|
||||
(i32.shr_u
|
||||
;;@ assembly/index.ts:74:23
|
||||
;;@ assembly/index.ts:75:23
|
||||
(get_local $3)
|
||||
;;@ assembly/index.ts:24:26
|
||||
;;@ assembly/index.ts:25:26
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ assembly/index.ts:24:32
|
||||
(i32.const 10)
|
||||
;;@ assembly/index.ts:25:32
|
||||
(get_global $assembly/index/BIT_ROT)
|
||||
)
|
||||
)
|
||||
(tee_local $4
|
||||
;;@ assembly/index.ts:24:41
|
||||
;;@ assembly/index.ts:25:41
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.gt_s
|
||||
@ -595,24 +619,24 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:25:18
|
||||
;;@ assembly/index.ts:26:18
|
||||
(i32.const 24)
|
||||
)
|
||||
;;@ assembly/index.ts:25:24
|
||||
;;@ assembly/index.ts:26:24
|
||||
(i32.and
|
||||
;;@ assembly/index.ts:25:25
|
||||
;;@ assembly/index.ts:26:25
|
||||
(get_local $3)
|
||||
;;@ assembly/index.ts:25:29
|
||||
;;@ assembly/index.ts:26:29
|
||||
(i32.const 16777215)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:52:27
|
||||
;;@ assembly/index.ts:53:27
|
||||
(set_local $1
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:52:29
|
||||
;;@ assembly/index.ts:53:29
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
@ -621,10 +645,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:49:25
|
||||
;;@ assembly/index.ts:50:25
|
||||
(set_local $2
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:49:27
|
||||
;;@ assembly/index.ts:50:27
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
@ -634,4 +658,126 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $assembly/index/fill (; 3 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
|
||||
(local $3 i32)
|
||||
(loop $continue|0
|
||||
(if
|
||||
;;@ assembly/index.ts:83:19
|
||||
(i32.lt_s
|
||||
(get_local $3)
|
||||
;;@ assembly/index.ts:83:24
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
(block
|
||||
;;@ assembly/index.ts:84:4
|
||||
(if
|
||||
;;@ assembly/index.ts:84:8
|
||||
(f64.lt
|
||||
;;@ assembly/index.ts:84:13
|
||||
(call $~lib/math/JSMath.random)
|
||||
;;@ assembly/index.ts:84:24
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $assembly/index/s)
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:84:35
|
||||
(get_local $1)
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:84:31
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ assembly/index.ts:84:38
|
||||
(i32.or
|
||||
(get_global $assembly/index/RGB_ALIVE)
|
||||
;;@ assembly/index.ts:84:50
|
||||
(i32.const -16777216)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:83:27
|
||||
(set_local $3
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:83:29
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:86:7
|
||||
(set_local $3
|
||||
;;@ assembly/index.ts:86:16
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|1
|
||||
(if
|
||||
;;@ assembly/index.ts:86:19
|
||||
(i32.lt_s
|
||||
(get_local $3)
|
||||
;;@ assembly/index.ts:86:24
|
||||
(get_global $assembly/index/h)
|
||||
)
|
||||
(block
|
||||
;;@ assembly/index.ts:87:4
|
||||
(if
|
||||
;;@ assembly/index.ts:87:8
|
||||
(f64.lt
|
||||
;;@ assembly/index.ts:87:13
|
||||
(call $~lib/math/JSMath.random)
|
||||
;;@ assembly/index.ts:87:24
|
||||
(get_local $2)
|
||||
)
|
||||
;;@ assembly/index.ts:19:2
|
||||
(i32.store
|
||||
;;@ assembly/index.ts:19:13
|
||||
(i32.shl
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:19:14
|
||||
(i32.add
|
||||
(get_global $assembly/index/s)
|
||||
;;@ assembly/index.ts:19:18
|
||||
(i32.mul
|
||||
;;@ assembly/index.ts:87:34
|
||||
(get_local $3)
|
||||
;;@ assembly/index.ts:19:22
|
||||
(get_global $assembly/index/w)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:87:31
|
||||
(get_local $0)
|
||||
)
|
||||
;;@ assembly/index.ts:19:32
|
||||
(i32.const 2)
|
||||
)
|
||||
;;@ assembly/index.ts:87:38
|
||||
(i32.or
|
||||
(get_global $assembly/index/RGB_ALIVE)
|
||||
;;@ assembly/index.ts:87:50
|
||||
(i32.const -16777216)
|
||||
)
|
||||
)
|
||||
)
|
||||
;;@ assembly/index.ts:86:27
|
||||
(set_local $3
|
||||
(i32.add
|
||||
;;@ assembly/index.ts:86:29
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,13 +2,16 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Conway's Game of Life - AssemblyScript</title>
|
||||
<link rel="icon" href="http://assemblyscript.org/favicon.ico" type="image/x-icon" />
|
||||
<meta name="viewport" content="user-scalable=0" />
|
||||
<style>
|
||||
html, body { height: 100%; margin: 0; overflow: hidden; color: #111; background: #fff; font-family: sans-serif; }
|
||||
body { border-top: 2px solid #bc18d4; }
|
||||
h1 { padding: 18px 20px 20px; font-size: 12pt; margin: 0; }
|
||||
a { color: #111; text-decoration: none; }
|
||||
a:hover { color: #bc18d4; text-decoration: underline; }
|
||||
canvas { position: absolute; top: 60px; left: 20px; width: calc(100% - 40px); height: calc(100% - 80px); background: #100707; }
|
||||
canvas { position: absolute; top: 60px; left: 20px; width: calc(100% - 40px); height: calc(100% - 80px); background: #100707; cursor: cell; user-select: none; }
|
||||
#edge { position: absolute; bottom: 40px; right: 40px; color: #fff; display: none; text-shadow: 0 1px 2px #000; -ms-user-select: none; user-select: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -18,8 +21,14 @@ canvas { position: absolute; top: 60px; left: 20px; width: calc(100% - 40px); he
|
||||
( <a href="https://github.com/AssemblyScript/assemblyscript/blob/master/examples/game-of-life/assembly/index.ts">source</a> )
|
||||
</h1>
|
||||
<canvas></canvas>
|
||||
<div id="edge">Might be blurry because MS Edge does not support 'image-rendering: crisp-edges' (yet) :-(</div>
|
||||
<script>"use strict";
|
||||
|
||||
// Configuration
|
||||
const RGB_ALIVE = 0xD392E6;
|
||||
const RGB_DEAD = 0xA61B85;
|
||||
const BIT_ROT = 10;
|
||||
|
||||
// Set up the canvas with a 2D rendering context
|
||||
var cnv = document.getElementsByTagName("canvas")[0];
|
||||
var ctx = cnv.getContext("2d");
|
||||
@ -38,6 +47,8 @@ cnv.style = `
|
||||
image-rendering: -moz-crisp-edges;
|
||||
image-rendering: -webkit-optimize-contrast;
|
||||
image-rendering: -o-crisp-edges;
|
||||
image-rendering: optimize-contrast;
|
||||
image-rendering: crisp-edges;
|
||||
image-rendering: pixelated;
|
||||
-ms-interpolation-mode: nearest-neighbor;
|
||||
`;
|
||||
@ -50,7 +61,13 @@ var memory = new WebAssembly.Memory({ initial: ((byteSize + 0xffff) & ~0xffff) >
|
||||
fetch("build/optimized.wasm")
|
||||
.then(response => response.arrayBuffer())
|
||||
.then(buffer => WebAssembly.instantiate(buffer, {
|
||||
env: { memory: memory, abort: function() {} },
|
||||
env: {
|
||||
RGB_ALIVE : rgb2le(RGB_ALIVE) | 1, // little endian, LSB must be set
|
||||
RGB_DEAD : rgb2le(RGB_DEAD) & ~1, // little endian, LSB must not be set
|
||||
BIT_ROT,
|
||||
memory,
|
||||
abort: function() {}
|
||||
},
|
||||
JSMath: Math
|
||||
}))
|
||||
.then(module => {
|
||||
@ -77,10 +94,40 @@ fetch("build/optimized.wasm")
|
||||
ctx.putImageData(imageData, 0, 0); // apply image buffer
|
||||
})();
|
||||
|
||||
// When clicked or dragged, fill the current row and column with random live cells
|
||||
var down = false;
|
||||
[ [cnv, "mousedown"],
|
||||
[cnv, "touchstart"]
|
||||
].forEach(eh => eh[0].addEventListener(eh[1], e => down = true));
|
||||
[ [document, "mouseup"],
|
||||
[document, "touchend"]
|
||||
].forEach(eh => eh[0].addEventListener(eh[1], e => down = false));
|
||||
[ [cnv, "mousemove"],
|
||||
[cnv, "touchmove"],
|
||||
[cnv, "mousedown"]
|
||||
].forEach(eh => eh[0].addEventListener(eh[1], e => {
|
||||
if (!down) return;
|
||||
var loc;
|
||||
if (e.touches) {
|
||||
if (e.touches.length > 1) return;
|
||||
loc = e.touches[0];
|
||||
} else {
|
||||
loc = e;
|
||||
}
|
||||
var bcr = cnv.getBoundingClientRect();
|
||||
exports.fill((loc.clientX - bcr.left) >>> 1, (loc.clientY - bcr.top) >>> 1, 0.5);
|
||||
}));
|
||||
|
||||
// :-(
|
||||
if (navigator.userAgent.indexOf(" Edge/") >= 0) document.getElementById("edge").style.display = "block";
|
||||
}).catch(err => {
|
||||
alert("Failed to load WASM: " + err.message + " (ad blocker, maybe?)");
|
||||
console.log(err.stack);
|
||||
});
|
||||
|
||||
function rgb2le(rgb) {
|
||||
return ((rgb >>> 16) & 0xff) | (rgb & 0xff00) | (rgb & 0xff) << 16;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -2,6 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Mandelbrot set - AssemblyScript</title>
|
||||
<link rel="icon" href="http://assemblyscript.org/favicon.ico" type="image/x-icon" />
|
||||
<style>
|
||||
html, body { height: 100%; margin: 0; overflow: hidden; color: #111; background: #fff; font-family: sans-serif; }
|
||||
h1 { padding: 20px; font-size: 12pt; margin: 0; }
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @module builtins
|
||||
*//***/
|
||||
|
||||
import {
|
||||
import {
|
||||
Compiler,
|
||||
ConversionKind,
|
||||
|
||||
|
@ -176,6 +176,12 @@ export class Parser extends DiagnosticEmitter {
|
||||
var exportStart: i32 = 0;
|
||||
var exportEnd: i32 = 0;
|
||||
if (tn.skip(Token.EXPORT)) {
|
||||
if (tn.skip(Token.DEFAULT)) {
|
||||
this.error(
|
||||
DiagnosticCode.Operation_not_supported,
|
||||
tn.range()
|
||||
);
|
||||
}
|
||||
if (startPos < 0) startPos = tn.tokenPos;
|
||||
flags |= CommonFlags.EXPORT;
|
||||
exportStart = tn.tokenPos;
|
||||
@ -3181,11 +3187,8 @@ export class Parser extends DiagnosticEmitter {
|
||||
let nextToken = tn.peek(true);
|
||||
if (
|
||||
nextToken == Token.ENDOFFILE || // next step should handle this
|
||||
nextToken == Token.CLOSEBRACE // current step should handle this
|
||||
nextToken == Token.SEMICOLON // end of the statement for sure
|
||||
) {
|
||||
break;
|
||||
}
|
||||
if (nextToken == Token.SEMICOLON) { // end of the statement for sure
|
||||
tn.next();
|
||||
break;
|
||||
}
|
||||
|
@ -905,7 +905,6 @@ export class Tokenizer extends DiagnosticEmitter {
|
||||
this.token = state.token;
|
||||
this.tokenPos = state.tokenPos;
|
||||
this.nextToken = -1;
|
||||
reusableState = state;
|
||||
}
|
||||
|
||||
range(start: i32 = -1, end: i32 = -1): Range {
|
||||
|
@ -1,568 +0,0 @@
|
||||
(module
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $F (func (result f64)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
|
||||
(global $../../examples/game-of-life/assembly/index/w (mut i32) (i32.const 0))
|
||||
(global $../../examples/game-of-life/assembly/index/h (mut i32) (i32.const 0))
|
||||
(global $../../examples/game-of-life/assembly/index/s (mut i32) (i32.const 0))
|
||||
(global $~lib/math/random_seeded (mut i32) (i32.const 0))
|
||||
(global $~lib/math/random_state0 (mut i64) (i64.const 0))
|
||||
(global $~lib/math/random_state1 (mut i64) (i64.const 0))
|
||||
(memory $0 1)
|
||||
(data (i32.const 4) "\0c\00\00\00~\00l\00i\00b\00/\00m\00a\00t\00h\00.\00t\00s")
|
||||
(export "init" (func $../../examples/game-of-life/assembly/index/init))
|
||||
(export "step" (func $../../examples/game-of-life/assembly/index/step))
|
||||
(export "memory" (memory $0))
|
||||
(func $~lib/math/NativeMath.random (; 1 ;) (type $F) (result f64)
|
||||
(local $0 i64)
|
||||
(local $1 i64)
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_global $~lib/math/random_seeded)
|
||||
)
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 4)
|
||||
(i32.const 1007)
|
||||
(i32.const 24)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(get_global $~lib/math/random_state0)
|
||||
)
|
||||
(set_global $~lib/math/random_state0
|
||||
(tee_local $1
|
||||
(get_global $~lib/math/random_state1)
|
||||
)
|
||||
)
|
||||
(set_global $~lib/math/random_state1
|
||||
(tee_local $0
|
||||
(i64.xor
|
||||
(i64.xor
|
||||
(i64.xor
|
||||
(tee_local $0
|
||||
(i64.xor
|
||||
(get_local $0)
|
||||
(i64.shl
|
||||
(get_local $0)
|
||||
(i64.const 23)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i64.shr_u
|
||||
(get_local $0)
|
||||
(i64.const 17)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(i64.shr_u
|
||||
(get_local $1)
|
||||
(i64.const 26)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(f64.sub
|
||||
(f64.reinterpret/i64
|
||||
(i64.or
|
||||
(i64.and
|
||||
(i64.add
|
||||
(get_local $1)
|
||||
(get_local $0)
|
||||
)
|
||||
(i64.const 4503599627370495)
|
||||
)
|
||||
(i64.const 4607182418800017408)
|
||||
)
|
||||
)
|
||||
(f64.const 1)
|
||||
)
|
||||
)
|
||||
(func $../../examples/game-of-life/assembly/index/init (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(set_global $../../examples/game-of-life/assembly/index/w
|
||||
(get_local $0)
|
||||
)
|
||||
(set_global $../../examples/game-of-life/assembly/index/h
|
||||
(get_local $1)
|
||||
)
|
||||
(set_global $../../examples/game-of-life/assembly/index/s
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $0)
|
||||
(get_global $../../examples/game-of-life/assembly/index/h)
|
||||
)
|
||||
(block
|
||||
(set_local $1
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|1
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $1)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
(get_local $1)
|
||||
)
|
||||
(set_local $3
|
||||
(get_local $0)
|
||||
)
|
||||
(set_local $4
|
||||
(if (result i32)
|
||||
(f64.gt
|
||||
(call $~lib/math/NativeMath.random)
|
||||
(f64.const 0.1)
|
||||
)
|
||||
(i32.const 8723366)
|
||||
(i32.const -1666349)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $3)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(get_local $4)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $../../examples/game-of-life/assembly/index/step (; 3 ;) (type $v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 i32)
|
||||
(set_local $7
|
||||
(i32.sub
|
||||
(get_global $../../examples/game-of-life/assembly/index/h)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $8
|
||||
(i32.sub
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $0)
|
||||
(get_global $../../examples/game-of-life/assembly/index/h)
|
||||
)
|
||||
(block
|
||||
(set_local $4
|
||||
(select
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(get_local $7)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(set_local $5
|
||||
(select
|
||||
(i32.const 0)
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
(get_local $7)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|1
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $1)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(block
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $4)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(tee_local $2
|
||||
(select
|
||||
(i32.sub
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(get_local $8)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $4)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $4)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(tee_local $3
|
||||
(select
|
||||
(i32.const 0)
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(get_local $8)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $5)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $5)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $5)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.and
|
||||
(tee_local $3
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(if
|
||||
(i32.eq
|
||||
(i32.and
|
||||
(get_local $2)
|
||||
(i32.const 14)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.or
|
||||
(i32.shl
|
||||
(tee_local $3
|
||||
(select
|
||||
(tee_local $3
|
||||
(i32.sub
|
||||
(i32.shr_u
|
||||
(tee_local $2
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 24)
|
||||
)
|
||||
(i32.const 10)
|
||||
)
|
||||
)
|
||||
(i32.const 0)
|
||||
(i32.gt_s
|
||||
(get_local $3)
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 24)
|
||||
)
|
||||
(i32.and
|
||||
(get_local $2)
|
||||
(i32.const 16777215)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.const -8053850)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eq
|
||||
(get_local $2)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.const -1666349)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i32.or
|
||||
(i32.shl
|
||||
(tee_local $2
|
||||
(select
|
||||
(tee_local $2
|
||||
(i32.sub
|
||||
(i32.shr_u
|
||||
(get_local $3)
|
||||
(i32.const 24)
|
||||
)
|
||||
(i32.const 10)
|
||||
)
|
||||
)
|
||||
(i32.const 0)
|
||||
(i32.gt_s
|
||||
(get_local $2)
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 24)
|
||||
)
|
||||
(i32.and
|
||||
(get_local $3)
|
||||
(i32.const 16777215)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i32.add
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@ -1 +0,0 @@
|
||||
export { init, step } from "../../examples/game-of-life/assembly/index";
|
@ -1,805 +0,0 @@
|
||||
(module
|
||||
(type $iiv (func (param i32 i32)))
|
||||
(type $F (func (result f64)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
|
||||
(global $../../examples/game-of-life/assembly/index/RGB_ALIVE i32 (i32.const 15110867))
|
||||
(global $../../examples/game-of-life/assembly/index/RGB_DEAD i32 (i32.const 8723366))
|
||||
(global $../../examples/game-of-life/assembly/index/BIT_ROT i32 (i32.const 10))
|
||||
(global $../../examples/game-of-life/assembly/index/w (mut i32) (i32.const 0))
|
||||
(global $../../examples/game-of-life/assembly/index/h (mut i32) (i32.const 0))
|
||||
(global $../../examples/game-of-life/assembly/index/s (mut i32) (i32.const 0))
|
||||
(global $~lib/math/random_seeded (mut i32) (i32.const 0))
|
||||
(global $~lib/math/random_state0 (mut i64) (i64.const 0))
|
||||
(global $~lib/math/random_state1 (mut i64) (i64.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 32))
|
||||
(memory $0 1)
|
||||
(data (i32.const 4) "\0c\00\00\00~\00l\00i\00b\00/\00m\00a\00t\00h\00.\00t\00s\00")
|
||||
(export "init" (func $../../examples/game-of-life/assembly/index/init))
|
||||
(export "step" (func $../../examples/game-of-life/assembly/index/step))
|
||||
(export "memory" (memory $0))
|
||||
(func $~lib/math/NativeMath.random (; 1 ;) (type $F) (result f64)
|
||||
(local $0 i64)
|
||||
(local $1 i64)
|
||||
(local $2 i64)
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_global $~lib/math/random_seeded)
|
||||
)
|
||||
(block
|
||||
(call $abort
|
||||
(i32.const 0)
|
||||
(i32.const 4)
|
||||
(i32.const 1007)
|
||||
(i32.const 24)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(get_global $~lib/math/random_state0)
|
||||
)
|
||||
(set_local $1
|
||||
(get_global $~lib/math/random_state1)
|
||||
)
|
||||
(set_global $~lib/math/random_state0
|
||||
(get_local $1)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.xor
|
||||
(get_local $0)
|
||||
(i64.shl
|
||||
(get_local $0)
|
||||
(i64.const 23)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.xor
|
||||
(get_local $0)
|
||||
(i64.shr_u
|
||||
(get_local $0)
|
||||
(i64.const 17)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.xor
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.xor
|
||||
(get_local $0)
|
||||
(i64.shr_u
|
||||
(get_local $1)
|
||||
(i64.const 26)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_global $~lib/math/random_state1
|
||||
(get_local $0)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.or
|
||||
(i64.and
|
||||
(i64.add
|
||||
(get_local $1)
|
||||
(get_local $0)
|
||||
)
|
||||
(i64.const 4503599627370495)
|
||||
)
|
||||
(i64.const 4607182418800017408)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(f64.sub
|
||||
(f64.reinterpret/i64
|
||||
(get_local $2)
|
||||
)
|
||||
(f64.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $../../examples/game-of-life/assembly/index/init (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(set_global $../../examples/game-of-life/assembly/index/w
|
||||
(get_local $0)
|
||||
)
|
||||
(set_global $../../examples/game-of-life/assembly/index/h
|
||||
(get_local $1)
|
||||
)
|
||||
(set_global $../../examples/game-of-life/assembly/index/s
|
||||
(i32.mul
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(set_local $2
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $2)
|
||||
(get_global $../../examples/game-of-life/assembly/index/h)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(block $break|1
|
||||
(set_local $3
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|1
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $3)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(block $../../examples/game-of-life/assembly/index/set|inlined.0
|
||||
(set_local $4
|
||||
(get_local $3)
|
||||
)
|
||||
(set_local $5
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $6
|
||||
(if (result i32)
|
||||
(f64.gt
|
||||
(call $~lib/math/NativeMath.random)
|
||||
(f64.const 0.1)
|
||||
)
|
||||
(i32.and
|
||||
(i32.const 8723366)
|
||||
(i32.const 16777215)
|
||||
)
|
||||
(i32.or
|
||||
(i32.const 15110867)
|
||||
(i32.const -16777216)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $5)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $4)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(i32.add
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $../../examples/game-of-life/assembly/index/step (; 3 ;) (type $v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 i32)
|
||||
(local $9 i32)
|
||||
(local $10 i32)
|
||||
(local $11 i32)
|
||||
(local $12 i32)
|
||||
(local $13 i32)
|
||||
(local $14 i32)
|
||||
(local $15 i32)
|
||||
(local $16 i32)
|
||||
(block
|
||||
(set_local $0
|
||||
(i32.sub
|
||||
(get_global $../../examples/game-of-life/assembly/index/h)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.sub
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(set_local $2
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $2)
|
||||
(get_global $../../examples/game-of-life/assembly/index/h)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(block
|
||||
(set_local $3
|
||||
(if (result i32)
|
||||
(i32.eq
|
||||
(get_local $2)
|
||||
(i32.const 0)
|
||||
)
|
||||
(get_local $0)
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(if (result i32)
|
||||
(i32.eq
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 0)
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $break|1
|
||||
(set_local $5
|
||||
(i32.const 0)
|
||||
)
|
||||
(loop $continue|1
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $5)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(block
|
||||
(set_local $6
|
||||
(if (result i32)
|
||||
(i32.eq
|
||||
(get_local $5)
|
||||
(i32.const 0)
|
||||
)
|
||||
(get_local $1)
|
||||
(i32.sub
|
||||
(get_local $5)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $7
|
||||
(if (result i32)
|
||||
(i32.eq
|
||||
(get_local $5)
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 0)
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $8
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.add
|
||||
(i32.and
|
||||
(block $../../examples/game-of-life/assembly/index/get|inlined.0 (result i32)
|
||||
(set_local $8
|
||||
(get_local $6)
|
||||
)
|
||||
(set_local $9
|
||||
(get_local $3)
|
||||
)
|
||||
(br $../../examples/game-of-life/assembly/index/get|inlined.0
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $9)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i32.and
|
||||
(block $../../examples/game-of-life/assembly/index/get|inlined.1 (result i32)
|
||||
(set_local $9
|
||||
(get_local $5)
|
||||
)
|
||||
(set_local $8
|
||||
(get_local $3)
|
||||
)
|
||||
(br $../../examples/game-of-life/assembly/index/get|inlined.1
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $8)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $9)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(block $../../examples/game-of-life/assembly/index/get|inlined.2 (result i32)
|
||||
(set_local $8
|
||||
(get_local $7)
|
||||
)
|
||||
(set_local $9
|
||||
(get_local $3)
|
||||
)
|
||||
(br $../../examples/game-of-life/assembly/index/get|inlined.2
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $9)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(block $../../examples/game-of-life/assembly/index/get|inlined.3 (result i32)
|
||||
(set_local $9
|
||||
(get_local $6)
|
||||
)
|
||||
(set_local $8
|
||||
(get_local $2)
|
||||
)
|
||||
(br $../../examples/game-of-life/assembly/index/get|inlined.3
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $8)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $9)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(block $../../examples/game-of-life/assembly/index/get|inlined.4 (result i32)
|
||||
(set_local $8
|
||||
(get_local $7)
|
||||
)
|
||||
(set_local $9
|
||||
(get_local $2)
|
||||
)
|
||||
(br $../../examples/game-of-life/assembly/index/get|inlined.4
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $9)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(block $../../examples/game-of-life/assembly/index/get|inlined.5 (result i32)
|
||||
(set_local $9
|
||||
(get_local $6)
|
||||
)
|
||||
(set_local $8
|
||||
(get_local $4)
|
||||
)
|
||||
(br $../../examples/game-of-life/assembly/index/get|inlined.5
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $8)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $9)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(block $../../examples/game-of-life/assembly/index/get|inlined.6 (result i32)
|
||||
(set_local $8
|
||||
(get_local $5)
|
||||
)
|
||||
(set_local $9
|
||||
(get_local $4)
|
||||
)
|
||||
(br $../../examples/game-of-life/assembly/index/get|inlined.6
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $9)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $8)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(i32.and
|
||||
(block $../../examples/game-of-life/assembly/index/get|inlined.7 (result i32)
|
||||
(set_local $9
|
||||
(get_local $7)
|
||||
)
|
||||
(set_local $8
|
||||
(get_local $4)
|
||||
)
|
||||
(br $../../examples/game-of-life/assembly/index/get|inlined.7
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $8)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $9)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(block $../../examples/game-of-life/assembly/index/get|inlined.8 (result i32)
|
||||
(set_local $9
|
||||
(get_local $5)
|
||||
)
|
||||
(set_local $10
|
||||
(get_local $2)
|
||||
)
|
||||
(br $../../examples/game-of-life/assembly/index/get|inlined.8
|
||||
(i32.load
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.mul
|
||||
(get_local $10)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
(get_local $9)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $10)
|
||||
(i32.const 1)
|
||||
)
|
||||
(if
|
||||
(i32.eq
|
||||
(i32.and
|
||||
(get_local $8)
|
||||
(i32.const 14)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(block $../../examples/game-of-life/assembly/index/rot|inlined.0
|
||||
(set_local $9
|
||||
(get_local $5)
|
||||
)
|
||||
(set_local $11
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $12
|
||||
(get_local $10)
|
||||
)
|
||||
(set_local $13
|
||||
(select
|
||||
(tee_local $13
|
||||
(i32.sub
|
||||
(i32.shr_u
|
||||
(get_local $12)
|
||||
(i32.const 24)
|
||||
)
|
||||
(i32.const 10)
|
||||
)
|
||||
)
|
||||
(tee_local $14
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.gt_s
|
||||
(get_local $13)
|
||||
(get_local $14)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $../../examples/game-of-life/assembly/index/set|inlined.1
|
||||
(set_local $14
|
||||
(get_local $9)
|
||||
)
|
||||
(set_local $15
|
||||
(get_local $11)
|
||||
)
|
||||
(set_local $16
|
||||
(i32.or
|
||||
(i32.shl
|
||||
(get_local $13)
|
||||
(i32.const 24)
|
||||
)
|
||||
(i32.and
|
||||
(get_local $12)
|
||||
(i32.const 16777215)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $15)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $14)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(get_local $16)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $../../examples/game-of-life/assembly/index/set|inlined.2
|
||||
(set_local $13
|
||||
(get_local $5)
|
||||
)
|
||||
(set_local $12
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $11
|
||||
(i32.or
|
||||
(i32.const 8723366)
|
||||
(i32.const -16777216)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $12)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $13)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(get_local $11)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eq
|
||||
(get_local $8)
|
||||
(i32.const 3)
|
||||
)
|
||||
(block $../../examples/game-of-life/assembly/index/set|inlined.3
|
||||
(set_local $11
|
||||
(get_local $5)
|
||||
)
|
||||
(set_local $12
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $13
|
||||
(i32.or
|
||||
(i32.const 15110867)
|
||||
(i32.const -16777216)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $12)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $11)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(get_local $13)
|
||||
)
|
||||
)
|
||||
(block $../../examples/game-of-life/assembly/index/rot|inlined.1
|
||||
(set_local $13
|
||||
(get_local $5)
|
||||
)
|
||||
(set_local $12
|
||||
(get_local $2)
|
||||
)
|
||||
(set_local $11
|
||||
(get_local $10)
|
||||
)
|
||||
(set_local $9
|
||||
(select
|
||||
(tee_local $9
|
||||
(i32.sub
|
||||
(i32.shr_u
|
||||
(get_local $11)
|
||||
(i32.const 24)
|
||||
)
|
||||
(i32.const 10)
|
||||
)
|
||||
)
|
||||
(tee_local $16
|
||||
(i32.const 0)
|
||||
)
|
||||
(i32.gt_s
|
||||
(get_local $9)
|
||||
(get_local $16)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $../../examples/game-of-life/assembly/index/set|inlined.4
|
||||
(set_local $16
|
||||
(get_local $13)
|
||||
)
|
||||
(set_local $15
|
||||
(get_local $12)
|
||||
)
|
||||
(set_local $14
|
||||
(i32.or
|
||||
(i32.shl
|
||||
(get_local $9)
|
||||
(i32.const 24)
|
||||
)
|
||||
(i32.and
|
||||
(get_local $11)
|
||||
(i32.const 16777215)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(i32.shl
|
||||
(i32.add
|
||||
(i32.add
|
||||
(get_global $../../examples/game-of-life/assembly/index/s)
|
||||
(i32.mul
|
||||
(get_local $15)
|
||||
(get_global $../../examples/game-of-life/assembly/index/w)
|
||||
)
|
||||
)
|
||||
(get_local $16)
|
||||
)
|
||||
(i32.const 2)
|
||||
)
|
||||
(get_local $14)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $5
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.add
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user