1879N/A * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/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 0N/A //PSYoungGen(init_byte_size, minimum_byte_size, byte_size_limit), 0N/A "generation size limit is wrong");
0N/A// Return the number of bytes the young gen is willing give up. 0N/A// Future implementations could check the survivors and if to_space is in the 0N/A// right place (below from_space), take a chunk from to_space. 0N/A // Respect the minimum size for eden and for the young gen as a whole. 0N/A "Alignment is wrong");
0N/A "minimum gen size is wrong");
0N/A // See comment for ASPSOldGen::available_for_contraction() 0N/A // for reasons the "increment" fraction is used. 0N/A// The current implementation only considers to the end of eden. 0N/A// If to_space is below from_space, to_space is not considered. 0N/A // Include any space that is committed but is not in eden. 0N/A// Similar to PSYoungGen::resize_generation() but 0N/A// allows sum of eden_size and 2 * survivor_size to exceed _max_gen_size 0N/A// expands at the low end of the virtual space 0N/A// moves the boundary between the generations in order to expand 0N/A// some additional diagnostics 0N/A// If no additional changes are required, this can be deleted 0N/A// and the changes factored back into PSYoungGen::resize_generation(). 0N/A // There used to be a guarantee here that 0N/A // (eden_size + 2*survivor_size) <= _max_gen_size 0N/A // This requirement is enforced by the calculation of desired_size 0N/A // below. It may not be true on entry since the size of the 0N/A // eden_size is no bounded by the generation size. 0N/A // Adjust new generation size 0N/A // Grow the generation 263N/A // Mangle newly committed space immediately because it 263N/A // can be done here more simply that after the new 263N/A // spaces have been computed. 0N/A // How much is available for shrinking. 0N/A// Similar to PSYoungGen::resize_spaces() but 0N/A// eden always starts at the low end of the committed virtual space 0N/A// current implementation does not allow holes between the spaces 0N/A// _young_generation_boundary has to be reset because it changes. 0N/A// so additional verification 0N/A // We require eden and to space to be empty 0N/A // There's nothing to do if the new sizes are the same as the current 0N/A // Check whether from space is below to space 263N/A // "requested_eden_size" is a goal for the size of eden 263N/A // and may not be attainable. "eden_size" below is 263N/A // calculated based on the location of from-space and 263N/A // the goal for the size of eden. from-space is 263N/A // fixed in place because it contains live data. 263N/A // The calculation is done this way to avoid 32bit 263N/A // overflow (i.e., eden_start + requested_eden_size 263N/A // may too large for representation in 32bits). 263N/A // Only make eden larger than the requested size if 263N/A // the minimum size of the generation has to be maintained. 263N/A // This could be done in general but policy at a higher 263N/A // level is determining a requested size for eden and that 263N/A // should be honored unless there is a fundamental reason. 0N/A // To may resize into from space as long as it is clear of live data. 0N/A // From space must remain page aligned, though, so we need to do some 0N/A // extra calculations. 0N/A // First calculate an optimal to-space 0N/A // Does the optimal to-space overlap from-space? 0N/A // Calculate the minimum offset possible for from_end 0N/A // Should we be in this method if from_space is empty? Why not the set_space method? FIX ME! 0N/A "from_end moved to the right");
0N/A // Now update to_start with the new from_end 0N/A // To space gets priority over eden resizing. Note that we position 0N/A // to space as if we were able to resize from space, even though from 0N/A // space is not modified. 0N/A // Giving eden priority was tried and gave poorer performance. 0N/A // if the space sizes are to be increased by several times then 0N/A // 'to_start' will point beyond the young generation. In this case 0N/A // 'to_start' should be adjusted. 0N/A // Compute how big eden can be, then adjust end. 263N/A // See comments above on calculating eden_end. 0N/A // Don't let eden shrink down to 0 or less. 0N/A "from start moved to the right");
0N/A "from end moved into live data");
0N/A // Let's make sure the call to initialize doesn't reset "top"! 0N/A // For PrintAdaptiveSizePolicy block below 263N/A // NUMA is a special case because a numa space is not mangled 263N/A // in order to not prematurely bind its address to memory to 263N/A // the wrong memory (i.e., don't want the GC thread to first 263N/A // touch the memory). The survivor spaces are not numa 263N/A // spaces and are mangled. 263N/A // If not mangling the spaces, do some checking to verify that 263N/A // the spaces are already mangled. 263N/A // The spaces should be correctly mangled at this point so 263N/A // do some checking here. Note that they are not being mangled 263N/A // in the calls to initialize(). 263N/A // Must check mangling before the spaces are reshaped. Otherwise, 263N/A // the bottom or end of one space may have moved into an area 263N/A // covered by another space and a failure of the check may 263N/A // not correctly indicate which space is not properly mangled. 263N/A // When an existing space is being initialized, it is not 263N/A // mangled because the space has been previously mangled.