changeset 22717:ba7846fcb814

Fix ppc and x86_32 after fetch_unroll_info_helper changes Changes in 3c1edc9c60d8 only included x86_64 and sparc. This change also reuses the existing unpack_kind instead of a new field in UnrollBlock.
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Mon, 02 Nov 2015 15:33:53 +0100
parents f536aaa5a5d5
children f04d84a5f7c5
files src/cpu/ppc/vm/sharedRuntime_ppc.cpp src/cpu/sparc/vm/sharedRuntime_sparc.cpp src/cpu/x86/vm/sharedRuntime_x86_32.cpp src/cpu/x86/vm/sharedRuntime_x86_64.cpp src/share/vm/runtime/deoptimization.cpp src/share/vm/runtime/deoptimization.hpp src/share/vm/shark/sharkRuntime.cpp
diffstat 7 files changed, 30 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Fri Oct 30 12:28:17 2015 +0100
+++ b/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Mon Nov 02 15:33:53 2015 +0100
@@ -2841,7 +2841,7 @@
   __ set_last_Java_frame(R1_SP, noreg);
 
   // With EscapeAnalysis turned on, this call may safepoint!
-  __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info), R16_thread);
+  __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info), R16_thread, exec_mode_reg);
   address calls_return_pc = __ last_calls_return_pc();
   // Set an oopmap for the call site that describes all our saved registers.
   oop_maps->add_gc_map(calls_return_pc - start, map);
@@ -2854,6 +2854,8 @@
   // by save_volatile_registers(...).
   RegisterSaver::restore_result_registers(masm, first_frame_size_in_bytes);
 
+  // reload the exec mode from the UnrollBlock (it might have changed)
+  __ lwz(exec_mode_reg, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes(), unroll_block_reg);
   // In excp_deopt_mode, restore and clear exception oop which we
   // stored in the thread during exception entry above. The exception
   // oop will be the return value of this stub.
@@ -2989,8 +2991,9 @@
   __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1);
 
   __ mr(klass_index_reg, R3);
+  __ li(R5, Deoptimization::Unpack_exception);
   __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap),
-                  R16_thread, klass_index_reg);
+                  R16_thread, klass_index_reg, R5);
 
   // Set an oopmap for the call site.
   oop_maps->add_gc_map(gc_map_pc - start, map);
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Fri Oct 30 12:28:17 2015 +0100
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Mon Nov 02 15:33:53 2015 +0100
@@ -3665,7 +3665,7 @@
 
   RegisterSaver::restore_result_registers(masm);
 
-  __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::exec_mode_offset_in_bytes(), G4deopt_mode);
+  __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes(), G4deopt_mode);
   Label noException;
   __ cmp_and_br_short(G4deopt_mode, Deoptimization::Unpack_exception, Assembler::notEqual, Assembler::pt, noException);
 
@@ -3799,7 +3799,7 @@
 
 #ifdef ASSERT
   { Label L;
-    __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::exec_mode_offset_in_bytes(), O1);
+    __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes(), O1);
     __  cmp_and_br_short(O1, Deoptimization::Unpack_uncommon_trap, Assembler::equal, Assembler::pt, L);
     __ stop("SharedRuntime::generate_deopt_blob: expected Unpack_uncommon_trap");
     __ bind(L);
--- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Fri Oct 30 12:28:17 2015 +0100
+++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Mon Nov 02 15:33:53 2015 +0100
@@ -2959,9 +2959,8 @@
   // we are very short of registers
 
   Address unpack_kind(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes());
-  // retrieve the deopt kind from where we left it.
-  __ pop(rax);
-  __ movl(unpack_kind, rax);                      // save the unpack_kind value
+  // retrieve the deopt kind from the UnrollBlock.
+  __ movl(rax, unpack_kind);
 
    Label noException;
   __ cmpl(rax, Deoptimization::Unpack_exception);   // Was exception pending?
@@ -3171,11 +3170,12 @@
   enum frame_layout {
     arg0_off,      // thread                     sp + 0 // Arg location for
     arg1_off,      // unloaded_class_index       sp + 1 // calling C
+    arg2_off,      // exec_mode                  sp + 2
     // The frame sender code expects that rbp will be in the "natural" place and
     // will override any oopMap setting for it. We must therefore force the layout
     // so that it agrees with the frame sender code.
-    rbp_off,       // callee saved register      sp + 2
-    return_off,    // slot for return address    sp + 3
+    rbp_off,       // callee saved register      sp + 3
+    return_off,    // slot for return address    sp + 4
     framesize
   };
 
@@ -3207,6 +3207,7 @@
   __ movptr(Address(rsp, arg0_off*wordSize), rdx);
   // argument already in ECX
   __ movl(Address(rsp, arg1_off*wordSize),rcx);
+  __ movl(Address(rsp, arg2_off*wordSize), Deoptimization::Unpack_uncommon_trap);
   __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
 
   // Set an oopmap for the call site
@@ -3223,6 +3224,16 @@
   // Load UnrollBlock into EDI
   __ movptr(rdi, rax);
 
