From a4504c6f116760d6c0f9f920bb755c3d0136f6c6 Mon Sep 17 00:00:00 2001 From: Mark Seaborn Date: Fri, 15 Nov 2013 17:22:57 -0800 Subject: PNaCl: Change exception info format to distinguish catch-all/cleanup clauses 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 --- test/Transforms/NaCl/pnacl-eh-exception-info.ll | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/Transforms/NaCl/pnacl-eh-exception-info.ll b/test/Transforms/NaCl/pnacl-eh-exception-info.ll index a330f6f5ac..478bc97d3f 100644 --- a/test/Transforms/NaCl/pnacl-eh-exception-info.ll +++ b/test/Transforms/NaCl/pnacl-eh-exception-info.ll @@ -21,9 +21,9 @@ declare void @external_func() ; CHECK: @__pnacl_eh_type_table = internal constant [4 x i8*] [i8* @exc_typeid1, i8* @exc_typeid2, i8* @exc_typeid3, i8* null] -; CHECK: @__pnacl_eh_action_table = internal constant [6 x %action_table_entry] [%action_table_entry { i32 2, i32 0 }, %action_table_entry { i32 1, i32 1 }, %action_table_entry { i32 0, i32 2 }, %action_table_entry { i32 -1, i32 0 }, %action_table_entry { i32 -2, i32 0 }, %action_table_entry { i32 3, i32 0 }] +; CHECK: @__pnacl_eh_action_table = internal constant [7 x %action_table_entry] [%action_table_entry { i32 3, i32 0 }, %action_table_entry { i32 2, i32 1 }, %action_table_entry { i32 1, i32 2 }, %action_table_entry { i32 -1, i32 0 }, %action_table_entry { i32 -2, i32 0 }, %action_table_entry { i32 4, i32 0 }, %action_table_entry zeroinitializer] -; CHECK: @__pnacl_eh_filter_table = internal constant [5 x i32] [i32 -1, i32 1, i32 2, i32 0, i32 -1] +; CHECK: @__pnacl_eh_filter_table = internal constant [5 x i32] [i32 0, i32 2, i32 3, i32 1, i32 0] ; Exception type pointers are allocated IDs which specify the index @@ -38,9 +38,9 @@ define void @test_eh_typeid(i32 %arg) { ret void } ; CHECK: define void @test_eh_typeid -; CHECK-NEXT: %cmp1 = icmp eq i32 %arg, 0 -; CHECK-NEXT: %cmp2 = icmp eq i32 %arg, 1 -; CHECK-NEXT: %cmp3 = icmp eq i32 %arg, 2 +; CHECK-NEXT: %cmp1 = icmp eq i32 %arg, 1 +; CHECK-NEXT: %cmp2 = icmp eq i32 %arg, 2 +; CHECK-NEXT: %cmp3 = icmp eq i32 %arg, 3 ; CHECK-NEXT: ret void @@ -114,7 +114,6 @@ lpad: ; CHECK: store i32 6, i32* %exc_info_ptr -; "cleanup" is treated the same as "catch i8* null". define void @test_cleanup_clause() { invoke void @external_func() to label %cont unwind label %lpad cont: @@ -125,4 +124,4 @@ lpad: ret void } ; CHECK: define void @test_cleanup_clause -; CHECK: store i32 6, i32* %exc_info_ptr +; CHECK: store i32 7, i32* %exc_info_ptr -- cgit v1.2.3-18-g5258