duke@435: /* duke@435: * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * duke@435: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: * CA 95054 USA or visit www.sun.com if you need additional information or duke@435: * have any questions. duke@435: * duke@435: */ duke@435: duke@435: // A Generation that does parallel young-gen collection extended duke@435: // for adaptive size policy. duke@435: duke@435: // Division of generation into spaces duke@435: // done by DefNewGeneration::compute_space_boundaries() duke@435: // +---------------+ duke@435: // | uncommitted | duke@435: // |---------------| duke@435: // | ss0 | duke@435: // |---------------| duke@435: // | ss1 | duke@435: // |---------------| duke@435: // | | duke@435: // | eden | duke@435: // | | duke@435: // +---------------+ <-- low end of VirtualSpace duke@435: // duke@435: class ASParNewGeneration: public ParNewGeneration { duke@435: duke@435: size_t _min_gen_size; duke@435: duke@435: // Resize the generation based on the desired sizes of duke@435: // the constituent spaces. duke@435: bool resize_generation(size_t eden_size, size_t survivor_size); duke@435: // Resize the spaces based on their desired sizes but duke@435: // respecting the maximum size of the generation. duke@435: void resize_spaces(size_t eden_size, size_t survivor_size); duke@435: // Return the byte size remaining to the minimum generation size. duke@435: size_t available_to_min_gen(); duke@435: // Return the byte size remaining to the live data in the generation. duke@435: size_t available_to_live() const; duke@435: // Return the byte size that the generation is allowed to shrink. duke@435: size_t limit_gen_shrink(size_t bytes); duke@435: // Reset the size of the spaces after a shrink of the generation. duke@435: void reset_survivors_after_shrink(); duke@435: duke@435: // Accessor duke@435: VirtualSpace* virtual_space() { return &_virtual_space; } duke@435: duke@435: virtual void adjust_desired_tenuring_threshold(); duke@435: duke@435: public: duke@435: duke@435: ASParNewGeneration(ReservedSpace rs, duke@435: size_t initial_byte_size, duke@435: size_t min_byte_size, duke@435: int level); duke@435: duke@435: virtual const char* short_name() const { return "ASParNew"; } duke@435: virtual const char* name() const; duke@435: virtual Generation::Name kind() { return ASParNew; } duke@435: duke@435: // Change the sizes of eden and the survivor spaces in duke@435: // the generation. The parameters are desired sizes duke@435: // and are not guaranteed to be met. For example, if duke@435: // the total is larger than the generation. duke@435: void resize(size_t eden_size, size_t survivor_size); duke@435: duke@435: virtual void compute_new_size(); duke@435: duke@435: size_t max_gen_size() { return _reserved.byte_size(); } duke@435: size_t min_gen_size() const { return _min_gen_size; } duke@435: duke@435: // Space boundary invariant checker duke@435: void space_invariants() PRODUCT_RETURN; duke@435: };