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