< prev index next >

src/hotspot/share/c1/c1_Instruction.hpp

Print this page


 447   ValueType* type() const                        { return _type; }
 448   BlockBegin *block() const                      { return _block; }
 449   Instruction* prev();                           // use carefully, expensive operation
 450   Instruction* next() const                      { return _next; }
 451   bool has_subst() const                         { return _subst != NULL; }
 452   Instruction* subst()                           { return _subst == NULL ? this : _subst->subst(); }
 453   LIR_Opr operand() const                        { return _operand; }
 454 
 455   void set_needs_null_check(bool f)              { set_flag(NeedsNullCheckFlag, f); }
 456   bool needs_null_check() const                  { return check_flag(NeedsNullCheckFlag); }
 457   void set_never_null(bool f)                    { set_flag(NeverNullFlag, f); }
 458   bool is_never_null() const                     { return check_flag(NeverNullFlag); }
 459   bool is_linked() const                         { return check_flag(IsLinkedInBlockFlag); }
 460   bool can_be_linked()                           { return as_Local() == NULL && as_Phi() == NULL; }
 461 
 462   bool has_uses() const                          { return use_count() > 0; }
 463   ValueStack* state_before() const               { return _state_before; }
 464   ValueStack* exception_state() const            { return _exception_state; }
 465   virtual bool needs_exception_state() const     { return true; }
 466   XHandlers* exception_handlers() const          { return _exception_handlers; }

 467 
 468   // manipulation
 469   void pin(PinReason reason)                     { _pin_state |= reason; }
 470   void pin()                                     { _pin_state |= PinUnknown; }
 471   // DANGEROUS: only used by EliminateStores
 472   void unpin(PinReason reason)                   { assert((reason & PinUnknown) == 0, "can't unpin unknown state"); _pin_state &= ~reason; }
 473 
 474   Instruction* set_next(Instruction* next) {
 475     assert(next->has_printable_bci(), "_printable_bci should have been set");
 476     assert(next != NULL, "must not be NULL");
 477     assert(as_BlockEnd() == NULL, "BlockEnd instructions must have no next");
 478     assert(next->can_be_linked(), "shouldn't link these instructions into list");
 479 
 480     BlockBegin *block = this->block();
 481     next->_block = block;
 482 
 483     next->set_flag(Instruction::IsLinkedInBlockFlag, true);
 484     _next = next;
 485     return next;
 486   }


1128   HASHING3(Op2, true, op(), x()->subst(), y()->subst())
1129 };
1130 
1131 
1132 LEAF(CompareOp, Op2)
1133  public:
1134   // creation
1135   CompareOp(Bytecodes::Code op, Value x, Value y, ValueStack* state_before)
1136   : Op2(intType, op, x, y, state_before)
1137   {}
1138 
1139   // generic
1140   HASHING3(Op2, true, op(), x()->subst(), y()->subst())
1141 };
1142 
1143 
1144 LEAF(IfOp, Op2)
1145  private:
1146   Value _tval;
1147   Value _fval;

1148 
1149  public:
1150   // creation
1151   IfOp(Value x, Condition cond, Value y, Value tval, Value fval)
1152   : Op2(tval->type()->meet(fval->type()), (Bytecodes::Code)cond, x, y)
1153   , _tval(tval)
1154   , _fval(fval)

1155   {
1156     ASSERT_VALUES
1157     assert(tval->type()->tag() == fval->type()->tag(), "types must match");

1158   }
1159 
1160   // accessors
1161   virtual bool is_commutative() const;
1162   Bytecodes::Code op() const                     { ShouldNotCallThis(); return Bytecodes::_illegal; }
1163   Condition cond() const                         { return (Condition)Op2::op(); }
1164   Value tval() const                             { return _tval; }
1165   Value fval() const                             { return _fval; }
1166 
1167   // generic
1168   virtual void input_values_do(ValueVisitor* f)   { Op2::input_values_do(f); f->visit(&_tval); f->visit(&_fval); }
1169 };
1170 
1171 
1172 LEAF(Convert, Instruction)
1173  private:
1174   Bytecodes::Code _op;
1175   Value           _value;
1176 
1177  public:
1178   // creation
1179   Convert(Bytecodes::Code op, Value value, ValueType* to_type) : Instruction(to_type), _op(op), _value(value) {
1180     ASSERT_VALUES
1181   }
1182 
1183   // accessors
1184   Bytecodes::Code op() const                     { return _op; }
1185   Value value() const                            { return _value; }
1186 


