< prev index next >

src/hotspot/share/gc/parallel/mutableSpace.hpp

Print this page
rev 60637 : 8252221: Use multiple workers for Parallel GC pre-touching
Reviewed-by:
Contributed-by: amith.pawar@gmail.com


  39 //
  40 // Invariant: (ImmutableSpace +) bottom() <= top() <= end()
  41 // top() is inclusive and end() is exclusive.
  42 
  43 class MutableSpaceMangler;
  44 
  45 class MutableSpace: public ImmutableSpace {
  46   friend class VMStructs;
  47 
  48   // Helper for mangling unused space in debug builds
  49   MutableSpaceMangler* _mangler;
  50   // The last region which page had been setup to be interleaved.
  51   MemRegion _last_setup_region;
  52   size_t _alignment;
  53  protected:
  54   HeapWord* volatile _top;
  55 
  56   MutableSpaceMangler* mangler() { return _mangler; }
  57 
  58   void numa_setup_pages(MemRegion mr, bool clear_space);
  59   void pretouch_pages(MemRegion mr);
  60 
  61   void set_last_setup_region(MemRegion mr) { _last_setup_region = mr;   }
  62   MemRegion last_setup_region() const      { return _last_setup_region; }
  63 
  64  public:
  65   virtual ~MutableSpace();
  66   MutableSpace(size_t page_size);
  67 
  68   // Accessors
  69   HeapWord* top() const                    { return _top;    }
  70   virtual void set_top(HeapWord* value)    { _top = value;   }
  71 
  72   HeapWord* volatile* top_addr()           { return &_top; }
  73   HeapWord** end_addr()                    { return &_end; }
  74 
  75   virtual void set_bottom(HeapWord* value) { _bottom = value; }
  76   virtual void set_end(HeapWord* value)    { _end = value; }
  77 
  78   size_t alignment()                       { return _alignment; }
  79 
  80   // Returns a subregion containing all objects in this space.
  81   MemRegion used_region() { return MemRegion(bottom(), top()); }
  82 
  83   static const bool SetupPages = true;
  84   static const bool DontSetupPages = false;
  85 
  86   // Initialization
  87   virtual void initialize(MemRegion mr,
  88                           bool clear_space,
  89                           bool mangle_space,
  90                           bool setup_pages = SetupPages);

  91 
  92   virtual void clear(bool mangle_space);
  93   // Does the usual initialization but optionally resets top to bottom.
  94 #if 0  // MANGLE_SPACE
  95   void initialize(MemRegion mr, bool clear_space, bool reset_top);
  96 #endif
  97   virtual void update() { }
  98   virtual void accumulate_statistics() { }
  99 
 100   // Methods used in mangling.  See descriptions under SpaceMangler.
 101   virtual void mangle_unused_area() PRODUCT_RETURN;
 102   virtual void mangle_unused_area_complete() PRODUCT_RETURN;
 103   virtual void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN;
 104   virtual void check_mangled_unused_area_complete() PRODUCT_RETURN;
 105   virtual void set_top_for_allocations(HeapWord* v) PRODUCT_RETURN;
 106 
 107   // Used to save the space's current top for later use during mangling.
 108   virtual void set_top_for_allocations() PRODUCT_RETURN;
 109 
 110   virtual void ensure_parsability() { }




  39 //
  40 // Invariant: (ImmutableSpace +) bottom() <= top() <= end()
  41 // top() is inclusive and end() is exclusive.
  42 
  43 class MutableSpaceMangler;
  44 
  45 class MutableSpace: public ImmutableSpace {
  46   friend class VMStructs;
  47 
  48   // Helper for mangling unused space in debug builds
  49   MutableSpaceMangler* _mangler;
  50   // The last region which page had been setup to be interleaved.
  51   MemRegion _last_setup_region;
  52   size_t _alignment;
  53  protected:
  54   HeapWord* volatile _top;
  55 
  56   MutableSpaceMangler* mangler() { return _mangler; }
  57 
  58   void numa_setup_pages(MemRegion mr, bool clear_space);

  59 
  60   void set_last_setup_region(MemRegion mr) { _last_setup_region = mr;   }
  61   MemRegion last_setup_region() const      { return _last_setup_region; }
  62 
  63  public:
  64   virtual ~MutableSpace();
  65   MutableSpace(size_t page_size);
  66 
  67   // Accessors
  68   HeapWord* top() const                    { return _top;    }
  69   virtual void set_top(HeapWord* value)    { _top = value;   }
  70 
  71   HeapWord* volatile* top_addr()           { return &_top; }
  72   HeapWord** end_addr()                    { return &_end; }
  73 
  74   virtual void set_bottom(HeapWord* value) { _bottom = value; }
  75   virtual void set_end(HeapWord* value)    { _end = value; }
  76 
  77   size_t alignment()                       { return _alignment; }
  78 
  79   // Returns a subregion containing all objects in this space.
  80   MemRegion used_region() { return MemRegion(bottom(), top()); }
  81 
  82   static const bool SetupPages = true;
  83   static const bool DontSetupPages = false;
  84 
  85   // Initialization
  86   virtual void initialize(MemRegion mr,
  87                           bool clear_space,
  88                           bool mangle_space,
  89                           bool setup_pages = SetupPages,
  90                           WorkGang *pretouch_gang = NULL);
  91 
  92   virtual void clear(bool mangle_space);
  93   // Does the usual initialization but optionally resets top to bottom.
  94 #if 0  // MANGLE_SPACE
  95   void initialize(MemRegion mr, bool clear_space, bool reset_top);
  96 #endif
  97   virtual void update() { }
  98   virtual void accumulate_statistics() { }
  99 
 100   // Methods used in mangling.  See descriptions under SpaceMangler.
 101   virtual void mangle_unused_area() PRODUCT_RETURN;
 102   virtual void mangle_unused_area_complete() PRODUCT_RETURN;
 103   virtual void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN;
 104   virtual void check_mangled_unused_area_complete() PRODUCT_RETURN;
 105   virtual void set_top_for_allocations(HeapWord* v) PRODUCT_RETURN;
 106 
 107   // Used to save the space's current top for later use during mangling.
 108   virtual void set_top_for_allocations() PRODUCT_RETURN;
 109 
 110   virtual void ensure_parsability() { }


< prev index next >