Skip to content

Commit 10ea126

Browse files
committed
Include growableHeap.js via the normal include mechanism. NFC
Split out from emscripten-core#23261
1 parent d853b15 commit 10ea126

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

Diff for: src/preamble.js

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ if (typeof WebAssembly != 'object') {
4848
#include "runtime_safe_heap.js"
4949
#endif
5050

51+
#if SHARED_MEMORY && ALLOW_MEMORY_GROWTH
52+
#include "growableHeap.js"
53+
#endif
54+
5155
#if USE_ASAN
5256
#include "runtime_asan.js"
5357
#endif

Diff for: src/preamble_minimal.js

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#include "runtime_safe_heap.js"
99
#endif
1010

11+
#if SHARED_MEMORY && ALLOW_MEMORY_GROWTH
12+
#include "growableHeap.js"
13+
#endif
14+
1115
#if USE_ASAN
1216
#include "runtime_asan.js"
1317
#endif

Diff for: tools/acorn-optimizer.mjs

+6
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,12 @@ function littleEndianHeap(ast) {
12511251
// in each access), see #8365.
12521252
function growableHeap(ast) {
12531253
recursiveWalk(ast, {
1254+
FunctionDeclaration(node, c) {
1255+
// Do not recurse into to GROWABLE_HEAP_ helper functions themselves.
1256+
if (!(node.id.type === 'Identifier' && node.id.name.startsWith('GROWABLE_HEAP_'))) {
1257+
c(node.body);
1258+
}
1259+
},
12541260
AssignmentExpression: (node) => {
12551261
if (node.left.type === 'Identifier' && isEmscriptenHEAP(node.left.name)) {
12561262
// Don't transform initial setup of the arrays.

Diff for: tools/building.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1055,12 +1055,7 @@ def little_endian_heap(js_file):
10551055

10561056
def apply_wasm_memory_growth(js_file):
10571057
logger.debug('supporting wasm memory growth with pthreads')
1058-
fixed = acorn_optimizer(js_file, ['growableHeap'])
1059-
ret = js_file + '.pgrow.js'
1060-
fixed = utils.read_file(fixed)
1061-
support_code = utils.read_file(path_from_root('src/growableHeap.js'))
1062-
utils.write_file(ret, support_code + '\n' + fixed)
1063-
return ret
1058+
return acorn_optimizer(js_file, ['growableHeap'])
10641059

10651060

10661061
def use_unsigned_pointers_in_js(js_file):

0 commit comments

Comments
 (0)