mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 00:54:38 +02:00
8073463: G1 does not mangle freed heap regions
Reviewed-by: mgerdin, jwilhelm
This commit is contained in:
parent
395543dadc
commit
bcf9ea6cbf
5 changed files with 21 additions and 16 deletions
|
@ -396,6 +396,10 @@ class CompactibleFreeListSpace: public CompactibleSpace {
|
||||||
// Resizing support
|
// Resizing support
|
||||||
void set_end(HeapWord* value); // override
|
void set_end(HeapWord* value); // override
|
||||||
|
|
||||||
|
// Never mangle CompactibleFreeListSpace
|
||||||
|
void mangle_unused_area() {}
|
||||||
|
void mangle_unused_area_complete() {}
|
||||||
|
|
||||||
// Mutual exclusion support
|
// Mutual exclusion support
|
||||||
Mutex* freelistLock() const { return &_freelistLock; }
|
Mutex* freelistLock() const { return &_freelistLock; }
|
||||||
|
|
||||||
|
|
|
@ -934,6 +934,16 @@ void G1OffsetTableContigSpace::set_end(HeapWord* new_end) {
|
||||||
_offsets.resize(new_end - bottom());
|
_offsets.resize(new_end - bottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PRODUCT
|
||||||
|
void G1OffsetTableContigSpace::mangle_unused_area() {
|
||||||
|
mangle_unused_area_complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
void G1OffsetTableContigSpace::mangle_unused_area_complete() {
|
||||||
|
SpaceMangler::mangle_region(MemRegion(top(), end()));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void G1OffsetTableContigSpace::print() const {
|
void G1OffsetTableContigSpace::print() const {
|
||||||
print_short();
|
print_short();
|
||||||
gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
|
gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
|
||||||
|
|
|
@ -155,6 +155,9 @@ class G1OffsetTableContigSpace: public CompactibleSpace {
|
||||||
void set_bottom(HeapWord* value);
|
void set_bottom(HeapWord* value);
|
||||||
void set_end(HeapWord* value);
|
void set_end(HeapWord* value);
|
||||||
|
|
||||||
|
void mangle_unused_area() PRODUCT_RETURN;
|
||||||
|
void mangle_unused_area_complete() PRODUCT_RETURN;
|
||||||
|
|
||||||
HeapWord* scan_top() const;
|
HeapWord* scan_top() const;
|
||||||
void record_timestamp();
|
void record_timestamp();
|
||||||
void reset_gc_time_stamp() { _gc_time_stamp = 0; }
|
void reset_gc_time_stamp() { _gc_time_stamp = 0; }
|
||||||
|
|
|
@ -353,15 +353,6 @@ void ContiguousSpace::mangle_unused_area() {
|
||||||
void ContiguousSpace::mangle_unused_area_complete() {
|
void ContiguousSpace::mangle_unused_area_complete() {
|
||||||
mangler()->mangle_unused_area_complete();
|
mangler()->mangle_unused_area_complete();
|
||||||
}
|
}
|
||||||
void ContiguousSpace::mangle_region(MemRegion mr) {
|
|
||||||
// Although this method uses SpaceMangler::mangle_region() which
|
|
||||||
// is not specific to a space, the when the ContiguousSpace version
|
|
||||||
// is called, it is always with regard to a space and this
|
|
||||||
// bounds checking is appropriate.
|
|
||||||
MemRegion space_mr(bottom(), end());
|
|
||||||
assert(space_mr.contains(mr), "Mangling outside space");
|
|
||||||
SpaceMangler::mangle_region(mr);
|
|
||||||
}
|
|
||||||
#endif // NOT_PRODUCT
|
#endif // NOT_PRODUCT
|
||||||
|
|
||||||
void CompactibleSpace::initialize(MemRegion mr,
|
void CompactibleSpace::initialize(MemRegion mr,
|
||||||
|
|
|
@ -128,11 +128,10 @@ class Space: public CHeapObj<mtGC> {
|
||||||
|
|
||||||
// For detecting GC bugs. Should only be called at GC boundaries, since
|
// For detecting GC bugs. Should only be called at GC boundaries, since
|
||||||
// some unused space may be used as scratch space during GC's.
|
// some unused space may be used as scratch space during GC's.
|
||||||
// Default implementation does nothing. We also call this when expanding
|
// We also call this when expanding a space to satisfy an allocation
|
||||||
// a space to satisfy an allocation request. See bug #4668531
|
// request. See bug #4668531
|
||||||
virtual void mangle_unused_area() {}
|
virtual void mangle_unused_area() = 0;
|
||||||
virtual void mangle_unused_area_complete() {}
|
virtual void mangle_unused_area_complete() = 0;
|
||||||
virtual void mangle_region(MemRegion mr) {}
|
|
||||||
|
|
||||||
// Testers
|
// Testers
|
||||||
bool is_empty() const { return used() == 0; }
|
bool is_empty() const { return used() == 0; }
|
||||||
|
@ -559,8 +558,6 @@ class ContiguousSpace: public CompactibleSpace {
|
||||||
void mangle_unused_area() PRODUCT_RETURN;
|
void mangle_unused_area() PRODUCT_RETURN;
|
||||||
// Mangle [top, end)
|
// Mangle [top, end)
|
||||||
void mangle_unused_area_complete() PRODUCT_RETURN;
|
void mangle_unused_area_complete() PRODUCT_RETURN;
|
||||||
// Mangle the given MemRegion.
|
|
||||||
void mangle_region(MemRegion mr) PRODUCT_RETURN;
|
|
||||||
|
|
||||||
// Do some sparse checking on the area that should have been mangled.
|
// Do some sparse checking on the area that should have been mangled.
|
||||||
void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN;
|
void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue