Mercurial > hg > truffle
comparison src/share/vm/services/classLoadingService.hpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | f95d63e2154a |
children | fb19af007ffc |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
27 | 27 |
28 #include "runtime/handles.hpp" | 28 #include "runtime/handles.hpp" |
29 #include "runtime/perfData.hpp" | 29 #include "runtime/perfData.hpp" |
30 #include "utilities/growableArray.hpp" | 30 #include "utilities/growableArray.hpp" |
31 | 31 |
32 class instanceKlass; | 32 class InstanceKlass; |
33 | 33 |
34 // VM monitoring and management support for the Class Loading subsystem | 34 // VM monitoring and management support for the Class Loading subsystem |
35 class ClassLoadingService : public AllStatic { | 35 class ClassLoadingService : public AllStatic { |
36 private: | 36 private: |
37 // Counters for classes loaded from class files | 37 // Counters for classes loaded from class files |
46 static PerfCounter* _shared_classbytes_loaded; | 46 static PerfCounter* _shared_classbytes_loaded; |
47 static PerfCounter* _shared_classbytes_unloaded; | 47 static PerfCounter* _shared_classbytes_unloaded; |
48 | 48 |
49 static PerfVariable* _class_methods_size; | 49 static PerfVariable* _class_methods_size; |
50 | 50 |
51 static size_t compute_class_size(instanceKlass* k); | 51 static size_t compute_class_size(InstanceKlass* k); |
52 | 52 |
53 public: | 53 public: |
54 static void init(); | 54 static void init(); |
55 | 55 |
56 static bool get_verbose() { return TraceClassLoading; } | 56 static bool get_verbose() { return TraceClassLoading; } |
100 } | 100 } |
101 static jlong class_method_data_size() { | 101 static jlong class_method_data_size() { |
102 return (UsePerfData ? _class_methods_size->get_value() : -1); | 102 return (UsePerfData ? _class_methods_size->get_value() : -1); |
103 } | 103 } |
104 | 104 |
105 static void notify_class_loaded(instanceKlass* k, bool shared_class); | 105 static void notify_class_loaded(InstanceKlass* k, bool shared_class); |
106 // All unloaded classes are non-shared | 106 // All unloaded classes are non-shared |
107 static void notify_class_unloaded(instanceKlass* k); | 107 static void notify_class_unloaded(InstanceKlass* k); |
108 static void add_class_method_size(int size) { | 108 static void add_class_method_size(int size) { |
109 if (UsePerfData) { | 109 if (UsePerfData) { |
110 _class_methods_size->inc(size); | 110 _class_methods_size->inc(size); |
111 } | 111 } |
112 } | 112 } |
125 LoadedClassesEnumerator(Thread* cur_thread); | 125 LoadedClassesEnumerator(Thread* cur_thread); |
126 | 126 |
127 int num_loaded_classes() { return _klass_handle_array->length(); } | 127 int num_loaded_classes() { return _klass_handle_array->length(); } |
128 KlassHandle get_klass(int index) { return _klass_handle_array->at(index); } | 128 KlassHandle get_klass(int index) { return _klass_handle_array->at(index); } |
129 | 129 |
130 static void add_loaded_class(klassOop k) { | 130 static void add_loaded_class(Klass* k) { |
131 // FIXME: For now - don't include array klasses | 131 // FIXME: For now - don't include array klasses |
132 // The spec is unclear at this point to count array klasses or not | 132 // The spec is unclear at this point to count array klasses or not |
133 // and also indirect creation of array of super class and secondaries | 133 // and also indirect creation of array of super class and secondaries |
134 // | 134 // |
135 // for (klassOop l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) { | 135 // for (Klass* l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) { |
136 // KlassHandle h(_current_thread, l); | 136 // KlassHandle h(_current_thread, l); |
137 // _loaded_classes->append(h); | 137 // _loaded_classes->append(h); |
138 // } | 138 // } |
139 KlassHandle h(_current_thread, k); | 139 KlassHandle h(_current_thread, k); |
140 _loaded_classes->append(h); | 140 _loaded_classes->append(h); |