author | coleenp |
Mon, 27 Jul 2009 17:23:52 -0400 | |
changeset 3579 | b18b94266d60 |
parent 1388 | 3677f5f3d66b |
child 4584 | e2a449e8cc6f |
permissions | -rw-r--r-- |
1 | 1 |
/* |
670 | 2 |
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 |
* have any questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
// objArrayKlass is the klass for objArrays |
|
26 |
||
27 |
class objArrayKlass : public arrayKlass { |
|
28 |
friend class VMStructs; |
|
29 |
private: |
|
30 |
klassOop _element_klass; // The klass of the elements of this array type |
|
31 |
klassOop _bottom_klass; // The one-dimensional type (instanceKlass or typeArrayKlass) |
|
32 |
public: |
|
33 |
// Instance variables |
|
34 |
klassOop element_klass() const { return _element_klass; } |
|
35 |
void set_element_klass(klassOop k) { oop_store_without_check((oop*) &_element_klass, (oop) k); } |
|
36 |
oop* element_klass_addr() { return (oop*)&_element_klass; } |
|
37 |
||
38 |
klassOop bottom_klass() const { return _bottom_klass; } |
|
39 |
void set_bottom_klass(klassOop k) { oop_store_without_check((oop*) &_bottom_klass, (oop) k); } |
|
40 |
oop* bottom_klass_addr() { return (oop*)&_bottom_klass; } |
|
41 |
||
42 |
// Compiler/Interpreter offset |
|
43 |
static int element_klass_offset_in_bytes() { return offset_of(objArrayKlass, _element_klass); } |
|
44 |
||
45 |
// Dispatched operation |
|
46 |
bool can_be_primary_super_slow() const; |
|
47 |
objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS); |
|
48 |
bool compute_is_subtype_of(klassOop k); |
|
49 |
bool oop_is_objArray_slow() const { return true; } |
|
50 |
int oop_size(oop obj) const; |
|
51 |
int klass_oop_size() const { return object_size(); } |
|
52 |
||
53 |
// Allocation |
|
54 |
DEFINE_ALLOCATE_PERMANENT(objArrayKlass); |
|
55 |
objArrayOop allocate(int length, TRAPS); |
|
56 |
oop multi_allocate(int rank, jint* sizes, TRAPS); |
|
57 |
||
58 |
// Copying |
|
59 |
void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); |
|
60 |
||
61 |
// Compute protection domain |
|
62 |
oop protection_domain() { return Klass::cast(bottom_klass())->protection_domain(); } |
|
63 |
// Compute class loader |
|
64 |
oop class_loader() const { return Klass::cast(bottom_klass())->class_loader(); } |
|
65 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
66 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
67 |
// Either oop or narrowOop depending on UseCompressedOops. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
68 |
// must be called from within objArrayKlass.cpp |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
69 |
template <class T> void do_copy(arrayOop s, T* src, arrayOop d, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
70 |
T* dst, int length, TRAPS); |
1 | 71 |
protected: |
72 |
// Returns the objArrayKlass for n'th dimension. |
|
73 |
virtual klassOop array_klass_impl(bool or_null, int n, TRAPS); |
|
74 |
||
75 |
// Returns the array class with this class as element type. |
|
76 |
virtual klassOop array_klass_impl(bool or_null, TRAPS); |
|
77 |
||
78 |
public: |
|
79 |
// Casting from klassOop |
|
80 |
static objArrayKlass* cast(klassOop k) { |
|
81 |
assert(k->klass_part()->oop_is_objArray_slow(), "cast to objArrayKlass"); |
|
82 |
return (objArrayKlass*) k->klass_part(); |
|
83 |
} |
|
84 |
||
85 |
// Sizing |
|
86 |
static int header_size() { return oopDesc::header_size() + sizeof(objArrayKlass)/HeapWordSize; } |
|
87 |
int object_size() const { return arrayKlass::object_size(header_size()); } |
|
88 |
||
89 |
// Initialization (virtual from Klass) |
|
90 |
void initialize(TRAPS); |
|
91 |
||
92 |
// Garbage collection |
|
93 |
void oop_follow_contents(oop obj); |
|
94 |
int oop_adjust_pointers(oop obj); |
|
95 |
||
96 |
// Parallel Scavenge and Parallel Old |
|
97 |
PARALLEL_GC_DECLS |
|
98 |
||
99 |
// Iterators |
|
100 |
int oop_oop_iterate(oop obj, OopClosure* blk) { |
|
101 |
return oop_oop_iterate_v(obj, blk); |
|
102 |
} |
|
103 |
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { |
|
104 |
return oop_oop_iterate_v_m(obj, blk, mr); |
|
105 |
} |
|
106 |
#define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
|
107 |
int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ |
|
108 |
int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \ |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
109 |
MemRegion mr); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
110 |
int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
111 |
int start, int end); |
1 | 112 |
|
113 |
ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL) |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
114 |
ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL) |
1 | 115 |
|
116 |
// JVM support |
|
117 |
jint compute_modifier_flags(TRAPS) const; |
|
118 |
||
119 |
private: |
|
120 |
static klassOop array_klass_impl (objArrayKlassHandle this_oop, bool or_null, int n, TRAPS); |
|
121 |
||
122 |
#ifndef PRODUCT |
|
123 |
public: |
|
124 |
// Printing |
|
125 |
void oop_print_on (oop obj, outputStream* st); |
|
126 |
void oop_print_value_on(oop obj, outputStream* st); |
|
127 |
#endif |
|
128 |
||
129 |
public: |
|
130 |
// Verification |
|
131 |
const char* internal_name() const; |
|
132 |
void oop_verify_on(oop obj, outputStream* st); |
|
133 |
void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
134 |
void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty); |
1 | 135 |
|
136 |
}; |