forked from emscripten-core/emscripten
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't force the use of imported memory under WASM2JS
Setting `IMPORTED_MEMORY` can have other implications and don't want t by default just because we chose WASM2JS. There is a slight code size regression that looks like it comes from acorn/closure not being able to cleanup up the unused calls to `new Uint8Array` in the generated content, but I'm not sure its worth pursuing them. See emscripten-core#21071
- Loading branch information
Showing
6 changed files
with
73 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"a.html": 567, | ||
"a.html.gz": 379, | ||
"a.js": 17917, | ||
"a.js.gz": 8089, | ||
"a.js": 17939, | ||
"a.js.gz": 8114, | ||
"a.mem": 3123, | ||
"a.mem.gz": 2693, | ||
"total": 21607, | ||
"total_gz": 11161 | ||
"total": 21629, | ||
"total_gz": 11186 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"a.html": 567, | ||
"a.html.gz": 379, | ||
"a.js": 17395, | ||
"a.js.gz": 7900, | ||
"a.js": 17411, | ||
"a.js.gz": 7945, | ||
"a.mem": 3123, | ||
"a.mem.gz": 2693, | ||
"total": 21085, | ||
"total_gz": 10972 | ||
"total": 21101, | ||
"total_gz": 11017 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,73 @@ | ||
var b = Module, g = new function(a) { | ||
this.buffer = new ArrayBuffer(65536 * a.initial); | ||
}({ | ||
initial: 256, | ||
maximum: 256 | ||
}), k = g.buffer, d = new Uint8Array(k), l = new TextDecoder("utf8"), m; | ||
var c = Module, g, h, k = new TextDecoder("utf8"), l; | ||
|
||
function c(a) { | ||
this.exports = function(h) { | ||
function n(f) { | ||
f.set = function(e, p) { | ||
this[e] = p; | ||
function d(b) { | ||
this.exports = function(f) { | ||
function m(e) { | ||
e.set = function(a, n) { | ||
this[a] = n; | ||
}; | ||
f.get = function(e) { | ||
return this[e]; | ||
e.get = function(a) { | ||
return this[a]; | ||
}; | ||
return f; | ||
return e; | ||
} | ||
return function(f) { | ||
var e = f.a.a; | ||
return function(e) { | ||
var a = new ArrayBuffer(16777216); | ||
new Int8Array(a); | ||
new Int16Array(a); | ||
new Int32Array(a); | ||
new Uint8Array(a); | ||
new Uint16Array(a); | ||
new Uint32Array(a); | ||
new Float32Array(a); | ||
new Float64Array(a); | ||
var n = e.a.a; | ||
e = m([]); | ||
return { | ||
b: function() {}, | ||
c: function(p, q) { | ||
e(1024); | ||
b: Object.create(Object.prototype, { | ||
grow: {}, | ||
buffer: { | ||
get: function() { | ||
return a; | ||
} | ||
} | ||
}), | ||
c: function() {}, | ||
d: function(p, q) { | ||
n(1024); | ||
return 0; | ||
}, | ||
d: n([]) | ||
e: e | ||
}; | ||
}(h); | ||
}(a); | ||
}(f); | ||
}(b); | ||
} | ||
|
||
(function(a, h) { | ||
(function(b, f) { | ||
return { | ||
then: function(n) { | ||
n({ | ||
instance: new c(h) | ||
then: function(m) { | ||
m({ | ||
instance: new d(f) | ||
}); | ||
} | ||
}; | ||
})(b.wasm, { | ||
})(c.wasm, { | ||
a: { | ||
a: a => { | ||
var h = console, n = h.log; | ||
if (a) { | ||
for (var f = a + void 0, e = a; !(e >= f) && d[e]; ) ++e; | ||
a = l.decode(d.subarray(a, e)); | ||
} else a = ""; | ||
n.call(h, a); | ||
}, | ||
memory: g | ||
a: b => { | ||
var f = console, m = f.log; | ||
if (b) { | ||
for (var e = b + void 0, a = b; !(a >= e) && g[a]; ) ++a; | ||
b = k.decode(g.subarray(b, a)); | ||
} else b = ""; | ||
m.call(f, b); | ||
} | ||
} | ||
}).then((a => { | ||
a = a.instance.exports; | ||
m = a.c; | ||
d.set(new Uint8Array(b.mem), 1024); | ||
a.b(); | ||
m(); | ||
}).then((b => { | ||
b = b.instance.exports; | ||
l = b.d; | ||
h = b.b; | ||
g = new Uint8Array(h.buffer); | ||
g.set(new Uint8Array(c.mem), 1024); | ||
b.c(); | ||
l(); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"a.html": 671, | ||
"a.html.gz": 430, | ||
"a.js": 694, | ||
"a.js.gz": 433, | ||
"a.js": 862, | ||
"a.js.gz": 483, | ||
"a.mem": 6, | ||
"a.mem.gz": 32, | ||
"total": 1371, | ||
"total_gz": 895 | ||
"total": 1539, | ||
"total_gz": 945 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"a.html": 17331, | ||
"a.html.gz": 7543, | ||
"total": 17331, | ||
"total_gz": 7543 | ||
"a.html": 17346, | ||
"a.html.gz": 7554, | ||
"total": 17346, | ||
"total_gz": 7554 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters