hotspot/src/share/vm/memory/compactingPermGenGen.cpp
Print this page
rev 611 : Merge
@@ -1,10 +1,10 @@
#ifdef USE_PRAGMA_IDENT_SRC
#pragma ident "@(#)compactingPermGenGen.cpp 1.22 08/11/24 12:22:45 JVM"
#endif
/*
- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -50,13 +50,13 @@
// 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 {
-public:
- void do_oop(oop* o) {
- oop obj = *o;
+ protected:
+ template <class T> inline void do_oop_work(T* p) {
+ oop obj = oopDesc::load_decode_heap_oop_not_null(p);
if (obj->is_shared_readwrite()) {
if (obj->mark()->is_marked()) {
obj->init_mark(); // Don't revisit this object.
obj->oop_iterate(this); // Recurse - adjust objects referenced.
obj->adjust_pointers(); // Adjust this object's references.
@@ -72,11 +72,14 @@
cp->oop_iterate(this);
}
}
}
}
- };
+ }
+ public:
+ virtual void do_oop(oop* p) { RecursiveAdjustSharedObjectClosure::do_oop_work(p); }
+ virtual void do_oop(narrowOop* p) { RecursiveAdjustSharedObjectClosure::do_oop_work(p); }
};
// We need to go through all placeholders in the system dictionary and
// try to resolve them into shared classes. Other threads might be in
@@ -87,23 +90,27 @@
// 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 {
- public:
- void do_oop(oop* o) {
- oop obj = *o;
+ protected:
+ template <class T> inline void do_oop_work(T* p) {
+ oop obj = oopDesc::load_decode_heap_oop_not_null(p);
if (obj->klass() == Universe::symbolKlassObj() &&
obj->is_shared_readonly()) {
symbolHandle sym((symbolOop) obj);
oop k = SystemDictionary::find_shared_class(sym);
if (k != NULL) {
RecursiveAdjustSharedObjectClosure clo;
clo.do_oop(&k);
}
}
}
+ public:
+ virtual void do_oop(oop* p) { TraversePlaceholdersClosure::do_oop_work(p); }
+ virtual void do_oop(narrowOop* p) { TraversePlaceholdersClosure::do_oop_work(p); }
+
};
void CompactingPermGenGen::initialize_performance_counters() {
@@ -415,32 +422,10 @@
return OneContigSpaceCardGeneration::max_capacity()
- _shared_space_size;
}
-
-bool CompactingPermGenGen::grow_by(size_t bytes) {
- // Don't allow _virtual_size to expand into shared spaces.
- size_t max_bytes = _virtual_space.uncommitted_size() - _shared_space_size;
- if (bytes > _shared_space_size) {
- bytes = _shared_space_size;
- }
- return OneContigSpaceCardGeneration::grow_by(bytes);
-}
-
-
-void CompactingPermGenGen::grow_to_reserved() {
- // Don't allow _virtual_size to expand into shared spaces.
- if (_virtual_space.uncommitted_size() > _shared_space_size) {
- size_t remaining_bytes =
- _virtual_space.uncommitted_size() - _shared_space_size;
- bool success = OneContigSpaceCardGeneration::grow_by(remaining_bytes);
- DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
- }
-}
-
-
// 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).