--- a/hotspot/src/share/vm/opto/addnode.cpp Tue Mar 11 14:19:53 2008 -0700
+++ b/hotspot/src/share/vm/opto/addnode.cpp Thu Mar 13 05:40:44 2008 -0700
@@ -505,15 +505,25 @@
const Type *temp_t2 = phase->type( in(Offset) );
if( temp_t2 == Type::TOP ) return NULL;
const TypeX *t2 = temp_t2->is_intptr_t();
+ Node* address;
+ Node* offset;
if( t2->is_con() ) {
// The Add of the flattened expression
- set_req(Address, addp->in(Address));
- set_req(Offset , phase->MakeConX(t2->get_con() + t12->get_con()));
- return this; // Made progress
+ address = addp->in(Address);
+ offset = phase->MakeConX(t2->get_con() + t12->get_con());
+ } else {
+ // Else move the constant to the right. ((A+con)+B) into ((A+B)+con)
+ address = phase->transform(new (phase->C, 4) AddPNode(in(Base),addp->in(Address),in(Offset)));
+ offset = addp->in(Offset);
}
- // Else move the constant to the right. ((A+con)+B) into ((A+B)+con)
- set_req(Address, phase->transform(new (phase->C, 4) AddPNode(in(Base),addp->in(Address),in(Offset))));
- set_req(Offset , addp->in(Offset));
+ PhaseIterGVN *igvn = phase->is_IterGVN();
+ if( igvn ) {
+ set_req_X(Address,address,igvn);
+ set_req_X(Offset,offset,igvn);
+ } else {
+ set_req(Address,address);
+ set_req(Offset,offset);
+ }
return this;
}
}
@@ -608,6 +618,28 @@
return NULL;
}
+//------------------------------unpack_offsets----------------------------------
+// Collect the AddP offset values into the elements array, giving up
+// if there are more than length.
+int AddPNode::unpack_offsets(Node* elements[], int length) {
+ int count = 0;
+ Node* addr = this;
+ Node* base = addr->in(AddPNode::Base);
+ while (addr->is_AddP()) {
+ if (addr->in(AddPNode::Base) != base) {
+ // give up
+ return -1;
+ }
+ elements[count++] = addr->in(AddPNode::Offset);
+ if (count == length) {
+ // give up
+ return -1;
+ }
+ addr = addr->in(AddPNode::Address);
+ }
+ return count;
+}
+
//------------------------------match_edge-------------------------------------
// Do we Match on this edge index or not? Do not match base pointer edge
uint AddPNode::match_edge(uint idx) const {