# HG changeset patch # User Doug Simon # Date 1379627497 -7200 # Node ID 9ddd8704a65b660a563882fd4c25ab318de4cd40 # Parent cb5df18795001088c88f87a9497d7d3bc62e8747 removed creation of intermediate ArrayLengthNode when lowering [Load|Store]IndexedNodes diff -r cb5df1879500 -r 9ddd8704a65b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu Sep 19 23:42:23 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu Sep 19 23:51:37 2013 +0200 @@ -990,13 +990,14 @@ } } - private static GuardingNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) { - StructuredGraph graph = n.graph(); - ArrayLengthNode arrayLength = graph.add(new ArrayLengthNode(n.array())); - GuardingNode guard = tool.createGuard(graph.unique(new IntegerBelowThanNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile); - - graph.addBeforeFixed(n, arrayLength); - return guard; + private GuardingNode createBoundsCheck(AccessIndexedNode n, LoweringTool tool) { + StructuredGraph g = n.graph(); + ValueNode array = n.array(); + Stamp stamp = StampFactory.positiveInt(); + ReadNode arrayLength = g.add(new ReadNode(array, ConstantLocationNode.create(FINAL_LOCATION, Kind.Int, config.arrayLengthOffset, g), stamp, BarrierType.NONE, false)); + g.addBeforeFixed(n, arrayLength); + tool.createNullCheckGuard(arrayLength, array); + return tool.createGuard(g.unique(new IntegerBelowThanNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile); } public ResolvedJavaType lookupJavaType(Class clazz) {