1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
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 *
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 *
79
80 private:
81 // Either oop or narrowOop depending on UseCompressedOops.
82 // must be called from within ObjArrayKlass.cpp
83 template <class T> void do_copy(arrayOop s, T* src, arrayOop d,
84 T* dst, int length, TRAPS);
85 protected:
86 // Returns the ObjArrayKlass for n'th dimension.
87 virtual Klass* array_klass_impl(bool or_null, int n, TRAPS);
88
89 // Returns the array class with this class as element type.
90 virtual Klass* array_klass_impl(bool or_null, TRAPS);
91
92 public:
93 // Casting from Klass*
94 static ObjArrayKlass* cast(Klass* k) {
95 assert(k->oop_is_objArray(), "cast to ObjArrayKlass");
96 return (ObjArrayKlass*) k;
97 }
98
99 // Sizing
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);
|
1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
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 *
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 *
79
80 private:
81 // Either oop or narrowOop depending on UseCompressedOops.
82 // must be called from within ObjArrayKlass.cpp
83 template <class T> void do_copy(arrayOop s, T* src, arrayOop d,
84 T* dst, int length, TRAPS);
85 protected:
86 // Returns the ObjArrayKlass for n'th dimension.
87 virtual Klass* array_klass_impl(bool or_null, int n, TRAPS);
88
89 // Returns the array class with this class as element type.
90 virtual Klass* array_klass_impl(bool or_null, TRAPS);
91
92 public:
93 // Casting from Klass*
94 static ObjArrayKlass* cast(Klass* k) {
95 assert(k->oop_is_objArray(), "cast to ObjArrayKlass");
96 return (ObjArrayKlass*) k;
97 }
98
99 static const ObjArrayKlass* cast(const Klass* k) {
100 assert(k->oop_is_objArray(), "cast to ObjArrayKlass");
101 return static_cast<const ObjArrayKlass*>(k);
102 }
103
104 // Sizing
105 static int header_size() { return sizeof(ObjArrayKlass)/HeapWordSize; }
106 int size() const { return ArrayKlass::static_size(header_size()); }
107
108 // Initialization (virtual from Klass)
109 void initialize(TRAPS);
110
111 // Garbage collection
112 void oop_follow_contents(oop obj);
113 inline void oop_follow_contents(oop obj, int index);
114 template <class T> inline void objarray_follow_contents(oop obj, int index);
115
116 int oop_adjust_pointers(oop obj);
117
118 // Parallel Scavenge and Parallel Old
119 PARALLEL_GC_DECLS
120 #if INCLUDE_ALL_GCS
121 inline void oop_follow_contents(ParCompactionManager* cm, oop obj, int index);
122 template <class T> inline void
123 objarray_follow_contents(ParCompactionManager* cm, oop obj, int index);
|