src/share/vm/oops/objArrayKlass.hpp

Tue, 05 Feb 2013 08:25:51 -0800

author
vlivanov
date
Tue, 05 Feb 2013 08:25:51 -0800
changeset 4539
6a51fc70a15e
parent 4278
070d523b96a7
child 4542
db9981fd3124
permissions
-rw-r--r--

8006613: adding reason to made_not_compilable
Reviewed-by: kvn, vlivanov
Contributed-by: Igor Ignatyev <igor.ignatyev@oracle.com>

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"
stefank@2314 31
coleenp@4142 32 // ObjArrayKlass is the klass for objArrays
duke@435 33
coleenp@4142 34 class ObjArrayKlass : public ArrayKlass {
duke@435 35 friend class VMStructs;
duke@435 36 private:
coleenp@4037 37 Klass* _element_klass; // The klass of the elements of this array type
coleenp@4142 38 Klass* _bottom_klass; // The one-dimensional type (InstanceKlass or TypeArrayKlass)
coleenp@4037 39
coleenp@4037 40 // Constructor
coleenp@4142 41 ObjArrayKlass(int n, KlassHandle element_klass, Symbol* name);
coleenp@4142 42 static ObjArrayKlass* allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS);
duke@435 43 public:
coleenp@4037 44 // For dummy objects
coleenp@4142 45 ObjArrayKlass() {}
coleenp@4037 46
duke@435 47 // Instance variables
coleenp@4037 48 Klass* element_klass() const { return _element_klass; }
coleenp@4037 49 void set_element_klass(Klass* k) { _element_klass = k; }
coleenp@4037 50 Klass** element_klass_addr() { return &_element_klass; }
duke@435 51
coleenp@4037 52 Klass* bottom_klass() const { return _bottom_klass; }
coleenp@4037 53 void set_bottom_klass(Klass* k) { _bottom_klass = k; }
coleenp@4037 54 Klass** bottom_klass_addr() { return &_bottom_klass; }
duke@435 55
duke@435 56 // Compiler/Interpreter offset
coleenp@4142 57 static ByteSize element_klass_offset() { return in_ByteSize(offset_of(ObjArrayKlass, _element_klass)); }
duke@435 58
duke@435 59 // Dispatched operation
duke@435 60 bool can_be_primary_super_slow() const;
coleenp@4037 61 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
coleenp@4037 62 bool compute_is_subtype_of(Klass* k);
duke@435 63 bool oop_is_objArray_slow() const { return true; }
duke@435 64 int oop_size(oop obj) const;
duke@435 65
duke@435 66 // Allocation
coleenp@4037 67 static Klass* allocate_objArray_klass(ClassLoaderData* loader_data,
coleenp@4037 68 int n, KlassHandle element_klass, TRAPS);
coleenp@4037 69
duke@435 70 objArrayOop allocate(int length, TRAPS);
duke@435 71 oop multi_allocate(int rank, jint* sizes, TRAPS);
duke@435 72
duke@435 73 // Copying
duke@435 74 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
duke@435 75
duke@435 76 // Compute protection domain
hseigel@4278 77 oop protection_domain() { return bottom_klass()->protection_domain(); }
duke@435 78
coleenp@548 79 private:
coleenp@548 80 // Either oop or narrowOop depending on UseCompressedOops.
coleenp@4142 81 // must be called from within ObjArrayKlass.cpp
coleenp@548 82 template <class T> void do_copy(arrayOop s, T* src, arrayOop d,
coleenp@548 83 T* dst, int length, TRAPS);
duke@435 84 protected:
coleenp@4142 85 // Returns the ObjArrayKlass for n'th dimension.
coleenp@4037 86 virtual Klass* array_klass_impl(bool or_null, int n, TRAPS);
duke@435 87
duke@435 88 // Returns the array class with this class as element type.
coleenp@4037 89 virtual Klass* array_klass_impl(bool or_null, TRAPS);
duke@435 90
duke@435 91 public:
coleenp@4037 92 // Casting from Klass*
coleenp@4142 93 static ObjArrayKlass* cast(Klass* k) {
coleenp@4142 94 assert(k->oop_is_objArray(), "cast to ObjArrayKlass");
coleenp@4142 95 return (ObjArrayKlass*) k;
duke@435 96 }
duke@435 97
duke@435 98 // Sizing
coleenp@4142 99 static int header_size() { return sizeof(ObjArrayKlass)/HeapWordSize; }
coleenp@4142 100 int size() const { return ArrayKlass::static_size(header_size()); }
duke@435 101
duke@435 102 // Initialization (virtual from Klass)
duke@435 103 void initialize(TRAPS);
duke@435 104
duke@435 105 // Garbage collection
duke@435 106 void oop_follow_contents(oop obj);
jcoomes@1746 107 inline void oop_follow_contents(oop obj, int index);
jcoomes@1746 108 template <class T> inline void objarray_follow_contents(oop obj, int index);
jcoomes@1746 109
duke@435 110 int oop_adjust_pointers(oop obj);
duke@435 111
duke@435 112 // Parallel Scavenge and Parallel Old
duke@435 113 PARALLEL_GC_DECLS
jcoomes@1746 114 #ifndef SERIALGC
jcoomes@1746 115 inline void oop_follow_contents(ParCompactionManager* cm, oop obj, int index);
jcoomes@1746 116 template <class T> inline void
jcoomes@1746 117 objarray_follow_contents(ParCompactionManager* cm, oop obj, int index);
jcoomes@1746 118 #endif // !SERIALGC
duke@435 119
duke@435 120 // Iterators
coleenp@4037 121 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
duke@435 122 return oop_oop_iterate_v(obj, blk);
duke@435 123 }
coleenp@4037 124 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
duke@435 125 return oop_oop_iterate_v_m(obj, blk, mr);
duke@435 126 }
duke@435 127 #define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
duke@435 128 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
duke@435 129 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
coleenp@548 130 MemRegion mr); \
coleenp@548 131 int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \
coleenp@548 132 int start, int end);
duke@435 133
duke@435 134 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
ysr@777 135 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
duke@435 136
duke@435 137 // JVM support
duke@435 138 jint compute_modifier_flags(TRAPS) const;
duke@435 139
duke@435 140 public:
duke@435 141 // Printing
coleenp@4037 142 void print_on(outputStream* st) const;
coleenp@4037 143 void print_value_on(outputStream* st) const;
coleenp@4037 144
jrose@1590 145 void oop_print_value_on(oop obj, outputStream* st);
jrose@1590 146 #ifndef PRODUCT
duke@435 147 void oop_print_on (oop obj, outputStream* st);
jrose@1590 148 #endif //PRODUCT
duke@435 149
coleenp@4037 150 const char* internal_name() const;
coleenp@4037 151
duke@435 152 // Verification
coleenp@4037 153 void verify_on(outputStream* st);
coleenp@4037 154
duke@435 155 void oop_verify_on(oop obj, outputStream* st);
duke@435 156 };
stefank@2314 157
stefank@2314 158 #endif // SHARE_VM_OOPS_OBJARRAYKLASS_HPP

mercurial