2212N/A * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A////////////////////////////////////////////////////////// 0N/A// Methods in abstract class VM_CMS_Operation 0N/A////////////////////////////////////////////////////////// 0N/A // The caller may block while communicating 0N/A // The caller may block while communicating 0N/A // We lost a race to a foreground collection 0N/A // -- there's nothing to do 0N/A "Inconsistent collector state?");
0N/A "Possible deadlock");
0N/A // Get the Heap_lock after the pending_list_lock. 0N/A "Possible deadlock");
0N/A // Release the Heap_lock first. 0N/A////////////////////////////////////////////////////////// 0N/A// Methods in class VM_CMS_Initial_Mark 0N/A////////////////////////////////////////////////////////// 0N/A////////////////////////////////////////////////////////// 0N/A// Methods in class VM_CMS_Final_Remark_Operation 0N/A////////////////////////////////////////////////////////// 0N/A// VM operation to invoke a concurrent collection of a 0N/A// GenCollectedHeap heap. 0N/A // The "full" of do_full_collection call below "forces" 0N/A // a collection; the second arg, 0, below ensures that 0N/A // only the young gen is collected. XXX In the future, 0N/A // we'll probably need to have something in this interface 0N/A // to say do this only if we are sure we will not bail 0N/A // out to a full collection in this attempt, but that's 0N/A "We can only be executing this arm of if at a safepoint");
0N/A 0
/* collect only youngest gen */);
0N/A }
// Else no need for a foreground young gc 0N/A "total_collections() should be monotonically increasing");
2212N/A // Disable iCMS until the full collection is done, and 2212N/A // remember that we did so. 0N/A // In case CMS thread was in icms_wait(), wake it up. 1440N/A // Nudge the CMS thread to start a concurrent collection. 0N/A // No need to do a young gc, we'll just nudge the CMS thread 0N/A // in the doit() method above, to be executed soon. 0N/A "total_collections() should be monotnically increasing");
0N/A return false;
// no need for foreground young gc 0N/A return true;
// may still need foreground young gc 0N/A // Release the Heap_lock first. 0N/A // It is fine to test whether completed collections has 0N/A // exceeded our request count without locking because 0N/A // the completion count is monotonically increasing; 0N/A // this will break for very long-running apps when the 0N/A // count overflows and wraps around. XXX fix me !!! 0N/A // e.g. at the rate of 1 full gc per ms, this could 0N/A // overflow in about 1000 years. 1576N/A // maybe we should change the condition to test _gc_cause == 1576N/A // GCCause::_java_lang_system_gc, instead of 1576N/A // _gc_cause != GCCause::_gc_locker 1576N/A "the only way to get here if this was a System.gc()-induced GC");
0N/A // Now, wait for witnessing concurrent gc cycle to complete, 0N/A // but do so in native mode, because we want to lock the 0N/A // FullGCEvent_lock, which may be needed by the VM thread 0N/A // or by the CMS thread, so we do not want to be suspended 0N/A // while holding that lock. 0N/A // Either a concurrent or a stop-world full gc is sufficient 0N/A // witness to our request. 2212N/A // Enable iCMS back if we disabled it earlier.