summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2019-04-17 14:23:11 -0700
committerGitHub <noreply@github.com>2019-04-17 14:23:11 -0700
commitea12523aaca4f8dd2f2e877d0998b72d9a34de91 (patch)
treee59f063173a18c2bbbbc8fb6fb9bc4ddbdfce7eb /src
parent4f00e74c1c884060511a85ed71926aef85d830fc (diff)
downloadcoreclr-ea12523aaca4f8dd2f2e877d0998b72d9a34de91.tar.gz
coreclr-ea12523aaca4f8dd2f2e877d0998b72d9a34de91.tar.bz2
coreclr-ea12523aaca4f8dd2f2e877d0998b72d9a34de91.zip
JIT: ignore pinning of non-gc types (#24010)
We may see pin modifiers on locals that are not gc types. Ignore these modifiers. Closes #23950. Also added a missing copyright header on an unrelated test.
Diffstat (limited to 'src')
-rw-r--r--src/jit/importer.cpp24
-rw-r--r--src/jit/lclvars.cpp14
2 files changed, 28 insertions, 10 deletions
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 78c0b4fde0..db6b6df571 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -18932,22 +18932,28 @@ void Compiler::impInlineInitVars(InlineInfo* pInlineInfo)
var_types type = (var_types)eeGetArgType(localsSig, &methInfo->locals, &isPinned);
lclVarInfo[i + argCnt].lclHasLdlocaOp = false;
- lclVarInfo[i + argCnt].lclIsPinned = isPinned;
lclVarInfo[i + argCnt].lclTypeInfo = type;
if (varTypeIsGC(type))
{
+ if (isPinned)
+ {
+ JITDUMP("Inlinee local #%02u is pinned\n", i);
+ lclVarInfo[i + argCnt].lclIsPinned = true;
+
+ // Pinned locals may cause inlines to fail.
+ inlineResult->Note(InlineObservation::CALLEE_HAS_PINNED_LOCALS);
+ if (inlineResult->IsFailure())
+ {
+ return;
+ }
+ }
+
pInlineInfo->numberOfGcRefLocals++;
}
-
- if (isPinned)
+ else if (isPinned)
{
- // Pinned locals may cause inlines to fail.
- inlineResult->Note(InlineObservation::CALLEE_HAS_PINNED_LOCALS);
- if (inlineResult->IsFailure())
- {
- return;
- }
+ JITDUMP("Ignoring pin on inlinee local #%02u -- not a GC type\n", i);
}
lclVarInfo[i + argCnt].lclVerTypeInfo = verParseArgSigToTypeInfo(&methInfo->locals, localsSig);
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index 515e9348c0..6b26b5de12 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -255,7 +255,19 @@ void Compiler::lvaInitTypeRef()
lvaInitVarDsc(varDsc, varNum, corInfoType, typeHnd, localsSig, &info.compMethodInfo->locals);
- varDsc->lvPinned = ((corInfoTypeWithMod & CORINFO_TYPE_MOD_PINNED) != 0);
+ if ((corInfoTypeWithMod & CORINFO_TYPE_MOD_PINNED) != 0)
+ {
+ if ((corInfoType == CORINFO_TYPE_CLASS) || (corInfoType == CORINFO_TYPE_BYREF))
+ {
+ JITDUMP("Setting lvPinned for V%02u\n", varNum);
+ varDsc->lvPinned = 1;
+ }
+ else
+ {
+ JITDUMP("Ignoring pin for non-GC type V%02u\n", varNum);
+ }
+ }
+
varDsc->lvOnFrame = true; // The final home for this local variable might be our local stack frame
if (corInfoType == CORINFO_TYPE_CLASS)