author | stefank |
Sat, 26 May 2018 06:59:49 +0200 | |
changeset 50752 | 9d62da00bf15 |
parent 49982 | 9042ffe5b7fe |
child 51554 | 5b0d86499960 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46415
7d5a286cdf89
8138737: Remove oop_ms_adjust_pointers and use oop_iterate instead
sjohanss
parents:
38094
diff
changeset
|
2 |
* Copyright (c) 1997, 2017, 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:
2105
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2105
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:
2105
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_OOPS_TYPEARRAYKLASS_HPP |
26 |
#define SHARE_VM_OOPS_TYPEARRAYKLASS_HPP |
|
27 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
28 |
#include "classfile/classLoaderData.hpp" |
7397 | 29 |
#include "oops/arrayKlass.hpp" |
30 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
31 |
// A TypeArrayKlass is the klass of a typeArray |
1 | 32 |
// It contains the type and size of the elements |
33 |
||
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
34 |
class TypeArrayKlass : public ArrayKlass { |
1 | 35 |
friend class VMStructs; |
50752 | 36 |
|
37 |
public: |
|
38 |
static const KlassID ID = TypeArrayKlassID; |
|
39 |
||
1 | 40 |
private: |
41 |
jint _max_length; // maximum number of elements allowed in an array |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
42 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
43 |
// Constructor |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
44 |
TypeArrayKlass(BasicType type, Symbol* name); |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
45 |
static TypeArrayKlass* allocate(ClassLoaderData* loader_data, BasicType type, Symbol* name, TRAPS); |
1 | 46 |
public: |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
47 |
TypeArrayKlass() {} // For dummy objects. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
48 |
|
1 | 49 |
// instance variables |
50 |
jint max_length() { return _max_length; } |
|
51 |
void set_max_length(jint m) { _max_length = m; } |
|
52 |
||
53 |
// testers |
|
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
32606
diff
changeset
|
54 |
DEBUG_ONLY(bool is_typeArray_klass_slow() const { return true; }) |
1 | 55 |
|
56 |
// klass allocation |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
57 |
static TypeArrayKlass* create_klass(BasicType type, const char* name_str, |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1
diff
changeset
|
58 |
TRAPS); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
59 |
static inline Klass* create_klass(BasicType type, int scale, TRAPS) { |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
60 |
TypeArrayKlass* tak = create_klass(type, external_name(type), CHECK_NULL); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
61 |
assert(scale == (1 << tak->log2_element_size()), "scale must check out"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
62 |
return tak; |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1
diff
changeset
|
63 |
} |
1 | 64 |
|
65 |
int oop_size(oop obj) const; |
|
66 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
67 |
bool compute_is_subtype_of(Klass* k); |
1 | 68 |
|
69 |
// Allocation |
|
10566
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
7397
diff
changeset
|
70 |
typeArrayOop allocate_common(int length, bool do_zero, TRAPS); |
630c177ec580
7081933: Use zeroing elimination optimization for large array
kvn
parents:
7397
diff
changeset
|
71 |
typeArrayOop allocate(int length, TRAPS) { return allocate_common(length, true, THREAD); } |
1 | 72 |
oop multi_allocate(int rank, jint* sizes, TRAPS); |
73 |
||
17826
9ad5cd464a75
8003421: NPG: Move oops out of InstanceKlass into mirror
coleenp
parents:
13952
diff
changeset
|
74 |
oop protection_domain() const { return NULL; } |
9ad5cd464a75
8003421: NPG: Move oops out of InstanceKlass into mirror
coleenp
parents:
13952
diff
changeset
|
75 |
|
1 | 76 |
// Copying |
77 |
void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); |
|
78 |
||
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
79 |
// GC specific object visitors |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
80 |
// |
49982 | 81 |
#if INCLUDE_PARALLELGC |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
82 |
// Parallel Scavenge |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
83 |
void oop_ps_push_contents( oop obj, PSPromotionManager* pm); |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
84 |
// Parallel Compact |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
85 |
void oop_pc_follow_contents(oop obj, ParCompactionManager* cm); |
35877
a2a62511d0f8
8146987: Improve Parallel GC Full GC by caching results of live_words_in_range()
tschatzl
parents:
34666
diff
changeset
|
86 |
void oop_pc_update_pointers(oop obj, ParCompactionManager* cm); |
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
87 |
#endif |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
88 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
89 |
// Oop iterators. Since there are no oops in TypeArrayKlasses, |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
90 |
// these functions only return the size of the object. |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
91 |
|
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
92 |
private: |
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
22234
diff
changeset
|
93 |
// The implementation used by all oop_oop_iterate functions in TypeArrayKlasses. |
50752 | 94 |
inline void oop_oop_iterate_impl(oop obj, OopIterateClosure* closure); |
1 | 95 |
|
50752 | 96 |
public: |
30880
efe35e08179f
8080746: Refactor oop iteration macros to be more general
sjohanss
parents:
30150
diff
changeset
|
97 |
// Wraps oop_oop_iterate_impl to conform to macros. |
50752 | 98 |
template <typename T, typename OopClosureType> |
32606
fdaa30d06ada
8129417: Oop iteration clean-up to remove oop_ms_follow_contents
sjohanss
parents:
30880
diff
changeset
|
99 |
inline void oop_oop_iterate(oop obj, OopClosureType* closure); |
30880
efe35e08179f
8080746: Refactor oop iteration macros to be more general
sjohanss
parents:
30150
diff
changeset
|
100 |
|
efe35e08179f
8080746: Refactor oop iteration macros to be more general
sjohanss
parents:
30150
diff
changeset
|
101 |
// Wraps oop_oop_iterate_impl to conform to macros. |
50752 | 102 |
template <typename T, typename OopClosureType> |
32606
fdaa30d06ada
8129417: Oop iteration clean-up to remove oop_ms_follow_contents
sjohanss
parents:
30880
diff
changeset
|
103 |
inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr); |
30880
efe35e08179f
8080746: Refactor oop iteration macros to be more general
sjohanss
parents:
30150
diff
changeset
|
104 |
|
50752 | 105 |
// Wraps oop_oop_iterate_impl to conform to macros. |
106 |
template <typename T, typename OopClosureType> |
|
107 |
inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure); |
|
1 | 108 |
|
109 |
protected: |
|
110 |
// Find n'th dimensional array |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
111 |
virtual Klass* array_klass_impl(bool or_null, int n, TRAPS); |
1 | 112 |
|
113 |
// Returns the array class with this class as element type |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
114 |
virtual Klass* array_klass_impl(bool or_null, TRAPS); |
1 | 115 |
|
116 |
public: |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
117 |
static TypeArrayKlass* cast(Klass* k) { |
34666 | 118 |
return const_cast<TypeArrayKlass*>(cast(const_cast<const Klass*>(k))); |
119 |
} |
|
120 |
||
121 |
static const TypeArrayKlass* cast(const Klass* k) { |
|
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
32606
diff
changeset
|
122 |
assert(k->is_typeArray_klass(), "cast to TypeArrayKlass"); |
34666 | 123 |
return static_cast<const TypeArrayKlass*>(k); |
1 | 124 |
} |
125 |
||
126 |
// Naming |
|
127 |
static const char* external_name(BasicType type); |
|
128 |
||
129 |
// Sizing |
|
35898
ddc274f0052f
8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
coleenp
parents:
35877
diff
changeset
|
130 |
static int header_size() { return sizeof(TypeArrayKlass)/wordSize; } |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
131 |
int size() const { return ArrayKlass::static_size(header_size()); } |
1 | 132 |
|
133 |
// Initialization (virtual from Klass) |
|
134 |
void initialize(TRAPS); |
|
135 |
||
136 |
public: |
|
137 |
// Printing |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
138 |
#ifndef PRODUCT |
1 | 139 |
void oop_print_on(oop obj, outputStream* st); |
140 |
#endif |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
141 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
142 |
void print_on(outputStream* st) const; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
143 |
void print_value_on(outputStream* st) const; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10566
diff
changeset
|
144 |
|
1 | 145 |
public: |
146 |
const char* internal_name() const; |
|
38094
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
35898
diff
changeset
|
147 |
|
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
35898
diff
changeset
|
148 |
ModuleEntry* module() const; |
46977cd73d86
8152844: JVM InstanceKlass Methods For Obtaining Package/Module Should Be Moved to Klass
rprotacio
parents:
35898
diff
changeset
|
149 |
PackageEntry* package() const; |
1 | 150 |
}; |
7397 | 151 |
|
152 |
#endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP |