annotate src/share/vm/oops/objArrayKlass.hpp @ 4155:394404b2d9bd

Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
author Doug Simon <doug.simon@oracle.com>
date Wed, 21 Dec 2011 11:25:27 +0100
parents f95d63e2154a
children 069ab3f976d3
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: 1311
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1311
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: 1311
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_OBJARRAYKLASS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_OOPS_OBJARRAYKLASS_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 "memory/specialized_oop_closures.hpp"
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 #include "oops/instanceKlass.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31
0
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // objArrayKlass is the klass for objArrays
a61af66fc99e Initial load
duke
parents:
diff changeset
33
a61af66fc99e Initial load
duke
parents:
diff changeset
34 class objArrayKlass : 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 klassOop _element_klass; // The klass of the elements of this array type
a61af66fc99e Initial load
duke
parents:
diff changeset
38 klassOop _bottom_klass; // The one-dimensional type (instanceKlass or typeArrayKlass)
a61af66fc99e Initial load
duke
parents:
diff changeset
39 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // Instance variables
a61af66fc99e Initial load
duke
parents:
diff changeset
41 klassOop element_klass() const { return _element_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
42 void set_element_klass(klassOop k) { oop_store_without_check((oop*) &_element_klass, (oop) k); }
a61af66fc99e Initial load
duke
parents:
diff changeset
43 oop* element_klass_addr() { return (oop*)&_element_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 klassOop bottom_klass() const { return _bottom_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
46 void set_bottom_klass(klassOop k) { oop_store_without_check((oop*) &_bottom_klass, (oop) k); }
a61af66fc99e Initial load
duke
parents:
diff changeset
47 oop* bottom_klass_addr() { return (oop*)&_bottom_klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // Compiler/Interpreter offset
a61af66fc99e Initial load
duke
parents:
diff changeset
50 static int element_klass_offset_in_bytes() { return offset_of(objArrayKlass, _element_klass); }
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // Dispatched operation
a61af66fc99e Initial load
duke
parents:
diff changeset
53 bool can_be_primary_super_slow() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 bool compute_is_subtype_of(klassOop k);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 bool oop_is_objArray_slow() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
57 int oop_size(oop obj) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 int klass_oop_size() const { return object_size(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // Allocation
a61af66fc99e Initial load
duke
parents:
diff changeset
61 DEFINE_ALLOCATE_PERMANENT(objArrayKlass);
a61af66fc99e Initial load
duke
parents:
diff changeset
62 objArrayOop allocate(int length, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
63 oop multi_allocate(int rank, jint* sizes, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // Copying
a61af66fc99e Initial load
duke
parents:
diff changeset
66 void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // Compute protection domain
a61af66fc99e Initial load
duke
parents:
diff changeset
69 oop protection_domain() { return Klass::cast(bottom_klass())->protection_domain(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // Compute class loader
a61af66fc99e Initial load
duke
parents:
diff changeset
71 oop class_loader() const { return Klass::cast(bottom_klass())->class_loader(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
72
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
73 private:
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
74 // Either oop or narrowOop depending on UseCompressedOops.
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
75 // must be called from within objArrayKlass.cpp
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
76 template <class T> void do_copy(arrayOop s, T* src, arrayOop d,
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
77 T* dst, int length, TRAPS);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
78 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // Returns the objArrayKlass for n'th dimension.
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 objArrayKlass* cast(klassOop k) {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 assert(k->klass_part()->oop_is_objArray_slow(), "cast to objArrayKlass");
a61af66fc99e Initial load
duke
parents:
diff changeset
89 return (objArrayKlass*) 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 // Sizing
a61af66fc99e Initial load
duke
parents:
diff changeset
93 static int header_size() { return oopDesc::header_size() + sizeof(objArrayKlass)/HeapWordSize; }
a61af66fc99e Initial load
duke
parents:
diff changeset
94 int object_size() const { return arrayKlass::object_size(header_size()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // Initialization (virtual from Klass)
a61af66fc99e Initial load
duke
parents:
diff changeset
97 void initialize(TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Garbage collection
a61af66fc99e Initial load
duke
parents:
diff changeset
100 void oop_follow_contents(oop obj);
1311
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
101 inline void oop_follow_contents(oop obj, int index);
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
102 template <class T> inline void objarray_follow_contents(oop obj, int index);
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
103
0
a61af66fc99e Initial load
duke
parents:
diff changeset
104 int oop_adjust_pointers(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Parallel Scavenge and Parallel Old
a61af66fc99e Initial load
duke
parents:
diff changeset
107 PARALLEL_GC_DECLS
1311
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
108 #ifndef SERIALGC
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
109 inline void oop_follow_contents(ParCompactionManager* cm, oop obj, int index);
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
110 template <class T> inline void
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
111 objarray_follow_contents(ParCompactionManager* cm, oop obj, int index);
2a1472c30599 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 1155
diff changeset
112 #endif // !SERIALGC
0
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // Iterators
a61af66fc99e Initial load
duke
parents:
diff changeset
115 int oop_oop_iterate(oop obj, OopClosure* blk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 return oop_oop_iterate_v(obj, blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 }
a61af66fc99e Initial load
duke
parents:
diff changeset
118 int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 return oop_oop_iterate_v_m(obj, blk, mr);
a61af66fc99e Initial load
duke
parents:
diff changeset
120 }
a61af66fc99e Initial load
duke
parents:
diff changeset
121 #define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
a61af66fc99e Initial load
duke
parents:
diff changeset
122 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
a61af66fc99e Initial load
duke
parents:
diff changeset
123 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
124 MemRegion mr); \
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
125 int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
126 int start, int end);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 113
diff changeset
129 ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // JVM support
a61af66fc99e Initial load
duke
parents:
diff changeset
132 jint compute_modifier_flags(TRAPS) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
135 static klassOop array_klass_impl (objArrayKlassHandle this_oop, bool or_null, int n, TRAPS);
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
138 // Printing
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 356
diff changeset
139 void oop_print_value_on(oop obj, outputStream* st);
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 356
diff changeset
140 #ifndef PRODUCT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
141 void oop_print_on (oop obj, outputStream* st);
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 356
diff changeset
142 #endif //PRODUCT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
145 const char* internal_name() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
146 void oop_verify_on(oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
148 void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
149 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
150
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
151 #endif // SHARE_VM_OOPS_OBJARRAYKLASS_HPP