1
|
1 |
/*
|
|
2 |
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
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 |
# include "incls/_precompiled.incl"
|
|
26 |
# include "incls/_compiledICHolderKlass.cpp.incl"
|
|
27 |
|
|
28 |
klassOop compiledICHolderKlass::create_klass(TRAPS) {
|
|
29 |
compiledICHolderKlass o;
|
|
30 |
KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
|
|
31 |
KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
|
|
32 |
// Make sure size calculation is right
|
|
33 |
assert(k()->size() == align_object_size(header_size()), "wrong size for object");
|
|
34 |
java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
|
|
35 |
return k();
|
|
36 |
}
|
|
37 |
|
|
38 |
|
|
39 |
compiledICHolderOop compiledICHolderKlass::allocate(TRAPS) {
|
|
40 |
KlassHandle h_k(THREAD, as_klassOop());
|
|
41 |
int size = compiledICHolderOopDesc::object_size();
|
|
42 |
compiledICHolderOop c = (compiledICHolderOop)
|
|
43 |
CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL);
|
|
44 |
c->set_holder_method(NULL);
|
|
45 |
c->set_holder_klass(NULL);
|
|
46 |
return c;
|
|
47 |
}
|
|
48 |
|
|
49 |
|
|
50 |
int compiledICHolderKlass::oop_size(oop obj) const {
|
|
51 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
52 |
return compiledICHolderOop(obj)->object_size();
|
|
53 |
}
|
|
54 |
|
|
55 |
void compiledICHolderKlass::oop_follow_contents(oop obj) {
|
|
56 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
57 |
compiledICHolderOop c = compiledICHolderOop(obj);
|
|
58 |
|
|
59 |
obj->follow_header();
|
|
60 |
MarkSweep::mark_and_push(c->adr_holder_method());
|
|
61 |
MarkSweep::mark_and_push(c->adr_holder_klass());
|
|
62 |
}
|
|
63 |
|
|
64 |
#ifndef SERIALGC
|
|
65 |
void compiledICHolderKlass::oop_follow_contents(ParCompactionManager* cm,
|
|
66 |
oop obj) {
|
|
67 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
68 |
compiledICHolderOop c = compiledICHolderOop(obj);
|
|
69 |
|
|
70 |
obj->follow_header(cm);
|
|
71 |
PSParallelCompact::mark_and_push(cm, c->adr_holder_method());
|
|
72 |
PSParallelCompact::mark_and_push(cm, c->adr_holder_klass());
|
|
73 |
}
|
|
74 |
#endif // SERIALGC
|
|
75 |
|
|
76 |
|
|
77 |
int compiledICHolderKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
|
|
78 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
79 |
compiledICHolderOop c = compiledICHolderOop(obj);
|
|
80 |
// Get size before changing pointers.
|
|
81 |
// Don't call size() or oop_size() since that is a virtual call.
|
|
82 |
int size = c->object_size();
|
|
83 |
|
|
84 |
obj->oop_iterate_header(blk);
|
|
85 |
blk->do_oop(c->adr_holder_method());
|
|
86 |
blk->do_oop(c->adr_holder_klass());
|
|
87 |
return size;
|
|
88 |
}
|
|
89 |
|
|
90 |
int compiledICHolderKlass::oop_oop_iterate_m(oop obj, OopClosure* blk,
|
|
91 |
MemRegion mr) {
|
|
92 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
93 |
compiledICHolderOop c = compiledICHolderOop(obj);
|
|
94 |
// Get size before changing pointers.
|
|
95 |
// Don't call size() or oop_size() since that is a virtual call.
|
|
96 |
int size = c->object_size();
|
|
97 |
|
|
98 |
obj->oop_iterate_header(blk, mr);
|
|
99 |
|
|
100 |
oop* adr;
|
|
101 |
adr = c->adr_holder_method();
|
|
102 |
if (mr.contains(adr)) blk->do_oop(adr);
|
|
103 |
adr = c->adr_holder_klass();
|
|
104 |
if (mr.contains(adr)) blk->do_oop(adr);
|
|
105 |
return size;
|
|
106 |
}
|
|
107 |
|
|
108 |
|
|
109 |
int compiledICHolderKlass::oop_adjust_pointers(oop obj) {
|
|
110 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
111 |
compiledICHolderOop c = compiledICHolderOop(obj);
|
|
112 |
// Get size before changing pointers.
|
|
113 |
// Don't call size() or oop_size() since that is a virtual call.
|
|
114 |
int size = c->object_size();
|
|
115 |
|
|
116 |
MarkSweep::adjust_pointer(c->adr_holder_method());
|
|
117 |
MarkSweep::adjust_pointer(c->adr_holder_klass());
|
|
118 |
obj->adjust_header();
|
|
119 |
return size;
|
|
120 |
}
|
|
121 |
|
|
122 |
#ifndef SERIALGC
|
|
123 |
void compiledICHolderKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) {
|
|
124 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
125 |
}
|
|
126 |
|
|
127 |
void compiledICHolderKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
|
|
128 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
129 |
}
|
|
130 |
|
|
131 |
int compiledICHolderKlass::oop_update_pointers(ParCompactionManager* cm,
|
|
132 |
oop obj) {
|
|
133 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
134 |
compiledICHolderOop c = compiledICHolderOop(obj);
|
|
135 |
|
|
136 |
PSParallelCompact::adjust_pointer(c->adr_holder_method());
|
|
137 |
PSParallelCompact::adjust_pointer(c->adr_holder_klass());
|
|
138 |
return c->object_size();
|
|
139 |
}
|
|
140 |
|
|
141 |
int compiledICHolderKlass::oop_update_pointers(ParCompactionManager* cm,
|
|
142 |
oop obj,
|
|
143 |
HeapWord* beg_addr,
|
|
144 |
HeapWord* end_addr) {
|
|
145 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
146 |
compiledICHolderOop c = compiledICHolderOop(obj);
|
|
147 |
|
|
148 |
oop* p;
|
|
149 |
p = c->adr_holder_method();
|
|
150 |
PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
|
|
151 |
p = c->adr_holder_klass();
|
|
152 |
PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
|
|
153 |
return c->object_size();
|
|
154 |
}
|
|
155 |
#endif // SERIALGC
|
|
156 |
|
|
157 |
#ifndef PRODUCT
|
|
158 |
|
|
159 |
// Printing
|
|
160 |
|
|
161 |
void compiledICHolderKlass::oop_print_on(oop obj, outputStream* st) {
|
|
162 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
163 |
Klass::oop_print_on(obj, st);
|
|
164 |
compiledICHolderOop c = compiledICHolderOop(obj);
|
|
165 |
st->print(" - method: "); c->holder_method()->print_value_on(st); st->cr();
|
|
166 |
st->print(" - klass: "); c->holder_klass()->print_value_on(st); st->cr();
|
|
167 |
}
|
|
168 |
|
|
169 |
|
|
170 |
void compiledICHolderKlass::oop_print_value_on(oop obj, outputStream* st) {
|
|
171 |
assert(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
172 |
Klass::oop_print_value_on(obj, st);
|
|
173 |
}
|
|
174 |
#endif
|
|
175 |
|
|
176 |
const char* compiledICHolderKlass::internal_name() const {
|
|
177 |
return "{compiledICHolder}";
|
|
178 |
}
|
|
179 |
|
|
180 |
// Verification
|
|
181 |
|
|
182 |
void compiledICHolderKlass::oop_verify_on(oop obj, outputStream* st) {
|
|
183 |
Klass::oop_verify_on(obj, st);
|
|
184 |
guarantee(obj->is_compiledICHolder(), "must be compiledICHolder");
|
|
185 |
compiledICHolderOop c = compiledICHolderOop(obj);
|
|
186 |
guarantee(c->is_perm(), "should be in permspace");
|
|
187 |
guarantee(c->holder_method()->is_perm(), "should be in permspace");
|
|
188 |
guarantee(c->holder_method()->is_method(), "should be method");
|
|
189 |
guarantee(c->holder_klass()->is_perm(), "should be in permspace");
|
|
190 |
guarantee(c->holder_klass()->is_klass(), "should be klass");
|
|
191 |
}
|