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

Commit

Permalink
CR feedback and x86 fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
erozenfeld committed Jan 11, 2019
1 parent f027343 commit a377055
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
38 changes: 22 additions & 16 deletions src/jit/objectalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void ObjectAllocator::MarkEscapingVarsAndBuildConnGraph()
{
var_types type = comp->lvaTable[lclNum].TypeGet();

if (type == TYP_REF || type == TYP_I_IMPL || type == TYP_BYREF)
if (type == TYP_REF || genActualType(type) == TYP_I_IMPL || type == TYP_BYREF)
{
m_ConnGraphAdjacencyMatrix[lclNum] = BitVecOps::MakeEmpty(&m_bitVecTraits);

Expand Down Expand Up @@ -242,18 +242,21 @@ void ObjectAllocator::ComputeEscapingNodes(BitVecTraits* bitVecTraits, BitVec& e

while (iterator.NextElem(&lclNum))
{
doOneMoreIteration = true;

// newEscapingNodes = adjacentNodes[lclNum]
BitVecOps::Assign(bitVecTraits, newEscapingNodes, m_ConnGraphAdjacencyMatrix[lclNum]);
// newEscapingNodes = newEscapingNodes \ escapingNodes
BitVecOps::DiffD(bitVecTraits, newEscapingNodes, escapingNodes);
// escapingNodesToProcess = escapingNodesToProcess U newEscapingNodes
BitVecOps::UnionD(bitVecTraits, escapingNodesToProcess, newEscapingNodes);
// escapingNodes = escapingNodes U newEscapingNodes
BitVecOps::UnionD(bitVecTraits, escapingNodes, newEscapingNodes);
// escapingNodesToProcess = escapingNodesToProcess \ { lclNum }
BitVecOps::RemoveElemD(bitVecTraits, escapingNodesToProcess, lclNum);
if (m_ConnGraphAdjacencyMatrix[lclNum] != nullptr)
{
doOneMoreIteration = true;

// newEscapingNodes = adjacentNodes[lclNum]
BitVecOps::Assign(bitVecTraits, newEscapingNodes, m_ConnGraphAdjacencyMatrix[lclNum]);
// newEscapingNodes = newEscapingNodes \ escapingNodes
BitVecOps::DiffD(bitVecTraits, newEscapingNodes, escapingNodes);
// escapingNodesToProcess = escapingNodesToProcess U newEscapingNodes
BitVecOps::UnionD(bitVecTraits, escapingNodesToProcess, newEscapingNodes);
// escapingNodes = escapingNodes U newEscapingNodes
BitVecOps::UnionD(bitVecTraits, escapingNodes, newEscapingNodes);
// escapingNodesToProcess = escapingNodesToProcess \ { lclNum }
BitVecOps::RemoveElemD(bitVecTraits, escapingNodesToProcess, lclNum);
}
}
}
}
Expand Down Expand Up @@ -392,6 +395,8 @@ bool ObjectAllocator::MorphAllocObjNodes()

const unsigned int stackLclNum = MorphAllocObjNodeIntoStackAlloc(asAllocObj, block, stmt);
m_HeapLocalToStackLocalMap.AddOrUpdate(lclNum, stackLclNum);
// We keep the set of possibly-stack-pointing pointers as a superset of the set of
// definitely-stack-pointing pointers. All definitely-stack-pointing pointers are in both sets.
MarkLclVarAsDefinitelyStackPointing(lclNum);
MarkLclVarAsPossiblyStackPointing(lclNum);
stmt->gtStmtExpr->gtBashToNOP();
Expand Down Expand Up @@ -875,8 +880,7 @@ void ObjectAllocator::RewriteUses()
newType = TYP_I_IMPL;
tree =
m_compiler->gtNewOperNode(GT_ADDR, newType, m_compiler->gtNewLclvNode(newLclNum, TYP_STRUCT));
lclVarDsc->lvType = newType;
*use = tree;
*use = tree;
}
else
{
Expand All @@ -885,9 +889,11 @@ void ObjectAllocator::RewriteUses()
{
tree->ChangeType(newType);
}
lclVarDsc->lvType = newType;
}

JITDUMP("changing the type of V%02u\n from %s to %s", lclNum, varTypeName(lclVarDsc->lvType),
varTypeName(newType));
lclVarDsc->lvType = newType;
m_allocator->UpdateAncestorTypes(tree, &m_ancestors, newType);
}

Expand Down
10 changes: 6 additions & 4 deletions src/jit/objectalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class ObjectAllocator final : public Phase

//===============================================================================
// Data members
bool m_IsObjectStackAllocationEnabled;
bool m_AnalysisDone;
BitVecTraits m_bitVecTraits;
BitVec m_EscapingPointers;
bool m_IsObjectStackAllocationEnabled;
bool m_AnalysisDone;
BitVecTraits m_bitVecTraits;
BitVec m_EscapingPointers;
// We keep the set of possibly-stack-pointing pointers as a superset of the set of
// definitely-stack-pointing pointers. All definitely-stack-pointing pointers are in both sets.
BitVec m_PossiblyStackPointingPointers;
BitVec m_DefinitelyStackPointingPointers;
LocalToLocalMap m_HeapLocalToStackLocalMap;
Expand Down

0 comments on commit a377055

Please sign in to comment.