src/share/vm/oops/typeArrayKlass.hpp

Wed, 22 Jan 2014 17:42:23 -0800

author
kvn
date
Wed, 22 Jan 2014 17:42:23 -0800
changeset 6503
a9becfeecd1b
parent 6198
55fb97c4c58d
child 6876
710a3c8b516e
permissions
-rw-r--r--

Merge

duke@435 1 /*
mikael@6198 2 * Copyright (c) 1997, 2013, 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
coleenp@5176 70 oop protection_domain() const { return NULL; }
coleenp@5176 71
duke@435 72 // Copying
duke@435 73 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
duke@435 74
duke@435 75 // Iteration
coleenp@4037 76 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk);
coleenp@4037 77 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr);
duke@435 78
duke@435 79 // Garbage collection
duke@435 80 void oop_follow_contents(oop obj);
duke@435 81 int oop_adjust_pointers(oop obj);
duke@435 82
duke@435 83 // Parallel Scavenge and Parallel Old
duke@435 84 PARALLEL_GC_DECLS
duke@435 85
duke@435 86 protected:
duke@435 87 // Find n'th dimensional array
coleenp@4037 88 virtual Klass* array_klass_impl(bool or_null, int n, TRAPS);
duke@435 89
duke@435 90 // Returns the array class with this class as element type
coleenp@4037 91 virtual Klass* array_klass_impl(bool or_null, TRAPS);
duke@435 92
duke@435 93 public:
coleenp@4037 94 // Casting from Klass*
coleenp@4142 95 static TypeArrayKlass* cast(Klass* k) {
coleenp@4142 96 assert(k->oop_is_typeArray(), "cast to TypeArrayKlass");
coleenp@4142 97 return (TypeArrayKlass*) k;
duke@435 98 }
duke@435 99
duke@435 100 // Naming
duke@435 101 static const char* external_name(BasicType type);
duke@435 102
duke@435 103 // Sizing
coleenp@4142 104 static int header_size() { return sizeof(TypeArrayKlass)/HeapWordSize; }
coleenp@4142 105 int size() const { return ArrayKlass::static_size(header_size()); }
duke@435 106
duke@435 107 // Initialization (virtual from Klass)
duke@435 108 void initialize(TRAPS);
duke@435 109
duke@435 110 public:
duke@435 111 // Printing
coleenp@4037 112 #ifndef PRODUCT
duke@435 113 void oop_print_on(oop obj, outputStream* st);
duke@435 114 #endif
coleenp@4037 115
coleenp@4037 116 void print_on(outputStream* st) const;
coleenp@4037 117 void print_value_on(outputStream* st) const;
coleenp@4037 118
duke@435 119 public:
duke@435 120 const char* internal_name() const;
duke@435 121 };
stefank@2314 122
stefank@2314 123 #endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP

mercurial