530 // in the current pass, leaving the put_code set to zero will 531 // cause the next put instruction to reresolve. 532 Bytecodes::Code put_code = (Bytecodes::Code)0; 533 534 // We also need to delay resolving getstatic instructions until the 535 // class is intitialized. This is required so that access to the static 536 // field will call the initialization function every time until the class 537 // is completely initialized ala. in 2.17.5 in JVM Specification. 538 instanceKlass *klass = instanceKlass::cast(info.klass()->as_klassOop()); 539 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && 540 !klass->is_initialized()); 541 Bytecodes::Code get_code = (Bytecodes::Code)0; 542 543 if (!uninitialized_static) { 544 get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield); 545 if (is_put || !info.access_flags().is_final()) { 546 put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield); 547 } 548 } 549 550 if (is_put && !is_static && klass->is_subclass_of(SystemDictionary::CallSite_klass()) && (info.name() == vmSymbols::target_name())) { 551 const jint direction = frame::interpreter_frame_expression_stack_direction(); 552 Handle call_site (THREAD, *((oop*) thread->last_frame().interpreter_frame_tos_at(-1 * direction))); 553 Handle method_handle(THREAD, *((oop*) thread->last_frame().interpreter_frame_tos_at( 0 * direction))); 554 assert(call_site ->is_a(SystemDictionary::CallSite_klass()), "must be"); 555 assert(method_handle->is_a(SystemDictionary::MethodHandle_klass()), "must be"); 556 557 { 558 // Walk all nmethods depending on this call site. 559 MutexLocker mu(Compile_lock, thread); 560 Universe::flush_dependents_on(call_site, method_handle); 561 } 562 563 // Don't allow fast path for setting CallSite.target and sub-classes. 564 put_code = (Bytecodes::Code) 0; 565 } 566 567 cache_entry(thread)->set_field( 568 get_code, 569 put_code, 570 info.klass(), 571 info.field_index(), 572 info.field_offset(), 573 state, 574 info.access_flags().is_final(), 575 info.access_flags().is_volatile() 576 ); 577 IRT_END 578 579 580 //------------------------------------------------------------------------------------------------------------------------ 581 // Synchronization 582 // 583 // The interpreter's synchronization code is factored out so that it can 584 // be shared by method invocation and synchronized blocks. 585 //%note synchronization_3 586 | 530 // in the current pass, leaving the put_code set to zero will 531 // cause the next put instruction to reresolve. 532 Bytecodes::Code put_code = (Bytecodes::Code)0; 533 534 // We also need to delay resolving getstatic instructions until the 535 // class is intitialized. This is required so that access to the static 536 // field will call the initialization function every time until the class 537 // is completely initialized ala. in 2.17.5 in JVM Specification. 538 instanceKlass *klass = instanceKlass::cast(info.klass()->as_klassOop()); 539 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && 540 !klass->is_initialized()); 541 Bytecodes::Code get_code = (Bytecodes::Code)0; 542 543 if (!uninitialized_static) { 544 get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield); 545 if (is_put || !info.access_flags().is_final()) { 546 put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield); 547 } 548 } 549 550 cache_entry(thread)->set_field( 551 get_code, 552 put_code, 553 info.klass(), 554 info.field_index(), 555 info.field_offset(), 556 state, 557 info.access_flags().is_final(), 558 info.access_flags().is_volatile() 559 ); 560 IRT_END 561 562 563 //------------------------------------------------------------------------------------------------------------------------ 564 // Synchronization 565 // 566 // The interpreter's synchronization code is factored out so that it can 567 // be shared by method invocation and synchronized blocks. 568 //%note synchronization_3 569 |