Mercurial > hg > graal-compiler
annotate src/share/vm/oops/objArrayKlass.cpp @ 7199:cd3d6a6b95d9
8003240: x86: move MacroAssembler into separate file
Reviewed-by: kvn
author | twisti |
---|---|
date | Fri, 30 Nov 2012 15:23:16 -0800 |
parents | 070d523b96a7 |
children | 90273fc0a981 |
rev | line source |
---|---|
0 | 1 /* |
5935
a735aec54ea4
7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
sspitsyn
parents:
2227
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:
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" |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
26 #include "classfile/symbolTable.hpp" |
1972 | 27 #include "classfile/systemDictionary.hpp" |
28 #include "classfile/vmSymbols.hpp" | |
29 #include "gc_implementation/shared/markSweep.inline.hpp" | |
30 #include "gc_interface/collectedHeap.inline.hpp" | |
31 #include "memory/genOopClosures.inline.hpp" | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
32 #include "memory/metadataFactory.hpp" |
1972 | 33 #include "memory/resourceArea.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:
6008
diff
changeset
|
36 #include "oops/klass.inline.hpp" |
1972 | 37 #include "oops/objArrayKlass.hpp" |
38 #include "oops/objArrayKlass.inline.hpp" | |
39 #include "oops/objArrayOop.hpp" | |
40 #include "oops/oop.inline.hpp" | |
41 #include "oops/oop.inline2.hpp" | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2119
diff
changeset
|
42 #include "oops/symbol.hpp" |
1972 | 43 #include "runtime/handles.inline.hpp" |
44 #include "runtime/mutexLocker.hpp" | |
45 #include "utilities/copy.hpp" | |
46 #ifndef SERIALGC | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
47 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp" |
1972 | 48 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
49 #include "gc_implementation/g1/g1OopClosures.inline.hpp" | |
50 #include "gc_implementation/g1/g1RemSet.inline.hpp" | |
51 #include "gc_implementation/g1/heapRegionSeq.inline.hpp" | |
52 #include "gc_implementation/parNew/parOopClosures.inline.hpp" | |
53 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp" | |
54 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" | |
55 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" | |
56 #include "oops/oop.pcgc.inline.hpp" | |
57 #endif | |
0 | 58 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
59 ObjArrayKlass* ObjArrayKlass::allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS) { |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
60 assert(ObjArrayKlass::header_size() <= InstanceKlass::header_size(), |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
61 "array klasses must be same size as InstanceKlass"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
62 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
63 int size = ArrayKlass::static_size(ObjArrayKlass::header_size()); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
64 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
65 return new (loader_data, size, THREAD) ObjArrayKlass(n, klass_handle, name); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
66 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
67 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
68 Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data, |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
69 int n, KlassHandle element_klass, TRAPS) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
70 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
71 // Eagerly allocate the direct array supertype. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
72 KlassHandle super_klass = KlassHandle(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
73 if (!Universe::is_bootstrapping() || SystemDictionary::Object_klass_loaded()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
74 KlassHandle element_super (THREAD, element_klass->super()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
75 if (element_super.not_null()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
76 // The element type has a direct super. E.g., String[] has direct super of Object[]. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
77 super_klass = KlassHandle(THREAD, element_super->array_klass_or_null()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
78 bool supers_exist = super_klass.not_null(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
79 // Also, see if the element has secondary supertypes. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
80 // We need an array type for each. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
81 Array<Klass*>* element_supers = element_klass->secondary_supers(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
82 for( int i = element_supers->length()-1; i >= 0; i-- ) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
83 Klass* elem_super = element_supers->at(i); |
6983 | 84 if (elem_super->array_klass_or_null() == NULL) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
85 supers_exist = false; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
86 break; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
87 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
88 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
89 if (!supers_exist) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
90 // Oops. Not allocated yet. Back out, allocate it, and retry. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
91 #ifndef PRODUCT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
92 if (WizardMode) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
93 tty->print_cr("Must retry array klass creation for depth %d",n); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
94 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
95 #endif |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
96 KlassHandle ek; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
97 { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
98 MutexUnlocker mu(MultiArray_lock); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
99 MutexUnlocker mc(Compile_lock); // for vtables |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
100 Klass* sk = element_super->array_klass(CHECK_0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
101 super_klass = KlassHandle(THREAD, sk); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
102 for( int i = element_supers->length()-1; i >= 0; i-- ) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
103 KlassHandle elem_super (THREAD, element_supers->at(i)); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
104 elem_super->array_klass(CHECK_0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
105 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
106 // Now retry from the beginning |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
107 Klass* klass_oop = element_klass->array_klass(n, CHECK_0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
108 // Create a handle because the enclosing brace, when locking |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
109 // can cause a gc. Better to have this function return a Handle. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
110 ek = KlassHandle(THREAD, klass_oop); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
111 } // re-lock |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
112 return ek(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
113 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
114 } else { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
115 // The element type is already Object. Object[] has direct super of Object. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
116 super_klass = KlassHandle(THREAD, SystemDictionary::Object_klass()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
117 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
118 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
119 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
120 // Create type name for klass. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
121 Symbol* name = NULL; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
122 if (!element_klass->oop_is_instance() || |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
123 (name = InstanceKlass::cast(element_klass())->array_name()) == NULL) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
124 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
125 ResourceMark rm(THREAD); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
126 char *name_str = element_klass->name()->as_C_string(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
127 int len = element_klass->name()->utf8_length(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
128 char *new_str = NEW_RESOURCE_ARRAY(char, len + 4); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
129 int idx = 0; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
130 new_str[idx++] = '['; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
131 if (element_klass->oop_is_instance()) { // it could be an array or simple type |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
132 new_str[idx++] = 'L'; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
133 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
134 memcpy(&new_str[idx], name_str, len * sizeof(char)); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
135 idx += len; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
136 if (element_klass->oop_is_instance()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
137 new_str[idx++] = ';'; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
138 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
139 new_str[idx++] = '\0'; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
140 name = SymbolTable::new_permanent_symbol(new_str, CHECK_0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
141 if (element_klass->oop_is_instance()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
142 InstanceKlass* ik = InstanceKlass::cast(element_klass()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
143 ik->set_array_name(name); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
144 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
145 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
146 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
147 // Initialize instance variables |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
148 ObjArrayKlass* oak = ObjArrayKlass::allocate(loader_data, n, element_klass, name, CHECK_0); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
149 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
150 // Add all classes to our internal class loader list here, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
151 // including classes in the bootstrap (NULL) class loader. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
152 // GC walks these as strong roots. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
153 loader_data->add_class(oak); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
154 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
155 // Call complete_create_array_klass after all instance variables has been initialized. |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
156 ArrayKlass::complete_create_array_klass(oak, super_klass, CHECK_0); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
157 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
158 return oak; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
159 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
160 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
161 ObjArrayKlass::ObjArrayKlass(int n, KlassHandle element_klass, Symbol* name) : ArrayKlass(name) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
162 this->set_dimension(n); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
163 this->set_element_klass(element_klass()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
164 // decrement refcount because object arrays are not explicitly freed. The |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
165 // InstanceKlass array_name() keeps the name counted while the klass is |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
166 // loaded. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
167 name->decrement_refcount(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
168 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
169 Klass* bk; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
170 if (element_klass->oop_is_objArray()) { |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
171 bk = ObjArrayKlass::cast(element_klass())->bottom_klass(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
172 } else { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
173 bk = element_klass(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
174 } |
6983 | 175 assert(bk != NULL && (bk->oop_is_instance() || bk->oop_is_typeArray()), "invalid bottom klass"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
176 this->set_bottom_klass(bk); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
177 this->set_class_loader_data(bk->class_loader_data()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
178 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
179 this->set_layout_helper(array_layout_helper(T_OBJECT)); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
180 assert(this->oop_is_array(), "sanity"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
181 assert(this->oop_is_objArray(), "sanity"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
182 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
183 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
184 int ObjArrayKlass::oop_size(oop obj) const { |
0 | 185 assert(obj->is_objArray(), "must be object array"); |
186 return objArrayOop(obj)->object_size(); | |
187 } | |
188 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
189 objArrayOop ObjArrayKlass::allocate(int length, TRAPS) { |
0 | 190 if (length >= 0) { |
191 if (length <= arrayOopDesc::max_array_length(T_OBJECT)) { | |
192 int size = objArrayOopDesc::object_size(length); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
193 KlassHandle h_k(THREAD, this); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
194 return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, CHECK_NULL); |
0 | 195 } else { |
876
1413494da700
6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit
martin
parents:
665
diff
changeset
|
196 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:
2227
diff
changeset
|
197 JvmtiExport::post_array_size_exhausted(); |
0 | 198 THROW_OOP_0(Universe::out_of_memory_error_array_size()); |
199 } | |
200 } else { | |
201 THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); | |
202 } | |
203 } | |
204 | |
205 static int multi_alloc_counter = 0; | |
206 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
207 oop ObjArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) { |
0 | 208 int length = *sizes; |
209 // Call to lower_dimension uses this pointer, so most be called before a | |
210 // possible GC | |
211 KlassHandle h_lower_dimension(THREAD, lower_dimension()); | |
212 // If length < 0 allocate will throw an exception. | |
213 objArrayOop array = allocate(length, CHECK_NULL); | |
214 objArrayHandle h_array (THREAD, array); | |
215 if (rank > 1) { | |
216 if (length != 0) { | |
217 for (int index = 0; index < length; index++) { | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
218 ArrayKlass* ak = ArrayKlass::cast(h_lower_dimension()); |
0 | 219 oop sub_array = ak->multi_allocate(rank-1, &sizes[1], CHECK_NULL); |
220 h_array->obj_at_put(index, sub_array); | |
221 } | |
222 } else { | |
223 // Since this array dimension has zero length, nothing will be | |
224 // allocated, however the lower dimension values must be checked | |
225 // for illegal values. | |
226 for (int i = 0; i < rank - 1; ++i) { | |
227 sizes += 1; | |
228 if (*sizes < 0) { | |
229 THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); | |
230 } | |
231 } | |
232 } | |
233 } | |
234 return h_array(); | |
235 } | |
236 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
237 // Either oop or narrowOop depending on UseCompressedOops. |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
238 template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src, |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
239 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
|
240 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
241 BarrierSet* bs = Universe::heap()->barrier_set(); |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
242 // 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
|
243 // 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
|
244 // 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
|
245 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
|
246 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
|
247 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
248 if (s == d) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
249 // 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
|
250 assert(length > 0, "sanity check"); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
665
diff
changeset
|
251 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
|
252 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
|
253 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
254 // We have to make sure all elements conform to the destination array |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
255 Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass(); |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
256 Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass(); |
6983 | 257 if (stype == bound || stype->is_subtype_of(bound)) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
258 // 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
|
259 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
|
260 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
|
261 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
262 // 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
|
263 // 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
|
264 T* from = src; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
265 T* end = from + length; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
266 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
|
267 // 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
|
268 T element = *from; |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
269 // even slower now |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
270 bool element_is_null = oopDesc::is_null(element); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
271 oop new_val = element_is_null ? oop(NULL) |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
272 : oopDesc::decode_heap_oop_not_null(element); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
273 if (element_is_null || |
6983 | 274 (new_val->klass())->is_subtype_of(bound)) { |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
275 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
|
276 *p = *from; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
277 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
278 // 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
|
279 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
|
280 // 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
|
281 // 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
|
282 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
|
283 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
|
284 THROW(vmSymbols::java_lang_ArrayStoreException()); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
285 return; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
286 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
287 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
288 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
289 } |
1091
6aa7255741f3
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
879
diff
changeset
|
290 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
|
291 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
292 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
293 void ObjArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, |
0 | 294 int dst_pos, int length, TRAPS) { |
295 assert(s->is_objArray(), "must be obj array"); | |
296 | |
297 if (!d->is_objArray()) { | |
298 THROW(vmSymbols::java_lang_ArrayStoreException()); | |
299 } | |
300 | |
301 // Check is all offsets and lengths are non negative | |
302 if (src_pos < 0 || dst_pos < 0 || length < 0) { | |
303 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); | |
304 } | |
305 // Check if the ranges are valid | |
306 if ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) | |
307 || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) { | |
308 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); | |
309 } | |
310 | |
311 // Special case. Boundary cases must be checked first | |
312 // This allows the following call: copy_array(s, s.length(), d.length(), 0). | |
313 // This is correct, since the position is supposed to be an 'in between point', i.e., s.length(), | |
314 // points to the right of the last element. | |
315 if (length==0) { | |
316 return; | |
317 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
318 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
319 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
|
320 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
|
321 do_copy<narrowOop>(s, src, d, dst, length, CHECK); |
0 | 322 } else { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
323 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
|
324 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
|
325 do_copy<oop> (s, src, d, dst, length, CHECK); |
0 | 326 } |
327 } | |
328 | |
329 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
330 Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) { |
0 | 331 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
332 assert(dimension() <= n, "check order of chain"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
333 int dim = dimension(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
334 if (dim == n) return this; |
0 | 335 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
336 if (higher_dimension() == NULL) { |
0 | 337 if (or_null) return NULL; |
338 | |
339 ResourceMark rm; | |
340 JavaThread *jt = (JavaThread *)THREAD; | |
341 { | |
342 MutexLocker mc(Compile_lock, THREAD); // for vtables | |
343 // Ensure atomic creation of higher dimensions | |
344 MutexLocker mu(MultiArray_lock, THREAD); | |
345 | |
346 // Check if another thread beat us | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
347 if (higher_dimension() == NULL) { |
0 | 348 |
349 // Create multi-dim klass object and link them together | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
350 Klass* k = |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
351 ObjArrayKlass::allocate_objArray_klass(class_loader_data(), dim + 1, this, CHECK_NULL); |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
352 ObjArrayKlass* ak = ObjArrayKlass::cast(k); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
353 ak->set_lower_dimension(this); |
2119 | 354 OrderAccess::storestore(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
355 set_higher_dimension(ak); |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
356 assert(ak->oop_is_objArray(), "incorrect initialization of ObjArrayKlass"); |
0 | 357 } |
358 } | |
359 } else { | |
360 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); | |
361 } | |
362 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
363 ObjArrayKlass *ak = ObjArrayKlass::cast(higher_dimension()); |
0 | 364 if (or_null) { |
365 return ak->array_klass_or_null(n); | |
366 } | |
367 return ak->array_klass(n, CHECK_NULL); | |
368 } | |
369 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
370 Klass* ObjArrayKlass::array_klass_impl(bool or_null, TRAPS) { |
0 | 371 return array_klass_impl(or_null, dimension() + 1, CHECK_NULL); |
372 } | |
373 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
374 bool ObjArrayKlass::can_be_primary_super_slow() const { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
375 if (!bottom_klass()->can_be_primary_super()) |
0 | 376 // array of interfaces |
377 return false; | |
378 else | |
379 return Klass::can_be_primary_super_slow(); | |
380 } | |
381 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
382 GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slots) { |
0 | 383 // interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... }; |
6983 | 384 Array<Klass*>* elem_supers = element_klass()->secondary_supers(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
385 int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length(); |
0 | 386 int num_secondaries = num_extra_slots + 2 + num_elem_supers; |
387 if (num_secondaries == 2) { | |
388 // Must share this for correct bootstrapping! | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
389 set_secondary_supers(Universe::the_array_interfaces_array()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
390 return NULL; |
0 | 391 } else { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
392 GrowableArray<Klass*>* secondaries = new GrowableArray<Klass*>(num_elem_supers+2); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
393 secondaries->push(SystemDictionary::Cloneable_klass()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
394 secondaries->push(SystemDictionary::Serializable_klass()); |
0 | 395 for (int i = 0; i < num_elem_supers; i++) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
396 Klass* elem_super = (Klass*) elem_supers->at(i); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
397 Klass* array_super = elem_super->array_klass_or_null(); |
0 | 398 assert(array_super != NULL, "must already have been created"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
399 secondaries->push(array_super); |
0 | 400 } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
401 return secondaries; |
0 | 402 } |
403 } | |
404 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
405 bool ObjArrayKlass::compute_is_subtype_of(Klass* k) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
406 if (!k->oop_is_objArray()) |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
407 return ArrayKlass::compute_is_subtype_of(k); |
0 | 408 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
409 ObjArrayKlass* oak = ObjArrayKlass::cast(k); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
410 return element_klass()->is_subtype_of(oak->element_klass()); |
0 | 411 } |
412 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
413 void ObjArrayKlass::initialize(TRAPS) { |
6983 | 414 bottom_klass()->initialize(THREAD); // dispatches to either InstanceKlass or TypeArrayKlass |
0 | 415 } |
416 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
417 #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
|
418 { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
419 T* p = (T*)(a)->base(); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
420 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
|
421 while (p < end) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
422 do_oop; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
423 p++; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
424 } \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
425 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
426 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
427 #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
|
428 { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
429 T* const l = (T*)(low); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
430 T* const h = (T*)(high); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
431 T* p = (T*)(a)->base(); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
432 T* end = p + (a)->length(); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
433 if (p < l) p = l; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
434 if (end > h) end = h; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
435 while (p < end) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
436 do_oop; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
437 ++p; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
438 } \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
439 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
440 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
441 #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
|
442 if (UseCompressedOops) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
443 ObjArrayKlass_SPECIALIZED_OOP_ITERATE(narrowOop, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
444 a, p, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
445 } else { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
446 ObjArrayKlass_SPECIALIZED_OOP_ITERATE(oop, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
447 a, p, do_oop) \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
448 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
449 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
450 #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
|
451 if (UseCompressedOops) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
452 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
|
453 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
|
454 } else { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
455 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
|
456 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
|
457 } |
0 | 458 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
459 void ObjArrayKlass::oop_follow_contents(oop obj) { |
0 | 460 assert (obj->is_array(), "obj must be array"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
461 MarkSweep::follow_klass(obj->klass()); |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
462 if (UseCompressedOops) { |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
463 objarray_follow_contents<narrowOop>(obj, 0); |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
464 } else { |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
465 objarray_follow_contents<oop>(obj, 0); |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
466 } |
0 | 467 } |
468 | |
469 #ifndef SERIALGC | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
470 void ObjArrayKlass::oop_follow_contents(ParCompactionManager* cm, |
0 | 471 oop obj) { |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
472 assert(obj->is_array(), "obj must be array"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
473 PSParallelCompact::follow_klass(cm, obj->klass()); |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
474 if (UseCompressedOops) { |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
475 objarray_follow_contents<narrowOop>(cm, obj, 0); |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
476 } else { |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
477 objarray_follow_contents<oop>(cm, obj, 0); |
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1155
diff
changeset
|
478 } |
0 | 479 } |
480 #endif // SERIALGC | |
481 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
482 #define if_do_metadata_checked(closure, nv_suffix) \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
483 /* Make sure the non-virtual and the virtual versions match. */ \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
484 assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
485 "Inconsistency in do_metadata"); \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
486 if (closure->do_metadata##nv_suffix()) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
487 |
0 | 488 #define ObjArrayKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ |
489 \ | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
490 int ObjArrayKlass::oop_oop_iterate##nv_suffix(oop obj, \ |
0 | 491 OopClosureType* closure) { \ |
492 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \ | |
493 assert (obj->is_array(), "obj must be array"); \ | |
494 objArrayOop a = objArrayOop(obj); \ | |
495 /* Get size before changing pointers. */ \ | |
496 /* Don't call size() or oop_size() since that is a virtual call. */ \ | |
497 int size = a->object_size(); \ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
498 if_do_metadata_checked(closure, nv_suffix) { \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
499 closure->do_klass##nv_suffix(obj->klass()); \ |
0 | 500 } \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
501 ObjArrayKlass_OOP_ITERATE(a, p, (closure)->do_oop##nv_suffix(p)) \ |
0 | 502 return size; \ |
503 } | |
504 | |
505 #define ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ | |
506 \ | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
507 int ObjArrayKlass::oop_oop_iterate##nv_suffix##_m(oop obj, \ |
0 | 508 OopClosureType* closure, \ |
509 MemRegion mr) { \ | |
510 SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \ | |
511 assert(obj->is_array(), "obj must be array"); \ | |
512 objArrayOop a = objArrayOop(obj); \ | |
513 /* Get size before changing pointers. */ \ | |
514 /* Don't call size() or oop_size() since that is a virtual call */ \ | |
515 int size = a->object_size(); \ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
516 if_do_metadata_checked(closure, nv_suffix) { \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
517 /* SSS: Do we need to pass down mr here? */ \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
518 closure->do_klass##nv_suffix(a->klass()); \ |
0 | 519 } \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
520 ObjArrayKlass_BOUNDED_OOP_ITERATE( \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
521 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
|
522 return size; \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
523 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
524 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
525 // 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
|
526 // for objArrayOops. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
527 #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
|
528 \ |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
529 int ObjArrayKlass::oop_oop_iterate_range##nv_suffix(oop obj, \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
530 OopClosureType* closure, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
531 int start, int end) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
532 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
|
533 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
|
534 objArrayOop a = objArrayOop(obj); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
535 /* Get size before changing pointers. */ \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
536 /* 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
|
537 int size = a->object_size(); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
538 if (UseCompressedOops) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
539 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
|
540 /* 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
|
541 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
|
542 MemRegion mr(low, high); \ |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
543 if_do_metadata_checked(closure, nv_suffix) { \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
544 /* SSS: Do we need to pass down mr here? */ \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
545 closure->do_klass##nv_suffix(a->klass()); \ |
0 | 546 } \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
547 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
|
548 a, p, low, high, (closure)->do_oop##nv_suffix(p)) \ |
0 | 549 } else { \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
550 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
|
551 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
|
552 MemRegion mr(low, high); \ |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
553 if_do_metadata_checked(closure, nv_suffix) { \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
554 /* SSS: Do we need to pass down mr here? */ \ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
555 closure->do_klass##nv_suffix(a->klass()); \ |
0 | 556 } \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
557 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
|
558 a, p, low, high, (closure)->do_oop##nv_suffix(p)) \ |
0 | 559 } \ |
560 return size; \ | |
561 } | |
562 | |
563 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
|
564 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN) |
0 | 565 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
|
566 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
|
567 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
|
568 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r) |
0 | 569 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
570 int ObjArrayKlass::oop_adjust_pointers(oop obj) { |
0 | 571 assert(obj->is_objArray(), "obj must be obj array"); |
572 objArrayOop a = objArrayOop(obj); | |
573 // Get size before changing pointers. | |
574 // Don't call size() or oop_size() since that is a virtual call. | |
575 int size = a->object_size(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
576 MarkSweep::adjust_klass(a->klass()); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
577 ObjArrayKlass_OOP_ITERATE(a, p, MarkSweep::adjust_pointer(p)) |
0 | 578 return size; |
579 } | |
580 | |
581 #ifndef SERIALGC | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
582 void ObjArrayKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
0 | 583 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
|
584 ObjArrayKlass_OOP_ITERATE( \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
585 objArrayOop(obj), p, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
586 if (PSScavenge::should_scavenge(p)) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
587 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
|
588 }) |
0 | 589 } |
590 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
591 int ObjArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
0 | 592 assert (obj->is_objArray(), "obj must be obj array"); |
593 objArrayOop a = objArrayOop(obj); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
594 int size = a->object_size(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
595 a->update_header(cm); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
596 ObjArrayKlass_OOP_ITERATE(a, p, PSParallelCompact::adjust_pointer(p)) |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
597 return size; |
0 | 598 } |
599 #endif // SERIALGC | |
600 | |
601 // JVM support | |
602 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
603 jint ObjArrayKlass::compute_modifier_flags(TRAPS) const { |
0 | 604 // The modifier for an objectArray is the same as its element |
605 if (element_klass() == NULL) { | |
606 assert(Universe::is_bootstrapping(), "partial objArray only at startup"); | |
607 return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; | |
608 } | |
398
443791f333a2
6700107: java/lang/Class/forName/TooManyDimensions.java crashes with SIGSEGV in c2 compiler with fastdebug
coleenp
parents:
356
diff
changeset
|
609 // Return the flags of the bottom element type. |
6983 | 610 jint element_flags = bottom_klass()->compute_modifier_flags(CHECK_0); |
0 | 611 |
612 return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED)) | |
613 | (JVM_ACC_ABSTRACT | JVM_ACC_FINAL); | |
614 } | |
615 | |
616 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
617 // Printing |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
618 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
619 void ObjArrayKlass::print_on(outputStream* st) const { |
0 | 620 #ifndef PRODUCT |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
621 Klass::print_on(st); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
622 st->print(" - instance klass: "); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
623 element_klass()->print_value_on(st); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
624 st->cr(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
625 #endif //PRODUCT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
626 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
627 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
628 void ObjArrayKlass::print_value_on(outputStream* st) const { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
629 assert(is_klass(), "must be klass"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
630 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
631 element_klass()->print_value_on(st); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
632 st->print("[]"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
633 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
634 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
635 #ifndef PRODUCT |
0 | 636 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
637 void ObjArrayKlass::oop_print_on(oop obj, outputStream* st) { |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
638 ArrayKlass::oop_print_on(obj, st); |
0 | 639 assert(obj->is_objArray(), "must be objArray"); |
640 objArrayOop oa = objArrayOop(obj); | |
641 int print_len = MIN2((intx) oa->length(), MaxElementPrintSize); | |
642 for(int index = 0; index < print_len; index++) { | |
643 st->print(" - %3d : ", index); | |
644 oa->obj_at(index)->print_value_on(st); | |
645 st->cr(); | |
646 } | |
647 int remaining = oa->length() - print_len; | |
648 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
|
649 st->print_cr(" - <%d more elements, increase MaxElementPrintSize to print>", remaining); |
0 | 650 } |
651 } | |
652 | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1142
diff
changeset
|
653 #endif //PRODUCT |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1142
diff
changeset
|
654 |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
655 static int max_objArray_print_length = 4; |
0 | 656 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
657 void ObjArrayKlass::oop_print_value_on(oop obj, outputStream* st) { |
0 | 658 assert(obj->is_objArray(), "must be objArray"); |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
659 st->print("a "); |
0 | 660 element_klass()->print_value_on(st); |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
661 int len = objArrayOop(obj)->length(); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
662 st->print("[%d] ", len); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
663 obj->print_address_on(st); |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1142
diff
changeset
|
664 if (NOT_PRODUCT(PrintOopAddress ||) PrintMiscellaneous && (WizardMode || Verbose)) { |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
665 st->print("{"); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
666 for (int i = 0; i < len; i++) { |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
667 if (i > max_objArray_print_length) { |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
668 st->print("..."); break; |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
669 } |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
670 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
|
671 } |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
672 st->print(" }"); |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
398
diff
changeset
|
673 } |
0 | 674 } |
675 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
676 const char* ObjArrayKlass::internal_name() const { |
0 | 677 return external_name(); |
678 } | |
679 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
680 |
0 | 681 // Verification |
682 | |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
683 void ObjArrayKlass::verify_on(outputStream* st) { |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
684 ArrayKlass::verify_on(st); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
685 guarantee(element_klass()->is_metadata(), "should be in metaspace"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
686 guarantee(element_klass()->is_klass(), "should be klass"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
687 guarantee(bottom_klass()->is_metadata(), "should be in metaspace"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
688 guarantee(bottom_klass()->is_klass(), "should be klass"); |
6983 | 689 Klass* bk = bottom_klass(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
690 guarantee(bk->oop_is_instance() || bk->oop_is_typeArray(), "invalid bottom klass"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
691 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6008
diff
changeset
|
692 |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
693 void ObjArrayKlass::oop_verify_on(oop obj, outputStream* st) { |
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
694 ArrayKlass::oop_verify_on(obj, st); |
0 | 695 guarantee(obj->is_objArray(), "must be objArray"); |
696 objArrayOop oa = objArrayOop(obj); | |
697 for(int index = 0; index < oa->length(); index++) { | |
698 guarantee(oa->obj_at(index)->is_oop_or_null(), "should be oop"); | |
699 } | |
700 } |