Skip to content

Commit 065ac0a

Browse files
authored
Use standard export mechanism for memory and table with MINIMAL_RUNTIME. NFC (#25361)
This should have been part of #25298
1 parent 1294dd5 commit 065ac0a

19 files changed

+67
-77
lines changed

src/postamble_minimal.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,6 @@ WebAssembly.instantiate(Module['wasm'], imports).then(/** @suppress {missingProp
240240
#else
241241
assignWasmExports(wasmExports);
242242
#endif
243-
#if '$wasmTable' in addedLibraryItems
244-
wasmTable = wasmExports['__indirect_function_table'];
245-
#if ASSERTIONS
246-
assert(wasmTable);
247-
#endif
248-
#endif
249243

250244
#if AUDIO_WORKLET
251245
// If we are in the audio worklet environment, we can only access the Module object
@@ -266,10 +260,6 @@ WebAssembly.instantiate(Module['wasm'], imports).then(/** @suppress {missingProp
266260
#endif
267261

268262
#if !IMPORTED_MEMORY
269-
wasmMemory = wasmExports['memory'];
270-
#if ASSERTIONS
271-
assert(wasmMemory);
272-
#endif
273263
updateMemoryViews();
274264
#endif
275265
<<< ATPRERUNS >>>

test/codesize/audio_worklet_wasm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ function y() {
235235
C = a.m;
236236
B = a.n;
237237
Y = a.o;
238-
A = A = a.k;
238+
A = a.k;
239239
m.stackSave = Q;
240240
m.stackAlloc = ha;
241241
m.stackRestore = P;

test/codesize/hello_wasm_worker_wasm.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@ d || (f = c.mem || new WebAssembly.Memory({
1919
shared: !0
2020
}), g());
2121

22-
var k = [], m = a => {
22+
var k = [], n = a => {
2323
a = a.data;
2424
let b = a._wsc;
2525
b && l.get(b)(...a.x);
2626
}, p = a => {
2727
k.push(a);
2828
}, q = {}, r = 1, u = (a, b) => {
29-
let n = q[r] = new Worker(c.js, {
29+
let m = q[r] = new Worker(c.js, {
3030
name: "em-ww"
3131
});
32-
n.postMessage({
32+
m.postMessage({
3333
u: r,
3434
j: t,
3535
o: f,
3636
l: a,
3737
m: b
3838
});
39-
n.onmessage = m;
39+
m.onmessage = n;
4040
return r++;
4141
}, v = () => !1, w = (a, b) => {
4242
q[a].postMessage({
@@ -66,8 +66,8 @@ function h() {
6666
t = a.module || c.wasm;
6767
y = b.g;
6868
z = b.i;
69-
l = l = b.h;
70-
d ? (z(e.l, e.m), removeEventListener("message", p), k = k.forEach(m), addEventListener("message", m)) : b.f();
69+
l = b.h;
70+
d ? (z(e.l, e.m), removeEventListener("message", p), k = k.forEach(n), addEventListener("message", n)) : b.f();
7171
d || y();
7272
}));
7373
}

test/codesize/hello_world_wasm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ WebAssembly.instantiate(d.wasm, {
1414
}).then((a => {
1515
a = a.instance.exports;
1616
g = a.d;
17-
h = h = a.b;
17+
h = a.b;
1818
e = new Uint8Array(h.buffer);
1919
a.c();
2020
g();

test/codesize/hello_world_wasm2js.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var d = Module, f, h = new TextDecoder, k, l;
1+
var d = Module, g, h = new TextDecoder, k, l;
22

33
function e(a) {
44
this.exports = function(q) {
@@ -8,8 +8,8 @@ function e(a) {
88
t < x && (r[t++] = v << 6 | c[m.charCodeAt(p + 3)]);
99
return r;
1010
}
11-
for (var n, c = new Uint8Array(123), g = 25; 0 <= g; --g) c[48 + g] = 52 + g, c[65 + g] = g,
12-
c[97 + g] = 26 + g;
11+
for (var n, c = new Uint8Array(123), f = 25; 0 <= f; --f) c[48 + f] = 52 + f, c[65 + f] = f,
12+
c[97 + f] = 26 + f;
1313
c[43] = 62;
1414
c[47] = 63;
1515
return function(r) {
@@ -48,17 +48,17 @@ function e(a) {
4848
a: a => {
4949
var q = console, u = q.log;
5050
if (a) {
51-
for (var n = a, c = f, g = n + void 0; c[n] && !(n >= g); ) ++n;
52-
a = h.decode(f.subarray(a, n));
51+
for (var n = a, c = g, f = n + void 0; c[n] && !(n >= f); ) ++n;
52+
a = h.decode(g.subarray(a, n));
5353
} else a = "";
5454
u.call(q, a);
5555
}
5656
}
5757
}).then((a => {
5858
a = a.instance.exports;
5959
k = a.d;
60-
l = l = a.b;
61-
f = new Uint8Array(l.buffer);
60+
l = a.b;
61+
g = new Uint8Array(l.buffer);
6262
a.c();
6363
k();
6464
}));

test/codesize/test_codesize_minimal_Os_mr.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"a.out.js": 501,
3-
"a.out.js.gz": 299,
2+
"a.out.js": 499,
3+
"a.out.js.gz": 298,
44
"a.out.nodebug.wasm": 62,
55
"a.out.nodebug.wasm.gz": 76,
6-
"total": 563,
7-
"total_gz": 375,
6+
"total": 561,
7+
"total_gz": 374,
88
"sent": [],
99
"imports": [],
1010
"exports": [
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.html": 519,
33
"a.html.gz": 357,
4-
"a.js": 4077,
5-
"a.js.gz": 2137,
4+
"a.js": 4075,
5+
"a.js.gz": 2135,
66
"a.wasm": 1308,
77
"a.wasm.gz": 876,
8-
"total": 5904,
9-
"total_gz": 3370
8+
"total": 5902,
9+
"total_gz": 3368
1010
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.html": 552,
33
"a.html.gz": 373,
4-
"a.js": 7263,
5-
"a.js.gz": 3318,
4+
"a.js": 7255,
5+
"a.js.gz": 3314,
66
"a.wasm": 7315,
77
"a.wasm.gz": 3368,
8-
"total": 15130,
9-
"total_gz": 7059
8+
"total": 15122,
9+
"total_gz": 7055
1010
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.html": 552,
33
"a.html.gz": 373,
4-
"a.js": 5352,
5-
"a.js.gz": 2527,
4+
"a.js": 5350,
5+
"a.js.gz": 2524,
66
"a.wasm": 5852,
77
"a.wasm.gz": 2743,
8-
"total": 11756,
9-
"total_gz": 5643
8+
"total": 11754,
9+
"total_gz": 5640
1010
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.html": 519,
33
"a.html.gz": 357,
4-
"a.js": 857,
5-
"a.js.gz": 545,
4+
"a.js": 855,
5+
"a.js.gz": 543,
66
"a.wasm": 1841,
77
"a.wasm.gz": 1067,
8-
"total": 3217,
9-
"total_gz": 1969
8+
"total": 3215,
9+
"total_gz": 1967
1010
}

0 commit comments

Comments
 (0)