diff options
Diffstat (limited to 'lib/ExecutionEngine/ExecutionEngine.cpp')
| -rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 25 | 
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index f28697530b3d..2b1e8786c727 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -79,9 +79,10 @@ ExecutionEngine::~ExecutionEngine() {  void ExecutionEngine::DeregisterAllTables() {    if (ExceptionTableDeregister) { -    for (std::vector<void*>::iterator it = AllExceptionTables.begin(), -           ie = AllExceptionTables.end(); it != ie; ++it) -      ExceptionTableDeregister(*it); +    DenseMap<const Function*, void*>::iterator it = AllExceptionTables.begin(); +    DenseMap<const Function*, void*>::iterator ite = AllExceptionTables.end(); +    for (; it != ite; ++it) +      ExceptionTableDeregister(it->second);      AllExceptionTables.clear();    }  } @@ -310,19 +311,19 @@ void ExecutionEngine::runStaticConstructorsDestructors(Module *module,    // it.    if (!GV || GV->isDeclaration() || GV->hasLocalLinkage()) return; -  // Should be an array of '{ int, void ()* }' structs.  The first value is +  // Should be an array of '{ i32, void ()* }' structs.  The first value is    // the init priority, which we ignore. -  ConstantArray *InitList = dyn_cast<ConstantArray>(GV->getInitializer()); -  if (!InitList) return; +  if (isa<ConstantAggregateZero>(GV->getInitializer())) +    return; +  ConstantArray *InitList = cast<ConstantArray>(GV->getInitializer());    for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) { -    ConstantStruct *CS = -      dyn_cast<ConstantStruct>(InitList->getOperand(i)); -    if (!CS) continue; -    if (CS->getNumOperands() != 2) return; // Not array of 2-element structs. +    if (isa<ConstantAggregateZero>(InitList->getOperand(i))) +      continue; +    ConstantStruct *CS = cast<ConstantStruct>(InitList->getOperand(i));      Constant *FP = CS->getOperand(1);      if (FP->isNullValue()) -      break;  // Found a null terminator, exit. +      continue;  // Found a sentinal value, ignore.      // Strip off constant expression casts.      if (ConstantExpr *CE = dyn_cast<ConstantExpr>(FP)) @@ -838,7 +839,7 @@ void ExecutionEngine::StoreValueToMemory(const GenericValue &Val,    case Type::PointerTyID:      // Ensure 64 bit target pointers are fully initialized on 32 bit hosts.      if (StoreBytes != sizeof(PointerTy)) -      memset(Ptr, 0, StoreBytes); +      memset(&(Ptr->PointerVal), 0, StoreBytes);      *((PointerTy*)Ptr) = Val.PointerVal;      break;  | 
