Skip to content

Commit a1b75b6

Browse files
committed
Rename memory instructions; Rework constant handling
1 parent 34e8fac commit a1b75b6

File tree

170 files changed

+26355
-5148
lines changed

Some content is hidden

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

170 files changed

+26355
-5148
lines changed

examples/i64-polyfill/build/optimized.wat

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(type $iiiiv (func (param i32 i32 i32 i32)))
55
(global $assembly/i64/lo (mut i32) (i32.const 0))
66
(global $assembly/i64/hi (mut i32) (i32.const 0))
7-
(memory $0 1)
7+
(memory $0 0)
88
(export "getLo" (func $assembly/i64/getLo))
99
(export "getHi" (func $assembly/i64/getHi))
1010
(export "clz" (func $assembly/i64/clz))

examples/i64-polyfill/build/untouched.wat

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
(global $NaN f64 (f64.const nan:0x8000000000000))
88
(global $Infinity f64 (f64.const inf))
99
(global $HEAP_BASE i32 (i32.const 8))
10-
(memory $0 1)
10+
(memory $0 0)
1111
(export "getLo" (func $assembly/i64/getLo))
1212
(export "getHi" (func $assembly/i64/getHi))
1313
(export "clz" (func $assembly/i64/clz))

examples/mandelbrot/build/untouched.wat

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
(export "computeLine" (func $assembly/index/computeLine))
1313
(export "memory" (memory $0))
1414
(func $isFinite<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32)
15-
;;@ ~lib/builtins.ts:22:26
15+
;;@ ~lib/builtins.ts:26:26
1616
(f64.eq
17-
;;@ ~lib/builtins.ts:22:9
17+
;;@ ~lib/builtins.ts:26:9
1818
(f64.sub
1919
(get_local $0)
20-
;;@ ~lib/builtins.ts:22:17
20+
;;@ ~lib/builtins.ts:26:17
2121
(get_local $0)
2222
)
23-
;;@ ~lib/builtins.ts:22:26
23+
;;@ ~lib/builtins.ts:26:26
2424
(f64.const 0)
2525
)
2626
)

