summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-07 20:12:30 +0000
committerChris Lattner <sabre@nondot.org>2001-11-07 20:12:30 +0000
commitb1f672812b4fad36ce12f9cadc5aab6438e96652 (patch)
treeecc42889906f1e2525614ea36c7b40dc9c0bbbbc /llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
parent31e9e4d21980f98add7be51128080bbcc7947071 (diff)
downloadbcm5719-llvm-b1f672812b4fad36ce12f9cadc5aab6438e96652.tar.gz
bcm5719-llvm-b1f672812b4fad36ce12f9cadc5aab6438e96652.zip
Correct problem that allows indirect function calls
llvm-svn: 1179
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter/Execution.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index 3541eb8228f..41948c58066 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -806,7 +806,11 @@ void Interpreter::executeCallInst(CallInst *I, ExecutionContext &SF) {
for (unsigned i = 1; i < I->getNumOperands(); ++i)
ArgVals.push_back(getOperandValue(I->getOperand(i), SF));
- callMethod(I->getCalledMethod(), ArgVals);
+ // To handle indirect calls, we must get the pointer value from the argument
+ // and treat it as a method pointer.
+ GenericValue SRC = getOperandValue(I->getCalledValue(), SF);
+
+ callMethod((Method*)SRC.PointerVal, ArgVals);
}
static void executePHINode(PHINode *I, ExecutionContext &SF) {
OpenPOWER on IntegriCloud