aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-22 17:59:33 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-22 17:59:33 -0800
commit6eaf330462b1da305acaf9ba5d02dea3a34ae711 (patch)
tree9dc06fea37d31e6a0ad45bd6851282b63a0a695a
parent9dcd81dcdc3044cba82d856dd3d583d6434907ca (diff)
better temp dir definition and usage, and more debugging output in emcc
-rwxr-xr-xemcc14
-rw-r--r--tests/runner.py4
-rw-r--r--tools/shared.py9
3 files changed, 24 insertions, 3 deletions
diff --git a/emcc b/emcc
index 6c22276d..571126f3 100755
--- a/emcc
+++ b/emcc
@@ -472,25 +472,37 @@ try:
final += '.tr.js'
process(final)
+ if DEBUG:
+ shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-0.js'))
+ final = shared.Building.js_optimizer(final, []) # Clean up the syntax a bit, so comparisons to later passes are simpler
+ shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-1.js'))
+
if opt_level >= 1:
# js optimizer
if DEBUG: print >> sys.stderr, 'emcc: running pre-closure post-opts'
- final = shared.Building.js_optimizer(final, ['hoistMultiples', 'loopOptimizer'])
+ final = shared.Building.js_optimizer(final, ['hoistMultiples'])
+ if DEBUG: shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-2.js'))
+ final = shared.Building.js_optimizer(final, ['loopOptimizer'])
+ if DEBUG: shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-2.5.js'))
# eliminator
final = shared.Building.eliminator(final)
+ if DEBUG: shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-3.js'))
# js optimizer pre-pass
final = shared.Building.js_optimizer(final, 'simplifyExpressionsPre')
+ if DEBUG: shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-4.js'))
if closure:
if DEBUG: print >> sys.stderr, 'emcc: running closure'
final = shared.Building.closure_compiler(final)
+ if DEBUG: shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-5.js'))
if opt_level >= 1:
# js optimizer post-pass
if DEBUG: print >> sys.stderr, 'emcc: running post-closure post-opts'
final = shared.Building.js_optimizer(final, 'simplifyExpressionsPost')
+ if DEBUG: shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-6.js'))
# If we were asked to also generate HTML, do that
if final_suffix == 'html':
diff --git a/tests/runner.py b/tests/runner.py
index 84862c67..342bdc4d 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -40,9 +40,9 @@ class RunnerCore(unittest.TestCase):
Settings.reset()
self.banned_js_engines = []
if not self.save_dir:
- dirname = tempfile.mkdtemp(prefix="ems_" + self.__class__.__name__ + "_", dir=TEMP_DIR)
+ dirname = tempfile.mkdtemp(prefix='emscripten_test_' + self.__class__.__name__ + '_', dir=TEMP_DIR)
else:
- dirname = os.path.join(TEMP_DIR, 'tmp')
+ dirname = EMSCRIPTEN_TEMP_DIR
if not os.path.exists(dirname):
os.makedirs(dirname)
self.working_dir = dirname
diff --git a/tools/shared.py b/tools/shared.py
index adf3004e..86a6463f 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -110,6 +110,15 @@ EXEC_LLVM = path_from_root('tools', 'exec_llvm.py')
VARIABLE_ELIMINATOR = path_from_root('tools', 'eliminator', 'eliminator.coffee')
JS_OPTIMIZER = path_from_root('tools', 'js-optimizer.js')
+# Temp dir
+
+EMSCRIPTEN_TEMP_DIR = os.path.join(TEMP_DIR, 'emscripten_test')
+if not os.path.exists(EMSCRIPTEN_TEMP_DIR):
+ try:
+ os.makedirs(EMSCRIPTEN_TEMP_DIR)
+ except Exception, e:
+ print >> sys.stderr, 'Warning: Could not create temp dir (%s): %s' % (EMSCRIPTEN_TEMP_DIR, str(e))
+
# ~/.emscripten stuff
try: