128 // For detecting GC bugs. Should only be called at GC boundaries, since 129 // some unused space may be used as scratch space during GC's. 130 // We also call this when expanding a space to satisfy an allocation 131 // request. See bug #4668531 132 virtual void mangle_unused_area() = 0; 133 virtual void mangle_unused_area_complete() = 0; 134 135 // Testers 136 bool is_empty() const { return used() == 0; } 137 bool not_empty() const { return used() > 0; } 138 139 // Returns true iff the given the space contains the 140 // given address as part of an allocated object. For 141 // certain kinds of spaces, this might be a potentially 142 // expensive operation. To prevent performance problems 143 // on account of its inadvertent use in product jvm's, 144 // we restrict its use to assertion checks only. 145 bool is_in(const void* p) const { 146 return used_region().contains(p); 147 } 148 149 // Returns true iff the given reserved memory of the space contains the 150 // given address. 151 bool is_in_reserved(const void* p) const { return _bottom <= p && p < _end; } 152 153 // Returns true iff the given block is not allocated. 154 virtual bool is_free_block(const HeapWord* p) const = 0; 155 156 // Test whether p is double-aligned 157 static bool is_aligned(void* p) { 158 return ::is_aligned(p, sizeof(double)); 159 } 160 161 // Size computations. Sizes are in bytes. 162 size_t capacity() const { return byte_size(bottom(), end()); } 163 virtual size_t used() const = 0; 164 virtual size_t free() const = 0; 165 166 // Iterate over all the ref-containing fields of all objects in the 167 // space, calling "cl.do_oop" on each. Fields in objects allocated by | 128 // For detecting GC bugs. Should only be called at GC boundaries, since 129 // some unused space may be used as scratch space during GC's. 130 // We also call this when expanding a space to satisfy an allocation 131 // request. See bug #4668531 132 virtual void mangle_unused_area() = 0; 133 virtual void mangle_unused_area_complete() = 0; 134 135 // Testers 136 bool is_empty() const { return used() == 0; } 137 bool not_empty() const { return used() > 0; } 138 139 // Returns true iff the given the space contains the 140 // given address as part of an allocated object. For 141 // certain kinds of spaces, this might be a potentially 142 // expensive operation. To prevent performance problems 143 // on account of its inadvertent use in product jvm's, 144 // we restrict its use to assertion checks only. 145 bool is_in(const void* p) const { 146 return used_region().contains(p); 147 } 148 bool is_in(oop obj) const { 149 return is_in((void*)obj); 150 } 151 152 // Returns true iff the given reserved memory of the space contains the 153 // given address. 154 bool is_in_reserved(const void* p) const { return _bottom <= p && p < _end; } 155 156 // Returns true iff the given block is not allocated. 157 virtual bool is_free_block(const HeapWord* p) const = 0; 158 159 // Test whether p is double-aligned 160 static bool is_aligned(void* p) { 161 return ::is_aligned(p, sizeof(double)); 162 } 163 164 // Size computations. Sizes are in bytes. 165 size_t capacity() const { return byte_size(bottom(), end()); } 166 virtual size_t used() const = 0; 167 virtual size_t free() const = 0; 168 169 // Iterate over all the ref-containing fields of all objects in the 170 // space, calling "cl.do_oop" on each. Fields in objects allocated by |