Skip to content

Commit

Permalink
Keep x86 tail call via jit helper as a virtual stub call.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Andreenko committed Nov 10, 2020
1 parent 007f31f commit 8663da9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/coreclr/src/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ void Compiler::optAssertionGen(GenTree* tree)
// with a GTF_CALL_NULLCHECK flag set.
// Ignore tail calls because they have 'this` pointer in the regular arg list and an implicit null check.
GenTreeCall* const call = tree->AsCall();
if (call->NeedsNullCheck() || call->IsVirtual())
if (call->NeedsNullCheck() || (call->IsVirtual() && !call->IsTailCall()))
{
// Retrieve the 'this' arg.
GenTree* thisArg = gtGetThisArg(call);
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/src/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8435,6 +8435,10 @@ void Compiler::fgMorphTailCallViaJitHelper(GenTreeCall* call)
thisPtr = objp;
}

// TODO-Cleanup: we leave it as a virtual stub call to
// use logic in `LowerVirtualStubCall`, clear GTF_CALL_VIRT_KIND_MASK here
// and change `LowerCall` to recognize it as a direct call.

// During rationalization tmp="this" and null check will
// materialize as embedded stmts in right execution order.
assert(thisPtr != nullptr);
Expand Down

0 comments on commit 8663da9

Please sign in to comment.