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