/*
* 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 "gc_implementation/parallelScavenge/psVirtualspace.hpp"
#include "gc_implementation/shared/mutableSpace.hpp"
#include "gc_implementation/shared/spaceCounters.hpp"
class PSMarkSweepDecorator;
friend class VMStructs;
friend class ParallelScavengeHeap;
friend class AdjoiningGenerations;
protected:
// Spaces
// MarkSweep Decorators
// Sizing information, in bytes, set in constructor
// Performance counters
// Initialize the space boundaries
void compute_initial_space_boundaries();
// Space boundary helper
// Adjust the spaces to be consistent with the virtual space.
void post_resize();
// Return number of bytes that the generation can change.
// These should not be used by PSYoungGen
virtual size_t available_for_expansion();
virtual size_t available_for_contraction();
// Given a desired shrinkage in the size of the young generation,
// return the actual size available for shrinkage.
// returns the number of bytes available from the current size
// down to the minimum generation size.
// Return the number of bytes available for shrinkage considering
// the location the live data in the generation.
virtual size_t available_to_live();
public:
// Initialize the generation.
void initialize_work();
bool is_in(const void* p) const {
return _virtual_space->contains((void *)p);
}
bool is_in_reserved(const void* p) const {
}
// For Adaptive size policy
// MarkSweep support
void precompact();
void adjust_pointers();
void compact();
void swap_spaces();
// Resize generation using suggested free space size and survivor size
// NOTE: "eden_size" and "survivor_size" are suggestions only. Current
// heap layout (particularly, live objects in from space) might
// not allow us to use these values.
// Size info
size_t capacity_in_bytes() const;
size_t used_in_bytes() const;
size_t free_in_bytes() const;
size_t capacity_in_words() const;
size_t used_in_words() const;
size_t free_in_words() const;
// The max this generation can grow to
// The max this generation can grow to if the boundary between
// the generations are allowed to move.
bool is_maximal_no_gc() const {
return true; // never expands except at a GC
}
// Allocation
return result;
}
// Iteration.
virtual void reset_after_change();
virtual void reset_survivors_after_shrink();
// Performance Counter support
void update_counters();
// Debugging - do not use for time critical operations
void print() const;
void verify();
// Space boundary invariant checker
// Helper for mangling survivor spaces.
};
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSYOUNGGEN_HPP