summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Andreenko <seandree@microsoft.com>2017-10-23 20:45:04 -0700
committerJan Kotas <jkotas@microsoft.com>2017-10-23 20:45:04 -0700
commit2207dadf19fc976c6ccd04e12d46924a7b733457 (patch)
tree1f77037dfd1c3c32cc2ab85c725dbf52757e65ad /src
parent5d66791a3a1932d2afcd3ef58dd0df91323662cb (diff)
downloadcoreclr-2207dadf19fc976c6ccd04e12d46924a7b733457.tar.gz
coreclr-2207dadf19fc976c6ccd04e12d46924a7b733457.tar.bz2
coreclr-2207dadf19fc976c6ccd04e12d46924a7b733457.zip
Report registers as dead in GCInfo before the RhpPInvoke helper. (#14664)
* move killGCRefs to the compiler It makes it accessible from codegen. * use killGCRefs in codeGen It terminates live of GCRefs before RhpPInvoke. * small ref
Diffstat (limited to 'src')
-rw-r--r--src/jit/codegenarmarch.cpp2
-rw-r--r--src/jit/codegenxarch.cpp2
-rw-r--r--src/jit/compiler.cpp30
-rw-r--r--src/jit/compiler.h2
-rw-r--r--src/jit/lsra.cpp31
-rw-r--r--src/jit/lsra.h2
6 files changed, 35 insertions, 34 deletions
diff --git a/src/jit/codegenarmarch.cpp b/src/jit/codegenarmarch.cpp
index 38803054b9..56cad32bf0 100644
--- a/src/jit/codegenarmarch.cpp
+++ b/src/jit/codegenarmarch.cpp
@@ -2265,7 +2265,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
// the GC pointer state before the callsite.
// We can't utilize the typical lazy killing of GC pointers
// at (or inside) the callsite.
- if (call->IsUnmanaged())
+ if (compiler->killGCRefs(call))
{
genDefineTempLabel(genCreateTempLabel());
}
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index 7da42ce7e5..f1730b9999 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -5283,7 +5283,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
// the GC pointer state before the callsite.
// We can't utilize the typical lazy killing of GC pointers
// at (or inside) the callsite.
- if (call->IsUnmanaged())
+ if (compiler->killGCRefs(call))
{
genDefineTempLabel(genCreateTempLabel());
}
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index b8877f22f5..5c20a87e5f 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -11391,3 +11391,33 @@ HelperCallProperties Compiler::s_helperCallProperties;
/*****************************************************************************/
/*****************************************************************************/
+
+//------------------------------------------------------------------------
+// killGCRefs:
+// Given some tree node return does it need all GC refs to be spilled from
+// callee save registers.
+//
+// Arguments:
+// tree - the tree for which we ask about gc refs.
+//
+// Return Value:
+// true - tree kills GC refs on callee save registers
+// false - tree doesn't affect GC refs on callee save registers
+bool Compiler::killGCRefs(GenTreePtr tree)
+{
+ if (tree->IsCall())
+ {
+ GenTreeCall* call = tree->AsCall();
+ if (call->IsUnmanaged())
+ {
+ return true;
+ }
+
+ if (call->gtCallMethHnd == eeFindHelper(CORINFO_HELP_JIT_PINVOKE_BEGIN))
+ {
+ assert(opts.ShouldUsePInvokeHelpers());
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 3ff6375a57..6a64a7b648 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -9564,6 +9564,8 @@ public:
void fgMorphMultiregStructArgs(GenTreeCall* call);
GenTreePtr fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr fgEntryPtr);
+ bool killGCRefs(GenTreePtr tree);
+
}; // end of class Compiler
// Inline methods of CompAllocator.
diff --git a/src/jit/lsra.cpp b/src/jit/lsra.cpp
index c6a999fc95..c2258f0646 100644
--- a/src/jit/lsra.cpp
+++ b/src/jit/lsra.cpp
@@ -3083,7 +3083,7 @@ bool LinearScan::buildKillPositionsForNode(GenTree* tree, LsraLocation currentLo
}
}
- if (killGCRefs(tree))
+ if (compiler->killGCRefs(tree))
{
RefPosition* pos = newRefPosition((Interval*)nullptr, currentLoc, RefTypeKillGCRefs, tree,
(allRegs(TYP_REF) & ~RBM_ARG_REGS));
@@ -3094,35 +3094,6 @@ bool LinearScan::buildKillPositionsForNode(GenTree* tree, LsraLocation currentLo
return false;
}
-//------------------------------------------------------------------------
-// killGCRefs:
-// Given some tree node return does it need all GC refs to be spilled from
-// callee save registers.
-//
-// Arguments:
-// tree - the tree for which we ask about gc refs.
-//
-// Return Value:
-// true - tree kills GC refs on callee save registers
-// false - tree doesn't affect GC refs on callee save registers
-bool LinearScan::killGCRefs(GenTree* tree)
-{
- if (tree->IsCall())
- {
- if ((tree->gtFlags & GTF_CALL_UNMANAGED) != 0)
- {
- return true;
- }
-
- if (tree->AsCall()->gtCallMethHnd == compiler->eeFindHelper(CORINFO_HELP_JIT_PINVOKE_BEGIN))
- {
- assert(compiler->opts.ShouldUsePInvokeHelpers());
- return true;
- }
- }
- return false;
-}
-
//----------------------------------------------------------------------------
// defineNewInternalTemp: Defines a ref position for an internal temp.
//
diff --git a/src/jit/lsra.h b/src/jit/lsra.h
index fed5d6ea86..55ebe5e8d5 100644
--- a/src/jit/lsra.h
+++ b/src/jit/lsra.h
@@ -772,8 +772,6 @@ private:
// Given some tree node add refpositions for all the registers this node kills
bool buildKillPositionsForNode(GenTree* tree, LsraLocation currentLoc);
- bool killGCRefs(GenTree* tree);
-
regMaskTP allRegs(RegisterType rt);
regMaskTP allRegs(GenTree* tree);
regMaskTP allMultiRegCallNodeRegs(GenTreeCall* tree);