[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Interpreter.cpp Interpreter.h
Jeff Cohen
jeffc at jolt-lang.org
Mon Feb 6 21:29:57 PST 2006
Changes in directory llvm/lib/ExecutionEngine/Interpreter:
Execution.cpp updated: 1.138 -> 1.139
Interpreter.cpp updated: 1.25 -> 1.26
Interpreter.h updated: 1.71 -> 1.72
---
Log message:
The interpreter assumes that the caller of runFunction() must be lli, and
therefore the function being called must be a main() returning an int. The
consequences when these assumptions are false are not good, so don't assume
them.
---
Diffs of the changes: (+7 -8)
Execution.cpp | 6 +++---
Interpreter.cpp | 7 +++----
Interpreter.h | 2 +-
3 files changed, 7 insertions(+), 8 deletions(-)
Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.138 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.138 Sat Jun 18 13:34:52 2005
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Mon Feb 6 23:29:44 2006
@@ -553,7 +553,7 @@
/// Pop the last stack frame off of ECStack and then copy the result
/// back into the result variable if we are not returning void. The
-/// result variable may be the ExitCode, or the Value of the calling
+/// result variable may be the ExitValue, or the Value of the calling
/// CallInst if there was a previous stack frame. This method may
/// invalidate any ECStack iterators you have. This method also takes
/// care of switching to the normal destination BB, if we are returning
@@ -566,9 +566,9 @@
if (ECStack.empty()) { // Finished main. Put result into exit code...
if (RetTy && RetTy->isIntegral()) { // Nonvoid return type?
- ExitCode = Result.IntVal; // Capture the exit code of the program
+ ExitValue = Result; // Capture the exit value of the program
} else {
- ExitCode = 0;
+ memset(&ExitValue, 0, sizeof(ExitValue));
}
} else {
// If we have a previous stack frame, and we have a previous call,
Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.25 llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.26
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.25 Wed Jul 27 01:12:33 2005
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp Mon Feb 6 23:29:44 2006
@@ -50,10 +50,11 @@
//
Interpreter::Interpreter(Module *M, bool isLittleEndian, bool isLongPointer,
IntrinsicLowering *il)
- : ExecutionEngine(M), ExitCode(0),
+ : ExecutionEngine(M),
TD("lli", isLittleEndian, isLongPointer ? 8 : 4, isLongPointer ? 8 : 4,
isLongPointer ? 8 : 4), IL(il) {
+ memset(&ExitValue, 0, sizeof(ExitValue));
setTargetData(TD);
// Initialize the "backend"
initializeExecutionEngine();
@@ -100,8 +101,6 @@
// Start executing the function.
run();
- GenericValue rv;
- rv.IntVal = ExitCode;
- return rv;
+ return ExitValue;
}
Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.71 llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.72
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.71 Sat Jun 18 13:34:52 2005
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h Mon Feb 6 23:29:44 2006
@@ -80,7 +80,7 @@
// Interpreter - This class represents the entirety of the interpreter.
//
class Interpreter : public ExecutionEngine, public InstVisitor<Interpreter> {
- int ExitCode; // The exit code to be returned by the lli util
+ GenericValue ExitValue; // The return value of the called function
TargetData TD;
IntrinsicLowering *IL;
More information about the llvm-commits
mailing list