author | ehelin |
Mon, 12 Aug 2013 17:37:02 +0200 | |
changeset 19979 | ebe1dbb6e1aa |
parent 19319 | 0ad35be0733a |
child 20282 | 7f9cbdf89af2 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
13952
diff
changeset
|
2 |
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3262
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3262
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3262
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 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 |
||
1 | 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 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
35 |
typedef juint narrowOop; // Offset instead of address for an oop within a java object |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
13952
diff
changeset
|
36 |
|
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
13952
diff
changeset
|
37 |
// If compressed klass pointers then use narrowKlass. |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
13952
diff
changeset
|
38 |
typedef juint narrowKlass; |
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
13952
diff
changeset
|
39 |
|
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
2105
diff
changeset
|
40 |
typedef void* OopOrNarrowOopStar; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
41 |
typedef class markOopDesc* markOop; |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
42 |
|
1 | 43 |
#ifndef CHECK_UNHANDLED_OOPS |
44 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
45 |
typedef class oopDesc* oop; |
1 | 46 |
typedef class instanceOopDesc* instanceOop; |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
47 |
typedef class arrayOopDesc* arrayOop; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
48 |
typedef class objArrayOopDesc* objArrayOop; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
49 |
typedef class typeArrayOopDesc* typeArrayOop; |
1 | 50 |
|
51 |
#else |
|
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 |
class PromotedObject; |
|
69 |
||
70 |
||
71 |
class oop { |
|
72 |
oopDesc* _o; |
|
73 |
||
74 |
void register_oop(); |
|
75 |
void unregister_oop(); |
|
76 |
||
77 |
// friend class markOop; |
|
78 |
public: |
|
79 |
void set_obj(const void* p) { |
|
80 |
raw_set_obj(p); |
|
81 |
if (CheckUnhandledOops) register_oop(); |
|
82 |
} |
|
83 |
void raw_set_obj(const void* p) { _o = (oopDesc*)p; } |
|
84 |
||
85 |
oop() { set_obj(NULL); } |
|
86 |
oop(const volatile oop& o) { set_obj(o.obj()); } |
|
87 |
oop(const void* p) { set_obj(p); } |
|
88 |
oop(intptr_t i) { set_obj((void *)i); } |
|
89 |
#ifdef _LP64 |
|
90 |
oop(int i) { set_obj((void *)i); } |
|
91 |
#endif |
|
92 |
~oop() { |
|
93 |
if (CheckUnhandledOops) unregister_oop(); |
|
94 |
} |
|
95 |
||
96 |
oopDesc* obj() const volatile { return _o; } |
|
97 |
||
98 |
// General access |
|
99 |
oopDesc* operator->() const { return obj(); } |
|
100 |
bool operator==(const oop o) const { return obj() == o.obj(); } |
|
101 |
bool operator==(void *p) const { return obj() == p; } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
102 |
bool operator!=(const volatile oop o) const { return obj() != o.obj(); } |
1 | 103 |
bool operator!=(void *p) const { return obj() != p; } |
104 |
bool operator==(intptr_t p) const { return obj() == (oopDesc*)p; } |
|
105 |
bool operator!=(intptr_t p) const { return obj() != (oopDesc*)p; } |
|
106 |
||
107 |
bool operator<(oop o) const { return obj() < o.obj(); } |
|
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!() const { return !obj(); } |
|
112 |
||
113 |
// Cast |
|
114 |
operator void* () const { return (void *)obj(); } |
|
115 |
operator HeapWord* () const { return (HeapWord*)obj(); } |
|
116 |
operator oopDesc* () const { return obj(); } |
|
117 |
operator intptr_t* () const { return (intptr_t*)obj(); } |
|
118 |
operator PromotedObject* () const { return (PromotedObject*)obj(); } |
|
119 |
operator markOop () const { return markOop(obj()); } |
|
120 |
||
121 |
operator address () const { return (address)obj(); } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
122 |
operator intptr_t () const volatile { return (intptr_t)obj(); } |
1 | 123 |
|
124 |
// from javaCalls.cpp |
|
125 |
operator jobject () const { return (jobject)obj(); } |
|
126 |
// from javaClasses.cpp |
|
127 |
operator JavaThread* () const { return (JavaThread*)obj(); } |
|
1889
24b003a6fe46
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
670
diff
changeset
|
128 |
|
24b003a6fe46
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
670
diff
changeset
|
129 |
#ifndef _LP64 |
1 | 130 |
// from jvm.cpp |
131 |
operator jlong* () const { return (jlong*)obj(); } |
|
1889
24b003a6fe46
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
670
diff
changeset
|
132 |
#endif |
1 | 133 |
|
134 |
// from parNewGeneration and other things that want to get to the end of |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13738
diff
changeset
|
135 |
// an oop for stuff (like ObjArrayKlass.cpp) |
1 | 136 |
operator oop* () const { return (oop *)obj(); } |
137 |
}; |
|
138 |
||
139 |
#define DEF_OOP(type) \ |
|
140 |
class type##OopDesc; \ |
|
141 |
class type##Oop : public oop { \ |
|
142 |
public: \ |
|
143 |
type##Oop() : oop() {} \ |
|
144 |
type##Oop(const volatile oop& o) : oop(o) {} \ |
|
145 |
type##Oop(const void* p) : oop(p) {} \ |
|
146 |
operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \ |
|
147 |
type##OopDesc* operator->() const { \ |
|
148 |
return (type##OopDesc*)obj(); \ |
|
149 |
} \ |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
150 |
}; |
1 | 151 |
|
152 |
DEF_OOP(instance); |
|
153 |
DEF_OOP(array); |
|
154 |
DEF_OOP(objArray); |
|
155 |
DEF_OOP(typeArray); |
|
156 |
||
157 |
#endif // CHECK_UNHANDLED_OOPS |
|
158 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
159 |
// The metadata hierarchy is separate from the oop hierarchy |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
160 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
161 |
// class MetaspaceObj |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
162 |
class ConstMethod; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
163 |
class ConstantPoolCache; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
164 |
class MethodData; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
165 |
// class Metadata |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
166 |
class Method; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
167 |
class ConstantPool; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
168 |
// class CHeapObj |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
169 |
class CompiledICHolder; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
170 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
171 |
|
1 | 172 |
// The klass hierarchy is separate from the oop hierarchy. |
173 |
||
174 |
class Klass; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8725
diff
changeset
|
175 |
class InstanceKlass; |
13738
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
176 |
class InstanceMirrorKlass; |
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
177 |
class InstanceClassLoaderKlass; |
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
178 |
class InstanceRefKlass; |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13738
diff
changeset
|
179 |
class ArrayKlass; |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13738
diff
changeset
|
180 |
class ObjArrayKlass; |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13738
diff
changeset
|
181 |
class TypeArrayKlass; |
7397 | 182 |
|
183 |
#endif // SHARE_VM_OOPS_OOPSHIERARCHY_HPP |