comparison src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 4695:e29339f342de

Removed HandleException runtime call and associated C++ code (unused).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 25 Feb 2012 00:52:58 +0100
parents 723df37192d6
children 33df1aeaebbf
comparison
equal deleted inserted replaced
4694:6336b144e391 4695:e29339f342de
769 break; 769 break;
770 default: ShouldNotReachHere(); 770 default: ShouldNotReachHere();
771 } 771 }
772 772
773 return oop_maps; 773 return oop_maps;
774 }
775
776 void Runtime1::graal_generate_handle_exception(StubAssembler *sasm, OopMapSet* oop_maps, OopMap* oop_map) {
777 NOT_LP64(fatal("64 bit only"));
778 // incoming parameters
779 const Register exception_oop = j_rarg0;
780 // other registers used in this stub
781 const Register exception_pc = j_rarg1;
782 const Register thread = r15_thread;
783
784 __ block_comment("graal_generate_handle_exception");
785
786 // verify that rax, contains a valid exception
787 __ verify_not_null_oop(exception_oop);
788
789 #ifdef ASSERT
790 // check that fields in JavaThread for exception oop and issuing pc are
791 // empty before writing to them
792 Label oop_empty;
793 __ cmpptr(Address(thread, JavaThread::exception_oop_offset()), (int32_t) NULL_WORD);
794 __ jcc(Assembler::equal, oop_empty);
795 __ stop("exception oop already set");
796 __ bind(oop_empty);
797
798 Label pc_empty;
799 __ cmpptr(Address(thread, JavaThread::exception_pc_offset()), 0);
800 __ jcc(Assembler::equal, pc_empty);
801 __ stop("exception pc already set");
802 __ bind(pc_empty);
803 #endif
804
805 // save exception oop and issuing pc into JavaThread
806 // (exception handler will load it from here)
807 __ movptr(Address(thread, JavaThread::exception_oop_offset()), exception_oop);
808 __ movptr(exception_pc, Address(rbp, 1*BytesPerWord));
809 __ movptr(Address(thread, JavaThread::exception_pc_offset()), exception_pc);
810
811 // compute the exception handler.
812 // the exception oop and the throwing pc are read from the fields in JavaThread
813 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc));
814 oop_maps->add_gc_map(call_offset, oop_map);
815
816 // rax,: handler address
817 // will be the deopt blob if nmethod was deoptimized while we looked up
818 // handler regardless of whether handler existed in the nmethod.
819
820 // only rax, is valid at this time, all other registers have been destroyed by the runtime call
821 __ invalidate_registers(false, true, true, true, true, true);
822
823 #ifdef ASSERT
824 // Do we have an exception handler in the nmethod?
825 Label done;
826 __ testptr(rax, rax);
827 __ jcc(Assembler::notZero, done);
828 __ stop("no handler found");
829 __ bind(done);
830 #endif
831
832 // exception handler found
833 // patch the return address -> the stub will directly return to the exception handler
834 __ movptr(Address(rbp, 1*BytesPerWord), rax);
835
836 // restore registers
837 restore_live_registers(sasm, false);
838
839 // return to exception handler
840 __ leave();
841 __ ret(0);
842 } 774 }
843 775
844 776
845 void Runtime1::generate_unwind_exception(StubAssembler *sasm) { 777 void Runtime1::generate_unwind_exception(StubAssembler *sasm) {
846 // incoming parameters 778 // incoming parameters
1984 __ leave(); 1916 __ leave();
1985 __ ret(0); 1917 __ ret(0);
1986 break; 1918 break;
1987 } 1919 }
1988 1920
1989 case graal_handle_exception_id: {
1990 StubFrame f(sasm, "graal_handle_exception", dont_gc_arguments);
1991 oop_maps = new OopMapSet();
1992 OopMap* oop_map = save_live_registers(sasm, 1, false);
1993 graal_generate_handle_exception(sasm, oop_maps, oop_map);
1994 break;
1995 }
1996
1997 case graal_slow_subtype_check_id: { 1921 case graal_slow_subtype_check_id: {
1998 Label success; 1922 Label success;
1999 Label miss; 1923 Label miss;
2000 1924
2001 // TODO this should really be within the XirSnippets 1925 // TODO this should really be within the XirSnippets