comparison src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @ 1295:3cf667df43ef

6919934: JSR 292 needs to support x86 C1 Summary: This implements JSR 292 support for C1 x86. Reviewed-by: never, jrose, kvn
author twisti
date Tue, 09 Mar 2010 20:16:19 +0100
parents 6b2273dd6fa9
children c18cbe5936b8 61b2245abf36
comparison
equal deleted inserted replaced
1293:51db1e4b379d 1295:3cf667df43ef
1 /* 1 /*
2 * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1999-2010 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
675 __ set_info("unwind_exception", dont_gc_arguments); 675 __ set_info("unwind_exception", dont_gc_arguments);
676 __ mov(Oexception, Oexception->after_save()); 676 __ mov(Oexception, Oexception->after_save());
677 __ add(I7, frame::pc_return_offset, Oissuing_pc->after_save()); 677 __ add(I7, frame::pc_return_offset, Oissuing_pc->after_save());
678 678
679 __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), 679 __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address),
680 Oissuing_pc->after_save()); 680 G2_thread, Oissuing_pc->after_save());
681 __ verify_not_null_oop(Oexception->after_save()); 681 __ verify_not_null_oop(Oexception->after_save());
682 __ jmp(O0, 0); 682 __ jmp(O0, 0);
683 __ delayed()->restore(); 683 __ delayed()->restore();
684 } 684 }
685 break; 685 break;
983 } 983 }
984 984
985 985
986 void Runtime1::generate_handle_exception(StubAssembler* sasm, OopMapSet* oop_maps, OopMap* oop_map, bool) { 986 void Runtime1::generate_handle_exception(StubAssembler* sasm, OopMapSet* oop_maps, OopMap* oop_map, bool) {
987 Label no_deopt; 987 Label no_deopt;
988 Label no_handler;
989 988
990 __ verify_not_null_oop(Oexception); 989 __ verify_not_null_oop(Oexception);
991 990
992 // save the exception and issuing pc in the thread 991 // save the exception and issuing pc in the thread
993 __ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset())); 992 __ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset()));
1001 1000
1002 // Note: if nmethod has been deoptimized then regardless of 1001 // Note: if nmethod has been deoptimized then regardless of
1003 // whether it had a handler or not we will deoptimize 1002 // whether it had a handler or not we will deoptimize
1004 // by entering the deopt blob with a pending exception. 1003 // by entering the deopt blob with a pending exception.
1005 1004
1005 #ifdef ASSERT
1006 Label done;
1006 __ tst(O0); 1007 __ tst(O0);
1007 __ br(Assembler::zero, false, Assembler::pn, no_handler); 1008 __ br(Assembler::notZero, false, Assembler::pn, done);
1008 __ delayed()->nop(); 1009 __ delayed()->nop();
1010 __ stop("should have found address");
1011 __ bind(done);
1012 #endif
1009 1013
1010 // restore the registers that were saved at the beginning and jump to the exception handler. 1014 // restore the registers that were saved at the beginning and jump to the exception handler.
1011 restore_live_registers(sasm); 1015 restore_live_registers(sasm);
1012 1016
1013 __ jmp(O0, 0); 1017 __ jmp(O0, 0);
1014 __ delayed()->restore(); 1018 __ delayed()->restore();
1015 1019
1016 __ bind(no_handler);
1017 __ mov(L0, I7); // restore return address
1018
1019 // restore exception oop
1020 __ ld_ptr(G2_thread, in_bytes(JavaThread::exception_oop_offset()), Oexception->after_save());
1021 __ st_ptr(G0, G2_thread, in_bytes(JavaThread::exception_oop_offset()));
1022
1023 __ restore();
1024
1025 AddressLiteral exc(Runtime1::entry_for(Runtime1::unwind_exception_id));
1026 __ jump_to(exc, G4);
1027 __ delayed()->nop();
1028
1029
1030 oop_maps->add_gc_map(call_offset, oop_map); 1020 oop_maps->add_gc_map(call_offset, oop_map);
1031 } 1021 }
1032 1022
1033 1023
1034 #undef __ 1024 #undef __