comparison src/share/vm/gc_implementation/shared/mutableSpace.hpp @ 535:4e400c36026f

6783381: NUMA allocator: don't pretouch eden space with UseNUMA Summary: Moved pretouching to MutableSpace. Also MutableSpace now turns on page interleaving for the region it covers. Reviewed-by: jmasa, jcoomes
author iveresov
date Tue, 27 Jan 2009 18:13:59 -0800
parents 850fdf70db2b
children 0fbdb4381b99
comparison
equal deleted inserted replaced
534:5cfd8d19e546 535:4e400c36026f
23 */ 23 */
24 24
25 // A MutableSpace is a subtype of ImmutableSpace that supports the 25 // A MutableSpace is a subtype of ImmutableSpace that supports the
26 // concept of allocation. This includes the concepts that a space may 26 // concept of allocation. This includes the concepts that a space may
27 // be only partially full, and the querry methods that go with such 27 // be only partially full, and the querry methods that go with such
28 // an assumption. 28 // an assumption. MutableSpace is also responsible for minimizing the
29 // page allocation time by having the memory pretouched (with
30 // AlwaysPretouch) and for optimizing page placement on NUMA systems
31 // by make the underlying region interleaved (with UseNUMA).
29 // 32 //
30 // Invariant: (ImmutableSpace +) bottom() <= top() <= end() 33 // Invariant: (ImmutableSpace +) bottom() <= top() <= end()
31 // top() is inclusive and end() is exclusive. 34 // top() is inclusive and end() is exclusive.
32 35
33 class MutableSpaceMangler; 36 class MutableSpaceMangler;
35 class MutableSpace: public ImmutableSpace { 38 class MutableSpace: public ImmutableSpace {
36 friend class VMStructs; 39 friend class VMStructs;
37 40
38 // Helper for mangling unused space in debug builds 41 // Helper for mangling unused space in debug builds
39 MutableSpaceMangler* _mangler; 42 MutableSpaceMangler* _mangler;
40 43 // The last region which page had been setup to be interleaved.
44 MemRegion _last_setup_region;
45 size_t _alignment;
41 protected: 46 protected:
42 HeapWord* _top; 47 HeapWord* _top;
43 48
44 MutableSpaceMangler* mangler() { return _mangler; } 49 MutableSpaceMangler* mangler() { return _mangler; }
45 50
51 void numa_setup_pages(MemRegion mr, bool clear_space);
52 void pretouch_pages(MemRegion mr);
53
54 void set_last_setup_region(MemRegion mr) { _last_setup_region = mr; }
55 MemRegion last_setup_region() const { return _last_setup_region; }
56
46 public: 57 public:
47 virtual ~MutableSpace(); 58 virtual ~MutableSpace();
48 MutableSpace(); 59 MutableSpace(size_t page_size);
49 60
50 // Accessors 61 // Accessors
51 HeapWord* top() const { return _top; } 62 HeapWord* top() const { return _top; }
52 virtual void set_top(HeapWord* value) { _top = value; } 63 virtual void set_top(HeapWord* value) { _top = value; }
53 64
55 HeapWord** end_addr() { return &_end; } 66 HeapWord** end_addr() { return &_end; }
56 67
57 virtual void set_bottom(HeapWord* value) { _bottom = value; } 68 virtual void set_bottom(HeapWord* value) { _bottom = value; }
58 virtual void set_end(HeapWord* value) { _end = value; } 69 virtual void set_end(HeapWord* value) { _end = value; }
59 70
71 size_t alignment() { return _alignment; }
72
60 // Returns a subregion containing all objects in this space. 73 // Returns a subregion containing all objects in this space.
61 MemRegion used_region() { return MemRegion(bottom(), top()); } 74 MemRegion used_region() { return MemRegion(bottom(), top()); }
75
76 static const bool SetupPages = true;
77 static const bool DontSetupPages = false;
62 78
63 // Initialization 79 // Initialization
64 virtual void initialize(MemRegion mr, 80 virtual void initialize(MemRegion mr,
65 bool clear_space, 81 bool clear_space,
66 bool mangle_space); 82 bool mangle_space,
83 bool setup_pages = SetupPages);
84
67 virtual void clear(bool mangle_space); 85 virtual void clear(bool mangle_space);
68 // Does the usual initialization but optionally resets top to bottom. 86 // Does the usual initialization but optionally resets top to bottom.
69 #if 0 // MANGLE_SPACE 87 #if 0 // MANGLE_SPACE
70 void initialize(MemRegion mr, bool clear_space, bool reset_top); 88 void initialize(MemRegion mr, bool clear_space, bool reset_top);
71 #endif 89 #endif