diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-06-25 17:49:28 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-03 15:31:03 -0700 |
commit | 20e81c40735a5c98672900d3793f1cc8452b2471 (patch) | |
tree | c7e5c4badba7e3aa6b7d28c4bdd7233a3b7954b3 /src/parseTools.js | |
parent | 8bd809c849bdce4533c0062010e0c88fc1b0d467 (diff) |
begin work on memory relocation
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 6bc0b7ea..2b143697 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -492,7 +492,9 @@ function makeGlobalUse(ident) { UNINDEXABLE_GLOBALS[ident] = 1; return ident; } - return (Runtime.GLOBAL_BASE + index).toString(); + var ret = (Runtime.GLOBAL_BASE + index).toString(); + if (SIDE_MODULE) ret = '(H_BASE+' + ret + ')'; + return ret; } return ident; } @@ -1627,6 +1629,9 @@ function makePointer(slab, pos, allocator, type, ptr, finalMemoryInitialization) // writing out into memory, without a normal allocation. We put all of these into a single big chunk. assert(typeof slab == 'object'); assert(slab.length % QUANTUM_SIZE == 0, slab.length); // must be aligned already + if (SIDE_MODULE && typeof ptr == 'string') { + ptr = parseInt(ptr.substring(ptr.indexOf('+'), ptr.length-1)); // parse into (H_BASE+X) + } var offset = ptr - Runtime.GLOBAL_BASE; for (var i = 0; i < slab.length; i++) { memoryInitialization[offset + i] = slab[i]; |