diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-25 15:40:06 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-25 15:40:06 -0700 |
commit | 6dda61e5fc7c89b759033319444017aff8e3605f (patch) | |
tree | f9acab4314382b85b47d90094a5402aea4749dd4 | |
parent | ac75b943b75f769ba0b754ba4577c8556dcd3047 (diff) |
add option to run funcs stage in the browser
-rwxr-xr-x | emscripten.py | 7 | ||||
-rw-r--r-- | src/compiler_funcs.html | 26 |
2 files changed, 32 insertions, 1 deletions
diff --git a/emscripten.py b/emscripten.py index a58baba2..b95e03a7 100755 --- a/emscripten.py +++ b/emscripten.py @@ -58,6 +58,8 @@ def process_funcs((i, funcs, meta, settings_file, compiler, forwarded_file, libr f.write('\n') f.write(meta) f.close() + #print >> sys.stderr, 'running', str([settings_file, funcs_file, 'funcs', forwarded_file] + libraries).replace("'/", "'") # can use this in src/compiler_funcs.html arguments, + # # just copy temp dir to under this one out = jsrun.run_js( compiler, engine=compiler_engine, @@ -221,6 +223,8 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None, funcs, chunk_size, jcache.get_cachename('emscript_files') if jcache else None) + #chunks = [chunks[0]] # pick specific chunks for debugging/profiling + funcs = None if jcache: @@ -249,7 +253,8 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None, if DEBUG: print >> sys.stderr, ' emscript: phase 2 working on %d chunks %s (intended chunk size: %.2f MB, meta: %.2f MB, forwarded: %.2f MB, total: %.2f MB)' % (len(chunks), ('using %d cores' % cores) if len(chunks) > 1 else '', chunk_size/(1024*1024.), len(meta)/(1024*1024.), len(forwarded_data)/(1024*1024.), total_ll_size/(1024*1024.)) commands = [ - (i, chunk, meta, settings_file, compiler, forwarded_file, libraries, compiler_engine, temp_files, DEBUG) + (i, chunk, meta, settings_file, compiler, forwarded_file, libraries, compiler_engine,# + ['--prof'], + temp_files, DEBUG) for i, chunk in enumerate(chunks) ] diff --git a/src/compiler_funcs.html b/src/compiler_funcs.html new file mode 100644 index 00000000..92553e8a --- /dev/null +++ b/src/compiler_funcs.html @@ -0,0 +1,26 @@ +<html> +<body> +<h2>Run the emscripten compiler in a web page, just for laughs</h2> +Open the web console to see stderr output +<hr> +<pre id="output"></pre> +<script> + arguments = ['tmp/emscripten_temp/tmpffWtYF.txt', 'tmp/emscripten_temp/tmpnKzHrf.func_0.ll', 'funcs', 'tmp/emscripten_temp/tmpWD6y0W.json']; // copy from emscripten.py output + + var outputElement = document.getElementById('output'); + print = function(x) { + outputElement.innerHTML += x; + }; + + // For generated code + var Module = { + print: function(x) { + outputElement.innerHTML += x; + } + }; +</script> +<script src="compiler.js"> +</script> +</body> +</html> + |