Skip to content

Commit

Permalink
Constrain VFT of ClassObject to be java/lang/Class
Browse files Browse the repository at this point in the history
It was already so constrained in cases where the class represented by
the ClassObject is known exactly, but the represented class is
irrelevant here. Now (isClassObject() == TR_yes) takes precedence over
isFixedClass() so a location of {JavaLangClassObject} is sufficient to
cause VP to create the constraint.

Signed-off-by: Devin Papineau <devinmp@ca.ibm.com>
  • Loading branch information
jdmpapin committed Nov 20, 2018
1 parent fe0d1a4 commit 15318d4
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions compiler/optimizer/VPHandlers.cpp
Expand Up @@ -2124,33 +2124,30 @@ TR::Node *constrainIaload(OMR::ValuePropagation *vp, TR::Node *node)
if (base && node->getOpCode().hasSymbolReference() &&
(node->getSymbolReference() == vp->comp()->getSymRefTab()->findVftSymbolRef()))
{
TR::VPClassPresence *nonnull = TR::VPNonNullObject::create(vp);
if (!base->isFixedClass())
{
vp->addBlockOrGlobalConstraint(node, TR::VPClass::create(vp, NULL, nonnull, NULL, NULL, TR::VPObjectLocation::create(vp, TR::VPObjectLocation::J9ClassObject)), isGlobal);
}
else if (base->isClassObject() == TR_yes)
TR_OpaqueClassBlock *clazz = NULL;
if (base->isClassObject() == TR_yes)
{
// base can only be an instance of java/lang/Class, since
// we can't load <vft> relative to a J9Class.
vp->addBlockOrGlobalConstraint(node,
TR::VPClass::create(vp,
TR::VPFixedClass::create(vp, vp->comp()->fej9()->getClassClassPointer(base->getClass())),
nonnull,
NULL, NULL,
TR::VPObjectLocation::create(vp, TR::VPObjectLocation::J9ClassObject)),
isGlobal);
clazz = vp->comp()->getClassClassPointer();
}
else
else if (base->isFixedClass())
{
vp->addBlockOrGlobalConstraint(node,
TR::VPClass::create(vp,
TR::VPFixedClass::create(vp, base->getClass()),
nonnull,
NULL, NULL,
TR::VPObjectLocation::create(vp, TR::VPObjectLocation::J9ClassObject)),
isGlobal);
clazz = base->getClass();
}

TR::VPClassType *type = NULL;
if (clazz != NULL)
type = TR::VPFixedClass::create(vp, clazz);

TR::VPClassPresence *nonnull = TR::VPNonNullObject::create(vp);
TR::VPObjectLocation *loc =
TR::VPObjectLocation::create(vp, TR::VPObjectLocation::J9ClassObject);
vp->addBlockOrGlobalConstraint(
node,
TR::VPClass::create(vp, type, nonnull, NULL, NULL, loc),
isGlobal);

node->setIsNonNull(true);
}
else if (base
Expand Down

0 comments on commit 15318d4

Please sign in to comment.