/*
* 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 "precompiled.hpp"
#include "gc_implementation/shared/gcTimer.hpp"
#include "gc_implementation/shared/gcTraceTime.hpp"
#include "gc_implementation/shared/isGCActiveMark.hpp"
#include "memory/gcLocker.inline.hpp"
#include "runtime/interfaceSupport.hpp"
#include "utilities/dtrace.hpp"
#ifndef USDT2
#endif /* !USDT2 */
//////////////////////////////////////////////////////////
// Methods in abstract class VM_CMS_Operation
//////////////////////////////////////////////////////////
// The caller may block while communicating
}
// The caller may block while communicating
}
if (VerifyBeforeGC &&
}
}
if (VerifyAfterGC &&
}
}
// We lost a race to a foreground collection
// -- there's nothing to do
return true;
}
"Inconsistent collector state?");
return false;
}
"Possible deadlock");
if (needs_pll()) {
}
// Get the Heap_lock after the pending_list_lock.
if (lost_race()) {
if (needs_pll()) {
}
} else {
_prologue_succeeded = true;
}
return _prologue_succeeded;
}
"Possible deadlock");
// Release the Heap_lock first.
if (needs_pll()) {
}
}
//////////////////////////////////////////////////////////
// Methods in class VM_CMS_Initial_Mark
//////////////////////////////////////////////////////////
if (lost_race()) {
// Nothing to do.
return;
}
#ifndef USDT2
#else /* USDT2 */
);
#endif /* USDT2 */
IsGCActiveMark x; // stop-world GC active
#ifndef USDT2
#else /* USDT2 */
);
#endif /* USDT2 */
}
//////////////////////////////////////////////////////////
// Methods in class VM_CMS_Final_Remark_Operation
//////////////////////////////////////////////////////////
if (lost_race()) {
// Nothing to do.
return;
}
#ifndef USDT2
#else /* USDT2 */
);
#endif /* USDT2 */
IsGCActiveMark x; // stop-world GC active
#ifndef USDT2
#else /* USDT2 */
);
#endif /* USDT2 */
}
// VM operation to invoke a concurrent collection of a
// GenCollectedHeap heap.
// The "full" of do_full_collection call below "forces"
// a collection; the second arg, 0, below ensures that
// only the young gen is collected. XXX In the future,
// we'll probably need to have something in this interface
// to say do this only if we are sure we will not bail
// out to a full collection in this attempt, but that's
// for the future.
"We can only be executing this arm of if at a safepoint");
0 /* collect only youngest gen */);
} // Else no need for a foreground young gc
"total_collections() should be monotonically increasing");
// Disable iCMS until the full collection is done, and
// remember that we did so.
_disabled_icms = true;
// In case CMS thread was in icms_wait(), wake it up.
// Nudge the CMS thread to start a concurrent collection.
} else {
}
}
if (!thr->is_Java_thread()) {
// No need to do a young gc, we'll just nudge the CMS thread
// in the doit() method above, to be executed soon.
"total_collections() should be monotnically increasing");
return false; // no need for foreground young gc
}
}
return true; // may still need foreground young gc
}
// Release the Heap_lock first.
// It is fine to test whether completed collections has
// exceeded our request count without locking because
// the completion count is monotonically increasing;
// this will break for very long-running apps when the
// count overflows and wraps around. XXX fix me !!!
// e.g. at the rate of 1 full gc per ms, this could
// overflow in about 1000 years.
// maybe we should change the condition to test _gc_cause ==
// GCCause::_java_lang_system_gc, instead of
// _gc_cause != GCCause::_gc_locker
"the only way to get here if this was a System.gc()-induced GC");
// Now, wait for witnessing concurrent gc cycle to complete,
// but do so in native mode, because we want to lock the
// FullGCEvent_lock, which may be needed by the VM thread
// or by the CMS thread, so we do not want to be suspended
// while holding that lock.
// Either a concurrent or a stop-world full gc is sufficient
// witness to our request.
}
}
// Enable iCMS back if we disabled it earlier.
if (_disabled_icms) {
}
}