Skip to content

Commit

Permalink
Suppress candidates for stack allocation based on suppressEA option
Browse files Browse the repository at this point in the history
Check the setting of the suppressEA option to decide whether a
particular candidate for stack allocation should be prevented from
being stack allocated.  This can help test the effect on performance of
individual opportunities for stack allocation.

Signed-off-by:  Henry Zongaro <[email protected]>
  • Loading branch information
hzongaro committed Jan 30, 2023
1 parent 874985f commit 9949bb5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions runtime/compiler/optimizer/EscapeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#include "infra/Link.hpp"
#include "infra/List.hpp"
#include "infra/SimpleRegex.hpp"
#include "infra/String.hpp"
#include "infra/TRCfgEdge.hpp"
#include "infra/TRCfgNode.hpp"
#include "optimizer/Inliner.hpp"
Expand Down Expand Up @@ -1236,6 +1237,33 @@ int32_t TR_EscapeAnalysis::performAnalysisOnce()
}
}

// Suppress stack allocation for any candidates that match the regular
// expression specified with the suppressEA option.
TR::SimpleRegex * suppressAtRegex = comp()->getOptions()->getSuppressEARegex();
if (suppressAtRegex != NULL && !_candidates.isEmpty())
{
for (candidate = _candidates.getFirst(); candidate; candidate = next)
{
next = candidate->getNext();

if (!candidate->isLocalAllocation())
{
continue;
}

TR_ByteCodeInfo &bcInfo = candidate->_node->getByteCodeInfo();
if (TR::SimpleRegex::match(suppressAtRegex, bcInfo))
{
candidate->setLocalAllocation(false);

if (trace())
{
traceMsg(comp(), " Suppressing stack allocation of candidate node [%p] - matched suppressEA option\n", candidate->_node);
}
}
}
}

// Check for size limits on total object allocation size.
//
if (!_candidates.isEmpty())
Expand Down

0 comments on commit 9949bb5

Please sign in to comment.