properly use identifier given to resume instruction, avoids issues with cxa_catch cleaning it up; fixes test_multiexception, the exception-handling part of #747
This commit is contained in:
Родитель
b1da8a876b
Коммит
037e8d20c0
|
@ -919,6 +919,7 @@ function intertyper(data, sidePass, baseLineNums) {
|
||||||
processItem: function(item) {
|
processItem: function(item) {
|
||||||
return [{
|
return [{
|
||||||
intertype: 'resume',
|
intertype: 'resume',
|
||||||
|
ident: toNiceIdent(item.tokens[2].text),
|
||||||
lineNum: item.lineNum
|
lineNum: item.lineNum
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1036,8 +1036,12 @@ function JSify(data, functionsOnly, givenFunctions) {
|
||||||
return ret + ';';
|
return ret + ';';
|
||||||
});
|
});
|
||||||
makeFuncLineActor('resume', function(item) {
|
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.
|
||||||
return (EXCEPTION_DEBUG ? 'Module.print("Resuming exception");' : '') +
|
return (EXCEPTION_DEBUG ? 'Module.print("Resuming exception");' : '') +
|
||||||
'throw ' + makeGetValue('_llvm_eh_exception.buf', '0', 'void*') + ';';
|
'___cxa_throw(' + item.ident + '.f0, ' +
|
||||||
|
makeGetValue('_llvm_eh_exception.buf', Runtime.QUANTUM_SIZE, 'void*') + ',' +
|
||||||
|
makeGetValue('_llvm_eh_exception.buf', Runtime.QUANTUM_SIZE*2, 'void*') + ');';
|
||||||
});
|
});
|
||||||
makeFuncLineActor('invoke', function(item) {
|
makeFuncLineActor('invoke', function(item) {
|
||||||
// Wrapping in a function lets us easily return values if we are
|
// Wrapping in a function lets us easily return values if we are
|
||||||
|
|
|
@ -2377,8 +2377,10 @@ int main(int argc, char *argv[]) {
|
||||||
self.do_run(src, '''setjmp normal execution path, level: 0, prev_jmp: -1
|
self.do_run(src, '''setjmp normal execution path, level: 0, prev_jmp: -1
|
||||||
setjmp normal execution path, level: 1, prev_jmp: 0
|
setjmp normal execution path, level: 1, prev_jmp: 0
|
||||||
level is 2, perform longjmp!
|
level is 2, perform longjmp!
|
||||||
|
caught 1
|
||||||
setjmp exception execution path, level: 1, prev_jmp: 0
|
setjmp exception execution path, level: 1, prev_jmp: 0
|
||||||
prev_jmp is not empty, continue with longjmp!
|
prev_jmp is not empty, continue with longjmp!
|
||||||
|
caught 0
|
||||||
setjmp exception execution path, level: 0, prev_jmp: -1
|
setjmp exception execution path, level: 0, prev_jmp: -1
|
||||||
Exiting setjmp function, level: 0, prev_jmp: -1
|
Exiting setjmp function, level: 0, prev_jmp: -1
|
||||||
''')
|
''')
|
||||||
|
|
Загрузка…
Ссылка в новой задаче