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

Commit 60f74b3

Browse files
committed
Spill the eval stack when storing to a pinned local.
The jit may not see direct interference between a pinned local and expressions that use the pinned value. So worst case it should assume that such interference exists and spill the stack when storing to a pinned local. Otherwise the jit may reorder unpins and calls that refer to pinned storage. Fixes DevDiv 545749 [tfs-changeset: 1685045]
1 parent 50a4b33 commit 60f74b3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/jit/importer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10749,13 +10749,13 @@ void Compiler::impImportBlockCode(BasicBlock* block)
1074910749

1075010750
op2 = gtNewLclvNode(lclNum, lclTyp, opcodeOffs + sz + 1);
1075110751

10752-
/* If the local is aliased, we need to spill calls and
10752+
/* If the local is aliased or pinned, we need to spill calls and
1075310753
indirections from the stack. */
1075410754

10755-
if ((lvaTable[lclNum].lvAddrExposed || lvaTable[lclNum].lvHasLdAddrOp) &&
10756-
verCurrentState.esStackDepth > 0)
10755+
if ((lvaTable[lclNum].lvAddrExposed || lvaTable[lclNum].lvHasLdAddrOp || lvaTable[lclNum].lvPinned) &&
10756+
(verCurrentState.esStackDepth > 0))
1075710757
{
10758-
impSpillSideEffects(false, (unsigned)CHECK_SPILL_ALL DEBUGARG("Local could be aliased"));
10758+
impSpillSideEffects(false, (unsigned)CHECK_SPILL_ALL DEBUGARG("Local could be aliased or is pinned"));
1075910759
}
1076010760

1076110761
/* Spill any refs to the local from the stack */

0 commit comments

Comments
 (0)