diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-12-08 15:48:42 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-12-08 15:48:42 -0800 |
commit | f689a0eca6f2292478c5d49c1cc3030a5654bbda (patch) | |
tree | 22d0f54e4ac982511a9f09e7b941702b7d01c8ab | |
parent | 037e8d20c096ccacbfb7d3a2d7a243bc9e11081d (diff) |
better fix for the exception testcase in #747 - set the current exception when we are resuming after an end-catch which wiped it out, but not otherwise
-rw-r--r-- | src/jsifier.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 47118d76..50703b90 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1036,12 +1036,10 @@ function JSify(data, functionsOnly, givenFunctions) { return ret + ';'; }); makeFuncLineActor('resume', function(item) { - // exception pointer is from the ident (we can't reuse it from the original exception since cxa_end_catch might clean it up); - // type and destructor can be reused. + // If there is no current exception, set this one as it (during a resume, the current exception can be wiped out) return (EXCEPTION_DEBUG ? 'Module.print("Resuming exception");' : '') + - '___cxa_throw(' + item.ident + '.f0, ' + - makeGetValue('_llvm_eh_exception.buf', Runtime.QUANTUM_SIZE, 'void*') + ',' + - makeGetValue('_llvm_eh_exception.buf', Runtime.QUANTUM_SIZE*2, 'void*') + ');'; + 'if (' + makeGetValue('_llvm_eh_exception.buf', 0, 'void*') + ' == 0) { ' + makeSetValue('_llvm_eh_exception.buf', 0, item.ident + '.f0', 'void*') + ' } ' + + 'throw ' + item.ident + '.f0;'; }); makeFuncLineActor('invoke', function(item) { // Wrapping in a function lets us easily return values if we are |