aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-11-01 20:57:21 -0700
committeralon@honor <none@none>2010-11-01 20:57:21 -0700
commitc07e83131ea1f5138d645f39d0ba724fe370ccc1 (patch)
tree72f1a22cf4d177012efebbdee0fb6e52e69e8bbd /src/preamble.js
parent4a37bdf9e060010d3d4e6b1f6f503a13227f5de8 (diff)
add HEAPs and malloc/free to Module
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 66cb37bb..07ddf7ea 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -133,8 +133,8 @@ var _malloc, _free, __Znwj, __Znaj, __Znam, __Znwm, __ZdlPv, __ZdaPv;
function __initializeRuntime__() {
// If we don't have malloc/free implemented, use a simple implementation.
- _malloc = __Znwj = __Znaj = __Znam = __Znwm = Module['_malloc'] ? Module['_malloc'] : Runtime.staticAlloc;
- _free = __ZdlPv = __ZdaPv = Module['_free'] ? Module['_free'] : function() { };
+ Module['_malloc'] = _malloc = __Znwj = __Znaj = __Znam = __Znwm = Module['_malloc'] ? Module['_malloc'] : Runtime.staticAlloc;
+ Module['_free'] = _free = __ZdlPv = __ZdaPv = Module['_free'] ? Module['_free'] : function() { };
HEAP = intArrayFromString('(null)'); // So printing %s of NULL gives '(null)'
// Also this ensures we leave 0 as an invalid address, 'NULL'
@@ -157,6 +157,10 @@ function __initializeRuntime__() {
IHEAP = HEAP; // We use that name in our runtime code that processes strings etc., see library.js
#endif
+ Module['HEAP'] = HEAP;
+ Module['IHEAP'] = IHEAP;
+ Module['FHEAP'] = FHEAP;
+
STACK_ROOT = STACKTOP = alignMemoryPage(10);
if (!this['TOTAL_STACK']) TOTAL_STACK = 1024*1024; // Reserved room for stack
STACK_MAX = STACK_ROOT + TOTAL_STACK;