compactingPermGenGen.cpp revision 113
/*
* 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.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_compactingPermGenGen.cpp.incl"
// An ObjectClosure helper: Recursively adjust all pointers in an object
// and all objects by referenced it. Clear marks on objects in order to
// prevent visiting any object twice. This helper is used when the
// RedefineClasses() API has been called.
class AdjustSharedObjectClosure : public ObjectClosure {
public:
if (obj->is_shared_readwrite()) {
}
}
}
};
// An OopClosure helper: Recursively adjust all pointers in an object
// and all objects by referenced it. Clear marks on objects in order
// to prevent visiting any object twice.
class RecursiveAdjustSharedObjectClosure : public OopClosure {
protected:
template <class T> inline void do_oop_work(T* p) {
if (obj->is_shared_readwrite()) {
// Special case: if a class has a read-only constant pool,
// then the read-write objects referenced by the pool must
// have their marks reset.
if (cp->is_shared_readonly()) {
cp->oop_iterate(this);
}
}
}
}
}
public:
};
// We need to go through all placeholders in the system dictionary and
// try to resolve them into shared classes. Other threads might be in
// the process of loading a shared class and have strong roots on
// their stack to the class without having added the class to the
// dictionary yet. This means the class will be marked during phase 1
// but will not be unmarked during the application of the
// RecursiveAdjustSharedObjectClosure to the SystemDictionary. Note
// that we must not call find_shared_class with non-read-only symbols
// as doing so can cause hash codes to be computed, destroying
// forwarding pointers.
class TraversePlaceholdersClosure : public OopClosure {
protected:
template <class T> inline void do_oop_work(T* p) {
obj->is_shared_readonly()) {
if (k != NULL) {
}
}
}
public:
};
const char* gen_name = "perm";
// Generation Counters - generation 2, 1 subspace
}
void CompactingPermGenGen::update_counters() {
if (UsePerfData) {
}
}
if (!UseSharedSpaces && !DumpSharedSpaces) {
spec()->disable_sharing();
}
// Break virtual space into address ranges for all spaces.
if (spec()->enable_shared_spaces()) {
} else {
}
// Verify shared and unshared spaces adjacent.
// Split reserved memory into pieces.
+ spec()->read_write_size()
+ spec()->misc_data_size()
+ spec()->misc_code_size();
// Allocate the unshared (default) space.
if (_the_space == NULL)
vm_exit_during_initialization("Could not allocate an unshared"
" CompactingPermGen Space");
// Allocate shared spaces
if (spec()->enable_shared_spaces()) {
// If mapping a shared file, the space is not committed, don't
// mangle.
// Commit the memory behind the shared spaces if dumping (not
// mapping).
if (DumpSharedSpaces) {
}
// Allocate the shared spaces.
_ro_bts = new BlockOffsetSharedArray(
_rw_bts = new BlockOffsetSharedArray(
// Restore mangling flag.
vm_exit_during_initialization("Could not allocate a shared space");
// Cover both shared spaces entirely with cards.
if (UseSharedSpaces) {
// Map in the regions in the shared file.
// check the alignment constraints
// Base addresses didn't match; skip sharing, but continue
spec()->disable_sharing();
// If -Xshare:on is specified, print out the error message and exit VM,
// otherwise, set UseSharedSpaces to false and continue.
if (RequireSharedSpaces) {
} else {
FLAG_SET_DEFAULT(UseSharedSpaces, false);
}
// Note: freeing the block offset array objects does not
// currently free up the underlying storage.
delete _ro_bts;
delete _ro_space;
delete _rw_bts;
delete _rw_space;
}
}
// Reserved region includes shared spaces for oop.is_in_reserved().
} else {
}
}
// Do a complete scan of the shared read write space to catch all
// objects which contain references to any younger generation. Forward
// the pointers. Avoid space_iterate, as actually visiting all the
// objects in the space will page in more objects than we need.
// Instead, use the system dictionary as strong roots into the read
// write space.
//
// If a RedefineClasses() call has been made, then we have to iterate
// over the entire shared read-write space in order to find all the
// objects that need to be forwarded. For example, it is possible for
// an nmethod to be found and marked in GC phase-1 only for the nmethod
// to be freed by the time we reach GC phase-3. The underlying method
// is still marked, but we can't (easily) find it in GC phase-3 so we
// blow up in GC phase-4. With RedefineClasses() we want replaced code
// (EMCP or obsolete) to go away (i.e., be collectible) once it is no
// longer being executed by any thread so we keep minimal attachments
// to the replaced code. However, we can't guarantee when those EMCP
// or obsolete methods will be collected so they may still be out there
// even after we've severed our minimal attachments.
void CompactingPermGenGen::pre_adjust_pointers() {
if (spec()->enable_shared_spaces()) {
if (JvmtiExport::has_redefined_a_class()) {
// RedefineClasses() requires a brute force approach
} else {
}
}
}
#ifdef ASSERT
class VerifyMarksClearedClosure : public ObjectClosure {
public:
"Shared oop still marked?");
}
};
#endif
void CompactingPermGenGen::post_compact() {
#ifdef ASSERT
}
#endif
}
if (spec()->enable_shared_spaces()) {
#ifdef PRODUCT
// Making the rw_space walkable will page in the entire space, and
// is to be avoided. However, this is required for Verify options.
#endif
}
}
if (spec()->enable_shared_spaces()) {
} else {
}
}
// References from the perm gen to the younger generation objects may
// occur in static fields in Java classes or in constant pool references
// to String objects.
if (spec()->enable_shared_spaces()) {
blk->set_generation(this);
// ro_space has no younger gen refs.
blk->reset_generation();
}
}
// Shared spaces are addressed in pre_adjust_pointers.
void CompactingPermGenGen::adjust_pointers() {
the_space()->adjust_pointers();
}
void CompactingPermGenGen::compact() {
}
// Don't include shared spaces.
}
// Don't include shared spaces.
"If not used, the size of shared spaces should be 0");
return OneContigSpaceCardGeneration::max_capacity()
}
// Don't allow _virtual_size to expand into shared spaces.
if (bytes > _shared_space_size) {
}
}
void CompactingPermGenGen::grow_to_reserved() {
// Don't allow _virtual_size to expand into shared spaces.
}
}
// No young generation references, clear this generation's main space's
// card table entries. Do NOT clear the card table entries for the
// read-only space (always clear) or the read-write space (valuable
// information).
void CompactingPermGenGen::clear_remembered_set() {
}
// Objects in this generation's main space may have moved, invalidate
// that space's cards. Do NOT invalidate the card table entries for the
// read-only or read-write spaces, as those objects never move.
}
}
}
if (UseSharedSpaces) {
// remap the shared readonly space to shared readwrite, private
if (!mapinfo->remap_shared_readonly_as_readwrite()) {
return false;
}
}
return true;
}
void** CompactingPermGenGen::_vtbl_list;