src/share/vm/oops/typeArrayKlass.hpp

Wed, 02 Jan 2013 20:28:09 -0500

author
coleenp
date
Wed, 02 Jan 2013 20:28:09 -0500
changeset 4395
cc6a617fffd2
parent 4142
d8ce2825b193
child 5176
6bd680e9ea35
permissions
-rw-r--r--

8005494: SIGSEGV in Rewriter::relocate_and_link() when testing Weblogic with CompressedOops and KlassPtrs
Summary: Relocate functions with jsr's when rewriting so not repeated after reading shared archive
Reviewed-by: twisti, jrose

duke@435 1 /*
coleenp@4037 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_TYPEARRAYKLASS_HPP
stefank@2314 26 #define SHARE_VM_OOPS_TYPEARRAYKLASS_HPP
stefank@2314 27
coleenp@4037 28 #include "classfile/classLoaderData.hpp"
stefank@2314 29 #include "oops/arrayKlass.hpp"
stefank@2314 30
coleenp@4142 31 // A TypeArrayKlass is the klass of a typeArray
duke@435 32 // It contains the type and size of the elements
duke@435 33
coleenp@4142 34 class TypeArrayKlass : public ArrayKlass {
duke@435 35 friend class VMStructs;
duke@435 36 private:
duke@435 37 jint _max_length; // maximum number of elements allowed in an array
coleenp@4037 38
coleenp@4037 39 // Constructor
coleenp@4142 40 TypeArrayKlass(BasicType type, Symbol* name);
coleenp@4142 41 static TypeArrayKlass* allocate(ClassLoaderData* loader_data, BasicType type, Symbol* name, TRAPS);
duke@435 42 public:
coleenp@4142 43 TypeArrayKlass() {} // For dummy objects.
coleenp@4037 44
duke@435 45 // instance variables
duke@435 46 jint max_length() { return _max_length; }
duke@435 47 void set_max_length(jint m) { _max_length = m; }
duke@435 48
duke@435 49 // testers
duke@435 50 bool oop_is_typeArray_slow() const { return true; }
duke@435 51
duke@435 52 // klass allocation
coleenp@4142 53 static TypeArrayKlass* create_klass(BasicType type, const char* name_str,
jcoomes@916 54 TRAPS);
coleenp@4037 55 static inline Klass* create_klass(BasicType type, int scale, TRAPS) {
coleenp@4142 56 TypeArrayKlass* tak = create_klass(type, external_name(type), CHECK_NULL);
coleenp@4037 57 assert(scale == (1 << tak->log2_element_size()), "scale must check out");
coleenp@4037 58 return tak;
jcoomes@916 59 }
duke@435 60
duke@435 61 int oop_size(oop obj) const;
duke@435 62
coleenp@4037 63 bool compute_is_subtype_of(Klass* k);
duke@435 64
duke@435 65 // Allocation
kvn@3157 66 typeArrayOop allocate_common(int length, bool do_zero, TRAPS);
kvn@3157 67 typeArrayOop allocate(int length, TRAPS) { return allocate_common(length, true, THREAD); }
duke@435 68 oop multi_allocate(int rank, jint* sizes, TRAPS);
duke@435 69
duke@435 70 // Copying
duke@435 71 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
duke@435 72
duke@435 73 // Iteration
coleenp@4037 74 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk);
coleenp@4037 75 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr);
duke@435 76
duke@435 77 // Garbage collection
duke@435 78 void oop_follow_contents(oop obj);
duke@435 79 int oop_adjust_pointers(oop obj);
duke@435 80
duke@435 81 // Parallel Scavenge and Parallel Old
duke@435 82 PARALLEL_GC_DECLS
duke@435 83
duke@435 84 protected:
duke@435 85 // Find n'th dimensional array
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 TypeArrayKlass* cast(Klass* k) {
coleenp@4142 94 assert(k->oop_is_typeArray(), "cast to TypeArrayKlass");
coleenp@4142 95 return (TypeArrayKlass*) k;
duke@435 96 }
duke@435 97
duke@435 98 // Naming
duke@435 99 static const char* external_name(BasicType type);
duke@435 100
duke@435 101 // Sizing
coleenp@4142 102 static int header_size() { return sizeof(TypeArrayKlass)/HeapWordSize; }
coleenp@4142 103 int size() const { return ArrayKlass::static_size(header_size()); }
duke@435 104
duke@435 105 // Initialization (virtual from Klass)
duke@435 106 void initialize(TRAPS);
duke@435 107
duke@435 108 public:
duke@435 109 // Printing
coleenp@4037 110 #ifndef PRODUCT
duke@435 111 void oop_print_on(oop obj, outputStream* st);
duke@435 112 #endif
coleenp@4037 113
coleenp@4037 114 void print_on(outputStream* st) const;
coleenp@4037 115 void print_value_on(outputStream* st) const;
coleenp@4037 116
duke@435 117 public:
duke@435 118 const char* internal_name() const;
duke@435 119 };
stefank@2314 120
stefank@2314 121 #endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP

mercurial