aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-26 14:45:51 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-03 14:41:29 -0700
commitd0249dba76d07138e17ff1cf72d8b91b5a0c8da6 (patch)
treefaff536ec2fa53e58285e3cd96a1eda6a8a9cfc1
parent3b07ce3ad9e9975b8c09b98d53c3df53363a9134 (diff)
emit side module memory initializer in the right place; test_dlfcn_basic works in asm
-rw-r--r--src/jsifier.js4
-rw-r--r--tools/shared.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 7e58d61d..3a87df45 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1664,7 +1664,7 @@ function JSify(data, functionsOnly, givenFunctions) {
print('STATIC_BASE = ' + Runtime.GLOBAL_BASE + ';\n');
print('STATICTOP = STATIC_BASE + ' + Runtime.alignMemory(Variables.nextIndexedOffset) + ';\n');
} else {
- print('var H_BASE = parentModule["_malloc"](' + Runtime.alignMemory(Variables.nextIndexedOffset) + ');\n');
+ print('var H_BASE = parentModule["_malloc"](' + Runtime.alignMemory(Variables.nextIndexedOffset) + ' + Runtime.GLOBAL_BASE);\n');
print('// STATICTOP = STATIC_BASE + ' + Runtime.alignMemory(Variables.nextIndexedOffset) + ';\n'); // comment as metadata only
}
}
@@ -1693,7 +1693,7 @@ function JSify(data, functionsOnly, givenFunctions) {
return true;
});
// write out the singleton big memory initialization value
- print('/* memory initializer */ ' + makePointer(memoryInitialization, null, 'ALLOC_NONE', 'i8', 'Runtime.GLOBAL_BASE', true));
+ print('/* memory initializer */ ' + makePointer(memoryInitialization, null, 'ALLOC_NONE', 'i8', 'Runtime.GLOBAL_BASE' + (SIDE_MODULE ? '+H_BASE' : ''), true));
} else {
print('/* no memory initializer */'); // test purposes
}
diff --git a/tools/shared.py b/tools/shared.py
index 09526490..786d8d71 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1429,7 +1429,7 @@ JCache = cache.JCache(Cache)
chunkify = cache.chunkify
class JS:
- memory_initializer_pattern = '/\* memory initializer \*/ allocate\(([\d,\.concat\(\)\[\]\\n ]+)"i8", ALLOC_NONE, ([\dRuntime\.GLOBAL_BASE+]+)\)'
+ memory_initializer_pattern = '/\* memory initializer \*/ allocate\(([\d,\.concat\(\)\[\]\\n ]+)"i8", ALLOC_NONE, ([\dRuntime\.GLOBAL_BASEH+]+)\)'
no_memory_initializer_pattern = '/\* no memory initializer \*/'
memory_staticbump_pattern = 'STATICTOP = STATIC_BASE \+ (\d+);'