< prev index next >

src/hotspot/share/interpreter/rewriter.cpp

Print this page
rev 55090 : secret-sfac


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




 432           // Check if any final field of the class given as parameter is modified
 433           // outside of initializer methods of the class. Fields that are modified
 434           // are marked with a flag. For marked fields, the compilers do not perform
 435           // constant folding (as the field can be changed after initialization).
 436           //
 437           // The check is performed after verification and only if verification has
 438           // succeeded. Therefore, the class is guaranteed to be well-formed.
 439           InstanceKlass* klass = method->method_holder();
 440           u2 bc_index = Bytes::get_Java_u2(bcp + prefix_length + 1);
 441           constantPoolHandle cp(method->constants());
 442           Symbol* ref_class_name = cp->klass_name_at(cp->klass_ref_index_at(bc_index));
 443 
 444           if (klass->name() == ref_class_name) {
 445             Symbol* field_name = cp->name_ref_at(bc_index);
 446             Symbol* field_sig = cp->signature_ref_at(bc_index);
 447 
 448             fieldDescriptor fd;
 449             if (klass->find_field(field_name, field_sig, &fd) != NULL) {
 450               if (fd.access_flags().is_final()) {
 451                 if (fd.access_flags().is_static()) {
 452                   if (!method->is_class_initializer()) {
 453                     fd.set_has_initialized_final_update(true);
 454                   }
 455                 } else {
 456                   if (!method->is_object_constructor()) {
 457                     fd.set_has_initialized_final_update(true);
 458                   }
 459                 }
 460               }
 461             }
 462           }
 463         }
 464       }
 465       // fall through
 466       case Bytecodes::_getstatic      : // fall through
 467       case Bytecodes::_getfield       : // fall through
 468       case Bytecodes::_withfield     : // fall through but may require more checks for correctness
 469       case Bytecodes::_invokevirtual  : // fall through
 470       case Bytecodes::_invokestatic   :
 471       case Bytecodes::_invokeinterface:
 472       case Bytecodes::_invokehandle   : // if reverse=true
 473         rewrite_member_reference(bcp, prefix_length+1, reverse);
 474         break;
 475       case Bytecodes::_invokedynamic:
 476         rewrite_invokedynamic(bcp, prefix_length+1, reverse);


< prev index next >