diff options
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js index 710b7c52..f9fccdf6 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -642,6 +642,10 @@ Module['stringToUTF32'] = stringToUTF32; function demangle(func) { try { + // Special-case the entry point, since its name differs from other name mangling. + if (func == 'Object._main' || func == '_main') { + return 'main()'; + } if (typeof func === 'number') func = Pointer_stringify(func); if (func[0] !== '_') return func; if (func[1] !== '_') return func; // C function @@ -862,6 +866,21 @@ var TOTAL_STACK = Module['TOTAL_STACK'] || {{{ TOTAL_STACK }}}; var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || {{{ TOTAL_MEMORY }}}; var FAST_MEMORY = Module['FAST_MEMORY'] || {{{ FAST_MEMORY }}}; +#if ASM_JS +var totalMemory = 4096; +while (totalMemory < TOTAL_MEMORY || totalMemory < 2*TOTAL_STACK) { + if (totalMemory < 16*1024*1024) { + totalMemory *= 2; + } else { + totalMemory += 16*1024*1024 + } +} +if (totalMemory !== TOTAL_MEMORY) { + Module.printErr('increasing TOTAL_MEMORY to ' + totalMemory + ' to be more reasonable'); + TOTAL_MEMORY = totalMemory; +} +#endif + // Initialize the runtime's memory #if USE_TYPED_ARRAYS // check for full engine support (use string 'subarray' to avoid closure compiler confusion) |