src/share/vm/opto/idealKit.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7032314 Sdiff src/share/vm/opto

src/share/vm/opto/idealKit.hpp

Print this page




  91 };
  92 
  93 class IdealKit: public StackObj {
  94  friend class IdealVariable;
  95   // The main state (called a cvstate for Control and Variables)
  96   // contains both the current values of the variables and the
  97   // current set of predecessor control edges.  The variable values
  98   // are managed via a Node [in(1)..in(_var_ct)], and the predecessor
  99   // control edges managed via a RegionNode. The in(0) of the Node
 100   // for variables points to the RegionNode for the control edges.
 101  protected:
 102   Compile * const C;
 103   PhaseGVN &_gvn;
 104   GrowableArray<Node*>* _pending_cvstates; // stack of cvstates
 105   GrowableArray<Node*>* _delay_transform;  // delay invoking gvn.transform until drain
 106   Node* _cvstate;                          // current cvstate (control, memory and variables)
 107   uint _var_ct;                            // number of variables
 108   bool _delay_all_transforms;              // flag forcing all transforms to be delayed
 109   Node* _initial_ctrl;                     // saves initial control until variables declared
 110   Node* _initial_memory;                   // saves initial memory  until variables declared

 111 
 112   PhaseGVN& gvn() const { return _gvn; }
 113   // Create a new cvstate filled with nulls
 114   Node* new_cvstate();                     // Create a new cvstate
 115   Node* cvstate() { return _cvstate; }     // current cvstate
 116   Node* copy_cvstate();                    // copy current cvstate
 117 
 118   void set_memory(Node* mem, uint alias_idx );
 119   void do_memory_merge(Node* merging, Node* join);
 120   void clear(Node* m);                     // clear a cvstate
 121   void stop() { clear(_cvstate); }         // clear current cvstate
 122   Node* delay_transform(Node* n);
 123   Node* transform(Node* n);                // gvn.transform or push node on delay list
 124   Node* promote_to_phi(Node* n, Node* reg);// Promote "n" to a phi on region "reg"
 125   bool was_promoted_to_phi(Node* n, Node* reg) {
 126     return (n->is_Phi() && n->in(0) == reg);
 127   }
 128   void declare(IdealVariable* v) { v->set_id(_var_ct++); }
 129   // This declares the position where vars are kept in the cvstate
 130   // For some degree of consistency we use the TypeFunc enum to
 131   // soak up spots in the inputs even though we only use early Control
 132   // and Memory slots. (So far.)
 133   static const uint first_var; // = TypeFunc::Parms + 1;
 134 
 135 #ifdef ASSERT
 136   enum State { NullS=0, BlockS=1, LoopS=2, IfThenS=4, ElseS=8, EndifS= 16 };
 137   GrowableArray<int>* _state;
 138   State state() { return (State)(_state->top()); }
 139 #endif
 140 
 141   // Users should not care about slices only MergedMem so no access for them.
 142   Node* memory(uint alias_idx);
 143 
 144  public:
 145   IdealKit(PhaseGVN &gvn, Node* control, Node* memory, bool delay_all_transforms = false, bool has_declarations = false);
 146   ~IdealKit() {
 147     stop();
 148     drain_delay_transform();
 149   }


 150   // Control
 151   Node* ctrl()                          { return _cvstate->in(TypeFunc::Control); }
 152   void set_ctrl(Node* ctrl)             { _cvstate->set_req(TypeFunc::Control, ctrl); }
 153   Node* top()                           { return C->top(); }
 154   MergeMemNode* merged_memory()         { return _cvstate->in(TypeFunc::Memory)->as_MergeMem(); }
 155   void set_all_memory(Node* mem)        { _cvstate->set_req(TypeFunc::Memory, mem); }


 156   void set(IdealVariable& v, Node* rhs) { _cvstate->set_req(first_var + v.id(), rhs); }
 157   Node* value(IdealVariable& v)         { return _cvstate->in(first_var + v.id()); }
 158   void dead(IdealVariable& v)           { set(v, (Node*)NULL); }
 159   void if_then(Node* left, BoolTest::mask relop, Node* right,
 160                float prob = PROB_FAIR, float cnt = COUNT_UNKNOWN,
 161                bool push_new_state = true);
 162   void else_();
 163   void end_if();
 164   void loop(GraphKit* gkit, int nargs, IdealVariable& iv, Node* init, BoolTest::mask cmp, Node* limit,
 165             float prob = PROB_LIKELY(0.9), float cnt = COUNT_UNKNOWN);
 166   void end_loop();
 167   Node* make_label(int goto_ct);
 168   void bind(Node* lab);
 169   void goto_(Node* lab, bool bind = false);
 170   void declarations_done();
 171   void drain_delay_transform();
 172 
 173   Node* IfTrue(IfNode* iff)  { return transform(new (C,1) IfTrueNode(iff)); }
 174   Node* IfFalse(IfNode* iff) { return transform(new (C,1) IfFalseNode(iff)); }
 175 


 222               Node* val,
 223               BasicType bt,
 224               int adr_idx,
 225               bool require_atomic_access = false);
 226 
 227   // Store a card mark ordered after store_oop
 228   Node* storeCM(Node* ctl,
 229                 Node* adr,
 230                 Node* val,
 231                 Node* oop_store,
 232                 int oop_adr_idx,
 233                 BasicType bt,
 234                 int adr_idx);
 235 
 236   // Trivial call
 237   void make_leaf_call(const TypeFunc *slow_call_type,
 238                       address slow_call,
 239                       const char *leaf_name,
 240                       Node* parm0,
 241                       Node* parm1 = NULL,
 242                       Node* parm2 = NULL);











 243 };
 244 
 245 #endif // SHARE_VM_OPTO_IDEALKIT_HPP


  91 };
  92 
  93 class IdealKit: public StackObj {
  94  friend class IdealVariable;
  95   // The main state (called a cvstate for Control and Variables)
  96   // contains both the current values of the variables and the
  97   // current set of predecessor control edges.  The variable values
  98   // are managed via a Node [in(1)..in(_var_ct)], and the predecessor
  99   // control edges managed via a RegionNode. The in(0) of the Node
 100   // for variables points to the RegionNode for the control edges.
 101  protected:
 102   Compile * const C;
 103   PhaseGVN &_gvn;
 104   GrowableArray<Node*>* _pending_cvstates; // stack of cvstates
 105   GrowableArray<Node*>* _delay_transform;  // delay invoking gvn.transform until drain
 106   Node* _cvstate;                          // current cvstate (control, memory and variables)
 107   uint _var_ct;                            // number of variables
 108   bool _delay_all_transforms;              // flag forcing all transforms to be delayed
 109   Node* _initial_ctrl;                     // saves initial control until variables declared
 110   Node* _initial_memory;                   // saves initial memory  until variables declared
 111   Node* _initial_i_o;                      // saves initial i_o  until variables declared
 112 
 113   PhaseGVN& gvn() const { return _gvn; }
 114   // Create a new cvstate filled with nulls
 115   Node* new_cvstate();                     // Create a new cvstate
 116   Node* cvstate() { return _cvstate; }     // current cvstate
 117   Node* copy_cvstate();                    // copy current cvstate
 118 
 119   void set_memory(Node* mem, uint alias_idx );
 120   void do_memory_merge(Node* merging, Node* join);
 121   void clear(Node* m);                     // clear a cvstate
 122   void stop() { clear(_cvstate); }         // clear current cvstate
 123   Node* delay_transform(Node* n);
 124   Node* transform(Node* n);                // gvn.transform or push node on delay list
 125   Node* promote_to_phi(Node* n, Node* reg);// Promote "n" to a phi on region "reg"
 126   bool was_promoted_to_phi(Node* n, Node* reg) {
 127     return (n->is_Phi() && n->in(0) == reg);
 128   }
 129   void declare(IdealVariable* v) { v->set_id(_var_ct++); }
 130   // This declares the position where vars are kept in the cvstate
 131   // For some degree of consistency we use the TypeFunc enum to
 132   // soak up spots in the inputs even though we only use early Control
 133   // and Memory slots. (So far.)
 134   static const uint first_var; // = TypeFunc::Parms + 1;
 135 
 136 #ifdef ASSERT
 137   enum State { NullS=0, BlockS=1, LoopS=2, IfThenS=4, ElseS=8, EndifS= 16 };
 138   GrowableArray<int>* _state;
 139   State state() { return (State)(_state->top()); }
 140 #endif
 141 
 142   // Users should not care about slices only MergedMem so no access for them.
 143   Node* memory(uint alias_idx);
 144 
 145  public:
 146   IdealKit(GraphKit* gkit, bool delay_all_transforms = false, bool has_declarations = false);
 147   ~IdealKit() {
 148     stop();
 149     drain_delay_transform();
 150   }
 151   void sync_kit(GraphKit* gkit);
 152 
 153   // Control
 154   Node* ctrl()                          { return _cvstate->in(TypeFunc::Control); }
 155   void set_ctrl(Node* ctrl)             { _cvstate->set_req(TypeFunc::Control, ctrl); }
 156   Node* top()                           { return C->top(); }
 157   MergeMemNode* merged_memory()         { return _cvstate->in(TypeFunc::Memory)->as_MergeMem(); }
 158   void set_all_memory(Node* mem)        { _cvstate->set_req(TypeFunc::Memory, mem); }
 159   Node* i_o()                           { return _cvstate->in(TypeFunc::I_O); }
 160   void set_i_o(Node* c)                 { _cvstate->set_req(TypeFunc::I_O, c); }
 161   void set(IdealVariable& v, Node* rhs) { _cvstate->set_req(first_var + v.id(), rhs); }
 162   Node* value(IdealVariable& v)         { return _cvstate->in(first_var + v.id()); }
 163   void dead(IdealVariable& v)           { set(v, (Node*)NULL); }
 164   void if_then(Node* left, BoolTest::mask relop, Node* right,
 165                float prob = PROB_FAIR, float cnt = COUNT_UNKNOWN,
 166                bool push_new_state = true);
 167   void else_();
 168   void end_if();
 169   void loop(GraphKit* gkit, int nargs, IdealVariable& iv, Node* init, BoolTest::mask cmp, Node* limit,
 170             float prob = PROB_LIKELY(0.9), float cnt = COUNT_UNKNOWN);
 171   void end_loop();
 172   Node* make_label(int goto_ct);
 173   void bind(Node* lab);
 174   void goto_(Node* lab, bool bind = false);
 175   void declarations_done();
 176   void drain_delay_transform();
 177 
 178   Node* IfTrue(IfNode* iff)  { return transform(new (C,1) IfTrueNode(iff)); }
 179   Node* IfFalse(IfNode* iff) { return transform(new (C,1) IfFalseNode(iff)); }
 180 


 227               Node* val,
 228               BasicType bt,
 229               int adr_idx,
 230               bool require_atomic_access = false);
 231 
 232   // Store a card mark ordered after store_oop
 233   Node* storeCM(Node* ctl,
 234                 Node* adr,
 235                 Node* val,
 236                 Node* oop_store,
 237                 int oop_adr_idx,
 238                 BasicType bt,
 239                 int adr_idx);
 240 
 241   // Trivial call
 242   void make_leaf_call(const TypeFunc *slow_call_type,
 243                       address slow_call,
 244                       const char *leaf_name,
 245                       Node* parm0,
 246                       Node* parm1 = NULL,
 247                       Node* parm2 = NULL,
 248                       Node* parm3 = NULL);
 249 
 250   void make_leaf_call_no_fp(const TypeFunc *slow_call_type,
 251                             address slow_call,
 252                             const char *leaf_name,
 253                             const TypePtr* adr_type,
 254                             Node* parm0,
 255                             Node* parm1,
 256                             Node* parm2,
 257                             Node* parm3);
 258 
 259 };
 260 
 261 #endif // SHARE_VM_OPTO_IDEALKIT_HPP
src/share/vm/opto/idealKit.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File