Mercurial > hg > truffle
annotate src/share/vm/oops/oopsHierarchy.hpp @ 12114:c31eb8c86a50
Merge
author | brutisso |
---|---|
date | Thu, 22 Aug 2013 04:14:45 +0200 |
parents | d8ce2825b193 |
children | 740e263c80c6 |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
845
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
845
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
845
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_OOPS_OOPSHIERARCHY_HPP |
26 #define SHARE_VM_OOPS_OOPSHIERARCHY_HPP | |
27 | |
28 #include "runtime/globals.hpp" | |
29 #include "utilities/globalDefinitions.hpp" | |
30 | |
0 | 31 // OBJECT hierarchy |
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. | |
34 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
35 typedef juint narrowOop; // Offset instead of address for an oop within a java object |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
579
diff
changeset
|
36 typedef void* OopOrNarrowOopStar; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
37 typedef class markOopDesc* markOop; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
38 |
0 | 39 #ifndef CHECK_UNHANDLED_OOPS |
40 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
41 typedef class oopDesc* oop; |
0 | 42 typedef class instanceOopDesc* instanceOop; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
43 typedef class arrayOopDesc* arrayOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
44 typedef class objArrayOopDesc* objArrayOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
45 typedef class typeArrayOopDesc* typeArrayOop; |
0 | 46 |
47 #else | |
48 | |
49 // When CHECK_UNHANDLED_OOPS is defined, an "oop" is a class with a | |
50 // carefully chosen set of constructors and conversion operators to go | |
51 // to and from the underlying oopDesc pointer type. | |
52 // | |
53 // Because oop and its subclasses <type>Oop are class types, arbitrary | |
54 // conversions are not accepted by the compiler, and you may get a message | |
55 // about overloading ambiguity (between long and int is common when converting | |
56 // from a constant in 64 bit mode), or unable to convert from type to 'oop'. | |
57 // Applying a cast to one of these conversion operators first will get to the | |
58 // underlying oopDesc* type if appropriate. | |
59 // Converting NULL to oop to Handle implicit is no longer accepted by the | |
60 // compiler because there are too many steps in the conversion. Use Handle() | |
61 // instead, which generates less code anyway. | |
62 | |
63 class Thread; | |
64 class PromotedObject; | |
65 | |
66 | |
67 class oop { | |
68 oopDesc* _o; | |
69 | |
70 void register_oop(); | |
71 void unregister_oop(); | |
72 | |
73 // friend class markOop; | |
74 public: | |
75 void set_obj(const void* p) { | |
76 raw_set_obj(p); | |
77 if (CheckUnhandledOops) register_oop(); | |
78 } | |
79 void raw_set_obj(const void* p) { _o = (oopDesc*)p; } | |
80 | |
81 oop() { set_obj(NULL); } | |
82 oop(const volatile oop& o) { set_obj(o.obj()); } | |
83 oop(const void* p) { set_obj(p); } | |
84 oop(intptr_t i) { set_obj((void *)i); } | |
85 #ifdef _LP64 | |
86 oop(int i) { set_obj((void *)i); } | |
87 #endif | |
88 ~oop() { | |
89 if (CheckUnhandledOops) unregister_oop(); | |
90 } | |
91 | |
92 oopDesc* obj() const volatile { return _o; } | |
93 | |
94 // General access | |
95 oopDesc* operator->() const { return obj(); } | |
96 bool operator==(const oop o) const { return obj() == o.obj(); } | |
97 bool operator==(void *p) const { return obj() == p; } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
98 bool operator!=(const volatile oop o) const { return obj() != o.obj(); } |
0 | 99 bool operator!=(void *p) const { return obj() != p; } |
100 bool operator==(intptr_t p) const { return obj() == (oopDesc*)p; } | |
101 bool operator!=(intptr_t p) const { return obj() != (oopDesc*)p; } | |
102 | |
103 bool operator<(oop o) const { return obj() < o.obj(); } | |
104 bool operator>(oop o) const { return obj() > o.obj(); } | |
105 bool operator<=(oop o) const { return obj() <= o.obj(); } | |
106 bool operator>=(oop o) const { return obj() >= o.obj(); } | |
107 bool operator!() const { return !obj(); } | |
108 | |
109 // Cast | |
110 operator void* () const { return (void *)obj(); } | |
111 operator HeapWord* () const { return (HeapWord*)obj(); } | |
112 operator oopDesc* () const { return obj(); } | |
113 operator intptr_t* () const { return (intptr_t*)obj(); } | |
114 operator PromotedObject* () const { return (PromotedObject*)obj(); } | |
115 operator markOop () const { return markOop(obj()); } | |
116 | |
117 operator address () const { return (address)obj(); } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
118 operator intptr_t () const volatile { return (intptr_t)obj(); } |
0 | 119 |
120 // from javaCalls.cpp | |
121 operator jobject () const { return (jobject)obj(); } | |
122 // from javaClasses.cpp | |
123 operator JavaThread* () const { return (JavaThread*)obj(); } | |
513
2328d1d3f8cf
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
196
diff
changeset
|
124 |
2328d1d3f8cf
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
196
diff
changeset
|
125 #ifndef _LP64 |
0 | 126 // from jvm.cpp |
127 operator jlong* () const { return (jlong*)obj(); } | |
513
2328d1d3f8cf
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
196
diff
changeset
|
128 #endif |
0 | 129 |
130 // from parNewGeneration and other things that want to get to the end of | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6735
diff
changeset
|
131 // an oop for stuff (like ObjArrayKlass.cpp) |
0 | 132 operator oop* () const { return (oop *)obj(); } |
133 }; | |
134 | |
135 #define DEF_OOP(type) \ | |
136 class type##OopDesc; \ | |
137 class type##Oop : public oop { \ | |
138 public: \ | |
139 type##Oop() : oop() {} \ | |
140 type##Oop(const volatile oop& o) : oop(o) {} \ | |
141 type##Oop(const void* p) : oop(p) {} \ | |
142 operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \ | |
143 type##OopDesc* operator->() const { \ | |
144 return (type##OopDesc*)obj(); \ | |
145 } \ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
146 }; |
0 | 147 |
148 DEF_OOP(instance); | |
149 DEF_OOP(array); | |
150 DEF_OOP(objArray); | |
151 DEF_OOP(typeArray); | |
152 | |
153 #endif // CHECK_UNHANDLED_OOPS | |
154 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
155 // The metadata hierarchy is separate from the oop hierarchy |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
156 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
157 // class MetaspaceObj |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
158 class ConstMethod; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
159 class ConstantPoolCache; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
160 class MethodData; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
161 // class Metadata |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
162 class Method; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
163 class ConstantPool; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
164 // class CHeapObj |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
165 class CompiledICHolder; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
166 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
167 |
0 | 168 // The klass hierarchy is separate from the oop hierarchy. |
169 | |
170 class Klass; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2376
diff
changeset
|
171 class InstanceKlass; |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
172 class InstanceMirrorKlass; |
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
173 class InstanceClassLoaderKlass; |
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
174 class InstanceRefKlass; |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6735
diff
changeset
|
175 class ArrayKlass; |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6735
diff
changeset
|
176 class ObjArrayKlass; |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6735
diff
changeset
|
177 class TypeArrayKlass; |
1972 | 178 |
179 #endif // SHARE_VM_OOPS_OOPSHIERARCHY_HPP |