markSweep.cpp revision 1472
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_markSweep.cpp.incl"
#ifdef VALIDATE_MARK_SWEEP
bool MarkSweep::_pointer_tracking = false;
bool MarkSweep::_root_tracking = true;
#endif
_revisit_klass_stack->push(k);
}
void MarkSweep::follow_weak_klass_links() {
// All klasses on the revisit stack are marked at this point.
// Update and follow all subklass, sibling and implementor links.
if (PrintRevisitStats) {
gclog_or_tty->print_cr("#classes in system dictionary = %d", SystemDictionary::number_of_classes());
}
for (int i = 0; i < _revisit_klass_stack->length(); i++) {
}
follow_stack();
}
_revisit_mdo_stack->push(p);
}
void MarkSweep::follow_mdo_weak_refs() {
// All strongly reachable oops have been marked at this point;
// we can visit and clear any weak references from MDO's which
// we memoized during the strong marking phase.
if (PrintRevisitStats) {
gclog_or_tty->print_cr("#classes in system dictionary = %d", SystemDictionary::number_of_classes());
}
for (int i = 0; i < _revisit_mdo_stack->length(); i++) {
}
follow_stack();
}
CodeBlobToOopClosure MarkSweep::follow_code_root_closure(&MarkSweep::follow_root_closure, /*do_marking=*/ true);
void MarkSweep::follow_stack() {
do {
while (!_marking_stack->is_empty()) {
obj->follow_contents();
}
// Process ObjArrays one at a time to avoid marking stack bloat.
if (!_objarray_stack->is_empty()) {
}
}
// We preserve the mark which should be replaced at the end and the location that it
// will go. Note that the object that this markOop belongs to isn't currently at that
// address but it will be after phase4
// we try to store preserved marks in the to space of the new generation since this
// is storage which should be available. Most of the time this should be sufficient
// space for the marks we need to preserve but if it isn't we fall back in using
// GrowableArrays to keep track of the overflow.
if (_preserved_count < _preserved_count_max) {
} else {
if (_preserved_mark_stack == NULL) {
}
}
}
void MarkSweep::adjust_marks() {
"inconsistent preserved oop stacks");
// adjust the oops we saved earlier
for (size_t i = 0; i < _preserved_count; i++) {
}
// deal with the overflow stack
if (_preserved_oop_stack) {
for (int i = 0; i < _preserved_oop_stack->length(); i++) {
adjust_pointer(p);
}
}
}
void MarkSweep::restore_marks() {
"inconsistent preserved oop stacks");
}
// restore the marks we saved earlier
for (size_t i = 0; i < _preserved_count; i++) {
_preserved_marks[i].restore();
}
// deal with the overflow
if (_preserved_oop_stack) {
for (int i = 0; i < _preserved_oop_stack->length(); i++) {
}
}
}
#ifdef VALIDATE_MARK_SWEEP
if (!ValidateMarkSweep)
return;
if (!isroot) {
if (_pointer_tracking) {
_adjusted_pointers->remove(p);
}
} else {
if (index != -1) {
int l = _root_refs_stack->length();
if (l > 0 && l - 1 != index) {
} else {
_root_refs_stack->remove(p);
}
}
}
}
void MarkSweep::check_adjust_pointer(void* p) {
_adjusted_pointers->push(p);
}
class AdjusterTracker: public OopClosure {
public:
AdjusterTracker() {}
};
if (ValidateMarkSweep) {
_pointer_tracking = true;
}
}
void MarkSweep::check_interior_pointers() {
if (ValidateMarkSweep) {
_pointer_tracking = false;
}
}
if (ValidateMarkSweep) {
}
}
if (ValidateMarkSweep) {
_live_oops->push(p);
}
}
if (ValidateMarkSweep) {
}
}
"should be moved to forwarded location");
if (ValidateMarkSweep) {
}
if (RecordMarkSweepCompaction) {
_cur_gc_live_oops->push(q);
}
}
void MarkSweep::compaction_complete() {
if (RecordMarkSweepCompaction) {
}
}
if (!RecordMarkSweepCompaction) {
return;
}
if (_last_gc_live_oops == NULL) {
return;
}
for (int i = 0; i < _last_gc_live_oops->length(); i++) {
tty->print_cr(" Was in oop " PTR_FORMAT ", size " SIZE_FORMAT ", at offset " SIZE_FORMAT, old_oop, sz, offset);
return;
}
}
}
#endif //VALIDATE_MARK_SWEEP
void MarkSweep::KeepAliveClosure::do_oop(narrowOop* p) { MarkSweep::KeepAliveClosure::do_oop_work(p); }
void marksweep_init() { /* empty */ }
#ifndef PRODUCT
if (TraceMarkSweep)
}
#endif