diff options
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js index 1b5e8b20..c1eb2219 100644 --- a/src/library.js +++ b/src/library.js @@ -9065,6 +9065,35 @@ LibraryManager.library = { return cache[fullname] = allocate(intArrayFromString(ret + ''), 'i8', ALLOC_NORMAL); }, +#if ASM_JS +#if ALLOW_MEMORY_GROWTH + emscripten_replace_memory__asm: true, // this is used inside the asm module + emscripten_replace_memory__sig: 'viiiiiiii', // bogus + emscripten_replace_memory: function(_HEAP8, _HEAP16, _HEAP32, _HEAPU8, _HEAPU16, _HEAPU32, _HEAPF32, _HEAPF64) { + _HEAP8 = _HEAP8; // fake asm coercions + _HEAP16 = _HEAP16; + _HEAP32 = _HEAP32; + _HEAPU8 = _HEAPU8; + _HEAPU16 = _HEAPU16; + _HEAPU32 = _HEAPU32; + _HEAPF32 = _HEAPF32; + _HEAPF64 = _HEAPF64; + HEAP8 = _HEAP8; // replace the memory views + HEAP16 = _HEAP16; + HEAP32 = _HEAP32; + HEAPU8 = _HEAPU8; + HEAPU16 = _HEAPU16; + HEAPU32 = _HEAPU32; + HEAPF32 = _HEAPF32; + HEAPF64 = _HEAPF64; + }, + // this function is inside the asm block, but prevents validation as asm.js + // the codebase still benefits from being in the general asm.js shape, + // but should not declare itself as validating (which is prevented in ASM_JS == 2). + {{{ (assert(ASM_JS === 2), DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.push('emscripten_replace_memory'), '') }}} +#endif +#endif + //============================ // emscripten vector ops //============================ |