Skip to content

Commit

Permalink
Merge pull request #10068 from a7ehuo/checkcast-resolvechk
Browse files Browse the repository at this point in the history
Add ResolveCHK for value types before NULLCHK
  • Loading branch information
andrewcraik committed Jul 16, 2020
2 parents ee1f3d1 + e74076f commit fdfccf6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion runtime/compiler/ilgen/Walker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2364,6 +2364,8 @@ TR_J9ByteCodeIlGenerator::genCheckCast()
*
* If the class specified in the bytecode is unresolved, this leaves out the
* ResolveCHK since it has to be conditional on a non-null object.
* If the class specified in the bytecode is a value type, it has to be resolved
* unconditionally, regardless of whether the value is null.
*
* @param cpIndex The constant pool entry of the class given in the bytecode
*
Expand All @@ -2376,12 +2378,16 @@ TR_J9ByteCodeIlGenerator::genCheckCast(int32_t cpIndex)
if (TR::Compiler->om.areValueTypesEnabled() && TR::Compiler->cls.isClassRefValueType(comp(), method()->classOfMethod(), cpIndex))
{
TR::Node * objNode = _stack->top();

loadClassObject(cpIndex);

TR::Node *passThruNode = TR::Node::create(TR::PassThrough, 1, objNode);
genTreeTop(genNullCheck(passThruNode));
loadClassObject(cpIndex);
}
else
{
loadClassObjectForTypeTest(cpIndex, TR_DisableAOTCheckCastInlining);
}
genCheckCast();
}

Expand Down

0 comments on commit fdfccf6

Please sign in to comment.