Skip to content

Commit f7c7347

Browse files
authored
Update Binaryen to latest; Various fixes
1 parent b54a97c commit f7c7347

File tree

228 files changed

+8047
-10671
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+8047
-10671
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bin/* text eol=lf
22
dist/* binary
33
scripts/*.sh eol=lf
4+
lib/binaryen.js binary
33 Bytes
Binary file not shown.

examples/game-of-life/build/optimized.wat

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@
33
(type $F (func (result f64)))
44
(type $v (func))
55
(type $iiFv (func (param i32 i32 f64)))
6+
(import "env" "memory" (memory $0 0))
7+
(table 1 anyfunc)
8+
(elem (i32.const 0) $null)
69
(import "config" "BGR_ALIVE" (global $assembly/config/BGR_ALIVE i32))
710
(import "config" "BGR_DEAD" (global $assembly/config/BGR_DEAD i32))
811
(import "config" "BIT_ROT" (global $assembly/config/BIT_ROT i32))
9-
(import "JSMath" "random" (func $~lib/math/JSMath.random (result f64)))
10-
(import "env" "memory" (memory $0 0))
12+
(import "Math" "random" (func $~lib/bindings/Math/random (result f64)))
1113
(global $assembly/index/w (mut i32) (i32.const 0))
1214
(global $assembly/index/h (mut i32) (i32.const 0))
1315
(global $assembly/index/s (mut i32) (i32.const 0))
1416
(export "memory" (memory $0))
17+
(export "table" (table $0))
1518
(export "init" (func $assembly/index/init))
1619
(export "step" (func $assembly/index/step))
1720
(export "fill" (func $assembly/index/fill))
18-
(func $assembly/index/init (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32)
21+
(func $assembly/index/init (; 1 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32)
1922
(local $2 i32)
2023
;;@ assembly/index.ts:29:2
2124
(set_global $assembly/index/w
@@ -49,7 +52,7 @@
4952
(get_global $assembly/index/h)
5053
)
5154
)
52-
;;@ assembly/index.ts:34:30
55+
;;@ assembly/index.ts:35:4
5356
(block $break|1
5457
;;@ assembly/index.ts:35:9
5558
(set_local $1
@@ -70,7 +73,7 @@
7073
(if (result i32)
7174
(f64.gt
7275
;;@ assembly/index.ts:36:21
73-
(call $~lib/math/JSMath.random)
76+
(call $~lib/bindings/Math/random)
7477
;;@ assembly/index.ts:36:32
7578
(f64.const 0.1)
7679
)
@@ -131,7 +134,7 @@
131134
)
132135
)
133136
)
134-
(func $assembly/index/step (; 2 ;) (type $v)
137+
(func $assembly/index/step (; 2 ;) (; has Stack IR ;) (type $v)
135138
(local $0 i32)
136139
(local $1 i32)
137140
(local $2 i32)
@@ -604,7 +607,7 @@
604607
)
605608
)
606609
)
607-
(func $assembly/index/fill (; 3 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
610+
(func $assembly/index/fill (; 3 ;) (; has Stack IR ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64)
608611
(local $3 i32)
609612
;;@ assembly/index.ts:81:2
610613
(block $break|0
@@ -617,12 +620,12 @@
617620
(get_global $assembly/index/w)
618621
)
619622
)
620-
;;@ assembly/index.ts:81:33
623+
;;@ assembly/index.ts:82:4
621624
(if
622625
;;@ assembly/index.ts:82:8
623626
(f64.lt
624627
;;@ assembly/index.ts:82:13
625-
(call $~lib/math/JSMath.random)
628+
(call $~lib/bindings/Math/random)
626629
(get_local $2)
627630
)
628631
(i32.store
@@ -673,12 +676,12 @@
673676
(get_global $assembly/index/h)
674677
)
675678
)
676-
;;@ assembly/index.ts:84:33
679+
;;@ assembly/index.ts:85:4
677680
(if
678681
;;@ assembly/index.ts:85:8
679682
(f64.lt
680683
;;@ assembly/index.ts:85:13
681-
(call $~lib/math/JSMath.random)
684+
(call $~lib/bindings/Math/random)
682685
(get_local $2)
683686
)
684687
;;@ assembly/index.ts:17:2
@@ -720,4 +723,7 @@
720723
)
721724
)
722725
)
726+
(func $null (; 4 ;) (; has Stack IR ;) (type $v)
727+
(nop)
728+
)
723729
)

examples/game-of-life/build/untouched.wat

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
(type $F (func (result f64)))
44
(type $v (func))
55
(type $iiFv (func (param i32 i32 f64)))
6+
(import "env" "memory" (memory $0 0))
7+
(table 1 anyfunc)
8+
(elem (i32.const 0) $null)
69
(import "config" "BGR_ALIVE" (global $assembly/config/BGR_ALIVE i32))
710
(import "config" "BGR_DEAD" (global $assembly/config/BGR_DEAD i32))
811
(import "config" "BIT_ROT" (global $assembly/config/BIT_ROT i32))
9-
(import "JSMath" "random" (func $~lib/math/JSMath.random (result f64)))
10-
(import "env" "memory" (memory $0 0))
12+
(import "Math" "random" (func $~lib/bindings/Math/random (result f64)))
1113
(global $assembly/index/w (mut i32) (i32.const 0))
1214
(global $assembly/index/h (mut i32) (i32.const 0))
1315
(global $assembly/index/s (mut i32) (i32.const 0))
1416
(global $HEAP_BASE i32 (i32.const 8))
1517
(export "memory" (memory $0))
18+
(export "table" (table $0))
1619
(export "init" (func $assembly/index/init))
1720
(export "step" (func $assembly/index/step))
1821
(export "fill" (func $assembly/index/fill))
@@ -57,7 +60,7 @@
5760
)
5861
)
5962
)
60-
;;@ assembly/index.ts:34:30
63+
;;@ assembly/index.ts:35:4
6164
(block $break|1
6265
;;@ assembly/index.ts:35:9
6366
(set_local $3
@@ -75,14 +78,14 @@
7578
)
7679
)
7780
)
78-
;;@ assembly/index.ts:35:32
81+
;;@ assembly/index.ts:36:6
7982
(block $assembly/index/set|inlined.0
8083
(set_local $4
8184
;;@ assembly/index.ts:36:16
8285
(if (result i32)
8386
(f64.gt
8487
;;@ assembly/index.ts:36:21
85-
(call $~lib/math/JSMath.random)
88+
(call $~lib/bindings/Math/random)
8689
;;@ assembly/index.ts:36:32
8790
(f64.const 0.1)
8891
)
@@ -751,12 +754,12 @@
751754
)
752755
)
753756
)
754-
;;@ assembly/index.ts:81:33
757+
;;@ assembly/index.ts:82:4
755758
(if
756759
;;@ assembly/index.ts:82:8
757760
(f64.lt
758761
;;@ assembly/index.ts:82:13
759-
(call $~lib/math/JSMath.random)
762+
(call $~lib/bindings/Math/random)
760763
;;@ assembly/index.ts:82:24
761764
(get_local $2)
762765
)
@@ -817,12 +820,12 @@
817820
)
818821
)
819822
)
820-
;;@ assembly/index.ts:84:33
823+
;;@ assembly/index.ts:85:4
821824
(if
822825
;;@ assembly/index.ts:85:8
823826
(f64.lt
824827
;;@ assembly/index.ts:85:13
825-
(call $~lib/math/JSMath.random)
828+
(call $~lib/bindings/Math/random)
826829
;;@ assembly/index.ts:85:24
827830
(get_local $2)
828831
)
@@ -874,4 +877,6 @@
874877
)
875878
)
876879
)
880+
(func $null (; 4 ;) (type $v)
881+
)
877882
)

examples/game-of-life/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h1>
7070
BGR_DEAD : rgb2bgr(RGB_DEAD) & ~1, // little endian, LSB must not be set
7171
BIT_ROT
7272
},
73-
JSMath: Math
73+
Math
7474
}))
7575
.then(module => {
7676
var exports = module.instance.exports;

0 commit comments

Comments
 (0)