author | coleenp |
Mon, 14 Jan 2013 11:01:39 -0500 | |
changeset 15194 | a35093d73168 |
parent 13961 | aeaa21c167d1 |
child 15482 | 470d0b0c09f1 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
12114
9a825a536095
7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
sspitsyn
parents:
10566
diff
changeset
|
2 |
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5119
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5119
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5119
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
26 |
#include "classfile/symbolTable.hpp" |
7397 | 27 |
#include "classfile/systemDictionary.hpp" |
28 |
#include "classfile/vmSymbols.hpp" |
|
29 |
#include "gc_interface/collectedHeap.hpp" |
|
30 |
#include "gc_interface/collectedHeap.inline.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
31 |
#include "memory/metadataFactory.hpp" |
7397 | 32 |
#include "memory/resourceArea.hpp" |
33 |
#include "memory/universe.hpp" |
|
34 |
#include "memory/universe.inline.hpp" |
|
35 |
#include "oops/instanceKlass.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
36 |
#include "oops/klass.inline.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
37 |
#include "oops/objArrayKlass.hpp" |
7397 | 38 |
#include "oops/oop.inline.hpp" |
39 |
#include "oops/typeArrayKlass.hpp" |
|
40 |
#include "oops/typeArrayOop.hpp" |
|
41 |
#include "runtime/handles.inline.hpp" |
|
1 | 42 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
43 |
bool TypeArrayKlass::compute_is_subtype_of(Klass* k) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
44 |
if (!k->oop_is_typeArray()) { |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
45 |
return ArrayKlass::compute_is_subtype_of(k); |
1 | 46 |
} |
47 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
48 |
TypeArrayKlass* tak = TypeArrayKlass::cast(k); |
1 | 49 |
if (dimension() != tak->dimension()) return false; |
50 |
||
51 |
return element_type() == tak->element_type(); |
|
52 |
} |
|
53 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
54 |
TypeArrayKlass* TypeArrayKlass::create_klass(BasicType type, |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1
diff
changeset
|
55 |
const char* name_str, TRAPS) { |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7890
diff
changeset
|
56 |
Symbol* sym = NULL; |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7890
diff
changeset
|
57 |
if (name_str != NULL) { |
12263
d20640f4f8fe
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
12114
diff
changeset
|
58 |
sym = SymbolTable::new_permanent_symbol(name_str, CHECK_NULL); |
1 | 59 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
60 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
61 |
ClassLoaderData* null_loader_data = ClassLoaderData::the_null_class_loader_data(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
62 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
63 |
TypeArrayKlass* ak = TypeArrayKlass::allocate(null_loader_data, type, sym, CHECK_NULL); |
1 | 64 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
65 |
// Add all classes to our internal class loader list here, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
66 |
// including classes in the bootstrap (NULL) class loader. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
67 |
// GC walks these as strong roots. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
68 |
null_loader_data->add_class(ak); |
1 | 69 |
|
70 |
// Call complete_create_array_klass after all instance variables have been initialized. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
71 |
complete_create_array_klass(ak, ak->super(), CHECK_NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
72 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
73 |
return ak; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
74 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
75 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
76 |
TypeArrayKlass* TypeArrayKlass::allocate(ClassLoaderData* loader_data, BasicType type, Symbol* name, TRAPS) { |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
77 |
assert(TypeArrayKlass::header_size() <= InstanceKlass::header_size(), |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
78 |
"array klasses must be same size as InstanceKlass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
79 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
80 |
int size = ArrayKlass::static_size(TypeArrayKlass::header_size()); |
1 | 81 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
82 |
return new (loader_data, size, THREAD) TypeArrayKlass(type, name); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
83 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
84 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
85 |
TypeArrayKlass::TypeArrayKlass(BasicType type, Symbol* name) : ArrayKlass(name) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
86 |
set_layout_helper(array_layout_helper(type)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
87 |
assert(oop_is_array(), "sanity"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
88 |
assert(oop_is_typeArray(), "sanity"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
89 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
90 |
set_max_length(arrayOopDesc::max_array_length(type)); |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
91 |
assert(size() >= TypeArrayKlass::header_size(), "bad size"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
92 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
93 |
set_class_loader_data(ClassLoaderData::the_null_class_loader_data()); |
1 | 94 |
} |
95 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
96 |
typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) { |
1 | 97 |
assert(log2_element_size() >= 0, "bad scale"); |
98 |
if (length >= 0) { |
|
99 |
if (length <= max_length()) { |
|
100 |
size_t size = typeArrayOopDesc::object_size(layout_helper(), length); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
101 |
KlassHandle h_k(THREAD, this); |
1 | 102 |
typeArrayOop t; |
103 |
CollectedHeap* ch = Universe::heap(); |
|
10566
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
9997
diff
changeset
|
104 |
if (do_zero) { |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
9997
diff
changeset
|
105 |
t = (typeArrayOop)CollectedHeap::array_allocate(h_k, (int)size, length, CHECK_NULL); |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
9997
diff
changeset
|
106 |
} else { |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
9997
diff
changeset
|
107 |
t = (typeArrayOop)CollectedHeap::array_allocate_nozero(h_k, (int)size, length, CHECK_NULL); |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
9997
diff
changeset
|
108 |
} |
1 | 109 |
return t; |
110 |
} else { |
|
3576
4ceec8fb3e18
6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit
martin
parents:
2105
diff
changeset
|
111 |
report_java_out_of_memory("Requested array size exceeds VM limit"); |
12114
9a825a536095
7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
sspitsyn
parents:
10566
diff
changeset
|
112 |
JvmtiExport::post_array_size_exhausted(); |
1 | 113 |
THROW_OOP_0(Universe::out_of_memory_error_array_size()); |
114 |
} |
|
115 |
} else { |
|
116 |
THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); |
|
117 |
} |
|
118 |
} |
|
119 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
120 |
oop TypeArrayKlass::multi_allocate(int rank, jint* last_size, TRAPS) { |
1 | 121 |
// For typeArrays this is only called for the last dimension |
122 |
assert(rank == 1, "just checking"); |
|
123 |
int length = *last_size; |
|
124 |
return allocate(length, THREAD); |
|
125 |
} |
|
126 |
||
127 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
128 |
void TypeArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS) { |
1 | 129 |
assert(s->is_typeArray(), "must be type array"); |
130 |
||
131 |
// Check destination |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
132 |
if (!d->is_typeArray() || element_type() != TypeArrayKlass::cast(d->klass())->element_type()) { |
1 | 133 |
THROW(vmSymbols::java_lang_ArrayStoreException()); |
134 |
} |
|
135 |
||
136 |
// Check is all offsets and lengths are non negative |
|
137 |
if (src_pos < 0 || dst_pos < 0 || length < 0) { |
|
138 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
139 |
} |
|
140 |
// Check if the ranges are valid |
|
141 |
if ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) |
|
142 |
|| (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) { |
|
143 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
144 |
} |
|
5119
7bf54ea07181
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
3576
diff
changeset
|
145 |
// Check zero copy |
7bf54ea07181
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
3576
diff
changeset
|
146 |
if (length == 0) |
7bf54ea07181
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
3576
diff
changeset
|
147 |
return; |
1 | 148 |
|
149 |
// This is an attempt to make the copy_array fast. |
|
150 |
int l2es = log2_element_size(); |
|
151 |
int ihs = array_header_in_bytes() / wordSize; |
|
5119
7bf54ea07181
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
3576
diff
changeset
|
152 |
char* src = (char*) ((oop*)s + ihs) + ((size_t)src_pos << l2es); |
7bf54ea07181
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
3576
diff
changeset
|
153 |
char* dst = (char*) ((oop*)d + ihs) + ((size_t)dst_pos << l2es); |
7bf54ea07181
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
3576
diff
changeset
|
154 |
Copy::conjoint_memory_atomic(src, dst, (size_t)length << l2es); |
1 | 155 |
} |
156 |
||
157 |
||
158 |
// create a klass of array holding typeArrays |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
159 |
Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
160 |
int dim = dimension(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
161 |
assert(dim <= n, "check order of chain"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
162 |
if (dim == n) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
163 |
return this; |
1 | 164 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
165 |
if (higher_dimension() == NULL) { |
1 | 166 |
if (or_null) return NULL; |
167 |
||
168 |
ResourceMark rm; |
|
169 |
JavaThread *jt = (JavaThread *)THREAD; |
|
170 |
{ |
|
171 |
MutexLocker mc(Compile_lock, THREAD); // for vtables |
|
172 |
// Atomic create higher dimension and link into list |
|
173 |
MutexLocker mu(MultiArray_lock, THREAD); |
|
174 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
175 |
if (higher_dimension() == NULL) { |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
176 |
Klass* oak = ObjArrayKlass::allocate_objArray_klass( |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
177 |
class_loader_data(), dim + 1, this, CHECK_NULL); |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
178 |
ObjArrayKlass* h_ak = ObjArrayKlass::cast(oak); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
179 |
h_ak->set_lower_dimension(this); |
7890 | 180 |
OrderAccess::storestore(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
181 |
set_higher_dimension(h_ak); |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
182 |
assert(h_ak->oop_is_objArray(), "incorrect initialization of ObjArrayKlass"); |
1 | 183 |
} |
184 |
} |
|
185 |
} else { |
|
186 |
CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); |
|
187 |
} |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
188 |
ObjArrayKlass* h_ak = ObjArrayKlass::cast(higher_dimension()); |
1 | 189 |
if (or_null) { |
190 |
return h_ak->array_klass_or_null(n); |
|
191 |
} |
|
192 |
return h_ak->array_klass(n, CHECK_NULL); |
|
193 |
} |
|
194 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
195 |
Klass* TypeArrayKlass::array_klass_impl(bool or_null, TRAPS) { |
1 | 196 |
return array_klass_impl(or_null, dimension() + 1, THREAD); |
197 |
} |
|
198 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
199 |
int TypeArrayKlass::oop_size(oop obj) const { |
1 | 200 |
assert(obj->is_typeArray(),"must be a type array"); |
201 |
typeArrayOop t = typeArrayOop(obj); |
|
202 |
return t->object_size(); |
|
203 |
} |
|
204 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
205 |
void TypeArrayKlass::oop_follow_contents(oop obj) { |
1 | 206 |
assert(obj->is_typeArray(),"must be a type array"); |
207 |
// Performance tweak: We skip iterating over the klass pointer since we |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
208 |
// know that Universe::TypeArrayKlass never moves. |
1 | 209 |
} |
210 |
||
211 |
#ifndef SERIALGC |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
212 |
void TypeArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj) { |
1 | 213 |
assert(obj->is_typeArray(),"must be a type array"); |
214 |
// Performance tweak: We skip iterating over the klass pointer since we |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
215 |
// know that Universe::TypeArrayKlass never moves. |
1 | 216 |
} |
217 |
#endif // SERIALGC |
|
218 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
219 |
int TypeArrayKlass::oop_adjust_pointers(oop obj) { |
1 | 220 |
assert(obj->is_typeArray(),"must be a type array"); |
221 |
typeArrayOop t = typeArrayOop(obj); |
|
222 |
// Performance tweak: We skip iterating over the klass pointer since we |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
223 |
// know that Universe::TypeArrayKlass never moves. |
1 | 224 |
return t->object_size(); |
225 |
} |
|
226 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
227 |
int TypeArrayKlass::oop_oop_iterate(oop obj, ExtendedOopClosure* blk) { |
1 | 228 |
assert(obj->is_typeArray(),"must be a type array"); |
229 |
typeArrayOop t = typeArrayOop(obj); |
|
230 |
// Performance tweak: We skip iterating over the klass pointer since we |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
231 |
// know that Universe::TypeArrayKlass never moves. |
1 | 232 |
return t->object_size(); |
233 |
} |
|
234 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
235 |
int TypeArrayKlass::oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) { |
1 | 236 |
assert(obj->is_typeArray(),"must be a type array"); |
237 |
typeArrayOop t = typeArrayOop(obj); |
|
238 |
// Performance tweak: We skip iterating over the klass pointer since we |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
239 |
// know that Universe::TypeArrayKlass never moves. |
1 | 240 |
return t->object_size(); |
241 |
} |
|
242 |
||
243 |
#ifndef SERIALGC |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
244 |
void TypeArrayKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
245 |
ShouldNotReachHere(); |
1 | 246 |
assert(obj->is_typeArray(),"must be a type array"); |
247 |
} |
|
248 |
||
249 |
int |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
250 |
TypeArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
1 | 251 |
assert(obj->is_typeArray(),"must be a type array"); |
252 |
return typeArrayOop(obj)->object_size(); |
|
253 |
} |
|
254 |
#endif // SERIALGC |
|
255 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
256 |
void TypeArrayKlass::initialize(TRAPS) { |
1 | 257 |
// Nothing to do. Having this function is handy since objArrayKlasses can be |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
258 |
// initialized by calling initialize on their bottom_klass, see ObjArrayKlass::initialize |
1 | 259 |
} |
260 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
261 |
const char* TypeArrayKlass::external_name(BasicType type) { |
1 | 262 |
switch (type) { |
263 |
case T_BOOLEAN: return "[Z"; |
|
264 |
case T_CHAR: return "[C"; |
|
265 |
case T_FLOAT: return "[F"; |
|
266 |
case T_DOUBLE: return "[D"; |
|
267 |
case T_BYTE: return "[B"; |
|
268 |
case T_SHORT: return "[S"; |
|
269 |
case T_INT: return "[I"; |
|
270 |
case T_LONG: return "[J"; |
|
271 |
default: ShouldNotReachHere(); |
|
272 |
} |
|
273 |
return NULL; |
|
274 |
} |
|
275 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
276 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
277 |
// Printing |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
278 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
279 |
void TypeArrayKlass::print_on(outputStream* st) const { |
1 | 280 |
#ifndef PRODUCT |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
281 |
assert(is_klass(), "must be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
282 |
print_value_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
283 |
Klass::print_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
284 |
#endif //PRODUCT |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
285 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
286 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
287 |
void TypeArrayKlass::print_value_on(outputStream* st) const { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
288 |
assert(is_klass(), "must be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
289 |
st->print("{type array "); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
290 |
switch (element_type()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
291 |
case T_BOOLEAN: st->print("bool"); break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
292 |
case T_CHAR: st->print("char"); break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
293 |
case T_FLOAT: st->print("float"); break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
294 |
case T_DOUBLE: st->print("double"); break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
295 |
case T_BYTE: st->print("byte"); break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
296 |
case T_SHORT: st->print("short"); break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
297 |
case T_INT: st->print("int"); break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
298 |
case T_LONG: st->print("long"); break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
299 |
default: ShouldNotReachHere(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
300 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
301 |
st->print("}"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
302 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
303 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12263
diff
changeset
|
304 |
#ifndef PRODUCT |
1 | 305 |
|
306 |
static void print_boolean_array(typeArrayOop ta, int print_len, outputStream* st) { |
|
307 |
for (int index = 0; index < print_len; index++) { |
|
308 |
st->print_cr(" - %3d: %s", index, (ta->bool_at(index) == 0) ? "false" : "true"); |
|
309 |
} |
|
310 |
} |
|
311 |
||
312 |
||
313 |
static void print_char_array(typeArrayOop ta, int print_len, outputStream* st) { |
|
314 |
for (int index = 0; index < print_len; index++) { |
|
315 |
jchar c = ta->char_at(index); |
|
316 |
st->print_cr(" - %3d: %x %c", index, c, isprint(c) ? c : ' '); |
|
317 |
} |
|
318 |
} |
|
319 |
||
320 |
||
321 |
static void print_float_array(typeArrayOop ta, int print_len, outputStream* st) { |
|
322 |
for (int index = 0; index < print_len; index++) { |
|
323 |
st->print_cr(" - %3d: %g", index, ta->float_at(index)); |
|
324 |
} |
|
325 |
} |
|
326 |
||
327 |
||
328 |
static void print_double_array(typeArrayOop ta, int print_len, outputStream* st) { |
|
329 |
for (int index = 0; index < print_len; index++) { |
|
330 |
st->print_cr(" - %3d: %g", index, ta->double_at(index)); |
|
331 |
} |
|
332 |
} |
|
333 |
||
334 |
||
335 |
static void print_byte_array(typeArrayOop ta, int print_len, outputStream* st) { |
|
336 |
for (int index = 0; index < print_len; index++) { |
|
337 |
jbyte c = ta->byte_at(index); |
|
338 |
st->print_cr(" - %3d: %x %c", index, c, isprint(c) ? c : ' '); |
|
339 |
} |
|
340 |
} |
|
341 |
||
342 |
||
343 |
static void print_short_array(typeArrayOop ta, int print_len, outputStream* st) { |
|
344 |
for (int index = 0; index < print_len; index++) { |
|
345 |
int v = ta->ushort_at(index); |
|
346 |
st->print_cr(" - %3d: 0x%x\t %d", index, v, v); |
|
347 |
} |
|
348 |
} |
|
349 |
||
350 |
||
351 |
static void print_int_array(typeArrayOop ta, int print_len, outputStream* st) { |
|
352 |
for (int index = 0; index < print_len; index++) { |
|
353 |
jint v = ta->int_at(index); |
|
354 |
st->print_cr(" - %3d: 0x%x %d", index, v, v); |
|
355 |
} |
|
356 |
} |
|
357 |
||
358 |
||
359 |
static void print_long_array(typeArrayOop ta, int print_len, outputStream* st) { |
|
360 |
for (int index = 0; index < print_len; index++) { |
|
361 |
jlong v = ta->long_at(index); |
|
362 |
st->print_cr(" - %3d: 0x%x 0x%x", index, high(v), low(v)); |
|
363 |
} |
|
364 |
} |
|
365 |
||
366 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
367 |
void TypeArrayKlass::oop_print_on(oop obj, outputStream* st) { |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
368 |
ArrayKlass::oop_print_on(obj, st); |
1 | 369 |
typeArrayOop ta = typeArrayOop(obj); |
370 |
int print_len = MIN2((intx) ta->length(), MaxElementPrintSize); |
|
371 |
switch (element_type()) { |
|
372 |
case T_BOOLEAN: print_boolean_array(ta, print_len, st); break; |
|
373 |
case T_CHAR: print_char_array(ta, print_len, st); break; |
|
374 |
case T_FLOAT: print_float_array(ta, print_len, st); break; |
|
375 |
case T_DOUBLE: print_double_array(ta, print_len, st); break; |
|
376 |
case T_BYTE: print_byte_array(ta, print_len, st); break; |
|
377 |
case T_SHORT: print_short_array(ta, print_len, st); break; |
|
378 |
case T_INT: print_int_array(ta, print_len, st); break; |
|
379 |
case T_LONG: print_long_array(ta, print_len, st); break; |
|
380 |
default: ShouldNotReachHere(); |
|
381 |
} |
|
382 |
int remaining = ta->length() - print_len; |
|
383 |
if (remaining > 0) { |
|
13922
ab7d352debe6
8000227: [obj|type]ArrayKlass::oop_print_on prints one line to tty instead of the provided output stream
stefank
parents:
13728
diff
changeset
|
384 |
st->print_cr(" - <%d more elements, increase MaxElementPrintSize to print>", remaining); |
1 | 385 |
} |
386 |
} |
|
387 |
||
388 |
#endif // PRODUCT |
|
389 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
390 |
const char* TypeArrayKlass::internal_name() const { |
1 | 391 |
return Klass::external_name(); |
392 |
} |