aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-12-25 11:31:31 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-12-25 11:32:06 -0800
commitfda1fc2a3eb8f8de71d9fbe2d9459cadd4a93501 (patch)
tree7f481a19fccf1ed95010eb12598ffd7b2a227268 /src
parent0caa98e6ccae219815efafe1f7692ac0dce04971 (diff)
properly handle invoke of setjmp, by lowering to a call, which fixes phis that refer to it. fixes #1942
Diffstat (limited to 'src')
-rw-r--r--src/analyzer.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 17582ea3..e8ca6cf6 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -1570,7 +1570,17 @@ function analyzer(data, sidePass) {
for (var j = 0; j < label.lines.length; j++) {
var line = label.lines[j];
if ((line.intertype == 'call' || line.intertype == 'invoke') && line.ident == setjmp) {
- // Add a new label
+ if (line.intertype == 'invoke') {
+ // setjmp cannot trigger unwinding, so just reduce the invoke to a call + branch
+ line.intertype = 'call';
+ label.lines.push({
+ intertype: 'branch',
+ label: line.toLabel,
+ lineNum: line.lineNum + 0.01, // XXX legalizing might confuse this
+ });
+ line.toLabel = line.unwindLabel = -2;
+ }
+ // split this label into up to the setjmp (including), then a new label for the rest. longjmp will reach the rest
var oldLabel = label.ident;
var newLabel = func.labelIdCounter++;
if (!func.setjmpTable) func.setjmpTable = [];