Request for review (S): C2 should recognize "obj.getClass() == A.class" code pattern

Krystal Mok rednaxelafx at
Wed Apr 25 18:32:18 PDT 2012

Oops. I'm getting native NPE in CmpPNode::Ideal() with SPECjvm2008.
Will investigate and post an updated patch later.

- Kris

On Wed, Apr 25, 2012 at 10:22 PM, Krystal Mok <rednaxelafx at> wrote:

> Hi all,
> I've made a few improvements over the last patch, per John's suggestion,
> posted here:
> Could I get some reviews for the new version, please?
> The new patch normalizes "x.getClass() == y.getClass()" in addition to the
> old version.
> It also sharpens the type of obj to Foo:NotNull:exact in the IfTrue branch
> of "if (x._klass == Foo.klass)".
> Tested with the experiment that still had redundant checks with the old
> patch (, and now the redundant check is
> gone. Thanks a lot, John!
> I'm re-running SPECjvm2008 to see if it runs all right.
> There are still two doubts, though:
> 1. In Parse::adjust_map_after_if(), should I delay the transform of
> CheckCastPP node, or should I follow the example in
> GraphKit::type_check_receiver()?
> 2. The receiver of getClass() is casted to not_null with a CastPP when
> parsing the invokevirtual instruction. Should I sharpen the uncast obj, or
> is it okay to just sharpen the CastPP as I'm doing now?
> Regards,
> Kris
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the hotspot-compiler-dev mailing list