[cfe-commits] r64032 - in /cfe/trunk/lib/CodeGen: CGObjCMac.cpp CodeGenFunction.h
Anders Carlsson
andersca at mac.com
Sat Feb 7 13:37:21 PST 2009
Author: andersca
Date: Sat Feb 7 15:37:21 2009
New Revision: 64032
URL: http://llvm.org/viewvc/llvm-project?rev=64032&view=rev
Log:
Split the exception object out into its own stack.
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=64032&r1=64031&r2=64032&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sat Feb 7 15:37:21 2009
@@ -1868,7 +1868,8 @@
// through finally.
CodeGenFunction::ObjCEHEntry EHEntry(FinallyBlock, FinallySwitch, DestCode);
CGF.ObjCEHStack.push_back(&EHEntry);
-
+ CGF.ObjCEHValueStack.push_back(0);
+
// Allocate memory for the exception data and rethrow pointer.
llvm::Value *ExceptionData = CGF.CreateTempAlloca(ObjCTypes.ExceptionDataTy,
"exceptiondata.ptr");
@@ -1913,7 +1914,7 @@
llvm::Value *Caught = CGF.Builder.CreateCall(ObjCTypes.ExceptionExtractFn,
ExceptionData,
"caught");
- EHEntry.Exception = Caught;
+ CGF.ObjCEHValueStack.back() = Caught;
if (!isTry)
{
CGF.Builder.CreateStore(Caught, RethrowPtr);
@@ -2032,7 +2033,8 @@
// this now, because the code in the @finally block is not in this
// context.
CGF.ObjCEHStack.pop_back();
-
+ CGF.ObjCEHValueStack.pop_back();
+
// Emit the @finally block.
CGF.EmitBlock(FinallyBlock);
llvm::Value* CallTryExit = CGF.Builder.CreateLoad(CallTryExitPtr, "tmp");
@@ -2076,9 +2078,9 @@
ExceptionAsObject =
CGF.Builder.CreateBitCast(Exception, ObjCTypes.ObjectPtrTy, "tmp");
} else {
- assert((!CGF.ObjCEHStack.empty() && CGF.ObjCEHStack.back()->Exception) &&
+ assert((!CGF.ObjCEHValueStack.empty() && CGF.ObjCEHValueStack.back()) &&
"Unexpected rethrow outside @catch block.");
- ExceptionAsObject = CGF.ObjCEHStack.back()->Exception;
+ ExceptionAsObject = CGF.ObjCEHValueStack.back();
}
CGF.Builder.CreateCall(ObjCTypes.ExceptionThrowFn, ExceptionAsObject);
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=64032&r1=64031&r2=64032&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sat Feb 7 15:37:21 2009
@@ -97,7 +97,7 @@
struct ObjCEHEntry {
ObjCEHEntry(llvm::BasicBlock *fb, llvm::SwitchInst *fs, llvm::Value *dc)
: FinallyBlock(fb), FinallySwitch(fs),
- DestCode(dc), Exception(0) {}
+ DestCode(dc) {}
/// Entry point to the finally block.
llvm::BasicBlock *FinallyBlock;
@@ -109,12 +109,12 @@
/// Variable holding the code for the destination of a jump
/// through the @finally block.
llvm::Value *DestCode;
-
- /// The exception object being handled, during IR generation for a
- /// @catch block.
- llvm::Value *Exception;
};
+ /// ObjCEHValueStack - Stack of exception objects being handled,
+ /// during IR generation for a @catch block.
+ llvm::SmallVector<llvm::Value*, 8> ObjCEHValueStack;
+
typedef llvm::SmallVector<ObjCEHEntry*, 8> ObjCEHStackType;
ObjCEHStackType ObjCEHStack;
More information about the cfe-commits
mailing list