< prev index next >

src/hotspot/share/oops/constantPool.cpp

Print this page
rev 59477 : [mq]: cds_lambda


 397   // class redefinition. Since shared ConstantPools cannot be deallocated anyway,
 398   // we always set _on_stack to true to avoid having to change _flags during runtime.
 399   _flags |= (_on_stack | _is_shared);
 400   int num_klasses = 0;
 401   for (int index = 1; index < length(); index++) { // Index 0 is unused
 402     if (!DynamicDumpSharedSpaces) {
 403       assert(!tag_at(index).is_unresolved_klass_in_error(), "This must not happen during static dump time");
 404     } else {
 405       if (tag_at(index).is_unresolved_klass_in_error() ||
 406           tag_at(index).is_method_handle_in_error()    ||
 407           tag_at(index).is_method_type_in_error()      ||
 408           tag_at(index).is_dynamic_constant_in_error()) {
 409         tag_at_put(index, JVM_CONSTANT_UnresolvedClass);
 410       }
 411     }
 412     if (tag_at(index).is_klass()) {
 413       // This class was resolved as a side effect of executing Java code
 414       // during dump time. We need to restore it back to an UnresolvedClass,
 415       // so that the proper class loading and initialization can happen
 416       // at runtime.







 417       CPKlassSlot kslot = klass_slot_at(index);
 418       int resolved_klass_index = kslot.resolved_klass_index();
 419       int name_index = kslot.name_index();
 420       assert(tag_at(name_index).is_symbol(), "sanity");
 421       resolved_klasses()->at_put(resolved_klass_index, NULL);
 422       tag_at_put(index, JVM_CONSTANT_UnresolvedClass);
 423       assert(klass_name_at(index) == symbol_at(name_index), "sanity");

 424     }
 425   }
 426   if (cache() != NULL) {
 427     cache()->remove_unshareable_info();
 428   }
 429 }
 430 
 431 int ConstantPool::cp_to_object_index(int cp_index) {
 432   // this is harder don't do this so much.
 433   int i = reference_map()->find(cp_index);
 434   // We might not find the index for jsr292 call.
 435   return (i < 0) ? _no_index_sentinel : i;
 436 }
 437 
 438 void ConstantPool::string_at_put(int which, int obj_index, oop str) {
 439   resolved_references()->obj_at_put(obj_index, str);
 440 }
 441 
 442 void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, Klass* k) {
 443   ResourceMark rm;




 397   // class redefinition. Since shared ConstantPools cannot be deallocated anyway,
 398   // we always set _on_stack to true to avoid having to change _flags during runtime.
 399   _flags |= (_on_stack | _is_shared);
 400   int num_klasses = 0;
 401   for (int index = 1; index < length(); index++) { // Index 0 is unused
 402     if (!DynamicDumpSharedSpaces) {
 403       assert(!tag_at(index).is_unresolved_klass_in_error(), "This must not happen during static dump time");
 404     } else {
 405       if (tag_at(index).is_unresolved_klass_in_error() ||
 406           tag_at(index).is_method_handle_in_error()    ||
 407           tag_at(index).is_method_type_in_error()      ||
 408           tag_at(index).is_dynamic_constant_in_error()) {
 409         tag_at_put(index, JVM_CONSTANT_UnresolvedClass);
 410       }
 411     }
 412     if (tag_at(index).is_klass()) {
 413       // This class was resolved as a side effect of executing Java code
 414       // during dump time. We need to restore it back to an UnresolvedClass,
 415       // so that the proper class loading and initialization can happen
 416       // at runtime.
 417       bool clear_it = true;
 418       if (pool_holder()->is_hidden() && index == pool_holder()->this_class_index()) {
 419         // All references to a hidden class's own field/methods are through this
 420         // index. We cannot clear it. See comments in ClassFileParser::fill_instance_klass.
 421         clear_it = false;
 422       }
 423       if (clear_it) {
 424         CPKlassSlot kslot = klass_slot_at(index);
 425         int resolved_klass_index = kslot.resolved_klass_index();
 426         int name_index = kslot.name_index();
 427         assert(tag_at(name_index).is_symbol(), "sanity");
 428         resolved_klasses()->at_put(resolved_klass_index, NULL);
 429         tag_at_put(index, JVM_CONSTANT_UnresolvedClass);
 430         assert(klass_name_at(index) == symbol_at(name_index), "sanity");
 431       }
 432     }
 433   }
 434   if (cache() != NULL) {
 435     cache()->remove_unshareable_info();
 436   }
 437 }
 438 
 439 int ConstantPool::cp_to_object_index(int cp_index) {
 440   // this is harder don't do this so much.
 441   int i = reference_map()->find(cp_index);
 442   // We might not find the index for jsr292 call.
 443   return (i < 0) ? _no_index_sentinel : i;
 444 }
 445 
 446 void ConstantPool::string_at_put(int which, int obj_index, oop str) {
 447   resolved_references()->obj_at_put(obj_index, str);
 448 }
 449 
 450 void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, Klass* k) {
 451   ResourceMark rm;


< prev index next >