Mercurial > hg > graal-compiler
annotate src/share/vm/oops/objArrayKlass.cpp @ 1257:7b4415a18c8a
Merge
author | kvn |
---|---|
date | Fri, 12 Feb 2010 15:27:36 -0800 |
parents | 4e6abf09f540 |
children | 2a1472c30599 |
rev | line source |
---|---|
0 | 1 /* |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
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 # include "incls/_precompiled.incl" | |
26 # include "incls/_objArrayKlass.cpp.incl" | |
27 | |
28 int objArrayKlass::oop_size(oop obj) const { | |
29 assert(obj->is_objArray(), "must be object array"); | |
30 return objArrayOop(obj)->object_size(); | |
31 } | |
32 | |
33 objArrayOop objArrayKlass::allocate(int length, TRAPS) { | |
34 if (length >= 0) { | |
35 if (length <= arrayOopDesc::max_array_length(T_OBJECT)) { | |
36 int size = objArrayOopDesc::object_size(length); | |
37 KlassHandle h_k(THREAD, as_klassOop()); | |
38 objArrayOop a = (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, CHECK_NULL); | |
39 assert(a->is_parsable(), "Can't publish unless parsable"); | |
40 return a; | |
41 } else { | |
876
1413494da700
6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit
martin
parents:
665
diff
changeset
|
42 report_java_out_of_memory("Requested array size exceeds VM limit"); |
0 | 43 THROW_OOP_0(Universe::out_of_memory_error_array_size()); |
44 } | |
45 } else { | |
46 THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); | |
47 } | |
48 } | |
49 | |
50 static int multi_alloc_counter = 0; | |
51 | |
52 oop objArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) { | |
53 int length = *sizes; | |
54 // Call to lower_dimension uses this pointer, so most be called before a | |
55 // possible GC | |
56 KlassHandle h_lower_dimension(THREAD, lower_dimension()); | |
57 // If length < 0 allocate will throw an exception. | |
58 objArrayOop array = allocate(length, CHECK_NULL); | |
59 assert(array->is_parsable(), "Don't handlize unless parsable"); | |
60 objArrayHandle h_array (THREAD, array); | |
61 if (rank > 1) { | |
62 if (length != 0) { | |
63 for (int index = 0; index < length; index++) { | |
64 arrayKlass* ak = arrayKlass::cast(h_lower_dimension()); | |
65 oop sub_array = ak->multi_allocate(rank-1, &sizes[1], CHECK_NULL); | |
66 assert(sub_array->is_parsable(), "Don't publish until parsable"); | |
67 h_array->obj_at_put(index, sub_array); | |
68 } | |
69 } else { | |
70 // Since this array dimension has zero length, nothing will be | |
71 // allocated, however the lower dimension values must be checked | |
72 // for illegal values. | |
73 for (int i = 0; i < rank - 1; ++i) { | |
74 sizes += 1; | |
75 if (*sizes < 0) { | |
76 THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); | |
77 } | |
78 } | |
79 } | |
80 } | |
81 return h_array(); | |
82 } | |
83 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
84 // Either oop or narrowOop depending on UseCompressedOops. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
85 template <class T> void objArrayKlass::do_copy(arrayOop s, T* src, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
86 arrayOop d, T* dst, int length, TRAPS) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
87 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
88 BarrierSet* bs = Universe::heap()->barrier_set(); |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
89 // For performance reasons, we assume we are that the write barrier we |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
90 // are using has optimized modes for arrays of references. At least one |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
91 // of the asserts below will fail if this is not the case. |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
92 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
93 assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well."); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
94 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
95 if (s == d) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
96 // since source and destination are equal we do not need conversion checks. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
97 assert(length > 0, "sanity check"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
665
diff
changeset
|
98 bs->write_ref_array_pre(dst, length); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
99 Copy::conjoint_oops_atomic(src, dst, length); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
100 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
101 // We have to make sure all elements conform to the destination array |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
102 klassOop bound = objArrayKlass::cast(d->klass())->element_klass(); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
103 klassOop stype = objArrayKlass::cast(s->klass())->element_klass(); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
104 if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
105 // elements are guaranteed to be subtypes, so no check necessary |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
665
diff
changeset
|
106 bs->write_ref_array_pre(dst, length); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
107 Copy::conjoint_oops_atomic(src, dst, length); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
108 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
109 // slow case: need individual subtype checks |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
110 // note: don't use obj_at_put below because it includes a redundant store check |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
111 T* from = src; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
112 T* end = from + length; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
113 for (T* p = dst; from < end; from++, p++) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
114 // XXX this is going to be slow. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
115 T element = *from; |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
116 // even slower now |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
117 bool element_is_null = oopDesc::is_null(element); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
118 oop new_val = element_is_null ? oop(NULL) |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
119 : oopDesc::decode_heap_oop_not_null(element); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
120 if (element_is_null || |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
121 Klass::cast((new_val->klass()))->is_subtype_of(bound)) { |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
122 bs->write_ref_field_pre(p, new_val); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
123 *p = *from; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
124 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
125 // We must do a barrier to cover the partial copy. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
126 const size_t pd = pointer_delta(p, dst, (size_t)heapOopSize); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
127 // pointer delta is scaled to number of elements (length field in |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
128 // objArrayOop) which we assume is 32 bit. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
129 assert(pd == (size_t)(int)pd, "length field overflow"); |
1091
6aa7255741f3
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
879
diff
changeset
|
130 bs->write_ref_array((HeapWord*)dst, pd); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
131 THROW(vmSymbols::java_lang_ArrayStoreException()); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
132 return; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
133 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
134 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
135 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
136 } |
1091
6aa7255741f3
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
879
diff
changeset
|
137 bs->write_ref_array((HeapWord*)dst, length); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
138 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
139 |
0 | 140 void objArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, |
141 int dst_pos, int length, TRAPS) { | |
142 assert(s->is_objArray(), "must be obj array"); | |
143 | |
144 if (!d->is_objArray()) { | |
145 THROW(vmSymbols::java_lang_ArrayStoreException()); | |
146 } | |
147 | |
148 // Check is all offsets and lengths are non negative | |
149 if (src_pos < 0 || dst_pos < 0 || length < 0) { | |
150 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); | |
151 } | |
152 // Check if the ranges are valid | |
153 if ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) | |
154 || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) { | |
155 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); | |
156 } | |
157 | |
158 // Special case. Boundary cases must be checked first | |
159 // This allows the following call: copy_array(s, s.length(), d.length(), 0). | |
160 // This is correct, since the position is supposed to be an 'in between point', i.e., s.length(), | |
161 // points to the right of the last element. | |
162 if (length==0) { | |
163 return; | |
164 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
165 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
166 narrowOop* const src = objArrayOop(s)->obj_at_addr<narrowOop>(src_pos); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
167 narrowOop* const dst = objArrayOop(d)->obj_at_addr<narrowOop>(dst_pos); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
168 do_copy<narrowOop>(s, src, d, dst, length, CHECK); |
0 | 169 } else { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
170 oop* const src = objArrayOop(s)->obj_at_addr<oop>(src_pos); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
171 oop* const dst = objArrayOop(d)->obj_at_addr<oop>(dst_pos); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
172 do_copy<oop> (s, src, d, dst, length, CHECK); |
0 | 173 } |
174 } | |
175 | |
176 | |
177 klassOop objArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) { | |
178 objArrayKlassHandle h_this(THREAD, as_klassOop()); | |
179 return array_klass_impl(h_this, or_null, n, CHECK_NULL); | |
180 } | |
181 | |
182 | |
183 klassOop objArrayKlass::array_klass_impl(objArrayKlassHandle this_oop, bool or_null, int n, TRAPS) { | |
184 | |
185 assert(this_oop->dimension() <= n, "check order of chain"); | |
186 int dimension = this_oop->dimension(); | |
187 if (dimension == n) | |
188 return this_oop(); | |
189 | |
190 objArrayKlassHandle ak (THREAD, this_oop->higher_dimension()); | |
191 if (ak.is_null()) { | |
192 if (or_null) return NULL; | |
193 | |
194 ResourceMark rm; | |
195 JavaThread *jt = (JavaThread *)THREAD; | |
196 { | |
197 MutexLocker mc(Compile_lock, THREAD); // for vtables | |
198 // Ensure atomic creation of higher dimensions | |
199 MutexLocker mu(MultiArray_lock, THREAD); | |
200 | |
201 // Check if another thread beat us | |
202 ak = objArrayKlassHandle(THREAD, this_oop->higher_dimension()); | |
203 if( ak.is_null() ) { | |
204 | |
205 // Create multi-dim klass object and link them together | |
206 klassOop new_klass = | |
207 objArrayKlassKlass::cast(Universe::objArrayKlassKlassObj())-> | |
208 allocate_objArray_klass(dimension + 1, this_oop, CHECK_NULL); | |
209 ak = objArrayKlassHandle(THREAD, new_klass); | |
210 this_oop->set_higher_dimension(ak()); | |
211 ak->set_lower_dimension(this_oop()); | |
212 assert(ak->oop_is_objArray(), "incorrect initialization of objArrayKlass"); | |
213 } | |
214 } | |
215 } else { | |
216 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); | |
217 } | |
218 | |
219 if (or_null) { | |
220 return ak->array_klass_or_null(n); | |
221 } | |
222 return ak->array_klass(n, CHECK_NULL); | |
223 } | |
224 | |
225 klassOop objArrayKlass::array_klass_impl(bool or_null, TRAPS) { | |
226 return array_klass_impl(or_null, dimension() + 1, CHECK_NULL); | |
227 } | |
228 | |
229 bool objArrayKlass::can_be_primary_super_slow() const { | |
230 if (!bottom_klass()->klass_part()->can_be_primary_super()) | |
231 // array of interfaces | |
232 return false; | |
233 else | |
234 return Klass::can_be_primary_super_slow(); | |
235 } | |
236 | |
237 objArrayOop objArrayKlass::compute_secondary_supers(int num_extra_slots, TRAPS) { | |
238 // interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... }; | |
239 objArrayOop es = Klass::cast(element_klass())->secondary_supers(); | |
240 objArrayHandle elem_supers (THREAD, es); | |
241 int num_elem_supers = elem_supers.is_null() ? 0 : elem_supers->length(); | |
242 int num_secondaries = num_extra_slots + 2 + num_elem_supers; | |
243 if (num_secondaries == 2) { | |
244 // Must share this for correct bootstrapping! | |
245 return Universe::the_array_interfaces_array(); | |
246 } else { | |
247 objArrayOop sec_oop = oopFactory::new_system_objArray(num_secondaries, CHECK_NULL); | |
248 objArrayHandle secondaries(THREAD, sec_oop); | |
1142 | 249 secondaries->obj_at_put(num_extra_slots+0, SystemDictionary::Cloneable_klass()); |
250 secondaries->obj_at_put(num_extra_slots+1, SystemDictionary::Serializable_klass()); | |
0 | 251 for (int i = 0; i < num_elem_supers; i++) { |
252 klassOop elem_super = (klassOop) elem_supers->obj_at(i); | |
253 klassOop array_super = elem_super->klass_part()->array_klass_or_null(); | |
254 assert(array_super != NULL, "must already have been created"); | |
255 secondaries->obj_at_put(num_extra_slots+2+i, array_super); | |
256 } | |
257 return secondaries(); | |
258 } | |
259 } | |
260 | |
261 bool objArrayKlass::compute_is_subtype_of(klassOop k) { | |
262 if (!k->klass_part()->oop_is_objArray()) | |
263 return arrayKlass::compute_is_subtype_of(k); | |
264 | |
265 objArrayKlass* oak = objArrayKlass::cast(k); | |
266 return element_klass()->klass_part()->is_subtype_of(oak->element_klass()); | |
267 } | |
268 | |
269 void objArrayKlass::initialize(TRAPS) { | |
270 Klass::cast(bottom_klass())->initialize(THREAD); // dispatches to either instanceKlass or typeArrayKlass | |
271 } | |
272 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
273 #define ObjArrayKlass_SPECIALIZED_OOP_ITERATE(T, a, p, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
274 { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
275 T* p = (T*)(a)->base(); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
276 T* const end = p + (a)->length(); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
277 while (p < end) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
278 do_oop; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
279 p++; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
280 } \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
281 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
282 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
283 #define ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(T, a, p, low, high, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
284 { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
285 T* const l = (T*)(low); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
286 T* const h = (T*)(high); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
287 T* p = (T*)(a)->base(); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
288 T* end = p + (a)->length(); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
289 if (p < l) p = l; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
290 if (end > h) end = h; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
291 while (p < end) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
292 do_oop; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
293 ++p; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
294 } \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
295 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
296 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
297 #define ObjArrayKlass_OOP_ITERATE(a, p, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
298 if (UseCompressedOops) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
299 ObjArrayKlass_SPECIALIZED_OOP_ITERATE(narrowOop, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
300 a, p, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
301 } else { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
302 ObjArrayKlass_SPECIALIZED_OOP_ITERATE(oop, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
303 a, p, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
304 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
305 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
306 #define ObjArrayKlass_BOUNDED_OOP_ITERATE(a, p, low, high, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
307 if (UseCompressedOops) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
308 ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
309 a, p, low, high, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
310 } else { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
311 ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
312 a, p, low, high, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
313 } |
0 | 314 |
315 void objArrayKlass::oop_follow_contents(oop obj) { | |
316 assert (obj->is_array(), "obj must be array"); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
317 objArrayOop a = objArrayOop(obj); |
0 | 318 a->follow_header(); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
319 ObjArrayKlass_OOP_ITERATE( \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
320 a, p, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
321 /* we call mark_and_follow here to avoid excessive marking stack usage */ \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
322 MarkSweep::mark_and_follow(p)) |
0 | 323 } |
324 | |
325 #ifndef SERIALGC | |
326 void objArrayKlass::oop_follow_contents(ParCompactionManager* cm, | |
327 oop obj) { | |
328 assert (obj->is_array(), "obj must be array"); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
329 objArrayOop a = objArrayOop(obj); |
0 | 330 a->follow_header(cm); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
331 ObjArrayKlass_OOP_ITERATE( \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
332 a, p, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
333 /* we call mark_and_follow here to avoid excessive marking stack usage */ \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
334 PSParallelCompact::mark_and_follow(cm, p)) |
0 | 335 } |
336 #endif // SERIALGC | |
337 | |
338 #define ObjArrayKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ | |
339 \ | |
340 int objArrayKlass::oop_oop_iterate##nv_suffix(oop obj, \ | |
341 OopClosureType* closure) { \ | |
342 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \ | |
343 assert (obj->is_array(), "obj must be array"); \ | |
344 objArrayOop a = objArrayOop(obj); \ | |
345 /* Get size before changing pointers. */ \ | |
346 /* Don't call size() or oop_size() since that is a virtual call. */ \ | |
347 int size = a->object_size(); \ | |
348 if (closure->do_header()) { \ | |
349 a->oop_iterate_header(closure); \ | |
350 } \ | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
351 ObjArrayKlass_OOP_ITERATE(a, p, (closure)->do_oop##nv_suffix(p)) \ |
0 | 352 return size; \ |
353 } | |
354 | |
355 #define ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ | |
356 \ | |
357 int objArrayKlass::oop_oop_iterate##nv_suffix##_m(oop obj, \ | |
358 OopClosureType* closure, \ | |
359 MemRegion mr) { \ | |
360 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \ | |
361 assert(obj->is_array(), "obj must be array"); \ | |
362 objArrayOop a = objArrayOop(obj); \ | |
363 /* Get size before changing pointers. */ \ | |
364 /* Don't call size() or oop_size() since that is a virtual call */ \ | |
365 int size = a->object_size(); \ | |
366 if (closure->do_header()) { \ | |
367 a->oop_iterate_header(closure, mr); \ | |
368 } \ | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
369 ObjArrayKlass_BOUNDED_OOP_ITERATE( \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
370 a, p, mr.start(), mr.end(), (closure)->do_oop##nv_suffix(p)) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
371 return size; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
372 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
373 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
374 // Like oop_oop_iterate but only iterates over a specified range and only used |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
375 // for objArrayOops. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
376 #define ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r(OopClosureType, nv_suffix) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
377 \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
378 int objArrayKlass::oop_oop_iterate_range##nv_suffix(oop obj, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
379 OopClosureType* closure, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
380 int start, int end) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
381 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
382 assert(obj->is_array(), "obj must be array"); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
383 objArrayOop a = objArrayOop(obj); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
384 /* Get size before changing pointers. */ \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
385 /* Don't call size() or oop_size() since that is a virtual call */ \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
386 int size = a->object_size(); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
387 if (UseCompressedOops) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
388 HeapWord* low = start == 0 ? (HeapWord*)a : (HeapWord*)a->obj_at_addr<narrowOop>(start);\ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
389 /* this might be wierd if end needs to be aligned on HeapWord boundary */ \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
390 HeapWord* high = (HeapWord*)((narrowOop*)a->base() + end); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
391 MemRegion mr(low, high); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
392 if (closure->do_header()) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
393 a->oop_iterate_header(closure, mr); \ |
0 | 394 } \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
395 ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
396 a, p, low, high, (closure)->do_oop##nv_suffix(p)) \ |
0 | 397 } else { \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
398 HeapWord* low = start == 0 ? (HeapWord*)a : (HeapWord*)a->obj_at_addr<oop>(start); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
399 HeapWord* high = (HeapWord*)((oop*)a->base() + end); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
400 MemRegion mr(low, high); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
401 if (closure->do_header()) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
402 a->oop_iterate_header(closure, mr); \ |
0 | 403 } \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
404 ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
405 a, p, low, high, (closure)->do_oop##nv_suffix(p)) \ |
0 | 406 } \ |
407 return size; \ | |
408 } | |
409 | |
410 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DEFN) | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
411 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN) |
0 | 412 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m) |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
413 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m) |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
414 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r) |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
415 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r) |
0 | 416 |
417 int objArrayKlass::oop_adjust_pointers(oop obj) { | |
418 assert(obj->is_objArray(), "obj must be obj array"); | |
419 objArrayOop a = objArrayOop(obj); | |
420 // Get size before changing pointers. | |
421 // Don't call size() or oop_size() since that is a virtual call. | |
422 int size = a->object_size(); | |
423 a->adjust_header(); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
424 ObjArrayKlass_OOP_ITERATE(a, p, MarkSweep::adjust_pointer(p)) |
0 | 425 return size; |
426 } | |
427 | |
428 #ifndef SERIALGC | |
429 void objArrayKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) { | |
430 assert(!pm->depth_first(), "invariant"); | |
431 assert(obj->is_objArray(), "obj must be obj array"); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
432 ObjArrayKlass_OOP_ITERATE( \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
433 objArrayOop(obj), p, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
434 if (PSScavenge::should_scavenge(p)) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
435 pm->claim_or_forward_breadth(p); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
436 }) |
0 | 437 } |
438 | |
439 void objArrayKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { | |
440 assert(pm->depth_first(), "invariant"); | |
441 assert(obj->is_objArray(), "obj must be obj array"); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
442 ObjArrayKlass_OOP_ITERATE( \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
443 objArrayOop(obj), p, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
444 if (PSScavenge::should_scavenge(p)) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
445 pm->claim_or_forward_depth(p); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
446 }) |
0 | 447 } |
448 | |
449 int objArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { | |
450 assert (obj->is_objArray(), "obj must be obj array"); | |
451 objArrayOop a = objArrayOop(obj); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
452 ObjArrayKlass_OOP_ITERATE(a, p, PSParallelCompact::adjust_pointer(p)) |
0 | 453 return a->object_size(); |
454 } | |
455 | |
456 int objArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj, | |
457 HeapWord* beg_addr, HeapWord* end_addr) { | |
458 assert (obj->is_objArray(), "obj must be obj array"); | |
459 objArrayOop a = objArrayOop(obj); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
460 ObjArrayKlass_BOUNDED_OOP_ITERATE( \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
461 a, p, beg_addr, end_addr, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
462 PSParallelCompact::adjust_pointer(p)) |
0 | 463 return a->object_size(); |
464 } | |
465 #endif // SERIALGC | |
466 | |
467 // JVM support | |
468 | |
469 jint objArrayKlass::compute_modifier_flags(TRAPS) const { | |
470 // The modifier for an objectArray is the same as its element | |
471 if (element_klass() == NULL) { | |
472 assert(Universe::is_bootstrapping(), "partial objArray only at startup"); | |
473 return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; | |
474 } | |
398
443791f333a2
6700107: java/lang/Class/forName/TooManyDimensions.java crashes with SIGSEGV in c2 compiler with fastdebug
coleenp
parents:
356
diff
changeset
|
475 // Return the flags of the bottom element type. |
443791f333a2
6700107: java/lang/Class/forName/TooManyDimensions.java crashes with SIGSEGV in c2 compiler with fastdebug
coleenp
parents:
356
diff
changeset
|
476 jint element_flags = Klass::cast(bottom_klass())->compute_modifier_flags(CHECK_0); |
0 | 477 |
478 return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED)) | |
479 | (JVM_ACC_ABSTRACT | JVM_ACC_FINAL); | |
480 } | |
481 | |
482 | |
483 #ifndef PRODUCT | |
484 // Printing | |
485 | |
486 void objArrayKlass::oop_print_on(oop obj, outputStream* st) { | |
487 arrayKlass::oop_print_on(obj, st); | |
488 assert(obj->is_objArray(), "must be objArray"); | |
489 objArrayOop oa = objArrayOop(obj); | |
490 int print_len = MIN2((intx) oa->length(), MaxElementPrintSize); | |
491 for(int index = 0; index < print_len; index++) { | |
492 st->print(" - %3d : ", index); | |
493 oa->obj_at(index)->print_value_on(st); | |
494 st->cr(); | |
495 } | |
496 int remaining = oa->length() - print_len; | |
497 if (remaining > 0) { | |
498 tty->print_cr(" - <%d more elements, increase MaxElementPrintSize to print>", remaining); | |
499 } | |
500 } | |
501 | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1142
diff
changeset
|
502 #endif //PRODUCT |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1142
diff
changeset
|
503 |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
504 static int max_objArray_print_length = 4; |
0 | 505 |
506 void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) { | |
507 assert(obj->is_objArray(), "must be objArray"); | |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
508 st->print("a "); |
0 | 509 element_klass()->print_value_on(st); |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
510 int len = objArrayOop(obj)->length(); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
511 st->print("[%d] ", len); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
512 obj->print_address_on(st); |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1142
diff
changeset
|
513 if (NOT_PRODUCT(PrintOopAddress ||) PrintMiscellaneous && (WizardMode || Verbose)) { |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
514 st->print("{"); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
515 for (int i = 0; i < len; i++) { |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
516 if (i > max_objArray_print_length) { |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
517 st->print("..."); break; |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
518 } |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
519 st->print(" "INTPTR_FORMAT, (intptr_t)(void*)objArrayOop(obj)->obj_at(i)); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
520 } |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
521 st->print(" }"); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
522 } |
0 | 523 } |
524 | |
525 const char* objArrayKlass::internal_name() const { | |
526 return external_name(); | |
527 } | |
528 | |
529 // Verification | |
530 | |
531 void objArrayKlass::oop_verify_on(oop obj, outputStream* st) { | |
532 arrayKlass::oop_verify_on(obj, st); | |
533 guarantee(obj->is_objArray(), "must be objArray"); | |
534 objArrayOop oa = objArrayOop(obj); | |
535 for(int index = 0; index < oa->length(); index++) { | |
536 guarantee(oa->obj_at(index)->is_oop_or_null(), "should be oop"); | |
537 } | |
538 } | |
539 | |
540 void objArrayKlass::oop_verify_old_oop(oop obj, oop* p, bool allow_dirty) { | |
541 /* $$$ move into remembered set verification? | |
542 RememberedSet::verify_old_oop(obj, p, allow_dirty, true); | |
543 */ | |
544 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
545 void objArrayKlass::oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty) {} |