On Sep 22, 2016, at 12:23 AM, Michael Haupt <michael.ha...@oracle.com> wrote:

> thanks for your review, and thanks Vladimir! I've had another go at the 
> implementation to use a dedicated loop clause holder class with a stable 
> array; performance is roughly on par with that of the BMHs-as-arrays approach 
> (see below).
> The new webrev is at http://cr.openjdk.java.net/~mhaupt/8161211/webrev.01/ 
> <http://cr.openjdk.java.net/~mhaupt/8161211/webrev.01/>; please review.

Yes, that's cleaner.

Suggestion:  Filter all loop clause functions with ".asFixedArity" when you 
wrap up the constant array.
This will do two things:  1. double-check for nulls (which @Stable doesn't 
like) and 2. allow you to
omit all asFixedArity calls from the driver function (MHI.loop).  The 
asFixedArity normalization could
move into MethodHandles.java, in fact, since that's part of the advertised 
semantics (hmm, right?).

Also (this is a nit) consider commoning (binding a temp for) the three 
expressions 'init[i]' in the driver.
I noticed that while peeking at the asFixedArity calls.  The JIT will DTRT 
here, but we might as well
make its job a bit easier.  JITs enjoy little favors like that; they are less 
likely to drop optimizations.


— John

Reply via email to