src/share/vm/opto/valuetypenode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File valhalla Sdiff src/share/vm/opto

src/share/vm/opto/valuetypenode.cpp

Print this page




  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 "ci/ciValueKlass.hpp"
  26 #include "opto/addnode.hpp"
  27 #include "opto/graphKit.hpp"
  28 #include "opto/valuetypenode.hpp"
  29 #include "opto/phaseX.hpp"
  30 
  31 Node* ValueTypeNode::make(PhaseGVN& gvn, ciValueKlass* klass) {
  32   // Create a new ValueTypeNode with uninitialized values and NULL oop
  33   const TypeValueType* type = TypeValueType::make(klass);
  34   return new ValueTypeNode(type, gvn.zerocon(T_VALUETYPE));
  35 }
  36 
  37 Node* ValueTypeNode::make(PhaseGVN& gvn, Node* mem, Node* oop) {
  38   // Create and initialize a ValueTypeNode by loading all field
  39   // values from memory and also save the oop to the heap allocated version.
  40   const TypeValueTypePtr* vtptr = gvn.type(oop)->is_valuetypeptr();
  41   ValueTypeNode* vt = new ValueTypeNode(vtptr->value_type(), oop);
  42   for (uint index = 0; index < vt->field_count(); ++index) {
  43     int offset = vt->get_field_offset(index);
  44     const TypePtr* adr_type = vtptr->add_offset(offset);
  45     const Type* field_type = Type::get_const_basic_type(vt->get_field_type(index));
  46     Node* adr = gvn.transform(new AddPNode(oop, oop, gvn.longcon(offset)));
  47     Node* ld = LoadNode::make(gvn, NULL, mem, adr, adr_type, field_type, field_type->basic_type(), MemNode::unordered);
  48     vt->set_field_value(index, gvn.transform(ld));
  49   }
  50   return gvn.transform(vt);
  51 }
  52 
  53 Node* ValueTypeNode::store_to_memory(GraphKit* kit) {
  54   Node* in_oop = get_oop();
  55   Node* null_ctl = kit->top();
  56   // Check if value type is already allocated
  57   Node* not_null_oop = kit->null_check_oop(in_oop, &null_ctl);
  58   if (null_ctl->is_top()) {
  59     // Value type is allocated




  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 "ci/ciValueKlass.hpp"
  26 #include "opto/addnode.hpp"
  27 #include "opto/graphKit.hpp"
  28 #include "opto/valuetypenode.hpp"
  29 #include "opto/phaseX.hpp"
  30 
  31 Node* ValueTypeNode::make(PhaseGVN& gvn, ciValueKlass* klass) {
  32   // Create a new ValueTypeNode with uninitialized values and NULL oop
  33   const TypeValueType* type = TypeValueType::make(klass);
  34   return new ValueTypeNode(type, gvn.zerocon(T_VALUETYPE));
  35 }
  36 
  37 Node* ValueTypeNode::make(PhaseGVN& gvn, Node* mem, Node* oop) {
  38   // Create and initialize a ValueTypeNode by loading all field
  39   // values from memory and also save the oop to the heap-allocated version.
  40   const TypeValueTypePtr* vtptr = gvn.type(oop)->is_valuetypeptr();
  41   ValueTypeNode* vt = new ValueTypeNode(vtptr->value_type(), oop);
  42   for (uint index = 0; index < vt->field_count(); ++index) {
  43     int offset = vt->get_field_offset(index);
  44     const TypePtr* adr_type = vtptr->add_offset(offset);
  45     const Type* field_type = Type::get_const_basic_type(vt->get_field_type(index));
  46     Node* adr = gvn.transform(new AddPNode(oop, oop, gvn.longcon(offset)));
  47     Node* ld = LoadNode::make(gvn, NULL, mem, adr, adr_type, field_type, field_type->basic_type(), MemNode::unordered);
  48     vt->set_field_value(index, gvn.transform(ld));
  49   }
  50   return gvn.transform(vt);
  51 }
  52 
  53 Node* ValueTypeNode::store_to_memory(GraphKit* kit) {
  54   Node* in_oop = get_oop();
  55   Node* null_ctl = kit->top();
  56   // Check if value type is already allocated
  57   Node* not_null_oop = kit->null_check_oop(in_oop, &null_ctl);
  58   if (null_ctl->is_top()) {
  59     // Value type is allocated


src/share/vm/opto/valuetypenode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File