diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-20 17:29:52 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-20 17:29:52 -0800 |
commit | 93ff9b23ee47a7a906ee695ed76d577c56870cbf (patch) | |
tree | 51d4a3172d90443f27306a68f4d4dccb093451e6 /emscripten.py | |
parent | 22b996181d14580413f720703b68b15a7270dd41 (diff) |
memory initializer in fastcomp
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/emscripten.py b/emscripten.py index a7faed0d..ea2120ba 100755 --- a/emscripten.py +++ b/emscripten.py @@ -779,8 +779,10 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, funcs = backend_output[start_funcs+len(start_funcs_marker):end_funcs] metadata_raw = backend_output[metadata_split+len(metadata_split_marker):] metadata = json.loads(metadata_raw) + mem_init = backend_output[end_funcs+len(end_funcs_marker):metadata_split] print >> sys.stderr, "FUNCS", funcs print >> sys.stderr, "META", metadata + print >> sys.stderr, "meminit", mem_init if DEBUG: logging.debug('emscript: js compiler glue') @@ -816,6 +818,12 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, #print >> sys.stderr, 'glue:', pre, '\n\n||||||||||||||||\n\n', post, '...............' + # memory initializer + + pre = pre.replace('STATICTOP = STATIC_BASE + 0;', '''STATICTOP = STATIC_BASE + Runtime.alignMemory(%d); +// /* global initializers */ __ATINIT__.push({ func: function() { runPostSets() } }); +%s''' % (mem_init.count(',')+1, mem_init)) # XXX wrong size calculation! + funcs_js = [funcs] if settings.get('ASM_JS'): parts = pre.split('// ASM_LIBRARY FUNCTIONS\n') |