671 |
671 |
672 |
672 |
673 JRT_ENTRY(void, SharedRuntime::yield_all(JavaThread* thread, int attempts)) |
673 JRT_ENTRY(void, SharedRuntime::yield_all(JavaThread* thread, int attempts)) |
674 os::yield_all(attempts); |
674 os::yield_all(attempts); |
675 JRT_END |
675 JRT_END |
676 |
|
677 |
|
678 // --------------------------------------------------------------------------------------------------------- |
|
679 // Non-product code |
|
680 #ifndef PRODUCT |
|
681 |
|
682 void SharedRuntime::verify_caller_frame(frame caller_frame, methodHandle callee_method) { |
|
683 ResourceMark rm; |
|
684 assert (caller_frame.is_interpreted_frame(), "sanity check"); |
|
685 assert (callee_method->has_compiled_code(), "callee must be compiled"); |
|
686 methodHandle caller_method (Thread::current(), caller_frame.interpreter_frame_method()); |
|
687 jint bci = caller_frame.interpreter_frame_bci(); |
|
688 methodHandle method = find_callee_method_inside_interpreter(caller_frame, caller_method, bci); |
|
689 assert (callee_method == method, "incorrect method"); |
|
690 } |
|
691 |
|
692 methodHandle SharedRuntime::find_callee_method_inside_interpreter(frame caller_frame, methodHandle caller_method, int bci) { |
|
693 EXCEPTION_MARK; |
|
694 Bytecode_invoke* bytecode = Bytecode_invoke_at(caller_method, bci); |
|
695 methodHandle staticCallee = bytecode->static_target(CATCH); // Non-product code |
|
696 |
|
697 bytecode = Bytecode_invoke_at(caller_method, bci); |
|
698 int bytecode_index = bytecode->index(); |
|
699 Bytecodes::Code bc = bytecode->adjusted_invoke_code(); |
|
700 |
|
701 Handle receiver; |
|
702 if (bc == Bytecodes::_invokeinterface || |
|
703 bc == Bytecodes::_invokevirtual || |
|
704 bc == Bytecodes::_invokespecial) { |
|
705 symbolHandle signature (THREAD, staticCallee->signature()); |
|
706 receiver = Handle(THREAD, retrieve_receiver(signature, caller_frame)); |
|
707 } else { |
|
708 receiver = Handle(); |
|
709 } |
|
710 CallInfo result; |
|
711 constantPoolHandle constants (THREAD, caller_method->constants()); |
|
712 LinkResolver::resolve_invoke(result, receiver, constants, bytecode_index, bc, CATCH); // Non-product code |
|
713 methodHandle calleeMethod = result.selected_method(); |
|
714 return calleeMethod; |
|
715 } |
|
716 |
|
717 #endif // PRODUCT |
|
718 |
676 |
719 |
677 |
720 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* thread, oopDesc* obj)) |
678 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* thread, oopDesc* obj)) |
721 assert(obj->is_oop(), "must be a valid oop"); |
679 assert(obj->is_oop(), "must be a valid oop"); |
722 assert(obj->klass()->klass_part()->has_finalizer(), "shouldn't be here otherwise"); |
680 assert(obj->klass()->klass_part()->has_finalizer(), "shouldn't be here otherwise"); |