Mercurial > hg > graal-compiler
annotate src/share/vm/oops/oopsHierarchy.hpp @ 775:93c14e5562c4
6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
Summary: These methods can be instrinsified by using bit scan, bit test, and population count instructions.
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Wed, 06 May 2009 00:27:52 -0700 |
parents | 0fbdb4381b99 |
children | df6caf649ff7 |
rev | line source |
---|---|
0 | 1 /* |
579 | 2 * Copyright 1997-2009 Sun Microsystems, Inc. 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 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 // OBJECT hierarchy | |
26 // This hierarchy is a representation hierarchy, i.e. if A is a superclass | |
27 // of B, A's representation is a prefix of B's representation. | |
28 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
29 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
|
30 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
|
31 // detector happy. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
32 |
0 | 33 #ifndef CHECK_UNHANDLED_OOPS |
34 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
35 typedef class oopDesc* oop; |
0 | 36 typedef class instanceOopDesc* instanceOop; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
37 typedef class methodOopDesc* methodOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
38 typedef class constMethodOopDesc* constMethodOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
39 typedef class methodDataOopDesc* methodDataOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
40 typedef class arrayOopDesc* arrayOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
41 typedef class objArrayOopDesc* objArrayOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
42 typedef class typeArrayOopDesc* typeArrayOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
43 typedef class constantPoolOopDesc* constantPoolOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
44 typedef class constantPoolCacheOopDesc* constantPoolCacheOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
45 typedef class symbolOopDesc* symbolOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
46 typedef class klassOopDesc* klassOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
47 typedef class markOopDesc* markOop; |
0 | 48 typedef class compiledICHolderOopDesc* compiledICHolderOop; |
49 | |
50 #else | |
51 | |
52 | |
53 // When CHECK_UNHANDLED_OOPS is defined, an "oop" is a class with a | |
54 // carefully chosen set of constructors and conversion operators to go | |
55 // to and from the underlying oopDesc pointer type. | |
56 // | |
57 // Because oop and its subclasses <type>Oop are class types, arbitrary | |
58 // conversions are not accepted by the compiler, and you may get a message | |
59 // about overloading ambiguity (between long and int is common when converting | |
60 // from a constant in 64 bit mode), or unable to convert from type to 'oop'. | |
61 // Applying a cast to one of these conversion operators first will get to the | |
62 // underlying oopDesc* type if appropriate. | |
63 // Converting NULL to oop to Handle implicit is no longer accepted by the | |
64 // compiler because there are too many steps in the conversion. Use Handle() | |
65 // instead, which generates less code anyway. | |
66 | |
67 class Thread; | |
68 typedef class markOopDesc* markOop; | |
69 class PromotedObject; | |
70 | |
71 | |
72 class oop { | |
73 oopDesc* _o; | |
74 | |
75 void register_oop(); | |
76 void unregister_oop(); | |
77 | |
78 // friend class markOop; | |
79 public: | |
80 void set_obj(const void* p) { | |
81 raw_set_obj(p); | |
82 if (CheckUnhandledOops) register_oop(); | |
83 } | |
84 void raw_set_obj(const void* p) { _o = (oopDesc*)p; } | |
85 | |
86 oop() { set_obj(NULL); } | |
87 oop(const volatile oop& o) { set_obj(o.obj()); } | |
88 oop(const void* p) { set_obj(p); } | |
89 oop(intptr_t i) { set_obj((void *)i); } | |
90 #ifdef _LP64 | |
91 oop(int i) { set_obj((void *)i); } | |
92 #endif | |
93 ~oop() { | |
94 if (CheckUnhandledOops) unregister_oop(); | |
95 } | |
96 | |
97 oopDesc* obj() const volatile { return _o; } | |
98 | |
99 // General access | |
100 oopDesc* operator->() const { return obj(); } | |
101 bool operator==(const oop o) const { return obj() == o.obj(); } | |
102 bool operator==(void *p) const { return obj() == p; } | |
103 bool operator!=(const oop o) const { return obj() != o.obj(); } | |
104 bool operator!=(void *p) const { return obj() != p; } | |
105 bool operator==(intptr_t p) const { return obj() == (oopDesc*)p; } | |
106 bool operator!=(intptr_t p) const { return obj() != (oopDesc*)p; } | |
107 | |
108 bool operator<(oop o) const { return obj() < o.obj(); } | |
109 bool operator>(oop o) const { return obj() > o.obj(); } | |
110 bool operator<=(oop o) const { return obj() <= o.obj(); } | |
111 bool operator>=(oop o) const { return obj() >= o.obj(); } | |
112 bool operator!() const { return !obj(); } | |
113 | |
114 // Cast | |
115 operator void* () const { return (void *)obj(); } | |
116 operator HeapWord* () const { return (HeapWord*)obj(); } | |
117 operator oopDesc* () const { return obj(); } | |
118 operator intptr_t* () const { return (intptr_t*)obj(); } | |
119 operator PromotedObject* () const { return (PromotedObject*)obj(); } | |
120 operator markOop () const { return markOop(obj()); } | |
121 | |
122 operator address () const { return (address)obj(); } | |
123 operator intptr_t () const { return (intptr_t)obj(); } | |
124 | |
125 // from javaCalls.cpp | |
126 operator jobject () const { return (jobject)obj(); } | |
127 // from javaClasses.cpp | |
128 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
|
129 |
2328d1d3f8cf
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
196
diff
changeset
|
130 #ifndef _LP64 |
0 | 131 // from jvm.cpp |
132 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
|
133 #endif |
0 | 134 |
135 // from parNewGeneration and other things that want to get to the end of | |
136 // an oop for stuff (like constMethodKlass.cpp, objArrayKlass.cpp) | |
137 operator oop* () const { return (oop *)obj(); } | |
138 }; | |
139 | |
140 #define DEF_OOP(type) \ | |
141 class type##OopDesc; \ | |
142 class type##Oop : public oop { \ | |
143 public: \ | |
144 type##Oop() : oop() {} \ | |
145 type##Oop(const volatile oop& o) : oop(o) {} \ | |
146 type##Oop(const void* p) : oop(p) {} \ | |
147 operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \ | |
148 type##OopDesc* operator->() const { \ | |
149 return (type##OopDesc*)obj(); \ | |
150 } \ | |
151 }; \ | |
152 | |
153 DEF_OOP(instance); | |
154 DEF_OOP(method); | |
155 DEF_OOP(methodData); | |
156 DEF_OOP(array); | |
157 DEF_OOP(constMethod); | |
158 DEF_OOP(constantPool); | |
159 DEF_OOP(constantPoolCache); | |
160 DEF_OOP(objArray); | |
161 DEF_OOP(typeArray); | |
162 DEF_OOP(symbol); | |
163 DEF_OOP(klass); | |
164 DEF_OOP(compiledICHolder); | |
165 | |
166 #endif // CHECK_UNHANDLED_OOPS | |
167 | |
168 // The klass hierarchy is separate from the oop hierarchy. | |
169 | |
170 class Klass; | |
171 class instanceKlass; | |
172 class instanceRefKlass; | |
173 class methodKlass; | |
174 class constMethodKlass; | |
175 class methodDataKlass; | |
176 class klassKlass; | |
177 class instanceKlassKlass; | |
178 class arrayKlassKlass; | |
179 class objArrayKlassKlass; | |
180 class typeArrayKlassKlass; | |
181 class arrayKlass; | |
182 class objArrayKlass; | |
183 class typeArrayKlass; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
184 class constantPoolKlass; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
185 class constantPoolCacheKlass; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
186 class symbolKlass; |
0 | 187 class compiledICHolderKlass; |