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