author | stefank |
Mon, 01 Oct 2012 13:29:11 +0200 | |
changeset 13922 | ab7d352debe6 |
parent 13728 | 882756847a04 |
child 13961 | aeaa21c167d1 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
12114
9a825a536095
7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
sspitsyn
parents:
8297
diff
changeset
|
2 |
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
26 |
#include "classfile/symbolTable.hpp" |
7397 | 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" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
32 |
#include "memory/metadataFactory.hpp" |
7397 | 33 |
#include "memory/resourceArea.hpp" |
34 |
#include "memory/universe.inline.hpp" |
|
35 |
#include "oops/instanceKlass.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
36 |
#include "oops/klass.inline.hpp" |
7397 | 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" |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7890
diff
changeset
|
42 |
#include "oops/symbol.hpp" |
7397 | 43 |
#include "runtime/handles.inline.hpp" |
44 |
#include "runtime/mutexLocker.hpp" |
|
45 |
#include "utilities/copy.hpp" |
|
46 |
#ifndef SERIALGC |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
47 |
#include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp" |
7397 | 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 |
|
1 | 58 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
59 |
objArrayKlass* objArrayKlass::allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
60 |
assert(objArrayKlass::header_size() <= InstanceKlass::header_size(), |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
61 |
"array klasses must be same size as InstanceKlass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
62 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
63 |
int size = arrayKlass::static_size(objArrayKlass::header_size()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
64 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
65 |
return new (loader_data, size, THREAD) objArrayKlass(n, klass_handle, name); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
66 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
67 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
68 |
Klass* objArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
69 |
int n, KlassHandle element_klass, TRAPS) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
70 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
71 |
// Eagerly allocate the direct array supertype. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
72 |
KlassHandle super_klass = KlassHandle(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
73 |
if (!Universe::is_bootstrapping() || SystemDictionary::Object_klass_loaded()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
74 |
KlassHandle element_super (THREAD, element_klass->super()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
75 |
if (element_super.not_null()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
76 |
// The element type has a direct super. E.g., String[] has direct super of Object[]. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
77 |
super_klass = KlassHandle(THREAD, element_super->array_klass_or_null()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
78 |
bool supers_exist = super_klass.not_null(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
79 |
// Also, see if the element has secondary supertypes. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
80 |
// We need an array type for each. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
81 |
Array<Klass*>* element_supers = element_klass->secondary_supers(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
82 |
for( int i = element_supers->length()-1; i >= 0; i-- ) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
83 |
Klass* elem_super = element_supers->at(i); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
84 |
if (Klass::cast(elem_super)->array_klass_or_null() == NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
85 |
supers_exist = false; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
86 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
87 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
88 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
89 |
if (!supers_exist) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
90 |
// Oops. Not allocated yet. Back out, allocate it, and retry. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
91 |
#ifndef PRODUCT |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
92 |
if (WizardMode) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
93 |
tty->print_cr("Must retry array klass creation for depth %d",n); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
94 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
95 |
#endif |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
96 |
KlassHandle ek; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
97 |
{ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
98 |
MutexUnlocker mu(MultiArray_lock); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
99 |
MutexUnlocker mc(Compile_lock); // for vtables |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
100 |
Klass* sk = element_super->array_klass(CHECK_0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
101 |
super_klass = KlassHandle(THREAD, sk); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
102 |
for( int i = element_supers->length()-1; i >= 0; i-- ) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
103 |
KlassHandle elem_super (THREAD, element_supers->at(i)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
104 |
elem_super->array_klass(CHECK_0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
105 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
106 |
// Now retry from the beginning |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
107 |
Klass* klass_oop = element_klass->array_klass(n, CHECK_0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
108 |
// Create a handle because the enclosing brace, when locking |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
109 |
// can cause a gc. Better to have this function return a Handle. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
110 |
ek = KlassHandle(THREAD, klass_oop); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
111 |
} // re-lock |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
112 |
return ek(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
113 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
114 |
} else { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
115 |
// The element type is already Object. Object[] has direct super of Object. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
116 |
super_klass = KlassHandle(THREAD, SystemDictionary::Object_klass()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
117 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
118 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
119 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
120 |
// Create type name for klass. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
121 |
Symbol* name = NULL; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
122 |
if (!element_klass->oop_is_instance() || |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
123 |
(name = InstanceKlass::cast(element_klass())->array_name()) == NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
124 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
125 |
ResourceMark rm(THREAD); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
126 |
char *name_str = element_klass->name()->as_C_string(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
127 |
int len = element_klass->name()->utf8_length(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
128 |
char *new_str = NEW_RESOURCE_ARRAY(char, len + 4); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
129 |
int idx = 0; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
130 |
new_str[idx++] = '['; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
131 |
if (element_klass->oop_is_instance()) { // it could be an array or simple type |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
132 |
new_str[idx++] = 'L'; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
133 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
134 |
memcpy(&new_str[idx], name_str, len * sizeof(char)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
135 |
idx += len; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
136 |
if (element_klass->oop_is_instance()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
137 |
new_str[idx++] = ';'; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
138 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
139 |
new_str[idx++] = '\0'; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
140 |
name = SymbolTable::new_permanent_symbol(new_str, CHECK_0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
141 |
if (element_klass->oop_is_instance()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
142 |
InstanceKlass* ik = InstanceKlass::cast(element_klass()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
143 |
ik->set_array_name(name); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
144 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
145 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
146 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
147 |
// Initialize instance variables |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
148 |
objArrayKlass* oak = objArrayKlass::allocate(loader_data, n, element_klass, name, CHECK_0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
149 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
150 |
// Add all classes to our internal class loader list here, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
151 |
// including classes in the bootstrap (NULL) class loader. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
152 |
// GC walks these as strong roots. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
153 |
loader_data->add_class(oak); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
154 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
155 |
// Call complete_create_array_klass after all instance variables has been initialized. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
156 |
arrayKlass::complete_create_array_klass(oak, super_klass, CHECK_0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
157 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
158 |
return oak; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
159 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
160 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
161 |
objArrayKlass::objArrayKlass(int n, KlassHandle element_klass, Symbol* name) : arrayKlass(name) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
162 |
this->set_dimension(n); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
163 |
this->set_element_klass(element_klass()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
164 |
// decrement refcount because object arrays are not explicitly freed. The |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
165 |
// InstanceKlass array_name() keeps the name counted while the klass is |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
166 |
// loaded. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
167 |
name->decrement_refcount(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
168 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
169 |
Klass* bk; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
170 |
if (element_klass->oop_is_objArray()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
171 |
bk = objArrayKlass::cast(element_klass())->bottom_klass(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
172 |
} else { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
173 |
bk = element_klass(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
174 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
175 |
assert(bk != NULL && (Klass::cast(bk)->oop_is_instance() || Klass::cast(bk)->oop_is_typeArray()), "invalid bottom klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
176 |
this->set_bottom_klass(bk); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
177 |
this->set_class_loader_data(bk->class_loader_data()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
178 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
179 |
this->set_layout_helper(array_layout_helper(T_OBJECT)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
180 |
assert(this->oop_is_array(), "sanity"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
181 |
assert(this->oop_is_objArray(), "sanity"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
182 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
183 |
|
1 | 184 |
int objArrayKlass::oop_size(oop obj) const { |
185 |
assert(obj->is_objArray(), "must be object array"); |
|
186 |
return objArrayOop(obj)->object_size(); |
|
187 |
} |
|
188 |
||
189 |
objArrayOop objArrayKlass::allocate(int length, TRAPS) { |
|
190 |
if (length >= 0) { |
|
191 |
if (length <= arrayOopDesc::max_array_length(T_OBJECT)) { |
|
192 |
int size = objArrayOopDesc::object_size(length); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
193 |
KlassHandle h_k(THREAD, this); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
194 |
return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, CHECK_NULL); |
1 | 195 |
} else { |
3576
4ceec8fb3e18
6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit
martin
parents:
2332
diff
changeset
|
196 |
report_java_out_of_memory("Requested array size exceeds VM limit"); |
12114
9a825a536095
7123170: JCK vm/jvmti/ResourceExhausted/resexh001/resexh00101/ tests fails since 7u4 b02
sspitsyn
parents:
8297
diff
changeset
|
197 |
JvmtiExport::post_array_size_exhausted(); |
1 | 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 |
||
207 |
oop objArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) { |
|
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++) { |
|
218 |
arrayKlass* ak = arrayKlass::cast(h_lower_dimension()); |
|
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 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
237 |
// Either oop or narrowOop depending on UseCompressedOops. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
238 |
template <class T> void objArrayKlass::do_copy(arrayOop s, T* src, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
239 |
arrayOop d, T* dst, int length, TRAPS) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
240 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
241 |
BarrierSet* bs = Universe::heap()->barrier_set(); |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
242 |
// For performance reasons, we assume we are that the write barrier we |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
243 |
// are using has optimized modes for arrays of references. At least one |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
244 |
// of the asserts below will fail if this is not the case. |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
245 |
assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
246 |
assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well."); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
247 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
248 |
if (s == d) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
249 |
// since source and destination are equal we do not need conversion checks. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
250 |
assert(length > 0, "sanity check"); |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
2332
diff
changeset
|
251 |
bs->write_ref_array_pre(dst, length); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
252 |
Copy::conjoint_oops_atomic(src, dst, length); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
253 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
254 |
// We have to make sure all elements conform to the destination array |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
255 |
Klass* bound = objArrayKlass::cast(d->klass())->element_klass(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
256 |
Klass* stype = objArrayKlass::cast(s->klass())->element_klass(); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
257 |
if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
258 |
// elements are guaranteed to be subtypes, so no check necessary |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
2332
diff
changeset
|
259 |
bs->write_ref_array_pre(dst, length); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
260 |
Copy::conjoint_oops_atomic(src, dst, length); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
261 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
262 |
// slow case: need individual subtype checks |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
263 |
// note: don't use obj_at_put below because it includes a redundant store check |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
264 |
T* from = src; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
265 |
T* end = from + length; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
266 |
for (T* p = dst; from < end; from++, p++) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
267 |
// XXX this is going to be slow. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
268 |
T element = *from; |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
269 |
// even slower now |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
270 |
bool element_is_null = oopDesc::is_null(element); |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
271 |
oop new_val = element_is_null ? oop(NULL) |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
272 |
: oopDesc::decode_heap_oop_not_null(element); |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
273 |
if (element_is_null || |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
274 |
Klass::cast((new_val->klass()))->is_subtype_of(bound)) { |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
275 |
bs->write_ref_field_pre(p, new_val); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
276 |
*p = *from; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
277 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
278 |
// We must do a barrier to cover the partial copy. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
279 |
const size_t pd = pointer_delta(p, dst, (size_t)heapOopSize); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
280 |
// pointer delta is scaled to number of elements (length field in |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
281 |
// objArrayOop) which we assume is 32 bit. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
282 |
assert(pd == (size_t)(int)pd, "length field overflow"); |
4461
c17c526d36ef
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
3579
diff
changeset
|
283 |
bs->write_ref_array((HeapWord*)dst, pd); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
284 |
THROW(vmSymbols::java_lang_ArrayStoreException()); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
285 |
return; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
286 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
287 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
288 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
289 |
} |
4461
c17c526d36ef
6906727: UseCompressedOops: some card-marking fixes related to object arrays
ysr
parents:
3579
diff
changeset
|
290 |
bs->write_ref_array((HeapWord*)dst, length); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
291 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
292 |
|
1 | 293 |
void objArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, |
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 |
} |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
318 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
319 |
narrowOop* const src = objArrayOop(s)->obj_at_addr<narrowOop>(src_pos); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
320 |
narrowOop* const dst = objArrayOop(d)->obj_at_addr<narrowOop>(dst_pos); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
321 |
do_copy<narrowOop>(s, src, d, dst, length, CHECK); |
1 | 322 |
} else { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
323 |
oop* const src = objArrayOop(s)->obj_at_addr<oop>(src_pos); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
324 |
oop* const dst = objArrayOop(d)->obj_at_addr<oop>(dst_pos); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
325 |
do_copy<oop> (s, src, d, dst, length, CHECK); |
1 | 326 |
} |
327 |
} |
|
328 |
||
329 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
330 |
Klass* objArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) { |
1 | 331 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
332 |
assert(dimension() <= n, "check order of chain"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
333 |
int dim = dimension(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
334 |
if (dim == n) return this; |
1 | 335 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
336 |
if (higher_dimension() == NULL) { |
1 | 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 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
347 |
if (higher_dimension() == NULL) { |
1 | 348 |
|
349 |
// Create multi-dim klass object and link them together |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
350 |
Klass* k = |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
351 |
objArrayKlass::allocate_objArray_klass(class_loader_data(), dim + 1, this, CHECK_NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
352 |
objArrayKlass* ak = objArrayKlass::cast(k); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
353 |
ak->set_lower_dimension(this); |
7890 | 354 |
OrderAccess::storestore(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
355 |
set_higher_dimension(ak); |
1 | 356 |
assert(ak->oop_is_objArray(), "incorrect initialization of objArrayKlass"); |
357 |
} |
|
358 |
} |
|
359 |
} else { |
|
360 |
CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); |
|
361 |
} |
|
362 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
363 |
objArrayKlass *ak = objArrayKlass::cast(higher_dimension()); |
1 | 364 |
if (or_null) { |
365 |
return ak->array_klass_or_null(n); |
|
366 |
} |
|
367 |
return ak->array_klass(n, CHECK_NULL); |
|
368 |
} |
|
369 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
370 |
Klass* objArrayKlass::array_klass_impl(bool or_null, TRAPS) { |
1 | 371 |
return array_klass_impl(or_null, dimension() + 1, CHECK_NULL); |
372 |
} |
|
373 |
||
374 |
bool objArrayKlass::can_be_primary_super_slow() const { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
375 |
if (!bottom_klass()->can_be_primary_super()) |
1 | 376 |
// array of interfaces |
377 |
return false; |
|
378 |
else |
|
379 |
return Klass::can_be_primary_super_slow(); |
|
380 |
} |
|
381 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
382 |
GrowableArray<Klass*>* objArrayKlass::compute_secondary_supers(int num_extra_slots) { |
1 | 383 |
// interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... }; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
384 |
Array<Klass*>* elem_supers = Klass::cast(element_klass())->secondary_supers(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
385 |
int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length(); |
1 | 386 |
int num_secondaries = num_extra_slots + 2 + num_elem_supers; |
387 |
if (num_secondaries == 2) { |
|
388 |
// Must share this for correct bootstrapping! |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
389 |
set_secondary_supers(Universe::the_array_interfaces_array()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
390 |
return NULL; |
1 | 391 |
} else { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
392 |
GrowableArray<Klass*>* secondaries = new GrowableArray<Klass*>(num_elem_supers+2); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
393 |
secondaries->push(SystemDictionary::Cloneable_klass()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
394 |
secondaries->push(SystemDictionary::Serializable_klass()); |
1 | 395 |
for (int i = 0; i < num_elem_supers; i++) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
396 |
Klass* elem_super = (Klass*) elem_supers->at(i); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
397 |
Klass* array_super = elem_super->array_klass_or_null(); |
1 | 398 |
assert(array_super != NULL, "must already have been created"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
399 |
secondaries->push(array_super); |
1 | 400 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
401 |
return secondaries; |
1 | 402 |
} |
403 |
} |
|
404 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
405 |
bool objArrayKlass::compute_is_subtype_of(Klass* k) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
406 |
if (!k->oop_is_objArray()) |
1 | 407 |
return arrayKlass::compute_is_subtype_of(k); |
408 |
||
409 |
objArrayKlass* oak = objArrayKlass::cast(k); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
410 |
return element_klass()->is_subtype_of(oak->element_klass()); |
1 | 411 |
} |
412 |
||
413 |
void objArrayKlass::initialize(TRAPS) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
414 |
Klass::cast(bottom_klass())->initialize(THREAD); // dispatches to either InstanceKlass or typeArrayKlass |
1 | 415 |
} |
416 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
417 |
#define ObjArrayKlass_SPECIALIZED_OOP_ITERATE(T, a, p, do_oop) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
418 |
{ \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
419 |
T* p = (T*)(a)->base(); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
420 |
T* const end = p + (a)->length(); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
421 |
while (p < end) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
422 |
do_oop; \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
423 |
p++; \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
424 |
} \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
425 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
426 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
427 |
#define ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(T, a, p, low, high, do_oop) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
428 |
{ \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
429 |
T* const l = (T*)(low); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
430 |
T* const h = (T*)(high); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
431 |
T* p = (T*)(a)->base(); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
432 |
T* end = p + (a)->length(); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
433 |
if (p < l) p = l; \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
434 |
if (end > h) end = h; \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
435 |
while (p < end) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
436 |
do_oop; \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
437 |
++p; \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
438 |
} \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
439 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
440 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
441 |
#define ObjArrayKlass_OOP_ITERATE(a, p, do_oop) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
442 |
if (UseCompressedOops) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
443 |
ObjArrayKlass_SPECIALIZED_OOP_ITERATE(narrowOop, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
444 |
a, p, do_oop) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
445 |
} else { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
446 |
ObjArrayKlass_SPECIALIZED_OOP_ITERATE(oop, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
447 |
a, p, do_oop) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
448 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
449 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
450 |
#define ObjArrayKlass_BOUNDED_OOP_ITERATE(a, p, low, high, do_oop) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
451 |
if (UseCompressedOops) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
452 |
ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
453 |
a, p, low, high, do_oop) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
454 |
} else { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
455 |
ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
456 |
a, p, low, high, do_oop) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
457 |
} |
1 | 458 |
|
459 |
void objArrayKlass::oop_follow_contents(oop obj) { |
|
460 |
assert (obj->is_array(), "obj must be array"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
461 |
MarkSweep::follow_klass(obj->klass()); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
462 |
if (UseCompressedOops) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
463 |
objarray_follow_contents<narrowOop>(obj, 0); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
464 |
} else { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
465 |
objarray_follow_contents<oop>(obj, 0); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
466 |
} |
1 | 467 |
} |
468 |
||
469 |
#ifndef SERIALGC |
|
470 |
void objArrayKlass::oop_follow_contents(ParCompactionManager* cm, |
|
471 |
oop obj) { |
|
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
472 |
assert(obj->is_array(), "obj must be array"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
473 |
PSParallelCompact::follow_klass(cm, obj->klass()); |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
474 |
if (UseCompressedOops) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
475 |
objarray_follow_contents<narrowOop>(cm, obj, 0); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
476 |
} else { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
477 |
objarray_follow_contents<oop>(cm, obj, 0); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
4584
diff
changeset
|
478 |
} |
1 | 479 |
} |
480 |
#endif // SERIALGC |
|
481 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
482 |
#define if_do_metadata_checked(closure, nv_suffix) \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
483 |
/* Make sure the non-virtual and the virtual versions match. */ \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
484 |
assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
485 |
"Inconsistency in do_metadata"); \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
486 |
if (closure->do_metadata##nv_suffix()) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
487 |
|
1 | 488 |
#define ObjArrayKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ |
489 |
\ |
|
490 |
int objArrayKlass::oop_oop_iterate##nv_suffix(oop obj, \ |
|
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(); \ |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
498 |
if_do_metadata_checked(closure, nv_suffix) { \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
499 |
closure->do_klass##nv_suffix(obj->klass()); \ |
1 | 500 |
} \ |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
501 |
ObjArrayKlass_OOP_ITERATE(a, p, (closure)->do_oop##nv_suffix(p)) \ |
1 | 502 |
return size; \ |
503 |
} |
|
504 |
||
505 |
#define ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ |
|
506 |
\ |
|
507 |
int objArrayKlass::oop_oop_iterate##nv_suffix##_m(oop obj, \ |
|
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(); \ |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
516 |
if_do_metadata_checked(closure, nv_suffix) { \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
517 |
/* SSS: Do we need to pass down mr here? */ \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
518 |
closure->do_klass##nv_suffix(a->klass()); \ |
1 | 519 |
} \ |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
520 |
ObjArrayKlass_BOUNDED_OOP_ITERATE( \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
521 |
a, p, mr.start(), mr.end(), (closure)->do_oop##nv_suffix(p)) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
522 |
return size; \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
523 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
524 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
525 |
// Like oop_oop_iterate but only iterates over a specified range and only used |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
526 |
// for objArrayOops. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
527 |
#define ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r(OopClosureType, nv_suffix) \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
528 |
\ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
529 |
int objArrayKlass::oop_oop_iterate_range##nv_suffix(oop obj, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
530 |
OopClosureType* closure, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
531 |
int start, int end) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
532 |
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
533 |
assert(obj->is_array(), "obj must be array"); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
534 |
objArrayOop a = objArrayOop(obj); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
535 |
/* Get size before changing pointers. */ \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
536 |
/* Don't call size() or oop_size() since that is a virtual call */ \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
537 |
int size = a->object_size(); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
538 |
if (UseCompressedOops) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
539 |
HeapWord* low = start == 0 ? (HeapWord*)a : (HeapWord*)a->obj_at_addr<narrowOop>(start);\ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
540 |
/* this might be wierd if end needs to be aligned on HeapWord boundary */ \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
541 |
HeapWord* high = (HeapWord*)((narrowOop*)a->base() + end); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
542 |
MemRegion mr(low, high); \ |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
543 |
if_do_metadata_checked(closure, nv_suffix) { \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
544 |
/* SSS: Do we need to pass down mr here? */ \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
545 |
closure->do_klass##nv_suffix(a->klass()); \ |
1 | 546 |
} \ |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
547 |
ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
548 |
a, p, low, high, (closure)->do_oop##nv_suffix(p)) \ |
1 | 549 |
} else { \ |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
550 |
HeapWord* low = start == 0 ? (HeapWord*)a : (HeapWord*)a->obj_at_addr<oop>(start); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
551 |
HeapWord* high = (HeapWord*)((oop*)a->base() + end); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
552 |
MemRegion mr(low, high); \ |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
553 |
if_do_metadata_checked(closure, nv_suffix) { \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
554 |
/* SSS: Do we need to pass down mr here? */ \ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
555 |
closure->do_klass##nv_suffix(a->klass()); \ |
1 | 556 |
} \ |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
557 |
ObjArrayKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
558 |
a, p, low, high, (closure)->do_oop##nv_suffix(p)) \ |
1 | 559 |
} \ |
560 |
return size; \ |
|
561 |
} |
|
562 |
||
563 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DEFN) |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
564 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN) |
1 | 565 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m) |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
566 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m) |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
567 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r) |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
568 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r) |
1 | 569 |
|
570 |
int objArrayKlass::oop_adjust_pointers(oop obj) { |
|
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(); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
576 |
MarkSweep::adjust_klass(a->klass()); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
577 |
ObjArrayKlass_OOP_ITERATE(a, p, MarkSweep::adjust_pointer(p)) |
1 | 578 |
return size; |
579 |
} |
|
580 |
||
581 |
#ifndef SERIALGC |
|
582 |
void objArrayKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
|
583 |
assert(obj->is_objArray(), "obj must be obj array"); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
584 |
ObjArrayKlass_OOP_ITERATE( \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
585 |
objArrayOop(obj), p, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
586 |
if (PSScavenge::should_scavenge(p)) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
587 |
pm->claim_or_forward_depth(p); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
588 |
}) |
1 | 589 |
} |
590 |
||
591 |
int objArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
|
592 |
assert (obj->is_objArray(), "obj must be obj array"); |
|
593 |
objArrayOop a = objArrayOop(obj); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
594 |
int size = a->object_size(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
595 |
a->update_header(cm); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
596 |
ObjArrayKlass_OOP_ITERATE(a, p, PSParallelCompact::adjust_pointer(p)) |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
597 |
return size; |
1 | 598 |
} |
599 |
#endif // SERIALGC |
|
600 |
||
601 |
// JVM support |
|
602 |
||
603 |
jint objArrayKlass::compute_modifier_flags(TRAPS) const { |
|
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 |
} |
|
1430
16aa7ef1ffa1
6700107: java/lang/Class/forName/TooManyDimensions.java crashes with SIGSEGV in c2 compiler with fastdebug
coleenp
parents:
1388
diff
changeset
|
609 |
// Return the flags of the bottom element type. |
16aa7ef1ffa1
6700107: java/lang/Class/forName/TooManyDimensions.java crashes with SIGSEGV in c2 compiler with fastdebug
coleenp
parents:
1388
diff
changeset
|
610 |
jint element_flags = Klass::cast(bottom_klass())->compute_modifier_flags(CHECK_0); |
1 | 611 |
|
612 |
return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED)) |
|
613 |
| (JVM_ACC_ABSTRACT | JVM_ACC_FINAL); |
|
614 |
} |
|
615 |
||
616 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
617 |
// Printing |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
618 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
619 |
void objArrayKlass::print_on(outputStream* st) const { |
1 | 620 |
#ifndef PRODUCT |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
621 |
Klass::print_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
622 |
st->print(" - instance klass: "); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
623 |
element_klass()->print_value_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
624 |
st->cr(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
625 |
#endif //PRODUCT |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
626 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
627 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
628 |
void objArrayKlass::print_value_on(outputStream* st) const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
629 |
assert(is_klass(), "must be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
630 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
631 |
element_klass()->print_value_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
632 |
st->print("[]"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
633 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
634 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
635 |
#ifndef PRODUCT |
1 | 636 |
|
637 |
void objArrayKlass::oop_print_on(oop obj, outputStream* st) { |
|
638 |
arrayKlass::oop_print_on(obj, st); |
|
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) { |
|
13922
ab7d352debe6
8000227: [obj|type]ArrayKlass::oop_print_on prints one line to tty instead of the provided output stream
stefank
parents:
13728
diff
changeset
|
649 |
st->print_cr(" - <%d more elements, increase MaxElementPrintSize to print>", remaining); |
1 | 650 |
} |
651 |
} |
|
652 |
||
4584
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
4571
diff
changeset
|
653 |
#endif //PRODUCT |
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
4571
diff
changeset
|
654 |
|
2332
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
655 |
static int max_objArray_print_length = 4; |
1 | 656 |
|
657 |
void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) { |
|
658 |
assert(obj->is_objArray(), "must be objArray"); |
|
2332
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
659 |
st->print("a "); |
1 | 660 |
element_klass()->print_value_on(st); |
2332
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
661 |
int len = objArrayOop(obj)->length(); |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
662 |
st->print("[%d] ", len); |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
663 |
obj->print_address_on(st); |
4584
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
4571
diff
changeset
|
664 |
if (NOT_PRODUCT(PrintOopAddress ||) PrintMiscellaneous && (WizardMode || Verbose)) { |
2332
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
665 |
st->print("{"); |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
666 |
for (int i = 0; i < len; i++) { |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
667 |
if (i > max_objArray_print_length) { |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
668 |
st->print("..."); break; |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
669 |
} |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
670 |
st->print(" "INTPTR_FORMAT, (intptr_t)(void*)objArrayOop(obj)->obj_at(i)); |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
671 |
} |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
672 |
st->print(" }"); |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
673 |
} |
1 | 674 |
} |
675 |
||
676 |
const char* objArrayKlass::internal_name() const { |
|
677 |
return external_name(); |
|
678 |
} |
|
679 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
680 |
|
1 | 681 |
// Verification |
682 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
683 |
void objArrayKlass::verify_on(outputStream* st) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
684 |
arrayKlass::verify_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
685 |
guarantee(element_klass()->is_metadata(), "should be in metaspace"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
686 |
guarantee(element_klass()->is_klass(), "should be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
687 |
guarantee(bottom_klass()->is_metadata(), "should be in metaspace"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
688 |
guarantee(bottom_klass()->is_klass(), "should be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
689 |
Klass* bk = Klass::cast(bottom_klass()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
690 |
guarantee(bk->oop_is_instance() || bk->oop_is_typeArray(), "invalid bottom klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
691 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
692 |
|
1 | 693 |
void objArrayKlass::oop_verify_on(oop obj, outputStream* st) { |
694 |
arrayKlass::oop_verify_on(obj, st); |
|
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 |
} |