+#ifdef ASSERT
+  { Label L;
+    __ cmpptr(Address(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()),
+            (int32_t)Deoptimization::Unpack_uncommon_trap);
+    __ jcc(Assembler::equal, L);
+    __ stop("SharedRuntime::generate_deopt_blob: expected Unpack_uncommon_trap");
+    __ bind(L);
+  }
+#endif
+
   // Pop all the frames we must move/replace.
   //
   // Frame picture (youngest to oldest)
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri Oct 30 12:28:17 2015 +0100
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Mon Nov 02 15:33:53 2015 +0100
@@ -3514,7 +3514,7 @@
   // Load UnrollBlock* into rdi
   __ mov(rdi, rax);
 
-  __ movl(r14, Address(rdi, Deoptimization::UnrollBlock::exec_mode_offset_in_bytes()));
+  __ movl(r14, Address(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()));
    Label noException;
   __ cmpl(r14, Deoptimization::Unpack_exception);   // Was exception pending?
   __ jcc(Assembler::notEqual, noException);
@@ -3749,7 +3749,7 @@
 
 #ifdef ASSERT
   { Label L;
-    __ cmpptr(Address(rdi, Deoptimization::UnrollBlock::exec_mode_offset_in_bytes()),
+    __ cmpptr(Address(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()),
             (int32_t)Deoptimization::Unpack_uncommon_trap);
     __ jcc(Assembler::equal, L);
     __ stop("SharedRuntime::generate_deopt_blob: expected Unpack_uncommon_trap");
--- a/src/share/vm/runtime/deoptimization.cpp	Fri Oct 30 12:28:17 2015 +0100
+++ b/src/share/vm/runtime/deoptimization.cpp	Mon Nov 02 15:33:53 2015 +0100
@@ -119,12 +119,11 @@
   _initial_info              = 0;
   // PD (x86 only)
   _counter_temp              = 0;
-  _unpack_kind               = 0;
+  _unpack_kind               = exec_mode;
   _sender_sp_temp            = 0;
 
   _total_frame_sizes         = size_of_frames();
   assert(exec_mode >= 0 && exec_mode < Unpack_LIMIT, "Unexpected exec_mode");
-  _exec_mode                 = exec_mode;
 }
 
 
--- a/src/share/vm/runtime/deoptimization.hpp	Fri Oct 30 12:28:17 2015 +0100
+++ b/src/share/vm/runtime/deoptimization.hpp	Mon Nov 02 15:33:53 2015 +0100
@@ -173,14 +173,13 @@
     intptr_t  _initial_info;              // Platform dependent data for the sender frame (was FP on x86)
     int       _caller_actual_parameters;  // The number of actual arguments at the
                                           // interpreted caller of the deoptimized frame
-    int       _exec_mode;                 // exec_mode that can be changed during fetch_unroll_info
+    int       _unpack_kind;               // exec_mode that can be changed during fetch_unroll_info
 
     // The following fields are used as temps during the unpacking phase
     // (which is tight on registers, especially on x86). They really ought
     // to be PD variables but that involves moving this class into its own
     // file to use the pd include mechanism. Maybe in a later cleanup ...
     intptr_t  _counter_temp;              // SHOULD BE PD VARIABLE (x86 frame count temp)
-    intptr_t  _unpack_kind;               // SHOULD BE PD VARIABLE (x86 unpack kind)
     intptr_t  _sender_sp_temp;            // SHOULD BE PD VARIABLE (x86 sender_sp)
    public:
     // Constructor
@@ -191,7 +190,7 @@
                 intptr_t* frame_sizes,
                 address* frames_pcs,
                 BasicType return_type,
-                int exec_mode);
+                int unpack_kind);
     ~UnrollBlock();
 
     // Returns where a register is located.
@@ -201,7 +200,7 @@
     intptr_t* frame_sizes()  const { return _frame_sizes; }
     int number_of_frames()  const { return _number_of_frames; }
     address*  frame_pcs()   const { return _frame_pcs ; }
-    int  exec_mode()   const { return _exec_mode ; }
+    int  unpack_kind()   const { return _unpack_kind; }
 
     // Returns the total size of frames
     int size_of_frames() const;
@@ -223,7 +222,6 @@
     static int initial_info_offset_in_bytes()              { return offset_of(UnrollBlock, _initial_info);              }
     static int unpack_kind_offset_in_bytes()               { return offset_of(UnrollBlock, _unpack_kind);               }
     static int sender_sp_temp_offset_in_bytes()            { return offset_of(UnrollBlock, _sender_sp_temp);            }
-    static int exec_mode_offset_in_bytes()                 { return offset_of(UnrollBlock, _exec_mode);                 }
 
     BasicType return_type() const { return _return_type; }
     void print();
--- a/src/share/vm/shark/sharkRuntime.cpp	Fri Oct 30 12:28:17 2015 +0100
+++ b/src/share/vm/shark/sharkRuntime.cpp	Mon Nov 02 15:33:53 2015 +0100
@@ -214,7 +214,7 @@
   Deoptimization::UnrollBlock *urb =
     Deoptimization::uncommon_trap(thread, trap_request, Deoptimization::Unpack_uncommon_trap);
   thread->reset_last_Java_frame();
-  assert(urb->exec_mode() == Deoptimization::Unpack_uncommon_trap, "expected Unpack_uncommon_trap");
+  assert(urb->unpack_kind() == Deoptimization::Unpack_uncommon_trap, "expected Unpack_uncommon_trap");
 
   // Pop our dummy frame and the frame being deoptimized
   thread->pop_zero_frame();