src/share/vm/c1/c1_Instruction.hpp

changeset 2138
d5d065957597
parent 1939
b812ff5abc73
child 2146
3a294e483abc
     1.1 --- a/src/share/vm/c1/c1_Instruction.hpp	Thu Sep 02 11:40:02 2010 -0700
     1.2 +++ b/src/share/vm/c1/c1_Instruction.hpp	Fri Sep 03 17:51:07 2010 -0700
     1.3 @@ -98,7 +98,7 @@
     1.4  class         UnsafePrefetchRead;
     1.5  class         UnsafePrefetchWrite;
     1.6  class   ProfileCall;
     1.7 -class   ProfileCounter;
     1.8 +class   ProfileInvoke;
     1.9  
    1.10  // A Value is a reference to the instruction creating the value
    1.11  typedef Instruction* Value;
    1.12 @@ -195,7 +195,7 @@
    1.13    virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) = 0;
    1.14    virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
    1.15    virtual void do_ProfileCall    (ProfileCall*     x) = 0;
    1.16 -  virtual void do_ProfileCounter (ProfileCounter*  x) = 0;
    1.17 +  virtual void do_ProfileInvoke  (ProfileInvoke*   x) = 0;
    1.18  };
    1.19  
    1.20  
    1.21 @@ -1734,19 +1734,44 @@
    1.22  
    1.23  LEAF(Goto, BlockEnd)
    1.24   public:
    1.25 +  enum Direction {
    1.26 +    none,            // Just a regular goto
    1.27 +    taken, not_taken // Goto produced from If
    1.28 +  };
    1.29 + private:
    1.30 +  ciMethod*   _profiled_method;
    1.31 +  int         _profiled_bci;
    1.32 +  Direction   _direction;
    1.33 + public:
    1.34    // creation
    1.35 -  Goto(BlockBegin* sux, ValueStack* state_before, bool is_safepoint = false) : BlockEnd(illegalType, state_before, is_safepoint) {
    1.36 +  Goto(BlockBegin* sux, ValueStack* state_before, bool is_safepoint = false)
    1.37 +    : BlockEnd(illegalType, state_before, is_safepoint)
    1.38 +    , _direction(none)
    1.39 +    , _profiled_method(NULL)
    1.40 +    , _profiled_bci(0) {
    1.41      BlockList* s = new BlockList(1);
    1.42      s->append(sux);
    1.43      set_sux(s);
    1.44    }
    1.45  
    1.46 -  Goto(BlockBegin* sux, bool is_safepoint) : BlockEnd(illegalType, NULL, is_safepoint) {
    1.47 +  Goto(BlockBegin* sux, bool is_safepoint) : BlockEnd(illegalType, NULL, is_safepoint)
    1.48 +                                           , _direction(none)
    1.49 +                                           , _profiled_method(NULL)
    1.50 +                                           , _profiled_bci(0) {
    1.51      BlockList* s = new BlockList(1);
    1.52      s->append(sux);
    1.53      set_sux(s);
    1.54    }
    1.55  
    1.56 +  bool should_profile() const                    { return check_flag(ProfileMDOFlag); }
    1.57 +  ciMethod* profiled_method() const              { return _profiled_method; } // set only for profiled branches
    1.58 +  int profiled_bci() const                       { return _profiled_bci; }
    1.59 +  Direction direction() const                    { return _direction; }
    1.60 +
    1.61 +  void set_should_profile(bool value)            { set_flag(ProfileMDOFlag, value); }
    1.62 +  void set_profiled_method(ciMethod* method)     { _profiled_method = method; }
    1.63 +  void set_profiled_bci(int bci)                 { _profiled_bci = bci; }
    1.64 +  void set_direction(Direction d)                { _direction = d; }
    1.65  };
    1.66  
    1.67  
    1.68 @@ -1757,6 +1782,8 @@
    1.69    Value       _y;
    1.70    ciMethod*   _profiled_method;
    1.71    int         _profiled_bci; // Canonicalizer may alter bci of If node
    1.72 +  bool        _swapped;      // Is the order reversed with respect to the original If in the
    1.73 +                             // bytecode stream?
    1.74   public:
    1.75    // creation
    1.76    // unordered_is_true is valid for float/double compares only
    1.77 @@ -1767,6 +1794,7 @@
    1.78    , _y(y)
    1.79    , _profiled_method(NULL)
    1.80    , _profiled_bci(0)
    1.81 +  , _swapped(false)
    1.82    {
    1.83      ASSERT_VALUES
    1.84      set_flag(UnorderedIsTrueFlag, unordered_is_true);
    1.85 @@ -1788,7 +1816,8 @@
    1.86    BlockBegin* usux() const                       { return sux_for(unordered_is_true()); }
    1.87    bool should_profile() const                    { return check_flag(ProfileMDOFlag); }
    1.88    ciMethod* profiled_method() const              { return _profiled_method; } // set only for profiled branches
    1.89 -  int profiled_bci() const                       { return _profiled_bci; }    // set only for profiled branches
    1.90 +  int profiled_bci() const                       { return _profiled_bci; }    // set for profiled branches and tiered
    1.91 +  bool is_swapped() const                        { return _swapped; }
    1.92  
    1.93    // manipulation
    1.94    void swap_operands() {
    1.95 @@ -1807,7 +1836,7 @@
    1.96    void set_should_profile(bool value)             { set_flag(ProfileMDOFlag, value); }
    1.97    void set_profiled_method(ciMethod* method)      { _profiled_method = method; }
    1.98    void set_profiled_bci(int bci)                  { _profiled_bci = bci;       }
    1.99 -
   1.100 +  void set_swapped(bool value)                    { _swapped = value;         }
   1.101    // generic
   1.102    virtual void input_values_do(ValueVisitor* f)   { BlockEnd::input_values_do(f); f->visit(&_x); f->visit(&_y); }
   1.103  };
   1.104 @@ -2235,7 +2264,6 @@
   1.105    }
   1.106  };
   1.107  
   1.108 -
   1.109  LEAF(ProfileCall, Instruction)
   1.110   private:
   1.111    ciMethod* _method;
   1.112 @@ -2263,35 +2291,32 @@
   1.113    virtual void input_values_do(ValueVisitor* f)   { if (_recv != NULL) f->visit(&_recv); }
   1.114  };
   1.115  
   1.116 +// Use to trip invocation counter of an inlined method
   1.117  
   1.118 -//
   1.119 -// Simple node representing a counter update generally used for updating MDOs
   1.120 -//
   1.121 -LEAF(ProfileCounter, Instruction)
   1.122 +LEAF(ProfileInvoke, Instruction)
   1.123   private:
   1.124 -  Value     _mdo;
   1.125 -  int       _offset;
   1.126 -  int       _increment;
   1.127 +  ciMethod*   _inlinee;
   1.128 +  ValueStack* _state;
   1.129 +  int         _bci_of_invoke;
   1.130  
   1.131   public:
   1.132 -  ProfileCounter(Value mdo, int offset, int increment = 1)
   1.133 +  ProfileInvoke(ciMethod* inlinee,  ValueStack* state, int bci)
   1.134      : Instruction(voidType)
   1.135 -    , _mdo(mdo)
   1.136 -    , _offset(offset)
   1.137 -    , _increment(increment)
   1.138 +    , _inlinee(inlinee)
   1.139 +    , _bci_of_invoke(bci)
   1.140 +    , _state(state)
   1.141    {
   1.142 -    // The ProfileCounter has side-effects and must occur precisely where located
   1.143 +    // The ProfileInvoke has side-effects and must occur precisely where located QQQ???
   1.144      pin();
   1.145    }
   1.146  
   1.147 -  Value mdo()      { return _mdo; }
   1.148 -  int offset()     { return _offset; }
   1.149 -  int increment()  { return _increment; }
   1.150 -
   1.151 -  virtual void input_values_do(ValueVisitor* f)   { f->visit(&_mdo); }
   1.152 +  ciMethod* inlinee()      { return _inlinee; }
   1.153 +  ValueStack* state()      { return _state; }
   1.154 +  int bci_of_invoke()      { return _bci_of_invoke; }
   1.155 +  virtual void input_values_do(ValueVisitor*)   {}
   1.156 +  virtual void state_values_do(ValueVisitor*);
   1.157  };
   1.158  
   1.159 -
   1.160  class BlockPair: public CompilationResourceObj {
   1.161   private:
   1.162    BlockBegin* _from;

mercurial