comparison src/share/vm/gc_implementation/shared/mutableSpace.hpp @ 269:850fdf70db2b

Merge
author jmasa
date Mon, 28 Jul 2008 15:30:23 -0700
parents d1605aabd0a1 12eea04c8b06
children 4e400c36026f
comparison
equal deleted inserted replaced
238:3df2fe7c4451 269:850fdf70db2b
28 // an assumption. 28 // an assumption.
29 // 29 //
30 // Invariant: (ImmutableSpace +) bottom() <= top() <= end() 30 // Invariant: (ImmutableSpace +) bottom() <= top() <= end()
31 // top() is inclusive and end() is exclusive. 31 // top() is inclusive and end() is exclusive.
32 32
33 class MutableSpaceMangler;
34
33 class MutableSpace: public ImmutableSpace { 35 class MutableSpace: public ImmutableSpace {
34 friend class VMStructs; 36 friend class VMStructs;
37
38 // Helper for mangling unused space in debug builds
39 MutableSpaceMangler* _mangler;
40
35 protected: 41 protected:
36 HeapWord* _top; 42 HeapWord* _top;
37 43
44 MutableSpaceMangler* mangler() { return _mangler; }
45
38 public: 46 public:
39 virtual ~MutableSpace() {} 47 virtual ~MutableSpace();
40 MutableSpace() { _top = NULL; } 48 MutableSpace();
49
41 // Accessors 50 // Accessors
42 HeapWord* top() const { return _top; } 51 HeapWord* top() const { return _top; }
43 virtual void set_top(HeapWord* value) { _top = value; } 52 virtual void set_top(HeapWord* value) { _top = value; }
44 53
45 HeapWord** top_addr() { return &_top; } 54 HeapWord** top_addr() { return &_top; }
50 59
51 // Returns a subregion containing all objects in this space. 60 // Returns a subregion containing all objects in this space.
52 MemRegion used_region() { return MemRegion(bottom(), top()); } 61 MemRegion used_region() { return MemRegion(bottom(), top()); }
53 62
54 // Initialization 63 // Initialization
55 virtual void initialize(MemRegion mr, bool clear_space); 64 virtual void initialize(MemRegion mr,
56 virtual void clear(); 65 bool clear_space,
66 bool mangle_space);
67 virtual void clear(bool mangle_space);
68 // Does the usual initialization but optionally resets top to bottom.
69 #if 0 // MANGLE_SPACE
70 void initialize(MemRegion mr, bool clear_space, bool reset_top);
71 #endif
57 virtual void update() { } 72 virtual void update() { }
58 virtual void accumulate_statistics() { } 73 virtual void accumulate_statistics() { }
59 74
60 // Overwrites the unused portion of this space. Note that some collectors 75 // Methods used in mangling. See descriptions under SpaceMangler.
61 // may use this "scratch" space during collections. 76 virtual void mangle_unused_area() PRODUCT_RETURN;
62 virtual void mangle_unused_area() { 77 virtual void mangle_unused_area_complete() PRODUCT_RETURN;
63 mangle_region(MemRegion(_top, _end)); 78 virtual void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN;
64 } 79 virtual void check_mangled_unused_area_complete() PRODUCT_RETURN;
80 virtual void set_top_for_allocations(HeapWord* v) PRODUCT_RETURN;
81
82 // Used to save the space's current top for later use during mangling.
83 virtual void set_top_for_allocations() PRODUCT_RETURN;
84
65 virtual void ensure_parsability() { } 85 virtual void ensure_parsability() { }
66 86
67 void mangle_region(MemRegion mr) { 87 virtual void mangle_region(MemRegion mr) PRODUCT_RETURN;
68 debug_only(Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord));
69 }
70 88
71 // Boolean querries. 89 // Boolean querries.
72 bool is_empty() const { return used_in_words() == 0; } 90 bool is_empty() const { return used_in_words() == 0; }
73 bool not_empty() const { return used_in_words() > 0; } 91 bool not_empty() const { return used_in_words() > 0; }
74 bool contains(const void* p) const { return _bottom <= p && p < _end; } 92 bool contains(const void* p) const { return _bottom <= p && p < _end; }