Mercurial > hg > graal-jvmci-8
annotate src/share/vm/oops/cpCacheKlass.cpp @ 113:ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author | coleenp |
---|---|
date | Sun, 13 Apr 2008 17:43:42 -0400 |
parents | a61af66fc99e |
children | d1605aabd0a1 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. | |
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 #include "incls/_precompiled.incl" | |
26 #include "incls/_cpCacheKlass.cpp.incl" | |
27 | |
28 | |
29 int constantPoolCacheKlass::oop_size(oop obj) const { | |
30 assert(obj->is_constantPoolCache(), "must be constantPool"); | |
31 return constantPoolCacheOop(obj)->object_size(); | |
32 } | |
33 | |
34 | |
35 constantPoolCacheOop constantPoolCacheKlass::allocate(int length, TRAPS) { | |
36 // allocate memory | |
37 int size = constantPoolCacheOopDesc::object_size(length); | |
38 KlassHandle klass (THREAD, as_klassOop()); | |
39 constantPoolCacheOop cache = (constantPoolCacheOop) | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
40 CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
41 cache->set_length(length); |
0 | 42 cache->set_constant_pool(NULL); |
43 return cache; | |
44 } | |
45 | |
46 klassOop constantPoolCacheKlass::create_klass(TRAPS) { | |
47 constantPoolCacheKlass o; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
48 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj()); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
49 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
50 // Make sure size calculation is right |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
51 assert(k()->size() == align_object_size(header_size()), "wrong size for object"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
52 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror |
0 | 53 return k(); |
54 } | |
55 | |
56 | |
57 void constantPoolCacheKlass::oop_follow_contents(oop obj) { | |
58 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
59 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
60 // Performance tweak: We skip iterating over the klass pointer since we | |
61 // know that Universe::constantPoolCacheKlassObj never moves. | |
62 // gc of constant pool cache instance variables | |
63 MarkSweep::mark_and_push((oop*)cache->constant_pool_addr()); | |
64 // gc of constant pool cache entries | |
65 int i = cache->length(); | |
66 while (i-- > 0) cache->entry_at(i)->follow_contents(); | |
67 } | |
68 | |
69 #ifndef SERIALGC | |
70 void constantPoolCacheKlass::oop_follow_contents(ParCompactionManager* cm, | |
71 oop obj) { | |
72 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
73 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
74 // Performance tweak: We skip iterating over the klass pointer since we | |
75 // know that Universe::constantPoolCacheKlassObj never moves. | |
76 // gc of constant pool cache instance variables | |
77 PSParallelCompact::mark_and_push(cm, (oop*)cache->constant_pool_addr()); | |
78 // gc of constant pool cache entries | |
79 int i = cache->length(); | |
80 while (i-- > 0) cache->entry_at(i)->follow_contents(cm); | |
81 } | |
82 #endif // SERIALGC | |
83 | |
84 | |
85 int constantPoolCacheKlass::oop_oop_iterate(oop obj, OopClosure* blk) { | |
86 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
87 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
88 // Get size before changing pointers. | |
89 // Don't call size() or oop_size() since that is a virtual call. | |
90 int size = cache->object_size(); | |
91 // Performance tweak: We skip iterating over the klass pointer since we | |
92 // know that Universe::constantPoolCacheKlassObj never moves. | |
93 // iteration over constant pool cache instance variables | |
94 blk->do_oop((oop*)cache->constant_pool_addr()); | |
95 // iteration over constant pool cache entries | |
96 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->oop_iterate(blk); | |
97 return size; | |
98 } | |
99 | |
100 | |
101 int constantPoolCacheKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { | |
102 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
103 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
104 // Get size before changing pointers. | |
105 // Don't call size() or oop_size() since that is a virtual call. | |
106 int size = cache->object_size(); | |
107 // Performance tweak: We skip iterating over the klass pointer since we | |
108 // know that Universe::constantPoolCacheKlassObj never moves. | |
109 // iteration over constant pool cache instance variables | |
110 oop* addr = (oop*)cache->constant_pool_addr(); | |
111 if (mr.contains(addr)) blk->do_oop(addr); | |
112 // iteration over constant pool cache entries | |
113 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->oop_iterate_m(blk, mr); | |
114 return size; | |
115 } | |
116 | |
117 | |
118 int constantPoolCacheKlass::oop_adjust_pointers(oop obj) { | |
119 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
120 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
121 // Get size before changing pointers. | |
122 // Don't call size() or oop_size() since that is a virtual call. | |
123 int size = cache->object_size(); | |
124 // Performance tweak: We skip iterating over the klass pointer since we | |
125 // know that Universe::constantPoolCacheKlassObj never moves. | |
126 // Iteration over constant pool cache instance variables | |
127 MarkSweep::adjust_pointer((oop*)cache->constant_pool_addr()); | |
128 // iteration over constant pool cache entries | |
129 for (int i = 0; i < cache->length(); i++) | |
130 cache->entry_at(i)->adjust_pointers(); | |
131 return size; | |
132 } | |
133 | |
134 #ifndef SERIALGC | |
135 void constantPoolCacheKlass::oop_copy_contents(PSPromotionManager* pm, | |
136 oop obj) { | |
137 assert(obj->is_constantPoolCache(), "should be constant pool"); | |
138 } | |
139 | |
140 void constantPoolCacheKlass::oop_push_contents(PSPromotionManager* pm, | |
141 oop obj) { | |
142 assert(obj->is_constantPoolCache(), "should be constant pool"); | |
143 } | |
144 | |
145 int | |
146 constantPoolCacheKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { | |
147 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
148 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
149 | |
150 // Iteration over constant pool cache instance variables | |
151 PSParallelCompact::adjust_pointer((oop*)cache->constant_pool_addr()); | |
152 | |
153 // iteration over constant pool cache entries | |
154 for (int i = 0; i < cache->length(); ++i) { | |
155 cache->entry_at(i)->update_pointers(); | |
156 } | |
157 | |
158 return cache->object_size(); | |
159 } | |
160 | |
161 int | |
162 constantPoolCacheKlass::oop_update_pointers(ParCompactionManager* cm, oop obj, | |
163 HeapWord* beg_addr, | |
164 HeapWord* end_addr) { | |
165 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
166 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
167 | |
168 // Iteration over constant pool cache instance variables | |
169 oop* p; | |
170 p = (oop*)cache->constant_pool_addr(); | |
171 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); | |
172 | |
173 // Iteration over constant pool cache entries | |
174 for (int i = 0; i < cache->length(); ++i) { | |
175 cache->entry_at(i)->update_pointers(beg_addr, end_addr); | |
176 } | |
177 return cache->object_size(); | |
178 } | |
179 #endif // SERIALGC | |
180 | |
181 #ifndef PRODUCT | |
182 | |
183 void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) { | |
184 assert(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
185 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
186 // super print | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
187 Klass::oop_print_on(obj, st); |
0 | 188 // print constant pool cache entries |
189 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->print(st, i); | |
190 } | |
191 | |
192 #endif | |
193 | |
194 void constantPoolCacheKlass::oop_verify_on(oop obj, outputStream* st) { | |
195 guarantee(obj->is_constantPoolCache(), "obj must be constant pool cache"); | |
196 constantPoolCacheOop cache = (constantPoolCacheOop)obj; | |
197 // super verify | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
198 Klass::oop_verify_on(obj, st); |
0 | 199 // print constant pool cache entries |
200 for (int i = 0; i < cache->length(); i++) cache->entry_at(i)->verify(st); | |
201 } | |
202 | |
203 | |
204 const char* constantPoolCacheKlass::internal_name() const { | |
205 return "{constant pool cache}"; | |
206 } |