hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
changeset 34185 ee71c590a456
parent 33593 60764a78fa5c
parent 34173 01bb07d23a5b
child 35113 b11bd150ed8a
child 35201 996db89f378e
equal deleted inserted replaced
33813:4f376e851453 34185:ee71c590a456
    70 };
    70 };
    71 
    71 
    72 class RegisterSaver {
    72 class RegisterSaver {
    73   // Capture info about frame layout.  Layout offsets are in jint
    73   // Capture info about frame layout.  Layout offsets are in jint
    74   // units because compiler frame slots are jints.
    74   // units because compiler frame slots are jints.
    75 #define HALF_ZMM_BANK_WORDS 128
    75 #define XSAVE_AREA_BEGIN 160
       
    76 #define XSAVE_AREA_YMM_BEGIN 576
       
    77 #define XSAVE_AREA_ZMM_BEGIN 1152
       
    78 #define XSAVE_AREA_UPPERBANK 1664
    76 #define DEF_XMM_OFFS(regnum) xmm ## regnum ## _off = xmm_off + (regnum)*16/BytesPerInt, xmm ## regnum ## H_off
    79 #define DEF_XMM_OFFS(regnum) xmm ## regnum ## _off = xmm_off + (regnum)*16/BytesPerInt, xmm ## regnum ## H_off
       
    80 #define DEF_YMM_OFFS(regnum) ymm ## regnum ## _off = ymm_off + (regnum)*16/BytesPerInt, ymm ## regnum ## H_off
    77 #define DEF_ZMM_OFFS(regnum) zmm ## regnum ## _off = zmm_off + (regnum-16)*64/BytesPerInt, zmm ## regnum ## H_off
    81 #define DEF_ZMM_OFFS(regnum) zmm ## regnum ## _off = zmm_off + (regnum-16)*64/BytesPerInt, zmm ## regnum ## H_off
    78   enum layout {
    82   enum layout {
    79     fpu_state_off = frame::arg_reg_save_area_bytes/BytesPerInt, // fxsave save area
    83     fpu_state_off = frame::arg_reg_save_area_bytes/BytesPerInt, // fxsave save area
    80     xmm_off       = fpu_state_off + 160/BytesPerInt,            // offset in fxsave save area
    84     xmm_off       = fpu_state_off + XSAVE_AREA_BEGIN/BytesPerInt,            // offset in fxsave save area
    81     DEF_XMM_OFFS(0),
    85     DEF_XMM_OFFS(0),
    82     DEF_XMM_OFFS(1),
    86     DEF_XMM_OFFS(1),
    83     DEF_XMM_OFFS(2),
    87     // 2..15 are implied in range usage
    84     DEF_XMM_OFFS(3),
    88     ymm_off = xmm_off + (XSAVE_AREA_YMM_BEGIN - XSAVE_AREA_BEGIN)/BytesPerInt,
    85     DEF_XMM_OFFS(4),
    89     DEF_YMM_OFFS(0),
    86     DEF_XMM_OFFS(5),
    90     DEF_YMM_OFFS(1),
    87     DEF_XMM_OFFS(6),
    91     // 2..15 are implied in range usage
    88     DEF_XMM_OFFS(7),
    92     zmm_high = xmm_off + (XSAVE_AREA_ZMM_BEGIN - XSAVE_AREA_BEGIN)/BytesPerInt,
    89     DEF_XMM_OFFS(8),
    93     zmm_off = xmm_off + (XSAVE_AREA_UPPERBANK - XSAVE_AREA_BEGIN)/BytesPerInt,
    90     DEF_XMM_OFFS(9),
       
    91     DEF_XMM_OFFS(10),
       
    92     DEF_XMM_OFFS(11),
       
    93     DEF_XMM_OFFS(12),
       
    94     DEF_XMM_OFFS(13),
       
    95     DEF_XMM_OFFS(14),
       
    96     DEF_XMM_OFFS(15),
       
    97     zmm_off = fpu_state_off + ((FPUStateSizeInWords - (HALF_ZMM_BANK_WORDS + 1))*wordSize / BytesPerInt),
       
    98     DEF_ZMM_OFFS(16),
    94     DEF_ZMM_OFFS(16),
    99     DEF_ZMM_OFFS(17),
    95     DEF_ZMM_OFFS(17),
   100     DEF_ZMM_OFFS(18),
    96     // 18..31 are implied in range usage
   101     DEF_ZMM_OFFS(19),
       
   102     DEF_ZMM_OFFS(20),
       
   103     DEF_ZMM_OFFS(21),
       
   104     DEF_ZMM_OFFS(22),
       
   105     DEF_ZMM_OFFS(23),
       
   106     DEF_ZMM_OFFS(24),
       
   107     DEF_ZMM_OFFS(25),
       
   108     DEF_ZMM_OFFS(26),
       
   109     DEF_ZMM_OFFS(27),
       
   110     DEF_ZMM_OFFS(28),
       
   111     DEF_ZMM_OFFS(29),
       
   112     DEF_ZMM_OFFS(30),
       
   113     DEF_ZMM_OFFS(31),
       
   114     fpu_state_end = fpu_state_off + ((FPUStateSizeInWords-1)*wordSize / BytesPerInt),
    97     fpu_state_end = fpu_state_off + ((FPUStateSizeInWords-1)*wordSize / BytesPerInt),
   115     fpu_stateH_end,
    98     fpu_stateH_end,
   116     r15_off, r15H_off,
    99     r15_off, r15H_off,
   117     r14_off, r14H_off,
   100     r14_off, r14H_off,
   118     r13_off, r13H_off,
   101     r13_off, r13H_off,
   158   // all the other values have already been extracted.
   141   // all the other values have already been extracted.
   159   static void restore_result_registers(MacroAssembler* masm);
   142   static void restore_result_registers(MacroAssembler* masm);
   160 };
   143 };
   161 
   144 
   162 OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_frame_words, int* total_frame_words, bool save_vectors) {
   145 OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_frame_words, int* total_frame_words, bool save_vectors) {
   163   int vect_words = 0;
       
   164   int ymmhi_offset = -1;
       
   165   int off = 0;
   146   int off = 0;
   166   int num_xmm_regs = XMMRegisterImpl::number_of_registers;
   147   int num_xmm_regs = XMMRegisterImpl::number_of_registers;
   167   if (UseAVX < 3) {
   148   if (UseAVX < 3) {
   168     num_xmm_regs = num_xmm_regs/2;
   149     num_xmm_regs = num_xmm_regs/2;
   169   }
   150   }
   170 #if defined(COMPILER2) || INCLUDE_JVMCI
   151 #if defined(COMPILER2) || INCLUDE_JVMCI
   171   if (save_vectors) {
   152   if (save_vectors) {
   172     assert(UseAVX > 0, "512bit vectors are supported only with EVEX");
   153     assert(UseAVX > 0, "512bit vectors are supported only with EVEX");
   173     assert(MaxVectorSize == 64, "only 512bit vectors are supported now");
   154     assert(MaxVectorSize == 64, "only 512bit vectors are supported now");
   174     // Save upper half of YMM registers
       
   175     vect_words = 16 * num_xmm_regs / wordSize;
       
   176     if (UseAVX < 3) {
       
   177       ymmhi_offset = additional_frame_words;
       
   178       additional_frame_words += vect_words;
       
   179     }
       
   180   }
   155   }
   181 #else
   156 #else
   182   assert(!save_vectors, "vectors are generated only by C2 and JVMCI");
   157   assert(!save_vectors, "vectors are generated only by C2 and JVMCI");
   183 #endif
   158 #endif
   184 
   159 
   185   // Always make the frame size 16-byte aligned
   160   // Always make the frame size 16-byte aligned, both vector and non vector stacks are always allocated
   186   int frame_size_in_bytes = round_to(additional_frame_words*wordSize +
   161   int frame_size_in_bytes = round_to(reg_save_size*BytesPerInt, num_xmm_regs);
   187                                      reg_save_size*BytesPerInt, num_xmm_regs);
       
   188   // OopMap frame size is in compiler stack slots (jint's) not bytes or words
   162   // OopMap frame size is in compiler stack slots (jint's) not bytes or words
   189   int frame_size_in_slots = frame_size_in_bytes / BytesPerInt;
   163   int frame_size_in_slots = frame_size_in_bytes / BytesPerInt;
   190   // The caller will allocate additional_frame_words
       
   191   int additional_frame_slots = additional_frame_words*wordSize / BytesPerInt;
       
   192   // CodeBlob frame size is in words.
   164   // CodeBlob frame size is in words.
   193   int frame_size_in_words = frame_size_in_bytes / wordSize;
   165   int frame_size_in_words = frame_size_in_bytes / wordSize;
   194   *total_frame_words = frame_size_in_words;
   166   *total_frame_words = frame_size_in_words;
   195 
   167 
   196   // Save registers, fpu state, and flags.
   168   // Save registers, fpu state, and flags.
   201 
   173 
   202   __ enter();          // rsp becomes 16-byte aligned here
   174   __ enter();          // rsp becomes 16-byte aligned here
   203   __ push_CPU_state(); // Push a multiple of 16 bytes
   175   __ push_CPU_state(); // Push a multiple of 16 bytes
   204 
   176 
   205   // push cpu state handles this on EVEX enabled targets
   177   // push cpu state handles this on EVEX enabled targets
   206   if ((vect_words > 0) && (UseAVX < 3)) {
   178   if (save_vectors) {
   207     assert(vect_words*wordSize >= 256, "");
   179     // Save upper half of YMM registes(0..15)
   208     // Save upper half of YMM registes(0..num_xmm_regs)
   180     int base_addr = XSAVE_AREA_YMM_BEGIN;
   209     __ subptr(rsp, num_xmm_regs*16);
   181     for (int n = 0; n < 16; n++) {
   210     for (int n = 0; n < num_xmm_regs; n++) {
   182       __ vextractf128h(Address(rsp, base_addr+n*16), as_XMMRegister(n));
   211       __ vextractf128h(Address(rsp, off++*16), as_XMMRegister(n));
   183     }
       
   184     if (VM_Version::supports_evex()) {
       
   185       // Save upper half of ZMM registes(0..15)
       
   186       base_addr = XSAVE_AREA_ZMM_BEGIN;
       
   187       for (int n = 0; n < 16; n++) {
       
   188         __ vextractf64x4h(Address(rsp, base_addr+n*32), as_XMMRegister(n), 1);
       
   189       }
       
   190       // Save full ZMM registes(16..num_xmm_regs)
       
   191       base_addr = XSAVE_AREA_UPPERBANK;
       
   192       int off = 0;
       
   193       int vector_len = Assembler::AVX_512bit;
       
   194       for (int n = 16; n < num_xmm_regs; n++) {
       
   195         __ evmovdqul(Address(rsp, base_addr+(off++*64)), as_XMMRegister(n), vector_len);
       
   196       }
       
   197     }
       
   198   } else {
       
   199     if (VM_Version::supports_evex()) {
       
   200       // Save upper bank of ZMM registers(16..31) for double/float usage
       
   201       int base_addr = XSAVE_AREA_UPPERBANK;
       
   202       int off = 0;
       
   203       for (int n = 16; n < num_xmm_regs; n++) {
       
   204         __ movsd(Address(rsp, base_addr+(off++*64)), as_XMMRegister(n));
       
   205       }
   212     }
   206     }
   213   }
   207   }
   214   if (frame::arg_reg_save_area_bytes != 0) {
   208   if (frame::arg_reg_save_area_bytes != 0) {
   215     // Allocate argument register save area
   209     // Allocate argument register save area
   216     __ subptr(rsp, frame::arg_reg_save_area_bytes);
   210     __ subptr(rsp, frame::arg_reg_save_area_bytes);
   222   // debug-info recordings, as well as let GC find all oops.
   216   // debug-info recordings, as well as let GC find all oops.
   223 
   217 
   224   OopMapSet *oop_maps = new OopMapSet();
   218   OopMapSet *oop_maps = new OopMapSet();
   225   OopMap* map = new OopMap(frame_size_in_slots, 0);
   219   OopMap* map = new OopMap(frame_size_in_slots, 0);
   226 
   220 
   227 #define STACK_OFFSET(x) VMRegImpl::stack2reg((x) + additional_frame_slots)
   221 #define STACK_OFFSET(x) VMRegImpl::stack2reg((x))
   228 #define YMMHI_STACK_OFFSET(x) VMRegImpl::stack2reg((x / VMRegImpl::stack_slot_size) + ymmhi_offset)
       
   229 
   222 
   230   map->set_callee_saved(STACK_OFFSET( rax_off ), rax->as_VMReg());
   223   map->set_callee_saved(STACK_OFFSET( rax_off ), rax->as_VMReg());
   231   map->set_callee_saved(STACK_OFFSET( rcx_off ), rcx->as_VMReg());
   224   map->set_callee_saved(STACK_OFFSET( rcx_off ), rcx->as_VMReg());
   232   map->set_callee_saved(STACK_OFFSET( rdx_off ), rdx->as_VMReg());
   225   map->set_callee_saved(STACK_OFFSET( rdx_off ), rdx->as_VMReg());
   233   map->set_callee_saved(STACK_OFFSET( rbx_off ), rbx->as_VMReg());
   226   map->set_callee_saved(STACK_OFFSET( rbx_off ), rbx->as_VMReg());
   255   if(UseAVX > 2) {
   248   if(UseAVX > 2) {
   256     // Obtain xmm16..xmm31 from the XSAVE area on EVEX enabled targets
   249     // Obtain xmm16..xmm31 from the XSAVE area on EVEX enabled targets
   257     off = zmm16_off;
   250     off = zmm16_off;
   258     delta = zmm17_off - off;
   251     delta = zmm17_off - off;
   259     for (int n = 16; n < num_xmm_regs; n++) {
   252     for (int n = 16; n < num_xmm_regs; n++) {
   260       XMMRegister xmm_name = as_XMMRegister(n);
   253       XMMRegister zmm_name = as_XMMRegister(n);
   261       map->set_callee_saved(STACK_OFFSET(off), xmm_name->as_VMReg());
   254       map->set_callee_saved(STACK_OFFSET(off), zmm_name->as_VMReg());
   262       off += delta;
   255       off += delta;
   263     }
   256     }
   264   }
   257   }
   265 
   258 
   266 #if defined(COMPILER2) || INCLUDE_JVMCI
   259 #if defined(COMPILER2) || INCLUDE_JVMCI
   267   if (save_vectors) {
   260   if (save_vectors) {
   268     assert(ymmhi_offset != -1, "save area must exist");
   261     off = ymm0_off;
   269     map->set_callee_saved(YMMHI_STACK_OFFSET(  0), xmm0->as_VMReg()->next(4));
   262     int delta = ymm1_off - off;
   270     map->set_callee_saved(YMMHI_STACK_OFFSET( 16), xmm1->as_VMReg()->next(4));
   263     for (int n = 0; n < 16; n++) {
   271     map->set_callee_saved(YMMHI_STACK_OFFSET( 32), xmm2->as_VMReg()->next(4));
   264       XMMRegister ymm_name = as_XMMRegister(n);
   272     map->set_callee_saved(YMMHI_STACK_OFFSET( 48), xmm3->as_VMReg()->next(4));
   265       map->set_callee_saved(STACK_OFFSET(off), ymm_name->as_VMReg()->next(4));
   273     map->set_callee_saved(YMMHI_STACK_OFFSET( 64), xmm4->as_VMReg()->next(4));
   266       off += delta;
   274     map->set_callee_saved(YMMHI_STACK_OFFSET( 80), xmm5->as_VMReg()->next(4));
   267     }
   275     map->set_callee_saved(YMMHI_STACK_OFFSET( 96), xmm6->as_VMReg()->next(4));
       
   276     map->set_callee_saved(YMMHI_STACK_OFFSET(112), xmm7->as_VMReg()->next(4));
       
   277     map->set_callee_saved(YMMHI_STACK_OFFSET(128), xmm8->as_VMReg()->next(4));
       
   278     map->set_callee_saved(YMMHI_STACK_OFFSET(144), xmm9->as_VMReg()->next(4));
       
   279     map->set_callee_saved(YMMHI_STACK_OFFSET(160), xmm10->as_VMReg()->next(4));
       
   280     map->set_callee_saved(YMMHI_STACK_OFFSET(176), xmm11->as_VMReg()->next(4));
       
   281     map->set_callee_saved(YMMHI_STACK_OFFSET(192), xmm12->as_VMReg()->next(4));
       
   282     map->set_callee_saved(YMMHI_STACK_OFFSET(208), xmm13->as_VMReg()->next(4));
       
   283     map->set_callee_saved(YMMHI_STACK_OFFSET(224), xmm14->as_VMReg()->next(4));
       
   284     map->set_callee_saved(YMMHI_STACK_OFFSET(240), xmm15->as_VMReg()->next(4));
       
   285   }
   268   }
   286 #endif // COMPILER2 || INCLUDE_JVMCI
   269 #endif // COMPILER2 || INCLUDE_JVMCI
   287 
   270 
   288   // %%% These should all be a waste but we'll keep things as they were for now
   271   // %%% These should all be a waste but we'll keep things as they were for now
   289   if (true) {
   272   if (true) {
   314     if (UseAVX > 2) {
   297     if (UseAVX > 2) {
   315       // Obtain xmm16..xmm31 from the XSAVE area on EVEX enabled targets
   298       // Obtain xmm16..xmm31 from the XSAVE area on EVEX enabled targets
   316       off = zmm16H_off;
   299       off = zmm16H_off;
   317       delta = zmm17H_off - off;
   300       delta = zmm17H_off - off;
   318       for (int n = 16; n < num_xmm_regs; n++) {
   301       for (int n = 16; n < num_xmm_regs; n++) {
   319         XMMRegister xmm_name = as_XMMRegister(n);
   302         XMMRegister zmm_name = as_XMMRegister(n);
   320         map->set_callee_saved(STACK_OFFSET(off), xmm_name->as_VMReg()->next());
   303         map->set_callee_saved(STACK_OFFSET(off), zmm_name->as_VMReg()->next());
   321         off += delta;
   304         off += delta;
   322       }
   305       }
   323     }
   306     }
   324   }
   307   }
   325 
   308 
   333   }
   316   }
   334   if (frame::arg_reg_save_area_bytes != 0) {
   317   if (frame::arg_reg_save_area_bytes != 0) {
   335     // Pop arg register save area
   318     // Pop arg register save area
   336     __ addptr(rsp, frame::arg_reg_save_area_bytes);
   319     __ addptr(rsp, frame::arg_reg_save_area_bytes);
   337   }
   320   }
       
   321 
   338 #if defined(COMPILER2) || INCLUDE_JVMCI
   322 #if defined(COMPILER2) || INCLUDE_JVMCI
       
   323   if (restore_vectors) {
       
   324     assert(UseAVX > 0, "512bit vectors are supported only with EVEX");
       
   325     assert(MaxVectorSize == 64, "only 512bit vectors are supported now");
       
   326   }
       
   327 #else
       
   328   assert(!save_vectors, "vectors are generated only by C2");
       
   329 #endif
       
   330 
   339   // On EVEX enabled targets everything is handled in pop fpu state
   331   // On EVEX enabled targets everything is handled in pop fpu state
   340   if ((restore_vectors) && (UseAVX < 3)) {
   332   if (restore_vectors) {
   341     assert(UseAVX > 0, "256/512-bit vectors are supported only with AVX");
   333     // Restore upper half of YMM registes (0..15)
   342     assert(MaxVectorSize == 64, "up to 512bit vectors are supported now");
   334     int base_addr = XSAVE_AREA_YMM_BEGIN;
   343     int off = 0;
   335     for (int n = 0; n < 16; n++) {
   344     // Restore upper half of YMM registes (0..num_xmm_regs)
   336       __ vinsertf128h(as_XMMRegister(n), Address(rsp,  base_addr+n*16));
   345     for (int n = 0; n < num_xmm_regs; n++) {
   337     }
   346       __ vinsertf128h(as_XMMRegister(n), Address(rsp,  off++*16));
   338     if (VM_Version::supports_evex()) {
   347     }
   339       // Restore upper half of ZMM registes (0..15)
   348     __ addptr(rsp, num_xmm_regs*16);
   340       base_addr = XSAVE_AREA_ZMM_BEGIN;
   349   }
   341       for (int n = 0; n < 16; n++) {
   350 #else
   342         __ vinsertf64x4h(as_XMMRegister(n), Address(rsp, base_addr+n*32), 1);
   351   assert(!restore_vectors, "vectors are generated only by C2 and JVMCI");
   343       }
   352 #endif
   344       // Restore full ZMM registes(16..num_xmm_regs)
       
   345       base_addr = XSAVE_AREA_UPPERBANK;
       
   346       int vector_len = Assembler::AVX_512bit;
       
   347       int off = 0;
       
   348       for (int n = 16; n < num_xmm_regs; n++) {
       
   349         __ evmovdqul(as_XMMRegister(n), Address(rsp, base_addr+(off++*64)), vector_len);
       
   350       }
       
   351     }
       
   352   } else {
       
   353     if (VM_Version::supports_evex()) {
       
   354       // Restore upper bank of ZMM registes(16..31) for double/float usage
       
   355       int base_addr = XSAVE_AREA_UPPERBANK;
       
   356       int off = 0;
       
   357       for (int n = 16; n < num_xmm_regs; n++) {
       
   358         __ movsd(as_XMMRegister(n), Address(rsp, base_addr+(off++*64)));
       
   359       }
       
   360     }
       
   361   }
       
   362 
   353   // Recover CPU state
   363   // Recover CPU state
   354   __ pop_CPU_state();
   364   __ pop_CPU_state();
   355   // Get the rbp described implicitly by the calling convention (no oopMap)
   365   // Get the rbp described implicitly by the calling convention (no oopMap)
   356   __ pop(rbp);
   366   __ pop(rbp);
   357 }
   367 }
  2817     __ movl(c_rarg1, Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())));
  2827     __ movl(c_rarg1, Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())));
  2818     __ movl(Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())), -1);
  2828     __ movl(Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())), -1);
  2819 
  2829 
  2820     __ movl(r14, (int32_t)Deoptimization::Unpack_reexecute);
  2830     __ movl(r14, (int32_t)Deoptimization::Unpack_reexecute);
  2821     __ mov(c_rarg0, r15_thread);
  2831     __ mov(c_rarg0, r15_thread);
       
  2832     __ movl(c_rarg2, r14); // exec mode
  2822     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
  2833     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
  2823     oop_maps->add_gc_map( __ pc()-start, map->deep_copy());
  2834     oop_maps->add_gc_map( __ pc()-start, map->deep_copy());
  2824 
  2835 
  2825     __ reset_last_Java_frame(false, false);
  2836     __ reset_last_Java_frame(false, false);
  2826 
  2837 
  2903     __ stop("SharedRuntime::generate_deopt_blob: last_Java_fp not cleared");
  2914     __ stop("SharedRuntime::generate_deopt_blob: last_Java_fp not cleared");
  2904     __ bind(L);
  2915     __ bind(L);
  2905   }
  2916   }
  2906 #endif // ASSERT
  2917 #endif // ASSERT
  2907   __ mov(c_rarg0, r15_thread);
  2918   __ mov(c_rarg0, r15_thread);
       
  2919   __ movl(c_rarg1, r14); // exec_mode
  2908   __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info)));
  2920   __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info)));
  2909 
  2921 
  2910   // Need to have an oopmap that tells fetch_unroll_info where to
  2922   // Need to have an oopmap that tells fetch_unroll_info where to
  2911   // find any register it might need.
  2923   // find any register it might need.
  2912   oop_maps->add_gc_map(__ pc() - start, map);
  2924   oop_maps->add_gc_map(__ pc() - start, map);
  2920 #endif
  2932 #endif
  2921 
  2933 
  2922   // Load UnrollBlock* into rdi
  2934   // Load UnrollBlock* into rdi
  2923   __ mov(rdi, rax);
  2935   __ mov(rdi, rax);
  2924 
  2936 
       
  2937   __ movl(r14, Address(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()));
  2925    Label noException;
  2938    Label noException;
  2926   __ cmpl(r14, Deoptimization::Unpack_exception);   // Was exception pending?
  2939   __ cmpl(r14, Deoptimization::Unpack_exception);   // Was exception pending?
  2927   __ jcc(Assembler::notEqual, noException);
  2940   __ jcc(Assembler::notEqual, noException);
  2928   __ movptr(rax, Address(r15_thread, JavaThread::exception_oop_offset()));
  2941   __ movptr(rax, Address(r15_thread, JavaThread::exception_oop_offset()));
  2929   // QQQ this is useless it was NULL above
  2942   // QQQ this is useless it was NULL above
  3138   // Thread is in rdi already.
  3151   // Thread is in rdi already.
  3139   //
  3152   //
  3140   // UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index);
  3153   // UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index);
  3141 
  3154 
  3142   __ mov(c_rarg0, r15_thread);
  3155   __ mov(c_rarg0, r15_thread);
       
  3156   __ movl(c_rarg2, Deoptimization::Unpack_uncommon_trap);
  3143   __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
  3157   __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
  3144 
  3158 
  3145   // Set an oopmap for the call site
  3159   // Set an oopmap for the call site
  3146   OopMapSet* oop_maps = new OopMapSet();
  3160   OopMapSet* oop_maps = new OopMapSet();
  3147   OopMap* map = new OopMap(SimpleRuntimeFrame::framesize, 0);
  3161   OopMap* map = new OopMap(SimpleRuntimeFrame::framesize, 0);
  3152 
  3166 
  3153   __ reset_last_Java_frame(false, false);
  3167   __ reset_last_Java_frame(false, false);
  3154 
  3168 
  3155   // Load UnrollBlock* into rdi
  3169   // Load UnrollBlock* into rdi
  3156   __ mov(rdi, rax);
  3170   __ mov(rdi, rax);
       
  3171 
       
  3172 #ifdef ASSERT
       
  3173   { Label L;
       
  3174     __ cmpptr(Address(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes()),
       
  3175             (int32_t)Deoptimization::Unpack_uncommon_trap);
       
  3176     __ jcc(Assembler::equal, L);
       
  3177     __ stop("SharedRuntime::generate_deopt_blob: expected Unpack_uncommon_trap");
       
  3178     __ bind(L);
       
  3179   }
       
  3180 #endif
  3157 
  3181 
  3158   // Pop all the frames we must move/replace.
  3182   // Pop all the frames we must move/replace.
  3159   //
  3183   //
  3160   // Frame picture (youngest to oldest)
  3184   // Frame picture (youngest to oldest)
  3161   // 1: self-frame (no frame link)
  3185   // 1: self-frame (no frame link)