Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ if (typeof WebAssembly != 'object') {
#include "runtime_safe_heap.js"
#endif

#if SHARED_MEMORY && ALLOW_MEMORY_GROWTH
#include "growableHeap.js"
#endif

#if USE_ASAN
#include "runtime_asan.js"
#endif
Expand Down
4 changes: 4 additions & 0 deletions src/preamble_minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include "runtime_safe_heap.js"
#endif

#if SHARED_MEMORY && ALLOW_MEMORY_GROWTH
#include "growableHeap.js"
#endif

#if USE_ASAN
#include "runtime_asan.js"
#endif
Expand Down
6 changes: 6 additions & 0 deletions tools/acorn-optimizer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,12 @@ function littleEndianHeap(ast) {
// in each access), see #8365.
function growableHeap(ast) {
recursiveWalk(ast, {
FunctionDeclaration(node, c) {
// Do not recurse into to GROWABLE_HEAP_ helper functions themselves.
if (!(node.id.type === 'Identifier' && node.id.name.startsWith('GROWABLE_HEAP_'))) {
c(node.body);
}
},
AssignmentExpression: (node) => {
if (node.left.type === 'Identifier' && isEmscriptenHEAP(node.left.name)) {
// Don't transform initial setup of the arrays.
Expand Down
7 changes: 1 addition & 6 deletions tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,12 +1055,7 @@ def little_endian_heap(js_file):

def apply_wasm_memory_growth(js_file):
logger.debug('supporting wasm memory growth with pthreads')
fixed = acorn_optimizer(js_file, ['growableHeap'])
ret = js_file + '.pgrow.js'
fixed = utils.read_file(fixed)
support_code = utils.read_file(path_from_root('src/growableHeap.js'))
utils.write_file(ret, support_code + '\n' + fixed)
return ret
return acorn_optimizer(js_file, ['growableHeap'])


def use_unsigned_pointers_in_js(js_file):
Expand Down