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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OOPS_OBJARRAYKLASS_HPP
26 #define SHARE_VM_OOPS_OBJARRAYKLASS_HPP
27
28 #include "classfile/classLoaderData.hpp"
29 #include "memory/specialized_oop_closures.hpp"
30 #include "oops/arrayKlass.hpp"
31 #include "utilities/macros.hpp"
32
33 // ObjArrayKlass is the klass for objArrays
34
35 class ObjArrayKlass : public ArrayKlass {
36 friend class VMStructs;
37 private:
38 Klass* _element_klass; // The klass of the elements of this array type
39 Klass* _bottom_klass; // The one-dimensional type (InstanceKlass or TypeArrayKlass)
40
41 // Constructor
42 ObjArrayKlass(int n, KlassHandle element_klass, Symbol* name);
43 static ObjArrayKlass* allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS);
44 public:
45 // For dummy objects
46 ObjArrayKlass() {}
47
48 // Instance variables
49 Klass* element_klass() const { return _element_klass; }
100 static int header_size() { return sizeof(ObjArrayKlass)/HeapWordSize; }
101 int size() const { return ArrayKlass::static_size(header_size()); }
102
103 // Initialization (virtual from Klass)
104 void initialize(TRAPS);
105
106 // Garbage collection
107 void oop_follow_contents(oop obj);
108 inline void oop_follow_contents(oop obj, int index);
109 template <class T> inline void objarray_follow_contents(oop obj, int index);
110
111 int oop_adjust_pointers(oop obj);
112
113 // Parallel Scavenge and Parallel Old
114 PARALLEL_GC_DECLS
115 #if INCLUDE_ALL_GCS
116 inline void oop_follow_contents(ParCompactionManager* cm, oop obj, int index);
117 template <class T> inline void
118 objarray_follow_contents(ParCompactionManager* cm, oop obj, int index);
119 #endif // INCLUDE_ALL_GCS
120
121 // Iterators
122 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
123 return oop_oop_iterate_v(obj, blk);
124 }
125 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
126 return oop_oop_iterate_v_m(obj, blk, mr);
127 }
128 #define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
129 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
130 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
131 MemRegion mr); \
132 int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \
133 int start, int end);
134
135 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
136 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
137
138 // JVM support
139 jint compute_modifier_flags(TRAPS) const;
|
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OOPS_OBJARRAYKLASS_HPP
26 #define SHARE_VM_OOPS_OBJARRAYKLASS_HPP
27
28 #include "classfile/classLoaderData.hpp"
29 #include "memory/specialized_oop_closures.inline.hpp"
30 #include "oops/arrayKlass.hpp"
31 #include "utilities/macros.hpp"
32
33 // ObjArrayKlass is the klass for objArrays
34
35 class ObjArrayKlass : public ArrayKlass {
36 friend class VMStructs;
37 private:
38 Klass* _element_klass; // The klass of the elements of this array type
39 Klass* _bottom_klass; // The one-dimensional type (InstanceKlass or TypeArrayKlass)
40
41 // Constructor
42 ObjArrayKlass(int n, KlassHandle element_klass, Symbol* name);
43 static ObjArrayKlass* allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS);
44 public:
45 // For dummy objects
46 ObjArrayKlass() {}
47
48 // Instance variables
49 Klass* element_klass() const { return _element_klass; }
100 static int header_size() { return sizeof(ObjArrayKlass)/HeapWordSize; }
101 int size() const { return ArrayKlass::static_size(header_size()); }
102
103 // Initialization (virtual from Klass)
104 void initialize(TRAPS);
105
106 // Garbage collection
107 void oop_follow_contents(oop obj);
108 inline void oop_follow_contents(oop obj, int index);
109 template <class T> inline void objarray_follow_contents(oop obj, int index);
110
111 int oop_adjust_pointers(oop obj);
112
113 // Parallel Scavenge and Parallel Old
114 PARALLEL_GC_DECLS
115 #if INCLUDE_ALL_GCS
116 inline void oop_follow_contents(ParCompactionManager* cm, oop obj, int index);
117 template <class T> inline void
118 objarray_follow_contents(ParCompactionManager* cm, oop obj, int index);
119 #endif // INCLUDE_ALL_GCS
120
121 int get_linear_oop_intervals(oop obj, OopInterval* &start, int &size);
122
123 // Iterators
124 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
125 return oop_oop_iterate_v(obj, blk);
126 }
127 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
128 return oop_oop_iterate_v_m(obj, blk, mr);
129 }
130 #define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
131 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
132 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
133 MemRegion mr); \
134 int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \
135 int start, int end);
136
137 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
138 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
139
140 // JVM support
141 jint compute_modifier_flags(TRAPS) const;
|