compactingPermGenGen.cpp revision 47
6443N/A * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. 6443N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6443N/A * This code is free software; you can redistribute it and/or modify it 6443N/A * under the terms of the GNU General Public License version 2 only, as 6443N/A * published by the Free Software Foundation. 6443N/A * This code is distributed in the hope that it will be useful, but WITHOUT 6443N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6443N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6443N/A * version 2 for more details (a copy is included in the LICENSE file that 6443N/A * You should have received a copy of the GNU General Public License version 6443N/A * 2 along with this work; if not, write to the Free Software Foundation, 6443N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6443N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 6443N/A * CA 95054 USA or visit www.sun.com if you need additional information or 6443N/A#
include "incls/_precompiled.incl" 7255N/A// An ObjectClosure helper: Recursively adjust all pointers in an object 7255N/A// and all objects by referenced it. Clear marks on objects in order to 6443N/A// prevent visiting any object twice. This helper is used when the 6443N/A// RedefineClasses() API has been called. 7255N/A// An OopClosure helper: Recursively adjust all pointers in an object 7255N/A// and all objects by referenced it. Clear marks on objects in order 7255N/A// to prevent visiting any object twice. 7255N/A // Special case: if a class has a read-only constant pool, 7255N/A // then the read-write objects referenced by the pool must 7255N/A// We need to go through all placeholders in the system dictionary and 7255N/A// try to resolve them into shared classes. Other threads might be in 7255N/A// the process of loading a shared class and have strong roots on 7255N/A// their stack to the class without having added the class to the 7255N/A// dictionary yet. This means the class will be marked during phase 1 7255N/A// but will not be unmarked during the application of the 7255N/A// RecursiveAdjustSharedObjectClosure to the SystemDictionary. Note 7255N/A// that we must not call find_shared_class with non-read-only symbols 7255N/A// as doing so can cause hash codes to be computed, destroying 7255N/A // Generation Counters - generation 2, 1 subspace 7255N/A // Break virtual space into address ranges for all spaces. 7097N/A // Verify shared and unshared spaces adjacent. 7097N/A // Split reserved memory into pieces. 6443N/A // Allocate the unshared (default) space. 7097N/A " CompactingPermGen Space");
6443N/A // If mapping a shared file, the space is not committed, don't 6443N/A // Commit the memory behind the shared spaces if dumping (not 7097N/A // Allocate the shared spaces. 6443N/A // Cover both shared spaces entirely with cards. 6443N/A // Map in the regions in the shared file. 7070N/A // check the alignment constraints 7070N/A // Base addresses didn't match; skip sharing, but continue 7070N/A // If -Xshare:on is specified, print out the error message and exit VM, 6443N/A // otherwise, set UseSharedSpaces to false and continue. 7097N/A // Note: freeing the block offset array objects does not 7097N/A // currently free up the underlying storage. 6443N/A // Reserved region includes shared spaces for oop.is_in_reserved(). 7097N/A// Do a complete scan of the shared read write space to catch all 7097N/A// objects which contain references to any younger generation. Forward 7097N/A// the pointers. Avoid space_iterate, as actually visiting all the 7097N/A// objects in the space will page in more objects than we need. 7097N/A// Instead, use the system dictionary as strong roots into the read 7097N/A// If a RedefineClasses() call has been made, then we have to iterate 7097N/A// over the entire shared read-write space in order to find all the 6443N/A// objects that need to be forwarded. For example, it is possible for 6443N/A// an nmethod to be found and marked in GC phase-1 only for the nmethod 6443N/A// to be freed by the time we reach GC phase-3. The underlying method 6443N/A// is still marked, but we can't (easily) find it in GC phase-3 so we 6443N/A// 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. // RedefineClasses() requires a brute force approach "Shared oop still marked?");
// Making the rw_space walkable will page in the entire space, and // is to be avoided. However, this is required for Verify options. // References from the perm gen to the younger generation objects may // occur in static fields in Java classes or in constant pool references // ro_space has no younger gen refs. // Shared spaces are addressed in pre_adjust_pointers. // Don't include shared spaces. // Don't include shared spaces. "If not used, the size of shared spaces should be 0");
// Don't allow _virtual_size to expand into shared spaces. // 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 // 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. // JVM/TI RedefineClasses() support: // remap the shared readonly space to shared readwrite, private