summaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2016-05-14 23:53:51 -0700
committerJan Kotas <jkotas@microsoft.com>2016-05-14 23:53:51 -0700
commita3777d85f0c65a552b0f3d9e43035ffaca14261d (patch)
tree9682ef0ae1519a7d98cbcdea7f36bca59b0eb83e /src/jit
parentbd7549da15efca09231ac09091c7b8b1a9c29f17 (diff)
downloadcoreclr-a3777d85f0c65a552b0f3d9e43035ffaca14261d.tar.gz
coreclr-a3777d85f0c65a552b0f3d9e43035ffaca14261d.tar.bz2
coreclr-a3777d85f0c65a552b0f3d9e43035ffaca14261d.zip
Remove unneeded INLINE_NDIRECT and INLINE_PINVOKE #ifdefs (#4977)
Diffstat (limited to 'src/jit')
-rw-r--r--src/jit/codegenarm.cpp5
-rw-r--r--src/jit/codegenclassic.h4
-rw-r--r--src/jit/codegencommon.cpp10
-rw-r--r--src/jit/codegenlegacy.cpp56
-rw-r--r--src/jit/compiler.cpp2
-rw-r--r--src/jit/compiler.h6
-rw-r--r--src/jit/flowgraph.cpp5
-rw-r--r--src/jit/gentree.cpp5
-rw-r--r--src/jit/importer.cpp15
-rw-r--r--src/jit/jit.h2
-rw-r--r--src/jit/lclvars.cpp8
-rw-r--r--src/jit/liveness.cpp11
-rw-r--r--src/jit/lower.cpp22
-rw-r--r--src/jit/morph.cpp4
-rw-r--r--src/jit/regalloc.cpp2
15 files changed, 15 insertions, 142 deletions
diff --git a/src/jit/codegenarm.cpp b/src/jit/codegenarm.cpp
index a3f5a005a5..88925c272c 100644
--- a/src/jit/codegenarm.cpp
+++ b/src/jit/codegenarm.cpp
@@ -226,16 +226,13 @@ void CodeGen::genCodeForBBlist()
regSet.rsSetRegsModified(RBM_INT_CALLEE_SAVED & ~RBM_FPBASE);
}
-#if INLINE_NDIRECT
/* If we have any pinvoke calls, we might potentially trash everything */
- if (compiler->info.compCallUnmanaged)
+ if (compiler->info.compCallUnmanaged)
{
noway_assert(isFramePointerUsed()); // Setup of Pinvoke frame currently requires an EBP style frame
regSet.rsSetRegsModified(RBM_INT_CALLEE_SAVED & ~RBM_FPBASE);
}
-#endif // INLINE_NDIRECT
-
genPendingCallLabel = nullptr;
/* Initialize the pointer tracking code */
diff --git a/src/jit/codegenclassic.h b/src/jit/codegenclassic.h
index 26a95f4b90..988437ec66 100644
--- a/src/jit/codegenclassic.h
+++ b/src/jit/codegenclassic.h
@@ -64,8 +64,6 @@ protected:
// Prolog functions and data (there are a few exceptions for more generally used things)
//
-#if INLINE_NDIRECT
-
regMaskTP genPInvokeMethodProlog(regMaskTP initRegs);
void genPInvokeMethodEpilog();
@@ -78,8 +76,6 @@ protected:
void genPInvokeCallEpilog(LclVarDsc * varDsc,
regMaskTP retVal);
-#endif // INLINE_NDIRECT
-
regNumber genLclHeap (GenTreePtr size);
void genSinglePush ();
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index 027b19acea..7a9b9f9ef9 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -5068,10 +5068,8 @@ void CodeGen::genCheckUseBlockInit()
continue;
#if FEATURE_FIXED_OUT_ARGS
-#if INLINE_NDIRECT
if (varNum == compiler->lvaPInvokeFrameRegSaveVar)
continue;
-#endif
if (varNum == compiler->lvaOutgoingArgSpaceVar)
continue;
#endif
@@ -7744,14 +7742,12 @@ void CodeGen::genFinalizeFrame()
#endif // !_TARGET_AMD64_
}
-#if INLINE_NDIRECT
/* If we have any pinvoke calls, we might potentially trash everything */
if (compiler->info.compCallUnmanaged)
{
noway_assert(isFramePointerUsed()); // Setup of Pinvoke frame currently requires an EBP style frame
regSet.rsSetRegsModified(RBM_INT_CALLEE_SAVED & ~RBM_FPBASE);
}
-#endif // INLINE_NDIRECT
/* Count how many callee-saved registers will actually be saved (pushed) */
@@ -8187,7 +8183,6 @@ void CodeGen::genFnProlog()
regMaskTP excludeMask = intRegState.rsCalleeRegArgMaskLiveIn;
regMaskTP tempMask;
-#if INLINE_NDIRECT
// We should not use the special PINVOKE registers as the initReg
// since they are trashed by the jithelper call to setup the PINVOKE frame
if (compiler->info.compCallUnmanaged)
@@ -8210,7 +8205,6 @@ void CodeGen::genFnProlog()
}
}
}
-#endif // INLINE_NDIRECT
#ifdef _TARGET_ARM_
// If we have a variable sized frame (compLocallocUsed is true)
@@ -8471,14 +8465,14 @@ void CodeGen::genFnProlog()
genReportGenericContextArg(initReg, &initRegZeroed);
-#if INLINE_NDIRECT && defined(LEGACY_BACKEND) // in RyuJIT backend this has already been expanded into trees
+#if defined(LEGACY_BACKEND) // in RyuJIT backend this has already been expanded into trees
if (compiler->info.compCallUnmanaged)
{
getEmitter()->emitDisableRandomNops();
initRegs = genPInvokeMethodProlog(initRegs);
getEmitter()->emitEnableRandomNops();
}
-#endif // !(INLINE_NDIRECT && defined(LEGACY_BACKEND))
+#endif // defined(LEGACY_BACKEND)
// The local variable representing the security object must be on the stack frame
// and must be 0 initialized.
diff --git a/src/jit/codegenlegacy.cpp b/src/jit/codegenlegacy.cpp
index 0613d7fdb1..93a1956336 100644
--- a/src/jit/codegenlegacy.cpp
+++ b/src/jit/codegenlegacy.cpp
@@ -5341,8 +5341,6 @@ void CodeGen::genCodeForTreeLeaf_GT_JMP(GenTreePtr tree)
}
#endif // PROFILING_SUPPORTED
-#if INLINE_NDIRECT
-
/* This code is cloned from the regular processing of GT_RETURN values. We have to remember to
* call genPInvokeMethodEpilog anywhere that we have a method return. We should really
* generate trees for the PInvoke prolog and epilog so we can remove these special cases.
@@ -5353,8 +5351,6 @@ void CodeGen::genCodeForTreeLeaf_GT_JMP(GenTreePtr tree)
genPInvokeMethodEpilog();
}
-#endif
-
// Make sure register arguments are in their initial registers
// and stack arguments are put back as well.
//
@@ -9800,8 +9796,6 @@ void CodeGen::genCodeForTreeSmpOp(GenTreePtr tree,
case GT_RETURN:
-#if INLINE_NDIRECT
-
// TODO: this should be done AFTER we called exit mon so that
// we are sure that we don't have to keep 'this' alive
@@ -9814,8 +9808,6 @@ void CodeGen::genCodeForTreeSmpOp(GenTreePtr tree,
genPInvokeMethodEpilog();
}
-#endif
-
/* Is there a return value and/or an exit statement? */
if (op1)
@@ -12626,15 +12618,13 @@ void CodeGen::genCodeForBBlist()
regSet.rsSetRegsModified(RBM_INT_CALLEE_SAVED & ~RBM_FPBASE);
}
-#if INLINE_NDIRECT
/* If we have any pinvoke calls, we might potentially trash everything */
- if (compiler->info.compCallUnmanaged)
+ if (compiler->info.compCallUnmanaged)
{
noway_assert(isFramePointerUsed()); // Setup of Pinvoke frame currently requires an EBP style frame
regSet.rsSetRegsModified(RBM_INT_CALLEE_SAVED & ~RBM_FPBASE);
}
-#endif // INLINE_NDIRECT
/* Initialize the pointer tracking code */
@@ -15361,7 +15351,6 @@ USE_SAR_FOR_CAST:
case GT_RETURN:
-#if INLINE_NDIRECT
/* TODO:
* This code is cloned from the regular processing of GT_RETURN values. We have to remember to
* call genPInvokeMethodEpilog anywhere that we have a GT_RETURN statement. We should really
@@ -15380,8 +15369,6 @@ USE_SAR_FOR_CAST:
genPInvokeMethodEpilog();
}
-#endif
-
#if CPU_LONG_USES_REGPAIR
/* There must be a long return value */
@@ -15787,7 +15774,6 @@ void CodeGen::genCodeForTreeFlt(GenTreePtr tree,
if (tree->OperGet() == GT_RETURN)
{
//Make sure to get ALL THE EPILOG CODE
-#if INLINE_NDIRECT
// TODO: this should be done AFTER we called exit mon so that
// we are sure that we don't have to keep 'this' alive
@@ -15801,8 +15787,6 @@ void CodeGen::genCodeForTreeFlt(GenTreePtr tree,
genPInvokeMethodEpilog();
}
-#endif
-
//The profiling hook does not trash registers, so it's safe to call after we emit the code for
//the GT_RETURN tree.
#ifdef PROFILING_SUPPORTED
@@ -18958,9 +18942,7 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
unsigned saveStackLvl;
-#if INLINE_NDIRECT
BasicBlock * returnLabel = DUMMY_INIT(NULL);
-#endif
LclVarDsc * frameListRoot = NULL;
unsigned savCurIntArgReg;
@@ -19039,8 +19021,6 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
argSize = 0;
-#if INLINE_NDIRECT
-
/* We need to get a label for the return address with the proper stack depth. */
/* For the callee pops case (the default) that is before the args are pushed. */
@@ -19049,8 +19029,6 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
{
returnLabel = genCreateTempLabel();
}
-#endif
-
/*
Make sure to save the current argument register status
@@ -19070,8 +19048,6 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
argSize += genPushArgList(call);
}
-#if INLINE_NDIRECT
-
/* We need to get a label for the return address with the proper stack depth. */
/* For the caller pops case (cdecl) that is after the args are pushed. */
@@ -19083,7 +19059,6 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
/* Make sure that we now have a label */
noway_assert(returnLabel != DUMMY_INIT(NULL));
}
-#endif
if (callType == CT_INDIRECT)
{
@@ -19139,14 +19114,11 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
regMaskTP spillRegs = calleeTrashedRegs & regSet.rsMaskUsed;
-#if INLINE_NDIRECT
-
/* We need to save all GC registers to the InlinedCallFrame.
Instead, just spill them to temps. */
if (call->gtFlags & GTF_CALL_UNMANAGED)
spillRegs |= (gcInfo.gcRegGCrefSetCur|gcInfo.gcRegByrefSetCur) & regSet.rsMaskUsed;
-#endif
// Ignore fptrRegs as it is needed only to perform the indirect call
@@ -19756,7 +19728,6 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
#endif
}
-#if INLINE_NDIRECT
if (call->gtFlags & GTF_CALL_UNMANAGED)
{
//------------------------------------------------------
@@ -19905,7 +19876,6 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
// Done with PInvoke calls
break;
}
-#endif // INLINE_NDIRECT
if (callType == CT_INDIRECT)
{
@@ -20542,8 +20512,6 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
}
#endif // _TARGET_X86_
-#if INLINE_NDIRECT
-
if (call->gtFlags & GTF_CALL_UNMANAGED)
{
genDefineTempLabel(returnLabel);
@@ -20593,11 +20561,10 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
genDefineTempLabel(esp_check);
}
}
-#endif
/* Are we supposed to pop the arguments? */
-#if defined(_TARGET_X86_) && defined(INLINE_NDIRECT)
+#if defined(_TARGET_X86_)
if (call->gtFlags & GTF_CALL_UNMANAGED)
{
if ((compiler->opts.eeFlags & CORJIT_FLG_PINVOKE_RESTORE_ESP) ||
@@ -20637,7 +20604,7 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
}
}
}
-#endif // _TARGET_X86_ && INLINE_NDIRECT
+#endif // _TARGET_X86_
if (call->gtFlags & GTF_CALL_POP_ARGS)
{
@@ -20714,7 +20681,6 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
noway_assert(!"unexpected/unhandled fn return type");
}
-#if INLINE_NDIRECT
// We now have to generate the "call epilog" (if it was a call to unmanaged code).
/* if it is a call to unmanaged code, frameListRoot must be set */
@@ -20733,8 +20699,6 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
}
}
-#endif //INLINE_NDIRECT
-
#ifdef DEBUG
if (compiler->opts.compStackCheckOnCall
#if defined(USE_TRANSITION_THUNKS) || defined(USE_DYNAMIC_STACK_ALIGN)
@@ -21743,8 +21707,6 @@ GenTreePtr Compiler::fgLegacyPerStatementLocalVarLiveness(GenTreePtr startNode,
}
}
-#if INLINE_NDIRECT
-
// If this is a p/invoke unmanaged call or if this is a tail-call
// and we have an unmanaged p/invoke call in the method,
// then we're going to run the p/invoke epilog.
@@ -21769,8 +21731,6 @@ GenTreePtr Compiler::fgLegacyPerStatementLocalVarLiveness(GenTreePtr startNode,
}
}
-#endif // INLINE_NDIRECT
-
break;
default:
@@ -21810,7 +21770,6 @@ _return:
}
/*****************************************************************************/
-#if INLINE_NDIRECT
/*****************************************************************************
* Initialize the TCB local and the NDirect stub, afterwards "push"
@@ -22098,7 +22057,7 @@ void CodeGen::genPInvokeMethodEpilog()
{
if (compiler->rpMaskPInvokeEpilogIntf & RBM_PINVOKE_TCB)
{
-#if INLINE_NDIRECT && FEATURE_FIXED_OUT_ARGS
+#if FEATURE_FIXED_OUT_ARGS
// Save the register in the reserved local var slot.
getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_PINVOKE_TCB, compiler->lvaPInvokeFrameRegSaveVar, 0);
#else
@@ -22107,7 +22066,7 @@ void CodeGen::genPInvokeMethodEpilog()
}
if (compiler->rpMaskPInvokeEpilogIntf & RBM_PINVOKE_FRAME)
{
-#if INLINE_NDIRECT && FEATURE_FIXED_OUT_ARGS
+#if FEATURE_FIXED_OUT_ARGS
// Save the register in the reserved local var slot.
getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_PINVOKE_FRAME, compiler->lvaPInvokeFrameRegSaveVar, REGSIZE_BYTES);
#else
@@ -22175,7 +22134,7 @@ void CodeGen::genPInvokeMethodEpilog()
{
if (compiler->rpMaskPInvokeEpilogIntf & RBM_PINVOKE_FRAME)
{
-#if INLINE_NDIRECT && FEATURE_FIXED_OUT_ARGS
+#if FEATURE_FIXED_OUT_ARGS
// Restore the register from the reserved local var slot.
getEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, REG_PINVOKE_FRAME, compiler->lvaPInvokeFrameRegSaveVar, REGSIZE_BYTES);
#else
@@ -22185,7 +22144,7 @@ void CodeGen::genPInvokeMethodEpilog()
}
if (compiler->rpMaskPInvokeEpilogIntf & RBM_PINVOKE_TCB)
{
-#if INLINE_NDIRECT && FEATURE_FIXED_OUT_ARGS
+#if FEATURE_FIXED_OUT_ARGS
// Restore the register from the reserved local var slot.
getEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, REG_PINVOKE_TCB, compiler->lvaPInvokeFrameRegSaveVar, 0);
#else
@@ -22683,7 +22642,6 @@ void CodeGen::genPInvokeCallEpilog(LclVarDsc * frameListRoot,
}
/*****************************************************************************/
-#endif // INLINE_NDIRECT
/*****************************************************************************
* TRACKING OF FLAGS
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 08b6f0485b..f2d4dff93f 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -4753,10 +4753,8 @@ int Compiler::compCompileHelper (CORINFO_MODULE_HANDLE clas
}
info.compRetNativeType = info.compRetType = JITtype2varType(methodInfo->args.retType);
-#if INLINE_NDIRECT
info.compCallUnmanaged = 0;
info.compLvFrameListRoot = BAD_VAR_NUM;
-#endif
#if FEATURE_FIXED_OUT_ARGS
lvaOutgoingArgSpaceSize = 0;
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 50c90b669c..4c3c54824f 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -2218,13 +2218,11 @@ public :
unsigned lvaVarargsBaseOfStkArgs; // Pointer (computed based on incoming varargs handle) to the start of the stack arguments
#endif // _TARGET_X86_
-#if INLINE_NDIRECT
unsigned lvaInlinedPInvokeFrameVar; // variable representing the InlinedCallFrame
unsigned lvaReversePInvokeFrameVar; // variable representing the reverse PInvoke frame
#if FEATURE_FIXED_OUT_ARGS
unsigned lvaPInvokeFrameRegSaveVar; // variable representing the RegSave for PInvoke inlining.
#endif
-#endif
unsigned lvaMonAcquired; // boolean variable introduced into in synchronized methods
// that tracks whether the lock has been taken
@@ -2657,10 +2655,8 @@ protected :
unsigned mflags);
GenTreePtr impImportIndirectCall(CORINFO_SIG_INFO * sig,
IL_OFFSETX ilOffset = BAD_IL_OFFSET);
-#ifdef INLINE_NDIRECT
void impPopArgsForUnmanagedCall(GenTreePtr call,
CORINFO_SIG_INFO * sig);
-#endif // INLINE_NDIRECT
void impInsertHelperCall(CORINFO_HELPER_DESC * helperCall);
void impHandleAccessAllowed(CorInfoIsAccessAllowedResult result,
@@ -7819,10 +7815,8 @@ public :
UNATIVE_OFFSET compTotalHotCodeSize; // Total number of bytes of Hot Code in the method
UNATIVE_OFFSET compTotalColdCodeSize; // Total number of bytes of Cold Code in the method
-#if INLINE_NDIRECT
unsigned compCallUnmanaged; // count of unmanaged calls
unsigned compLvFrameListRoot; // lclNum for the Frame root
-#endif
unsigned compXcptnsCount; // Number of exception-handling clauses read in the method's IL.
// You should generally use compHndBBtabCount instead: it is the
// current number of EH clauses (after additions like synchronized
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index 6bd0155ea5..548977593d 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -7985,13 +7985,12 @@ void Compiler::fgAddInternal()
//
// We will generate just one epilog (return block)
// when we are asked to generate enter/leave callbacks
+ // or for methods with PInvoke
// or for methods calling into unmanaged code
// or for synchronized methods.
//
if ( compIsProfilerHookNeeded() ||
-#if INLINE_NDIRECT
(info.compCallUnmanaged != 0) ||
-#endif
opts.IsReversePInvoke() ||
((info.compFlags & CORINFO_FLG_SYNCH) != 0))
{
@@ -8185,7 +8184,6 @@ void Compiler::fgAddInternal()
genReturnLocal = BAD_VAR_NUM;
}
-#if INLINE_NDIRECT
if (info.compCallUnmanaged != 0)
{
// The P/Invoke helpers only require a frame variable, so only allocate the
@@ -8215,7 +8213,6 @@ void Compiler::fgAddInternal()
}
#endif
}
-#endif
// Do we need to insert a "JustMyCode" callback?
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index e907d5009e..8d7296a3a1 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -499,7 +499,6 @@ Compiler::fgWalkResult Compiler::fgWalkTreePreRec(GenTreePtr *pTree, fgWalk
assert(tree->gtFlags & GTF_CALL);
-#if INLINE_NDIRECT
/* Is this a call to unmanaged code ? */
if (fgWalkData->wtprLclsOnly && (tree->gtFlags & GTF_CALL_UNMANAGED))
{
@@ -507,7 +506,7 @@ Compiler::fgWalkResult Compiler::fgWalkTreePreRec(GenTreePtr *pTree, fgWalk
if (result == WALK_ABORT)
return result;
}
-#endif
+
if (tree->gtCall.gtCallObjp)
{
result = fgWalkTreePreRec<computeStack>(&tree->gtCall.gtCallObjp, fgWalkData);
@@ -7969,10 +7968,8 @@ void Compiler::gtGetLclVarNameInfo(unsigned lclNum, const char**
else if (lclNum == lvaGSSecurityCookie)
ilName = "GsCookie";
#if FEATURE_FIXED_OUT_ARGS
-#if INLINE_NDIRECT
else if (lclNum == lvaPInvokeFrameRegSaveVar)
ilName = "PInvokeFrameRegSave";
-#endif // INLINE_NDIRECT
else if (lclNum == lvaOutgoingArgSpaceVar)
ilName = "OutArgs";
#endif // FEATURE_FIXED_OUT_ARGS
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index d16b72b7c9..52604b5136 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -4762,9 +4762,6 @@ GenTreePtr Compiler::impTransformThis (GenTreePtr thisPtr,
}
}
-/*****************************************************************************/
-#if defined(INLINE_NDIRECT)
-/*****************************************************************************/
bool Compiler::impCanPInvokeInline(var_types callRetTyp)
{
@@ -4901,9 +4898,6 @@ void Compiler::impCheckForPInvokeCall(
call->gtCall.gtCallMoreFlags |= GTF_CALL_M_UNMGD_THISCALL;
}
-/*****************************************************************************/
-#endif // INLINE_NDIRECT
-/*****************************************************************************/
GenTreePtr Compiler::impImportIndirectCall(CORINFO_SIG_INFO * sig, IL_OFFSETX ilOffset)
{
@@ -4944,8 +4938,6 @@ GenTreePtr Compiler::impImportIndirectCall(CORINFO_SIG_INFO * sig, IL_O
/*****************************************************************************/
-#ifdef INLINE_NDIRECT
-
void Compiler::impPopArgsForUnmanagedCall(
GenTreePtr call,
CORINFO_SIG_INFO * sig)
@@ -5029,7 +5021,6 @@ void Compiler::impPopArgsForUnmanagedCall(
call->gtFlags |= args->gtFlags & GTF_GLOB_EFFECT;
}
-#endif // INLINE_NDIRECT
//------------------------------------------------------------------------
// impInitClass: Build a node to initialize the class before accessing the
@@ -6261,8 +6252,6 @@ var_types Compiler::impImportCall (OPCODE opcode,
//--------------------------- Inline NDirect ------------------------------
-#if defined(INLINE_NDIRECT)
-
if (!compIsForInlining())
{
impCheckForPInvokeCall(call, methHnd, sig, mflags);
@@ -6284,9 +6273,7 @@ var_types Compiler::impImportCall (OPCODE opcode,
goto DONE;
}
- else
-#endif //INLINE_NDIRECT
- if ((opcode == CEE_CALLI) &&
+ else if ((opcode == CEE_CALLI) &&
(
((sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_STDCALL) ||
((sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_C) ||
diff --git a/src/jit/jit.h b/src/jit/jit.h
index 500ccfd790..f5bae93123 100644
--- a/src/jit/jit.h
+++ b/src/jit/jit.h
@@ -407,8 +407,6 @@ typedef ptrdiff_t ssize_t;
//=============================================================================
#define REDUNDANT_LOAD 1 // track locals in regs, suppress loads
-#define INLINE_PINVOKE 1 // try to inline P/Invoke stubs
-#define INLINE_NDIRECT INLINE_PINVOKE // ndirect is an archaic name for pinvoke
#define LONG_MATH_REGPARAM 0 // args to long mul/div passed in registers
#define STACK_PROBES 0 // Support for stack probes
#define DUMP_FLOWGRAPHS DEBUG // Support for creating Xml Flowgraph reports in *.fgx files
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index bd37512f71..8782863139 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -48,9 +48,7 @@ void Compiler::lvaInit()
lvaInlinedPInvokeFrameVar = BAD_VAR_NUM;
lvaReversePInvokeFrameVar = BAD_VAR_NUM;
#if FEATURE_FIXED_OUT_ARGS
-#if INLINE_NDIRECT
lvaPInvokeFrameRegSaveVar = BAD_VAR_NUM;
-#endif // !INLINE_NDIRECT
lvaOutgoingArgSpaceVar = BAD_VAR_NUM;
#endif // FEATURE_FIXED_OUT_ARGS
#ifdef _TARGET_ARM_
@@ -2838,7 +2836,6 @@ var_types LclVarDsc::lvaArgType()
void Compiler::lvaMarkLclRefs(GenTreePtr tree)
{
-#if INLINE_NDIRECT
/* Is this a call to unmanaged code ? */
if (tree->gtOper == GT_CALL && tree->gtFlags & GTF_CALL_UNMANAGED)
{
@@ -2857,7 +2854,6 @@ void Compiler::lvaMarkLclRefs(GenTreePtr tree)
varDsc->incRefCnts(lvaMarkRefsWeight, this);
}
}
-#endif
/* Is this an assigment? */
@@ -3199,9 +3195,6 @@ void Compiler::lvaMarkLocalVars()
printf("\n*************** In lvaMarkLocalVars()");
#endif
-
-#if INLINE_NDIRECT
-
/* If there is a call to an unmanaged target, we already grabbed a
local slot for the current thread control block.
*/
@@ -3222,7 +3215,6 @@ void Compiler::lvaMarkLocalVars()
lvaTable[info.compLvFrameListRoot].lvRefCntWtd = 2 * BB_UNITY_WEIGHT;
}
}
-#endif
lvaAllocOutgoingArgSpace();
diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp
index 306577e428..16deb27a67 100644
--- a/src/jit/liveness.cpp
+++ b/src/jit/liveness.cpp
@@ -427,8 +427,6 @@ void Compiler::fgPerStatementLocalVarLiveness(GenTreePtr startNode, GenTreePtr a
}
}
-#if INLINE_NDIRECT
-
// If this is a p/invoke unmanaged call or if this is a tail-call
// and we have an unmanaged p/invoke call in the method,
// then we're going to run the p/invoke epilog.
@@ -457,8 +455,6 @@ void Compiler::fgPerStatementLocalVarLiveness(GenTreePtr startNode, GenTreePtr a
}
}
-#endif // INLINE_NDIRECT
-
break;
default:
@@ -628,8 +624,6 @@ void Compiler::fgPerBlockLocalVarLiveness()
#endif // LEGACY_BACKEND
}
-#if INLINE_NDIRECT
-
/* Get the TCB local and mark it as used */
if (block->bbJumpKind == BBJ_RETURN && info.compCallUnmanaged)
@@ -651,8 +645,6 @@ void Compiler::fgPerBlockLocalVarLiveness()
}
}
-#endif // INLINE_NDIRECT
-
#ifdef DEBUG
if (verbose)
{
@@ -1742,8 +1734,6 @@ SKIP_QMARK:
if (tree->gtOper == GT_CALL)
{
-#if INLINE_NDIRECT
-
// if this is a tail-call and we have any unmanaged p/invoke calls in
// the method then we're going to run the p/invoke epilog
// So we mark the FrameRoot as used by this instruction.
@@ -1854,7 +1844,6 @@ SKIP_QMARK:
}
}
}
-#endif // INLINE_NDIRECT
}
// Is this a use/def of a local variable?
diff --git a/src/jit/lower.cpp b/src/jit/lower.cpp
index 060032c4f1..1df4f3bbcd 100644
--- a/src/jit/lower.cpp
+++ b/src/jit/lower.cpp
@@ -1679,27 +1679,19 @@ void Lowering::LowerCall(GenTree* node)
break;
case GTF_CALL_NONVIRT:
- {
-
-#if INLINE_PINVOKE
if (call->IsUnmanaged())
{
result = LowerNonvirtPinvokeCall(call);
- break;
}
-#endif
- if (call->gtCallType == CT_INDIRECT)
+ else if (call->gtCallType == CT_INDIRECT)
{
result = LowerIndirectNonvirtCall(call);
- break;
}
else
{
result = LowerDirectCall(call);
- break;
}
- }
- break;
+ break;
default:
noway_assert(!"strange call type");
@@ -1996,14 +1988,12 @@ void Lowering::LowerFastTailCall(GenTreeCall *call)
// fgLastBB with block number > loop header block number.
//assert((comp->compCurBB->bbFlags & BBF_GC_SAFE_POINT) || !comp->optReachWithoutCall(comp->fgFirstBB, comp->compCurBB) || comp->genInterruptible);
-#if INLINE_PINVOKE
// If PInvokes are in-lined, we have to remember to execute PInvoke method epilog anywhere that
// a method returns. This is a case of caller method has both PInvokes and tail calls.
if (comp->info.compCallUnmanaged)
{
InsertPInvokeMethodEpilog(comp->compCurBB DEBUGARG(call));
}
-#endif
// Args for tail call are setup in incoming arg area. The gc-ness of args of
// caller and callee (which being tail called) may not match. Therefore, everything
@@ -2237,14 +2227,12 @@ GenTree* Lowering::LowerTailCallViaHelper(GenTreeCall* call, GenTree *callTarget
// GC starvation.
assert(comp->compCurBB->bbFlags & BBF_GC_SAFE_POINT);
-#if INLINE_PINVOKE
// If PInvokes are in-lined, we have to remember to execute PInvoke method epilog anywhere that
// a method returns. This is a case of caller method has both PInvokes and tail calls.
if (comp->info.compCallUnmanaged)
{
InsertPInvokeMethodEpilog(comp->compCurBB DEBUGARG(call));
}
-#endif
// Remove gtCallAddr from execution order if one present.
GenTreeStmt* callStmt = comp->compCurStmt->AsStmt();
@@ -2306,14 +2294,12 @@ void Lowering::LowerJmpMethod(GenTree* jmp)
DISPTREE(jmp);
JITDUMP("============");
-#if INLINE_PINVOKE
// If PInvokes are in-lined, we have to remember to execute PInvoke method epilog anywhere that
// a method returns.
if (comp->info.compCallUnmanaged)
{
InsertPInvokeMethodEpilog(comp->compCurBB DEBUGARG(jmp));
}
-#endif
}
// Lower GT_RETURN node to insert PInvoke method epilog if required.
@@ -2325,13 +2311,11 @@ void Lowering::LowerRet(GenTree* ret)
DISPTREE(ret);
JITDUMP("============");
-#if INLINE_PINVOKE
// Method doing PInvokes has exactly one return block unless it has tail calls.
if (comp->info.compCallUnmanaged && (comp->compCurBB == comp->genReturnBB))
{
InsertPInvokeMethodEpilog(comp->compCurBB DEBUGARG(ret));
}
-#endif
}
GenTree* Lowering::LowerDirectCall(GenTreeCall* call)
@@ -3994,7 +3978,6 @@ void Lowering::DoPhase()
}
}
-#if INLINE_PINVOKE
// If we have any PInvoke calls, insert the one-time prolog code. We've already inserted the epilog code in the appropriate spots.
// NOTE: there is a minor optimization opportunity here, as we still create p/invoke data structures and setup/teardown
// even if we've eliminated all p/invoke calls due to dead code elimination.
@@ -4002,7 +3985,6 @@ void Lowering::DoPhase()
{
InsertPInvokeMethodProlog();
}
-#endif
#ifdef DEBUG
JITDUMP("Lower has completed modifying nodes, proceeding to initialize LSRA TreeNodeInfo structs...\n");
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 5cb2008953..2dbadfc93d 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -2868,7 +2868,6 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* callNode)
maxRegArgs++;
}
-#if INLINE_NDIRECT
if (call->IsUnmanaged())
{
noway_assert(intArgRegNum == 0);
@@ -2889,7 +2888,6 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* callNode)
if (callHasRetBuffArg)
maxRegArgs++;
}
-#endif // INLINE_NDIRECT
#endif // _TARGET_X86_
/* Morph the user arguments */
@@ -14716,12 +14714,10 @@ void Compiler::fgSetOptions()
codeGen->setFramePointerRequiredGCInfo(true);
}
-#if INLINE_NDIRECT
if (info.compCallUnmanaged)
{
codeGen->setFramePointerRequired(true); // Setup of Pinvoke frame currently requires an EBP style frame
}
-#endif
if (info.compPublishStubParam)
{
diff --git a/src/jit/regalloc.cpp b/src/jit/regalloc.cpp
index 867a0ac5bc..4d10ea0274 100644
--- a/src/jit/regalloc.cpp
+++ b/src/jit/regalloc.cpp
@@ -4896,7 +4896,6 @@ HANDLE_SHIFT_COUNT:
lockedRegs | regArgMask);
}
-#if INLINE_NDIRECT
if (tree->gtFlags & GTF_CALL_UNMANAGED)
{
// Need a register for tcbReg
@@ -4906,7 +4905,6 @@ HANDLE_SHIFT_COUNT:
callAddrMask |= rpPredictRegPick(TYP_I_IMPL, PREDICT_SCRATCH_REG, lockedRegs | regArgMask | callAddrMask);
#endif
}
-#endif
tree->gtUsedRegs |= callAddrMask;