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