author | ccheung |
Wed, 02 May 2018 09:26:10 -0700 | |
changeset 49948 | ff8dbb56740a |
parent 49658 | 8237a91c1cca |
child 50094 | 2f79462aab9b |
permissions | -rw-r--r-- |
1 | 1 |
/* |
49359
59f6547e151f
8199264: Remove universe.inline.hpp to simplify include dependencies
stefank
parents:
47998
diff
changeset
|
2 |
* Copyright (c) 1997, 2018, 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" |
38094
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
26 |
#include "classfile/moduleEntry.hpp" |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
27 |
#include "classfile/packageEntry.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
28 |
#include "classfile/symbolTable.hpp" |
7397 | 29 |
#include "classfile/systemDictionary.hpp" |
30 |
#include "classfile/vmSymbols.hpp" |
|
30764 | 31 |
#include "gc/shared/collectedHeap.inline.hpp" |
32 |
#include "gc/shared/specialized_oop_closures.hpp" |
|
25356
4a4a482298a6
8046670: Make CMS metadata aware closures applicable for other collectors
stefank
parents:
24351
diff
changeset
|
33 |
#include "memory/iterator.inline.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
34 |
#include "memory/metadataFactory.hpp" |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46329
diff
changeset
|
35 |
#include "memory/metaspaceClosure.hpp" |
7397 | 36 |
#include "memory/resourceArea.hpp" |
49359
59f6547e151f
8199264: Remove universe.inline.hpp to simplify include dependencies
stefank
parents:
47998
diff
changeset
|
37 |
#include "memory/universe.hpp" |
40887
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
38094
diff
changeset
|
38 |
#include "oops/arrayKlass.inline.hpp" |
7397 | 39 |
#include "oops/instanceKlass.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
40 |
#include "oops/klass.inline.hpp" |
7397 | 41 |
#include "oops/objArrayKlass.inline.hpp" |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
27680
diff
changeset
|
42 |
#include "oops/objArrayOop.inline.hpp" |
7397 | 43 |
#include "oops/oop.inline.hpp" |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7890
diff
changeset
|
44 |
#include "oops/symbol.hpp" |
7397 | 45 |
#include "runtime/handles.inline.hpp" |
46 |
#include "runtime/mutexLocker.hpp" |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
14588
diff
changeset
|
47 |
#include "utilities/macros.hpp" |
1 | 48 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
49 |
ObjArrayKlass* ObjArrayKlass::allocate(ClassLoaderData* loader_data, int n, Klass* k, Symbol* name, TRAPS) { |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
50 |
assert(ObjArrayKlass::header_size() <= InstanceKlass::header_size(), |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
51 |
"array klasses must be same size as InstanceKlass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
52 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
53 |
int size = ArrayKlass::static_size(ObjArrayKlass::header_size()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
54 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
55 |
return new (loader_data, size, THREAD) ObjArrayKlass(n, k, name); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
56 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
57 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
58 |
Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
59 |
int n, Klass* element_klass, TRAPS) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
60 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
61 |
// Eagerly allocate the direct array supertype. |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
62 |
Klass* super_klass = NULL; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
63 |
if (!Universe::is_bootstrapping() || SystemDictionary::Object_klass_loaded()) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
64 |
Klass* element_super = element_klass->super(); |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
65 |
if (element_super != NULL) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
66 |
// The element type has a direct super. E.g., String[] has direct super of Object[]. |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
67 |
super_klass = element_super->array_klass_or_null(); |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
68 |
bool supers_exist = super_klass != NULL; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
69 |
// Also, see if the element has secondary supertypes. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
70 |
// We need an array type for each. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
71 |
Array<Klass*>* element_supers = element_klass->secondary_supers(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
72 |
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
|
73 |
Klass* elem_super = element_supers->at(i); |
14488 | 74 |
if (elem_super->array_klass_or_null() == NULL) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
75 |
supers_exist = false; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
76 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
77 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
78 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
79 |
if (!supers_exist) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
80 |
// Oops. Not allocated yet. Back out, allocate it, and retry. |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
81 |
Klass* ek = NULL; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
82 |
{ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
83 |
MutexUnlocker mu(MultiArray_lock); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
84 |
MutexUnlocker mc(Compile_lock); // for vtables |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
85 |
super_klass = element_super->array_klass(CHECK_0); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
86 |
for( int i = element_supers->length()-1; i >= 0; i-- ) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
87 |
Klass* elem_super = element_supers->at(i); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
88 |
elem_super->array_klass(CHECK_0); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
89 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
90 |
// Now retry from the beginning |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
91 |
ek = element_klass->array_klass(n, CHECK_0); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
92 |
} // re-lock |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
93 |
return ek; |
13728
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 |
} else { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
96 |
// The element type is already Object. Object[] has direct super of Object. |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
97 |
super_klass = SystemDictionary::Object_klass(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
98 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
99 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
100 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
101 |
// Create type name for klass. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
102 |
Symbol* name = NULL; |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
103 |
if (!element_klass->is_instance_klass() || |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
104 |
(name = InstanceKlass::cast(element_klass)->array_name()) == NULL) { |
13728
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 |
ResourceMark rm(THREAD); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
107 |
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
|
108 |
int len = element_klass->name()->utf8_length(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
109 |
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
|
110 |
int idx = 0; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
111 |
new_str[idx++] = '['; |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
112 |
if (element_klass->is_instance_klass()) { // it could be an array or simple type |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
113 |
new_str[idx++] = 'L'; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
114 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
115 |
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
|
116 |
idx += len; |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
117 |
if (element_klass->is_instance_klass()) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
118 |
new_str[idx++] = ';'; |
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 |
new_str[idx++] = '\0'; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
121 |
name = SymbolTable::new_permanent_symbol(new_str, CHECK_0); |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
122 |
if (element_klass->is_instance_klass()) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
123 |
InstanceKlass* ik = InstanceKlass::cast(element_klass); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
124 |
ik->set_array_name(name); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
125 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
126 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
127 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
128 |
// Initialize instance variables |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
129 |
ObjArrayKlass* oak = ObjArrayKlass::allocate(loader_data, n, element_klass, name, CHECK_0); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
130 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
131 |
// 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
|
132 |
// including classes in the bootstrap (NULL) class loader. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
133 |
// GC walks these as strong roots. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
134 |
loader_data->add_class(oak); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
135 |
|
38094
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
136 |
ModuleEntry* module = oak->module(); |
36508 | 137 |
assert(module != NULL, "No module entry for array"); |
138 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
139 |
// Call complete_create_array_klass after all instance variables has been initialized. |
36508 | 140 |
ArrayKlass::complete_create_array_klass(oak, super_klass, module, CHECK_0); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
141 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
142 |
return oak; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
143 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
144 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
145 |
ObjArrayKlass::ObjArrayKlass(int n, Klass* element_klass, Symbol* name) : ArrayKlass(name) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
146 |
this->set_dimension(n); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
147 |
this->set_element_klass(element_klass); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
148 |
// 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
|
149 |
// 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
|
150 |
// loaded. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
151 |
name->decrement_refcount(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
152 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
153 |
Klass* bk; |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
154 |
if (element_klass->is_objArray_klass()) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
155 |
bk = ObjArrayKlass::cast(element_klass)->bottom_klass(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
156 |
} else { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
157 |
bk = element_klass; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
158 |
} |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
159 |
assert(bk != NULL && (bk->is_instance_klass() || bk->is_typeArray_klass()), "invalid bottom klass"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
160 |
this->set_bottom_klass(bk); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
161 |
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
|
162 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
163 |
this->set_layout_helper(array_layout_helper(T_OBJECT)); |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
164 |
assert(this->is_array_klass(), "sanity"); |
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
165 |
assert(this->is_objArray_klass(), "sanity"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
166 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
167 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
168 |
int ObjArrayKlass::oop_size(oop obj) const { |
1 | 169 |
assert(obj->is_objArray(), "must be object array"); |
170 |
return objArrayOop(obj)->object_size(); |
|
171 |
} |
|
172 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
173 |
objArrayOop ObjArrayKlass::allocate(int length, TRAPS) { |
1 | 174 |
if (length >= 0) { |
175 |
if (length <= arrayOopDesc::max_array_length(T_OBJECT)) { |
|
176 |
int size = objArrayOopDesc::object_size(length); |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
177 |
return (objArrayOop)CollectedHeap::array_allocate(this, size, length, THREAD); |
1 | 178 |
} else { |
3576
4ceec8fb3e18
6850957: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit
martin
parents:
2332
diff
changeset
|
179 |
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
|
180 |
JvmtiExport::post_array_size_exhausted(); |
1 | 181 |
THROW_OOP_0(Universe::out_of_memory_error_array_size()); |
182 |
} |
|
183 |
} else { |
|
184 |
THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); |
|
185 |
} |
|
186 |
} |
|
187 |
||
188 |
static int multi_alloc_counter = 0; |
|
189 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
190 |
oop ObjArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) { |
1 | 191 |
int length = *sizes; |
192 |
// Call to lower_dimension uses this pointer, so most be called before a |
|
193 |
// possible GC |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
194 |
Klass* ld_klass = lower_dimension(); |
1 | 195 |
// If length < 0 allocate will throw an exception. |
196 |
objArrayOop array = allocate(length, CHECK_NULL); |
|
197 |
objArrayHandle h_array (THREAD, array); |
|
198 |
if (rank > 1) { |
|
199 |
if (length != 0) { |
|
200 |
for (int index = 0; index < length; index++) { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
40887
diff
changeset
|
201 |
ArrayKlass* ak = ArrayKlass::cast(ld_klass); |
1 | 202 |
oop sub_array = ak->multi_allocate(rank-1, &sizes[1], CHECK_NULL); |
203 |
h_array->obj_at_put(index, sub_array); |
|
204 |
} |
|
205 |
} else { |
|
206 |
// Since this array dimension has zero length, nothing will be |
|
207 |
// allocated, however the lower dimension values must be checked |
|
208 |
// for illegal values. |
|
209 |
for (int i = 0; i < rank - 1; ++i) { |
|
210 |
sizes += 1; |
|
211 |
if (*sizes < 0) { |
|
212 |
THROW_0(vmSymbols::java_lang_NegativeArraySizeException()); |
|
213 |
} |
|
214 |
} |
|
215 |
} |
|
216 |
} |
|
217 |
return h_array(); |
|
218 |
} |
|
219 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
220 |
// Either oop or narrowOop depending on UseCompressedOops. |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
221 |
template <class T> void ObjArrayKlass::do_copy(arrayOop s, T* src, |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
222 |
arrayOop d, T* dst, int length, TRAPS) { |
49658 | 223 |
if (oopDesc::equals(s, d)) { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
224 |
// 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
|
225 |
assert(length > 0, "sanity check"); |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
226 |
HeapAccess<>::oop_arraycopy(s, d, src, dst, length); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
227 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
228 |
// We have to make sure all elements conform to the destination array |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
229 |
Klass* bound = ObjArrayKlass::cast(d->klass())->element_klass(); |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
230 |
Klass* stype = ObjArrayKlass::cast(s->klass())->element_klass(); |
14488 | 231 |
if (stype == bound || stype->is_subtype_of(bound)) { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
232 |
// elements are guaranteed to be subtypes, so no check necessary |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
233 |
HeapAccess<ARRAYCOPY_DISJOINT>::oop_arraycopy(s, d, src, dst, length); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
234 |
} else { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
235 |
// 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
|
236 |
// note: don't use obj_at_put below because it includes a redundant store check |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
237 |
if (!HeapAccess<ARRAYCOPY_DISJOINT | ARRAYCOPY_CHECKCAST>::oop_arraycopy(s, d, src, dst, length)) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47658
diff
changeset
|
238 |
THROW(vmSymbols::java_lang_ArrayStoreException()); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
239 |
} |
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 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
242 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
243 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
244 |
void ObjArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, |
1 | 245 |
int dst_pos, int length, TRAPS) { |
246 |
assert(s->is_objArray(), "must be obj array"); |
|
247 |
||
248 |
if (!d->is_objArray()) { |
|
249 |
THROW(vmSymbols::java_lang_ArrayStoreException()); |
|
250 |
} |
|
251 |
||
252 |
// Check is all offsets and lengths are non negative |
|
253 |
if (src_pos < 0 || dst_pos < 0 || length < 0) { |
|
254 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
255 |
} |
|
256 |
// Check if the ranges are valid |
|
257 |
if ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) |
|
258 |
|| (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) { |
|
259 |
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); |
|
260 |
} |
|
261 |
||
262 |
// Special case. Boundary cases must be checked first |
|
263 |
// This allows the following call: copy_array(s, s.length(), d.length(), 0). |
|
264 |
// This is correct, since the position is supposed to be an 'in between point', i.e., s.length(), |
|
265 |
// points to the right of the last element. |
|
266 |
if (length==0) { |
|
267 |
return; |
|
268 |
} |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
269 |
if (UseCompressedOops) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
270 |
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
|
271 |
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
|
272 |
do_copy<narrowOop>(s, src, d, dst, length, CHECK); |
1 | 273 |
} else { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
274 |
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
|
275 |
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
|
276 |
do_copy<oop> (s, src, d, dst, length, CHECK); |
1 | 277 |
} |
278 |
} |
|
279 |
||
280 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
281 |
Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) { |
1 | 282 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
283 |
assert(dimension() <= n, "check order of chain"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
284 |
int dim = dimension(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
285 |
if (dim == n) return this; |
1 | 286 |
|
40887
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
38094
diff
changeset
|
287 |
// lock-free read needs acquire semantics |
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
38094
diff
changeset
|
288 |
if (higher_dimension_acquire() == NULL) { |
1 | 289 |
if (or_null) return NULL; |
290 |
||
291 |
ResourceMark rm; |
|
292 |
JavaThread *jt = (JavaThread *)THREAD; |
|
293 |
{ |
|
294 |
MutexLocker mc(Compile_lock, THREAD); // for vtables |
|
295 |
// Ensure atomic creation of higher dimensions |
|
296 |
MutexLocker mu(MultiArray_lock, THREAD); |
|
297 |
||
298 |
// Check if another thread beat us |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
299 |
if (higher_dimension() == NULL) { |
1 | 300 |
|
301 |
// 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
|
302 |
Klass* k = |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
303 |
ObjArrayKlass::allocate_objArray_klass(class_loader_data(), dim + 1, this, CHECK_NULL); |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
304 |
ObjArrayKlass* ak = ObjArrayKlass::cast(k); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
305 |
ak->set_lower_dimension(this); |
40887
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
38094
diff
changeset
|
306 |
// use 'release' to pair with lock-free load |
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
38094
diff
changeset
|
307 |
release_set_higher_dimension(ak); |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
308 |
assert(ak->is_objArray_klass(), "incorrect initialization of ObjArrayKlass"); |
1 | 309 |
} |
310 |
} |
|
311 |
} else { |
|
312 |
CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); |
|
313 |
} |
|
314 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
315 |
ObjArrayKlass *ak = ObjArrayKlass::cast(higher_dimension()); |
1 | 316 |
if (or_null) { |
317 |
return ak->array_klass_or_null(n); |
|
318 |
} |
|
27680
8ecc0871c18e
8064811: Use THREAD instead of CHECK_NULL in return statements
stefank
parents:
26316
diff
changeset
|
319 |
return ak->array_klass(n, THREAD); |
1 | 320 |
} |
321 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
322 |
Klass* ObjArrayKlass::array_klass_impl(bool or_null, TRAPS) { |
27680
8ecc0871c18e
8064811: Use THREAD instead of CHECK_NULL in return statements
stefank
parents:
26316
diff
changeset
|
323 |
return array_klass_impl(or_null, dimension() + 1, THREAD); |
1 | 324 |
} |
325 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
326 |
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
|
327 |
if (!bottom_klass()->can_be_primary_super()) |
1 | 328 |
// array of interfaces |
329 |
return false; |
|
330 |
else |
|
331 |
return Klass::can_be_primary_super_slow(); |
|
332 |
} |
|
333 |
||
49948
ff8dbb56740a
8200466: Revisit the setting of _transitive_interfaces in InstanceKlass
ccheung
parents:
49658
diff
changeset
|
334 |
GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slots, |
ff8dbb56740a
8200466: Revisit the setting of _transitive_interfaces in InstanceKlass
ccheung
parents:
49658
diff
changeset
|
335 |
Array<Klass*>* transitive_interfaces) { |
ff8dbb56740a
8200466: Revisit the setting of _transitive_interfaces in InstanceKlass
ccheung
parents:
49658
diff
changeset
|
336 |
assert(transitive_interfaces == NULL, "sanity"); |
1 | 337 |
// interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... }; |
14488 | 338 |
Array<Klass*>* elem_supers = element_klass()->secondary_supers(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
339 |
int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length(); |
1 | 340 |
int num_secondaries = num_extra_slots + 2 + num_elem_supers; |
341 |
if (num_secondaries == 2) { |
|
342 |
// Must share this for correct bootstrapping! |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
343 |
set_secondary_supers(Universe::the_array_interfaces_array()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
344 |
return NULL; |
1 | 345 |
} else { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
346 |
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
|
347 |
secondaries->push(SystemDictionary::Cloneable_klass()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
348 |
secondaries->push(SystemDictionary::Serializable_klass()); |
1 | 349 |
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
|
350 |
Klass* elem_super = (Klass*) elem_supers->at(i); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
351 |
Klass* array_super = elem_super->array_klass_or_null(); |
1 | 352 |
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
|
353 |
secondaries->push(array_super); |
1 | 354 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
355 |
return secondaries; |
1 | 356 |
} |
357 |
} |
|
358 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
359 |
bool ObjArrayKlass::compute_is_subtype_of(Klass* k) { |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
360 |
if (!k->is_objArray_klass()) |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
361 |
return ArrayKlass::compute_is_subtype_of(k); |
1 | 362 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
363 |
ObjArrayKlass* oak = ObjArrayKlass::cast(k); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
364 |
return element_klass()->is_subtype_of(oak->element_klass()); |
1 | 365 |
} |
366 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
367 |
void ObjArrayKlass::initialize(TRAPS) { |
14488 | 368 |
bottom_klass()->initialize(THREAD); // dispatches to either InstanceKlass or TypeArrayKlass |
1 | 369 |
} |
370 |
||
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46329
diff
changeset
|
371 |
void ObjArrayKlass::metaspace_pointers_do(MetaspaceClosure* it) { |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46329
diff
changeset
|
372 |
ArrayKlass::metaspace_pointers_do(it); |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46329
diff
changeset
|
373 |
it->push(&_element_klass); |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46329
diff
changeset
|
374 |
it->push(&_bottom_klass); |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46329
diff
changeset
|
375 |
} |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46329
diff
changeset
|
376 |
|
1 | 377 |
// JVM support |
378 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
379 |
jint ObjArrayKlass::compute_modifier_flags(TRAPS) const { |
1 | 380 |
// The modifier for an objectArray is the same as its element |
381 |
if (element_klass() == NULL) { |
|
382 |
assert(Universe::is_bootstrapping(), "partial objArray only at startup"); |
|
383 |
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; |
|
384 |
} |
|
1430
16aa7ef1ffa1
6700107: java/lang/Class/forName/TooManyDimensions.java crashes with SIGSEGV in c2 compiler with fastdebug
coleenp
parents:
1388
diff
changeset
|
385 |
// Return the flags of the bottom element type. |
14488 | 386 |
jint element_flags = bottom_klass()->compute_modifier_flags(CHECK_0); |
1 | 387 |
|
388 |
return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED)) |
|
389 |
| (JVM_ACC_ABSTRACT | JVM_ACC_FINAL); |
|
390 |
} |
|
391 |
||
38094
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
392 |
ModuleEntry* ObjArrayKlass::module() const { |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
393 |
assert(bottom_klass() != NULL, "ObjArrayKlass returned unexpected NULL bottom_klass"); |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
394 |
// The array is defined in the module of its bottom class |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
395 |
return bottom_klass()->module(); |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
396 |
} |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
397 |
|
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
398 |
PackageEntry* ObjArrayKlass::package() const { |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
399 |
assert(bottom_klass() != NULL, "ObjArrayKlass returned unexpected NULL bottom_klass"); |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
400 |
return bottom_klass()->package(); |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
37190
diff
changeset
|
401 |
} |
1 | 402 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
403 |
// Printing |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
404 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
405 |
void ObjArrayKlass::print_on(outputStream* st) const { |
1 | 406 |
#ifndef PRODUCT |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
407 |
Klass::print_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
408 |
st->print(" - instance klass: "); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
409 |
element_klass()->print_value_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
410 |
st->cr(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
411 |
#endif //PRODUCT |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
412 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
413 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
414 |
void ObjArrayKlass::print_value_on(outputStream* st) const { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
415 |
assert(is_klass(), "must be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
416 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
417 |
element_klass()->print_value_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
418 |
st->print("[]"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
419 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
420 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
421 |
#ifndef PRODUCT |
1 | 422 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
423 |
void ObjArrayKlass::oop_print_on(oop obj, outputStream* st) { |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
424 |
ArrayKlass::oop_print_on(obj, st); |
1 | 425 |
assert(obj->is_objArray(), "must be objArray"); |
426 |
objArrayOop oa = objArrayOop(obj); |
|
427 |
int print_len = MIN2((intx) oa->length(), MaxElementPrintSize); |
|
428 |
for(int index = 0; index < print_len; index++) { |
|
429 |
st->print(" - %3d : ", index); |
|
430 |
oa->obj_at(index)->print_value_on(st); |
|
431 |
st->cr(); |
|
432 |
} |
|
433 |
int remaining = oa->length() - print_len; |
|
434 |
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
|
435 |
st->print_cr(" - <%d more elements, increase MaxElementPrintSize to print>", remaining); |
1 | 436 |
} |
437 |
} |
|
438 |
||
4584
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
4571
diff
changeset
|
439 |
#endif //PRODUCT |
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
4571
diff
changeset
|
440 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
441 |
void ObjArrayKlass::oop_print_value_on(oop obj, outputStream* st) { |
1 | 442 |
assert(obj->is_objArray(), "must be objArray"); |
2332
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
443 |
st->print("a "); |
1 | 444 |
element_klass()->print_value_on(st); |
2332
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
445 |
int len = objArrayOop(obj)->length(); |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
446 |
st->print("[%d] ", len); |
5c7b6f4ce0a1
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
1430
diff
changeset
|
447 |
obj->print_address_on(st); |
1 | 448 |
} |
449 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
450 |
const char* ObjArrayKlass::internal_name() const { |
1 | 451 |
return external_name(); |
452 |
} |
|
453 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
454 |
|
1 | 455 |
// Verification |
456 |
||
22794
f1c014ad3754
8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents:
22234
diff
changeset
|
457 |
void ObjArrayKlass::verify_on(outputStream* st) { |
f1c014ad3754
8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents:
22234
diff
changeset
|
458 |
ArrayKlass::verify_on(st); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
459 |
guarantee(element_klass()->is_klass(), "should be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
460 |
guarantee(bottom_klass()->is_klass(), "should be klass"); |
14488 | 461 |
Klass* bk = bottom_klass(); |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
31592
diff
changeset
|
462 |
guarantee(bk->is_instance_klass() || bk->is_typeArray_klass(), "invalid bottom klass"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
463 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
464 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
465 |
void ObjArrayKlass::oop_verify_on(oop obj, outputStream* st) { |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
466 |
ArrayKlass::oop_verify_on(obj, st); |
1 | 467 |
guarantee(obj->is_objArray(), "must be objArray"); |
468 |
objArrayOop oa = objArrayOop(obj); |
|
469 |
for(int index = 0; index < oa->length(); index++) { |
|
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
46746
diff
changeset
|
470 |
guarantee(oopDesc::is_oop_or_null(oa->obj_at(index)), "should be oop"); |
1 | 471 |
} |
472 |
} |