Request for reviews (M): 7170463: C2 should recognize "obj.getClass() == A.class" code pattern
rednaxelafx at gmail.com
Thu May 24 01:28:27 PDT 2012
Hi Vladimir and John,
Thanks for polishing the changes!
Comments inline below:
On Thu, May 24, 2012 at 1:02 PM, John Rose <john.r.rose at oracle.com> wrote:
> 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.
> Oops, I didn't notice this assignment handles Longs and Oops too. Thank
for the catch!
> New code should do separate map update of object which klass is compared.
> That's fine; I like it.
> Yes, I like it better this way, too. I couldn't get a clean factoring
of sharpen_type_after_if() with the new and old code mixed together; now 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.
> Maybe we should just do without the join?
> — John
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hotspot-compiler-dev