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

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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
@ -33,12 +33,11 @@
#include "memory/genCollectedHeap.hpp"
#include "memory/oopFactory.hpp"
#include "memory/universe.hpp"
#include "oops/constantPoolOop.hpp"
#include "oops/constantPool.hpp"
#include "oops/generateOopMap.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/instanceKlassKlass.hpp"
#include "oops/instanceOop.hpp"
#include "oops/methodOop.hpp"
#include "oops/method.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
@ -115,19 +114,23 @@ HS_DTRACE_PROBE_DECL(hotspot, vm__shutdown);
// Statistics printing (method invocation histogram)
GrowableArray<methodOop>* collected_invoked_methods;
GrowableArray<Method*>* collected_invoked_methods;
void collect_invoked_methods(methodOop m) {
void collect_invoked_methods(Method* m) {
if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
collected_invoked_methods->push(m);
}
}
GrowableArray<methodOop>* collected_profiled_methods;
GrowableArray<Method*>* collected_profiled_methods;
void collect_profiled_methods(methodOop m) {
methodHandle mh(Thread::current(), m);
void collect_profiled_methods(Method* m) {
Thread* thread = Thread::current();
// This HandleMark prevents a huge amount of handles from being added
// to the metadata_handles() array on the thread.
HandleMark hm(thread);
methodHandle mh(thread, m);
if ((m->method_data() != NULL) &&
(PrintMethodData || CompilerOracle::should_print(mh))) {
collected_profiled_methods->push(m);
@ -135,7 +138,7 @@ void collect_profiled_methods(methodOop m) {
}
int compare_methods(methodOop* a, methodOop* b) {
int compare_methods(Method** a, Method** b) {
// %%% there can be 32-bit overflow here
return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
- ((*a)->invocation_count() + (*a)->compiled_invocation_count());
@ -145,7 +148,7 @@ int compare_methods(methodOop* a, methodOop* b) {
void print_method_invocation_histogram() {
ResourceMark rm;
HandleMark hm;
collected_invoked_methods = new GrowableArray<methodOop>(1024);
collected_invoked_methods = new GrowableArray<Method*>(1024);
SystemDictionary::methods_do(collect_invoked_methods);
collected_invoked_methods->sort(&compare_methods);
//
@ -156,7 +159,7 @@ void print_method_invocation_histogram() {
unsigned total = 0, int_total = 0, comp_total = 0, static_total = 0, final_total = 0,
synch_total = 0, nativ_total = 0, acces_total = 0;
for (int index = 0; index < collected_invoked_methods->length(); index++) {
methodOop m = collected_invoked_methods->at(index);
Method* m = collected_invoked_methods->at(index);
int c = m->invocation_count() + m->compiled_invocation_count();
if (c >= MethodHistogramCutoff) m->print_invocation_count();
int_total += m->invocation_count();
@ -185,14 +188,14 @@ void print_method_invocation_histogram() {
void print_method_profiling_data() {
ResourceMark rm;
HandleMark hm;
collected_profiled_methods = new GrowableArray<methodOop>(1024);
collected_profiled_methods = new GrowableArray<Method*>(1024);
SystemDictionary::methods_do(collect_profiled_methods);
collected_profiled_methods->sort(&compare_methods);
int count = collected_profiled_methods->length();
if (count > 0) {
for (int index = 0; index < count; index++) {
methodOop m = collected_profiled_methods->at(index);
Method* m = collected_profiled_methods->at(index);
ttyLocker ttyl;
tty->print_cr("------------------------------------------------------------------------");
//m->print_name(tty);
@ -485,6 +488,9 @@ void before_exit(JavaThread * thread) {
if (PrintGCDetails) {
Universe::print();
AdaptiveSizePolicyOutput(0);
if (Verbose) {
ClassLoaderDataGraph::dump_on(gclog_or_tty);
}
}