2037   Condition cond() const                         { return _cond; }
2038   bool unordered_is_true() const                 { return check_flag(UnorderedIsTrueFlag); }
2039   Value y() const                                { return _y; }
2040 
2041   void always_fail()                             { _x = _y = NULL; }
2042 
2043   // generic
2044   virtual void input_values_do(ValueVisitor* f)  { StateSplit::input_values_do(f); f->visit(&_x); f->visit(&_y); }
2045   HASHING3(RangeCheckPredicate, true, x()->subst(), y()->subst(), cond())
2046 };
2047 
2048 LEAF(If, BlockEnd)
2049  private:
2050   Value       _x;
2051   Condition   _cond;
2052   Value       _y;
2053   ciMethod*   _profiled_method;
2054   int         _profiled_bci; // Canonicalizer may alter bci of If node
2055   bool        _swapped;      // Is the order reversed with respect to the original If in the
2056                              // bytecode stream?

2057  public:
2058   // creation
2059   // unordered_is_true is valid for float/double compares only
2060   If(Value x, Condition cond, bool unordered_is_true, Value y, BlockBegin* tsux, BlockBegin* fsux, ValueStack* state_before, bool is_safepoint)
2061     : BlockEnd(illegalType, state_before, is_safepoint)
2062   , _x(x)
2063   , _cond(cond)
2064   , _y(y)
2065   , _profiled_method(NULL)
2066   , _profiled_bci(0)
2067   , _swapped(false)

2068   {
2069     ASSERT_VALUES
2070     set_flag(UnorderedIsTrueFlag, unordered_is_true);
2071     assert(x->type()->tag() == y->type()->tag(), "types must match");
2072     BlockList* s = new BlockList(2);
2073     s->append(tsux);
2074     s->append(fsux);
2075     set_sux(s);
2076   }
2077 
2078   // accessors
2079   Value x() const                                { return _x; }
2080   Condition cond() const                         { return _cond; }
2081   bool unordered_is_true() const                 { return check_flag(UnorderedIsTrueFlag); }
2082   Value y() const                                { return _y; }
2083   BlockBegin* sux_for(bool is_true) const        { return sux_at(is_true ? 0 : 1); }
2084   BlockBegin* tsux() const                       { return sux_for(true); }
2085   BlockBegin* fsux() const                       { return sux_for(false); }
2086   BlockBegin* usux() const                       { return sux_for(unordered_is_true()); }
2087   bool should_profile() const                    { return check_flag(ProfileMDOFlag); }


2090   bool is_swapped() const                        { return _swapped; }
2091 
2092   // manipulation
2093   void swap_operands() {
2094     Value t = _x; _x = _y; _y = t;
2095     _cond = mirror(_cond);
2096   }
2097 
2098   void swap_sux() {
2099     assert(number_of_sux() == 2, "wrong number of successors");
2100     BlockList* s = sux();
2101     BlockBegin* t = s->at(0); s->at_put(0, s->at(1)); s->at_put(1, t);
2102     _cond = negate(_cond);
2103     set_flag(UnorderedIsTrueFlag, !check_flag(UnorderedIsTrueFlag));
2104   }
2105 
2106   void set_should_profile(bool value)             { set_flag(ProfileMDOFlag, value); }
2107   void set_profiled_method(ciMethod* method)      { _profiled_method = method; }
2108   void set_profiled_bci(int bci)                  { _profiled_bci = bci;       }
2109   void set_swapped(bool value)                    { _swapped = value;         }

