comparison src/share/vm/oops/oopsHierarchy.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 c7f3d0b4570f
children aed758eda82a
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 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.
31 // OBJECT hierarchy 31 // OBJECT hierarchy
32 // This hierarchy is a representation hierarchy, i.e. if A is a superclass 32 // This hierarchy is a representation hierarchy, i.e. if A is a superclass
33 // of B, A's representation is a prefix of B's representation. 33 // of B, A's representation is a prefix of B's representation.
34 34
35 typedef juint narrowOop; // Offset instead of address for an oop within a java object 35 typedef juint narrowOop; // Offset instead of address for an oop within a java object
36 typedef class klassOopDesc* wideKlassOop; // to keep SA happy and unhandled oop
37 // detector happy.
38 typedef void* OopOrNarrowOopStar; 36 typedef void* OopOrNarrowOopStar;
37 typedef class markOopDesc* markOop;
39 38
40 #ifndef CHECK_UNHANDLED_OOPS 39 #ifndef CHECK_UNHANDLED_OOPS
41 40
42 typedef class oopDesc* oop; 41 typedef class oopDesc* oop;
43 typedef class instanceOopDesc* instanceOop; 42 typedef class instanceOopDesc* instanceOop;
44 typedef class methodOopDesc* methodOop;
45 typedef class constMethodOopDesc* constMethodOop;
46 typedef class methodDataOopDesc* methodDataOop;
47 typedef class arrayOopDesc* arrayOop; 43 typedef class arrayOopDesc* arrayOop;
48 typedef class objArrayOopDesc* objArrayOop; 44 typedef class objArrayOopDesc* objArrayOop;
49 typedef class typeArrayOopDesc* typeArrayOop; 45 typedef class typeArrayOopDesc* typeArrayOop;
50 typedef class constantPoolOopDesc* constantPoolOop;
51 typedef class constantPoolCacheOopDesc* constantPoolCacheOop;
52 typedef class klassOopDesc* klassOop;
53 typedef class markOopDesc* markOop;
54 typedef class compiledICHolderOopDesc* compiledICHolderOop;
55 46
56 #else 47 #else
57
58 48
59 // When CHECK_UNHANDLED_OOPS is defined, an "oop" is a class with a 49 // When CHECK_UNHANDLED_OOPS is defined, an "oop" is a class with a
60 // carefully chosen set of constructors and conversion operators to go 50 // carefully chosen set of constructors and conversion operators to go
61 // to and from the underlying oopDesc pointer type. 51 // to and from the underlying oopDesc pointer type.
62 // 52 //
69 // Converting NULL to oop to Handle implicit is no longer accepted by the 59 // Converting NULL to oop to Handle implicit is no longer accepted by the
70 // compiler because there are too many steps in the conversion. Use Handle() 60 // compiler because there are too many steps in the conversion. Use Handle()
71 // instead, which generates less code anyway. 61 // instead, which generates less code anyway.
72 62
73 class Thread; 63 class Thread;
74 typedef class markOopDesc* markOop;
75 class PromotedObject; 64 class PromotedObject;
76 65
77 66
78 class oop { 67 class oop {
79 oopDesc* _o; 68 oopDesc* _o;
104 93
105 // General access 94 // General access
106 oopDesc* operator->() const { return obj(); } 95 oopDesc* operator->() const { return obj(); }
107 bool operator==(const oop o) const { return obj() == o.obj(); } 96 bool operator==(const oop o) const { return obj() == o.obj(); }
108 bool operator==(void *p) const { return obj() == p; } 97 bool operator==(void *p) const { return obj() == p; }
109 bool operator!=(const oop o) const { return obj() != o.obj(); } 98 bool operator!=(const volatile oop o) const { return obj() != o.obj(); }
110 bool operator!=(void *p) const { return obj() != p; } 99 bool operator!=(void *p) const { return obj() != p; }
111 bool operator==(intptr_t p) const { return obj() == (oopDesc*)p; } 100 bool operator==(intptr_t p) const { return obj() == (oopDesc*)p; }
112 bool operator!=(intptr_t p) const { return obj() != (oopDesc*)p; } 101 bool operator!=(intptr_t p) const { return obj() != (oopDesc*)p; }
113 102
114 bool operator<(oop o) const { return obj() < o.obj(); } 103 bool operator<(oop o) const { return obj() < o.obj(); }
124 operator intptr_t* () const { return (intptr_t*)obj(); } 113 operator intptr_t* () const { return (intptr_t*)obj(); }
125 operator PromotedObject* () const { return (PromotedObject*)obj(); } 114 operator PromotedObject* () const { return (PromotedObject*)obj(); }
126 operator markOop () const { return markOop(obj()); } 115 operator markOop () const { return markOop(obj()); }
127 116
128 operator address () const { return (address)obj(); } 117 operator address () const { return (address)obj(); }
129 operator intptr_t () const { return (intptr_t)obj(); } 118 operator intptr_t () const volatile { return (intptr_t)obj(); }
130 119
131 // from javaCalls.cpp 120 // from javaCalls.cpp
132 operator jobject () const { return (jobject)obj(); } 121 operator jobject () const { return (jobject)obj(); }
133 // from javaClasses.cpp 122 // from javaClasses.cpp
134 operator JavaThread* () const { return (JavaThread*)obj(); } 123 operator JavaThread* () const { return (JavaThread*)obj(); }
137 // from jvm.cpp 126 // from jvm.cpp
138 operator jlong* () const { return (jlong*)obj(); } 127 operator jlong* () const { return (jlong*)obj(); }
139 #endif 128 #endif
140 129
141 // from parNewGeneration and other things that want to get to the end of 130 // from parNewGeneration and other things that want to get to the end of
142 // an oop for stuff (like constMethodKlass.cpp, objArrayKlass.cpp) 131 // an oop for stuff (like objArrayKlass.cpp)
143 operator oop* () const { return (oop *)obj(); } 132 operator oop* () const { return (oop *)obj(); }
144 }; 133 };
145 134
146 #define DEF_OOP(type) \ 135 #define DEF_OOP(type) \
147 class type##OopDesc; \ 136 class type##OopDesc; \
152 type##Oop(const void* p) : oop(p) {} \ 141 type##Oop(const void* p) : oop(p) {} \
153 operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \ 142 operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \
154 type##OopDesc* operator->() const { \ 143 type##OopDesc* operator->() const { \
155 return (type##OopDesc*)obj(); \ 144 return (type##OopDesc*)obj(); \
156 } \ 145 } \
157 }; \ 146 };
158 147
159 DEF_OOP(instance); 148 DEF_OOP(instance);
160 DEF_OOP(method);
161 DEF_OOP(methodData);
162 DEF_OOP(array); 149 DEF_OOP(array);
163 DEF_OOP(constMethod);
164 DEF_OOP(constantPool);
165 DEF_OOP(constantPoolCache);
166 DEF_OOP(objArray); 150 DEF_OOP(objArray);
167 DEF_OOP(typeArray); 151 DEF_OOP(typeArray);
168 DEF_OOP(klass);
169 DEF_OOP(compiledICHolder);
170 152
171 #endif // CHECK_UNHANDLED_OOPS 153 #endif // CHECK_UNHANDLED_OOPS
154
155 // The metadata hierarchy is separate from the oop hierarchy
156
157 // class MetaspaceObj
158 class ConstMethod;
159 class ConstantPoolCache;
160 class MethodData;
161 // class Metadata
162 class Method;
163 class ConstantPool;
164 // class CHeapObj
165 class CompiledICHolder;
166
172 167
173 // The klass hierarchy is separate from the oop hierarchy. 168 // The klass hierarchy is separate from the oop hierarchy.
174 169
175 class Klass; 170 class Klass;
176 class instanceKlass; 171 class InstanceKlass;
177 class instanceMirrorKlass; 172 class instanceMirrorKlass;
173 class instanceClassLoaderKlass;
178 class instanceRefKlass; 174 class instanceRefKlass;
179 class methodKlass;
180 class constMethodKlass;
181 class methodDataKlass;
182 class klassKlass;
183 class instanceKlassKlass;
184 class arrayKlassKlass;
185 class objArrayKlassKlass;
186 class typeArrayKlassKlass;
187 class arrayKlass; 175 class arrayKlass;
188 class objArrayKlass; 176 class objArrayKlass;
189 class typeArrayKlass; 177 class typeArrayKlass;
190 class constantPoolKlass;
191 class constantPoolCacheKlass;
192 class compiledICHolderKlass;
193 178
194 #endif // SHARE_VM_OOPS_OOPSHIERARCHY_HPP 179 #endif // SHARE_VM_OOPS_OOPSHIERARCHY_HPP