diff options
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/preamble.js b/src/preamble.js index b197ef02..24277014 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -576,9 +576,12 @@ var STACK_ROOT, STACKTOP, STACK_MAX; var STATICTOP; #if USE_TYPED_ARRAYS function enlargeMemory() { +#if ALLOW_MEMORY_GROWTH == 0 + abort('Cannot enlarge memory arrays. Adjust TOTAL_MEMORY or compile with ALLOW_MEMORY_GROWTH'); +#else // TOTAL_MEMORY is the current size of the actual array, and STATICTOP is the new top. #if ASSERTIONS - Module.printErr('Warning: Enlarging memory arrays, this is not fast, and can also break in high optimization levels where we assume globals are not modified! ' + [STATICTOP, TOTAL_MEMORY]); // XXX perhaps never do elimination optimizations of calls that can lead to resizing, to avoid HEAP[malloc()] = X; where JS semantic will write to the old HEAP if malloc replaces it + Module.printErr('Warning: Enlarging memory arrays, this is not fast, and ALLOW_MEMORY_GROWTH is not fully tested with all optimizations on! ' + [STATICTOP, TOTAL_MEMORY]); // We perform safe elimination instead of elimination in this mode, but if you see this error, try to disable it and other optimizations entirely assert(STATICTOP >= TOTAL_MEMORY); assert(TOTAL_MEMORY > 4); // So the loop below will not be infinite #endif @@ -609,6 +612,7 @@ function enlargeMemory() { HEAPF64 = new Float64Array(buffer); HEAP8.set(oldHEAP8); #endif +#endif } #endif |