< prev index next >

src/hotspot/share/interpreter/rewriter.cpp

Print this page

439           // Check if any final field of the class given as parameter is modified
440           // outside of initializer methods of the class. Fields that are modified
441           // are marked with a flag. For marked fields, the compilers do not perform
442           // constant folding (as the field can be changed after initialization).
443           //
444           // The check is performed after verification and only if verification has
445           // succeeded. Therefore, the class is guaranteed to be well-formed.
446           InstanceKlass* klass = method->method_holder();
447           u2 bc_index = Bytes::get_Java_u2(bcp + prefix_length + 1);
448           constantPoolHandle cp(thread, method->constants());
449           Symbol* ref_class_name = cp->klass_name_at(cp->uncached_klass_ref_index_at(bc_index));
450 
451           if (klass->name() == ref_class_name) {
452             Symbol* field_name = cp->uncached_name_ref_at(bc_index);
453             Symbol* field_sig = cp->uncached_signature_ref_at(bc_index);
454 
455             fieldDescriptor fd;
456             if (klass->find_field(field_name, field_sig, &fd) != nullptr) {
457               if (fd.access_flags().is_final()) {
458                 if (fd.access_flags().is_static()) {
459                   if (!method->is_static_initializer()) {
460                     fd.set_has_initialized_final_update(true);
461                   }
462                 } else {
463                   if (!method->is_object_initializer()) {
464                     fd.set_has_initialized_final_update(true);
465                   }
466                 }
467               }
468             }
469           }
470         }
471       }
472       // fall through
473       case Bytecodes::_getstatic      : // fall through
474       case Bytecodes::_getfield       : // fall through
475         rewrite_field_reference(bcp, prefix_length+1, reverse);
476         break;
477       case Bytecodes::_invokevirtual  : // fall through
478       case Bytecodes::_invokestatic   :
479       case Bytecodes::_invokeinterface:
480       case Bytecodes::_invokehandle   : // if reverse=true
481         rewrite_method_reference(bcp, prefix_length+1, reverse);
482         break;
483       case Bytecodes::_invokedynamic:

439           // Check if any final field of the class given as parameter is modified
440           // outside of initializer methods of the class. Fields that are modified
441           // are marked with a flag. For marked fields, the compilers do not perform
442           // constant folding (as the field can be changed after initialization).
443           //
444           // The check is performed after verification and only if verification has
445           // succeeded. Therefore, the class is guaranteed to be well-formed.
446           InstanceKlass* klass = method->method_holder();
447           u2 bc_index = Bytes::get_Java_u2(bcp + prefix_length + 1);
448           constantPoolHandle cp(thread, method->constants());
449           Symbol* ref_class_name = cp->klass_name_at(cp->uncached_klass_ref_index_at(bc_index));
450 
451           if (klass->name() == ref_class_name) {
452             Symbol* field_name = cp->uncached_name_ref_at(bc_index);
453             Symbol* field_sig = cp->uncached_signature_ref_at(bc_index);
454 
455             fieldDescriptor fd;
456             if (klass->find_field(field_name, field_sig, &fd) != nullptr) {
457               if (fd.access_flags().is_final()) {
458                 if (fd.access_flags().is_static()) {
459                   if (!method->is_class_initializer()) {
460                     fd.set_has_initialized_final_update(true);
461                   }
462                 } else {
463                   if (!method->is_object_constructor()) {
464                     fd.set_has_initialized_final_update(true);
465                   }
466                 }
467               }
468             }
469           }
470         }
471       }
472       // fall through
473       case Bytecodes::_getstatic      : // fall through
474       case Bytecodes::_getfield       : // fall through
475         rewrite_field_reference(bcp, prefix_length+1, reverse);
476         break;
477       case Bytecodes::_invokevirtual  : // fall through
478       case Bytecodes::_invokestatic   :
479       case Bytecodes::_invokeinterface:
480       case Bytecodes::_invokehandle   : // if reverse=true
481         rewrite_method_reference(bcp, prefix_length+1, reverse);
482         break;
483       case Bytecodes::_invokedynamic:
< prev index next >