6964458: Reimplement class meta-data storage to use native memory

Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes

Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
This commit is contained in:
Jon Masamitsu 2012-09-01 13:25:18 -04:00 committed by Coleen Phillimore
parent 36eee7c8c8
commit 5c58d27aac
853 changed files with 26124 additions and 82956 deletions

View file

@ -43,7 +43,6 @@ class GenCollectedHeap : public SharedHeap {
friend class CMSCollector;
friend class GenMarkSweep;
friend class VM_GenCollectForAllocation;
friend class VM_GenCollectForPermanentAllocation;
friend class VM_GenCollectFull;
friend class VM_GenCollectFullConcurrent;
friend class VM_GC_HeapInspection;
@ -86,10 +85,6 @@ public:
// In block contents verification, the number of header words to skip
NOT_PRODUCT(static size_t _skip_header_HeapWords;)
// GC is not allowed during the dump of the shared classes. Keep track
// of this in order to provide an reasonable error message when terminating.
bool _preloading_shared_classes;
protected:
// Directs each generation up to and including "collectedGen" to recompute
// its desired size.
@ -116,6 +111,7 @@ protected:
// Callback from VM_GenCollectFull operation.
// Perform a full collection of the first max_level+1 generations.
virtual void do_full_collection(bool clear_all_soft_refs);
void do_full_collection(bool clear_all_soft_refs, int max_level);
// Does the "cause" of GC indicate that
@ -129,7 +125,7 @@ public:
// Returns JNI_OK on success
virtual jint initialize();
char* allocate(size_t alignment, PermanentGenerationSpec* perm_gen_spec,
char* allocate(size_t alignment,
size_t* _total_reserved, int* _n_covered_regions,
ReservedSpace* heap_rs);
@ -145,6 +141,7 @@ public:
// The generational collector policy.
GenCollectorPolicy* gen_policy() const { return _gen_policy; }
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) gen_policy(); }
// Adaptive size policy
virtual AdaptiveSizePolicy* size_policy() {
@ -154,9 +151,8 @@ public:
size_t capacity() const;
size_t used() const;
// Save the "used_region" for generations level and lower,
// and, if perm is true, for perm gen.
void save_used_regions(int level, bool perm);
// Save the "used_region" for generations level and lower.
void save_used_regions(int level);
size_t max_capacity() const;
@ -185,12 +181,6 @@ public:
// supports. Caller does not hold the Heap_lock on entry.
void collect(GCCause::Cause cause);
// This interface assumes that it's being called by the
// vm thread. It collects the heap assuming that the
// heap lock is already held and that we are executing in
// the context of the vm thread.
void collect_as_vm_thread(GCCause::Cause cause);
// The same as above but assume that the caller holds the Heap_lock.
void collect_locked(GCCause::Cause cause);
@ -228,8 +218,8 @@ public:
}
// Iteration functions.
void oop_iterate(OopClosure* cl);
void oop_iterate(MemRegion mr, OopClosure* cl);
void oop_iterate(ExtendedOopClosure* cl);
void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
void object_iterate(ObjectClosure* cl);
void safe_object_iterate(ObjectClosure* cl);
void object_iterate_since_last_GC(ObjectClosure* cl);
@ -294,14 +284,6 @@ public:
return is_in_young(new_obj);
}
// Can a compiler elide a store barrier when it writes
// a permanent oop into the heap? Applies when the compiler
// is storing x to the heap, where x->is_perm() is true.
virtual bool can_elide_permanent_oop_store_barriers() const {
// CMS needs to see all, even intra-generational, ref updates.
return !UseConcMarkSweepGC;
}
// The "requestor" generation is performing some garbage collection
// action for which it would be useful to have scratch space. The
// requestor promises to allocate no more than "max_alloc_words" in any
@ -338,7 +320,6 @@ public:
for (int i = 0; i < _n_gens; i++) {
_gens[i]->update_time_of_last_gc(now);
}
perm_gen()->update_time_of_last_gc(now);
}
// Update the gc statistics for each generation.
@ -347,7 +328,6 @@ public:
for (int i = 0; i < _n_gens; i++) {
_gens[i]->update_gc_stats(current_level, full);
}
perm_gen()->update_gc_stats(current_level, full);
}
// Override.
@ -367,7 +347,6 @@ public:
// PrintGC, PrintGCDetails support
void print_heap_change(size_t prev_used) const;
void print_perm_heap_change(size_t perm_prev_used) const;
// The functions below are helper functions that a subclass of
// "CollectedHeap" can use in the implementation of its virtual
@ -378,13 +357,13 @@ public:
virtual void do_generation(Generation* gen) = 0;
};
// Apply "cl.do_generation" to all generations in the heap (not including
// the permanent generation). If "old_to_young" determines the order.
// Apply "cl.do_generation" to all generations in the heap
// If "old_to_young" determines the order.
void generation_iterate(GenClosure* cl, bool old_to_young);
void space_iterate(SpaceClosure* cl);
// Return "true" if all generations (but perm) have reached the
// Return "true" if all generations have reached the
// maximal committed limit that they can reach, without a garbage
// collection.
virtual bool is_maximal_no_gc() const;
@ -429,10 +408,8 @@ public:
// not scanned as roots; in this case, the caller must be arranging to
// scan the younger generations itself. (For example, a generation might
// explicitly mark reachable objects in younger generations, to avoid
// excess storage retention.) If "collecting_perm_gen" is false, then
// roots that may only contain references to permGen objects are not
// scanned; instead, the older_gens closure is applied to all outgoing
// references in the perm gen. The "so" argument determines which of the roots
// excess storage retention.)
// The "so" argument determines which of the roots
// the closure is applied to:
// "SO_None" does none;
// "SO_AllClasses" applies the closure to all entries in the SystemDictionary;
@ -443,11 +420,12 @@ public:
// The remaining arguments are in an order
// consistent with SharedHeap::process_strong_roots:
bool activate_scope,
bool collecting_perm_gen,
bool is_scavenging,
SharedHeap::ScanningOption so,
OopsInGenClosure* not_older_gens,
bool do_code_roots,
OopsInGenClosure* older_gens);
OopsInGenClosure* older_gens,
KlassClosure* klass_closure);
// Apply "blk" to all the weak roots of the system. These include
// JNI weak roots, the code cache, system dictionary, symbol table,
@ -463,9 +441,9 @@ public:
// Apply "cur->do_oop" or "older->do_oop" to all the oops in objects
// allocated since the last call to save_marks in generations at or above
// "level" (including the permanent generation.) The "cur" closure is
// "level". The "cur" closure is
// applied to references in the generation at "level", and the "older"
// closure to older (and permanent) generations.
// closure to older generations.
#define GCH_SINCE_SAVE_MARKS_ITERATE_DECL(OopClosureType, nv_suffix) \
void oop_since_save_marks_iterate(int level, \
OopClosureType* cur, \
@ -476,7 +454,7 @@ public:
#undef GCH_SINCE_SAVE_MARKS_ITERATE_DECL
// Returns "true" iff no allocations have occurred in any generation at
// "level" or above (including the permanent generation) since the last
// "level" or above since the last
// call to "save_marks".
bool no_allocs_since_save_marks(int level);
@ -506,7 +484,7 @@ public:
_incremental_collection_failed = false;
}
// Promotion of obj into gen failed. Try to promote obj to higher non-perm
// Promotion of obj into gen failed. Try to promote obj to higher
// gens in ascending order; return the new location of obj if successful.
// Otherwise, try expand-and-allocate for obj in each generation starting at
// gen; return the new location of obj if successful. Otherwise, return NULL.
@ -547,9 +525,6 @@ private:
protected:
virtual void gc_prologue(bool full);
virtual void gc_epilogue(bool full);
public:
virtual void preload_and_dump(TRAPS) KERNEL_RETURN;
};
#endif // SHARE_VM_MEMORY_GENCOLLECTEDHEAP_HPP