67 check_mangled_unused_area_complete();
68 }
69
70 // A complete mangle is expected in the
71 // exceptional case where top_for_allocations is not
72 // properly tracking the high water mark for mangling.
73 // This can be the case when to-space is being used for
74 // scratch space during a mark-sweep-compact. See
75 // contribute_scratch() and PSMarkSweep::allocate_stacks().
76 void SpaceMangler::mangle_unused_area_complete() {
77 assert(ZapUnusedHeapArea, "Mangling should not be in use");
78 MemRegion mangle_mr(top(), end());
79 SpaceMangler::mangle_region(mangle_mr);
80 }
81
82 // Simply mangle the MemRegion mr.
83 void SpaceMangler::mangle_region(MemRegion mr) {
84 assert(ZapUnusedHeapArea, "Mangling should not be in use");
85 #ifdef ASSERT
86 if(TraceZapUnusedHeapArea) {
87 gclog_or_tty->print("Mangling [0x%x to 0x%x)", mr.start(), mr.end());
88 }
89 Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord);
90 if(TraceZapUnusedHeapArea) {
91 gclog_or_tty->print_cr(" done");
92 }
93 #endif
94 }
95
96 // Check that top, top_for_allocations and the last
97 // word of the space are mangled. In a tight memory
98 // situation even this light weight mangling could
99 // cause paging by touching the end of the space.
100 void SpaceMangler::check_mangled_unused_area(HeapWord* limit) {
101 if (CheckZapUnusedHeapArea) {
102 // This method can be called while the spaces are
103 // being reshaped so skip the test if the end of the
104 // space is beyond the specified limit;
105 if (end() > limit) return;
106
107 assert(top() == end() ||
|
67 check_mangled_unused_area_complete();
68 }
69
70 // A complete mangle is expected in the
71 // exceptional case where top_for_allocations is not
72 // properly tracking the high water mark for mangling.
73 // This can be the case when to-space is being used for
74 // scratch space during a mark-sweep-compact. See
75 // contribute_scratch() and PSMarkSweep::allocate_stacks().
76 void SpaceMangler::mangle_unused_area_complete() {
77 assert(ZapUnusedHeapArea, "Mangling should not be in use");
78 MemRegion mangle_mr(top(), end());
79 SpaceMangler::mangle_region(mangle_mr);
80 }
81
82 // Simply mangle the MemRegion mr.
83 void SpaceMangler::mangle_region(MemRegion mr) {
84 assert(ZapUnusedHeapArea, "Mangling should not be in use");
85 #ifdef ASSERT
86 if(TraceZapUnusedHeapArea) {
87 gclog_or_tty->print("Mangling [" PTR_FORMAT " to " PTR_FORMAT ")", mr.start(), mr.end());
88 }
89 Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord);
90 if(TraceZapUnusedHeapArea) {
91 gclog_or_tty->print_cr(" done");
92 }
93 #endif
94 }
95
96 // Check that top, top_for_allocations and the last
97 // word of the space are mangled. In a tight memory
98 // situation even this light weight mangling could
99 // cause paging by touching the end of the space.
100 void SpaceMangler::check_mangled_unused_area(HeapWord* limit) {
101 if (CheckZapUnusedHeapArea) {
102 // This method can be called while the spaces are
103 // being reshaped so skip the test if the end of the
104 // space is beyond the specified limit;
105 if (end() > limit) return;
106
107 assert(top() == end() ||
|