/*
* 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/psPermGen.hpp"
// If boundary moving is being used, create the young gen and old
// gen with ASPSYoungGen and ASPSOldGen, respectively. Revert to
// the old behavior otherwise (with PSYoungGen and PSOldGen).
// Create the generations differently based on the option to
// move the boundary.
if (UseAdaptiveGCBoundary) {
// Initialize the adjoining virtual spaces. Then pass the
// a virtual to each generation for initialization of the
// generation.
// Does the actual creation of the virtual spaces
// Place the young gen at the high end. Passes in the virtual space.
// Place the old gen at the low end. Passes in the virtual space.
"old", 1);
young_gen()->initialize_work();
"Consistency check");
"Consistency check");
"Consistency check");
"Consistency check");
} else {
// Layout the reserved space for the generations.
// Create the generations. Virtual spaces are not passed in.
"old", 1);
// The virtual spaces are created by the initialization of the gens.
"Consistency check");
}
}
}
// Make checks on the current sizes of the generations and
// the contraints on the sizes of the generations. Push
// up the boundary within the contraints. A partial
// push can occur.
// These sizes limit the amount the boundaries can move. Effectively,
// the generation says how much it is willing to yield to the other
// generation.
if (change_in_bytes == 0) {
return;
}
if (TraceAdaptiveGCBoundary) {
if (!PrintHeapAtGC) {
}
old_gen()->max_gen_size()/K);
}
// Move the boundary between the generations up (smaller young gen).
young_gen()->reset_after_change();
old_gen()->reset_after_change();
}
// The total reserved for the generations should match the sum
// of the two even if the boundary is moving.
assert(reserved_byte_size() ==
"Space is missing");
young_gen()->space_invariants();
old_gen()->space_invariants();
if (TraceAdaptiveGCBoundary) {
if (!PrintHeapAtGC) {
}
old_gen()->max_gen_size()/K);
}
}
// See comments on request_old_gen_expansion()
// If eden is not empty, the boundary can be moved but no advantage
// can be made of the move since eden cannot be moved.
return false;
}
bool result = false;
if (change_in_bytes == 0) {
return false;
}
if (TraceAdaptiveGCBoundary) {
if (!PrintHeapAtGC) {
}
}
// Move the boundary between the generations down (smaller old gen).
young_gen()->reset_after_change();
old_gen()->reset_after_change();
result = true;
}
// The total reserved for the generations should match the sum
// of the two even if the boundary is moving.
assert(reserved_byte_size() ==
"Space is missing");
young_gen()->space_invariants();
old_gen()->space_invariants();
if (TraceAdaptiveGCBoundary) {
if (!PrintHeapAtGC) {
}
}
return result;
}
// Additional space is needed in the old generation. Try to move the boundary
// up to meet the need. Moves boundary up only
// Stress testing.
if (PSAdaptiveSizePolicyResizeVirtualSpaceAlot == 1) {
}
// Expand only if the entire generation is already committed.
}
}
}
// See comment on adjust_boundary_for_old_gen_needss().
// Adjust boundary down only.
// Stress testing.
if (PSAdaptiveSizePolicyResizeVirtualSpaceAlot == 0) {
}
// Expand only if the entire generation is already committed.
if (desired_size > committed) {
}
}
}