diff --git a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index aa8695747658f0e78652d2317eeaa93096a30eb7..a9d9543ff74fe43fa8be4c5b948c528605080cea 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1425,6 +1425,18 @@ void G1CollectorPolicy::print_yg_surv_rate_info() const { #endif // PRODUCT } +bool G1CollectorPolicy::is_young_list_full() { + uint young_list_length = _g1->young_list()->length(); + uint young_list_target_length = _young_list_target_length; + return young_list_length >= young_list_target_length; +} + +bool G1CollectorPolicy::can_expand_young_list() { + uint young_list_length = _g1->young_list()->length(); + uint young_list_max_length = _young_list_max_length; + return young_list_length < young_list_max_length; +} + uint G1CollectorPolicy::max_regions(int purpose) { switch (purpose) { case GCAllocForSurvived: diff --git a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index b95824fef1da8bcec0a8890cfe1822c9b935f96e..6f9e2a1f5b40ee6cb83522dba95fc306da464e39 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -26,6 +26,7 @@ #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP #include "gc_implementation/g1/collectionSetChooser.hpp" +#include "gc_implementation/g1/g1Allocator.hpp" #include "gc_implementation/g1/g1MMUTracker.hpp" #include "memory/collectorPolicy.hpp" @@ -803,7 +804,7 @@ public: // If an expansion would be appropriate, because recent GC overhead had // exceeded the desired limit, return an amount to expand by. - size_t expansion_amount(); + virtual size_t expansion_amount(); // Print tracing information. void print_tracing_info() const; @@ -822,17 +823,9 @@ public: size_t young_list_target_length() const { return _young_list_target_length; } - bool is_young_list_full() { - uint young_list_length = _g1->young_list()->length(); - uint young_list_target_length = _young_list_target_length; - return young_list_length >= young_list_target_length; - } + bool is_young_list_full(); - bool can_expand_young_list() { - uint young_list_length = _g1->young_list()->length(); - uint young_list_max_length = _young_list_max_length; - return young_list_length < young_list_max_length; - } + bool can_expand_young_list(); uint young_list_max_length() { return _young_list_max_length; diff --git a/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp b/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c0b909856065378f513b1c99e1bf81c39837587c --- /dev/null +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. 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. + * + * 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. + * + */ + +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP +#define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP + +#include "gc_implementation/g1/g1CollectorPolicy.hpp" + +class G1CollectorPolicyExt : public G1CollectorPolicy { }; + +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP diff --git a/src/share/vm/memory/universe.cpp b/src/share/vm/memory/universe.cpp index 767fd3d77aada4f324d345c318f56bc66ef9b3b0..c4814d6ba131e0f309b2b33886b90830cd3c3fe4 100644 --- a/src/share/vm/memory/universe.cpp +++ b/src/share/vm/memory/universe.cpp @@ -78,7 +78,7 @@ #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp" #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp" #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" -#include "gc_implementation/g1/g1CollectorPolicy.hpp" +#include "gc_implementation/g1/g1CollectorPolicy_ext.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #endif // INCLUDE_ALL_GCS @@ -798,7 +798,7 @@ jint Universe::initialize_heap() { } else if (UseG1GC) { #if INCLUDE_ALL_GCS - G1CollectorPolicy* g1p = new G1CollectorPolicy(); + G1CollectorPolicyExt* g1p = new G1CollectorPolicyExt(); g1p->initialize_all(); G1CollectedHeap* g1h = new G1CollectedHeap(g1p); Universe::_collectedHeap = g1h; diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp index e5882e6d19dca0daad38b3b8690a870dec4e81ec..d8b4d7ad7ffc45e2b5118f7264dab6ee6fed4c48 100644 --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -2233,7 +2233,7 @@ bool Arguments::check_vm_args_consistency() { FLAG_SET_DEFAULT(UseGCOverheadLimit, false); } - status = status && ArgumentsExt::check_gc_consistency_user(); + status = status && check_gc_consistency_user(); status = status && check_stack_pages(); if (CMSIncrementalMode) { @@ -3625,7 +3625,7 @@ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_req } } - if (!ArgumentsExt::check_vm_args_consistency()) { + if (!check_vm_args_consistency()) { return JNI_ERR; } @@ -4028,7 +4028,7 @@ jint Arguments::apply_ergo() { // Set heap size based on available physical memory set_heap_size(); - set_gc_specific_flags(); + ArgumentsExt::set_gc_specific_flags(); // Initialize Metaspace flags and alignments. Metaspace::ergo_initialize(); diff --git a/src/share/vm/runtime/arguments.hpp b/src/share/vm/runtime/arguments.hpp index 2b345ffb1c992c9a79edb73c8a112bcf16d5e67b..e42f9acb62b3a29abb70d21594ab8de4dc8a70b0 100644 --- a/src/share/vm/runtime/arguments.hpp +++ b/src/share/vm/runtime/arguments.hpp @@ -342,7 +342,6 @@ class Arguments : AllStatic { static void select_gc(); static void set_ergonomics_flags(); static void set_shared_spaces_flags(); - static void set_gc_specific_flags(); // limits the given memory size by the maximum amount of memory this process is // currently allowed to allocate or reserve. static julong limit_by_allocatable_memory(julong size); @@ -454,6 +453,7 @@ class Arguments : AllStatic { // Adjusts the arguments after the OS have adjusted the arguments static jint adjust_after_os(); + static void set_gc_specific_flags(); static inline bool gc_selected(); // whether a gc has been selected static void select_gc_ergonomically(); diff --git a/src/share/vm/runtime/arguments_ext.hpp b/src/share/vm/runtime/arguments_ext.hpp index b0fbcc3d85683fe1d006662452465172008981fb..b1451229d8bc3d21e1d937e3e52f8b99a70c56c5 100644 --- a/src/share/vm/runtime/arguments_ext.hpp +++ b/src/share/vm/runtime/arguments_ext.hpp @@ -31,9 +31,8 @@ class ArgumentsExt: AllStatic { public: static inline void select_gc_ergonomically(); - static inline bool check_gc_consistency_user(); + static inline void set_gc_specific_flags(); static inline bool check_gc_consistency_ergo(); - static inline bool check_vm_args_consistency(); static void process_options(const JavaVMInitArgs* args) {} }; @@ -41,16 +40,12 @@ void ArgumentsExt::select_gc_ergonomically() { Arguments::select_gc_ergonomically(); } -bool ArgumentsExt::check_gc_consistency_user() { - return Arguments::check_gc_consistency_user(); +void ArgumentsExt::set_gc_specific_flags() { + Arguments::set_gc_specific_flags(); } bool ArgumentsExt::check_gc_consistency_ergo() { return Arguments::check_gc_consistency_ergo(); } -bool ArgumentsExt::check_vm_args_consistency() { - return Arguments::check_vm_args_consistency(); -} - #endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP