src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp

changeset 1876
a8127dc669ba
parent 1580
e018e6884bd8
child 1907
c18cbe5936b8
child 1926
2d127394260e
     1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Mon May 03 20:19:05 2010 -0700
     1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Mon May 10 12:31:52 2010 -0700
     1.3 @@ -33,140 +33,6 @@
     1.4  class ObjectClosureCareful;
     1.5  class Klass;
     1.6  
     1.7 -class PromotedObject VALUE_OBJ_CLASS_SPEC {
     1.8 - private:
     1.9 -  enum {
    1.10 -    promoted_mask  = right_n_bits(2),   // i.e. 0x3
    1.11 -    displaced_mark = nth_bit(2),        // i.e. 0x4
    1.12 -    next_mask      = ~(right_n_bits(3)) // i.e. ~(0x7)
    1.13 -  };
    1.14 -  intptr_t _next;
    1.15 - public:
    1.16 -  inline PromotedObject* next() const {
    1.17 -    return (PromotedObject*)(_next & next_mask);
    1.18 -  }
    1.19 -  inline void setNext(PromotedObject* x) {
    1.20 -    assert(((intptr_t)x & ~next_mask) == 0,
    1.21 -           "Conflict in bit usage, "
    1.22 -           " or insufficient alignment of objects");
    1.23 -    _next |= (intptr_t)x;
    1.24 -  }
    1.25 -  inline void setPromotedMark() {
    1.26 -    _next |= promoted_mask;
    1.27 -  }
    1.28 -  inline bool hasPromotedMark() const {
    1.29 -    return (_next & promoted_mask) == promoted_mask;
    1.30 -  }
    1.31 -  inline void setDisplacedMark() {
    1.32 -    _next |= displaced_mark;
    1.33 -  }
    1.34 -  inline bool hasDisplacedMark() const {
    1.35 -    return (_next & displaced_mark) != 0;
    1.36 -  }
    1.37 -  inline void clearNext()        { _next = 0; }
    1.38 -  debug_only(void *next_addr() { return (void *) &_next; })
    1.39 -};
    1.40 -
    1.41 -class SpoolBlock: public FreeChunk {
    1.42 -  friend class PromotionInfo;
    1.43 - protected:
    1.44 -  SpoolBlock*  nextSpoolBlock;
    1.45 -  size_t       bufferSize;        // number of usable words in this block
    1.46 -  markOop*     displacedHdr;      // the displaced headers start here
    1.47 -
    1.48 -  // Note about bufferSize: it denotes the number of entries available plus 1;
    1.49 -  // legal indices range from 1 through BufferSize - 1.  See the verification
    1.50 -  // code verify() that counts the number of displaced headers spooled.
    1.51 -  size_t computeBufferSize() {
    1.52 -    return (size() * sizeof(HeapWord) - sizeof(*this)) / sizeof(markOop);
    1.53 -  }
    1.54 -
    1.55 - public:
    1.56 -  void init() {
    1.57 -    bufferSize = computeBufferSize();
    1.58 -    displacedHdr = (markOop*)&displacedHdr;
    1.59 -    nextSpoolBlock = NULL;
    1.60 -  }
    1.61 -
    1.62 -  void print_on(outputStream* st) const;
    1.63 -  void print() const { print_on(gclog_or_tty); }
    1.64 -};
    1.65 -
    1.66 -class PromotionInfo VALUE_OBJ_CLASS_SPEC {
    1.67 -  bool            _tracking;      // set if tracking
    1.68 -  CompactibleFreeListSpace* _space; // the space to which this belongs
    1.69 -  PromotedObject* _promoHead;     // head of list of promoted objects
    1.70 -  PromotedObject* _promoTail;     // tail of list of promoted objects
    1.71 -  SpoolBlock*     _spoolHead;     // first spooling block
    1.72 -  SpoolBlock*     _spoolTail;     // last  non-full spooling block or null
    1.73 -  SpoolBlock*     _splice_point;  // when _spoolTail is null, holds list tail
    1.74 -  SpoolBlock*     _spareSpool;    // free spool buffer
    1.75 -  size_t          _firstIndex;    // first active index in
    1.76 -                                  // first spooling block (_spoolHead)
    1.77 -  size_t          _nextIndex;     // last active index + 1 in last
    1.78 -                                  // spooling block (_spoolTail)
    1.79 - private:
    1.80 -  // ensure that spooling space exists; return true if there is spooling space
    1.81 -  bool ensure_spooling_space_work();
    1.82 -
    1.83 - public:
    1.84 -  PromotionInfo() :
    1.85 -    _tracking(0), _space(NULL),
    1.86 -    _promoHead(NULL), _promoTail(NULL),
    1.87 -    _spoolHead(NULL), _spoolTail(NULL),
    1.88 -    _spareSpool(NULL), _firstIndex(1),
    1.89 -    _nextIndex(1) {}
    1.90 -
    1.91 -  bool noPromotions() const {
    1.92 -    assert(_promoHead != NULL || _promoTail == NULL, "list inconsistency");
    1.93 -    return _promoHead == NULL;
    1.94 -  }
    1.95 -  void startTrackingPromotions();
    1.96 -  void stopTrackingPromotions(uint worker_id = 0);
    1.97 -  bool tracking() const          { return _tracking;  }
    1.98 -  void track(PromotedObject* trackOop);      // keep track of a promoted oop
    1.99 -  // The following variant must be used when trackOop is not fully
   1.100 -  // initialized and has a NULL klass:
   1.101 -  void track(PromotedObject* trackOop, klassOop klassOfOop); // keep track of a promoted oop
   1.102 -  void setSpace(CompactibleFreeListSpace* sp) { _space = sp; }
   1.103 -  CompactibleFreeListSpace* space() const     { return _space; }
   1.104 -  markOop nextDisplacedHeader(); // get next header & forward spool pointer
   1.105 -  void    saveDisplacedHeader(markOop hdr);
   1.106 -                                 // save header and forward spool
   1.107 -
   1.108 -  inline size_t refillSize() const;
   1.109 -
   1.110 -  SpoolBlock* getSpoolBlock();   // return a free spooling block
   1.111 -  inline bool has_spooling_space() {
   1.112 -    return _spoolTail != NULL && _spoolTail->bufferSize > _nextIndex;
   1.113 -  }
   1.114 -  // ensure that spooling space exists
   1.115 -  bool ensure_spooling_space() {
   1.116 -    return has_spooling_space() || ensure_spooling_space_work();
   1.117 -  }
   1.118 -  #define PROMOTED_OOPS_ITERATE_DECL(OopClosureType, nv_suffix)  \
   1.119 -    void promoted_oops_iterate##nv_suffix(OopClosureType* cl);
   1.120 -  ALL_SINCE_SAVE_MARKS_CLOSURES(PROMOTED_OOPS_ITERATE_DECL)
   1.121 -  #undef PROMOTED_OOPS_ITERATE_DECL
   1.122 -  void promoted_oops_iterate(OopsInGenClosure* cl) {
   1.123 -    promoted_oops_iterate_v(cl);
   1.124 -  }
   1.125 -  void verify()  const;
   1.126 -  void reset() {
   1.127 -    _promoHead = NULL;
   1.128 -    _promoTail = NULL;
   1.129 -    _spoolHead = NULL;
   1.130 -    _spoolTail = NULL;
   1.131 -    _spareSpool = NULL;
   1.132 -    _firstIndex = 0;
   1.133 -    _nextIndex = 0;
   1.134 -
   1.135 -  }
   1.136 -
   1.137 -  void print_on(outputStream* st) const;
   1.138 -  void print_statistics(uint worker_id) const;
   1.139 -};
   1.140 -
   1.141  class LinearAllocBlock VALUE_OBJ_CLASS_SPEC {
   1.142   public:
   1.143    LinearAllocBlock() : _ptr(0), _word_size(0), _refillSize(0),
   1.144 @@ -557,6 +423,12 @@
   1.145    // promoted since the most recent call to save_marks() on
   1.146    // this generation and has not subsequently been iterated
   1.147    // over (using oop_since_save_marks_iterate() above).
   1.148 +  // This property holds only for single-threaded collections,
   1.149 +  // and is typically used for Cheney scans; for MT scavenges,
   1.150 +  // the property holds for all objects promoted during that
   1.151 +  // scavenge for the duration of the scavenge and is used
   1.152 +  // by card-scanning to avoid scanning objects (being) promoted
   1.153 +  // during that scavenge.
   1.154    bool obj_allocated_since_save_marks(const oop obj) const {
   1.155      assert(is_in_reserved(obj), "Wrong space?");
   1.156      return ((PromotedObject*)obj)->hasPromotedMark();

mercurial