668 669 670 JRT_LEAF(void, Runtime1::monitorexit(JavaThread* thread, BasicObjectLock* lock)) 671 NOT_PRODUCT(_monitorexit_slowcase_cnt++;) 672 assert(thread == JavaThread::current(), "threads must correspond"); 673 assert(thread->last_Java_sp(), "last_Java_sp must be set"); 674 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown 675 EXCEPTION_MARK; 676 677 oop obj = lock->obj(); 678 assert(obj->is_oop(), "must be NULL or an object"); 679 if (UseFastLocking) { 680 // When using fast locking, the compiled code has already tried the fast case 681 ObjectSynchronizer::slow_exit(obj, lock->lock(), THREAD); 682 } else { 683 ObjectSynchronizer::fast_exit(obj, lock->lock(), THREAD); 684 } 685 JRT_END 686 687 // Cf. OptoRuntime::deoptimize_caller_frame 688 JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread)) 689 // Called from within the owner thread, so no need for safepoint 690 RegisterMap reg_map(thread, false); 691 frame stub_frame = thread->last_frame(); 692 assert(stub_frame.is_runtime_frame(), "sanity check"); 693 frame caller_frame = stub_frame.sender(®_map); 694 695 // We are coming from a compiled method; check this is true. 696 assert(CodeCache::find_nmethod(caller_frame.pc()) != NULL, "sanity"); 697 698 // Deoptimize the caller frame. 699 Deoptimization::deoptimize_frame(thread, caller_frame.id()); 700 701 // Return to the now deoptimized frame. 702 JRT_END 703 704 705 static Klass* resolve_field_return_klass(methodHandle caller, int bci, TRAPS) { 706 Bytecode_field field_access(caller, bci); 707 // This can be static or non-static field access 708 Bytecodes::Code code = field_access.code(); 709 710 // We must load class, initialize class and resolvethe field 711 fieldDescriptor result; // initialize class if needed 712 constantPoolHandle constants(THREAD, caller->constants()); 713 LinkResolver::resolve_field_access(result, constants, field_access.index(), Bytecodes::java_code(code), CHECK_NULL); 714 return result.field_holder(); 715 } 716 717 718 // 719 // This routine patches sites where a class wasn't loaded or 720 // initialized at the time the code was generated. It handles | 668 669 670 JRT_LEAF(void, Runtime1::monitorexit(JavaThread* thread, BasicObjectLock* lock)) 671 NOT_PRODUCT(_monitorexit_slowcase_cnt++;) 672 assert(thread == JavaThread::current(), "threads must correspond"); 673 assert(thread->last_Java_sp(), "last_Java_sp must be set"); 674 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown 675 EXCEPTION_MARK; 676 677 oop obj = lock->obj(); 678 assert(obj->is_oop(), "must be NULL or an object"); 679 if (UseFastLocking) { 680 // When using fast locking, the compiled code has already tried the fast case 681 ObjectSynchronizer::slow_exit(obj, lock->lock(), THREAD); 682 } else { 683 ObjectSynchronizer::fast_exit(obj, lock->lock(), THREAD); 684 } 685 JRT_END 686 687 // Cf. OptoRuntime::deoptimize_caller_frame 688 JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread, jint trap_request)) 689 // Called from within the owner thread, so no need for safepoint 690 RegisterMap reg_map(thread, false); 691 frame stub_frame = thread->last_frame(); 692 assert(stub_frame.is_runtime_frame(), "sanity check"); 693 frame caller_frame = stub_frame.sender(®_map); 694 695 // We are coming from a compiled method; check this is true. 696 assert(CodeCache::find_nmethod(caller_frame.pc()) != NULL, "sanity"); 697 Deoptimization::DeoptAction action = Deoptimization::trap_request_action(trap_request); 698 699 if (action == Deoptimization::Action_make_not_entrant) { 700 nmethod* nm = CodeCache::find_nmethod(caller_frame.pc()); 701 if (nm != NULL) { 702 nm->make_not_entrant(); 703 } 704 } 705 706 // Deoptimize the caller frame. 707 Deoptimization::deoptimize_frame(thread, caller_frame.id()); 708 // Return to the now deoptimized frame. 709 JRT_END 710 711 712 static Klass* resolve_field_return_klass(methodHandle caller, int bci, TRAPS) { 713 Bytecode_field field_access(caller, bci); 714 // This can be static or non-static field access 715 Bytecodes::Code code = field_access.code(); 716 717 // We must load class, initialize class and resolvethe field 718 fieldDescriptor result; // initialize class if needed 719 constantPoolHandle constants(THREAD, caller->constants()); 720 LinkResolver::resolve_field_access(result, constants, field_access.index(), Bytecodes::java_code(code), CHECK_NULL); 721 return result.field_holder(); 722 } 723 724 725 // 726 // This routine patches sites where a class wasn't loaded or 727 // initialized at the time the code was generated. It handles |