4485N/A * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 342N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 342N/A * This code is free software; you can redistribute it and/or modify it 342N/A * under the terms of the GNU General Public License version 2 only, as 342N/A * published by the Free Software Foundation. 342N/A * This code is distributed in the hope that it will be useful, but WITHOUT 342N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 342N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 342N/A * version 2 for more details (a copy is included in the LICENSE file that 342N/A * accompanied this code). 342N/A * You should have received a copy of the GNU General Public License version 342N/A * 2 along with this work; if not, write to the Free Software Foundation, 342N/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 342N/A// A G1CollectorPolicy makes policy decisions that determine the 342N/A// characteristics of the collector. Examples include: 342N/A// * choice of collection set. 3776N/A// TraceGen0Time collects data on _both_ young and mixed evacuation pauses 3776N/A// (the latter may contain non-young regions - i.e. regions that are 3776N/A// technically in Gen1) while TraceGen1Time collects data about full GCs. 3009N/A// There are three command line options related to the young gen size: 3009N/A// NewSize, MaxNewSize and NewRatio (There is also -Xmn, but that is 3009N/A// just a short form for NewSize==MaxNewSize). G1 will use its internal 3009N/A// heuristics to calculate the actual young gen size, so these options 3009N/A// basically only limit the range within which G1 can pick a young gen 3009N/A// size. Also, these are general options taking byte sizes. G1 will 3009N/A// internally work with a number of regions instead. So, some rounding 3009N/A// If nothing related to the the young gen size is set on the command 4195N/A// line we should allow the young gen to be between G1NewSizePercent 4195N/A// and G1MaxNewSizePercent of the heap size. This means that every time 4195N/A// the heap size changes, the limits for the young gen size will be 3009N/A// If only -XX:NewSize is set we should use the specified value as the 4195N/A// minimum size for young gen. Still using G1MaxNewSizePercent of the 3009N/A// If only -XX:MaxNewSize is set we should use the specified value as the 4195N/A// maximum size for young gen. Still using G1NewSizePercent of the heap 3009N/A// If -XX:NewSize and -XX:MaxNewSize are both specified we use these values. 3009N/A// No updates when the heap size changes. There is a special case when 3009N/A// NewSize==MaxNewSize. This is interpreted as "fixed" and will use a 3009N/A// different heuristic for calculating the collection set when we do mixed 3009N/A// If only -XX:NewRatio is set we should use the specified ratio of the heap 3009N/A// as both min and max. This will be interpreted as "fixed" just like the 3009N/A// NewSize==MaxNewSize case above. But we will update the min and max 3009N/A// everytime the heap size changes. 3009N/A// NewSize and MaxNewSize override NewRatio. So, NewRatio is ignored if it is 3009N/A// combined with either NewSize or MaxNewSize. (A warning message is printed.) 342N/A // either equal to the number of parallel threads, if ParallelGCThreads 342N/A // has been set, or 1 otherwise 2941N/A // The number of GC threads currently active. 342N/A // These exclude marking times. 2986N/A // indicates whether we are in young or mixed GC mode 1898N/A // The max number of regions we can extend the eden by while the GC 1898N/A // locker is active. This should be >= _young_list_target_length; 342N/A // add here any more surv rate groups 342N/A // A function that prevents us putting too much stock in small sample 342N/A // sets. Returns a number between 2.0 and 1.0, depending on the number 342N/A // of samples. 5 or more samples yields one; fewer scales linearly from 342N/A // 2.0 at 1 sample to 1.0 at 5. 342N/A // also call it on any more surv rate groups 342N/A // Returns an estimate of the survival rate of the region at yg-age 342N/A // Statistics kept per GC stoppage, pause or full. 342N/A // Add a new GC of the given duration and end time to the record. 342N/A // The head of the list (via "next_in_collection_set()") representing the 1394N/A // current collection set. Set from the incrementally built collection 1394N/A // set at the start of the pause. 1394N/A // The number of bytes in the collection set before the pause. Set from 1394N/A // the incrementally built collection set at the start of an evacuation 3961N/A // pause, and incremented in finalize_cset() when adding old regions 3961N/A // (if any) to the collection set. 3961N/A // The number of bytes copied during the GC. 1394N/A // The associated information that is maintained while the incremental 1394N/A // collection set is being built with young regions. Used to populate 1394N/A // the recorded info for the evacuation pause. 1394N/A // The head of the incrementally built collection set. 1394N/A // The tail of the incrementally built collection set. 1394N/A // The number of bytes in the incrementally built collection set. 1394N/A // Used to set _collection_set_bytes_used_before at the start of 1394N/A // Used to record the highest end of heap region in collection set 3007N/A // The RSet lengths recorded for regions in the CSet. It is updated 3007N/A // by the thread that adds a new region to the CSet. We assume that 3007N/A // only one thread can be allocating a new CSet region (currently, 3007N/A // it does so after taking the Heap_lock) hence no need to 3007N/A // synchronize updates to this field. 3007N/A // A concurrent refinement thread periodcially samples the young 3007N/A // region RSets and needs to update _inc_cset_recorded_rs_lengths as 3007N/A // the RSets grow. Instead of having to syncronize updates to that 3007N/A // field we accumulate them in this field and add it to 3007N/A // _inc_cset_recorded_rs_lengths_diffs at the start of a GC. 3007N/A // The predicted elapsed time it will take to collect the regions in 3007N/A // the CSet. This is updated by the thread that adds a new region to 3007N/A // the CSet. See the comment for _inc_cset_recorded_rs_lengths about 3007N/A // See the comment for _inc_cset_recorded_rs_lengths_diffs. 342N/A // Stash a pointer to the g1 heap. 342N/A // The ratio of gc time to elapsed time, computed over recent pauses. 1359N/A // At the end of a pause we check the heap occupancy and we decide 1359N/A // whether we will start a marking cycle during the next pause. If 1359N/A // we decide that we want to do that, we will set this parameter to 1359N/A // true. So, this parameter will stay true between the end of a 1359N/A // pause and the beginning of a subsequent pause (not necessarily 1359N/A // the next one, see the comments on the next field) when we decide 1359N/A // that we will indeed start a marking cycle and do the initial-mark 1359N/A // If initiate_conc_mark_if_possible() is set at the beginning of a 1359N/A // pause, it is a suggestion that the pause should start a marking 1359N/A // cycle by doing the initial-mark work. However, it is possible 1359N/A // that the concurrent marking thread is still finishing up the 1359N/A // previous marking cycle (e.g., clearing the next marking 1359N/A // bitmap). If that is the case we cannot start a new cycle and 1359N/A // we'll have to wait for the concurrent marking thread to finish 1359N/A // what it is doing. In this case we will postpone the marking cycle 1359N/A // initiation decision for the next pause. When we eventually decide 1359N/A // to start a cycle, we will set _during_initial_mark_pause which 1359N/A // will stay true until the end of the initial-mark pause and it's 1359N/A // the condition that indicates that a pause is doing the 342N/A // This set of variables tracks the collector efficiency, in order to 342N/A // determine whether we should initiate a new marking. 2753N/A // Update the young list target length either by setting it to the 2753N/A // desired fixed value or by calculating it using G1's pause 2753N/A // prediction model. If no rs_lengths parameter is passed, predict 2753N/A // the RS lengths using the prediction model, otherwise use the 2753N/A // given rs_lengths as the prediction. 2753N/A // Calculate and return the minimum desired young list target 2753N/A // length. This is the minimum desired young list length according 2753N/A // Calculate and return the maximum desired young list target 2753N/A // length. This is the maximum desired young list length according 2753N/A // Calculate and return the maximum young list target length that 2753N/A // can fit into the pause time goal. The parameters are: rs_lengths 2753N/A // represent the prediction of how large the young RSet lengths will 2753N/A // be, base_min_length is the alreay existing number of regions in 2753N/A // the young list, min_length and max_length are the desired min and 2753N/A // max young list length according to the user's inputs. 2753N/A // Check whether a given young length (young_length) fits into the 2753N/A // given target pause time and whether the prediction for the amount 2753N/A // of objects to be copied for the given length will fit into the 2753N/A // given free space (expressed by base_free_regions). It is used by 2753N/A // calculate_young_list_target_length(). 4461N/A // Calculate the minimum number of old regions we'll add to the CSet 4461N/A // Calculate the maximum number of old regions we'll add to the CSet 4461N/A // Returns the given amount of uncollected reclaimable space 4461N/A // as a percentage of the current heap capacity. 2753N/A // Check the current value of the young list RSet lengths and 2753N/A // compare it against the last prediction. If the current value is 2753N/A // higher, recalculate the young list target length prediction. 2754N/A // This should be called after the heap is resized. 545N/A // Create jstat counters for the policy. 342N/A // This method controls how a collector handles one or more 342N/A // of its generations being fully allocated. 4485N/A // Record the start and end of an evacuation pause. 4485N/A // Record the start and end of a full collection. 342N/A // Must currently be called while the world is stopped. 4485N/A // Record start and end of remark. 4485N/A // Record start, end, and completion of cleanup. 4485N/A // Records the information about the heap size for reporting in 4485N/A // print_detailed_heap_transition 4485N/A // Print heap sizing transition (with less and more detail). 2655N/A // Record how much space we copied during a GC. This is typically 2655N/A // called when a GC alloc region is being retired. 2655N/A // The amount of space we copied during a GC. 3643N/A // Determine whether there are candidate regions so that the 3643N/A // next GC should be mixed. The two action strings are used 3643N/A // in the ergo output when the method returns true or false. 342N/A // Choose a new collection set. Marks the chosen regions as being 342N/A // "in_collection_set", and links them together. The head and number of 342N/A // the collection set are available via access methods. 342N/A // The head of the list (via "next_in_collection_set()") representing the 342N/A // current collection set. 2936N/A // Add old region "hr" to the CSet. 1394N/A // Incremental CSet Support 1394N/A // The head of the incrementally built collection set. 1394N/A // The tail of the incrementally built collection set. 1394N/A // Initialize incremental collection set info. 3007N/A // Perform any final calculations on the incremental CSet fields 1394N/A // Stop adding regions to the incremental collection set 3007N/A // Add information about hr to the aggregated information for the 3007N/A // incrementally built collection set. 1394N/A // Update information about hr in the aggregated information for 1394N/A // the incrementally built collection set. 1394N/A // Update the incremental cset information when adding a region 1394N/A // (should not be called directly). 1394N/A // Add hr to the LHS of the incremental collection set. 1394N/A // Add hr to the RHS of the incremental collection set. 1576N/A // This sets the initiate_conc_mark_if_possible() flag to start a 1576N/A // new cycle, as long as we are not already in one. It's best if it 1576N/A // is called during a safepoint when the test whether a cycle is in 1576N/A // progress or not is stable. 1359N/A // This is called at the very beginning of an evacuation pause (it 1359N/A // has to be the first thing that the pause does). If 1359N/A // initiate_conc_mark_if_possible() is true, and the concurrent 1359N/A // marking thread has completed its work during the previous cycle, 1359N/A // it will set during_initial_mark_pause() to so that the pause does 1359N/A // the initial-mark work and start a marking cycle. 342N/A // If an expansion would be appropriate, because recent GC overhead had 342N/A // exceeded the desired limit, return an amount to expand by. 342N/A // Print tracing information. 342N/A // Print stats on young survival ratio 342N/A // do that for any other surv rate groups 342N/A // Survivor regions policy. 342N/A // Current tenuring threshold, set to 0 if the collector reaches the 342N/A // maximum amount of suvivors regions. 545N/A // The limit on the number of regions allocated for survivors. 545N/A // The amount of survor regions after a collection. 545N/A // List of survivor regions. 342N/A // The limit on regions for a particular purpose is reached. 545N/A // Calculates survivor space parameters. 342N/A// This should move to some place more general... 342N/A// If we have "n" measurements, and we've kept track of their "sum" and the 342N/A// "sum_of_squares" of the measurements, this returns the variance of the 1879N/A#
endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP