< prev index next >

src/hotspot/share/oops/generateOopMap.hpp

Print this page




  54  private:
  55   static int _init_nof_jsrs;                      // Default size of jsrs list
  56   int _target_bci;                                // Target PC address of jump (bytecode index)
  57   GrowableArray<intptr_t> * _jsrs;                     // List of return addresses  (bytecode index)
  58   RetTableEntry *_next;                           // Link to next entry
  59  public:
  60    RetTableEntry(int target, RetTableEntry *next);
  61 
  62   // Query
  63   int target_bci() const                      { return _target_bci; }
  64   int nof_jsrs() const                        { return _jsrs->length(); }
  65   int jsrs(int i) const                       { assert(i>=0 && i<nof_jsrs(), "Index out of bounds"); return _jsrs->at(i); }
  66 
  67   // Update entry
  68   void add_jsr    (int return_bci)            { _jsrs->append(return_bci); }
  69   void add_delta  (int bci, int delta);
  70   RetTableEntry * next()  const               { return _next; }
  71 };
  72 
  73 
  74 class RetTable VALUE_OBJ_CLASS_SPEC {
  75  private:
  76   RetTableEntry *_first;
  77   static int _init_nof_entries;
  78 
  79   void add_jsr(int return_bci, int target_bci);   // Adds entry to list
  80  public:
  81   RetTable()                                                  { _first = NULL; }
  82   void compute_ret_table(const methodHandle& method);
  83   void update_ret_table(int bci, int delta);
  84   RetTableEntry* find_jsrs_for_target(int targBci);
  85 };
  86 
  87 //
  88 // CellTypeState
  89 //
  90 class CellTypeState VALUE_OBJ_CLASS_SPEC {
  91  private:
  92   unsigned int _state;
  93 
  94   // Masks for separating the BITS and INFO portions of a CellTypeState
  95   enum { info_mask            = right_n_bits(28),
  96          bits_mask            = (int)(~info_mask) };
  97 
  98   // These constant are used for manipulating the BITS portion of a
  99   // CellTypeState
 100   enum { uninit_bit           = (int)(nth_bit(31)),
 101          ref_bit              = nth_bit(30),
 102          val_bit              = nth_bit(29),
 103          addr_bit             = nth_bit(28),
 104          live_bits_mask       = (int)(bits_mask & ~uninit_bit) };
 105 
 106   // These constants are used for manipulating the INFO portion of a
 107   // CellTypeState
 108   enum { top_info_bit         = nth_bit(27),
 109          not_bottom_info_bit  = nth_bit(26),
 110          info_data_mask       = right_n_bits(26),


 271   CellTypeState* stack()                    { return _state + _max_locals; }
 272 
 273   bool changed()                            { return _changed; }
 274   void set_changed(bool s)                  { _changed = s; }
 275 
 276   bool is_reachable() const                 { return _stack_top >= 0; }  // Analysis has reached this basicblock
 277 
 278   // All basicblocks that are unreachable are going to have a _stack_top == _dead_basic_block.
 279   // This info. is setup in a pre-parse before the real abstract interpretation starts.
 280   bool is_dead() const                      { return _stack_top == _dead_basic_block; }
 281   bool is_alive() const                     { return _stack_top != _dead_basic_block; }
 282   void mark_as_alive()                      { assert(is_dead(), "must be dead"); _stack_top = _unreached; }
 283 };
 284 
 285 
 286 //
 287 //  GenerateOopMap
 288 //
 289 // Main class used to compute the pointer-maps in a Method
 290 //
 291 class GenerateOopMap VALUE_OBJ_CLASS_SPEC {
 292  protected:
 293 
 294   // _monitor_top is set to this constant to indicate that a monitor matching
 295   // problem was encountered prior to this point in control flow.
 296   enum { bad_monitors = -1 };
 297 
 298   // Main variables
 299   methodHandle _method;                     // The method we are examine
 300   RetTable     _rt;                         // Contains the return address mappings
 301   int          _max_locals;                 // Cached value of no. of locals
 302   int          _max_stack;                  // Cached value of max. stack depth
 303   int          _max_monitors;               // Cached value of max. monitor stack depth
 304   int          _has_exceptions;             // True, if exceptions exist for method
 305   bool         _got_error;                  // True, if an error occurred during interpretation.
 306   Handle       _exception;                  // Exception if got_error is true.
 307   bool         _did_rewriting;              // was bytecodes rewritten
 308   bool         _did_relocation;             // was relocation neccessary
 309   bool         _monitor_safe;               // The monitors in this method have been determined
 310                                             // to be safe.
 311 




  54  private:
  55   static int _init_nof_jsrs;                      // Default size of jsrs list
  56   int _target_bci;                                // Target PC address of jump (bytecode index)
  57   GrowableArray<intptr_t> * _jsrs;                     // List of return addresses  (bytecode index)
  58   RetTableEntry *_next;                           // Link to next entry
  59  public:
  60    RetTableEntry(int target, RetTableEntry *next);
  61 
  62   // Query
  63   int target_bci() const                      { return _target_bci; }
  64   int nof_jsrs() const                        { return _jsrs->length(); }
  65   int jsrs(int i) const                       { assert(i>=0 && i<nof_jsrs(), "Index out of bounds"); return _jsrs->at(i); }
  66 
  67   // Update entry
  68   void add_jsr    (int return_bci)            { _jsrs->append(return_bci); }
  69   void add_delta  (int bci, int delta);
  70   RetTableEntry * next()  const               { return _next; }
  71 };
  72 
  73 
  74 class RetTable {
  75  private:
  76   RetTableEntry *_first;
  77   static int _init_nof_entries;
  78 
  79   void add_jsr(int return_bci, int target_bci);   // Adds entry to list
  80  public:
  81   RetTable()                                                  { _first = NULL; }
  82   void compute_ret_table(const methodHandle& method);
  83   void update_ret_table(int bci, int delta);
  84   RetTableEntry* find_jsrs_for_target(int targBci);
  85 };
  86 
  87 //
  88 // CellTypeState
  89 //
  90 class CellTypeState {
  91  private:
  92   unsigned int _state;
  93 
  94   // Masks for separating the BITS and INFO portions of a CellTypeState
  95   enum { info_mask            = right_n_bits(28),
  96          bits_mask            = (int)(~info_mask) };
  97 
  98   // These constant are used for manipulating the BITS portion of a
  99   // CellTypeState
 100   enum { uninit_bit           = (int)(nth_bit(31)),
 101          ref_bit              = nth_bit(30),
 102          val_bit              = nth_bit(29),
 103          addr_bit             = nth_bit(28),
 104          live_bits_mask       = (int)(bits_mask & ~uninit_bit) };
 105 
 106   // These constants are used for manipulating the INFO portion of a
 107   // CellTypeState
 108   enum { top_info_bit         = nth_bit(27),
 109          not_bottom_info_bit  = nth_bit(26),
 110          info_data_mask       = right_n_bits(26),


 271   CellTypeState* stack()                    { return _state + _max_locals; }
 272 
 273   bool changed()                            { return _changed; }
 274   void set_changed(bool s)                  { _changed = s; }
 275 
 276   bool is_reachable() const                 { return _stack_top >= 0; }  // Analysis has reached this basicblock
 277 
 278   // All basicblocks that are unreachable are going to have a _stack_top == _dead_basic_block.
 279   // This info. is setup in a pre-parse before the real abstract interpretation starts.
 280   bool is_dead() const                      { return _stack_top == _dead_basic_block; }
 281   bool is_alive() const                     { return _stack_top != _dead_basic_block; }
 282   void mark_as_alive()                      { assert(is_dead(), "must be dead"); _stack_top = _unreached; }
 283 };
 284 
 285 
 286 //
 287 //  GenerateOopMap
 288 //
 289 // Main class used to compute the pointer-maps in a Method
 290 //
 291 class GenerateOopMap {
 292  protected:
 293 
 294   // _monitor_top is set to this constant to indicate that a monitor matching
 295   // problem was encountered prior to this point in control flow.
 296   enum { bad_monitors = -1 };
 297 
 298   // Main variables
 299   methodHandle _method;                     // The method we are examine
 300   RetTable     _rt;                         // Contains the return address mappings
 301   int          _max_locals;                 // Cached value of no. of locals
 302   int          _max_stack;                  // Cached value of max. stack depth
 303   int          _max_monitors;               // Cached value of max. monitor stack depth
 304   int          _has_exceptions;             // True, if exceptions exist for method
 305   bool         _got_error;                  // True, if an error occurred during interpretation.
 306   Handle       _exception;                  // Exception if got_error is true.
 307   bool         _did_rewriting;              // was bytecodes rewritten
 308   bool         _did_relocation;             // was relocation neccessary
 309   bool         _monitor_safe;               // The monitors in this method have been determined
 310                                             // to be safe.
 311 


< prev index next >