< prev index next >

src/share/vm/memory/generation.hpp

Print this page
rev 7420 : [mq]: removeOneContigSpaceGeneration


  28 #include "gc_implementation/shared/collectorCounters.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/memRegion.hpp"
  31 #include "memory/referenceProcessor.hpp"
  32 #include "memory/universe.hpp"
  33 #include "memory/watermark.hpp"
  34 #include "runtime/mutex.hpp"
  35 #include "runtime/perfData.hpp"
  36 #include "runtime/virtualspace.hpp"
  37 
  38 // A Generation models a heap area for similarly-aged objects.
  39 // It will contain one ore more spaces holding the actual objects.
  40 //
  41 // The Generation class hierarchy:
  42 //
  43 // Generation                      - abstract base class
  44 // - DefNewGeneration              - allocation area (copy collected)
  45 //   - ParNewGeneration            - a DefNewGeneration that is collected by
  46 //                                   several threads
  47 // - CardGeneration                 - abstract class adding offset array behavior
  48 //   - OneContigSpaceCardGeneration - abstract class holding a single
  49 //                                    contiguous space with card marking
  50 //     - TenuredGeneration         - tenured (old object) space (markSweepCompact)
  51 //   - ConcurrentMarkSweepGeneration - Mostly Concurrent Mark Sweep Generation
  52 //                                       (Detlefs-Printezis refinement of
  53 //                                       Boehm-Demers-Schenker)
  54 //
  55 // The system configurations currently allowed are:
  56 //
  57 //   DefNewGeneration + TenuredGeneration
  58 //   DefNewGeneration + ConcurrentMarkSweepGeneration
  59 //
  60 //   ParNewGeneration + TenuredGeneration
  61 //   ParNewGeneration + ConcurrentMarkSweepGeneration
  62 //
  63 
  64 class DefNewGeneration;
  65 class GenerationSpec;
  66 class CompactibleSpace;
  67 class ContiguousSpace;
  68 class CompactPoint;
  69 class OopsInGenClosure;


 626   // Attempt to expand the generation by "bytes".  Expand by at a
 627   // minimum "expand_bytes".  Return true if some amount (not
 628   // necessarily the full "bytes") was done.
 629   virtual bool expand(size_t bytes, size_t expand_bytes);
 630 
 631   // Shrink generation with specified size (returns false if unable to shrink)
 632   virtual void shrink(size_t bytes) = 0;
 633 
 634   virtual void compute_new_size();
 635 
 636   virtual void clear_remembered_set();
 637 
 638   virtual void invalidate_remembered_set();
 639 
 640   virtual void prepare_for_verify();
 641 
 642   // Grow generation with specified size (returns false if unable to grow)
 643   virtual bool grow_by(size_t bytes) = 0;
 644   // Grow generation to reserved size.
 645   virtual bool grow_to_reserved() = 0;
 646 };
 647 
 648 // OneContigSpaceCardGeneration models a heap of old objects contained in a single
 649 // contiguous space.
 650 //
 651 // Garbage collection is performed using mark-compact.
 652 
 653 class OneContigSpaceCardGeneration: public CardGeneration {
 654   friend class VMStructs;
 655   // Abstractly, this is a subtype that gets access to protected fields.
 656   friend class VM_PopulateDumpSharedSpace;
 657 
 658  protected:
 659   ContiguousSpace*  _the_space;       // actual space holding objects
 660   WaterMark  _last_gc;                // watermark between objects allocated before
 661                                       // and after last GC.
 662 
 663   // Grow generation with specified size (returns false if unable to grow)
 664   virtual bool grow_by(size_t bytes);
 665   // Grow generation to reserved size.
 666   virtual bool grow_to_reserved();
 667   // Shrink generation with specified size (returns false if unable to shrink)
 668   void shrink_by(size_t bytes);
 669 
 670   // Allocation failure
 671   virtual bool expand(size_t bytes, size_t expand_bytes);
 672   void shrink(size_t bytes);
 673 
 674   // Accessing spaces
 675   ContiguousSpace* the_space() const { return _the_space; }
 676 
 677  public:
 678   OneContigSpaceCardGeneration(ReservedSpace rs, size_t initial_byte_size,
 679                                int level, GenRemSet* remset,
 680                                ContiguousSpace* space) :
 681     CardGeneration(rs, initial_byte_size, level, remset),
 682     _the_space(space)
 683   {}
 684 
 685   inline bool is_in(const void* p) const;
 686 
 687   // Space enquiries
 688   size_t capacity() const;
 689   size_t used() const;
 690   size_t free() const;
 691 
 692   MemRegion used_region() const;
 693 
 694   size_t unsafe_max_alloc_nogc() const;
 695   size_t contiguous_available() const;
 696 
 697   // Iteration
 698   void object_iterate(ObjectClosure* blk);
 699   void space_iterate(SpaceClosure* blk, bool usedOnly = false);
 700 
 701   void younger_refs_iterate(OopsInGenClosure* blk);
 702 
 703   inline CompactibleSpace* first_compaction_space() const;
 704 
 705   virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);
 706   virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);
 707 
 708   // Accessing marks
 709   inline WaterMark top_mark();
 710   inline WaterMark bottom_mark();
 711 
 712 #define OneContig_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix)      \
 713   void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
 714   OneContig_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v)
 715   SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(OneContig_SINCE_SAVE_MARKS_DECL)
 716 
 717   void save_marks();
 718   void reset_saved_marks();
 719   bool no_allocs_since_save_marks();
 720 
 721   inline size_t block_size(const HeapWord* addr) const;
 722 
 723   inline bool block_is_obj(const HeapWord* addr) const;
 724 
 725   virtual void collect(bool full,
 726                        bool clear_all_soft_refs,
 727                        size_t size,
 728                        bool is_tlab);
 729   HeapWord* expand_and_allocate(size_t size,
 730                                 bool is_tlab,
 731                                 bool parallel = false);
 732 
 733   virtual void prepare_for_verify();
 734 
 735   virtual void gc_epilogue(bool full);
 736 
 737   virtual void record_spaces_top();
 738 
 739   virtual void verify();
 740   virtual void print_on(outputStream* st) const;
 741 };
 742 
 743 #endif // SHARE_VM_MEMORY_GENERATION_HPP


  28 #include "gc_implementation/shared/collectorCounters.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/memRegion.hpp"
  31 #include "memory/referenceProcessor.hpp"
  32 #include "memory/universe.hpp"
  33 #include "memory/watermark.hpp"
  34 #include "runtime/mutex.hpp"
  35 #include "runtime/perfData.hpp"
  36 #include "runtime/virtualspace.hpp"
  37 
  38 // A Generation models a heap area for similarly-aged objects.
  39 // It will contain one ore more spaces holding the actual objects.
  40 //
  41 // The Generation class hierarchy:
  42 //
  43 // Generation                      - abstract base class
  44 // - DefNewGeneration              - allocation area (copy collected)
  45 //   - ParNewGeneration            - a DefNewGeneration that is collected by
  46 //                                   several threads
  47 // - CardGeneration                 - abstract class adding offset array behavior


  48 //   - TenuredGeneration             - tenured (old object) space (markSweepCompact)
  49 //   - ConcurrentMarkSweepGeneration - Mostly Concurrent Mark Sweep Generation
  50 //                                       (Detlefs-Printezis refinement of
  51 //                                       Boehm-Demers-Schenker)
  52 //
  53 // The system configurations currently allowed are:
  54 //
  55 //   DefNewGeneration + TenuredGeneration
  56 //   DefNewGeneration + ConcurrentMarkSweepGeneration
  57 //
  58 //   ParNewGeneration + TenuredGeneration
  59 //   ParNewGeneration + ConcurrentMarkSweepGeneration
  60 //
  61 
  62 class DefNewGeneration;
  63 class GenerationSpec;
  64 class CompactibleSpace;
  65 class ContiguousSpace;
  66 class CompactPoint;
  67 class OopsInGenClosure;


 624   // Attempt to expand the generation by "bytes".  Expand by at a
 625   // minimum "expand_bytes".  Return true if some amount (not
 626   // necessarily the full "bytes") was done.
 627   virtual bool expand(size_t bytes, size_t expand_bytes);
 628 
 629   // Shrink generation with specified size (returns false if unable to shrink)
 630   virtual void shrink(size_t bytes) = 0;
 631 
 632   virtual void compute_new_size();
 633 
 634   virtual void clear_remembered_set();
 635 
 636   virtual void invalidate_remembered_set();
 637 
 638   virtual void prepare_for_verify();
 639 
 640   // Grow generation with specified size (returns false if unable to grow)
 641   virtual bool grow_by(size_t bytes) = 0;
 642   // Grow generation to reserved size.
 643   virtual bool grow_to_reserved() = 0;































































































 644 };
 645 
 646 #endif // SHARE_VM_MEMORY_GENERATION_HPP
< prev index next >