Skip to content

Commit 87ec6c5

Browse files
committed
Update examples
1 parent be5073a commit 87ec6c5

File tree

2 files changed

+45
-40
lines changed

2 files changed

+45
-40
lines changed

examples/n-body/build/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,8 @@ function bench(steps) {
137137
system.advance(0.01);
138138
}
139139
exports.bench = bench;
140+
function getBody(index) {
141+
var bodies = system.bodies;
142+
return index < bodies.length ? bodies[index] : null;
143+
}
144+
exports.getBody = getBody;

examples/n-body/build/untouched.wat

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,43 +1026,43 @@
10261026
(local $3 i32)
10271027
(local $4 i32)
10281028
(local $5 i32)
1029-
;;@ ~lib/array.ts:23:4
1029+
;;@ ~lib/array.ts:37:4
10301030
(if
1031-
;;@ ~lib/array.ts:23:8
1031+
;;@ ~lib/array.ts:37:8
10321032
(i32.gt_u
10331033
(get_local $1)
1034-
;;@ ~lib/array.ts:23:22
1034+
;;@ ~lib/array.ts:37:22
10351035
(i32.const 268435454)
10361036
)
1037-
;;@ ~lib/array.ts:23:39
1037+
;;@ ~lib/array.ts:37:39
10381038
(block
10391039
(call $~lib/env/abort
10401040
(i32.const 0)
10411041
(i32.const 8)
1042-
(i32.const 23)
1042+
(i32.const 37)
10431043
(i32.const 39)
10441044
)
10451045
(unreachable)
10461046
)
10471047
)
1048-
;;@ ~lib/array.ts:24:4
1048+
;;@ ~lib/array.ts:38:4
10491049
(set_local $2
1050-
;;@ ~lib/array.ts:24:21
1050+
;;@ ~lib/array.ts:38:21
10511051
(i32.shl
10521052
(get_local $1)
1053-
;;@ ~lib/array.ts:24:31
1053+
;;@ ~lib/array.ts:38:31
10541054
(i32.const 2)
10551055
)
10561056
)
1057-
;;@ ~lib/array.ts:25:4
1057+
;;@ ~lib/array.ts:39:4
10581058
(set_local $3
1059-
;;@ ~lib/array.ts:25:17
1059+
;;@ ~lib/array.ts:39:17
10601060
(call $~lib/internal/arraybuffer/allocateUnsafe
1061-
;;@ ~lib/array.ts:25:32
1061+
;;@ ~lib/array.ts:39:32
10621062
(get_local $2)
10631063
)
10641064
)
1065-
;;@ ~lib/array.ts:26:4
1065+
;;@ ~lib/array.ts:40:4
10661066
(i32.store
10671067
(tee_local $0
10681068
(if (result i32)
@@ -1088,27 +1088,27 @@
10881088
)
10891089
)
10901090
)
1091-
;;@ ~lib/array.ts:26:19
1091+
;;@ ~lib/array.ts:40:19
10921092
(get_local $3)
10931093
)
1094-
;;@ ~lib/array.ts:27:4
1094+
;;@ ~lib/array.ts:41:4
10951095
(i32.store offset=4
10961096
(get_local $0)
1097-
;;@ ~lib/array.ts:27:19
1097+
;;@ ~lib/array.ts:41:19
10981098
(get_local $1)
10991099
)
1100-
;;@ ~lib/array.ts:28:11
1100+
;;@ ~lib/array.ts:42:11
11011101
(block $~lib/memory/memory.fill|inlined.0
11021102
(set_local $4
1103-
;;@ ~lib/array.ts:29:6
1103+
;;@ ~lib/array.ts:43:6
11041104
(i32.add
11051105
(get_local $3)
1106-
;;@ ~lib/array.ts:29:34
1106+
;;@ ~lib/array.ts:43:34
11071107
(get_global $~lib/internal/arraybuffer/HEADER_SIZE)
11081108
)
11091109
)
11101110
(set_local $5
1111-
;;@ ~lib/array.ts:30:6
1111+
;;@ ~lib/array.ts:44:6
11121112
(i32.const 0)
11131113
)
11141114
;;@ ~lib/memory.ts:15:4
@@ -1125,10 +1125,10 @@
11251125
)
11261126
(func $~lib/array/Array<Body>#__unchecked_set (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
11271127
(local $3 i32)
1128-
;;@ ~lib/array.ts:98:4
1128+
;;@ ~lib/array.ts:112:4
11291129
(block $~lib/internal/arraybuffer/storeUnsafe<Body,Body>|inlined.0
11301130
(set_local $3
1131-
;;@ ~lib/array.ts:98:21
1131+
;;@ ~lib/array.ts:112:21
11321132
(i32.load
11331133
(get_local $0)
11341134
)
@@ -1153,10 +1153,10 @@
11531153
)
11541154
(func $~lib/array/Array<Body>#__unchecked_get (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
11551155
(local $2 i32)
1156-
;;@ ~lib/array.ts:78:46
1156+
;;@ ~lib/array.ts:92:46
11571157
(block $~lib/internal/arraybuffer/loadUnsafe<Body,Body>|inlined.0 (result i32)
11581158
(set_local $2
1159-
;;@ ~lib/array.ts:78:27
1159+
;;@ ~lib/array.ts:92:27
11601160
(i32.load
11611161
(get_local $0)
11621162
)
@@ -1179,29 +1179,29 @@
11791179
)
11801180
(func $~lib/array/Array<Body>#__get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
11811181
(local $2 i32)
1182-
;;@ ~lib/array.ts:70:4
1182+
;;@ ~lib/array.ts:84:4
11831183
(set_local $2
1184-
;;@ ~lib/array.ts:70:17
1184+
;;@ ~lib/array.ts:84:17
11851185
(i32.load
11861186
(get_local $0)
11871187
)
11881188
)
1189-
;;@ ~lib/array.ts:73:23
1189+
;;@ ~lib/array.ts:87:23
11901190
(if (result i32)
1191-
;;@ ~lib/array.ts:71:11
1191+
;;@ ~lib/array.ts:85:11
11921192
(i32.lt_u
11931193
(get_local $1)
1194-
;;@ ~lib/array.ts:71:24
1194+
;;@ ~lib/array.ts:85:24
11951195
(i32.shr_u
1196-
;;@ ~lib/array.ts:71:30
1196+
;;@ ~lib/array.ts:85:30
11971197
(i32.load
11981198
(get_local $2)
11991199
)
1200-
;;@ ~lib/array.ts:71:52
1200+
;;@ ~lib/array.ts:85:52
12011201
(i32.const 2)
12021202
)
12031203
)
1204-
;;@ ~lib/array.ts:72:8
1204+
;;@ ~lib/array.ts:86:8
12051205
(block $~lib/internal/arraybuffer/loadUnsafe<Body,Body>|inlined.1 (result i32)
12061206
;;@ ~lib/internal/arraybuffer.ts:68:91
12071207
(i32.load offset=8
@@ -1218,7 +1218,7 @@
12181218
)
12191219
)
12201220
)
1221-
;;@ ~lib/array.ts:73:8
1221+
;;@ ~lib/array.ts:87:8
12221222
(unreachable)
12231223
)
12241224
)
@@ -1292,9 +1292,9 @@
12921292
(set_local $5
12931293
;;@ assembly/index.ts:91:15
12941294
(block $~lib/array/Array<Body>#get:length|inlined.0 (result i32)
1295-
;;@ ~lib/array.ts:37:16
1295+
;;@ ~lib/array.ts:51:16
12961296
(i32.load offset=4
1297-
;;@ ~lib/array.ts:37:11
1297+
;;@ ~lib/array.ts:51:11
12981298
(get_local $1)
12991299
)
13001300
)
@@ -1511,9 +1511,9 @@
15111511
(set_local $3
15121512
;;@ assembly/index.ts:104:20
15131513
(block $~lib/array/Array<Body>#get:length|inlined.1 (result i32)
1514-
;;@ ~lib/array.ts:37:16
1514+
;;@ ~lib/array.ts:51:16
15151515
(i32.load offset=4
1516-
;;@ ~lib/array.ts:37:11
1516+
;;@ ~lib/array.ts:51:11
15171517
(get_local $2)
15181518
)
15191519
)
@@ -1945,9 +1945,9 @@
19451945
(set_local $4
19461946
;;@ assembly/index.ts:158:37
19471947
(block $~lib/array/Array<Body>#get:length|inlined.2 (result i32)
1948-
;;@ ~lib/array.ts:37:16
1948+
;;@ ~lib/array.ts:51:16
19491949
(i32.load offset=4
1950-
;;@ ~lib/array.ts:37:11
1950+
;;@ ~lib/array.ts:51:11
19511951
(get_local $2)
19521952
)
19531953
)
@@ -2278,9 +2278,9 @@
22782278
(get_local $0)
22792279
;;@ assembly/index.ts:209:22
22802280
(block $~lib/array/Array<Body>#get:length|inlined.4 (result i32)
2281-
;;@ ~lib/array.ts:37:16
2281+
;;@ ~lib/array.ts:51:16
22822282
(i32.load offset=4
2283-
;;@ ~lib/array.ts:37:11
2283+
;;@ ~lib/array.ts:51:11
22842284
(get_local $1)
22852285
)
22862286
)

0 commit comments

Comments
 (0)