annotate src/share/vm/oops/objArrayKlass.hpp @ 17524:89152779163c

Merge with jdk8-b132
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 11:59:32 +0200
parents 4ca6dc0799b6
children 52b4284cb496
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17524
89152779163c Merge with jdk8-b132
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1311
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1311
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1311
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_OOPS_OBJARRAYKLASS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_OOPS_OBJARRAYKLASS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
28 #include "classfile/classLoaderData.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "memory/specialized_oop_closures.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "oops/arrayKlass.hpp"
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6983
diff changeset
31 #include "utilities/macros.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
33 // ObjArrayKlass is the klass for objArrays
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
35 class ObjArrayKlass : public ArrayKlass {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
36 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 private:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
38 Klass* _element_klass; // The klass of the elements of this array type
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
39 Klass* _bottom_klass; // The one-dimensional type (InstanceKlass or TypeArrayKlass)
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
40
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
41 // Constructor
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
42 ObjArrayKlass(int n, KlassHandle element_klass, Symbol* name);
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
43 static ObjArrayKlass* allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
44 public:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
45 // For dummy objects
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
46 ObjArrayKlass() {}
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
47
0
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // Instance variables
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
49 Klass* element_klass() const { return _element_klass; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
50 void set_element_klass(Klass* k) { _element_klass = k; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
51 Klass** element_klass_addr() { return &_element_klass; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
52
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
53 Klass* bottom_klass() const { return _bottom_klass; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
54 void set_bottom_klass(Klass* k) { _bottom_klass = k; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
55 Klass** bottom_klass_addr() { return &_bottom_klass; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // Compiler/Interpreter offset
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
58 static ByteSize element_klass_offset() { return in_ByteSize(offset_of(ObjArrayKlass, _element_klass)); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // Dispatched operation
a61af66fc99e Initial load
duke
parents:
diff changeset
61 bool can_be_primary_super_slow() const;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
62 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
63 bool compute_is_subtype_of(Klass* k);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
64 bool oop_is_objArray_slow() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 int oop_size(oop obj) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Allocation
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
68 static Klass* allocate_objArray_klass(ClassLoaderData* loader_data,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
69 int n, KlassHandle element_klass, TRAPS);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
70
0
a61af66fc99e Initial load
duke
parents:
diff changeset
71 objArrayOop allocate(int length, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
72 oop multi_allocate(int rank, jint* sizes, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Copying
a61af66fc99e Initial load
duke
parents:
diff changeset
75 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // Compute protection domain
10343
6bd680e9ea35 8003421: NPG: Move oops out of InstanceKlass into mirror
coleenp
parents: 8001
diff changeset
78 oop protection_domain() const { return bottom_klass()->protection_domain(); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
79
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
80 private:
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
81 // Either oop or narrowOop depending on UseCompressedOops.
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
82 // must be called from within ObjArrayKlass.cpp
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
83 template <class T> void do_copy(arrayOop s, T* src, arrayOop d,
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
84 T* dst, int length, TRAPS);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
85 protected:
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
86 // Returns the ObjArrayKlass for n'th dimension.
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
87 virtual Klass* array_klass_impl(bool or_null, int n, TRAPS);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // Returns the array class with this class as element type.
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
90 virtual Klass* array_klass_impl(bool or_null, TRAPS);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 public:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
93 // Casting from Klass*
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
94 static ObjArrayKlass* cast(Klass* k) {
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
95 assert(k->oop_is_objArray(), "cast to ObjArrayKlass");
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
96 return (ObjArrayKlass*) k;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Sizing
6831
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
100 static int header_size() { return sizeof(ObjArrayKlass)/HeapWordSize; }
d8ce2825b193 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 6725
diff changeset
101 int size() const { return ArrayKlass::static_size(header_size()); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // Initialization (virtual from Klass)
a61af66fc99e Initial load
duke
parents:
diff changeset
104 void initialize(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Garbage collection
a61af66fc99e Initial load
duke
parents:
diff changeset
107 void oop_follow_contents(oop obj);
1311
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
108 inline void oop_follow_contents(oop obj, int index);
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
109 template <class T> inline void objarray_follow_contents(oop obj, int index);
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
110
0
a61af66fc99e Initial load
duke
parents:
diff changeset
111 int oop_adjust_pointers(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // Parallel Scavenge and Parallel Old
a61af66fc99e Initial load
duke
parents:
diff changeset
114 PARALLEL_GC_DECLS
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6983
diff changeset
115 #if INCLUDE_ALL_GCS
1311
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
116 inline void oop_follow_contents(ParCompactionManager* cm, oop obj, int index);
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
117 template <class T> inline void
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
118 objarray_follow_contents(ParCompactionManager* cm, oop obj, int index);
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6983
diff changeset
119 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // Iterators
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
122 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
123 return oop_oop_iterate_v(obj, blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
125 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
126 return oop_oop_iterate_v_m(obj, blk, mr);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 }
a61af66fc99e Initial load
duke
parents:
diff changeset
128 #define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
a61af66fc99e Initial load
duke
parents:
diff changeset
129 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
a61af66fc99e Initial load
duke
parents:
diff changeset
130 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
131 MemRegion mr); \
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
132 int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
133 int start, int end);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
136 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 // JVM support
a61af66fc99e Initial load
duke
parents:
diff changeset
139 jint compute_modifier_flags(TRAPS) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // Printing
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
143 void print_on(outputStream* st) const;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
144 void print_value_on(outputStream* st) const;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
145
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 356
diff changeset
146 void oop_print_value_on(oop obj, outputStream* st);
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 356
diff changeset
147 #ifndef PRODUCT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
148 void oop_print_on (oop obj, outputStream* st);
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 356
diff changeset
149 #endif //PRODUCT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
150
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
151 const char* internal_name() const;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
152
0
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // Verification
14909
4ca6dc0799b6 Backout jdk9 merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14378
diff changeset
154 void verify_on(outputStream* st, bool check_dictionary);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6008
diff changeset
155
0
a61af66fc99e Initial load
duke
parents:
diff changeset
156 void oop_verify_on(oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
157 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
158
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
159 #endif // SHARE_VM_OOPS_OBJARRAYKLASS_HPP