Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit a480afb

Browse files
committed
Clean up GTF_CALL_VIRT_KIND_MASK and related usage
Use the existing accessor functions instead of checking the bits directly.
1 parent 30d20fd commit a480afb

File tree

6 files changed

+23
-31
lines changed

6 files changed

+23
-31
lines changed

src/jit/assertionprop.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2093,7 +2093,7 @@ void Compiler::optAssertionGen(GenTreePtr tree)
20932093
case GT_CALL:
20942094
// A virtual call can create a non-null assertion. We transform some virtual calls into non-virtual calls
20952095
// with a GTF_CALL_NULLCHECK flag set.
2096-
if ((tree->gtFlags & GTF_CALL_NULLCHECK) || ((tree->gtFlags & GTF_CALL_VIRT_KIND_MASK) != GTF_CALL_NONVIRT))
2096+
if ((tree->gtFlags & GTF_CALL_NULLCHECK) || tree->AsCall()->IsVirtual())
20972097
{
20982098
// Retrieve the 'this' arg
20992099
GenTreePtr thisArg = gtGetThisArg(tree->AsCall());

src/jit/codegenlegacy.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18277,8 +18277,7 @@ regMaskTP CodeGen::genCodeForCall(GenTreeCall* call, bool valUsed)
1827718277
#endif
1827818278

1827918279
#ifdef _TARGET_ARM_
18280-
if (compiler->opts.ShouldUsePInvokeHelpers() && (call->gtFlags & GTF_CALL_UNMANAGED) &&
18281-
((call->gtFlags & GTF_CALL_VIRT_KIND_MASK) == GTF_CALL_NONVIRT))
18280+
if (compiler->opts.ShouldUsePInvokeHelpers() && (call->gtFlags & GTF_CALL_UNMANAGED) && !call->IsVirtual())
1828218281
{
1828318282
(void)genPInvokeCallProlog(nullptr, 0, (CORINFO_METHOD_HANDLE) nullptr, nullptr);
1828418283
}

src/jit/compiler.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7371,7 +7371,7 @@ void Compiler::compCallArgStats()
73717371
regArgDeferred++;
73727372
argTotalObjPtr++;
73737373

7374-
if (call->gtFlags & (GTF_CALL_VIRT_VTABLE | GTF_CALL_VIRT_STUB))
7374+
if (call->IsVirtual())
73757375
{
73767376
/* virtual function */
73777377
argVirtualCalls++;
@@ -9732,15 +9732,15 @@ int cTreeFlagsIR(Compiler* comp, GenTree* tree)
97329732
{
97339733
chars += printf("[CALL_INLINE_CANDIDATE]");
97349734
}
9735-
if (tree->gtFlags & GTF_CALL_NONVIRT)
9735+
if (!tree->AsCall()->IsVirtual())
97369736
{
97379737
chars += printf("[CALL_NONVIRT]");
97389738
}
9739-
if (tree->gtFlags & GTF_CALL_VIRT_VTABLE)
9739+
if (tree->AsCall()->IsVirtualVtable())
97409740
{
97419741
chars += printf("[CALL_VIRT_VTABLE]");
97429742
}
9743-
if (tree->gtFlags & GTF_CALL_VIRT_STUB)
9743+
if (tree->AsCall()->IsVirtualStub())
97449744
{
97459745
chars += printf("[CALL_VIRT_STUB]");
97469746
}

src/jit/gentree.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4712,7 +4712,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
47124712
else
47134713
{
47144714
#ifdef _TARGET_ARM_
4715-
if ((tree->gtFlags & GTF_CALL_VIRT_KIND_MASK) == GTF_CALL_VIRT_STUB)
4715+
if (tree->gtCall.IsVirtualStub())
47164716
{
47174717
// We generate movw/movt/ldr
47184718
costEx += (1 + IND_COST_EX);
@@ -4737,20 +4737,17 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
47374737

47384738
level += 1;
47394739

4740-
unsigned callKind;
4741-
callKind = (tree->gtFlags & GTF_CALL_VIRT_KIND_MASK);
4742-
47434740
/* Virtual calls are a bit more expensive */
4744-
if (callKind != GTF_CALL_NONVIRT)
4741+
if (tree->gtCall.IsVirtual())
47454742
{
47464743
costEx += 2 * IND_COST_EX;
47474744
costSz += 2;
4748-
}
47494745

4750-
/* Virtual stub calls also must reserve the VIRTUAL_STUB_PARAM reg */
4751-
if (callKind == GTF_CALL_VIRT_STUB)
4752-
{
4753-
ftreg |= virtualStubParamInfo->GetRegMask();
4746+
/* Virtual stub calls also must reserve the VIRTUAL_STUB_PARAM reg */
4747+
if (tree->gtCall.IsVirtualStub())
4748+
{
4749+
ftreg |= virtualStubParamInfo->GetRegMask();
4750+
}
47544751
}
47554752

47564753
#ifdef FEATURE_READYTORUN_COMPILER
@@ -8023,7 +8020,7 @@ GenTreePtr Compiler::gtCloneExpr(
80238020
? gtCloneExpr(tree->gtCall.gtCallAddr, addFlags, deepVarNum, deepVarVal)
80248021
: nullptr;
80258022
}
8026-
else if (tree->gtFlags & GTF_CALL_VIRT_STUB)
8023+
else if (tree->gtCall.IsVirtualStub())
80278024
{
80288025
copy->gtCall.gtCallMethHnd = tree->gtCall.gtCallMethHnd;
80298026
copy->gtCall.gtStubCallStubAddr = tree->gtCall.gtStubCallStubAddr;
@@ -9700,7 +9697,7 @@ void Compiler::gtDispNodeName(GenTree* tree)
97009697

97019698
if (tree->gtCall.gtCallType == CT_USER_FUNC)
97029699
{
9703-
if ((tree->gtFlags & GTF_CALL_VIRT_KIND_MASK) != GTF_CALL_NONVIRT)
9700+
if (tree->gtCall.IsVirtual())
97049701
{
97059702
callType = "CALLV";
97069703
}
@@ -9722,11 +9719,11 @@ void Compiler::gtDispNodeName(GenTree* tree)
97229719
{
97239720
gtfType = " nullcheck";
97249721
}
9725-
if (tree->gtFlags & GTF_CALL_VIRT_VTABLE)
9722+
if (tree->gtCall.IsVirtualVtable())
97269723
{
97279724
gtfType = " ind";
97289725
}
9729-
else if (tree->gtFlags & GTF_CALL_VIRT_STUB)
9726+
else if (tree->gtCall.IsVirtualStub())
97309727
{
97319728
gtfType = " stub";
97329729
}

src/jit/importer.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7888,7 +7888,7 @@ var_types Compiler::impImportCall(OPCODE opcode,
78887888
call->gtCall.gtCallObjp = obj;
78897889

78907890
// Is this a virtual or interface call?
7891-
if ((call->gtFlags & GTF_CALL_VIRT_KIND_MASK) != GTF_CALL_NONVIRT)
7891+
if (call->gtCall.IsVirtual())
78927892
{
78937893
// only true object pointers can be virtual
78947894
assert(obj->gtType == TYP_REF);
@@ -8039,10 +8039,8 @@ var_types Compiler::impImportCall(OPCODE opcode,
80398039
if (canTailCall)
80408040
{
80418041
// True virtual or indirect calls, shouldn't pass in a callee handle.
8042-
CORINFO_METHOD_HANDLE exactCalleeHnd = ((call->gtCall.gtCallType != CT_USER_FUNC) ||
8043-
((call->gtFlags & GTF_CALL_VIRT_KIND_MASK) != GTF_CALL_NONVIRT))
8044-
? nullptr
8045-
: methHnd;
8042+
CORINFO_METHOD_HANDLE exactCalleeHnd =
8043+
((call->gtCall.gtCallType != CT_USER_FUNC) || call->gtCall.IsVirtual()) ? nullptr : methHnd;
80468044
GenTreePtr thisArg = call->gtCall.gtCallObjp;
80478045

80488046
if (info.compCompHnd->canTailCall(info.compMethodHnd, methHnd, exactCalleeHnd, explicitTailCall))
@@ -8149,9 +8147,7 @@ var_types Compiler::impImportCall(OPCODE opcode,
81498147
GenTreePtr callObj = call->gtCall.gtCallObjp;
81508148
assert(callObj != nullptr);
81518149

8152-
unsigned callKind = call->gtFlags & GTF_CALL_VIRT_KIND_MASK;
8153-
8154-
if (((callKind != GTF_CALL_NONVIRT) || (call->gtFlags & GTF_CALL_NULLCHECK)) &&
8150+
if ((call->gtCall.IsVirtual() || (call->gtFlags & GTF_CALL_NULLCHECK)) &&
81558151
impInlineIsGuaranteedThisDerefBeforeAnySideEffects(call->gtCall.gtCallArgs, callObj,
81568152
impInlineInfo->inlArgInfo))
81578153
{
@@ -18901,7 +18897,7 @@ void Compiler::impMarkInlineCandidate(GenTreePtr callNode,
1890118897
return;
1890218898
}
1890318899

18904-
if ((call->gtFlags & GTF_CALL_VIRT_KIND_MASK) != GTF_CALL_NONVIRT)
18900+
if (call->IsVirtual())
1890518901
{
1890618902
inlineResult.NoteFatal(InlineObservation::CALLSITE_IS_NOT_DIRECT);
1890718903
return;

src/jit/lower.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4087,7 +4087,7 @@ GenTree* Lowering::LowerVirtualVtableCall(GenTreeCall* call)
40874087
// Lower stub dispatched virtual calls.
40884088
GenTree* Lowering::LowerVirtualStubCall(GenTreeCall* call)
40894089
{
4090-
assert((call->gtFlags & GTF_CALL_VIRT_KIND_MASK) == GTF_CALL_VIRT_STUB);
4090+
assert(call->IsVirtualStub());
40914091

40924092
// An x86 JIT which uses full stub dispatch must generate only
40934093
// the following stub dispatch calls:

0 commit comments

Comments
 (0)