annotate src/share/vm/oops/typeArrayKlass.hpp @ 6123:2fe087c3e814

7172967: Eliminate constMethod's _method backpointer to methodOop. Summary: Eliminate constMethod's _method backpointer to methodOop, and move the _constant field from methodOop to constMethod. Reviewed-by: roland, bdelsart, kamg
author jiangli
date Wed, 06 Jun 2012 14:33:43 -0400
parents a92cdbac8b9e
children da91efe96a93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 579
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 579
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 579
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_OOPS_TYPEARRAYKLASS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_OOPS_TYPEARRAYKLASS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "oops/arrayKlass.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29
0
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // A typeArrayKlass is the klass of a typeArray
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // It contains the type and size of the elements
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 class typeArrayKlass : public arrayKlass {
a61af66fc99e Initial load
duke
parents:
diff changeset
34 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
36 jint _max_length; // maximum number of elements allowed in an array
a61af66fc99e Initial load
duke
parents:
diff changeset
37 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // instance variables
a61af66fc99e Initial load
duke
parents:
diff changeset
39 jint max_length() { return _max_length; }
a61af66fc99e Initial load
duke
parents:
diff changeset
40 void set_max_length(jint m) { _max_length = m; }
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // testers
a61af66fc99e Initial load
duke
parents:
diff changeset
43 bool oop_is_typeArray_slow() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // klass allocation
a61af66fc99e Initial load
duke
parents:
diff changeset
46 DEFINE_ALLOCATE_PERMANENT(typeArrayKlass);
481
7d7a7c599c17 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 0
diff changeset
47 static klassOop create_klass(BasicType type, int scale, const char* name_str,
7d7a7c599c17 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 0
diff changeset
48 TRAPS);
7d7a7c599c17 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 0
diff changeset
49 static inline klassOop create_klass(BasicType type, int scale, TRAPS) {
7d7a7c599c17 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 0
diff changeset
50 return create_klass(type, scale, external_name(type), CHECK_NULL);
7d7a7c599c17 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 0
diff changeset
51 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 int oop_size(oop obj) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 int klass_oop_size() const { return object_size(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 bool compute_is_subtype_of(klassOop k);
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // Allocation
3961
a92cdbac8b9e 7081933: Use zeroing elimination optimization for large array
kvn
parents: 1972
diff changeset
59 typeArrayOop allocate_common(int length, bool do_zero, TRAPS);
a92cdbac8b9e 7081933: Use zeroing elimination optimization for large array
kvn
parents: 1972
diff changeset
60 typeArrayOop allocate(int length, TRAPS) { return allocate_common(length, true, THREAD); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61 typeArrayOop allocate_permanent(int length, TRAPS); // used for class file structures
a61af66fc99e Initial load
duke
parents:
diff changeset
62 oop multi_allocate(int rank, jint* sizes, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // Copying
a61af66fc99e Initial load
duke
parents:
diff changeset
65 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Iteration
a61af66fc99e Initial load
duke
parents:
diff changeset
68 int oop_oop_iterate(oop obj, OopClosure* blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
69 int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // Garbage collection
a61af66fc99e Initial load
duke
parents:
diff changeset
72 void oop_follow_contents(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
73 int oop_adjust_pointers(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // Parallel Scavenge and Parallel Old
a61af66fc99e Initial load
duke
parents:
diff changeset
76 PARALLEL_GC_DECLS
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // Find n'th dimensional array
a61af66fc99e Initial load
duke
parents:
diff changeset
80 virtual klassOop array_klass_impl(bool or_null, int n, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // Returns the array class with this class as element type
a61af66fc99e Initial load
duke
parents:
diff changeset
83 virtual klassOop array_klass_impl(bool or_null, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // Casting from klassOop
a61af66fc99e Initial load
duke
parents:
diff changeset
87 static typeArrayKlass* cast(klassOop k) {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 assert(k->klass_part()->oop_is_typeArray_slow(), "cast to typeArrayKlass");
a61af66fc99e Initial load
duke
parents:
diff changeset
89 return (typeArrayKlass*) k->klass_part();
a61af66fc99e Initial load
duke
parents:
diff changeset
90 }
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // Naming
a61af66fc99e Initial load
duke
parents:
diff changeset
93 static const char* external_name(BasicType type);
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // Sizing
a61af66fc99e Initial load
duke
parents:
diff changeset
96 static int header_size() { return oopDesc::header_size() + sizeof(typeArrayKlass)/HeapWordSize; }
a61af66fc99e Initial load
duke
parents:
diff changeset
97 int object_size() const { return arrayKlass::object_size(header_size()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Initialization (virtual from Klass)
a61af66fc99e Initial load
duke
parents:
diff changeset
100 void initialize(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // Helpers
a61af66fc99e Initial load
duke
parents:
diff changeset
104 static klassOop array_klass_impl(typeArrayKlassHandle h_this, bool or_null, int n, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
107 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // Printing
a61af66fc99e Initial load
duke
parents:
diff changeset
109 void oop_print_on(oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
111 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
112 const char* internal_name() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
113 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
114
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
115 #endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP