aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/NaCl/ExceptionInfoWriter.cpp
AgeCommit message (Collapse)Author
2013-11-15PNaCl: Change exception info format to distinguish catch-all/cleanup clausesMark Seaborn
The initial version of ExceptionInfoWriter.cpp encodes a landingpad's "cleanup" clause the same as "catch i8* null" (a catch-all). But it turns out we do want to distinguish these two: If an uncaught exception occurs, we don't want the runtime to run C++ destructors (cleanups), because this involves unwinding the stack to jump to landingpads, which loses the context of where the uncaught exception was thrown from, which is unhelpful for debugging. (The C++ standard says it's optional whether destructors are run when an uncaught exception occurs.) So, change the encoding as follows: * Use 0 as the ID for "cleanup" clauses. * Add 1 to the IDs of types and "catch" clauses. (Adding 1 to both seems neater than just one of them.) * This means we can use 0 for the terminator of filter lists instead of -1, which seems a little neater. This requires a corresponding change to eh_pnacl.cc in libsupc++. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3696 TEST=NaCl's EH tests with libsupc++ change applied Review URL: https://codereview.chromium.org/69923008
2013-10-16Add PNaClSjLjEH pass to implement C++ exception handling using ↵Mark Seaborn
setjmp()+longjmp() There are two parts to this: * PNaClSjLjEH.cpp expands out the "invoke", "landingpad" and "resume" instructions, modifying the control flow to use setjmp(). * ExceptionInfoWriter.cpp lowers landingpads' clause lists to data that PNaCl's C++ runtime library will interpret. This part will be reused when we drop the SjLj part and create a stable ABI for zero-cost EH. This pass isn't enabled in PNaClABISimplify yet: I'll do that in a separate change. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3696 TEST=*.ll tests (also tested end-to-end: plumbing for this will follow later) Review URL: https://codereview.chromium.org/24777002