annotate src/share/vm/oops/compiledICHolderKlass.cpp @ 974:26b774d693aa

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