Skip to content

Commit 6ffe193

Browse files
authored
Allow __indirect_function_table to be DCE'd (#24103)
Prior this this change `__indirect_function_table` would be seen as an unexpected user export and therefore added to `user_requested_exports` which in turn would mean it would be marked as metaDCE root.
1 parent 8dc91db commit 6ffe193

File tree

62 files changed

+98
-135
lines changed

Some content is hidden

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

62 files changed

+98
-135
lines changed

test/code_size/embind_val_wasm.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"a.html": 552,
33
"a.html.gz": 380,
44
"a.js": 6940,
5-
"a.js.gz": 3000,
6-
"a.wasm": 9137,
7-
"a.wasm.gz": 4712,
8-
"total": 16629,
9-
"total_gz": 8092
5+
"a.js.gz": 2999,
6+
"a.wasm": 9133,
7+
"a.wasm.gz": 4710,
8+
"total": 16625,
9+
"total_gz": 8089
1010
}

test/code_size/hello_world_wasm.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 380,
44
"a.js": 283,
55
"a.js.gz": 244,
6-
"a.wasm": 106,
7-
"a.wasm.gz": 113,
8-
"total": 941,
9-
"total_gz": 737
6+
"a.wasm": 95,
7+
"a.wasm.gz": 108,
8+
"total": 930,
9+
"total_gz": 732
1010
}

test/code_size/hello_world_wasm2js.js

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,64 @@
11
var d = Module, g, h, k = new TextDecoder, l;
22

3-
function e(b) {
4-
this.exports = function(r) {
5-
function u(c) {
6-
c.set = function(a, f) {
7-
this[a] = f;
8-
};
9-
c.get = function(a) {
10-
return this[a];
11-
};
12-
return c;
13-
}
14-
function x(c, a, f) {
15-
for (var v, p = 0, t = a, w = f.length, y = a + (3 * w >> 2) - ("=" == f[w - 2]) - ("=" == f[w - 1]); p < w; p += 4) a = m[f.charCodeAt(p + 1)],
16-
v = m[f.charCodeAt(p + 2)], c[t++] = m[f.charCodeAt(p)] << 2 | a >> 4, t < y && (c[t++] = a << 4 | v >> 2),
17-
t < y && (c[t++] = v << 6 | m[f.charCodeAt(p + 3)]);
18-
return c;
3+
function e(a) {
4+
this.exports = function(p) {
5+
function t(q, b, f) {
6+
for (var u, n = 0, r = b, v = f.length, x = b + (3 * v >> 2) - ("=" == f[v - 2]) - ("=" == f[v - 1]); n < v; n += 4) b = c[f.charCodeAt(n + 1)],
7+
u = c[f.charCodeAt(n + 2)], q[r++] = c[f.charCodeAt(n)] << 2 | b >> 4, r < x && (q[r++] = b << 4 | u >> 2),
8+
r < x && (q[r++] = u << 6 | c[f.charCodeAt(n + 3)]);
9+
return q;
1910
}
20-
for (var q, m = new Uint8Array(123), n = 25; 0 <= n; --n) m[48 + n] = 52 + n, m[65 + n] = n,
21-
m[97 + n] = 26 + n;
22-
m[43] = 62;
23-
m[47] = 63;
24-
return function(c) {
25-
var a = new ArrayBuffer(16908288), f = new Uint8Array(a), v = c.a.a;
26-
q = f;
27-
x(q, 1024, "aGVsbG8h");
28-
c = u([]);
11+
for (var w, c = new Uint8Array(123), m = 25; 0 <= m; --m) c[48 + m] = 52 + m, c[65 + m] = m,
12+
c[97 + m] = 26 + m;
13+
c[43] = 62;
14+
c[47] = 63;
15+
return function(q) {
16+
var b = new ArrayBuffer(16908288), f = new Uint8Array(b), u = q.a.a;
17+
w = f;
18+
t(w, 1024, "aGVsbG8h");
2919
return {
3020
b: Object.create(Object.prototype, {
3121
grow: {},
3222
buffer: {
3323
get: function() {
34-
return a;
24+
return b;
3525
}
3626
}
3727
}),
3828
c: function() {},
39-
d: function(p, t) {
40-
v(1024);
29+
d: function(n, r) {
30+
u(1024);
4131
return 0;
42-
},
43-
e: c
32+
}
4433
};
45-
}(r);
46-
}(b);
34+
}(p);
35+
}(a);
4736
}
4837

49-
(function(b, r) {
38+
(function(a, p) {
5039
return {
51-
then: function(u) {
52-
u({
53-
instance: new e(r)
40+
then: function(t) {
41+
t({
42+
instance: new e(p)
5443
});
5544
}
5645
};
5746
})(d.wasm, {
5847
a: {
59-
a: b => {
60-
var r = console, u = r.log;
61-
if (b) {
62-
for (var x = b + void 0, q = b; !(q >= x) && g[q]; ) ++q;
63-
b = k.decode(g.subarray(b, q));
64-
} else b = "";
65-
u.call(r, b);
48+
a: a => {
49+
var p = console, t = p.log;
50+
if (a) {
51+
for (var w = a + void 0, c = a; !(c >= w) && g[c]; ) ++c;
52+
a = k.decode(g.subarray(a, c));
53+
} else a = "";
54+
t.call(p, a);
6655
}
6756
}
68-
}).then((b => {
69-
b = b.instance.exports;
70-
l = b.d;
71-
h = b.b;
57+
}).then((a => {
58+
a = a.instance.exports;
59+
l = a.d;
60+
h = a.b;
7261
g = new Uint8Array(h.buffer);
73-
b.c();
62+
a.c();
7463
l();
7564
}));
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"a.html": 323,
33
"a.html.gz": 253,
4-
"a.js": 1061,
5-
"a.js.gz": 629,
6-
"total": 1384,
7-
"total_gz": 882
4+
"a.js": 961,
5+
"a.js.gz": 591,
6+
"total": 1284,
7+
"total_gz": 844
88
}

test/code_size/math_wasm.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 380,
44
"a.js": 110,
55
"a.js.gz": 125,
6-
"a.wasm": 2698,
7-
"a.wasm.gz": 1666,
8-
"total": 3360,
9-
"total_gz": 2171
6+
"a.wasm": 2687,
7+
"a.wasm.gz": 1658,
8+
"total": 3349,
9+
"total_gz": 2163
1010
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"a.html": 12494,
3-
"a.html.gz": 6820,
4-
"total": 12494,
5-
"total_gz": 6820
2+
"a.html": 12490,
3+
"a.html.gz": 6832,
4+
"total": 12490,
5+
"total_gz": 6832
66
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"a.html": 17262,
3-
"a.html.gz": 7542,
4-
"total": 17262,
5-
"total_gz": 7542
2+
"a.html": 17170,
3+
"a.html.gz": 7510,
4+
"total": 17170,
5+
"total_gz": 7510
66
}

test/other/codesize/test_codesize_cxx_lto.exports

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ m (memory)
22
n (__wasm_call_ctors)
33
o (main)
44
p (_emscripten_timeout)
5-
q (__indirect_function_table)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
121942
1+
121938
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
e (memory)
22
f (__wasm_call_ctors)
33
g (main)
4-
h (__indirect_function_table)

0 commit comments

Comments
 (0)