Wed, 06 Jan 2010 22:21:39 -0800
Merge
duke@435 | 1 | /* |
xdono@631 | 2 | * Copyright 1997-2008 Sun Microsystems, Inc. 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 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | // objArrayKlass is the klass for objArrays |
duke@435 | 26 | |
duke@435 | 27 | class objArrayKlass : public arrayKlass { |
duke@435 | 28 | friend class VMStructs; |
duke@435 | 29 | private: |
duke@435 | 30 | klassOop _element_klass; // The klass of the elements of this array type |
duke@435 | 31 | klassOop _bottom_klass; // The one-dimensional type (instanceKlass or typeArrayKlass) |
duke@435 | 32 | public: |
duke@435 | 33 | // Instance variables |
duke@435 | 34 | klassOop element_klass() const { return _element_klass; } |
duke@435 | 35 | void set_element_klass(klassOop k) { oop_store_without_check((oop*) &_element_klass, (oop) k); } |
duke@435 | 36 | oop* element_klass_addr() { return (oop*)&_element_klass; } |
duke@435 | 37 | |
duke@435 | 38 | klassOop bottom_klass() const { return _bottom_klass; } |
duke@435 | 39 | void set_bottom_klass(klassOop k) { oop_store_without_check((oop*) &_bottom_klass, (oop) k); } |
duke@435 | 40 | oop* bottom_klass_addr() { return (oop*)&_bottom_klass; } |
duke@435 | 41 | |
duke@435 | 42 | // Compiler/Interpreter offset |
duke@435 | 43 | static int element_klass_offset_in_bytes() { return offset_of(objArrayKlass, _element_klass); } |
duke@435 | 44 | |
duke@435 | 45 | // Dispatched operation |
duke@435 | 46 | bool can_be_primary_super_slow() const; |
duke@435 | 47 | objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS); |
duke@435 | 48 | bool compute_is_subtype_of(klassOop k); |
duke@435 | 49 | bool oop_is_objArray_slow() const { return true; } |
duke@435 | 50 | int oop_size(oop obj) const; |
duke@435 | 51 | int klass_oop_size() const { return object_size(); } |
duke@435 | 52 | |
duke@435 | 53 | // Allocation |
duke@435 | 54 | DEFINE_ALLOCATE_PERMANENT(objArrayKlass); |
duke@435 | 55 | objArrayOop allocate(int length, TRAPS); |
duke@435 | 56 | oop multi_allocate(int rank, jint* sizes, TRAPS); |
duke@435 | 57 | |
duke@435 | 58 | // Copying |
duke@435 | 59 | void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); |
duke@435 | 60 | |
duke@435 | 61 | // Compute protection domain |
duke@435 | 62 | oop protection_domain() { return Klass::cast(bottom_klass())->protection_domain(); } |
duke@435 | 63 | // Compute class loader |
duke@435 | 64 | oop class_loader() const { return Klass::cast(bottom_klass())->class_loader(); } |
duke@435 | 65 | |
coleenp@548 | 66 | private: |
coleenp@548 | 67 | // Either oop or narrowOop depending on UseCompressedOops. |
coleenp@548 | 68 | // must be called from within objArrayKlass.cpp |
coleenp@548 | 69 | template <class T> void do_copy(arrayOop s, T* src, arrayOop d, |
coleenp@548 | 70 | T* dst, int length, TRAPS); |
duke@435 | 71 | protected: |
duke@435 | 72 | // Returns the objArrayKlass for n'th dimension. |
duke@435 | 73 | virtual klassOop array_klass_impl(bool or_null, int n, TRAPS); |
duke@435 | 74 | |
duke@435 | 75 | // Returns the array class with this class as element type. |
duke@435 | 76 | virtual klassOop array_klass_impl(bool or_null, TRAPS); |
duke@435 | 77 | |
duke@435 | 78 | public: |
duke@435 | 79 | // Casting from klassOop |
duke@435 | 80 | static objArrayKlass* cast(klassOop k) { |
duke@435 | 81 | assert(k->klass_part()->oop_is_objArray_slow(), "cast to objArrayKlass"); |
duke@435 | 82 | return (objArrayKlass*) k->klass_part(); |
duke@435 | 83 | } |
duke@435 | 84 | |
duke@435 | 85 | // Sizing |
duke@435 | 86 | static int header_size() { return oopDesc::header_size() + sizeof(objArrayKlass)/HeapWordSize; } |
duke@435 | 87 | int object_size() const { return arrayKlass::object_size(header_size()); } |
duke@435 | 88 | |
duke@435 | 89 | // Initialization (virtual from Klass) |
duke@435 | 90 | void initialize(TRAPS); |
duke@435 | 91 | |
duke@435 | 92 | // Garbage collection |
duke@435 | 93 | void oop_follow_contents(oop obj); |
duke@435 | 94 | int oop_adjust_pointers(oop obj); |
duke@435 | 95 | |
duke@435 | 96 | // Parallel Scavenge and Parallel Old |
duke@435 | 97 | PARALLEL_GC_DECLS |
duke@435 | 98 | |
duke@435 | 99 | // Iterators |
duke@435 | 100 | int oop_oop_iterate(oop obj, OopClosure* blk) { |
duke@435 | 101 | return oop_oop_iterate_v(obj, blk); |
duke@435 | 102 | } |
duke@435 | 103 | int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { |
duke@435 | 104 | return oop_oop_iterate_v_m(obj, blk, mr); |
duke@435 | 105 | } |
duke@435 | 106 | #define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
duke@435 | 107 | int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ |
duke@435 | 108 | int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \ |
coleenp@548 | 109 | MemRegion mr); \ |
coleenp@548 | 110 | int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \ |
coleenp@548 | 111 | int start, int end); |
duke@435 | 112 | |
duke@435 | 113 | ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL) |
ysr@777 | 114 | ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL) |
duke@435 | 115 | |
duke@435 | 116 | // JVM support |
duke@435 | 117 | jint compute_modifier_flags(TRAPS) const; |
duke@435 | 118 | |
duke@435 | 119 | private: |
duke@435 | 120 | static klassOop array_klass_impl (objArrayKlassHandle this_oop, bool or_null, int n, TRAPS); |
duke@435 | 121 | |
duke@435 | 122 | #ifndef PRODUCT |
duke@435 | 123 | public: |
duke@435 | 124 | // Printing |
duke@435 | 125 | void oop_print_on (oop obj, outputStream* st); |
duke@435 | 126 | void oop_print_value_on(oop obj, outputStream* st); |
duke@435 | 127 | #endif |
duke@435 | 128 | |
duke@435 | 129 | public: |
duke@435 | 130 | // Verification |
duke@435 | 131 | const char* internal_name() const; |
duke@435 | 132 | void oop_verify_on(oop obj, outputStream* st); |
duke@435 | 133 | void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty); |
coleenp@548 | 134 | void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty); |
duke@435 | 135 | |
duke@435 | 136 | }; |