compactingPermGenGen.hpp revision 408
/*
* Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// All heaps contains a "permanent generation," containing permanent
// (reflective) objects. This is like a regular generation in some ways,
// but unlike one in others, and so is split apart.
class PermanentGenerationSpec;
// This is the "generation" view of a CompactingPermGen.
class CompactingPermGenGen: public OneContigSpaceCardGeneration {
friend class VMStructs;
// Abstractly, this is a subtype that gets access to protected fields.
friend class CompactingPermGen;
private:
// Shared spaces
// With shared spaces there is a dicotomy in the use of the
// _virtual_space of the generation. There is a portion of the
// _virtual_space that is used for the unshared part of the
// permanent generation and a portion that is reserved for the shared part.
// The _reserved field in the generation represents both the
// unshared and shared parts of the generation. The _reserved
// variable is initialized for only the unshared part but is
// later extended to include the shared part during initialization
// if shared spaces are being used.
// The reserved size for the _virtual_space for CompactingPermGenGen
// is the size of the space for the permanent generation including the
// the shared spaces. This can be seen by the use of MaxPermSize
// in the allocation of PermanentGenerationSpec. The space for the
// shared spaces is committed separately (???).
// In general at initialization only a part of the
// space for the unshared part of the permanent generation is
// committed and more is committed as the permanent generation is
// grown. In growing the permanent generation the capacity() and
// max_capacity() of the generation are used. For the permanent
// generation (implemented with a CompactingPermGenGen) the capacity()
// is taken from the capacity of the space (_the_space variable used for the
// unshared part of the generation) and the max_capacity() is based
// on the size of the _reserved variable (which includes the size of the
// shared spaces) minus the size of the shared spaces.
// These values are redundant, but are called out separately to avoid
static HeapWord* unshared_bottom;
static HeapWord* unshared_end;
static HeapWord* shared_bottom;
static HeapWord* readonly_bottom;
static HeapWord* readonly_end;
static HeapWord* readwrite_bottom;
static HeapWord* readwrite_end;
static HeapWord* miscdata_bottom;
static HeapWord* miscdata_end;
static HeapWord* misccode_bottom;
static HeapWord* misccode_end;
static HeapWord* shared_end;
// List of klassOops whose vtbl entries are used to patch others.
static void** _vtbl_list;
// Performance Counters
void initialize_performance_counters();
public:
enum {
// subclass) objects, or greater.
};
enum {
ro = 0, // read-only shared space in the heap
n_regions = 4
};
const char* name() const {
return "compacting perm gen";
}
const char* short_name() const {
return "Perm";
}
// Return the maximum capacity for the object space. This
// explicitly does not include the shared spaces.
size_t max_capacity() const;
void update_counters();
void compute_new_size() {
assert(false, "Should not call this -- handled at PermGen level.");
}
bool must_be_youngest() const { return false; }
bool must_be_oldest() const { return false; }
}
// RedefineClasses note: this tester is used to check residence of
// the specified oop in the shared readonly space and not whether
// the oop is readonly.
static bool inline is_shared_readonly(const oopDesc* p) {
}
// RedefineClasses note: this tester is used to check residence of
// the specified oop in the shared readwrite space and not whether
// the oop is readwrite.
static bool inline is_shared_readwrite(const oopDesc* p) {
}
bool is_in_unshared(const void* p) const {
return OneContigSpaceCardGeneration::is_in(p);
}
bool is_in_shared(const void* p) const {
return p >= shared_bottom && p < shared_end;
}
inline bool is_in(const void* p) const {
return is_in_unshared(p) || is_in_shared(p);
}
void pre_adjust_pointers();
void adjust_pointers();
void compact();
void post_compact();
size_t contiguous_available() const;
void clear_remembered_set();
void invalidate_remembered_set();
else return false;
}
}
}
}
}
}
else {
}
}
static void generate_vtable_methods(void** vtbl_list,
void** vtable,
void verify(bool allow_dirty);
// Serialization
static void initialize_oops() KERNEL_RETURN;
// Initiate dumping of shared file.
// Remap the shared readonly space to shared readwrite, private if
// sharing is enabled. Simply returns true if sharing is not enabled
// or if the remapping has already been done by a prior call.
static bool remap_shared_readonly_as_readwrite();
};