src/share/vm/oops/objArrayKlass.hpp

Wed, 23 Jan 2013 13:02:39 -0500

author
jprovino
date
Wed, 23 Jan 2013 13:02:39 -0500
changeset 4542
db9981fd3124
parent 4278
070d523b96a7
child 5176
6bd680e9ea35
permissions
-rw-r--r--

8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
Summary: Rename INCLUDE_ALTERNATE_GCS to INCLUDE_ALL_GCS and replace SERIALGC with INCLUDE_ALL_GCS.
Reviewed-by: coleenp, stefank

duke@435 1 /*
brutisso@3711 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_OOPS_OBJARRAYKLASS_HPP
stefank@2314 26 #define SHARE_VM_OOPS_OBJARRAYKLASS_HPP
stefank@2314 27
coleenp@4037 28 #include "classfile/classLoaderData.hpp"
stefank@2314 29 #include "memory/specialized_oop_closures.hpp"
stefank@2314 30 #include "oops/arrayKlass.hpp"
jprovino@4542 31 #include "utilities/macros.hpp"
stefank@2314 32
coleenp@4142 33 // ObjArrayKlass is the klass for objArrays
duke@435 34
coleenp@4142 35 class ObjArrayKlass : public ArrayKlass {
duke@435 36 friend class VMStructs;
duke@435 37 private:
coleenp@4037 38 Klass* _element_klass; // The klass of the elements of this array type
coleenp@4142 39 Klass* _bottom_klass; // The one-dimensional type (InstanceKlass or TypeArrayKlass)
coleenp@4037 40
coleenp@4037 41 // Constructor
coleenp@4142 42 ObjArrayKlass(int n, KlassHandle element_klass, Symbol* name);
coleenp@4142 43 static ObjArrayKlass* allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS);
duke@435 44 public:
coleenp@4037 45 // For dummy objects
coleenp@4142 46 ObjArrayKlass() {}
coleenp@4037 47
duke@435 48 // Instance variables
coleenp@4037 49 Klass* element_klass() const { return _element_klass; }
coleenp@4037 50 void set_element_klass(Klass* k) { _element_klass = k; }
coleenp@4037 51 Klass** element_klass_addr() { return &_element_klass; }
duke@435 52
coleenp@4037 53 Klass* bottom_klass() const { return _bottom_klass; }
coleenp@4037 54 void set_bottom_klass(Klass* k) { _bottom_klass = k; }
coleenp@4037 55 Klass** bottom_klass_addr() { return &_bottom_klass; }
duke@435 56
duke@435 57 // Compiler/Interpreter offset
coleenp@4142 58 static ByteSize element_klass_offset() { return in_ByteSize(offset_of(ObjArrayKlass, _element_klass)); }
duke@435 59
duke@435 60 // Dispatched operation
duke@435 61 bool can_be_primary_super_slow() const;
coleenp@4037 62 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
coleenp@4037 63 bool compute_is_subtype_of(Klass* k);
duke@435 64 bool oop_is_objArray_slow() const { return true; }
duke@435 65 int oop_size(oop obj) const;
duke@435 66
duke@435 67 // Allocation
coleenp@4037 68 static Klass* allocate_objArray_klass(ClassLoaderData* loader_data,
coleenp@4037 69 int n, KlassHandle element_klass, TRAPS);
coleenp@4037 70
duke@435 71 objArrayOop allocate(int length, TRAPS);
duke@435 72 oop multi_allocate(int rank, jint* sizes, TRAPS);
duke@435 73
duke@435 74 // Copying
duke@435 75 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
duke@435 76
duke@435 77 // Compute protection domain
hseigel@4278 78 oop protection_domain() { return bottom_klass()->protection_domain(); }
duke@435 79
coleenp@548 80 private:
coleenp@548 81 // Either oop or narrowOop depending on UseCompressedOops.
coleenp@4142 82 // must be called from within ObjArrayKlass.cpp
coleenp@548 83 template <class T> void do_copy(arrayOop s, T* src, arrayOop d,
coleenp@548 84 T* dst, int length, TRAPS);
duke@435 85 protected:
coleenp@4142 86 // Returns the ObjArrayKlass for n'th dimension.
coleenp@4037 87 virtual Klass* array_klass_impl(bool or_null, int n, TRAPS);
duke@435 88
duke@435 89 // Returns the array class with this class as element type.
coleenp@4037 90 virtual Klass* array_klass_impl(bool or_null, TRAPS);
duke@435 91
duke@435 92 public:
coleenp@4037 93 // Casting from Klass*
coleenp@4142 94 static ObjArrayKlass* cast(Klass* k) {
coleenp@4142 95 assert(k->oop_is_objArray(), "cast to ObjArrayKlass");
coleenp@4142 96 return (ObjArrayKlass*) k;
duke@435 97 }
duke@435 98
duke@435 99 // Sizing
coleenp@4142 100 static int header_size() { return sizeof(ObjArrayKlass)/HeapWordSize; }
coleenp@4142 101 int size() const { return ArrayKlass::static_size(header_size()); }
duke@435 102
duke@435 103 // Initialization (virtual from Klass)
duke@435 104 void initialize(TRAPS);
duke@435 105
duke@435 106 // Garbage collection
duke@435 107 void oop_follow_contents(oop obj);
jcoomes@1746 108 inline void oop_follow_contents(oop obj, int index);
jcoomes@1746 109 template <class T> inline void objarray_follow_contents(oop obj, int index);
jcoomes@1746 110
duke@435 111 int oop_adjust_pointers(oop obj);
duke@435 112
duke@435 113 // Parallel Scavenge and Parallel Old
duke@435 114 PARALLEL_GC_DECLS
jprovino@4542 115 #if INCLUDE_ALL_GCS
jcoomes@1746 116 inline void oop_follow_contents(ParCompactionManager* cm, oop obj, int index);
jcoomes@1746 117 template <class T> inline void
jcoomes@1746 118 objarray_follow_contents(ParCompactionManager* cm, oop obj, int index);
jprovino@4542 119 #endif // INCLUDE_ALL_GCS
duke@435 120
duke@435 121 // Iterators
coleenp@4037 122 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
duke@435 123 return oop_oop_iterate_v(obj, blk);
duke@435 124 }
coleenp@4037 125 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
duke@435 126 return oop_oop_iterate_v_m(obj, blk, mr);
duke@435 127 }
duke@435 128 #define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
duke@435 129 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
duke@435 130 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
coleenp@548 131 MemRegion mr); \
coleenp@548 132 int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \
coleenp@548 133 int start, int end);
duke@435 134
duke@435 135 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
ysr@777 136 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
duke@435 137
duke@435 138 // JVM support
duke@435 139 jint compute_modifier_flags(TRAPS) const;
duke@435 140
duke@435 141 public:
duke@435 142 // Printing
coleenp@4037 143 void print_on(outputStream* st) const;
coleenp@4037 144 void print_value_on(outputStream* st) const;
coleenp@4037 145
jrose@1590 146 void oop_print_value_on(oop obj, outputStream* st);
jrose@1590 147 #ifndef PRODUCT
duke@435 148 void oop_print_on (oop obj, outputStream* st);
jrose@1590 149 #endif //PRODUCT
duke@435 150
coleenp@4037 151 const char* internal_name() const;
coleenp@4037 152
duke@435 153 // Verification
coleenp@4037 154 void verify_on(outputStream* st);
coleenp@4037 155
duke@435 156 void oop_verify_on(oop obj, outputStream* st);
duke@435 157 };
stefank@2314 158
stefank@2314 159 #endif // SHARE_VM_OOPS_OBJARRAYKLASS_HPP

mercurial