examples/n-body/build/index.asm.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function asmFunc(global, env, buffer) {
2626
var assembly_index_system = 0;
2727
var HEAP_BASE = 40;
2828
var i64toi32_i32$HIGH_BITS = 0;
29-
function $lib_allocator_arena_allocate_memory($0) {
29+
function $lib_allocator_arena___memory_allocate($0) {
3030
$0 = $0 | 0;
3131
var $1 = 0, $2 = 0, $3 = 0, wasm2asm_i32$0 = 0, wasm2asm_i32$1 = 0, wasm2asm_i32$2 = 0;
3232
if ($0) {
@@ -55,7 +55,7 @@ function asmFunc(global, env, buffer) {
5555
$7 = +$7;
5656
var wasm2asm_i32$0 = 0, wasm2asm_f64$0 = 0.0;
5757
if (($0 | 0) == (0 | 0)) {
58-
$0 = $lib_allocator_arena_allocate_memory(56 | 0) | 0;
58+
$0 = $lib_allocator_arena___memory_allocate(56 | 0) | 0;
5959
wasm2asm_i32$0 = $0;
6060
wasm2asm_f64$0 = $1;
6161
HEAPF64[wasm2asm_i32$0 >> 3] = wasm2asm_f64$0;
@@ -81,7 +81,7 @@ function asmFunc(global, env, buffer) {
8181
return $0 | 0;
8282
}
8383

84-
function $lib_memory_set_memory($0, $1, $2) {
84+
function $lib_memory_memory_fill($0, $1, $2) {
8585
$0 = $0 | 0;
8686
$1 = $1 | 0;
8787
$2 = $2 | 0;
@@ -253,12 +253,12 @@ function asmFunc(global, env, buffer) {
253253
abort();
254254
}
255255
$2 = $1 << 2 | 0;
256-
$3 = $lib_allocator_arena_allocate_memory(1 << (32 - Math_clz32($2 + 7 | 0) | 0) | 0 | 0) | 0;
256+
$3 = $lib_allocator_arena___memory_allocate(1 << (32 - Math_clz32($2 + 7 | 0) | 0) | 0 | 0) | 0;
257257
wasm2asm_i32$0 = $3;
258258
wasm2asm_i32$1 = $2;
259259
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
260260
if (($0 | 0) == (0 | 0)) {
261-
$0 = $lib_allocator_arena_allocate_memory(8 | 0) | 0;
261+
$0 = $lib_allocator_arena___memory_allocate(8 | 0) | 0;
262262
wasm2asm_i32$0 = $0;
263263
wasm2asm_i32$1 = 0;
264264
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;
@@ -272,7 +272,7 @@ function asmFunc(global, env, buffer) {
272272
wasm2asm_i32$0 = $0;
273273
wasm2asm_i32$1 = $1;
274274
HEAP32[(wasm2asm_i32$0 + 4 | 0) >> 2] = wasm2asm_i32$1;
275-
$lib_memory_set_memory($3 + 8 | 0 | 0, 0 | 0, $2 | 0);
275+
$lib_memory_memory_fill($3 + 8 | 0 | 0, 0 | 0, $2 | 0);
276276
return $0 | 0;
277277
}
278278

@@ -307,7 +307,7 @@ function asmFunc(global, env, buffer) {
307307
wasm2asm_f64$0 = -$7 / 39.47841760435743;
308308
HEAPF64[(wasm2asm_i32$0 + 40 | 0) >> 3] = wasm2asm_f64$0;
309309
if (($0 | 0) == (0 | 0)) {
310-
$2 = $lib_allocator_arena_allocate_memory(4 | 0) | 0;
310+
$2 = $lib_allocator_arena___memory_allocate(4 | 0) | 0;
311311
wasm2asm_i32$0 = $2;
312312
wasm2asm_i32$1 = $1;
313313
HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1;

examples/n-body/build/optimized.wat

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
(export "bench" (func $assembly/index/bench))
2323
(export "memory" (memory $0))
2424
(start $start)
25-
(func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32)
25+
(func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32)
2626
(local $1 i32)
2727
(local $2 i32)
2828
(local $3 i32)
@@ -116,7 +116,7 @@
116116
(block
117117
(f64.store
118118
(tee_local $0
119-
(call $~lib/allocator/arena/allocate_memory
119+
(call $~lib/allocator/arena/__memory_allocate
120120
(i32.const 56)
121121
)
122122
)
@@ -150,7 +150,7 @@
150150
)
151151
(get_local $0)
152152
)
153-
(func $~lib/memory/set_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
153+
(func $~lib/memory/memory.fill (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
154154
(local $3 i32)
155155
(local $4 i64)
156156
(if
@@ -500,7 +500,7 @@
500500
)
501501
(i32.store
502502
(tee_local $3
503-
(call $~lib/allocator/arena/allocate_memory
503+
(call $~lib/allocator/arena/__memory_allocate
504504
(i32.shl
505505
(i32.const 1)
506506
(i32.sub
@@ -529,7 +529,7 @@
529529
(block
530530
(i32.store
531531
(tee_local $0
532-
(call $~lib/allocator/arena/allocate_memory
532+
(call $~lib/allocator/arena/__memory_allocate
533533
(i32.const 8)
534534
)
535535
)
@@ -549,7 +549,7 @@
549549
(get_local $0)
550550
(get_local $1)
551551
)
552-
(call $~lib/memory/set_memory
552+
(call $~lib/memory/memory.fill
553553
(i32.add
554554
(get_local $3)
555555
(i32.const 8)
@@ -693,7 +693,7 @@
693693
(block
694694
(i32.store
695695
(tee_local $2
696-
(call $~lib/allocator/arena/allocate_memory
696+
(call $~lib/allocator/arena/__memory_allocate
697697
(i32.const 4)
698698
)
699699
)

0 commit comments

Comments
 (0)