Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interpreter: check if parent stackframe exists #215

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading