annotate src/share/vm/oops/objArrayKlass.hpp @ 45:48a3fa21394b

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