# HG changeset patch # User Stefan Anzinger # Date 1406734808 25200 # Node ID ab59ee6c581b3d480db490b4abbd23948fa9ebaa # Parent 5391f043d5f5bef4981552a722cd79f5427bbc49 [SPARC] Fix deoptimization fixup of return pc when called via the deoptimization entry diff -r 5391f043d5f5 -r ab59ee6c581b src/cpu/sparc/vm/sharedRuntime_sparc.cpp --- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Wed Jul 30 08:37:10 2014 -0700 +++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Wed Jul 30 08:40:08 2014 -0700 @@ -3567,33 +3567,6 @@ // Restore G2_thread __ get_thread(); -#ifdef GRAAL - // load throwing pc from JavaThread and patch it as the return address - // of the current frame. Then clear the field in JavaThread - __ block_comment("load throwing pc and patch return"); - Address exception_pc(G2_thread, JavaThread::exception_pc_offset()); - Label has_no_pc; - // TODO: Remove this weird check if we should patch the return pc - // This is because when graal decides to deoptimize and the ExceptionHandlerStub.java - // jumps back to this code and the I7 register contains the pc pointing to the begin - // of this code. If this is the case (PC within a certain range) then we need to patch - // the return pc. - // THIS NEEDS REWORK! (sa) - __ rdpc(L0); - __ sub(L0, I7, L0); - __ cmp(L0, 0xFFF); - __ br(Assembler::greater, false, Assembler::pt, has_no_pc); - __ delayed() -> nop(); - __ cmp(L0, -0xFFF); - __ br(Assembler::less, false, Assembler::pt, has_no_pc); - __ delayed() -> nop(); - __ ld_ptr(exception_pc, I7); - __ sub(I7, 8, I7); - __ st_ptr(G0, exception_pc); - __ bind(has_no_pc); - __ block_comment("/load throwing pc and patch return"); -#endif // GAAL - #ifdef ASSERT { // verify that there is really an exception oop in exception_oop diff -r 5391f043d5f5 -r ab59ee6c581b src/share/vm/code/nmethod.hpp --- a/src/share/vm/code/nmethod.hpp Wed Jul 30 08:37:10 2014 -0700 +++ b/src/share/vm/code/nmethod.hpp Wed Jul 30 08:40:08 2014 -0700 @@ -643,7 +643,21 @@ // (thomaswue) When using graal, the address might be off by 5 (because this is the size of the call instruction. // (thomaswue) TODO: Replace this by a more general mechanism. - bool is_deopt_entry (address pc) { return pc == deopt_handler_begin() GRAAL_ONLY( || pc == deopt_handler_begin() + 5); } + // (sanzinger) SPARC has another offset, looked for some variable existing in HotSpot which describes this offset, but i have not + // found anything. + bool is_deopt_entry (address pc) { + return pc == deopt_handler_begin() +#ifdef GRAAL + || pc == deopt_handler_begin() + +#ifdef TARGET_ARCH_sparc + 8 +#endif // sparc +#ifdef TARGET_ARCH_x86 + 5 +#endif // x86 +#endif // GRAAL + ; + } bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); } // Accessor/mutator for the original pc of a frame before a frame was deopted. address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); }