< prev index next >

src/hotspot/share/interpreter/oopMapCache.hpp

Print this page




  75                                          // for testing bit_mask allocation
  76 
  77     bits_per_entry   = 2,
  78     dead_bit_number  = 1,
  79     oop_bit_number   = 0
  80   };
  81 
  82  private:
  83   Method*        _method;         // the method for which the mask is valid
  84   unsigned short _bci;            // the bci    for which the mask is valid
  85   int            _mask_size;      // the mask size in bits
  86   int            _expression_stack_size; // the size of the expression stack in slots
  87 
  88  protected:
  89   intptr_t       _bit_mask[N];    // the bit mask if
  90                                   // mask_size <= small_mask_limit,
  91                                   // ptr to bit mask otherwise
  92                                   // "protected" so that sub classes can
  93                                   // access it without using trickery in
  94                                   // methd bit_mask().

  95 #ifdef ASSERT
  96   bool _resource_allocate_bit_mask;
  97 #endif
  98 
  99   // access methods
 100   Method*        method() const                  { return _method; }
 101   void           set_method(Method* v)           { _method = v; }
 102   int            bci() const                     { return _bci; }
 103   void           set_bci(int v)                  { _bci = v; }
 104   int            mask_size() const               { return _mask_size; }
 105   void           set_mask_size(int v)            { _mask_size = v; }
 106   // Test bit mask size and return either the in-line bit mask or allocated
 107   // bit mask.
 108   uintptr_t*  bit_mask() const                   { return (uintptr_t*)(mask_size() <= small_mask_limit ? (intptr_t)_bit_mask : _bit_mask[0]); }
 109 
 110   // return the word size of_bit_mask.  mask_size() <= 4 * MAX_USHORT
 111   size_t mask_word_size() const {
 112     return (mask_size() + BitsPerWord - 1) / BitsPerWord;
 113   }
 114 


 122 
 123   // Initialization
 124   void initialize();
 125 
 126  public:
 127   InterpreterOopMap();
 128   ~InterpreterOopMap();
 129 
 130   // Copy the OopMapCacheEntry in parameter "from" into this
 131   // InterpreterOopMap.  If the _bit_mask[0] in "from" points to
 132   // allocated space (i.e., the bit mask was to large to hold
 133   // in-line), allocate the space from a Resource area.
 134   void resource_copy(OopMapCacheEntry* from);
 135 
 136   void iterate_oop(OffsetClosure* oop_closure) const;
 137   void print() const;
 138 
 139   int number_of_entries() const                  { return mask_size() / bits_per_entry; }
 140   bool is_dead(int offset) const                 { return (entry_at(offset) & (1 << dead_bit_number)) != 0; }
 141   bool is_oop (int offset) const                 { return (entry_at(offset) & (1 << oop_bit_number )) != 0; }

 142 
 143   int expression_stack_size() const              { return _expression_stack_size; }
 144 
 145 };
 146 
 147 class OopMapCache : public CHeapObj<mtClass> {
 148  static OopMapCacheEntry* volatile _old_entries;
 149  private:
 150   enum { _size        = 32,     // Use fixed size for now
 151          _probe_depth = 3       // probe depth in case of collisions
 152   };
 153 
 154   OopMapCacheEntry* volatile * _array;
 155 
 156   unsigned int hash_value_for(const methodHandle& method, int bci) const;
 157   OopMapCacheEntry* entry_at(int i) const;
 158   bool put_at(int i, OopMapCacheEntry* entry, OopMapCacheEntry* old);
 159 
 160   static void enqueue_for_cleanup(OopMapCacheEntry* entry);
 161 


  75                                          // for testing bit_mask allocation
  76 
  77     bits_per_entry   = 2,
  78     dead_bit_number  = 1,
  79     oop_bit_number   = 0
  80   };
  81 
  82  private:
  83   Method*        _method;         // the method for which the mask is valid
  84   unsigned short _bci;            // the bci    for which the mask is valid
  85   int            _mask_size;      // the mask size in bits
  86   int            _expression_stack_size; // the size of the expression stack in slots
  87 
  88  protected:
  89   intptr_t       _bit_mask[N];    // the bit mask if
  90                                   // mask_size <= small_mask_limit,
  91                                   // ptr to bit mask otherwise
  92                                   // "protected" so that sub classes can
  93                                   // access it without using trickery in
  94                                   // methd bit_mask().
  95   int            _num_oops;
  96 #ifdef ASSERT
  97   bool _resource_allocate_bit_mask;
  98 #endif
  99 
 100   // access methods
 101   Method*        method() const                  { return _method; }
 102   void           set_method(Method* v)           { _method = v; }
 103   int            bci() const                     { return _bci; }
 104   void           set_bci(int v)                  { _bci = v; }
 105   int            mask_size() const               { return _mask_size; }
 106   void           set_mask_size(int v)            { _mask_size = v; }
 107   // Test bit mask size and return either the in-line bit mask or allocated
 108   // bit mask.
 109   uintptr_t*  bit_mask() const                   { return (uintptr_t*)(mask_size() <= small_mask_limit ? (intptr_t)_bit_mask : _bit_mask[0]); }
 110 
 111   // return the word size of_bit_mask.  mask_size() <= 4 * MAX_USHORT
 112   size_t mask_word_size() const {
 113     return (mask_size() + BitsPerWord - 1) / BitsPerWord;
 114   }
 115 


 123 
 124   // Initialization
 125   void initialize();
 126 
 127  public:
 128   InterpreterOopMap();
 129   ~InterpreterOopMap();
 130 
 131   // Copy the OopMapCacheEntry in parameter "from" into this
 132   // InterpreterOopMap.  If the _bit_mask[0] in "from" points to
 133   // allocated space (i.e., the bit mask was to large to hold
 134   // in-line), allocate the space from a Resource area.
 135   void resource_copy(OopMapCacheEntry* from);
 136 
 137   void iterate_oop(OffsetClosure* oop_closure) const;
 138   void print() const;
 139 
 140   int number_of_entries() const                  { return mask_size() / bits_per_entry; }
 141   bool is_dead(int offset) const                 { return (entry_at(offset) & (1 << dead_bit_number)) != 0; }
 142   bool is_oop (int offset) const                 { return (entry_at(offset) & (1 << oop_bit_number )) != 0; }
 143   int  num_oops() const                          { return _num_oops; }
 144 
 145   int expression_stack_size() const              { return _expression_stack_size; }
 146 
 147 };
 148 
 149 class OopMapCache : public CHeapObj<mtClass> {
 150  static OopMapCacheEntry* volatile _old_entries;
 151  private:
 152   enum { _size        = 32,     // Use fixed size for now
 153          _probe_depth = 3       // probe depth in case of collisions
 154   };
 155 
 156   OopMapCacheEntry* volatile * _array;
 157 
 158   unsigned int hash_value_for(const methodHandle& method, int bci) const;
 159   OopMapCacheEntry* entry_at(int i) const;
 160   bool put_at(int i, OopMapCacheEntry* entry, OopMapCacheEntry* old);
 161 
 162   static void enqueue_for_cleanup(OopMapCacheEntry* entry);
 163 
< prev index next >