annotate src/share/vm/oops/objArrayKlass.hpp @ 7745:6dc8db7164d2

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