Mercurial > hg > graal-compiler
annotate src/share/vm/oops/typeArrayKlass.cpp @ 10185:d50cc62e94ff
8012715: G1: GraphKit accesses PtrQueue::_index as int but is size_t
Summary: In graphKit INT operations were generated to access PtrQueue::_index which has type size_t. This is 64 bit on 64-bit machines. No problems occur on little endian machines as long as the index fits into 32 bit, but on big endian machines the upper part is read, which is zero. This leads to unnecessary branches to the slow path in the runtime.
Reviewed-by: twisti, johnc
Contributed-by: Martin Doerr <martin.doerr@sap.com>
author | johnc |
---|---|
date | Wed, 24 Apr 2013 14:48:43 -0700 |
parents | db9981fd3124 |
children | de6a9e811145 |
rev | line source |
---|---|
0 | 1 /* |
5935
a735aec54ea4
7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
sspitsyn
parents:
3961
diff
changeset
|
2 * Copyright (c) 1997, 2012, 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:
1334
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1334
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:
1334
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
26 #include "classfile/symbolTable.hpp" |
1972 | 27 #include "classfile/systemDictionary.hpp" |
28 #include "classfile/vmSymbols.hpp" | |
29 #include "gc_interface/collectedHeap.hpp" | |
30 #include "gc_interface/collectedHeap.inline.hpp" | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
31 #include "memory/metadataFactory.hpp" |
1972 | 32 #include "memory/resourceArea.hpp" |
33 #include "memory/universe.hpp" | |
34 #include "memory/universe.inline.hpp" | |
35 #include "oops/instanceKlass.hpp" | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
36 #include "oops/klass.inline.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
37 #include "oops/objArrayKlass.hpp" |
1972 | 38 #include "oops/oop.inline.hpp" |
39 #include "oops/typeArrayKlass.hpp" | |
40 #include "oops/typeArrayOop.hpp" | |
41 #include "runtime/handles.inline.hpp" | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6840
diff
changeset
|
42 #include "utilities/macros.hpp" |
0 | 43 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
44 bool TypeArrayKlass::compute_is_subtype_of(Klass* k) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
45 if (!k->oop_is_typeArray()) { |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
46 return ArrayKlass::compute_is_subtype_of(k); |
0 | 47 } |
48 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
49 TypeArrayKlass* tak = TypeArrayKlass::cast(k); |
0 | 50 if (dimension() != tak->dimension()) return false; |
51 | |
52 return element_type() == tak->element_type(); | |
53 } | |
54 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
55 TypeArrayKlass* TypeArrayKlass::create_klass(BasicType type, |
481
7d7a7c599c17
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
0
diff
changeset
|
56 const char* name_str, TRAPS) { |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2119
diff
changeset
|
57 Symbol* sym = NULL; |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2119
diff
changeset
|
58 if (name_str != NULL) { |
5979
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
5935
diff
changeset
|
59 sym = SymbolTable::new_permanent_symbol(name_str, CHECK_NULL); |
0 | 60 } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
61 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
62 ClassLoaderData* null_loader_data = ClassLoaderData::the_null_class_loader_data(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
63 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
64 TypeArrayKlass* ak = TypeArrayKlass::allocate(null_loader_data, type, sym, CHECK_NULL); |
0 | 65 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
66 // Add all classes to our internal class loader list here, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
67 // including classes in the bootstrap (NULL) class loader. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
68 // GC walks these as strong roots. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
69 null_loader_data->add_class(ak); |
0 | 70 |
71 // Call complete_create_array_klass after all instance variables have been initialized. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
72 complete_create_array_klass(ak, ak->super(), CHECK_NULL); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
73 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
74 return ak; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
75 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
76 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
77 TypeArrayKlass* TypeArrayKlass::allocate(ClassLoaderData* loader_data, BasicType type, Symbol* name, TRAPS) { |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
78 assert(TypeArrayKlass::header_size() <= InstanceKlass::header_size(), |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
79 "array klasses must be same size as InstanceKlass"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
80 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
81 int size = ArrayKlass::static_size(TypeArrayKlass::header_size()); |
0 | 82 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
83 return new (loader_data, size, THREAD) TypeArrayKlass(type, name); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
84 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
85 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
86 TypeArrayKlass::TypeArrayKlass(BasicType type, Symbol* name) : ArrayKlass(name) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
87 set_layout_helper(array_layout_helper(type)); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
88 assert(oop_is_array(), "sanity"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
89 assert(oop_is_typeArray(), "sanity"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
90 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
91 set_max_length(arrayOopDesc::max_array_length(type)); |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
92 assert(size() >= TypeArrayKlass::header_size(), "bad size"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
93 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
94 set_class_loader_data(ClassLoaderData::the_null_class_loader_data()); |
0 | 95 } |
96 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
97 typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) { |
0 | 98 assert(log2_element_size() >= 0, "bad scale"); |
99 if (length >= 0) { | |
100 if (length <= max_length()) { | |
101 size_t size = typeArrayOopDesc::object_size(layout_helper(), length); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
102 KlassHandle h_k(THREAD, this); |
0 | 103 typeArrayOop t; |
104 CollectedHeap* ch = Universe::heap(); | |
3961
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3774
diff
changeset
|
105 if (do_zero) { |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3774
diff
changeset
|
106 t = (typeArrayOop)CollectedHeap::array_allocate(h_k, (int)size, length, CHECK_NULL); |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3774
diff
changeset
|
107 } else { |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3774
diff
changeset
|
108 t = (typeArrayOop)CollectedHeap::array_allocate_nozero(h_k, (int)size, length, CHECK_NULL); |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3774
diff
changeset
|
109 } |
0 | 110 return t; |
111 } else { | |
876
1413494da700
6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit
martin
parents:
579
diff
changeset
|
112 report_java_out_of_memory("Requested array size exceeds VM limit"); |
5935
a735aec54ea4
7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
sspitsyn
parents:
3961
diff
changeset
|
113 JvmtiExport::post_array_size_exhausted(); |
0 | 114 THROW_OOP_0(Universe::out_of_memory_error_array_size()); |
115 } | |
116 } else { | |
117 THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); | |
118 } | |
119 } | |
120 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
121 oop TypeArrayKlass::multi_allocate(int rank, jint* last_size, TRAPS) { |
0 | 122 // For typeArrays this is only called for the last dimension |
123 assert(rank == 1, "just checking"); | |
124 int length = *last_size; | |
125 return allocate(length, THREAD); | |
126 } | |
127 | |
128 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
129 void TypeArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS) { |
0 | 130 assert(s->is_typeArray(), "must be type array"); |
131 | |
132 // Check destination | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
133 if (!d->is_typeArray() || element_type() != TypeArrayKlass::cast(d->klass())->element_type()) { |
0 | 134 THROW(vmSymbols::java_lang_ArrayStoreException()); |
135 } | |
136 | |
137 // Check is all offsets and lengths are non negative | |
138 if (src_pos < 0 || dst_pos < 0 || length < 0) { | |
139 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); | |
140 } | |
141 // Check if the ranges are valid | |
142 if ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) | |
143 || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) { | |
144 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); | |
145 } | |
1334
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
876
diff
changeset
|
146 // Check zero copy |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
876
diff
changeset
|
147 if (length == 0) |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
876
diff
changeset
|
148 return; |
0 | 149 |
150 // This is an attempt to make the copy_array fast. | |
151 int l2es = log2_element_size(); | |
152 int ihs = array_header_in_bytes() / wordSize; | |
1334
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
876
diff
changeset
|
153 char* src = (char*) ((oop*)s + ihs) + ((size_t)src_pos << l2es); |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
876
diff
changeset
|
154 char* dst = (char*) ((oop*)d + ihs) + ((size_t)dst_pos << l2es); |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
876
diff
changeset
|
155 Copy::conjoint_memory_atomic(src, dst, (size_t)length << l2es); |
0 | 156 } |
157 | |
158 | |
159 // create a klass of array holding typeArrays | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
160 Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
161 int dim = dimension(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
162 assert(dim <= n, "check order of chain"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
163 if (dim == n) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
164 return this; |
0 | 165 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
166 if (higher_dimension() == NULL) { |
0 | 167 if (or_null) return NULL; |
168 | |
169 ResourceMark rm; | |
170 JavaThread *jt = (JavaThread *)THREAD; | |
171 { | |
172 MutexLocker mc(Compile_lock, THREAD); // for vtables | |
173 // Atomic create higher dimension and link into list | |
174 MutexLocker mu(MultiArray_lock, THREAD); | |
175 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
176 if (higher_dimension() == NULL) { |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
177 Klass* oak = ObjArrayKlass::allocate_objArray_klass( |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
178 class_loader_data(), dim + 1, this, CHECK_NULL); |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
179 ObjArrayKlass* h_ak = ObjArrayKlass::cast(oak); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
180 h_ak->set_lower_dimension(this); |
2119 | 181 OrderAccess::storestore(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
182 set_higher_dimension(h_ak); |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
183 assert(h_ak->oop_is_objArray(), "incorrect initialization of ObjArrayKlass"); |
0 | 184 } |
185 } | |
186 } else { | |
187 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); | |
188 } | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
189 ObjArrayKlass* h_ak = ObjArrayKlass::cast(higher_dimension()); |
0 | 190 if (or_null) { |
191 return h_ak->array_klass_or_null(n); | |
192 } | |
193 return h_ak->array_klass(n, CHECK_NULL); | |
194 } | |
195 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
196 Klass* TypeArrayKlass::array_klass_impl(bool or_null, TRAPS) { |
0 | 197 return array_klass_impl(or_null, dimension() + 1, THREAD); |
198 } | |
199 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
200 int TypeArrayKlass::oop_size(oop obj) const { |
0 | 201 assert(obj->is_typeArray(),"must be a type array"); |
202 typeArrayOop t = typeArrayOop(obj); | |
203 return t->object_size(); | |
204 } | |
205 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
206 void TypeArrayKlass::oop_follow_contents(oop obj) { |
0 | 207 assert(obj->is_typeArray(),"must be a type array"); |
208 // Performance tweak: We skip iterating over the klass pointer since we | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
209 // know that Universe::TypeArrayKlass never moves. |
0 | 210 } |
211 | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6840
diff
changeset
|
212 #if INCLUDE_ALL_GCS |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
213 void TypeArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj) { |
0 | 214 assert(obj->is_typeArray(),"must be a type array"); |
215 // Performance tweak: We skip iterating over the klass pointer since we | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
216 // know that Universe::TypeArrayKlass never moves. |
0 | 217 } |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6840
diff
changeset
|
218 #endif // INCLUDE_ALL_GCS |
0 | 219 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
220 int TypeArrayKlass::oop_adjust_pointers(oop obj) { |
0 | 221 assert(obj->is_typeArray(),"must be a type array"); |
222 typeArrayOop t = typeArrayOop(obj); | |
223 // Performance tweak: We skip iterating over the klass pointer since we | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
224 // know that Universe::TypeArrayKlass never moves. |
0 | 225 return t->object_size(); |
226 } | |
227 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
228 int TypeArrayKlass::oop_oop_iterate(oop obj, ExtendedOopClosure* blk) { |
0 | 229 assert(obj->is_typeArray(),"must be a type array"); |
230 typeArrayOop t = typeArrayOop(obj); | |
231 // Performance tweak: We skip iterating over the klass pointer since we | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
232 // know that Universe::TypeArrayKlass never moves. |
0 | 233 return t->object_size(); |
234 } | |
235 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
236 int TypeArrayKlass::oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) { |
0 | 237 assert(obj->is_typeArray(),"must be a type array"); |
238 typeArrayOop t = typeArrayOop(obj); | |
239 // Performance tweak: We skip iterating over the klass pointer since we | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
240 // know that Universe::TypeArrayKlass never moves. |
0 | 241 return t->object_size(); |
242 } | |
243 | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6840
diff
changeset
|
244 #if INCLUDE_ALL_GCS |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
245 void TypeArrayKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
246 ShouldNotReachHere(); |
0 | 247 assert(obj->is_typeArray(),"must be a type array"); |
248 } | |
249 | |
250 int | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
251 TypeArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
0 | 252 assert(obj->is_typeArray(),"must be a type array"); |
253 return typeArrayOop(obj)->object_size(); | |
254 } | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6840
diff
changeset
|
255 #endif // INCLUDE_ALL_GCS |
0 | 256 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
257 void TypeArrayKlass::initialize(TRAPS) { |
0 | 258 // Nothing to do. Having this function is handy since objArrayKlasses can be |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
259 // initialized by calling initialize on their bottom_klass, see ObjArrayKlass::initialize |
0 | 260 } |
261 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
262 const char* TypeArrayKlass::external_name(BasicType type) { |
0 | 263 switch (type) { |
264 case T_BOOLEAN: return "[Z"; | |
265 case T_CHAR: return "[C"; | |
266 case T_FLOAT: return "[F"; | |
267 case T_DOUBLE: return "[D"; | |
268 case T_BYTE: return "[B"; | |
269 case T_SHORT: return "[S"; | |
270 case T_INT: return "[I"; | |
271 case T_LONG: return "[J"; | |
272 default: ShouldNotReachHere(); | |
273 } | |
274 return NULL; | |
275 } | |
276 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
277 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
278 // Printing |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
279 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
280 void TypeArrayKlass::print_on(outputStream* st) const { |
0 | 281 #ifndef PRODUCT |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
282 assert(is_klass(), "must be klass"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
283 print_value_on(st); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
284 Klass::print_on(st); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
285 #endif //PRODUCT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
286 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
287 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
288 void TypeArrayKlass::print_value_on(outputStream* st) const { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
289 assert(is_klass(), "must be klass"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
290 st->print("{type array "); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
291 switch (element_type()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
292 case T_BOOLEAN: st->print("bool"); break; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
293 case T_CHAR: st->print("char"); break; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
294 case T_FLOAT: st->print("float"); break; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
295 case T_DOUBLE: st->print("double"); break; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
296 case T_BYTE: st->print("byte"); break; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
297 case T_SHORT: st->print("short"); break; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
298 case T_INT: st->print("int"); break; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
299 case T_LONG: st->print("long"); break; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
300 default: ShouldNotReachHere(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
301 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
302 st->print("}"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
303 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
304 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
5979
diff
changeset
|
305 #ifndef PRODUCT |
0 | 306 |
307 static void print_boolean_array(typeArrayOop ta, int print_len, outputStream* st) { | |
308 for (int index = 0; index < print_len; index++) { | |
309 st->print_cr(" - %3d: %s", index, (ta->bool_at(index) == 0) ? "false" : "true"); | |
310 } | |
311 } | |
312 | |
313 | |
314 static void print_char_array(typeArrayOop ta, int print_len, outputStream* st) { | |
315 for (int index = 0; index < print_len; index++) { | |
316 jchar c = ta->char_at(index); | |
317 st->print_cr(" - %3d: %x %c", index, c, isprint(c) ? c : ' '); | |
318 } | |
319 } | |
320 | |
321 | |
322 static void print_float_array(typeArrayOop ta, int print_len, outputStream* st) { | |
323 for (int index = 0; index < print_len; index++) { | |
324 st->print_cr(" - %3d: %g", index, ta->float_at(index)); | |
325 } | |
326 } | |
327 | |
328 | |
329 static void print_double_array(typeArrayOop ta, int print_len, outputStream* st) { | |
330 for (int index = 0; index < print_len; index++) { | |
331 st->print_cr(" - %3d: %g", index, ta->double_at(index)); | |
332 } | |
333 } | |
334 | |
335 | |
336 static void print_byte_array(typeArrayOop ta, int print_len, outputStream* st) { | |
337 for (int index = 0; index < print_len; index++) { | |
338 jbyte c = ta->byte_at(index); | |
339 st->print_cr(" - %3d: %x %c", index, c, isprint(c) ? c : ' '); | |
340 } | |
341 } | |
342 | |
343 | |
344 static void print_short_array(typeArrayOop ta, int print_len, outputStream* st) { | |
345 for (int index = 0; index < print_len; index++) { | |
346 int v = ta->ushort_at(index); | |
347 st->print_cr(" - %3d: 0x%x\t %d", index, v, v); | |
348 } | |
349 } | |
350 | |
351 | |
352 static void print_int_array(typeArrayOop ta, int print_len, outputStream* st) { | |
353 for (int index = 0; index < print_len; index++) { | |
354 jint v = ta->int_at(index); | |
355 st->print_cr(" - %3d: 0x%x %d", index, v, v); | |
356 } | |
357 } | |
358 | |
359 | |
360 static void print_long_array(typeArrayOop ta, int print_len, outputStream* st) { | |
361 for (int index = 0; index < print_len; index++) { | |
362 jlong v = ta->long_at(index); | |
363 st->print_cr(" - %3d: 0x%x 0x%x", index, high(v), low(v)); | |
364 } | |
365 } | |
366 | |
367 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
368 void TypeArrayKlass::oop_print_on(oop obj, outputStream* st) { |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
369 ArrayKlass::oop_print_on(obj, st); |
0 | 370 typeArrayOop ta = typeArrayOop(obj); |
371 int print_len = MIN2((intx) ta->length(), MaxElementPrintSize); | |
372 switch (element_type()) { | |
373 case T_BOOLEAN: print_boolean_array(ta, print_len, st); break; | |
374 case T_CHAR: print_char_array(ta, print_len, st); break; | |
375 case T_FLOAT: print_float_array(ta, print_len, st); break; | |
376 case T_DOUBLE: print_double_array(ta, print_len, st); break; | |
377 case T_BYTE: print_byte_array(ta, print_len, st); break; | |
378 case T_SHORT: print_short_array(ta, print_len, st); break; | |
379 case T_INT: print_int_array(ta, print_len, st); break; | |
380 case T_LONG: print_long_array(ta, print_len, st); break; | |
381 default: ShouldNotReachHere(); | |
382 } | |
383 int remaining = ta->length() - print_len; | |
384 if (remaining > 0) { | |
6815
86af3dacab81
8000227: [obj|type]ArrayKlass::oop_print_on prints one line to tty instead of the provided output stream
stefank
parents:
6725
diff
changeset
|
385 st->print_cr(" - <%d more elements, increase MaxElementPrintSize to print>", remaining); |
0 | 386 } |
387 } | |
388 | |
389 #endif // PRODUCT | |
390 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
391 const char* TypeArrayKlass::internal_name() const { |
0 | 392 return Klass::external_name(); |
393 } |