/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*
*/
#include "precompiled.hpp"
#include "gc_implementation/parallelScavenge/asPSYoungGen.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
#include "gc_implementation/parallelScavenge/psYoungGen.hpp"
#include "gc_implementation/shared/gcUtil.hpp"
#include "gc_implementation/shared/spaceDecorator.hpp"
#include "oops/oop.inline.hpp"
}
//PSYoungGen(init_byte_size, minimum_byte_size, byte_size_limit),
_virtual_space = vs;
}
vm_exit_during_initialization("Could not reserve enough space for "
"object heap");
}
}
}
"generation size limit is wrong");
return result_aligned;
}
// Return the number of bytes the young gen is willing give up.
//
// Future implementations could check the survivors and if to_space is in the
// right place (below from_space), take a chunk from to_space.
if (uncommitted_bytes != 0) {
return uncommitted_bytes;
}
if (eden_space()->is_empty()) {
// Respect the minimum size for eden and for the young gen as a whole.
"Alignment is wrong");
"minimum gen size is wrong");
// See comment for ASPSOldGen::available_for_contraction()
// for reasons the "increment" fraction is used.
if (PrintAdaptiveSizePolicy && Verbose) {
result_aligned/K);
}
return result_aligned;
}
return 0;
}
// The current implementation only considers to the end of eden.
// If to_space is below from_space, to_space is not considered.
// to_space can be.
// Include any space that is committed but is not in eden.
virtual_space()->low(),
sizeof(char));
}
return available;
}
// Similar to PSYoungGen::resize_generation() but
// allows sum of eden_size and 2 * survivor_size to exceed _max_gen_size
// expands at the low end of the virtual space
// moves the boundary between the generations in order to expand
// some additional diagnostics
// If no additional changes are required, this can be deleted
// and the changes factored back into PSYoungGen::resize_generation().
bool size_changed = false;
// There used to be a guarantee here that
// (eden_size + 2*survivor_size) <= _max_gen_size
// This requirement is enforced by the calculation of desired_size
// below. It may not be true on entry since the size of the
// eden_size is no bounded by the generation size.
"just checking");
// Adjust new generation size
min_gen_size());
if (desired_size > orig_size) {
// Grow the generation
return false;
}
if (ZapUnusedHeapArea) {
// Mangle newly committed space immediately because it
// can be done here more simply that after the new
// spaces have been computed.
}
size_changed = true;
} else if (desired_size < orig_size) {
// How much is available for shrinking.
size_changed = true;
} else {
if (orig_size == gen_size_limit()) {
} else if (orig_size == min_gen_size()) {
}
}
}
if (size_changed) {
orig_size/K, current_size/K);
}
}
return true;
}
// Similar to PSYoungGen::resize_spaces() but
// eden always starts at the low end of the committed virtual space
// current implementation does not allow holes between the spaces
// _young_generation_boundary has to be reset because it changes.
// so additional verification
"just checking");
// We require eden and to space to be empty
return;
}
if (PrintAdaptiveSizePolicy && Verbose) {
eden_space()->bottom(),
eden_space()->end(),
eden_space()->bottom(),
sizeof(char)));
from_space()->bottom(),
from_space()->end(),
from_space()->bottom(),
sizeof(char)));
sizeof(char)));
}
// There's nothing to do if the new sizes are the same as the current
if (PrintAdaptiveSizePolicy && Verbose) {
}
return;
}
const bool maintain_minimum =
// Check whether from space is below to space
if (eden_from_to_order) {
// Eden, from, to
if (PrintAdaptiveSizePolicy && Verbose) {
}
// Set eden
// "requested_eden_size" is a goal for the size of eden
// and may not be attainable. "eden_size" below is
// calculated based on the location of from-space and
// the goal for the size of eden. from-space is
// fixed in place because it contains live data.
// The calculation is done this way to avoid 32bit
// overflow (i.e., eden_start + requested_eden_size
// may too large for representation in 32bits).
if (maintain_minimum) {
// Only make eden larger than the requested size if
// the minimum size of the generation has to be maintained.
// This could be done in general but policy at a higher
// level is determining a requested size for eden and that
// should be honored unless there is a fundamental reason.
sizeof(char));
} else {
}
// To may resize into from space as long as it is clear of live data.
// From space must remain page aligned, though, so we need to do some
// extra calculations.
// First calculate an optimal to-space
(char*)requested_survivor_size,
sizeof(char));
// Does the optimal to-space overlap from-space?
// Calculate the minimum offset possible for from_end
// Should we be in this method if from_space is empty? Why not the set_space method? FIX ME!
if (from_size == 0) {
} else {
}
"from_end moved to the right");
// Now update to_start with the new from_end
}
if (PrintAdaptiveSizePolicy && Verbose) {
}
} else {
// Eden, to, from
if (PrintAdaptiveSizePolicy && Verbose) {
}
// To space gets priority over eden resizing. Note that we position
// to space as if we were able to resize from space, even though from
// space is not modified.
// Giving eden priority was tried and gave poorer performance.
(char*)requested_survivor_size,
sizeof(char));
sizeof(char));
// if the space sizes are to be increased by several times then
// 'to_start' will point beyond the young generation. In this case
// 'to_start' should be adjusted.
// Compute how big eden can be, then adjust end.
// See comments above on calculating eden_end.
if (maintain_minimum) {
} else {
}
// Don't let eden shrink down to 0 or less.
if (PrintAdaptiveSizePolicy && Verbose) {
}
}
"from start moved to the right");
"from end moved into live data");
// Let's make sure the call to initialize doesn't reset "top"!
// For PrintAdaptiveSizePolicy block below
if (ZapUnusedHeapArea) {
// NUMA is a special case because a numa space is not mangled
// in order to not prematurely bind its address to memory to
// the wrong memory (i.e., don't want the GC thread to first
// touch the memory). The survivor spaces are not numa
// spaces and are mangled.
if (UseNUMA) {
if (eden_from_to_order) {
} else {
}
}
// If not mangling the spaces, do some checking to verify that
// the spaces are already mangled.
// The spaces should be correctly mangled at this point so
// do some checking here. Note that they are not being mangled
// in the calls to initialize().
// Must check mangling before the spaces are reshaped. Otherwise,
// the bottom or end of one space may have moved into an area
// covered by another space and a failure of the check may
// not correctly indicate which space is not properly mangled.
}
// When an existing space is being initialized, it is not
// mangled because the space has been previously mangled.
if (PrintAdaptiveSizePolicy) {
"collection: %d "
from_space()->capacity_in_bytes(),
to_space()->capacity_in_bytes());
gclog_or_tty->cr();
}
}
void ASPSYoungGen::reset_after_change() {
if (new_eden_bottom != eden_bottom) {
}
}