aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemcc2
-rw-r--r--emlink.py1
-rw-r--r--tools/shared.py2
3 files changed, 4 insertions, 1 deletions
diff --git a/emcc b/emcc
index 600a99fd..304316fc 100755
--- a/emcc
+++ b/emcc
@@ -1622,7 +1622,7 @@ try:
if os.path.abspath(memfile) != os.path.abspath(memfile):
shutil.copyfile(memfile, temp_memfile)
return 'loadMemoryInitializer("%s");' % os.path.basename(memfile)
- src = re.sub('/\* memory initializer \*/ allocate\(([\d,\.concat\(\)\[\]\\n ]+)"i8", ALLOC_NONE, Runtime\.GLOBAL_BASE\)', repl, src, count=1)
+ src = re.sub(shared.JS.memory_initializer_pattern, repl, src, count=1)
open(final + '.mem.js', 'w').write(src)
final += '.mem.js'
js_transform_tempfiles[-1] = final # simple text substitution preserves comment line number mappings
diff --git a/emlink.py b/emlink.py
index 8e7cbb9c..cb1bcc25 100644
--- a/emlink.py
+++ b/emlink.py
@@ -56,6 +56,7 @@ class AsmModule():
# heap initializer TODO
# global initializers TODO
+ shared.JS.memory_initializer_pattern
# imports
main_imports = set(main.imports)
diff --git a/tools/shared.py b/tools/shared.py
index 52ca0292..bc1177b2 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1351,6 +1351,8 @@ JCache = cache.JCache(Cache)
chunkify = cache.chunkify
class JS:
+ memory_initializer_pattern = '/\* memory initializer \*/ allocate\(([\d,\.concat\(\)\[\]\\n ]+)"i8", ALLOC_NONE, Runtime\.GLOBAL_BASE\)'
+
@staticmethod
def to_nice_ident(ident): # limited version of the JS function toNiceIdent
return ident.replace('%', '$').replace('@', '_');