Skip to content

Commit

Permalink
Ensure staticName() symbols represent static fields
Browse files Browse the repository at this point in the history
Caller of Symbol::staticName typically assumes the underlying symbol
represents a static field. However, the condition that guards the
call currently only checks for a staic symbol, which is insufficient
as other types like Constant Dynamic. Method Handle, Method Type all
use static symbols. Use the correct check Symbol::isStaticField which
precludes the above mentioned non-static field types.

Signed-off-by: Yan Luo <[email protected]>
  • Loading branch information
yanluo7 committed Oct 5, 2018
1 parent 6fc8ead commit 2522870
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/optimizer/OMRValuePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7923,7 +7923,7 @@ void OMR::ValuePropagation::doDelayedTransformations()
bool recognizedStatic = false;

if ((origFirst->getOpCodeValue() == TR::aload) &&
origFirst->getSymbol()->isStatic())
origFirst->getSymbol()->isStaticField())
{
int32_t staticNameLen = -1;
char *staticName = NULL;
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/VPHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2617,7 +2617,7 @@ TR::Node *constrainIaload(OMR::ValuePropagation *vp, TR::Node *node)
int32_t fieldNameLen = -1;
char *fieldName = NULL;
if (underlyingArray && underlyingArray->getOpCode().hasSymbolReference() &&
(underlyingArray->getSymbolReference()->getSymbol()->isStatic() ||
(underlyingArray->getSymbolReference()->getSymbol()->isStaticField() ||
underlyingArray->getSymbolReference()->getSymbol()->isShadow()))
{
if (underlyingArray->getSymbolReference()->getSymbol()->isShadow())
Expand Down

0 comments on commit 2522870

Please sign in to comment.