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

Krystal Mok rednaxelafx at
Wed Apr 25 07:22:36 PDT 2012

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
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?

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the hotspot-compiler-dev mailing list