aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-09 12:25:04 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-09 12:25:04 -0800
commiteebf751df357e74c3ea17ef6ea8be322aa7e442c (patch)
treee23fa801c31a7e1b88084a429ee6d3ddc2b1ff97
parentb8bf06bf01efccded4b0f0a326fb4494b11d7e10 (diff)
fix resume with legalized structurals
-rw-r--r--src/jsifier.js5
-rw-r--r--src/parseTools.js8
2 files changed, 11 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 0e8b825a..e76b7fba 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1082,9 +1082,10 @@ function JSify(data, functionsOnly, givenFunctions) {
});
makeFuncLineActor('resume', function(item) {
// If there is no current exception, set this one as it (during a resume, the current exception can be wiped out)
+ var ptr = makeStructuralAccess(item.ident, 0);
return (EXCEPTION_DEBUG ? 'Module.print("Resuming exception");' : '') +
- 'if (' + makeGetValue('_llvm_eh_exception.buf', 0, 'void*') + ' == 0) { ' + makeSetValue('_llvm_eh_exception.buf', 0, item.ident + '.f0', 'void*') + ' } ' +
- 'throw ' + item.ident + '.f0;';
+ 'if (' + makeGetValue('_llvm_eh_exception.buf', 0, 'void*') + ' == 0) { ' + makeSetValue('_llvm_eh_exception.buf', 0, ptr, 'void*') + ' } ' +
+ 'throw ' + ptr + ';';
});
makeFuncLineActor('invoke', function(item) {
// Wrapping in a function lets us easily return values if we are
diff --git a/src/parseTools.js b/src/parseTools.js
index 13839d17..06d4494f 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1591,6 +1591,14 @@ function makeStructuralReturn(values) {
}
}
+function makeStructuralAccess(ident, i) {
+ if (USE_TYPED_ARRAYS == 2) {
+ return ident + '$' + i;
+ } else {
+ return ident + '.f' + i;
+ }
+}
+
// From parseLLVMSegment
function finalizeLLVMParameter(param, noIndexizeFunctions) {
var ret;