Skip to content

Commit

Permalink
interpreter: check if parent stackframe exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyxogen committed Feb 14, 2024
1 parent d13608e commit 0075044
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,6 @@ GenericValue Interpreter::callExternalFunction(Function *F,
TheInterpreter = this;

auto &Fns = getFunctions();
assert(ECStack.size() > 1);
ExecutionContext &CallerFrame = *(ECStack.end() - 2);
std::unique_lock<sys::Mutex> Guard(Fns.Lock);

// Do a lookup to see if the function is in our cache... this should just be a
Expand All @@ -285,7 +283,8 @@ GenericValue Interpreter::callExternalFunction(Function *F,
if (ExFunc Fn = (FI == Fns.ExportedFunctions.end()) ? lookupFunction(F, LazyFunctionCreator)
: FI->second) {
Guard.unlock();
return Fn(F->getFunctionType(), ArgVals, CallerFrame.Caller->getAttributes());
AttributeList Attrs = ECStack.size() > 1 ? (ECStack.end() - 2)->Caller->getAttributes() : AttributeList();
return Fn(F->getFunctionType(), ArgVals, Attrs);
}

#ifdef USE_LIBFFI
Expand Down

0 comments on commit 0075044

Please sign in to comment.