8060252: JDK-7173584 compiler changes regress SPECjvm2008 on SPARC
Summary: arraycopy code misses opportunities to optimize copies to just allocated array.
Reviewed-by: kvn
--- a/hotspot/src/share/vm/opto/library_call.cpp Mon Nov 03 12:02:40 2014 -0800
+++ b/hotspot/src/share/vm/opto/library_call.cpp Mon Oct 20 22:53:37 2014 +0200
@@ -4697,6 +4697,10 @@
Node* dest_offset = argument(3); // type: int
Node* length = argument(4); // type: int
+ // Check for allocation before we add nodes that would confuse
+ // tightly_coupled_allocation()
+ AllocateArrayNode* alloc = tightly_coupled_allocation(dest, NULL);
+
// The following tests must be performed
// (1) src and dest are arrays.
// (2) src and dest arrays must have elements of the same BasicType
@@ -4870,7 +4874,6 @@
return true;
}
- AllocateArrayNode* alloc = tightly_coupled_allocation(dest, NULL);
ArrayCopyNode* ac = ArrayCopyNode::make(this, true, src, src_offset, dest, dest_offset, length, alloc != NULL,
// Create LoadRange and LoadKlass nodes for use during macro expansion here
// so the compiler has a chance to eliminate them: during macro expansion,