Skip to content

Commit

Permalink
Address comments ykjit#1
Browse files Browse the repository at this point in the history
  • Loading branch information
ptersilie committed Aug 31, 2022
1 parent b75d0bc commit 3a22adb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ykllvmwrap/src/jitmodbuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ uint64_t getNewTraceIdx() {

#define YK_OUTLINE_FNATTR "yk_outline"

// The first two arguments of a stackmap call are it's id and shadow bytes and
// need to be skipped when scanning the operands for live values.
#define YK_STACKMAP_SKIP_ARGS 2

// Return value telling the caller of the compiled trace that no guard failure
// occurred and it's safe to continue running the fake trace stitching loop.
#define TRACE_RETURN_SUCCESS 0
Expand Down Expand Up @@ -612,13 +616,16 @@ class JITModBuilder {
for (size_t I = 0; I < ActiveFrames.size(); I++) {
FrameInfo FI = ActiveFrames[I];

// Read live AOT variables from stackmap calls and match them to
// variables in the JIT so we they can be optimised.
// Read live AOTMod values from stackmap calls and find their
// corresponding values in JITMod. These are exactly the values that are
// live at each guard failure and need to be deoptimised.
CallBase *SMC = FI.SMCall;
for (size_t Idx = 2; Idx < SMC->arg_size(); Idx++) {
for (size_t Idx = YK_STACKMAP_SKIP_ARGS; Idx < SMC->arg_size(); Idx++) {
Value *Arg = SMC->getArgOperand(Idx);
if (VMap.find(Arg) != VMap.end()) {
if (Arg == NewControlPointCall) {
// There's no corresponding JIT value for the return value of the
// control point call, so just skip it.
continue;
}
Value *JITArg = VMap[Arg];
Expand Down

0 comments on commit 3a22adb

Please sign in to comment.