RFR (L): 7173584: Implement arraycopy as a macro node

Vladimir Kozlov vladimir.kozlov at oracle.com
Mon Oct 1 11:41:33 PDT 2012

I don't think you need suffix "_any_phase" in the name 
gen_subtype_check_any_phase(). Just add comment that it is also used in phase 
Macro. Generally speaking GraphKit class is wrong place for it. May be it should 
be in base class Phase but keep the code in graphKit.cpp file.

You don't need special gvn_transform(). It is already done since Macro phase 
sets gvn._delay_transform flag to true and:

Node *PhaseIterGVN::transform( Node *n ) {
   if (_delay_transform) {
     // Register the node but don't optimize for now
     return n;

gvn_transform_ctrl() should remain to be record_for_igvn() but virtual as you 

It would be also nice to factor out IfNode creation into separate method (it 
used 5 times):

+        Node* cmp = gvn_transform(new(C, 3) CmpPNode(subklass, superklass), gvn);
+        Node* bol = gvn_transform(new(C, 2) BoolNode(cmp, BoolTest::eq), gvn);
+        IfNode* iff = new (C, 2) IfNode(*ctrl, bol, PROB_STATIC_FREQUENT, 
+        gvn_transform(iff, gvn);
+        if (!bol->is_Con()) gvn_transform_ctrl(iff, gvn);

Next optimization belongs to ConvI2LNode::Value(). May be we should not widen 
type in ConvI2LNode::Ideal() and Value() if input is singleton (constant).

+  Node *chk_off_X = LP64_ONLY(NULL) NOT_LP64(chk_off);
+#ifdef _LP64
+  jint chk_off_con = gvn->find_int_con(chk_off, Type::OffsetBot);
+  if (chk_off_con != Type::OffsetBot) {
+    chk_off_X = gvn->longcon((jlong) chk_off_con);
+  } else {
+    chk_off_X = gvn_transform(new (C, 2) ConvI2LNode(chk_off), gvn);
+  }


Roland Westrelin wrote:
>> Also instead of duplicating gen_subtype_check() in macroArrayCopy.cpp can you modify the original one to work for you (by passing additional flag)?
> This (on top of previous webrev - I've done only minimal testing)?
> http://cr.openjdk.java.net/~roland/7173584/webrev.02/
> Or do we want gvn_transform/gvn_transform_ctrl to be virtual methods of PhaseGVN/PhaseIterGVN?
> Roland.

More information about the hotspot-compiler-dev mailing list