1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
110 m->set_prev_time(0); |
110 m->set_prev_time(0); |
111 #endif |
111 #endif |
112 |
112 |
113 assert(m->is_parsable(), "must be parsable here."); |
113 assert(m->is_parsable(), "must be parsable here."); |
114 assert(m->size() == size, "wrong size for object"); |
114 assert(m->size() == size, "wrong size for object"); |
115 // We should not publish an uprasable object's reference |
|
116 // into one that is parsable, since that presents problems |
|
117 // for the concurrent parallel marking and precleaning phases |
|
118 // of concurrent gc (CMS). |
|
119 xconst->set_method(m); |
|
120 return m; |
115 return m; |
121 } |
116 } |
122 |
117 |
123 |
118 |
124 void methodKlass::oop_follow_contents(oop obj) { |
119 void methodKlass::oop_follow_contents(oop obj) { |
125 assert (obj->is_method(), "object must be method"); |
120 assert (obj->is_method(), "object must be method"); |
126 methodOop m = methodOop(obj); |
121 methodOop m = methodOop(obj); |
127 // Performance tweak: We skip iterating over the klass pointer since we |
122 // Performance tweak: We skip iterating over the klass pointer since we |
128 // know that Universe::methodKlassObj never moves. |
123 // know that Universe::methodKlassObj never moves. |
129 MarkSweep::mark_and_push(m->adr_constMethod()); |
124 MarkSweep::mark_and_push(m->adr_constMethod()); |
130 MarkSweep::mark_and_push(m->adr_constants()); |
|
131 if (m->method_data() != NULL) { |
125 if (m->method_data() != NULL) { |
132 MarkSweep::mark_and_push(m->adr_method_data()); |
126 MarkSweep::mark_and_push(m->adr_method_data()); |
133 } |
127 } |
134 } |
128 } |
135 |
129 |
139 assert (obj->is_method(), "object must be method"); |
133 assert (obj->is_method(), "object must be method"); |
140 methodOop m = methodOop(obj); |
134 methodOop m = methodOop(obj); |
141 // Performance tweak: We skip iterating over the klass pointer since we |
135 // Performance tweak: We skip iterating over the klass pointer since we |
142 // know that Universe::methodKlassObj never moves. |
136 // know that Universe::methodKlassObj never moves. |
143 PSParallelCompact::mark_and_push(cm, m->adr_constMethod()); |
137 PSParallelCompact::mark_and_push(cm, m->adr_constMethod()); |
144 PSParallelCompact::mark_and_push(cm, m->adr_constants()); |
|
145 #ifdef COMPILER2 |
138 #ifdef COMPILER2 |
146 if (m->method_data() != NULL) { |
139 if (m->method_data() != NULL) { |
147 PSParallelCompact::mark_and_push(cm, m->adr_method_data()); |
140 PSParallelCompact::mark_and_push(cm, m->adr_method_data()); |
148 } |
141 } |
149 #endif // COMPILER2 |
142 #endif // COMPILER2 |
157 // Don't call size() or oop_size() since that is a virtual call. |
150 // Don't call size() or oop_size() since that is a virtual call. |
158 int size = m->object_size(); |
151 int size = m->object_size(); |
159 // Performance tweak: We skip iterating over the klass pointer since we |
152 // Performance tweak: We skip iterating over the klass pointer since we |
160 // know that Universe::methodKlassObj never moves |
153 // know that Universe::methodKlassObj never moves |
161 blk->do_oop(m->adr_constMethod()); |
154 blk->do_oop(m->adr_constMethod()); |
162 blk->do_oop(m->adr_constants()); |
|
163 if (m->method_data() != NULL) { |
155 if (m->method_data() != NULL) { |
164 blk->do_oop(m->adr_method_data()); |
156 blk->do_oop(m->adr_method_data()); |
165 } |
157 } |
166 return size; |
158 return size; |
167 } |
159 } |
176 // Performance tweak: We skip iterating over the klass pointer since we |
168 // Performance tweak: We skip iterating over the klass pointer since we |
177 // know that Universe::methodKlassObj never moves. |
169 // know that Universe::methodKlassObj never moves. |
178 oop* adr; |
170 oop* adr; |
179 adr = m->adr_constMethod(); |
171 adr = m->adr_constMethod(); |
180 if (mr.contains(adr)) blk->do_oop(adr); |
172 if (mr.contains(adr)) blk->do_oop(adr); |
181 adr = m->adr_constants(); |
|
182 if (mr.contains(adr)) blk->do_oop(adr); |
|
183 if (m->method_data() != NULL) { |
173 if (m->method_data() != NULL) { |
184 adr = m->adr_method_data(); |
174 adr = m->adr_method_data(); |
185 if (mr.contains(adr)) blk->do_oop(adr); |
175 if (mr.contains(adr)) blk->do_oop(adr); |
186 } |
176 } |
187 return size; |
177 return size; |
195 // Don't call size() or oop_size() since that is a virtual call. |
185 // Don't call size() or oop_size() since that is a virtual call. |
196 int size = m->object_size(); |
186 int size = m->object_size(); |
197 // Performance tweak: We skip iterating over the klass pointer since we |
187 // Performance tweak: We skip iterating over the klass pointer since we |
198 // know that Universe::methodKlassObj never moves. |
188 // know that Universe::methodKlassObj never moves. |
199 MarkSweep::adjust_pointer(m->adr_constMethod()); |
189 MarkSweep::adjust_pointer(m->adr_constMethod()); |
200 MarkSweep::adjust_pointer(m->adr_constants()); |
|
201 if (m->method_data() != NULL) { |
190 if (m->method_data() != NULL) { |
202 MarkSweep::adjust_pointer(m->adr_method_data()); |
191 MarkSweep::adjust_pointer(m->adr_method_data()); |
203 } |
192 } |
204 return size; |
193 return size; |
205 } |
194 } |
211 |
200 |
212 int methodKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
201 int methodKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
213 assert(obj->is_method(), "should be method"); |
202 assert(obj->is_method(), "should be method"); |
214 methodOop m = methodOop(obj); |
203 methodOop m = methodOop(obj); |
215 PSParallelCompact::adjust_pointer(m->adr_constMethod()); |
204 PSParallelCompact::adjust_pointer(m->adr_constMethod()); |
216 PSParallelCompact::adjust_pointer(m->adr_constants()); |
|
217 #ifdef COMPILER2 |
205 #ifdef COMPILER2 |
218 if (m->method_data() != NULL) { |
206 if (m->method_data() != NULL) { |
219 PSParallelCompact::adjust_pointer(m->adr_method_data()); |
207 PSParallelCompact::adjust_pointer(m->adr_method_data()); |
220 } |
208 } |
221 #endif // COMPILER2 |
209 #endif // COMPILER2 |
337 Klass::oop_verify_on(obj, st); |
325 Klass::oop_verify_on(obj, st); |
338 guarantee(obj->is_method(), "object must be method"); |
326 guarantee(obj->is_method(), "object must be method"); |
339 if (!obj->partially_loaded()) { |
327 if (!obj->partially_loaded()) { |
340 methodOop m = methodOop(obj); |
328 methodOop m = methodOop(obj); |
341 guarantee(m->is_perm(), "should be in permspace"); |
329 guarantee(m->is_perm(), "should be in permspace"); |
342 guarantee(m->constants()->is_perm(), "should be in permspace"); |
|
343 guarantee(m->constants()->is_constantPool(), "should be constant pool"); |
|
344 guarantee(m->constMethod()->is_constMethod(), "should be constMethodOop"); |
330 guarantee(m->constMethod()->is_constMethod(), "should be constMethodOop"); |
345 guarantee(m->constMethod()->is_perm(), "should be in permspace"); |
331 guarantee(m->constMethod()->is_perm(), "should be in permspace"); |
346 methodDataOop method_data = m->method_data(); |
332 methodDataOop method_data = m->method_data(); |
347 guarantee(method_data == NULL || |
333 guarantee(method_data == NULL || |
348 method_data->is_perm(), "should be in permspace"); |
334 method_data->is_perm(), "should be in permspace"); |