aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-20 15:27:31 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-20 15:27:31 -0800
commit079a6226ea2fbb0c323b4a94eefe52ff20998d7e (patch)
tree6fe0db3855f22619af8e275836a4a58f64792f79 /emscripten.py
parent39549647380bc09d6ac05b880933daf7cf4c82c1 (diff)
parse fastcomp output into parts
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/emscripten.py b/emscripten.py
index 7f6c0dad..f7e4b777 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -762,10 +762,26 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
temp4 = temp_files.get('.4.js').name
backend_compiler = os.path.join(shared.JS_BACKEND_ROOT, 'llc')
shared.jsrun.timeout_run(subprocess.Popen([backend_compiler, temp3, '-march=js', '-filetype=asm', '-o', temp4], stdout=subprocess.PIPE))
+ if DEBUG: shutil.copyfile(temp4, os.path.join(shared.CANONICAL_TEMP_DIR, 'temp4.js'))
+
+ # Split up output
backend_output = open(temp4).read()
print >> sys.stderr, backend_output
- if DEBUG: logging.debug(' ..5..')
+ start_funcs_marker = '// EMSCRIPTEN_START_FUNCTIONS'
+ end_funcs_marker = '// EMSCRIPTEN_END_FUNCTIONS'
+ metadata_split_marker = '// EMSCRIPTEN_METADATA'
+
+ start_funcs = backend_output.index(start_funcs_marker)
+ end_funcs = backend_output.rindex(end_funcs_marker)
+ metadata_split = backend_output.rindex(metadata_split_marker)
+
+ 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)
+ print >> sys.stderr, "FUNCS", funcs
+ print >> sys.stderr, "META", metadata
+
1/0 # XXX