comparison src/cpu/sparc/vm/sharedRuntime_sparc.cpp @ 16641:422eda5267b3

[SPARC] Temporary fix to get the stack for deoptimization right when exception is thrown
author Stefan Anzinger <stefan.anzinger@gmail.com>
date Thu, 24 Jul 2014 08:19:30 -0700
parents 51f392557124
children ab59ee6c581b
comparison
equal deleted inserted replaced
16640:0058b4af625d 16641:422eda5267b3
3559 // Vanilla deoptimization with an exception pending in exception_oop 3559 // Vanilla deoptimization with an exception pending in exception_oop
3560 // 3560 //
3561 int exception_in_tls_offset = __ offset() - start; 3561 int exception_in_tls_offset = __ offset() - start;
3562 3562
3563 // No need to update oop_map as each call to save_live_registers will produce identical oopmap 3563 // No need to update oop_map as each call to save_live_registers will produce identical oopmap
3564 // Opens a new stack frame
3564 (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_words); 3565 (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_words);
3565 3566
3566 // Restore G2_thread 3567 // Restore G2_thread
3567 __ get_thread(); 3568 __ get_thread();
3569
3570 #ifdef GRAAL
3571 // load throwing pc from JavaThread and patch it as the return address
3572 // of the current frame. Then clear the field in JavaThread
3573 __ block_comment("load throwing pc and patch return");
3574 Address exception_pc(G2_thread, JavaThread::exception_pc_offset());
3575 Label has_no_pc;
3576 // TODO: Remove this weird check if we should patch the return pc
3577 // This is because when graal decides to deoptimize and the ExceptionHandlerStub.java
3578 // jumps back to this code and the I7 register contains the pc pointing to the begin
3579 // of this code. If this is the case (PC within a certain range) then we need to patch
3580 // the return pc.
3581 // THIS NEEDS REWORK! (sa)
3582 __ rdpc(L0);
3583 __ sub(L0, I7, L0);
3584 __ cmp(L0, 0xFFF);
3585 __ br(Assembler::greater, false, Assembler::pt, has_no_pc);
3586 __ delayed() -> nop();
3587 __ cmp(L0, -0xFFF);
3588 __ br(Assembler::less, false, Assembler::pt, has_no_pc);
3589 __ delayed() -> nop();
3590 __ ld_ptr(exception_pc, I7);
3591 __ sub(I7, 8, I7);
3592 __ st_ptr(G0, exception_pc);
3593 __ bind(has_no_pc);
3594 __ block_comment("/load throwing pc and patch return");
3595 #endif // GAAL
3568 3596
3569 #ifdef ASSERT 3597 #ifdef ASSERT
3570 { 3598 {
3571 // verify that there is really an exception oop in exception_oop 3599 // verify that there is really an exception oop in exception_oop
3572 Label has_exception; 3600 Label has_exception;
3590 3618
3591 // 3619 //
3592 // Reexecute entry, similar to c2 uncommon trap 3620 // Reexecute entry, similar to c2 uncommon trap
3593 // 3621 //
3594 int reexecute_offset = __ offset() - start; 3622 int reexecute_offset = __ offset() - start;
3595 3623 #if defined(COMPILERGRAAL) && !defined(COMPILER1)
3624 // Graal does not use this kind of deoptimization
3625 __ should_not_reach_here();
3626 #endif
3596 // No need to update oop_map as each call to save_live_registers will produce identical oopmap 3627 // No need to update oop_map as each call to save_live_registers will produce identical oopmap
3597 (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_words); 3628 (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_words);
3598 3629
3599 __ mov(Deoptimization::Unpack_reexecute, L0deopt_mode); 3630 __ mov(Deoptimization::Unpack_reexecute, L0deopt_mode);
3600 3631