ysr@777: /* brutisso@2532: * Copyright (c) 2001, 2011, Oracle and/or its affiliates. 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: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. ysr@777: * ysr@777: */ ysr@777: stefank@2314: #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP stefank@2314: #define SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP stefank@2314: stefank@2314: #include "gc_implementation/shared/vmGCOperations.hpp" stefank@2314: ysr@777: // VM_operations for the G1 collector. ysr@777: // VM_GC_Operation: ysr@777: // - VM_CGC_Operation ysr@777: // - VM_G1CollectFull tonyp@2315: // - VM_G1OperationWithAllocRequest tonyp@2315: // - VM_G1CollectForAllocation tonyp@2315: // - VM_G1IncCollectionPause tonyp@2315: tonyp@2315: class VM_G1OperationWithAllocRequest: public VM_GC_Operation { tonyp@2315: protected: tonyp@2315: size_t _word_size; tonyp@2315: HeapWord* _result; tonyp@2315: bool _pause_succeeded; tonyp@2315: tonyp@2315: public: tonyp@2315: VM_G1OperationWithAllocRequest(unsigned int gc_count_before, tonyp@2315: size_t word_size) brutisso@2532: : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure), tonyp@2315: _word_size(word_size), _result(NULL), _pause_succeeded(false) { } tonyp@2315: HeapWord* result() { return _result; } tonyp@2315: bool pause_succeeded() { return _pause_succeeded; } tonyp@2315: }; ysr@777: ysr@777: class VM_G1CollectFull: public VM_GC_Operation { tonyp@2315: public: tonyp@2011: VM_G1CollectFull(unsigned int gc_count_before, tonyp@2011: unsigned int full_gc_count_before, tonyp@2011: GCCause::Cause cause) brutisso@2532: : VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { } 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: tonyp@2315: class VM_G1CollectForAllocation: public VM_G1OperationWithAllocRequest { tonyp@2315: public: tonyp@2315: VM_G1CollectForAllocation(unsigned int gc_count_before, tonyp@2315: size_t word_size); 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: }; ysr@777: tonyp@2315: class VM_G1IncCollectionPause: public VM_G1OperationWithAllocRequest { tonyp@2011: private: tonyp@2315: bool _should_initiate_conc_mark; tonyp@2315: double _target_pause_time_ms; tonyp@2011: unsigned int _full_collections_completed_before; tonyp@2011: public: tonyp@2011: VM_G1IncCollectionPause(unsigned int gc_count_before, tonyp@2315: size_t word_size, tonyp@2011: bool should_initiate_conc_mark, tonyp@2011: double target_pause_time_ms, tonyp@2315: GCCause::Cause gc_cause); ysr@777: virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; } ysr@777: virtual void doit(); tonyp@2011: virtual void doit_epilogue(); 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; tonyp@2315: public: tonyp@2315: VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg) tonyp@2315: : _cl(cl), _printGCMessage(printGCMsg) { } 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: }; stefank@2314: stefank@2314: #endif // SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP