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