aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-29 13:13:48 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-29 13:13:48 -0800
commit63abeaa88d35575419f87c594df1830b957e0b4e (patch)
tree3e8a91a3df8bd0704198e0c0484aed33c4c55ba4
parente29f63136bb41aa5c5c5ef33e67a4c7fa1a8e36e (diff)
fix eliminator bug with eliminating over loops
-rwxr-xr-xtests/runner.py1
-rw-r--r--tools/eliminator/eliminator-test-output.js9
-rw-r--r--tools/eliminator/eliminator-test.js10
-rw-r--r--tools/eliminator/eliminator.coffee6
4 files changed, 20 insertions, 6 deletions
diff --git a/tests/runner.py b/tests/runner.py
index d3c53d88..fdeb9b11 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -5652,6 +5652,7 @@ f.close()
assert False, 'Make sure unaligned loads are not done unnecessarily (add some comments and inspect the source)'
assert False, 'Make sure Poppler builds with llvm full opts'
assert False, 'Check if we should use -Ox instead of -std-compile-opts'
+ assert False, 'Ensure all opts including linktime apply to bindings generator. might need to adjust visibility of bindings C funcs'
elif 'benchmark' in str(sys.argv):
# Benchmarks. Run them with argument |benchmark|. To run a specific test, do
diff --git a/tools/eliminator/eliminator-test-output.js b/tools/eliminator/eliminator-test-output.js
index da9be5cc..876340de 100644
--- a/tools/eliminator/eliminator-test-output.js
+++ b/tools/eliminator/eliminator-test-output.js
@@ -111,4 +111,11 @@ function f2() {
var $8 = $_pre;
c($8);
}
-// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2"]
+function f3($s, $tree, $k) {
+ var $0 = HEAPU32[($s + 2908 + ($k << 2) | 0) >> 2];
+ while (1) {
+ HEAP32[($s + 2908 + ($storemerge_in << 2) | 0) >> 2] = $9;
+ }
+ HEAP32[($s + 2908 + ($storemerge_in << 2) | 0) >> 2] = $0;
+}
+// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2", "f3"]
diff --git a/tools/eliminator/eliminator-test.js b/tools/eliminator/eliminator-test.js
index 3410499d..4928134a 100644
--- a/tools/eliminator/eliminator-test.js
+++ b/tools/eliminator/eliminator-test.js
@@ -122,5 +122,13 @@ function f2() {
var $8 = $_pre;
c($8);
}
-// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2"]
+function f3($s, $tree, $k) {
+ // HEAP vars alias each other, and the loop can confuse us
+ var $0 = HEAPU32[($s + 2908 + ($k << 2) | 0) >> 2];
+ while (1) {
+ HEAP32[($s + 2908 + ($storemerge_in << 2) | 0) >> 2] = $9;
+ }
+ HEAP32[($s + 2908 + ($storemerge_in << 2) | 0) >> 2] = $0;
+}
+// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2", "f3"]
diff --git a/tools/eliminator/eliminator.coffee b/tools/eliminator/eliminator.coffee
index 84e544b2..5b8ac43f 100644
--- a/tools/eliminator/eliminator.coffee
+++ b/tools/eliminator/eliminator.coffee
@@ -252,12 +252,10 @@ class Eliminator
traverseChild child
else
# Don't put anything from outside into the body of a loop.
- savedLive = isLive
isLive = {}
for child in node then traverseChild child
- for name of isLive
- if not isLive[name] then savedLive[name] = false
- isLive = savedLive
+ # Don't keep anything alive through a loop
+ isLive = {}
return node
else if type is 'var'
for [varName, varValue] in node[1]