< prev index next >

src/share/vm/opto/valuetypenode.cpp

Print this page




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/ciValueKlass.hpp"
  27 #include "opto/addnode.hpp"
  28 #include "opto/graphKit.hpp"
  29 #include "opto/rootnode.hpp"
  30 #include "opto/valuetypenode.hpp"
  31 #include "opto/phaseX.hpp"
  32 




































































































































































  33 ValueTypeNode* ValueTypeNode::make(PhaseGVN& gvn, ciValueKlass* klass) {
  34   // Create a new ValueTypeNode with uninitialized values and NULL oop
  35   const TypeValueType* type = TypeValueType::make(klass);
  36   return new ValueTypeNode(type, gvn.zerocon(T_VALUETYPE));
  37 }
  38 
  39 Node* ValueTypeNode::make_default(PhaseGVN& gvn, ciValueKlass* vk) {
  40   // TODO re-use constant oop of pre-allocated default value type here?
  41   // Create a new ValueTypeNode with default values
  42   ValueTypeNode* vt = ValueTypeNode::make(gvn, vk);
  43   for (uint i = 0; i < vt->field_count(); ++i) {
  44     ciType* field_type = vt->field_type(i);
  45     Node* value = NULL;
  46     if (field_type->is_valuetype()) {
  47       value = ValueTypeNode::make_default(gvn, field_type->as_value_klass());
  48     } else {
  49       value = gvn.zerocon(field_type->basic_type());
  50     }
  51     vt->set_field_value(i, value);
  52   }
  53   return gvn.transform(vt);
  54 }
  55 
  56 Node* ValueTypeNode::make(PhaseGVN& gvn, Node* mem, Node* oop) {
  57   // Create and initialize a ValueTypeNode by loading all field
  58   // values from a heap-allocated version and also save the oop.
  59   const TypeValueType* type = gvn.type(oop)->is_valuetypeptr()->value_type();
  60   ValueTypeNode* vt = new ValueTypeNode(type, oop);
  61   vt->load(gvn, mem, oop, oop, type->value_klass());
  62   assert(vt->is_allocated(&gvn), "value type should be allocated");
  63   assert(oop->is_Con() || oop->is_CheckCastPP() || vt->is_loaded(&gvn, type) == oop, "value type should be loaded");
  64   return gvn.transform(vt);
  65 }
  66 
  67 Node* ValueTypeNode::make(PhaseGVN& gvn, ciValueKlass* vk, Node* mem, Node* obj, Node* ptr, ciInstanceKlass* holder, int holder_offset) {
  68   // Create and initialize a ValueTypeNode by loading all field values from
  69   // a flattened value type field at 'holder_offset' or from a value type array.
  70   ValueTypeNode* vt = make(gvn, vk);
  71   // The value type is flattened into the object without an oop header. Subtract the
  72   // offset of the first field to account for the missing header when loading the values.
  73   holder_offset -= vk->first_field_offset();
  74   vt->load(gvn, mem, obj, ptr, holder, holder_offset);
  75   assert(vt->is_loaded(&gvn, vt->type()->isa_valuetype()) != obj, "holder oop should not be used as flattened value type oop");
  76   return gvn.transform(vt)->as_ValueType();
  77 }
  78 
  79 void ValueTypeNode::load(PhaseGVN& gvn, Node* mem, Node* base, Node* ptr, ciInstanceKlass* holder, int holder_offset) {
  80   // Initialize the value type by loading its field values from
  81   // memory and adding the values as input edges to the node.
  82   for (uint i = 0; i < field_count(); ++i) {
  83     int offset = holder_offset + field_offset(i);


 243   // Update GraphKit
 244   kit->set_control(kit->gvn().transform(region));
 245   kit->set_i_o(kit->gvn().transform(io));
 246   kit->set_all_memory(kit->gvn().transform(mem));
 247   kit->record_for_igvn(region);
 248   kit->record_for_igvn(oop);
 249   kit->record_for_igvn(io);
 250   kit->record_for_igvn(mem);
 251 
 252   // Use cloned ValueTypeNode to propagate oop from now on
 253   Node* res_oop = kit->gvn().transform(oop);
 254   ValueTypeNode* vt = clone()->as_ValueType();
 255   vt->set_oop(res_oop);
 256   kit->replace_in_map(this, kit->gvn().transform(vt));
 257   return res_oop;
 258 }
 259 
 260 bool ValueTypeNode::is_allocated(PhaseGVN* phase) const {
 261   const Type* oop_type = phase->type(get_oop());
 262   return oop_type->meet(TypePtr::NULL_PTR) != oop_type;
 263 }
 264 
 265 // Clones the values type to handle control flow merges involving multiple value types.
 266 // The inputs are replaced by PhiNodes to represent the merged values for the given region.
 267 ValueTypeNode* ValueTypeNode::clone_with_phis(PhaseGVN* gvn, Node* region) {
 268   assert(!has_phi_inputs(region), "already cloned with phis");
 269   ValueTypeNode* vt = clone()->as_ValueType();
 270 
 271   // Create a PhiNode for merging the oop values
 272   const TypeValueTypePtr* vtptr = TypeValueTypePtr::make(vt->bottom_type()->isa_valuetype());
 273   PhiNode* oop = PhiNode::make(region, vt->get_oop(), vtptr);
 274   gvn->set_type(oop, vtptr);
 275   vt->set_oop(oop);
 276 
 277   // Create a PhiNode each for merging the field values
 278   for (uint i = 0; i < vt->field_count(); ++i) {
 279     ciType* type = vt->field_type(i);
 280     Node*  value = vt->field_value(i);
 281     if (type->is_valuetype()) {
 282       // Handle flattened value type fields recursively
 283       value = value->as_ValueType()->clone_with_phis(gvn, region);
 284     } else {
 285       const Type* phi_type = Type::get_const_type(type);
 286       value = PhiNode::make(region, value, phi_type);
 287       gvn->set_type(value, phi_type);
 288     }
 289     vt->set_field_value(i, value);
 290   }
 291   gvn->set_type(vt, vt->bottom_type());
 292   return vt;
 293 }
 294 
 295 // Checks if the inputs of the ValueTypeNode were replaced by PhiNodes
 296 // for the given region (see ValueTypeNode::clone_with_phis).
 297 bool ValueTypeNode::has_phi_inputs(Node* region) {
 298   // Check oop input
 299   bool result = get_oop()->is_Phi() && get_oop()->as_Phi()->region() == region;
 300 #ifdef ASSERT
 301   if (result) {
 302     // Check all field value inputs for consistency
 303     for (uint i = Oop; i < field_count(); ++i) {
 304       Node* n = in(i);
 305       if (n->is_ValueType()) {
 306         assert(n->as_ValueType()->has_phi_inputs(region), "inconsistent phi inputs");
 307       } else {
 308         assert(n->is_Phi() && n->as_Phi()->region() == region, "inconsistent phi inputs");
 309       }
 310     }
 311   }
 312 #endif
 313   return result;
 314 }
 315 
 316 // Merges 'this' with 'other' by updating the input PhiNodes added by 'clone_with_phis'
 317 ValueTypeNode* ValueTypeNode::merge_with(PhaseGVN* gvn, const ValueTypeNode* other, int pnum, bool transform) {
 318   // Merge oop inputs
 319   PhiNode* phi = get_oop()->as_Phi();
 320   phi->set_req(pnum, other->get_oop());
 321   if (transform) {
 322     set_oop(gvn->transform(phi));
 323     gvn->record_for_igvn(phi);
 324   }
 325   // Merge field values
 326   for (uint i = 0; i < field_count(); ++i) {
 327     Node* val1 =        field_value(i);
 328     Node* val2 = other->field_value(i);
 329     if (val1->isa_ValueType()) {
 330       val1->as_ValueType()->merge_with(gvn, val2->as_ValueType(), pnum, transform);
 331     } else {
 332       assert(val1->is_Phi(), "must be a phi node");
 333       assert(!val2->is_ValueType(), "inconsistent merge values");
 334       val1->set_req(pnum, val2);
 335     }
 336     if (transform) {
 337       set_field_value(i, gvn->transform(val1));
 338       gvn->record_for_igvn(val1);
 339     }
 340   }
 341   return this;
 342 }
 343 
 344 Node* ValueTypeNode::field_value(uint index) const {
 345   assert(index < field_count(), "index out of bounds");
 346   return in(Values + index);
 347 }
 348 
 349 // Get the value of the field at the given offset.
 350 // If 'recursive' is true, flattened value type fields will be resolved recursively.
 351 Node* ValueTypeNode::field_value_by_offset(int offset, bool recursive) const {
 352   // If the field at 'offset' belongs to a flattened value type field, 'index' refers to the
 353   // corresponding ValueTypeNode input and 'sub_offset' is the offset in flattened value type.
 354   int index = value_klass()->field_index_by_offset(offset);
 355   int sub_offset = offset - field_offset(index);
 356   Node* value = field_value(index);
 357   if (recursive && value->is_ValueType()) {
 358     // Flattened value type field
 359     ValueTypeNode* vt = value->as_ValueType();
 360     sub_offset += vt->value_klass()->first_field_offset(); // Add header size
 361     return vt->field_value_by_offset(sub_offset);
 362   }
 363   assert(!(recursive && value->is_ValueType()), "should not be a value type");
 364   assert(sub_offset == 0, "offset mismatch");
 365   return value;
 366 }
 367 
 368 void ValueTypeNode::set_field_value(uint index, Node* value) {
 369   assert(index < field_count(), "index out of bounds");
 370   set_req(Values + index, value);
 371 }
 372 
 373 int ValueTypeNode::field_offset(uint index) const {
 374   assert(index < field_count(), "index out of bounds");
 375   return value_klass()->field_offset_by_index(index);
 376 }
 377 
 378 ciType* ValueTypeNode::field_type(uint index) const {
 379   assert(index < field_count(), "index out of bounds");
 380   return value_klass()->field_type_by_index(index);
 381 }
 382 
 383 void ValueTypeNode::make_scalar_in_safepoints(Compile* C) {
 384   const TypeValueTypePtr* res_type = TypeValueTypePtr::make(bottom_type()->isa_valuetype(), TypePtr::NotNull);
 385   ciValueKlass* vk = value_klass();
 386   uint nfields = vk->flattened_field_count();
 387   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
 388     Node* u = fast_out(i);
 389     if (u->is_SafePoint() && (!u->is_Call() || u->as_Call()->has_debug_use(this))) {
 390       Node* in_oop = get_oop();
 391       const Type* oop_type = in_oop->bottom_type();
 392       SafePointNode* sfpt = u->as_SafePoint();
 393       JVMState* jvms = sfpt->jvms();
 394       int start = jvms->debug_start();
 395       int end   = jvms->debug_end();
 396       assert(TypePtr::NULL_PTR->higher_equal(oop_type), "already heap allocated value type should be linked directly");
 397       // Replace safepoint edge by SafePointScalarObjectNode and add field values
 398       assert(jvms != NULL, "missing JVMS");
 399       uint first_ind = (sfpt->req() - jvms->scloff());
 400       SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type,
 401 #ifdef ASSERT
 402                                                                       NULL,
 403 #endif
 404                                                                       first_ind, nfields);
 405       sobj->init_req(0, C->root());
 406       // Iterate over the value type fields in order of increasing
 407       // offset and add the field values to the safepoint.
 408       for (uint j = 0; j < nfields; ++j) {
 409         int offset = vk->nonstatic_field_at(j)->offset();
 410         Node* value = field_value_by_offset(offset, true /* include flattened value type fields */);
 411         sfpt->add_req(value);
 412       }
 413       jvms->set_endoff(sfpt->req());
 414       int nb = sfpt->replace_edges_in_range(this, sobj, start, end);
 415       --i; imax -= nb;
 416     }
 417   }
 418 }
 419 
 420 void ValueTypeNode::pass_klass(Node* n, uint pos, const GraphKit& kit) {
 421   ciValueKlass* vk = value_klass();
 422   const TypeKlassPtr* tk = TypeKlassPtr::make(vk);
 423   intptr_t bits = tk->get_con();
 424   set_nth_bit(bits, 0);
 425   Node* klass_tagged = kit.MakeConX(bits);
 426   n->init_req(pos, klass_tagged);
 427 }
 428 
 429 uint ValueTypeNode::pass_fields(Node* n, int base_input, const GraphKit& kit, ciValueKlass* base_vk, int base_offset) {
 430   ciValueKlass* vk = value_klass();
 431   if (base_vk == NULL) {
 432     base_vk = vk;
 433   }
 434   uint edges = 0;
 435   for (uint i = 0; i < field_count(); i++) {
 436     ciType* f_type = field_type(i);
 437     int offset = base_offset + field_offset(i) - (base_offset > 0 ? vk->first_field_offset() : 0);




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/ciValueKlass.hpp"
  27 #include "opto/addnode.hpp"
  28 #include "opto/graphKit.hpp"
  29 #include "opto/rootnode.hpp"
  30 #include "opto/valuetypenode.hpp"
  31 #include "opto/phaseX.hpp"
  32 
  33 // Clones the values type to handle control flow merges involving multiple value types.
  34 // The inputs are replaced by PhiNodes to represent the merged values for the given region.
  35 ValueTypeBaseNode* ValueTypeBaseNode::clone_with_phis(PhaseGVN* gvn, Node* region) {
  36   assert(!has_phi_inputs(region), "already cloned with phis");
  37   ValueTypeBaseNode* vt = clone()->as_ValueTypeBase();
  38 
  39   // Create a PhiNode for merging the oop values
  40   const TypeValueTypePtr* vtptr = value_type_ptr();
  41   PhiNode* oop = PhiNode::make(region, vt->get_oop(), vtptr);
  42   gvn->set_type(oop, vtptr);
  43   vt->set_oop(oop);
  44 
  45   // Create a PhiNode each for merging the field values
  46   for (uint i = 0; i < vt->field_count(); ++i) {
  47     ciType* type = vt->field_type(i);
  48     Node*  value = vt->field_value(i);
  49     if (type->is_valuetype()) {
  50       // Handle flattened value type fields recursively
  51       value = value->as_ValueType()->clone_with_phis(gvn, region);
  52     } else {
  53       const Type* phi_type = Type::get_const_type(type);
  54       value = PhiNode::make(region, value, phi_type);
  55       gvn->set_type(value, phi_type);
  56     }
  57     vt->set_field_value(i, value);
  58   }
  59   gvn->set_type(vt, vt->bottom_type());
  60   return vt;
  61 }
  62 
  63 // Checks if the inputs of the ValueBaseTypeNode were replaced by PhiNodes
  64 // for the given region (see ValueBaseTypeNode::clone_with_phis).
  65 bool ValueTypeBaseNode::has_phi_inputs(Node* region) {
  66   // Check oop input
  67   bool result = get_oop()->is_Phi() && get_oop()->as_Phi()->region() == region;
  68 #ifdef ASSERT
  69   if (result) {
  70     // Check all field value inputs for consistency
  71     for (uint i = Oop; i < field_count(); ++i) {
  72       Node* n = in(i);
  73       if (n->is_ValueTypeBase()) {
  74         assert(n->as_ValueTypeBase()->has_phi_inputs(region), "inconsistent phi inputs");
  75       } else {
  76         assert(n->is_Phi() && n->as_Phi()->region() == region, "inconsistent phi inputs");
  77       }
  78     }
  79   }
  80 #endif
  81   return result;
  82 }
  83 
  84 // Merges 'this' with 'other' by updating the input PhiNodes added by 'clone_with_phis'
  85 ValueTypeBaseNode* ValueTypeBaseNode::merge_with(PhaseGVN* gvn, const ValueTypeBaseNode* other, int pnum, bool transform) {
  86   // Merge oop inputs
  87   PhiNode* phi = get_oop()->as_Phi();
  88   phi->set_req(pnum, other->get_oop());
  89   if (transform) {
  90     set_oop(gvn->transform(phi));
  91     gvn->record_for_igvn(phi);
  92   }
  93   // Merge field values
  94   for (uint i = 0; i < field_count(); ++i) {
  95     Node* val1 =        field_value(i);
  96     Node* val2 = other->field_value(i);
  97     if (val1->isa_ValueType()) {
  98       val1->as_ValueType()->merge_with(gvn, val2->as_ValueType(), pnum, transform);
  99     } else {
 100       assert(val1->is_Phi(), "must be a phi node");
 101       assert(!val2->is_ValueType(), "inconsistent merge values");
 102       val1->set_req(pnum, val2);
 103     }
 104     if (transform) {
 105       set_field_value(i, gvn->transform(val1));
 106       gvn->record_for_igvn(val1);
 107     }
 108   }
 109   return this;
 110 }
 111 
 112 Node* ValueTypeBaseNode::field_value(uint index) const {
 113   assert(index < field_count(), "index out of bounds");
 114   return in(Values + index);
 115 }
 116 
 117 // Get the value of the field at the given offset.
 118 // If 'recursive' is true, flattened value type fields will be resolved recursively.
 119 Node* ValueTypeBaseNode::field_value_by_offset(int offset, bool recursive) const {
 120   // If the field at 'offset' belongs to a flattened value type field, 'index' refers to the
 121   // corresponding ValueTypeNode input and 'sub_offset' is the offset in flattened value type.
 122   int index = value_klass()->field_index_by_offset(offset);
 123   int sub_offset = offset - field_offset(index);
 124   Node* value = field_value(index);
 125   if (recursive && value->is_ValueType()) {
 126     // Flattened value type field
 127     ValueTypeNode* vt = value->as_ValueType();
 128     sub_offset += vt->value_klass()->first_field_offset(); // Add header size
 129     return vt->field_value_by_offset(sub_offset);
 130   }
 131   assert(!(recursive && value->is_ValueType()), "should not be a value type");
 132   assert(sub_offset == 0, "offset mismatch");
 133   return value;
 134 }
 135 
 136 void ValueTypeBaseNode::set_field_value(uint index, Node* value) {
 137   assert(index < field_count(), "index out of bounds");
 138   set_req(Values + index, value);
 139 }
 140 
 141 int ValueTypeBaseNode::field_offset(uint index) const {
 142   assert(index < field_count(), "index out of bounds");
 143   return value_klass()->field_offset_by_index(index);
 144 }
 145 
 146 ciType* ValueTypeBaseNode::field_type(uint index) const {
 147   assert(index < field_count(), "index out of bounds");
 148   return value_klass()->field_type_by_index(index);
 149 }
 150 
 151 int ValueTypeBaseNode::make_scalar_in_safepoint(SafePointNode* sfpt, Node* root, PhaseGVN* gvn) {
 152   ciValueKlass* vk = value_klass();
 153   uint nfields = vk->flattened_field_count();
 154   JVMState* jvms = sfpt->jvms();
 155   int start = jvms->debug_start();
 156   int end   = jvms->debug_end();
 157   // Replace safepoint edge by SafePointScalarObjectNode and add field values
 158   assert(jvms != NULL, "missing JVMS");
 159   uint first_ind = (sfpt->req() - jvms->scloff());
 160   const TypeValueTypePtr* res_type = value_type_ptr();
 161   SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type,
 162 #ifdef ASSERT
 163                                                                   NULL,
 164 #endif
 165                                                                   first_ind, nfields);
 166   sobj->init_req(0, root);
 167   // Iterate over the value type fields in order of increasing
 168   // offset and add the field values to the safepoint.
 169   for (uint j = 0; j < nfields; ++j) {
 170     int offset = vk->nonstatic_field_at(j)->offset();
 171     Node* value = field_value_by_offset(offset, true /* include flattened value type fields */);
 172     assert(value != NULL, "");
 173     sfpt->add_req(value);
 174   }
 175   jvms->set_endoff(sfpt->req());
 176   if (gvn != NULL) {
 177     sobj = gvn->transform(sobj)->as_SafePointScalarObject();
 178     gvn->igvn_rehash_node_delayed(sfpt);
 179   }
 180   return sfpt->replace_edges_in_range(this, sobj, start, end);
 181 }
 182 
 183 void ValueTypeBaseNode::make_scalar_in_safepoints(Node* root, PhaseGVN* gvn) {
 184   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
 185     Node* u = fast_out(i);
 186     if (u->is_SafePoint() && (!u->is_Call() || u->as_Call()->has_debug_use(this))) {
 187       SafePointNode* sfpt = u->as_SafePoint();
 188       Node* in_oop = get_oop();
 189       const Type* oop_type = in_oop->bottom_type();
 190       assert(Opcode() == Op_ValueTypePtr || TypePtr::NULL_PTR->higher_equal(oop_type), "already heap allocated value type should be linked directly");
 191       int nb = make_scalar_in_safepoint(sfpt, root, gvn);
 192       --i; imax -= nb;
 193     }
 194   }
 195 }
 196 
 197 ValueTypeNode* ValueTypeNode::make(PhaseGVN& gvn, ciValueKlass* klass) {
 198   // Create a new ValueTypeNode with uninitialized values and NULL oop
 199   const TypeValueType* type = TypeValueType::make(klass);
 200   return new ValueTypeNode(type, gvn.zerocon(T_VALUETYPE));
 201 }
 202 
 203 Node* ValueTypeNode::make_default(PhaseGVN& gvn, ciValueKlass* vk) {
 204   // TODO re-use constant oop of pre-allocated default value type here?
 205   // Create a new ValueTypeNode with default values
 206   ValueTypeNode* vt = ValueTypeNode::make(gvn, vk);
 207   for (uint i = 0; i < vt->field_count(); ++i) {
 208     ciType* field_type = vt->field_type(i);
 209     Node* value = NULL;
 210     if (field_type->is_valuetype()) {
 211       value = ValueTypeNode::make_default(gvn, field_type->as_value_klass());
 212     } else {
 213       value = gvn.zerocon(field_type->basic_type());
 214     }
 215     vt->set_field_value(i, value);
 216   }
 217   return gvn.transform(vt);
 218 }
 219 
 220 Node* ValueTypeNode::make(PhaseGVN& gvn, Node* mem, Node* oop) {
 221   // Create and initialize a ValueTypeNode by loading all field
 222   // values from a heap-allocated version and also save the oop.
 223   const TypeValueType* type = gvn.type(oop)->is_valuetypeptr()->value_type();
 224   ValueTypeNode* vt = new ValueTypeNode(type, oop);
 225   vt->load(gvn, mem, oop, oop, type->value_klass());
 226   assert(vt->is_allocated(&gvn), "value type should be allocated");
 227   assert(oop->is_Con() || oop->is_CheckCastPP() || oop->Opcode() == Op_ValueTypePtr || vt->is_loaded(&gvn, type) == oop, "value type should be loaded");
 228   return gvn.transform(vt);
 229 }
 230 
 231 Node* ValueTypeNode::make(PhaseGVN& gvn, ciValueKlass* vk, Node* mem, Node* obj, Node* ptr, ciInstanceKlass* holder, int holder_offset) {
 232   // Create and initialize a ValueTypeNode by loading all field values from
 233   // a flattened value type field at 'holder_offset' or from a value type array.
 234   ValueTypeNode* vt = make(gvn, vk);
 235   // The value type is flattened into the object without an oop header. Subtract the
 236   // offset of the first field to account for the missing header when loading the values.
 237   holder_offset -= vk->first_field_offset();
 238   vt->load(gvn, mem, obj, ptr, holder, holder_offset);
 239   assert(vt->is_loaded(&gvn, vt->type()->isa_valuetype()) != obj, "holder oop should not be used as flattened value type oop");
 240   return gvn.transform(vt)->as_ValueType();
 241 }
 242 
 243 void ValueTypeNode::load(PhaseGVN& gvn, Node* mem, Node* base, Node* ptr, ciInstanceKlass* holder, int holder_offset) {
 244   // Initialize the value type by loading its field values from
 245   // memory and adding the values as input edges to the node.
 246   for (uint i = 0; i < field_count(); ++i) {
 247     int offset = holder_offset + field_offset(i);


 407   // Update GraphKit
 408   kit->set_control(kit->gvn().transform(region));
 409   kit->set_i_o(kit->gvn().transform(io));
 410   kit->set_all_memory(kit->gvn().transform(mem));
 411   kit->record_for_igvn(region);
 412   kit->record_for_igvn(oop);
 413   kit->record_for_igvn(io);
 414   kit->record_for_igvn(mem);
 415 
 416   // Use cloned ValueTypeNode to propagate oop from now on
 417   Node* res_oop = kit->gvn().transform(oop);
 418   ValueTypeNode* vt = clone()->as_ValueType();
 419   vt->set_oop(res_oop);
 420   kit->replace_in_map(this, kit->gvn().transform(vt));
 421   return res_oop;
 422 }
 423 
 424 bool ValueTypeNode::is_allocated(PhaseGVN* phase) const {
 425   const Type* oop_type = phase->type(get_oop());
 426   return oop_type->meet(TypePtr::NULL_PTR) != oop_type;



























































































































































 427 }
 428 
 429 void ValueTypeNode::pass_klass(Node* n, uint pos, const GraphKit& kit) {
 430   ciValueKlass* vk = value_klass();
 431   const TypeKlassPtr* tk = TypeKlassPtr::make(vk);
 432   intptr_t bits = tk->get_con();
 433   set_nth_bit(bits, 0);
 434   Node* klass_tagged = kit.MakeConX(bits);
 435   n->init_req(pos, klass_tagged);
 436 }
 437 
 438 uint ValueTypeNode::pass_fields(Node* n, int base_input, const GraphKit& kit, ciValueKlass* base_vk, int base_offset) {
 439   ciValueKlass* vk = value_klass();
 440   if (base_vk == NULL) {
 441     base_vk = vk;
 442   }
 443   uint edges = 0;
 444   for (uint i = 0; i < field_count(); i++) {
 445     ciType* f_type = field_type(i);
 446     int offset = base_offset + field_offset(i) - (base_offset > 0 ? vk->first_field_offset() : 0);


< prev index next >