(original) (raw)

Hi John,

Please look at the new webrev for the RFR: http://cr.openjdk.java.net/\~kmo/8003585/webrev.02/

The rationale and results are in the RFR thread.

Thanks,
Kris


On Thu, Feb 13, 2014 at 12:32 PM, John Rose <john.r.rose@oracle.com> wrote:
On Feb 13, 2014, at 9:11 AM, Krystal Mok <rednaxelafx@gmail.com> wrote:

Here, the code in line 1 should ensure a.length > 2, and that predicate should propagate to line 2\. But in the generated code, there's still a bounds check (a.length != 0) in line 2, right before the actual element load.

We use two main sources of information to delete redundant tests: type information (such as integer ranges) and pattern matching on dominating tests (IfNode::).  In this case, the array type information does not carry the path-dependent information about a.length.  And, the dominating checks are not sufficiently similar to fold together.  But the common case is optimized, so I'm happy.

You might want to look at the code for HashMap.getNode, which (I think) optimizes with your existing logic.

— John