Request for reviews (M): 7170463: C2 should recognize "obj.getClass() == A.class" code pattern

John Rose john.r.rose at
Wed May 23 22:02:47 PDT 2012

On May 23, 2012, at 4:47 PM, Vladimir Kozlov wrote:

> I updated webrev:
> I found additional issue with original changes. They accidentally removed optimization which replaces LoadKlass node with ConP (klass type) in map. Next code will not be executed:
>   cast = con;  // Replace non-constant val by con.
> New code should do separate map update of object which klass is compared.

That's fine; I like it.

New question:  Can the following call return Top?

  Number x = 5;
  if (x.getClass() == String.class)

Perhaps the compare will short-circuit before that happens.  If it doesn't, we'll get assertion failures or worse.

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

More information about the hotspot-compiler-dev mailing list