From 87ce0bec915be2989c8c615e525eaf2e923c985b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 21 Sep 2007 18:30:39 +0000 Subject: [PATCH] #ifdef out unsafe tracing code, which fixes PR1689 llvm-svn: 42205 --- .../ExecutionEngine/Interpreter/Execution.cpp | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp index 53df5443659c..95e2143787cb 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -1338,20 +1338,6 @@ void Interpreter::callFunction(Function *F, StackFrame.VarArgs.assign(ArgVals.begin()+i, ArgVals.end()); } -static void PrintGenericValue(const GenericValue &Val, const Type* Ty) { - switch (Ty->getTypeID()) { - default: assert(0 && "Invalid GenericValue Type"); - case Type::VoidTyID: DOUT << "void"; break; - case Type::FloatTyID: DOUT << "float " << Val.FloatVal; break; - case Type::DoubleTyID: DOUT << "double " << Val.DoubleVal; break; - case Type::PointerTyID: DOUT << "void* " << intptr_t(Val.PointerVal); break; - case Type::IntegerTyID: - DOUT << "i" << Val.IntVal.getBitWidth() << " " - << Val.IntVal.toStringUnsigned(10) - << " (0x" << Val.IntVal.toStringUnsigned(16) << ")\n"; - break; - } -} void Interpreter::run() { while (!ECStack.empty()) { @@ -1364,12 +1350,28 @@ void Interpreter::run() { DOUT << "About to interpret: " << I; visit(I); // Dispatch to one of the visit* methods... +#if 0 + // This is not safe, as visiting the instruction could lower it and free I. #ifndef NDEBUG if (!isa(I) && !isa(I) && I.getType() != Type::VoidTy) { DOUT << " --> "; - PrintGenericValue(SF.Values[&I], I.getType()); + const GenericValue &Val = SF.Values[&I]; + switch (I.getType()->getTypeID()) { + default: assert(0 && "Invalid GenericValue Type"); + case Type::VoidTyID: DOUT << "void"; break; + case Type::FloatTyID: DOUT << "float " << Val.FloatVal; break; + case Type::DoubleTyID: DOUT << "double " << Val.DoubleVal; break; + case Type::PointerTyID: DOUT << "void* " << intptr_t(Val.PointerVal); + break; + case Type::IntegerTyID: + DOUT << "i" << Val.IntVal.getBitWidth() << " " + << Val.IntVal.toStringUnsigned(10) + << " (0x" << Val.IntVal.toStringUnsigned(16) << ")\n"; + break; + } } +#endif #endif } }