2110   // generic
2111   virtual void input_values_do(ValueVisitor* f)   { BlockEnd::input_values_do(f); f->visit(&_x); f->visit(&_y); }
2112 };
2113 
2114 
2115 LEAF(IfInstanceOf, BlockEnd)
2116  private:
2117   ciKlass* _klass;
2118   Value    _obj;
2119   bool     _test_is_instance;                    // jump if instance
2120   int      _instanceof_bci;
2121 
2122  public:
2123   IfInstanceOf(ciKlass* klass, Value obj, bool test_is_instance, int instanceof_bci, BlockBegin* tsux, BlockBegin* fsux)
2124   : BlockEnd(illegalType, NULL, false) // temporary set to false
2125   , _klass(klass)
2126   , _obj(obj)
2127   , _test_is_instance(test_is_instance)
2128   , _instanceof_bci(instanceof_bci)
2129   {




 447   ValueType* type() const                        { return _type; }
 448   BlockBegin *block() const                      { return _block; }
 449   Instruction* prev();                           // use carefully, expensive operation
 450   Instruction* next() const                      { return _next; }
 451   bool has_subst() const                         { return _subst != NULL; }
 452   Instruction* subst()                           { return _subst == NULL ? this : _subst->subst(); }
 453   LIR_Opr operand() const                        { return _operand; }
 454 
 455   void set_needs_null_check(bool f)              { set_flag(NeedsNullCheckFlag, f); }
 456   bool needs_null_check() const                  { return check_flag(NeedsNullCheckFlag); }
 457   void set_never_null(bool f)                    { set_flag(NeverNullFlag, f); }
 458   bool is_never_null() const                     { return check_flag(NeverNullFlag); }
 459   bool is_linked() const                         { return check_flag(IsLinkedInBlockFlag); }
 460   bool can_be_linked()                           { return as_Local() == NULL && as_Phi() == NULL; }
 461 
 462   bool has_uses() const                          { return use_count() > 0; }
 463   ValueStack* state_before() const               { return _state_before; }
 464   ValueStack* exception_state() const            { return _exception_state; }
 465   virtual bool needs_exception_state() const     { return true; }
 466   XHandlers* exception_handlers() const          { return _exception_handlers; }
 467   ciKlass* as_loaded_klass_or_null() const;
 468 
 469   // manipulation
 470   void pin(PinReason reason)                     { _pin_state |= reason; }
 471   void pin()                                     { _pin_state |= PinUnknown; }
 472   // DANGEROUS: only used by EliminateStores
 473   void unpin(PinReason reason)                   { assert((reason & PinUnknown) == 0, "can't unpin unknown state"); _pin_state &= ~reason; }
 474 
 475   Instruction* set_next(Instruction* next) {
 476     assert(next->has_printable_bci(), "_printable_bci should have been set");
 477     assert(next != NULL, "must not be NULL");
 478     assert(as_BlockEnd() == NULL, "BlockEnd instructions must have no next");
 479     assert(next->can_be_linked(), "shouldn't link these instructions into list");
 480 
 481     BlockBegin *block = this->block();
 482     next->_block = block;
 483 
 484     next->set_flag(Instruction::IsLinkedInBlockFlag, true);
 485     _next = next;
 486     return next;
 487   }


1129   HASHING3(Op2, true, op(), x()->subst(), y()->subst())
1130 };
1131 
1132 
1133 LEAF(CompareOp, Op2)
1134  public:
1135   // creation
1136   CompareOp(Bytecodes::Code op, Value x, Value y, ValueStack* state_before)
1137   : Op2(intType, op, x, y, state_before)
1138   {}
1139 
1140   // generic
1141   HASHING3(Op2, true, op(), x()->subst(), y()->subst())
1142 };
1143 
1144 
1145 LEAF(IfOp, Op2)
1146  private:
1147   Value _tval;
1148   Value _fval;
1149   bool _substituability_check;
1150 
1151  public:
1152   // creation
1153   IfOp(Value x, Condition cond, Value y, Value tval, Value fval, ValueStack* state_before, bool substituability_check)
1154   : Op2(tval->type()->meet(fval->type()), (Bytecodes::Code)cond, x, y)
1155   , _tval(tval)
1156   , _fval(fval)
1157   , _substituability_check(substituability_check)
1158   {
1159     ASSERT_VALUES
1160     assert(tval->type()->tag() == fval->type()->tag(), "types must match");
1161     set_state_before(state_before);
1162   }
1163 
1164   // accessors
1165   virtual bool is_commutative() const;
1166   Bytecodes::Code op() const                     { ShouldNotCallThis(); return Bytecodes::_illegal; }
1167   Condition cond() const                         { return (Condition)Op2::op(); }
1168   Value tval() const                             { return _tval; }
1169   Value fval() const                             { return _fval; }
1170   bool substituability_check() const             { return _substituability_check; }
1171   // generic
1172   virtual void input_values_do(ValueVisitor* f)   { Op2::input_values_do(f); f->visit(&_tval); f->visit(&_fval); }
1173 };
1174 
1175 
1176 LEAF(Convert, Instruction)
1177  private:
1178   Bytecodes::Code _op;
1179   Value           _value;
1180 
1181  public:
1182   // creation
1183   Convert(Bytecodes::Code op, Value value, ValueType* to_type) : Instruction(to_type), _op(op), _value(value) {
1184     ASSERT_VALUES
1185   }
1186 
1187   // accessors
1188   Bytecodes::Code op() const                     { return _op; }
1189   Value value() const                            { return _value; }
1190 


