1 /* |
1 /* |
2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2010, 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. |
32 (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL); |
32 (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL); |
33 |
33 |
34 c->set_length(length); |
34 c->set_length(length); |
35 c->set_tags(NULL); |
35 c->set_tags(NULL); |
36 c->set_cache(NULL); |
36 c->set_cache(NULL); |
|
37 c->set_operands(NULL); |
37 c->set_pool_holder(NULL); |
38 c->set_pool_holder(NULL); |
38 c->set_flags(0); |
39 c->set_flags(0); |
39 // only set to non-zero if constant pool is merged by RedefineClasses |
40 // only set to non-zero if constant pool is merged by RedefineClasses |
40 c->set_orig_length(0); |
41 c->set_orig_length(0); |
41 // if constant pool may change during RedefineClasses, it is created |
42 // if constant pool may change during RedefineClasses, it is created |
90 base++; |
91 base++; |
91 } |
92 } |
92 // gc of constant pool instance variables |
93 // gc of constant pool instance variables |
93 MarkSweep::mark_and_push(cp->tags_addr()); |
94 MarkSweep::mark_and_push(cp->tags_addr()); |
94 MarkSweep::mark_and_push(cp->cache_addr()); |
95 MarkSweep::mark_and_push(cp->cache_addr()); |
|
96 MarkSweep::mark_and_push(cp->operands_addr()); |
95 MarkSweep::mark_and_push(cp->pool_holder_addr()); |
97 MarkSweep::mark_and_push(cp->pool_holder_addr()); |
96 } |
98 } |
97 } |
99 } |
98 |
100 |
99 #ifndef SERIALGC |
101 #ifndef SERIALGC |
116 base++; |
118 base++; |
117 } |
119 } |
118 // gc of constant pool instance variables |
120 // gc of constant pool instance variables |
119 PSParallelCompact::mark_and_push(cm, cp->tags_addr()); |
121 PSParallelCompact::mark_and_push(cm, cp->tags_addr()); |
120 PSParallelCompact::mark_and_push(cm, cp->cache_addr()); |
122 PSParallelCompact::mark_and_push(cm, cp->cache_addr()); |
|
123 PSParallelCompact::mark_and_push(cm, cp->operands_addr()); |
121 PSParallelCompact::mark_and_push(cm, cp->pool_holder_addr()); |
124 PSParallelCompact::mark_and_push(cm, cp->pool_holder_addr()); |
122 } |
125 } |
123 } |
126 } |
124 #endif // SERIALGC |
127 #endif // SERIALGC |
125 |
128 |
230 } |
237 } |
231 } |
238 } |
232 } |
239 } |
233 PSParallelCompact::adjust_pointer(cp->tags_addr()); |
240 PSParallelCompact::adjust_pointer(cp->tags_addr()); |
234 PSParallelCompact::adjust_pointer(cp->cache_addr()); |
241 PSParallelCompact::adjust_pointer(cp->cache_addr()); |
|
242 PSParallelCompact::adjust_pointer(cp->operands_addr()); |
235 PSParallelCompact::adjust_pointer(cp->pool_holder_addr()); |
243 PSParallelCompact::adjust_pointer(cp->pool_holder_addr()); |
236 return cp->object_size(); |
244 return cp->object_size(); |
237 } |
245 } |
238 |
246 |
239 int |
247 int |
259 |
267 |
260 oop* p; |
268 oop* p; |
261 p = cp->tags_addr(); |
269 p = cp->tags_addr(); |
262 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
270 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
263 p = cp->cache_addr(); |
271 p = cp->cache_addr(); |
|
272 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
|
273 p = cp->operands_addr(); |
264 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
274 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
265 p = cp->pool_holder_addr(); |
275 p = cp->pool_holder_addr(); |
266 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
276 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr); |
267 |
277 |
268 return cp->object_size(); |
278 return cp->object_size(); |
361 break; |
371 break; |
362 case JVM_CONSTANT_MethodType : |
372 case JVM_CONSTANT_MethodType : |
363 st->print("signature_index=%d", cp->method_type_index_at(index)); |
373 st->print("signature_index=%d", cp->method_type_index_at(index)); |
364 break; |
374 break; |
365 case JVM_CONSTANT_InvokeDynamic : |
375 case JVM_CONSTANT_InvokeDynamic : |
366 st->print("bootstrap_method_index=%d", cp->invoke_dynamic_bootstrap_method_ref_index_at(index)); |
376 { |
367 st->print(" name_and_type_index=%d", cp->invoke_dynamic_name_and_type_ref_index_at(index)); |
377 st->print("bootstrap_method_index=%d", cp->invoke_dynamic_bootstrap_method_ref_index_at(index)); |
|
378 st->print(" name_and_type_index=%d", cp->invoke_dynamic_name_and_type_ref_index_at(index)); |
|
379 int argc = cp->invoke_dynamic_argument_count_at(index); |
|
380 if (argc > 0) { |
|
381 for (int arg_i = 0; arg_i < argc; arg_i++) { |
|
382 int arg = cp->invoke_dynamic_argument_index_at(index, arg_i); |
|
383 st->print((arg_i == 0 ? " arguments={%d" : ", %d"), arg); |
|
384 } |
|
385 st->print("}"); |
|
386 } |
|
387 } |
368 break; |
388 break; |
369 default: |
389 default: |
370 ShouldNotReachHere(); |
390 ShouldNotReachHere(); |
371 break; |
391 break; |
372 } |
392 } |
379 assert(obj->is_constantPool(), "must be constantPool"); |
399 assert(obj->is_constantPool(), "must be constantPool"); |
380 constantPoolOop cp = constantPoolOop(obj); |
400 constantPoolOop cp = constantPoolOop(obj); |
381 st->print("constant pool [%d]", cp->length()); |
401 st->print("constant pool [%d]", cp->length()); |
382 if (cp->has_pseudo_string()) st->print("/pseudo_string"); |
402 if (cp->has_pseudo_string()) st->print("/pseudo_string"); |
383 if (cp->has_invokedynamic()) st->print("/invokedynamic"); |
403 if (cp->has_invokedynamic()) st->print("/invokedynamic"); |
|
404 if (cp->operands() != NULL) st->print("/operands[%d]", cp->operands()->length()); |
384 cp->print_address_on(st); |
405 cp->print_address_on(st); |
385 st->print(" for "); |
406 st->print(" for "); |
386 cp->pool_holder()->print_value_on(st); |
407 cp->pool_holder()->print_value_on(st); |
387 if (cp->cache() != NULL) { |
408 if (cp->cache() != NULL) { |
388 st->print(" cache=" PTR_FORMAT, cp->cache()); |
409 st->print(" cache=" PTR_FORMAT, cp->cache()); |
438 // Note: cache() can be NULL before a class is completely setup or |
459 // Note: cache() can be NULL before a class is completely setup or |
439 // in temporary constant pools used during constant pool merging |
460 // in temporary constant pools used during constant pool merging |
440 guarantee(cp->cache()->is_perm(), "should be in permspace"); |
461 guarantee(cp->cache()->is_perm(), "should be in permspace"); |
441 guarantee(cp->cache()->is_constantPoolCache(), "should be constant pool cache"); |
462 guarantee(cp->cache()->is_constantPoolCache(), "should be constant pool cache"); |
442 } |
463 } |
|
464 if (cp->operands() != NULL) { |
|
465 guarantee(cp->operands()->is_perm(), "should be in permspace"); |
|
466 guarantee(cp->operands()->is_typeArray(), "should be type array"); |
|
467 } |
443 if (cp->pool_holder() != NULL) { |
468 if (cp->pool_holder() != NULL) { |
444 // Note: pool_holder() can be NULL in temporary constant pools |
469 // Note: pool_holder() can be NULL in temporary constant pools |
445 // used during constant pool merging |
470 // used during constant pool merging |
446 guarantee(cp->pool_holder()->is_perm(), "should be in permspace"); |
471 guarantee(cp->pool_holder()->is_perm(), "should be in permspace"); |
447 guarantee(cp->pool_holder()->is_klass(), "should be klass"); |
472 guarantee(cp->pool_holder()->is_klass(), "should be klass"); |