hotspot/src/share/vm/memory/genMarkSweep.cpp
Print this page
rev 611 : Merge
*** 1,10 ****
#ifdef USE_PRAGMA_IDENT_SRC
#pragma ident "@(#)genMarkSweep.cpp 1.40 07/05/17 15:54:55 JVM"
#endif
/*
! * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,10 ----
#ifdef USE_PRAGMA_IDENT_SRC
#pragma ident "@(#)genMarkSweep.cpp 1.40 07/05/17 15:54:55 JVM"
#endif
/*
! * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 32,43 ****
bool clear_all_softrefs) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
// hook up weak ref data so it can be used during Mark-Sweep
assert(ref_processor() == NULL, "no stomping");
- _ref_processor = rp;
assert(rp != NULL, "should be non-NULL");
TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty);
// When collecting the permanent generation methodOops may be moving,
// so we either have to flush all bcp data or convert it into bci.
--- 32,44 ----
bool clear_all_softrefs) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
// hook up weak ref data so it can be used during Mark-Sweep
assert(ref_processor() == NULL, "no stomping");
assert(rp != NULL, "should be non-NULL");
+ _ref_processor = rp;
+ rp->setup_policy(clear_all_softrefs);
TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty);
// When collecting the permanent generation methodOops may be moving,
// so we either have to flush all bcp data or convert it into bci.
*** 74,85 ****
mark_sweep_phase3(level);
VALIDATE_MARK_SWEEP_ONLY(
if (ValidateMarkSweep) {
! guarantee(_root_refs_stack->length() == 0,
! "should be empty by now");
}
)
mark_sweep_phase4();
--- 75,85 ----
mark_sweep_phase3(level);
VALIDATE_MARK_SWEEP_ONLY(
if (ValidateMarkSweep) {
! guarantee(_root_refs_stack->length() == 0, "should be empty by now");
}
)
mark_sweep_phase4();
*** 166,178 ****
int size = SystemDictionary::number_of_classes() * 2;
_revisit_klass_stack = new (ResourceObj::C_HEAP) GrowableArray<Klass*>(size, true);
#ifdef VALIDATE_MARK_SWEEP
if (ValidateMarkSweep) {
! _root_refs_stack = new (ResourceObj::C_HEAP) GrowableArray<oop*>(100, true);
! _other_refs_stack = new (ResourceObj::C_HEAP) GrowableArray<oop*>(100, true);
! _adjusted_pointers = new (ResourceObj::C_HEAP) GrowableArray<oop*>(100, true);
_live_oops = new (ResourceObj::C_HEAP) GrowableArray<oop>(100, true);
_live_oops_moved_to = new (ResourceObj::C_HEAP) GrowableArray<oop>(100, true);
_live_oops_size = new (ResourceObj::C_HEAP) GrowableArray<size_t>(100, true);
}
if (RecordMarkSweepCompaction) {
--- 166,178 ----
int size = SystemDictionary::number_of_classes() * 2;
_revisit_klass_stack = new (ResourceObj::C_HEAP) GrowableArray<Klass*>(size, true);
#ifdef VALIDATE_MARK_SWEEP
if (ValidateMarkSweep) {
! _root_refs_stack = new (ResourceObj::C_HEAP) GrowableArray<void*>(100, true);
! _other_refs_stack = new (ResourceObj::C_HEAP) GrowableArray<void*>(100, true);
! _adjusted_pointers = new (ResourceObj::C_HEAP) GrowableArray<void*>(100, true);
_live_oops = new (ResourceObj::C_HEAP) GrowableArray<oop>(100, true);
_live_oops_moved_to = new (ResourceObj::C_HEAP) GrowableArray<oop>(100, true);
_live_oops_size = new (ResourceObj::C_HEAP) GrowableArray<size_t>(100, true);
}
if (RecordMarkSweepCompaction) {
*** 192,201 ****
--- 192,207 ----
#endif
}
void GenMarkSweep::deallocate_stacks() {
+
+ if (!UseG1GC) {
+ GenCollectedHeap* gch = GenCollectedHeap::heap();
+ gch->release_scratch();
+ }
+
if (_preserved_oop_stack) {
delete _preserved_mark_stack;
_preserved_mark_stack = NULL;
delete _preserved_oop_stack;
_preserved_oop_stack = NULL;
*** 241,264 ****
SharedHeap::SO_SystemClasses,
&follow_root_closure, &follow_root_closure);
// Process reference objects found during marking
{
! ReferencePolicy *soft_ref_policy;
! if (clear_all_softrefs) {
! soft_ref_policy = new AlwaysClearPolicy();
! } else {
! #ifdef COMPILER2
! soft_ref_policy = new LRUMaxHeapPolicy();
! #else
! soft_ref_policy = new LRUCurrentHeapPolicy();
! #endif // COMPILER2
! }
! assert(soft_ref_policy != NULL,"No soft reference policy");
ref_processor()->process_discovered_references(
! soft_ref_policy, &is_alive, &keep_alive,
! &follow_stack_closure, NULL);
}
// Follow system dictionary roots and unload classes
bool purged_class = SystemDictionary::do_unloading(&is_alive);
--- 247,259 ----
SharedHeap::SO_SystemClasses,
&follow_root_closure, &follow_root_closure);
// Process reference objects found during marking
{
! ref_processor()->setup_policy(clear_all_softrefs);
ref_processor()->process_discovered_references(
! &is_alive, &keep_alive, &follow_stack_closure, NULL);
}
// Follow system dictionary roots and unload classes
bool purged_class = SystemDictionary::do_unloading(&is_alive);