diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-12 14:47:17 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-12 14:47:17 -0700 |
commit | 6010666be99cd0322babba1174cfbc65c776deb5 (patch) | |
tree | dad63b03b751394c169de61fbf2c195f4faf5344 /emscripten.py | |
parent | 38890204ed1f5f8dd34cced7c42fc9cf42dccab5 (diff) | |
parent | f9dff9b3f2e95b2ca8e5b8fd97538f301fd080fe (diff) |
Merge branch 'incoming'
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/emscripten.py b/emscripten.py index 257527fe..4d744fdd 100755 --- a/emscripten.py +++ b/emscripten.py @@ -43,6 +43,12 @@ NUM_CHUNKS_PER_CORE = 1.25 MIN_CHUNK_SIZE = 1024*1024 MAX_CHUNK_SIZE = float(os.environ.get('EMSCRIPT_MAX_CHUNK_SIZE') or 'inf') # configuring this is just for debugging purposes +STDERR_FILE = os.environ.get('EMCC_STDERR_FILE') +if STDERR_FILE: + STDERR_FILE = os.path.abspath(STDERR_FILE) + print >> sys.stderr, 'logging stderr in js compiler phase into %s' % STDERR_FILE + STDERR_FILE = open(STDERR_FILE, 'w') + def process_funcs((i, funcs, meta, settings_file, compiler, forwarded_file, libraries, compiler_engine, temp_files, DEBUG)): try: funcs_file = temp_files.get('.func_%d.ll' % i).name @@ -57,6 +63,7 @@ def process_funcs((i, funcs, meta, settings_file, compiler, forwarded_file, libr engine=compiler_engine, args=[settings_file, funcs_file, 'funcs', forwarded_file] + libraries, stdout=subprocess.PIPE, + stderr=STDERR_FILE, cwd=path_from_root('src')) except KeyboardInterrupt: # Python 2.7 seems to lock up when a child process throws KeyboardInterrupt @@ -179,7 +186,7 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None, if out and DEBUG: print >> sys.stderr, ' loading pre from jcache' if not out: open(pre_file, 'w').write(pre_input) - out = jsrun.run_js(compiler, compiler_engine, [settings_file, pre_file, 'pre'] + libraries, stdout=subprocess.PIPE, + out = jsrun.run_js(compiler, compiler_engine, [settings_file, pre_file, 'pre'] + libraries, stdout=subprocess.PIPE, stderr=STDERR_FILE, cwd=path_from_root('src')) assert '//FORWARDED_DATA:' in out, 'Did not receive forwarded data in pre output - process failed?' if jcache: @@ -287,6 +294,7 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None, exported_implemented_functions = set() for func_js, curr_forwarded_data in outputs: curr_forwarded_json = json.loads(curr_forwarded_data) + forwarded_json['Types']['hasInlineJS'] = forwarded_json['Types']['hasInlineJS'] or curr_forwarded_json['Types']['hasInlineJS'] forwarded_json['Types']['preciseI64MathUsed'] = forwarded_json['Types']['preciseI64MathUsed'] or curr_forwarded_json['Types']['preciseI64MathUsed'] for key, value in curr_forwarded_json['Functions']['blockAddresses'].iteritems(): forwarded_json['Functions']['blockAddresses'][key] = value @@ -376,7 +384,7 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None, if DEBUG: t = time.time() post_file = temp_files.get('.post.ll').name open(post_file, 'w').write('\n') # no input, just processing of forwarded data - out = jsrun.run_js(compiler, compiler_engine, [settings_file, post_file, 'post', forwarded_file] + libraries, stdout=subprocess.PIPE, + out = jsrun.run_js(compiler, compiler_engine, [settings_file, post_file, 'post', forwarded_file] + libraries, stdout=subprocess.PIPE, stderr=STDERR_FILE, cwd=path_from_root('src')) post, last_forwarded_data = out.split('//FORWARDED_DATA:') # if this fails, perhaps the process failed prior to printing forwarded data? last_forwarded_json = json.loads(last_forwarded_data) @@ -543,7 +551,7 @@ function asmPrintFloat(x, y) { } // EMSCRIPTEN_START_ASM var asm = (function(global, env, buffer) { - 'use asm'; + %s var HEAP8 = new global.Int8Array(buffer); var HEAP16 = new global.Int16Array(buffer); var HEAP32 = new global.Int32Array(buffer); @@ -552,7 +560,7 @@ var asm = (function(global, env, buffer) { var HEAPU32 = new global.Uint32Array(buffer); var HEAPF32 = new global.Float32Array(buffer); var HEAPF64 = new global.Float64Array(buffer); -''' % (asm_setup,) + '\n' + asm_global_vars + ''' +''' % (asm_setup, "'use asm';" if not forwarded_json['Types']['hasInlineJS'] and not settings['SIDE_MODULE'] else "'almost asm';") + '\n' + asm_global_vars + ''' var __THREW__ = 0; var threwValue = 0; var setjmpId = 0; |