src/share/vm/memory/space.hpp

changeset 6981
ff1e37e7eb83
parent 6980
6c523f5d5440
child 7009
3f2894c5052e
     1.1 --- a/src/share/vm/memory/space.hpp	Wed Mar 12 17:13:48 2014 +0100
     1.2 +++ b/src/share/vm/memory/space.hpp	Wed Mar 12 15:25:35 2014 +0100
     1.3 @@ -104,6 +104,12 @@
     1.4  
     1.5    void set_saved_mark_word(HeapWord* p) { _saved_mark_word = p; }
     1.6  
     1.7 +  // Returns true if this object has been allocated since a
     1.8 +  // generation's "save_marks" call.
     1.9 +  virtual bool obj_allocated_since_save_marks(const oop obj) const {
    1.10 +    return (HeapWord*)obj >= saved_mark_word();
    1.11 +  }
    1.12 +
    1.13    MemRegionClosure* preconsumptionDirtyCardClosure() const {
    1.14      return _preconsumptionDirtyCardClosure;
    1.15    }
    1.16 @@ -111,9 +117,9 @@
    1.17      _preconsumptionDirtyCardClosure = cl;
    1.18    }
    1.19  
    1.20 -  // Returns a subregion of the space containing all the objects in
    1.21 +  // Returns a subregion of the space containing only the allocated objects in
    1.22    // the space.
    1.23 -  virtual MemRegion used_region() const { return MemRegion(bottom(), end()); }
    1.24 +  virtual MemRegion used_region() const = 0;
    1.25  
    1.26    // Returns a region that is guaranteed to contain (at least) all objects
    1.27    // allocated at the time of the last call to "save_marks".  If the space
    1.28 @@ -123,7 +129,7 @@
    1.29    // saved mark.  Otherwise, the "obj_allocated_since_save_marks" method of
    1.30    // the space must distiguish between objects in the region allocated before
    1.31    // and after the call to save marks.
    1.32 -  virtual MemRegion used_region_at_save_marks() const {
    1.33 +  MemRegion used_region_at_save_marks() const {
    1.34      return MemRegion(bottom(), saved_mark_word());
    1.35    }
    1.36  
    1.37 @@ -156,7 +162,9 @@
    1.38    // expensive operation. To prevent performance problems
    1.39    // on account of its inadvertent use in product jvm's,
    1.40    // we restrict its use to assertion checks only.
    1.41 -  virtual bool is_in(const void* p) const = 0;
    1.42 +  bool is_in(const void* p) const {
    1.43 +    return used_region().contains(p);
    1.44 +  }
    1.45  
    1.46    // Returns true iff the given reserved memory of the space contains the
    1.47    // given address.
    1.48 @@ -228,10 +236,6 @@
    1.49    // Allocation (return NULL if full).  Enforces mutual exclusion internally.
    1.50    virtual HeapWord* par_allocate(size_t word_size) = 0;
    1.51  
    1.52 -  // Returns true if this object has been allocated since a
    1.53 -  // generation's "save_marks" call.
    1.54 -  virtual bool obj_allocated_since_save_marks(const oop obj) const = 0;
    1.55 -
    1.56    // Mark-sweep-compact support: all spaces can update pointers to objects
    1.57    // moving as a part of compaction.
    1.58    virtual void adjust_pointers();
    1.59 @@ -363,7 +367,7 @@
    1.60  
    1.61    // Perform operations on the space needed after a compaction
    1.62    // has been performed.
    1.63 -  virtual void reset_after_compaction() {}
    1.64 +  virtual void reset_after_compaction() = 0;
    1.65  
    1.66    // Returns the next space (in the current generation) to be compacted in
    1.67    // the global compaction order.  Also is used to select the next
    1.68 @@ -428,7 +432,7 @@
    1.69    HeapWord* _end_of_live;
    1.70  
    1.71    // Minimum size of a free block.
    1.72 -  virtual size_t minimum_free_block_size() const = 0;
    1.73 +  virtual size_t minimum_free_block_size() const { return 0; }
    1.74  
    1.75    // This the function is invoked when an allocation of an object covering
    1.76    // "start" to "end occurs crosses the threshold; returns the next
    1.77 @@ -478,7 +482,7 @@
    1.78    HeapWord* top() const            { return _top;    }
    1.79    void set_top(HeapWord* value)    { _top = value; }
    1.80  
    1.81 -  virtual void set_saved_mark()    { _saved_mark_word = top();    }
    1.82 +  void set_saved_mark()            { _saved_mark_word = top();    }
    1.83    void reset_saved_mark()          { _saved_mark_word = bottom(); }
    1.84  
    1.85    WaterMark bottom_mark()     { return WaterMark(this, bottom()); }
    1.86 @@ -513,27 +517,16 @@
    1.87    size_t used() const            { return byte_size(bottom(), top()); }
    1.88    size_t free() const            { return byte_size(top(),    end()); }
    1.89  
    1.90 -  // Override from space.
    1.91 -  bool is_in(const void* p) const;
    1.92 -
    1.93    virtual bool is_free_block(const HeapWord* p) const;
    1.94  
    1.95    // In a contiguous space we have a more obvious bound on what parts
    1.96    // contain objects.
    1.97    MemRegion used_region() const { return MemRegion(bottom(), top()); }
    1.98  
    1.99 -  MemRegion used_region_at_save_marks() const {
   1.100 -    return MemRegion(bottom(), saved_mark_word());
   1.101 -  }
   1.102 -
   1.103    // Allocation (return NULL if full)
   1.104    virtual HeapWord* allocate(size_t word_size);
   1.105    virtual HeapWord* par_allocate(size_t word_size);
   1.106  
   1.107 -  virtual bool obj_allocated_since_save_marks(const oop obj) const {
   1.108 -    return (HeapWord*)obj >= saved_mark_word();
   1.109 -  }
   1.110 -
   1.111    // Iteration
   1.112    void oop_iterate(ExtendedOopClosure* cl);
   1.113    void object_iterate(ObjectClosure* blk);
   1.114 @@ -578,7 +571,6 @@
   1.115      // set new iteration safe limit
   1.116      set_concurrent_iteration_safe_limit(compaction_top());
   1.117    }
   1.118 -  virtual size_t minimum_free_block_size() const { return 0; }
   1.119  
   1.120    // Override.
   1.121    DirtyCardToOopClosure* new_dcto_cl(ExtendedOopClosure* cl,

mercurial