Skip to content

Commit

Permalink
Merge pull request #2674 from liqunl/fix
Browse files Browse the repository at this point in the history
Use the right way to check if an argument has fixed type
  • Loading branch information
vijaysun-omr authored Jun 28, 2018
2 parents 9c8787d + 701ec81 commit ebefb67
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions compiler/optimizer/LocalOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7442,9 +7442,15 @@ int32_t TR_InvariantArgumentPreexistence::perform()

parmInfo.setSymbol(p);
TR_OpaqueClassBlock *clazz = arg->getClass();
if (clazz)
TR_OpaqueClassBlock *clazzFromMethod = fe()->getClassFromSignature(sig, len, feMethod);
TR_ASSERT(!clazz ||
!clazzFromMethod ||
clazz == clazzFromMethod ||
fe()->isInstanceOf(clazz, clazzFromMethod, true, true, true) == TR_yes,
"Type from argInfo should be more specific clazz %p clazzFromMethod %p", clazz, clazzFromMethod);

if (classIsFixed)
{
TR_ASSERT(classIsFixed, "assertion failure");
parmInfo.setClassIsFixed();
parmInfo.setClass(clazz);
parmInfo.setClassIsCurrentlyFinal();
Expand All @@ -7453,7 +7459,7 @@ int32_t TR_InvariantArgumentPreexistence::perform()
char *clazzSig = TR::Compiler->cls.classSignature(comp(), clazz, trMemory());
traceMsg(comp(), "PREX: Parm %d class %p is currently final %s\n", index, clazz, clazzSig);
}
if (clazz != fe()->getClassFromSignature(sig, len, feMethod))
if (clazz != clazzFromMethod)
{
parmInfo.setClassIsRefined();
if (trace())
Expand All @@ -7462,18 +7468,12 @@ int32_t TR_InvariantArgumentPreexistence::perform()
}
else
{
clazz = fe()->getClassFromSignature(sig, len, feMethod);
clazz = clazz ? clazz : clazzFromMethod;
if (clazz)
{
if (trace())
traceMsg(comp(), "PREX: Parm %d class %p is %.*s\n", index, clazz, len, sig);
if (classIsFixed)
{
parmInfo.setClassIsFixed();
if (trace())
traceMsg(comp(), "PREX: Parm %d class is fixed\n", index);
}
if (classIsFixed || !fe()->classHasBeenExtended(clazz))
if (!fe()->classHasBeenExtended(clazz))
{
parmInfo.setClassIsCurrentlyFinal();
if (trace())
Expand Down Expand Up @@ -7797,6 +7797,7 @@ void TR_InvariantArgumentPreexistence::processIndirectCall(TR::Node *node, TR::T
int32_t offset = symRef->getOffset();
TR_ResolvedMethod *refinedMethod = symRef->getOwningMethod(comp())->getResolvedVirtualMethod(comp(), receiverInfo.getClass(), offset);


if (refinedMethod)
{
bool isModified = false;
Expand Down

0 comments on commit ebefb67

Please sign in to comment.