2041   Condition cond() const                         { return _cond; }
2042   bool unordered_is_true() const                 { return check_flag(UnorderedIsTrueFlag); }
2043   Value y() const                                { return _y; }
2044 
2045   void always_fail()                             { _x = _y = NULL; }
2046 
2047   // generic
2048   virtual void input_values_do(ValueVisitor* f)  { StateSplit::input_values_do(f); f->visit(&_x); f->visit(&_y); }
2049   HASHING3(RangeCheckPredicate, true, x()->subst(), y()->subst(), cond())
2050 };
2051 
2052 LEAF(If, BlockEnd)
2053  private:
2054   Value       _x;
2055   Condition   _cond;
2056   Value       _y;
2057   ciMethod*   _profiled_method;
2058   int         _profiled_bci; // Canonicalizer may alter bci of If node
2059   bool        _swapped;      // Is the order reversed with respect to the original If in the
2060                              // bytecode stream?
2061   bool        _substituability_check;
2062  public:
2063   // creation
2064   // unordered_is_true is valid for float/double compares only
2065   If(Value x, Condition cond, bool unordered_is_true, Value y, BlockBegin* tsux, BlockBegin* fsux, ValueStack* state_before, bool is_safepoint, bool substituability_check=false)
2066     : BlockEnd(illegalType, state_before, is_safepoint)
2067   , _x(x)
2068   , _cond(cond)
2069   , _y(y)
2070   , _profiled_method(NULL)
2071   , _profiled_bci(0)
2072   , _swapped(false)
2073   , _substituability_check(substituability_check)
2074   {
2075     ASSERT_VALUES
2076     set_flag(UnorderedIsTrueFlag, unordered_is_true);
2077     assert(x->type()->tag() == y->type()->tag(), "types must match");
2078     BlockList* s = new BlockList(2);
2079     s->append(tsux);
2080     s->append(fsux);
2081     set_sux(s);
2082   }
2083 
2084   // accessors
2085   Value x() const                                { return _x; }
2086   Condition cond() const                         { return _cond; }
2087   bool unordered_is_true() const                 { return check_flag(UnorderedIsTrueFlag); }
2088   Value y() const                                { return _y; }
2089   BlockBegin* sux_for(bool is_true) const        { return sux_at(is_true ? 0 : 1); }
2090   BlockBegin* tsux() const                       { return sux_for(true); }
2091   BlockBegin* fsux() const                       { return sux_for(false); }
2092   BlockBegin* usux() const                       { return sux_for(unordered_is_true()); }
2093   bool should_profile() const                    { return check_flag(ProfileMDOFlag); }


2096   bool is_swapped() const                        { return _swapped; }
2097 
2098   // manipulation
2099   void swap_operands() {
2100     Value t = _x; _x = _y; _y = t;
2101     _cond = mirror(_cond);
2102   }
2103 
2104   void swap_sux() {
2105     assert(number_of_sux() == 2, "wrong number of successors");
2106     BlockList* s = sux();
2107     BlockBegin* t = s->at(0); s->at_put(0, s->at(1)); s->at_put(1, t);
2108     _cond = negate(_cond);
2109     set_flag(UnorderedIsTrueFlag, !check_flag(UnorderedIsTrueFlag));
2110   }
2111 
2112   void set_should_profile(bool value)             { set_flag(ProfileMDOFlag, value); }
2113   void set_profiled_method(ciMethod* method)      { _profiled_method = method; }
2114   void set_profiled_bci(int bci)                  { _profiled_bci = bci;       }
2115   void set_swapped(bool value)                    { _swapped = value;         }
2116   bool substituability_check() const              { return _substituability_check; }
2117   // generic
2118   virtual void input_values_do(ValueVisitor* f)   { BlockEnd::input_values_do(f); f->visit(&_x); f->visit(&_y); }
2119 };
2120 
2121 
2122 LEAF(IfInstanceOf, BlockEnd)
2123  private:
2124   ciKlass* _klass;
2125   Value    _obj;
2126   bool     _test_is_instance;                    // jump if instance
2127   int      _instanceof_bci;
2128 
2129  public:
2130   IfInstanceOf(ciKlass* klass, Value obj, bool test_is_instance, int instanceof_bci, BlockBegin* tsux, BlockBegin* fsux)
2131   : BlockEnd(illegalType, NULL, false) // temporary set to false
2132   , _klass(klass)
2133   , _obj(obj)
2134   , _test_is_instance(test_is_instance)
2135   , _instanceof_bci(instanceof_bci)
2136   {


< prev index next >