ysr@777: /* xdono@1279: * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. ysr@777: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ysr@777: * ysr@777: * This code is free software; you can redistribute it and/or modify it ysr@777: * under the terms of the GNU General Public License version 2 only, as ysr@777: * published by the Free Software Foundation. ysr@777: * ysr@777: * This code is distributed in the hope that it will be useful, but WITHOUT ysr@777: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ysr@777: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ysr@777: * version 2 for more details (a copy is included in the LICENSE file that ysr@777: * accompanied this code). ysr@777: * ysr@777: * You should have received a copy of the GNU General Public License version ysr@777: * 2 along with this work; if not, write to the Free Software Foundation, ysr@777: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ysr@777: * ysr@777: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, ysr@777: * CA 95054 USA or visit www.sun.com if you need additional information or ysr@777: * have any questions. ysr@777: * ysr@777: */ ysr@777: ysr@777: // VM_operations for the G1 collector. ysr@777: // VM_GC_Operation: ysr@777: // - VM_CGC_Operation ysr@777: // - VM_G1CollectFull ysr@777: // - VM_G1CollectForAllocation ysr@777: // - VM_G1IncCollectionPause ysr@777: // - VM_G1PopRegionCollectionPause ysr@777: ysr@777: class VM_G1CollectFull: public VM_GC_Operation { ysr@777: private: ysr@777: public: ysr@777: VM_G1CollectFull(int gc_count_before, ysr@777: GCCause::Cause gc_cause) ysr@777: : VM_GC_Operation(gc_count_before) ysr@777: { ysr@777: _gc_cause = gc_cause; ysr@777: } ysr@777: ~VM_G1CollectFull() {} ysr@777: virtual VMOp_Type type() const { return VMOp_G1CollectFull; } ysr@777: virtual void doit(); ysr@777: virtual const char* name() const { ysr@777: return "full garbage-first collection"; ysr@777: } ysr@777: }; ysr@777: ysr@777: class VM_G1CollectForAllocation: public VM_GC_Operation { ysr@777: private: ysr@777: HeapWord* _res; ysr@777: size_t _size; // size of object to be allocated ysr@777: public: ysr@777: VM_G1CollectForAllocation(size_t size, int gc_count_before) ysr@777: : VM_GC_Operation(gc_count_before) { ysr@777: _size = size; ysr@777: _res = NULL; ysr@777: } ysr@777: ~VM_G1CollectForAllocation() {} ysr@777: virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } ysr@777: virtual void doit(); ysr@777: virtual const char* name() const { ysr@777: return "garbage-first collection to satisfy allocation"; ysr@777: } ysr@777: HeapWord* result() { return _res; } ysr@777: }; ysr@777: ysr@777: class VM_G1IncCollectionPause: public VM_GC_Operation { ysr@777: public: ysr@777: VM_G1IncCollectionPause(int gc_count_before) : ysr@777: VM_GC_Operation(gc_count_before) {} ysr@777: virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; } ysr@777: virtual void doit(); ysr@777: virtual const char* name() const { ysr@777: return "garbage-first incremental collection pause"; ysr@777: } ysr@777: }; ysr@777: ysr@777: // Concurrent GC stop-the-world operations such as initial and final mark; ysr@777: // consider sharing these with CMS's counterparts. ysr@777: class VM_CGC_Operation: public VM_Operation { ysr@777: VoidClosure* _cl; ysr@777: const char* _printGCMessage; ysr@777: public: ysr@777: VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg) : ysr@777: _cl(cl), ysr@777: _printGCMessage(printGCMsg) ysr@777: {} ysr@777: ysr@777: ~VM_CGC_Operation() {} ysr@777: ysr@777: virtual VMOp_Type type() const { return VMOp_CGC_Operation; } ysr@777: virtual void doit(); ysr@777: virtual bool doit_prologue(); ysr@777: virtual void doit_epilogue(); ysr@777: virtual const char* name() const { ysr@777: return "concurrent gc"; ysr@777: } ysr@777: };