annotate src/share/vm/oops/typeArrayKlass.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents a92cdbac8b9e
children d8ce2825b193
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
2 * Copyright (c) 1997, 2012, 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
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
28 #include "classfile/classLoaderData.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "oops/arrayKlass.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30
0
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // A typeArrayKlass is the klass of a typeArray
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // It contains the type and size of the elements
a61af66fc99e Initial load
duke
parents:
diff changeset
33
a61af66fc99e Initial load
duke
parents:
diff changeset
34 class typeArrayKlass : public arrayKlass {
a61af66fc99e Initial load
duke
parents:
diff changeset
35 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
37 jint _max_length; // maximum number of elements allowed in an array
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
38
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
39 // Constructor
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
40 typeArrayKlass(BasicType type, Symbol* name);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
41 static typeArrayKlass* allocate(ClassLoaderData* loader_data, BasicType type, Symbol* name, TRAPS);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
42 public:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
43 typeArrayKlass() {} // For dummy objects.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
44
0
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // instance variables
a61af66fc99e Initial load
duke
parents:
diff changeset
46 jint max_length() { return _max_length; }
a61af66fc99e Initial load
duke
parents:
diff changeset
47 void set_max_length(jint m) { _max_length = m; }
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // testers
a61af66fc99e Initial load
duke
parents:
diff changeset
50 bool oop_is_typeArray_slow() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // klass allocation
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
53 static typeArrayKlass* create_klass(BasicType type, const char* name_str,
481
7d7a7c599c17 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 0
diff changeset
54 TRAPS);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
55 static inline Klass* create_klass(BasicType type, int scale, TRAPS) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
56 typeArrayKlass* tak = create_klass(type, external_name(type), CHECK_NULL);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
57 assert(scale == (1 << tak->log2_element_size()), "scale must check out");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
58 return tak;
481
7d7a7c599c17 6578152: fill_region_with_object has usability and safety issues
jcoomes
parents: 0
diff changeset
59 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 int oop_size(oop obj) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
62
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
63 bool compute_is_subtype_of(Klass* k);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // Allocation
3961
a92cdbac8b9e 7081933: Use zeroing elimination optimization for large array
kvn
parents: 1972
diff changeset
66 typeArrayOop allocate_common(int length, bool do_zero, TRAPS);
a92cdbac8b9e 7081933: Use zeroing elimination optimization for large array
kvn
parents: 1972
diff changeset
67 typeArrayOop allocate(int length, TRAPS) { return allocate_common(length, true, THREAD); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
68 oop multi_allocate(int rank, jint* sizes, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // Copying
a61af66fc99e Initial load
duke
parents:
diff changeset
71 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Iteration
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
74 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
75 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // Garbage collection
a61af66fc99e Initial load
duke
parents:
diff changeset
78 void oop_follow_contents(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
79 int oop_adjust_pointers(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // Parallel Scavenge and Parallel Old
a61af66fc99e Initial load
duke
parents:
diff changeset
82 PARALLEL_GC_DECLS
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // Find n'th dimensional array
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
86 virtual Klass* array_klass_impl(bool or_null, int n, TRAPS);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // Returns the array class with this class as element type
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
89 virtual Klass* array_klass_impl(bool or_null, TRAPS);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 public:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
92 // Casting from Klass*
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
93 static typeArrayKlass* cast(Klass* k) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
94 assert(k->oop_is_typeArray(), "cast to typeArrayKlass");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
95 return (typeArrayKlass*) k;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // Naming
a61af66fc99e Initial load
duke
parents:
diff changeset
99 static const char* external_name(BasicType type);
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 // Sizing
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
102 static int header_size() { return sizeof(typeArrayKlass)/HeapWordSize; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
103 int size() const { return arrayKlass::static_size(header_size()); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // Initialization (virtual from Klass)
a61af66fc99e Initial load
duke
parents:
diff changeset
106 void initialize(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // Printing
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
110 #ifndef PRODUCT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
111 void oop_print_on(oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 #endif
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
113
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
114 void print_on(outputStream* st) const;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
115 void print_value_on(outputStream* st) const;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 3961
diff changeset
116
0
a61af66fc99e Initial load
duke
parents:
diff changeset
117 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
118 const char* internal_name() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
120
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
121 #endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP