< prev index next >

src/share/vm/opto/valuetypenode.hpp

Print this page




  32 
  33 //------------------------------ValueTypeNode-------------------------------------
  34 // Node representing a value type in C2 IR
  35 class ValueTypeNode : public TypeNode {
  36 private:
  37   ValueTypeNode(const TypeValueType* t, Node* oop)
  38     : TypeNode(t, Values + t->value_klass()->nof_declared_nonstatic_fields()) {
  39     init_class_id(Class_ValueType);
  40     init_req(Oop, oop);
  41   }
  42 
  43   ValueTypeNode(const TypeValueType* t, Node* oop, int field_count)
  44     : TypeNode(t, Values + field_count) {
  45     init_class_id(Class_ValueType);
  46     init_req(Oop, oop);
  47   }
  48 
  49   // Get the klass defining the field layout of the value type
  50   ciValueKlass* value_klass() const { return type()->is_valuetype()->value_klass(); }
  51   // Initialize the value type by loading its field values from memory
  52   void load_values(PhaseGVN& gvn, Node* mem, ciInstanceKlass* holder, Node* base, int base_offset = 0);
  53 
  54   enum { Control,   // Control input
  55          Oop,       // Oop of TypeValueTypePtr
  56          Values     // Nodes corresponding to values of the value type's fields.
  57                     // Nodes are connected in increasing order of the index of the field
  58                     // they correspond to. Field indeces are defined in ciValueKlass::_field_index_map.
  59   };
  60 
  61 public:
  62   // Create a new ValueTypeNode with uninitialized values
  63   static ValueTypeNode* make(PhaseGVN& gvn, ciValueKlass* klass);


  64   // Create a new ValueTypeNode and load its values from an oop
  65   static Node* make(PhaseGVN& gvn, Node* mem, Node* oop);
  66   // Create a new ValueTypeNode and load its values from a flattened value type field
  67   static Node* make(PhaseGVN& gvn, ciValueKlass* klass, Node* mem, ciInstanceKlass* holder, Node* obj, int field_offset);
  68 
  69   // Support for control flow merges
  70   ValueTypeNode* clone_with_phis(PhaseGVN& gvn, Node* region);
  71   bool  has_phi_inputs(Node* region);
  72   Node* merge_with(GraphKit* kit, const ValueTypeNode* other, int pnum);
  73 
  74   // Store the value type to memory if not yet allocated and returns the oop
  75   Node* store_to_memory(GraphKit* kit);
  76   // Store the value type in a field of an object
  77   void store_to_field(GraphKit* kit, ciInstanceKlass* holder, Node* obj, int field_offset) const;
  78   // Store the field values to memory
  79   void store_values(GraphKit* kit, ciInstanceKlass* holder, Node* base, int base_offset = 0) const;
  80 
  81   // Get oop for heap allocated value type (may be TypePtr::NULL_PTR)
  82   Node* get_oop() const    { return in(Oop); }
  83   void  set_oop(Node* oop) { set_req(Oop, oop); }
  84 
  85   // Value type fields
  86   uint          field_count() const { return req() - Values; }
  87   Node*         field_value(uint index) const;
  88   Node*         field_value_by_offset(int offset, bool recursive = false) const;
  89   void      set_field_value(uint index, Node* value);
  90   int           field_offset(uint index) const;
  91   ciType*       field_type(uint index) const;
  92 
  93   // Replace ValueTypeNodes in debug info at safepoints with SafePointScalarObjectNodes
  94   void make_scalar_in_safepoints(Compile* C);
  95   uint set_arguments_for_java_call(CallJavaNode* call, int base_input, const GraphKit& kit, ciValueKlass* base_vk = NULL, int base_offset = 0);
  96   virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
  97   virtual int Opcode() const;
  98 
  99 #ifndef PRODUCT


  32 
  33 //------------------------------ValueTypeNode-------------------------------------
  34 // Node representing a value type in C2 IR
  35 class ValueTypeNode : public TypeNode {
  36 private:
  37   ValueTypeNode(const TypeValueType* t, Node* oop)
  38     : TypeNode(t, Values + t->value_klass()->nof_declared_nonstatic_fields()) {
  39     init_class_id(Class_ValueType);
  40     init_req(Oop, oop);
  41   }
  42 
  43   ValueTypeNode(const TypeValueType* t, Node* oop, int field_count)
  44     : TypeNode(t, Values + field_count) {
  45     init_class_id(Class_ValueType);
  46     init_req(Oop, oop);
  47   }
  48 
  49   // Get the klass defining the field layout of the value type
  50   ciValueKlass* value_klass() const { return type()->is_valuetype()->value_klass(); }
  51   // Initialize the value type by loading its field values from memory
  52   void load_values(PhaseGVN& gvn, Node* mem, Node* base, Node* ptr, ciKlass* holder = NULL, int f_offset = 0);
  53 
  54   enum { Control,   // Control input
  55          Oop,       // Oop of TypeValueTypePtr
  56          Values     // Nodes corresponding to values of the value type's fields.
  57                     // Nodes are connected in increasing order of the index of the field
  58                     // they correspond to. Field indeces are defined in ciValueKlass::_field_index_map.
  59   };
  60 
  61 public:
  62   // Create a new ValueTypeNode with uninitialized values
  63   static ValueTypeNode* make(PhaseGVN& gvn, ciValueKlass* klass);
  64   // Create a new ValueTypeNode with default values
  65   static Node* make_default(PhaseGVN& gvn, ciValueKlass* vk);
  66   // Create a new ValueTypeNode and load its values from an oop
  67   static Node* make(PhaseGVN& gvn, Node* mem, Node* oop);
  68   // Create a new ValueTypeNode and load its values from a flattened value type field or array
  69   static Node* make(PhaseGVN& gvn, ciValueKlass* vk, Node* mem, Node* obj, Node* ptr, ciKlass* holder, int field_offset = 0);
  70 
  71   // Support for control flow merges
  72   ValueTypeNode* clone_with_phis(PhaseGVN& gvn, Node* region);
  73   bool  has_phi_inputs(Node* region);
  74   Node* merge_with(GraphKit* kit, const ValueTypeNode* other, int pnum);
  75 
  76   // Store the value type to memory if not yet allocated and returns the oop
  77   Node* store_to_memory(GraphKit* kit);
  78   // Store the value type in a field of an object
  79   void store_to_field(GraphKit* kit, Node* obj, Node* ptr, ciInstanceKlass* instance_type, int field_offset) const;
  80   // Store the field values to memory
  81   void store_values(GraphKit* kit, Node* base, Node* ptr, ciKlass* holder = NULL, int holder_offset = 0) const;
  82 
  83   // Get oop for heap allocated value type (may be TypePtr::NULL_PTR)
  84   Node* get_oop() const    { return in(Oop); }
  85   void  set_oop(Node* oop) { set_req(Oop, oop); }
  86 
  87   // Value type fields
  88   uint          field_count() const { return req() - Values; }
  89   Node*         field_value(uint index) const;
  90   Node*         field_value_by_offset(int offset, bool recursive = false) const;
  91   void      set_field_value(uint index, Node* value);
  92   int           field_offset(uint index) const;
  93   ciType*       field_type(uint index) const;
  94 
  95   // Replace ValueTypeNodes in debug info at safepoints with SafePointScalarObjectNodes
  96   void make_scalar_in_safepoints(Compile* C);
  97   uint set_arguments_for_java_call(CallJavaNode* call, int base_input, const GraphKit& kit, ciValueKlass* base_vk = NULL, int base_offset = 0);
  98   virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
  99   virtual int Opcode() const;
 100 
 101 #ifndef PRODUCT
< prev index next >