Mercurial > hg > truffle
annotate src/share/vm/oops/oopsHierarchy.hpp @ 2137:ffd725ff6943
Merge
author | johnc |
---|---|
date | Thu, 13 Jan 2011 17:19:21 -0800 |
parents | f95d63e2154a |
children | 3582bf76420e |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 1997, 2010, 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 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
36 typedef class klassOopDesc* wideKlassOop; // to keep SA happy and unhandled oop |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
37 // detector happy. |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
579
diff
changeset
|
38 typedef void* OopOrNarrowOopStar; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
39 |
0 | 40 #ifndef CHECK_UNHANDLED_OOPS |
41 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
42 typedef class oopDesc* oop; |
0 | 43 typedef class instanceOopDesc* instanceOop; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
44 typedef class methodOopDesc* methodOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
45 typedef class constMethodOopDesc* constMethodOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
46 typedef class methodDataOopDesc* methodDataOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
47 typedef class arrayOopDesc* arrayOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
48 typedef class objArrayOopDesc* objArrayOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
49 typedef class typeArrayOopDesc* typeArrayOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
50 typedef class constantPoolOopDesc* constantPoolOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
51 typedef class constantPoolCacheOopDesc* constantPoolCacheOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
52 typedef class symbolOopDesc* symbolOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
53 typedef class klassOopDesc* klassOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
54 typedef class markOopDesc* markOop; |
0 | 55 typedef class compiledICHolderOopDesc* compiledICHolderOop; |
56 | |
57 #else | |
58 | |
59 | |
60 // When CHECK_UNHANDLED_OOPS is defined, an "oop" is a class with a | |
61 // carefully chosen set of constructors and conversion operators to go | |
62 // to and from the underlying oopDesc pointer type. | |
63 // | |
64 // Because oop and its subclasses <type>Oop are class types, arbitrary | |
65 // conversions are not accepted by the compiler, and you may get a message | |
66 // about overloading ambiguity (between long and int is common when converting | |
67 // from a constant in 64 bit mode), or unable to convert from type to 'oop'. | |
68 // Applying a cast to one of these conversion operators first will get to the | |
69 // underlying oopDesc* type if appropriate. | |
70 // Converting NULL to oop to Handle implicit is no longer accepted by the | |
71 // compiler because there are too many steps in the conversion. Use Handle() | |
72 // instead, which generates less code anyway. | |
73 | |
74 class Thread; | |
75 typedef class markOopDesc* markOop; | |
76 class PromotedObject; | |
77 | |
78 | |
79 class oop { | |
80 oopDesc* _o; | |
81 | |
82 void register_oop(); | |
83 void unregister_oop(); | |
84 | |
85 // friend class markOop; | |
86 public: | |
87 void set_obj(const void* p) { | |
88 raw_set_obj(p); | |
89 if (CheckUnhandledOops) register_oop(); | |
90 } | |
91 void raw_set_obj(const void* p) { _o = (oopDesc*)p; } | |
92 | |
93 oop() { set_obj(NULL); } | |
94 oop(const volatile oop& o) { set_obj(o.obj()); } | |
95 oop(const void* p) { set_obj(p); } | |
96 oop(intptr_t i) { set_obj((void *)i); } | |
97 #ifdef _LP64 | |
98 oop(int i) { set_obj((void *)i); } | |
99 #endif | |
100 ~oop() { | |
101 if (CheckUnhandledOops) unregister_oop(); | |
102 } | |
103 | |
104 oopDesc* obj() const volatile { return _o; } | |
105 | |
106 // General access | |
107 oopDesc* operator->() const { return obj(); } | |
108 bool operator==(const oop o) const { return obj() == o.obj(); } | |
109 bool operator==(void *p) const { return obj() == p; } | |
110 bool operator!=(const oop o) const { return obj() != o.obj(); } | |
111 bool operator!=(void *p) const { return obj() != p; } | |
112 bool operator==(intptr_t p) const { return obj() == (oopDesc*)p; } | |
113 bool operator!=(intptr_t p) const { return obj() != (oopDesc*)p; } | |
114 | |
115 bool operator<(oop o) const { return obj() < o.obj(); } | |
116 bool operator>(oop o) const { return obj() > o.obj(); } | |
117 bool operator<=(oop o) const { return obj() <= o.obj(); } | |
118 bool operator>=(oop o) const { return obj() >= o.obj(); } | |
119 bool operator!() const { return !obj(); } | |
120 | |
121 // Cast | |
122 operator void* () const { return (void *)obj(); } | |
123 operator HeapWord* () const { return (HeapWord*)obj(); } | |
124 operator oopDesc* () const { return obj(); } | |
125 operator intptr_t* () const { return (intptr_t*)obj(); } | |
126 operator PromotedObject* () const { return (PromotedObject*)obj(); } | |
127 operator markOop () const { return markOop(obj()); } | |
128 | |
129 operator address () const { return (address)obj(); } | |
130 operator intptr_t () const { return (intptr_t)obj(); } | |
131 | |
132 // from javaCalls.cpp | |
133 operator jobject () const { return (jobject)obj(); } | |
134 // from javaClasses.cpp | |
135 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
|
136 |
2328d1d3f8cf
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
196
diff
changeset
|
137 #ifndef _LP64 |
0 | 138 // from jvm.cpp |
139 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
|
140 #endif |
0 | 141 |
142 // from parNewGeneration and other things that want to get to the end of | |
143 // an oop for stuff (like constMethodKlass.cpp, objArrayKlass.cpp) | |
144 operator oop* () const { return (oop *)obj(); } | |
145 }; | |
146 | |
147 #define DEF_OOP(type) \ | |
148 class type##OopDesc; \ | |
149 class type##Oop : public oop { \ | |
150 public: \ | |
151 type##Oop() : oop() {} \ | |
152 type##Oop(const volatile oop& o) : oop(o) {} \ | |
153 type##Oop(const void* p) : oop(p) {} \ | |
154 operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \ | |
155 type##OopDesc* operator->() const { \ | |
156 return (type##OopDesc*)obj(); \ | |
157 } \ | |
158 }; \ | |
159 | |
160 DEF_OOP(instance); | |
161 DEF_OOP(method); | |
162 DEF_OOP(methodData); | |
163 DEF_OOP(array); | |
164 DEF_OOP(constMethod); | |
165 DEF_OOP(constantPool); | |
166 DEF_OOP(constantPoolCache); | |
167 DEF_OOP(objArray); | |
168 DEF_OOP(typeArray); | |
169 DEF_OOP(symbol); | |
170 DEF_OOP(klass); | |
171 DEF_OOP(compiledICHolder); | |
172 | |
173 #endif // CHECK_UNHANDLED_OOPS | |
174 | |
175 // The klass hierarchy is separate from the oop hierarchy. | |
176 | |
177 class Klass; | |
178 class instanceKlass; | |
179 class instanceRefKlass; | |
180 class methodKlass; | |
181 class constMethodKlass; | |
182 class methodDataKlass; | |
183 class klassKlass; | |
184 class instanceKlassKlass; | |
185 class arrayKlassKlass; | |
186 class objArrayKlassKlass; | |
187 class typeArrayKlassKlass; | |
188 class arrayKlass; | |
189 class objArrayKlass; | |
190 class typeArrayKlass; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
191 class constantPoolKlass; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
192 class constantPoolCacheKlass; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
193 class symbolKlass; |
0 | 194 class compiledICHolderKlass; |
1972 | 195 |
196 #endif // SHARE_VM_OOPS_OOPSHIERARCHY_HPP |