1.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Tue Aug 26 15:49:40 2008 -0700 1.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Wed Aug 27 00:21:55 2008 -0700 1.3 @@ -120,6 +120,7 @@ 1.4 // values on its own 1.5 1.6 static int rax_offset_in_bytes(void) { return BytesPerInt * rax_off; } 1.7 + static int rdx_offset_in_bytes(void) { return BytesPerInt * rdx_off; } 1.8 static int rbx_offset_in_bytes(void) { return BytesPerInt * rbx_off; } 1.9 static int xmm0_offset_in_bytes(void) { return BytesPerInt * xmm0_off; } 1.10 static int return_offset_in_bytes(void) { return BytesPerInt * return_off; } 1.11 @@ -152,7 +153,7 @@ 1.12 __ push_CPU_state(); // Push a multiple of 16 bytes 1.13 if (frame::arg_reg_save_area_bytes != 0) { 1.14 // Allocate argument register save area 1.15 - __ subq(rsp, frame::arg_reg_save_area_bytes); 1.16 + __ subptr(rsp, frame::arg_reg_save_area_bytes); 1.17 } 1.18 1.19 // Set an oopmap for the call site. This oopmap will map all 1.20 @@ -266,12 +267,12 @@ 1.21 void RegisterSaver::restore_live_registers(MacroAssembler* masm) { 1.22 if (frame::arg_reg_save_area_bytes != 0) { 1.23 // Pop arg register save area 1.24 - __ addq(rsp, frame::arg_reg_save_area_bytes); 1.25 + __ addptr(rsp, frame::arg_reg_save_area_bytes); 1.26 } 1.27 // Recover CPU state 1.28 __ pop_CPU_state(); 1.29 // Get the rbp described implicitly by the calling convention (no oopMap) 1.30 - __ popq(rbp); 1.31 + __ pop(rbp); 1.32 } 1.33 1.34 void RegisterSaver::restore_result_registers(MacroAssembler* masm) { 1.35 @@ -285,9 +286,11 @@ 1.36 // Restore fp result register 1.37 __ movdbl(xmm0, Address(rsp, xmm0_offset_in_bytes())); 1.38 // Restore integer result register 1.39 - __ movq(rax, Address(rsp, rax_offset_in_bytes())); 1.40 + __ movptr(rax, Address(rsp, rax_offset_in_bytes())); 1.41 + __ movptr(rdx, Address(rsp, rdx_offset_in_bytes())); 1.42 + 1.43 // Pop all of the register save are off the stack except the return address 1.44 - __ addq(rsp, return_offset_in_bytes()); 1.45 + __ addptr(rsp, return_offset_in_bytes()); 1.46 } 1.47 1.48 // The java_calling_convention describes stack locations as ideal slots on 1.49 @@ -407,18 +410,18 @@ 1.50 static void patch_callers_callsite(MacroAssembler *masm) { 1.51 Label L; 1.52 __ verify_oop(rbx); 1.53 - __ cmpq(Address(rbx, in_bytes(methodOopDesc::code_offset())), (int)NULL_WORD); 1.54 + __ cmpptr(Address(rbx, in_bytes(methodOopDesc::code_offset())), (int32_t)NULL_WORD); 1.55 __ jcc(Assembler::equal, L); 1.56 1.57 // Save the current stack pointer 1.58 - __ movq(r13, rsp); 1.59 + __ mov(r13, rsp); 1.60 // Schedule the branch target address early. 1.61 // Call into the VM to patch the caller, then jump to compiled callee 1.62 // rax isn't live so capture return address while we easily can 1.63 - __ movq(rax, Address(rsp, 0)); 1.64 + __ movptr(rax, Address(rsp, 0)); 1.65 1.66 // align stack so push_CPU_state doesn't fault 1.67 - __ andq(rsp, -(StackAlignmentInBytes)); 1.68 + __ andptr(rsp, -(StackAlignmentInBytes)); 1.69 __ push_CPU_state(); 1.70 1.71 1.72 @@ -430,20 +433,20 @@ 1.73 1.74 // Allocate argument register save area 1.75 if (frame::arg_reg_save_area_bytes != 0) { 1.76 - __ subq(rsp, frame::arg_reg_save_area_bytes); 1.77 + __ subptr(rsp, frame::arg_reg_save_area_bytes); 1.78 } 1.79 - __ movq(c_rarg0, rbx); 1.80 - __ movq(c_rarg1, rax); 1.81 + __ mov(c_rarg0, rbx); 1.82 + __ mov(c_rarg1, rax); 1.83 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::fixup_callers_callsite))); 1.84 1.85 // De-allocate argument register save area 1.86 if (frame::arg_reg_save_area_bytes != 0) { 1.87 - __ addq(rsp, frame::arg_reg_save_area_bytes); 1.88 + __ addptr(rsp, frame::arg_reg_save_area_bytes); 1.89 } 1.90 1.91 __ pop_CPU_state(); 1.92 // restore sp 1.93 - __ movq(rsp, r13); 1.94 + __ mov(rsp, r13); 1.95 __ bind(L); 1.96 } 1.97 1.98 @@ -452,13 +455,13 @@ 1.99 if (TaggedStackInterpreter) { 1.100 int tag_offset = st_off + Interpreter::expr_tag_offset_in_bytes(0); 1.101 if (sig == T_OBJECT || sig == T_ARRAY) { 1.102 - __ mov64(Address(rsp, tag_offset), frame::TagReference); 1.103 + __ movptr(Address(rsp, tag_offset), (int32_t) frame::TagReference); 1.104 } else if (sig == T_LONG || sig == T_DOUBLE) { 1.105 int next_tag_offset = st_off + Interpreter::expr_tag_offset_in_bytes(1); 1.106 - __ mov64(Address(rsp, next_tag_offset), frame::TagValue); 1.107 - __ mov64(Address(rsp, tag_offset), frame::TagValue); 1.108 + __ movptr(Address(rsp, next_tag_offset), (int32_t) frame::TagValue); 1.109 + __ movptr(Address(rsp, tag_offset), (int32_t) frame::TagValue); 1.110 } else { 1.111 - __ mov64(Address(rsp, tag_offset), frame::TagValue); 1.112 + __ movptr(Address(rsp, tag_offset), (int32_t) frame::TagValue); 1.113 } 1.114 } 1.115 } 1.116 @@ -490,15 +493,15 @@ 1.117 extraspace = round_to(extraspace, 2*wordSize); 1.118 1.119 // Get return address 1.120 - __ popq(rax); 1.121 + __ pop(rax); 1.122 1.123 // set senderSP value 1.124 - __ movq(r13, rsp); 1.125 - 1.126 - __ subq(rsp, extraspace); 1.127 + __ mov(r13, rsp); 1.128 + 1.129 + __ subptr(rsp, extraspace); 1.130 1.131 // Store the return address in the expected location 1.132 - __ movq(Address(rsp, 0), rax); 1.133 + __ movptr(Address(rsp, 0), rax); 1.134 1.135 // Now write the args into the outgoing interpreter space 1.136 for (int i = 0; i < total_args_passed; i++) { 1.137 @@ -537,7 +540,7 @@ 1.138 if (!r_2->is_valid()) { 1.139 // sign extend?? 1.140 __ movl(rax, Address(rsp, ld_off)); 1.141 - __ movq(Address(rsp, st_off), rax); 1.142 + __ movptr(Address(rsp, st_off), rax); 1.143 tag_stack(masm, sig_bt[i], st_off); 1.144 1.145 } else { 1.146 @@ -553,7 +556,7 @@ 1.147 #ifdef ASSERT 1.148 // Overwrite the unused slot with known junk 1.149 __ mov64(rax, CONST64(0xdeadffffdeadaaaa)); 1.150 - __ movq(Address(rsp, st_off), rax); 1.151 + __ movptr(Address(rsp, st_off), rax); 1.152 #endif /* ASSERT */ 1.153 tag_stack(masm, sig_bt[i], next_off); 1.154 } else { 1.155 @@ -576,12 +579,12 @@ 1.156 #ifdef ASSERT 1.157 // Overwrite the unused slot with known junk 1.158 __ mov64(rax, CONST64(0xdeadffffdeadaaab)); 1.159 - __ movq(Address(rsp, st_off), rax); 1.160 + __ movptr(Address(rsp, st_off), rax); 1.161 #endif /* ASSERT */ 1.162 __ movq(Address(rsp, next_off), r); 1.163 tag_stack(masm, sig_bt[i], next_off); 1.164 } else { 1.165 - __ movq(Address(rsp, st_off), r); 1.166 + __ movptr(Address(rsp, st_off), r); 1.167 tag_stack(masm, sig_bt[i], st_off); 1.168 } 1.169 } 1.170 @@ -595,7 +598,7 @@ 1.171 #ifdef ASSERT 1.172 // Overwrite the unused slot with known junk 1.173 __ mov64(rax, CONST64(0xdeadffffdeadaaac)); 1.174 - __ movq(Address(rsp, st_off), rax); 1.175 + __ movptr(Address(rsp, st_off), rax); 1.176 #endif /* ASSERT */ 1.177 __ movdbl(Address(rsp, next_off), r_1->as_XMMRegister()); 1.178 tag_stack(masm, sig_bt[i], next_off); 1.179 @@ -604,7 +607,7 @@ 1.180 } 1.181 1.182 // Schedule the branch target address early. 1.183 - __ movq(rcx, Address(rbx, in_bytes(methodOopDesc::interpreter_entry_offset()))); 1.184 + __ movptr(rcx, Address(rbx, in_bytes(methodOopDesc::interpreter_entry_offset()))); 1.185 __ jmp(rcx); 1.186 } 1.187 1.188 @@ -631,7 +634,7 @@ 1.189 // save code can segv when fxsave instructions find improperly 1.190 // aligned stack pointer. 1.191 1.192 - __ movq(rax, Address(rsp, 0)); 1.193 + __ movptr(rax, Address(rsp, 0)); 1.194 1.195 // Cut-out for having no stack args. Since up to 2 int/oop args are passed 1.196 // in registers, we will occasionally have no stack args. 1.197 @@ -645,20 +648,20 @@ 1.198 comp_words_on_stack = round_to(comp_args_on_stack*VMRegImpl::stack_slot_size, wordSize)>>LogBytesPerWord; 1.199 // Round up to miminum stack alignment, in wordSize 1.200 comp_words_on_stack = round_to(comp_words_on_stack, 2); 1.201 - __ subq(rsp, comp_words_on_stack * wordSize); 1.202 + __ subptr(rsp, comp_words_on_stack * wordSize); 1.203 } 1.204 1.205 1.206 // Ensure compiled code always sees stack at proper alignment 1.207 - __ andq(rsp, -16); 1.208 + __ andptr(rsp, -16); 1.209 1.210 // push the return address and misalign the stack that youngest frame always sees 1.211 // as far as the placement of the call instruction 1.212 - __ pushq(rax); 1.213 + __ push(rax); 1.214 1.215 // Will jump to the compiled code just as if compiled code was doing it. 1.216 // Pre-load the register-jump target early, to schedule it better. 1.217 - __ movq(r11, Address(rbx, in_bytes(methodOopDesc::from_compiled_offset()))); 1.218 + __ movptr(r11, Address(rbx, in_bytes(methodOopDesc::from_compiled_offset()))); 1.219 1.220 // Now generate the shuffle code. Pick up all register args and move the 1.221 // rest through the floating point stack top. 1.222 @@ -697,7 +700,7 @@ 1.223 if (!r_2->is_valid()) { 1.224 // sign extend??? 1.225 __ movl(rax, Address(r13, ld_off)); 1.226 - __ movq(Address(rsp, st_off), rax); 1.227 + __ movptr(Address(rsp, st_off), rax); 1.228 } else { 1.229 // 1.230 // We are using two optoregs. This can be either T_OBJECT, T_ADDRESS, T_LONG, or T_DOUBLE 1.231 @@ -751,12 +754,12 @@ 1.232 // is possible. So we stash the desired callee in the thread 1.233 // and the vm will find there should this case occur. 1.234 1.235 - __ movq(Address(r15_thread, JavaThread::callee_target_offset()), rbx); 1.236 + __ movptr(Address(r15_thread, JavaThread::callee_target_offset()), rbx); 1.237 1.238 // put methodOop where a c2i would expect should we end up there 1.239 // only needed becaus eof c2 resolve stubs return methodOop as a result in 1.240 // rax 1.241 - __ movq(rax, rbx); 1.242 + __ mov(rax, rbx); 1.243 __ jmp(r11); 1.244 } 1.245 1.246 @@ -792,8 +795,8 @@ 1.247 __ load_klass(temp, receiver); 1.248 __ verify_oop(temp); 1.249 1.250 - __ cmpq(temp, Address(holder, compiledICHolderOopDesc::holder_klass_offset())); 1.251 - __ movq(rbx, Address(holder, compiledICHolderOopDesc::holder_method_offset())); 1.252 + __ cmpptr(temp, Address(holder, compiledICHolderOopDesc::holder_klass_offset())); 1.253 + __ movptr(rbx, Address(holder, compiledICHolderOopDesc::holder_method_offset())); 1.254 __ jcc(Assembler::equal, ok); 1.255 __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub())); 1.256 1.257 @@ -801,7 +804,7 @@ 1.258 // Method might have been compiled since the call site was patched to 1.259 // interpreted if that is the case treat it as a miss so we can get 1.260 // the call site corrected. 1.261 - __ cmpq(Address(rbx, in_bytes(methodOopDesc::code_offset())), (int)NULL_WORD); 1.262 + __ cmpptr(Address(rbx, in_bytes(methodOopDesc::code_offset())), (int32_t)NULL_WORD); 1.263 __ jcc(Assembler::equal, skip_fixup); 1.264 __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub())); 1.265 } 1.266 @@ -980,10 +983,10 @@ 1.267 *receiver_offset = (offset_in_older_frame + framesize_in_slots) * VMRegImpl::stack_slot_size; 1.268 } 1.269 1.270 - __ cmpq(Address(rbp, reg2offset_in(src.first())), (int)NULL_WORD); 1.271 - __ leaq(rHandle, Address(rbp, reg2offset_in(src.first()))); 1.272 + __ cmpptr(Address(rbp, reg2offset_in(src.first())), (int32_t)NULL_WORD); 1.273 + __ lea(rHandle, Address(rbp, reg2offset_in(src.first()))); 1.274 // conditionally move a NULL 1.275 - __ cmovq(Assembler::equal, rHandle, Address(rbp, reg2offset_in(src.first()))); 1.276 + __ cmovptr(Assembler::equal, rHandle, Address(rbp, reg2offset_in(src.first()))); 1.277 } else { 1.278 1.279 // Oop is in an a register we must store it to the space we reserve 1.280 @@ -1011,20 +1014,20 @@ 1.281 1.282 map->set_oop(VMRegImpl::stack2reg(oop_slot)); 1.283 // Store oop in handle area, may be NULL 1.284 - __ movq(Address(rsp, offset), rOop); 1.285 + __ movptr(Address(rsp, offset), rOop); 1.286 if (is_receiver) { 1.287 *receiver_offset = offset; 1.288 } 1.289 1.290 - __ cmpq(rOop, (int)NULL); 1.291 - __ leaq(rHandle, Address(rsp, offset)); 1.292 + __ cmpptr(rOop, (int32_t)NULL_WORD); 1.293 + __ lea(rHandle, Address(rsp, offset)); 1.294 // conditionally move a NULL from the handle area where it was just stored 1.295 - __ cmovq(Assembler::equal, rHandle, Address(rsp, offset)); 1.296 + __ cmovptr(Assembler::equal, rHandle, Address(rsp, offset)); 1.297 } 1.298 1.299 // If arg is on the stack then place it otherwise it is already in correct reg. 1.300 if (dst.first()->is_stack()) { 1.301 - __ movq(Address(rsp, reg2offset_out(dst.first())), rHandle); 1.302 + __ movptr(Address(rsp, reg2offset_out(dst.first())), rHandle); 1.303 } 1.304 } 1.305 1.306 @@ -1039,7 +1042,7 @@ 1.307 if (src.first()->is_stack()) { 1.308 if (dst.first()->is_stack()) { 1.309 __ movl(rax, Address(rbp, reg2offset_in(src.first()))); 1.310 - __ movq(Address(rsp, reg2offset_out(dst.first())), rax); 1.311 + __ movptr(Address(rsp, reg2offset_out(dst.first())), rax); 1.312 } else { 1.313 // stack to reg 1.314 assert(dst.first()->is_XMMRegister(), "only expect xmm registers as parameters"); 1.315 @@ -1068,7 +1071,7 @@ 1.316 if (src.is_single_phys_reg() ) { 1.317 if (dst.is_single_phys_reg()) { 1.318 if (dst.first() != src.first()) { 1.319 - __ movq(dst.first()->as_Register(), src.first()->as_Register()); 1.320 + __ mov(dst.first()->as_Register(), src.first()->as_Register()); 1.321 } 1.322 } else { 1.323 assert(dst.is_single_reg(), "not a stack pair"); 1.324 @@ -1124,7 +1127,7 @@ 1.325 break; 1.326 case T_VOID: break; 1.327 default: { 1.328 - __ movq(Address(rbp, -wordSize), rax); 1.329 + __ movptr(Address(rbp, -wordSize), rax); 1.330 } 1.331 } 1.332 } 1.333 @@ -1141,7 +1144,7 @@ 1.334 break; 1.335 case T_VOID: break; 1.336 default: { 1.337 - __ movq(rax, Address(rbp, -wordSize)); 1.338 + __ movptr(rax, Address(rbp, -wordSize)); 1.339 } 1.340 } 1.341 } 1.342 @@ -1149,9 +1152,9 @@ 1.343 static void save_args(MacroAssembler *masm, int arg_count, int first_arg, VMRegPair *args) { 1.344 for ( int i = first_arg ; i < arg_count ; i++ ) { 1.345 if (args[i].first()->is_Register()) { 1.346 - __ pushq(args[i].first()->as_Register()); 1.347 + __ push(args[i].first()->as_Register()); 1.348 } else if (args[i].first()->is_XMMRegister()) { 1.349 - __ subq(rsp, 2*wordSize); 1.350 + __ subptr(rsp, 2*wordSize); 1.351 __ movdbl(Address(rsp, 0), args[i].first()->as_XMMRegister()); 1.352 } 1.353 } 1.354 @@ -1160,10 +1163,10 @@ 1.355 static void restore_args(MacroAssembler *masm, int arg_count, int first_arg, VMRegPair *args) { 1.356 for ( int i = arg_count - 1 ; i >= first_arg ; i-- ) { 1.357 if (args[i].first()->is_Register()) { 1.358 - __ popq(args[i].first()->as_Register()); 1.359 + __ pop(args[i].first()->as_Register()); 1.360 } else if (args[i].first()->is_XMMRegister()) { 1.361 __ movdbl(args[i].first()->as_XMMRegister(), Address(rsp, 0)); 1.362 - __ addq(rsp, 2*wordSize); 1.363 + __ addptr(rsp, 2*wordSize); 1.364 } 1.365 } 1.366 } 1.367 @@ -1303,16 +1306,16 @@ 1.368 Label exception_pending; 1.369 1.370 __ verify_oop(receiver); 1.371 - __ pushq(tmp); // spill (any other registers free here???) 1.372 + __ push(tmp); // spill (any other registers free here???) 1.373 __ load_klass(tmp, receiver); 1.374 __ cmpq(ic_reg, tmp); 1.375 __ jcc(Assembler::equal, ok); 1.376 1.377 - __ popq(tmp); 1.378 + __ pop(tmp); 1.379 __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub())); 1.380 1.381 __ bind(ok); 1.382 - __ popq(tmp); 1.383 + __ pop(tmp); 1.384 1.385 // Verified entry point must be aligned 1.386 __ align(8); 1.387 @@ -1335,7 +1338,7 @@ 1.388 // Generate a new frame for the wrapper. 1.389 __ enter(); 1.390 // -2 because return address is already present and so is saved rbp 1.391 - __ subq(rsp, stack_size - 2*wordSize); 1.392 + __ subptr(rsp, stack_size - 2*wordSize); 1.393 1.394 // Frame is now completed as far as size and linkage. 1.395 1.396 @@ -1344,9 +1347,9 @@ 1.397 #ifdef ASSERT 1.398 { 1.399 Label L; 1.400 - __ movq(rax, rsp); 1.401 - __ andq(rax, -16); // must be 16 byte boundry (see amd64 ABI) 1.402 - __ cmpq(rax, rsp); 1.403 + __ mov(rax, rsp); 1.404 + __ andptr(rax, -16); // must be 16 byte boundry (see amd64 ABI) 1.405 + __ cmpptr(rax, rsp); 1.406 __ jcc(Assembler::equal, L); 1.407 __ stop("improperly aligned stack"); 1.408 __ bind(L); 1.409 @@ -1467,13 +1470,13 @@ 1.410 __ movoop(oop_handle_reg, JNIHandles::make_local(Klass::cast(method->method_holder())->java_mirror())); 1.411 1.412 // Now handlize the static class mirror it's known not-null. 1.413 - __ movq(Address(rsp, klass_offset), oop_handle_reg); 1.414 + __ movptr(Address(rsp, klass_offset), oop_handle_reg); 1.415 map->set_oop(VMRegImpl::stack2reg(klass_slot_offset)); 1.416 1.417 // Now get the handle 1.418 - __ leaq(oop_handle_reg, Address(rsp, klass_offset)); 1.419 + __ lea(oop_handle_reg, Address(rsp, klass_offset)); 1.420 // store the klass handle as second argument 1.421 - __ movq(c_rarg1, oop_handle_reg); 1.422 + __ movptr(c_rarg1, oop_handle_reg); 1.423 // and protect the arg if we must spill 1.424 c_arg--; 1.425 } 1.426 @@ -1521,14 +1524,14 @@ 1.427 const int mark_word_offset = BasicLock::displaced_header_offset_in_bytes(); 1.428 1.429 // Get the handle (the 2nd argument) 1.430 - __ movq(oop_handle_reg, c_rarg1); 1.431 + __ mov(oop_handle_reg, c_rarg1); 1.432 1.433 // Get address of the box 1.434 1.435 - __ leaq(lock_reg, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size)); 1.436 + __ lea(lock_reg, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size)); 1.437 1.438 // Load the oop from the handle 1.439 - __ movq(obj_reg, Address(oop_handle_reg, 0)); 1.440 + __ movptr(obj_reg, Address(oop_handle_reg, 0)); 1.441 1.442 if (UseBiasedLocking) { 1.443 __ biased_locking_enter(lock_reg, obj_reg, swap_reg, rscratch1, false, lock_done, &slow_path_lock); 1.444 @@ -1538,17 +1541,17 @@ 1.445 __ movl(swap_reg, 1); 1.446 1.447 // Load (object->mark() | 1) into swap_reg %rax 1.448 - __ orq(swap_reg, Address(obj_reg, 0)); 1.449 + __ orptr(swap_reg, Address(obj_reg, 0)); 1.450 1.451 // Save (object->mark() | 1) into BasicLock's displaced header 1.452 - __ movq(Address(lock_reg, mark_word_offset), swap_reg); 1.453 + __ movptr(Address(lock_reg, mark_word_offset), swap_reg); 1.454 1.455 if (os::is_MP()) { 1.456 __ lock(); 1.457 } 1.458 1.459 // src -> dest iff dest == rax else rax <- dest 1.460 - __ cmpxchgq(lock_reg, Address(obj_reg, 0)); 1.461 + __ cmpxchgptr(lock_reg, Address(obj_reg, 0)); 1.462 __ jcc(Assembler::equal, lock_done); 1.463 1.464 // Hmm should this move to the slow path code area??? 1.465 @@ -1562,11 +1565,11 @@ 1.466 // least significant 2 bits clear. 1.467 // NOTE: the oopMark is in swap_reg %rax as the result of cmpxchg 1.468 1.469 - __ subq(swap_reg, rsp); 1.470 - __ andq(swap_reg, 3 - os::vm_page_size()); 1.471 + __ subptr(swap_reg, rsp); 1.472 + __ andptr(swap_reg, 3 - os::vm_page_size()); 1.473 1.474 // Save the test result, for recursive case, the result is zero 1.475 - __ movq(Address(lock_reg, mark_word_offset), swap_reg); 1.476 + __ movptr(Address(lock_reg, mark_word_offset), swap_reg); 1.477 __ jcc(Assembler::notEqual, slow_path_lock); 1.478 1.479 // Slow path will re-enter here 1.480 @@ -1580,21 +1583,21 @@ 1.481 1.482 // get JNIEnv* which is first argument to native 1.483 1.484 - __ leaq(c_rarg0, Address(r15_thread, in_bytes(JavaThread::jni_environment_offset()))); 1.485 + __ lea(c_rarg0, Address(r15_thread, in_bytes(JavaThread::jni_environment_offset()))); 1.486 1.487 // Now set thread in native 1.488 - __ mov64(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_native); 1.489 + __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_native); 1.490 1.491 __ call(RuntimeAddress(method->native_function())); 1.492 1.493 // Either restore the MXCSR register after returning from the JNI Call 1.494 // or verify that it wasn't changed. 1.495 if (RestoreMXCSROnJNICalls) { 1.496 - __ ldmxcsr(ExternalAddress(StubRoutines::amd64::mxcsr_std())); 1.497 + __ ldmxcsr(ExternalAddress(StubRoutines::x86::mxcsr_std())); 1.498 1.499 } 1.500 else if (CheckJNICalls ) { 1.501 - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::amd64::verify_mxcsr_entry()))); 1.502 + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::x86::verify_mxcsr_entry()))); 1.503 } 1.504 1.505 1.506 @@ -1624,7 +1627,7 @@ 1.507 // VM thread changes sync state to synchronizing and suspends threads for GC. 1.508 // Thread A is resumed to finish this native method, but doesn't block here since it 1.509 // didn't see any synchronization is progress, and escapes. 1.510 - __ mov64(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_native_trans); 1.511 + __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_native_trans); 1.512 1.513 if(os::is_MP()) { 1.514 if (UseMembar) { 1.515 @@ -1662,12 +1665,12 @@ 1.516 // by hand. 1.517 // 1.518 save_native_result(masm, ret_type, stack_slots); 1.519 - __ movq(c_rarg0, r15_thread); 1.520 - __ movq(r12, rsp); // remember sp 1.521 - __ subq(rsp, frame::arg_reg_save_area_bytes); // windows 1.522 - __ andq(rsp, -16); // align stack as required by ABI 1.523 + __ mov(c_rarg0, r15_thread); 1.524 + __ mov(r12, rsp); // remember sp 1.525 + __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows 1.526 + __ andptr(rsp, -16); // align stack as required by ABI 1.527 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans))); 1.528 - __ movq(rsp, r12); // restore sp 1.529 + __ mov(rsp, r12); // restore sp 1.530 __ reinit_heapbase(); 1.531 // Restore any method result value 1.532 restore_native_result(masm, ret_type, stack_slots); 1.533 @@ -1691,7 +1694,7 @@ 1.534 if (method->is_synchronized()) { 1.535 1.536 // Get locked oop from the handle we passed to jni 1.537 - __ movq(obj_reg, Address(oop_handle_reg, 0)); 1.538 + __ movptr(obj_reg, Address(oop_handle_reg, 0)); 1.539 1.540 Label done; 1.541 1.542 @@ -1701,7 +1704,7 @@ 1.543 1.544 // Simple recursive lock? 1.545 1.546 - __ cmpq(Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size), (int)NULL_WORD); 1.547 + __ cmpptr(Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size), (int32_t)NULL_WORD); 1.548 __ jcc(Assembler::equal, done); 1.549 1.550 // Must save rax if if it is live now because cmpxchg must use it 1.551 @@ -1711,15 +1714,15 @@ 1.552 1.553 1.554 // get address of the stack lock 1.555 - __ leaq(rax, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size)); 1.556 + __ lea(rax, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size)); 1.557 // get old displaced header 1.558 - __ movq(old_hdr, Address(rax, 0)); 1.559 + __ movptr(old_hdr, Address(rax, 0)); 1.560 1.561 // Atomic swap old header if oop still contains the stack lock 1.562 if (os::is_MP()) { 1.563 __ lock(); 1.564 } 1.565 - __ cmpxchgq(old_hdr, Address(obj_reg, 0)); 1.566 + __ cmpxchgptr(old_hdr, Address(obj_reg, 0)); 1.567 __ jcc(Assembler::notEqual, slow_path_unlock); 1.568 1.569 // slow path re-enters here 1.570 @@ -1746,23 +1749,23 @@ 1.571 // Unpack oop result 1.572 if (ret_type == T_OBJECT || ret_type == T_ARRAY) { 1.573 Label L; 1.574 - __ testq(rax, rax); 1.575 + __ testptr(rax, rax); 1.576 __ jcc(Assembler::zero, L); 1.577 - __ movq(rax, Address(rax, 0)); 1.578 + __ movptr(rax, Address(rax, 0)); 1.579 __ bind(L); 1.580 __ verify_oop(rax); 1.581 } 1.582 1.583 // reset handle block 1.584 - __ movq(rcx, Address(r15_thread, JavaThread::active_handles_offset())); 1.585 - __ movptr(Address(rcx, JNIHandleBlock::top_offset_in_bytes()), (int)NULL_WORD); 1.586 + __ movptr(rcx, Address(r15_thread, JavaThread::active_handles_offset())); 1.587 + __ movptr(Address(rcx, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD); 1.588 1.589 // pop our frame 1.590 1.591 __ leave(); 1.592 1.593 // Any exception pending? 1.594 - __ cmpq(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD); 1.595 + __ cmpptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD); 1.596 __ jcc(Assembler::notEqual, exception_pending); 1.597 1.598 // Return 1.599 @@ -1790,9 +1793,9 @@ 1.600 // protect the args we've loaded 1.601 save_args(masm, total_c_args, c_arg, out_regs); 1.602 1.603 - __ movq(c_rarg0, obj_reg); 1.604 - __ movq(c_rarg1, lock_reg); 1.605 - __ movq(c_rarg2, r15_thread); 1.606 + __ mov(c_rarg0, obj_reg); 1.607 + __ mov(c_rarg1, lock_reg); 1.608 + __ mov(c_rarg2, r15_thread); 1.609 1.610 // Not a leaf but we have last_Java_frame setup as we want 1.611 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_locking_C), 3); 1.612 @@ -1800,7 +1803,7 @@ 1.613 1.614 #ifdef ASSERT 1.615 { Label L; 1.616 - __ cmpq(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD); 1.617 + __ cmpptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD); 1.618 __ jcc(Assembler::equal, L); 1.619 __ stop("no pending exception allowed on exit from monitorenter"); 1.620 __ bind(L); 1.621 @@ -1820,32 +1823,32 @@ 1.622 save_native_result(masm, ret_type, stack_slots); 1.623 } 1.624 1.625 - __ leaq(c_rarg1, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size)); 1.626 - 1.627 - __ movq(c_rarg0, obj_reg); 1.628 - __ movq(r12, rsp); // remember sp 1.629 - __ subq(rsp, frame::arg_reg_save_area_bytes); // windows 1.630 - __ andq(rsp, -16); // align stack as required by ABI 1.631 + __ lea(c_rarg1, Address(rsp, lock_slot_offset * VMRegImpl::stack_slot_size)); 1.632 + 1.633 + __ mov(c_rarg0, obj_reg); 1.634 + __ mov(r12, rsp); // remember sp 1.635 + __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows 1.636 + __ andptr(rsp, -16); // align stack as required by ABI 1.637 1.638 // Save pending exception around call to VM (which contains an EXCEPTION_MARK) 1.639 // NOTE that obj_reg == rbx currently 1.640 - __ movq(rbx, Address(r15_thread, in_bytes(Thread::pending_exception_offset()))); 1.641 - __ movptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD); 1.642 + __ movptr(rbx, Address(r15_thread, in_bytes(Thread::pending_exception_offset()))); 1.643 + __ movptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD); 1.644 1.645 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C))); 1.646 - __ movq(rsp, r12); // restore sp 1.647 + __ mov(rsp, r12); // restore sp 1.648 __ reinit_heapbase(); 1.649 #ifdef ASSERT 1.650 { 1.651 Label L; 1.652 - __ cmpq(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD); 1.653 + __ cmpptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD); 1.654 __ jcc(Assembler::equal, L); 1.655 __ stop("no pending exception allowed on exit complete_monitor_unlocking_C"); 1.656 __ bind(L); 1.657 } 1.658 #endif /* ASSERT */ 1.659 1.660 - __ movq(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), rbx); 1.661 + __ movptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), rbx); 1.662 1.663 if (ret_type == T_FLOAT || ret_type == T_DOUBLE ) { 1.664 restore_native_result(masm, ret_type, stack_slots); 1.665 @@ -1860,11 +1863,11 @@ 1.666 1.667 __ bind(reguard); 1.668 save_native_result(masm, ret_type, stack_slots); 1.669 - __ movq(r12, rsp); // remember sp 1.670 - __ subq(rsp, frame::arg_reg_save_area_bytes); // windows 1.671 - __ andq(rsp, -16); // align stack as required by ABI 1.672 + __ mov(r12, rsp); // remember sp 1.673 + __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows 1.674 + __ andptr(rsp, -16); // align stack as required by ABI 1.675 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages))); 1.676 - __ movq(rsp, r12); // restore sp 1.677 + __ mov(rsp, r12); // restore sp 1.678 __ reinit_heapbase(); 1.679 restore_native_result(masm, ret_type, stack_slots); 1.680 // and continue 1.681 @@ -2574,19 +2577,74 @@ 1.682 // Normal deoptimization. Save exec mode for unpack_frames. 1.683 __ movl(r14, Deoptimization::Unpack_deopt); // callee-saved 1.684 __ jmp(cont); 1.685 + 1.686 + int reexecute_offset = __ pc() - start; 1.687 + 1.688 + // Reexecute case 1.689 + // return address is the pc describes what bci to do re-execute at 1.690 + 1.691 + // No need to update map as each call to save_live_registers will produce identical oopmap 1.692 + (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words); 1.693 + 1.694 + __ movl(r14, Deoptimization::Unpack_reexecute); // callee-saved 1.695 + __ jmp(cont); 1.696 + 1.697 int exception_offset = __ pc() - start; 1.698 1.699 // Prolog for exception case 1.700 1.701 - // Push throwing pc as return address 1.702 - __ pushq(rdx); 1.703 + // all registers are dead at this entry point, except for rax, and 1.704 + // rdx which contain the exception oop and exception pc 1.705 + // respectively. Set them in TLS and fall thru to the 1.706 + // unpack_with_exception_in_tls entry point. 1.707 + 1.708 + __ movptr(Address(r15_thread, JavaThread::exception_pc_offset()), rdx); 1.709 + __ movptr(Address(r15_thread, JavaThread::exception_oop_offset()), rax); 1.710 + 1.711 + int exception_in_tls_offset = __ pc() - start; 1.712 + 1.713 + // new implementation because exception oop is now passed in JavaThread 1.714 + 1.715 + // Prolog for exception case 1.716 + // All registers must be preserved because they might be used by LinearScan 1.717 + // Exceptiop oop and throwing PC are passed in JavaThread 1.718 + // tos: stack at point of call to method that threw the exception (i.e. only 1.719 + // args are on the stack, no return address) 1.720 + 1.721 + // make room on stack for the return address 1.722 + // It will be patched later with the throwing pc. The correct value is not 1.723 + // available now because loading it from memory would destroy registers. 1.724 + __ push(0); 1.725 1.726 // Save everything in sight. 1.727 map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words); 1.728 1.729 + // Now it is safe to overwrite any register 1.730 + 1.731 // Deopt during an exception. Save exec mode for unpack_frames. 1.732 __ movl(r14, Deoptimization::Unpack_exception); // callee-saved 1.733 1.734 + // load throwing pc from JavaThread and patch it as the return address 1.735 + // of the current frame. Then clear the field in JavaThread 1.736 + 1.737 + __ movptr(rdx, Address(r15_thread, JavaThread::exception_pc_offset())); 1.738 + __ movptr(Address(rbp, wordSize), rdx); 1.739 + __ movptr(Address(r15_thread, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); 1.740 + 1.741 +#ifdef ASSERT 1.742 + // verify that there is really an exception oop in JavaThread 1.743 + __ movptr(rax, Address(r15_thread, JavaThread::exception_oop_offset())); 1.744 + __ verify_oop(rax); 1.745 + 1.746 + // verify that there is no pending exception 1.747 + Label no_pending_exception; 1.748 + __ movptr(rax, Address(r15_thread, Thread::pending_exception_offset())); 1.749 + __ testptr(rax, rax); 1.750 + __ jcc(Assembler::zero, no_pending_exception); 1.751 + __ stop("must not have pending exception here"); 1.752 + __ bind(no_pending_exception); 1.753 +#endif 1.754 + 1.755 __ bind(cont); 1.756 1.757 // Call C code. Need thread and this frame, but NOT official VM entry 1.758 @@ -2599,15 +2657,15 @@ 1.759 __ set_last_Java_frame(noreg, noreg, NULL); 1.760 #ifdef ASSERT 1.761 { Label L; 1.762 - __ cmpq(Address(r15_thread, 1.763 + __ cmpptr(Address(r15_thread, 1.764 JavaThread::last_Java_fp_offset()), 1.765 - 0); 1.766 + (int32_t)0); 1.767 __ jcc(Assembler::equal, L); 1.768 __ stop("SharedRuntime::generate_deopt_blob: last_Java_fp not cleared"); 1.769 __ bind(L); 1.770 } 1.771 #endif // ASSERT 1.772 - __ movq(c_rarg0, r15_thread); 1.773 + __ mov(c_rarg0, r15_thread); 1.774 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info))); 1.775 1.776 // Need to have an oopmap that tells fetch_unroll_info where to 1.777 @@ -2617,7 +2675,25 @@ 1.778 __ reset_last_Java_frame(false, false); 1.779 1.780 // Load UnrollBlock* into rdi 1.781 - __ movq(rdi, rax); 1.782 + __ mov(rdi, rax); 1.783 + 1.784 + Label noException; 1.785 + __ cmpl(r12, Deoptimization::Unpack_exception); // Was exception pending? 1.786 + __ jcc(Assembler::notEqual, noException); 1.787 + __ movptr(rax, Address(r15_thread, JavaThread::exception_oop_offset())); 1.788 + // QQQ this is useless it was NULL above 1.789 + __ movptr(rdx, Address(r15_thread, JavaThread::exception_pc_offset())); 1.790 + __ movptr(Address(r15_thread, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD); 1.791 + __ movptr(Address(r15_thread, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); 1.792 + 1.793 + __ verify_oop(rax); 1.794 + 1.795 + // Overwrite the result registers with the exception results. 1.796 + __ movptr(Address(rsp, RegisterSaver::rax_offset_in_bytes()), rax); 1.797 + // I think this is useless 1.798 + __ movptr(Address(rsp, RegisterSaver::rdx_offset_in_bytes()), rdx); 1.799 + 1.800 + __ bind(noException); 1.801 1.802 // Only register save data is on the stack. 1.803 // Now restore the result registers. Everything else is either dead 1.804 @@ -2640,7 +2716,7 @@ 1.805 1.806 // Pop deoptimized frame 1.807 __ movl(rcx, Address(rdi, Deoptimization::UnrollBlock::size_of_deoptimized_frame_offset_in_bytes())); 1.808 - __ addq(rsp, rcx); 1.809 + __ addptr(rsp, rcx); 1.810 1.811 // rsp should be pointing at the return address to the caller (3) 1.812 1.813 @@ -2651,19 +2727,19 @@ 1.814 } 1.815 1.816 // Load address of array of frame pcs into rcx 1.817 - __ movq(rcx, Address(rdi, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes())); 1.818 + __ movptr(rcx, Address(rdi, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes())); 1.819 1.820 // Trash the old pc 1.821 - __ addq(rsp, wordSize); 1.822 + __ addptr(rsp, wordSize); 1.823 1.824 // Load address of array of frame sizes into rsi 1.825 - __ movq(rsi, Address(rdi, Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes())); 1.826 + __ movptr(rsi, Address(rdi, Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes())); 1.827 1.828 // Load counter into rdx 1.829 __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes())); 1.830 1.831 // Pick up the initial fp we should save 1.832 - __ movq(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_fp_offset_in_bytes())); 1.833 + __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_fp_offset_in_bytes())); 1.834 1.835 // Now adjust the caller's stack to make up for the extra locals 1.836 // but record the original sp so that we can save it in the skeletal interpreter 1.837 @@ -2672,41 +2748,56 @@ 1.838 1.839 const Register sender_sp = r8; 1.840 1.841 - __ movq(sender_sp, rsp); 1.842 + __ mov(sender_sp, rsp); 1.843 __ movl(rbx, Address(rdi, 1.844 Deoptimization::UnrollBlock:: 1.845 caller_adjustment_offset_in_bytes())); 1.846 - __ subq(rsp, rbx); 1.847 + __ subptr(rsp, rbx); 1.848 1.849 // Push interpreter frames in a loop 1.850 Label loop; 1.851 __ bind(loop); 1.852 - __ movq(rbx, Address(rsi, 0)); // Load frame size 1.853 - __ subq(rbx, 2*wordSize); // We'll push pc and ebp by hand 1.854 - __ pushq(Address(rcx, 0)); // Save return address 1.855 + __ movptr(rbx, Address(rsi, 0)); // Load frame size 1.856 +#ifdef CC_INTERP 1.857 + __ subptr(rbx, 4*wordSize); // we'll push pc and ebp by hand and 1.858 +#ifdef ASSERT 1.859 + __ push(0xDEADDEAD); // Make a recognizable pattern 1.860 + __ push(0xDEADDEAD); 1.861 +#else /* ASSERT */ 1.862 + __ subptr(rsp, 2*wordSize); // skip the "static long no_param" 1.863 +#endif /* ASSERT */ 1.864 +#else 1.865 + __ subptr(rbx, 2*wordSize); // We'll push pc and ebp by hand 1.866 +#endif // CC_INTERP 1.867 + __ pushptr(Address(rcx, 0)); // Save return address 1.868 __ enter(); // Save old & set new ebp 1.869 - __ subq(rsp, rbx); // Prolog 1.870 - __ movq(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize), 1.871 - sender_sp); // Make it walkable 1.872 + __ subptr(rsp, rbx); // Prolog 1.873 +#ifdef CC_INTERP 1.874 + __ movptr(Address(rbp, 1.875 + -(sizeof(BytecodeInterpreter)) + in_bytes(byte_offset_of(BytecodeInterpreter, _sender_sp))), 1.876 + sender_sp); // Make it walkable 1.877 +#else /* CC_INTERP */ 1.878 // This value is corrected by layout_activation_impl 1.879 - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int)NULL_WORD ); 1.880 - __ movq(sender_sp, rsp); // Pass sender_sp to next frame 1.881 - __ addq(rsi, wordSize); // Bump array pointer (sizes) 1.882 - __ addq(rcx, wordSize); // Bump array pointer (pcs) 1.883 + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD ); 1.884 + __ movptr(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize), sender_sp); // Make it walkable 1.885 +#endif /* CC_INTERP */ 1.886 + __ mov(sender_sp, rsp); // Pass sender_sp to next frame 1.887 + __ addptr(rsi, wordSize); // Bump array pointer (sizes) 1.888 + __ addptr(rcx, wordSize); // Bump array pointer (pcs) 1.889 __ decrementl(rdx); // Decrement counter 1.890 __ jcc(Assembler::notZero, loop); 1.891 - __ pushq(Address(rcx, 0)); // Save final return address 1.892 + __ pushptr(Address(rcx, 0)); // Save final return address 1.893 1.894 // Re-push self-frame 1.895 __ enter(); // Save old & set new ebp 1.896 1.897 // Allocate a full sized register save area. 1.898 // Return address and rbp are in place, so we allocate two less words. 1.899 - __ subq(rsp, (frame_size_in_words - 2) * wordSize); 1.900 + __ subptr(rsp, (frame_size_in_words - 2) * wordSize); 1.901 1.902 // Restore frame locals after moving the frame 1.903 __ movdbl(Address(rsp, RegisterSaver::xmm0_offset_in_bytes()), xmm0); 1.904 - __ movq(Address(rsp, RegisterSaver::rax_offset_in_bytes()), rax); 1.905 + __ movptr(Address(rsp, RegisterSaver::rax_offset_in_bytes()), rax); 1.906 1.907 // Call C code. Need thread but NOT official VM entry 1.908 // crud. We cannot block on this call, no GC can happen. Call should 1.909 @@ -2717,7 +2808,7 @@ 1.910 // Use rbp because the frames look interpreted now 1.911 __ set_last_Java_frame(noreg, rbp, NULL); 1.912 1.913 - __ movq(c_rarg0, r15_thread); 1.914 + __ mov(c_rarg0, r15_thread); 1.915 __ movl(c_rarg1, r14); // second arg: exec_mode 1.916 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames))); 1.917 1.918 @@ -2729,7 +2820,9 @@ 1.919 1.920 // Collect return values 1.921 __ movdbl(xmm0, Address(rsp, RegisterSaver::xmm0_offset_in_bytes())); 1.922 - __ movq(rax, Address(rsp, RegisterSaver::rax_offset_in_bytes())); 1.923 + __ movptr(rax, Address(rsp, RegisterSaver::rax_offset_in_bytes())); 1.924 + // I think this is useless (throwing pc?) 1.925 + __ movptr(rdx, Address(rsp, RegisterSaver::rdx_offset_in_bytes())); 1.926 1.927 // Pop self-frame. 1.928 __ leave(); // Epilog 1.929 @@ -2740,7 +2833,8 @@ 1.930 // Make sure all code is generated 1.931 masm->flush(); 1.932 1.933 - _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, 0, frame_size_in_words); 1.934 + _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_in_words); 1.935 + _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset); 1.936 } 1.937 1.938 #ifdef COMPILER2 1.939 @@ -2758,10 +2852,10 @@ 1.940 1.941 // Push self-frame. We get here with a return address on the 1.942 // stack, so rsp is 8-byte aligned until we allocate our frame. 1.943 - __ subq(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Epilog! 1.944 + __ subptr(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Epilog! 1.945 1.946 // No callee saved registers. rbp is assumed implicitly saved 1.947 - __ movq(Address(rsp, SimpleRuntimeFrame::rbp_off << LogBytesPerInt), rbp); 1.948 + __ movptr(Address(rsp, SimpleRuntimeFrame::rbp_off << LogBytesPerInt), rbp); 1.949 1.950 // compiler left unloaded_class_index in j_rarg0 move to where the 1.951 // runtime expects it. 1.952 @@ -2776,7 +2870,7 @@ 1.953 // 1.954 // UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index); 1.955 1.956 - __ movq(c_rarg0, r15_thread); 1.957 + __ mov(c_rarg0, r15_thread); 1.958 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap))); 1.959 1.960 // Set an oopmap for the call site 1.961 @@ -2790,7 +2884,7 @@ 1.962 __ reset_last_Java_frame(false, false); 1.963 1.964 // Load UnrollBlock* into rdi 1.965 - __ movq(rdi, rax); 1.966 + __ mov(rdi, rax); 1.967 1.968 // Pop all the frames we must move/replace. 1.969 // 1.970 @@ -2800,13 +2894,13 @@ 1.971 // 3: caller of deopting frame (could be compiled/interpreted). 1.972 1.973 // Pop self-frame. We have no frame, and must rely only on rax and rsp. 1.974 - __ addq(rsp, (SimpleRuntimeFrame::framesize - 2) << LogBytesPerInt); // Epilog! 1.975 + __ addptr(rsp, (SimpleRuntimeFrame::framesize - 2) << LogBytesPerInt); // Epilog! 1.976 1.977 // Pop deoptimized frame (int) 1.978 __ movl(rcx, Address(rdi, 1.979 Deoptimization::UnrollBlock:: 1.980 size_of_deoptimized_frame_offset_in_bytes())); 1.981 - __ addq(rsp, rcx); 1.982 + __ addptr(rsp, rcx); 1.983 1.984 // rsp should be pointing at the return address to the caller (3) 1.985 1.986 @@ -2817,17 +2911,17 @@ 1.987 } 1.988 1.989 // Load address of array of frame pcs into rcx (address*) 1.990 - __ movq(rcx, 1.991 - Address(rdi, 1.992 - Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes())); 1.993 + __ movptr(rcx, 1.994 + Address(rdi, 1.995 + Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes())); 1.996 1.997 // Trash the return pc 1.998 - __ addq(rsp, wordSize); 1.999 + __ addptr(rsp, wordSize); 1.1000 1.1001 // Load address of array of frame sizes into rsi (intptr_t*) 1.1002 - __ movq(rsi, Address(rdi, 1.1003 - Deoptimization::UnrollBlock:: 1.1004 - frame_sizes_offset_in_bytes())); 1.1005 + __ movptr(rsi, Address(rdi, 1.1006 + Deoptimization::UnrollBlock:: 1.1007 + frame_sizes_offset_in_bytes())); 1.1008 1.1009 // Counter 1.1010 __ movl(rdx, Address(rdi, 1.1011 @@ -2835,9 +2929,9 @@ 1.1012 number_of_frames_offset_in_bytes())); // (int) 1.1013 1.1014 // Pick up the initial fp we should save 1.1015 - __ movq(rbp, 1.1016 - Address(rdi, 1.1017 - Deoptimization::UnrollBlock::initial_fp_offset_in_bytes())); 1.1018 + __ movptr(rbp, 1.1019 + Address(rdi, 1.1020 + Deoptimization::UnrollBlock::initial_fp_offset_in_bytes())); 1.1021 1.1022 // Now adjust the caller's stack to make up for the extra locals but 1.1023 // record the original sp so that we can save it in the skeletal 1.1024 @@ -2846,34 +2940,34 @@ 1.1025 1.1026 const Register sender_sp = r8; 1.1027 1.1028 - __ movq(sender_sp, rsp); 1.1029 + __ mov(sender_sp, rsp); 1.1030 __ movl(rbx, Address(rdi, 1.1031 Deoptimization::UnrollBlock:: 1.1032 caller_adjustment_offset_in_bytes())); // (int) 1.1033 - __ subq(rsp, rbx); 1.1034 + __ subptr(rsp, rbx); 1.1035 1.1036 // Push interpreter frames in a loop 1.1037 Label loop; 1.1038 __ bind(loop); 1.1039 - __ movq(rbx, Address(rsi, 0)); // Load frame size 1.1040 - __ subq(rbx, 2 * wordSize); // We'll push pc and rbp by hand 1.1041 - __ pushq(Address(rcx, 0)); // Save return address 1.1042 - __ enter(); // Save old & set new rbp 1.1043 - __ subq(rsp, rbx); // Prolog 1.1044 - __ movq(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize), 1.1045 - sender_sp); // Make it walkable 1.1046 + __ movptr(rbx, Address(rsi, 0)); // Load frame size 1.1047 + __ subptr(rbx, 2 * wordSize); // We'll push pc and rbp by hand 1.1048 + __ pushptr(Address(rcx, 0)); // Save return address 1.1049 + __ enter(); // Save old & set new rbp 1.1050 + __ subptr(rsp, rbx); // Prolog 1.1051 + __ movptr(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize), 1.1052 + sender_sp); // Make it walkable 1.1053 // This value is corrected by layout_activation_impl 1.1054 - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int)NULL_WORD ); 1.1055 - __ movq(sender_sp, rsp); // Pass sender_sp to next frame 1.1056 - __ addq(rsi, wordSize); // Bump array pointer (sizes) 1.1057 - __ addq(rcx, wordSize); // Bump array pointer (pcs) 1.1058 - __ decrementl(rdx); // Decrement counter 1.1059 + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD ); 1.1060 + __ mov(sender_sp, rsp); // Pass sender_sp to next frame 1.1061 + __ addptr(rsi, wordSize); // Bump array pointer (sizes) 1.1062 + __ addptr(rcx, wordSize); // Bump array pointer (pcs) 1.1063 + __ decrementl(rdx); // Decrement counter 1.1064 __ jcc(Assembler::notZero, loop); 1.1065 - __ pushq(Address(rcx, 0)); // Save final return address 1.1066 + __ pushptr(Address(rcx, 0)); // Save final return address 1.1067 1.1068 // Re-push self-frame 1.1069 __ enter(); // Save old & set new rbp 1.1070 - __ subq(rsp, (SimpleRuntimeFrame::framesize - 4) << LogBytesPerInt); 1.1071 + __ subptr(rsp, (SimpleRuntimeFrame::framesize - 4) << LogBytesPerInt); 1.1072 // Prolog 1.1073 1.1074 // Use rbp because the frames look interpreted now 1.1075 @@ -2886,7 +2980,7 @@ 1.1076 // 1.1077 // BasicType unpack_frames(JavaThread* thread, int exec_mode); 1.1078 1.1079 - __ movq(c_rarg0, r15_thread); 1.1080 + __ mov(c_rarg0, r15_thread); 1.1081 __ movl(c_rarg1, Deoptimization::Unpack_uncommon_trap); 1.1082 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames))); 1.1083 1.1084 @@ -2933,7 +3027,7 @@ 1.1085 1.1086 // Make room for return address (or push it again) 1.1087 if (!cause_return) { 1.1088 - __ pushq(rbx); 1.1089 + __ push(rbx); 1.1090 } 1.1091 1.1092 // Save registers, fpu state, and flags 1.1093 @@ -2950,12 +3044,12 @@ 1.1094 1.1095 if (!cause_return) { 1.1096 // overwrite the dummy value we pushed on entry 1.1097 - __ movq(c_rarg0, Address(r15_thread, JavaThread::saved_exception_pc_offset())); 1.1098 - __ movq(Address(rbp, wordSize), c_rarg0); 1.1099 + __ movptr(c_rarg0, Address(r15_thread, JavaThread::saved_exception_pc_offset())); 1.1100 + __ movptr(Address(rbp, wordSize), c_rarg0); 1.1101 } 1.1102 1.1103 // Do the call 1.1104 - __ movq(c_rarg0, r15_thread); 1.1105 + __ mov(c_rarg0, r15_thread); 1.1106 __ call(RuntimeAddress(call_ptr)); 1.1107 1.1108 // Set an oopmap for the call site. This oopmap will map all 1.1109 @@ -2969,7 +3063,7 @@ 1.1110 1.1111 __ reset_last_Java_frame(false, false); 1.1112 1.1113 - __ cmpq(Address(r15_thread, Thread::pending_exception_offset()), (int)NULL_WORD); 1.1114 + __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); 1.1115 __ jcc(Assembler::equal, noException); 1.1116 1.1117 // Exception pending 1.1118 @@ -3023,7 +3117,7 @@ 1.1119 1.1120 __ set_last_Java_frame(noreg, noreg, NULL); 1.1121 1.1122 - __ movq(c_rarg0, r15_thread); 1.1123 + __ mov(c_rarg0, r15_thread); 1.1124 1.1125 __ call(RuntimeAddress(destination)); 1.1126 1.1127 @@ -3040,14 +3134,14 @@ 1.1128 __ reset_last_Java_frame(false, false); 1.1129 // check for pending exceptions 1.1130 Label pending; 1.1131 - __ cmpq(Address(r15_thread, Thread::pending_exception_offset()), (int)NULL_WORD); 1.1132 + __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); 1.1133 __ jcc(Assembler::notEqual, pending); 1.1134 1.1135 // get the returned methodOop 1.1136 - __ movq(rbx, Address(r15_thread, JavaThread::vm_result_offset())); 1.1137 - __ movq(Address(rsp, RegisterSaver::rbx_offset_in_bytes()), rbx); 1.1138 - 1.1139 - __ movq(Address(rsp, RegisterSaver::rax_offset_in_bytes()), rax); 1.1140 + __ movptr(rbx, Address(r15_thread, JavaThread::vm_result_offset())); 1.1141 + __ movptr(Address(rsp, RegisterSaver::rbx_offset_in_bytes()), rbx); 1.1142 + 1.1143 + __ movptr(Address(rsp, RegisterSaver::rax_offset_in_bytes()), rax); 1.1144 1.1145 RegisterSaver::restore_live_registers(masm); 1.1146 1.1147 @@ -3065,7 +3159,7 @@ 1.1148 1.1149 __ movptr(Address(r15_thread, JavaThread::vm_result_offset()), (int)NULL_WORD); 1.1150 1.1151 - __ movq(rax, Address(r15_thread, Thread::pending_exception_offset())); 1.1152 + __ movptr(rax, Address(r15_thread, Thread::pending_exception_offset())); 1.1153 __ jump(RuntimeAddress(StubRoutines::forward_exception_entry())); 1.1154 1.1155 // ------------- 1.1156 @@ -3154,8 +3248,8 @@ 1.1157 address start = __ pc(); 1.1158 1.1159 // Exception pc is 'return address' for stack walker 1.1160 - __ pushq(rdx); 1.1161 - __ subq(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Prolog 1.1162 + __ push(rdx); 1.1163 + __ subptr(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Prolog 1.1164 1.1165 // Save callee-saved registers. See x86_64.ad. 1.1166 1.1167 @@ -3163,14 +3257,14 @@ 1.1168 // convention will save restore it in prolog/epilog) Other than that 1.1169 // there are no callee save registers now that adapter frames are gone. 1.1170 1.1171 - __ movq(Address(rsp, SimpleRuntimeFrame::rbp_off << LogBytesPerInt), rbp); 1.1172 + __ movptr(Address(rsp, SimpleRuntimeFrame::rbp_off << LogBytesPerInt), rbp); 1.1173 1.1174 // Store exception in Thread object. We cannot pass any arguments to the 1.1175 // handle_exception call, since we do not want to make any assumption 1.1176 // about the size of the frame where the exception happened in. 1.1177 // c_rarg0 is either rdi (Linux) or rcx (Windows). 1.1178 - __ movq(Address(r15_thread, JavaThread::exception_oop_offset()),rax); 1.1179 - __ movq(Address(r15_thread, JavaThread::exception_pc_offset()), rdx); 1.1180 + __ movptr(Address(r15_thread, JavaThread::exception_oop_offset()),rax); 1.1181 + __ movptr(Address(r15_thread, JavaThread::exception_pc_offset()), rdx); 1.1182 1.1183 // This call does all the hard work. It checks if an exception handler 1.1184 // exists in the method. 1.1185 @@ -3181,7 +3275,7 @@ 1.1186 // address OptoRuntime::handle_exception_C(JavaThread* thread) 1.1187 1.1188 __ set_last_Java_frame(noreg, noreg, NULL); 1.1189 - __ movq(c_rarg0, r15_thread); 1.1190 + __ mov(c_rarg0, r15_thread); 1.1191 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C))); 1.1192 1.1193 // Set an oopmap for the call site. This oopmap will only be used if we 1.1194 @@ -3202,20 +3296,20 @@ 1.1195 // convention will save restore it in prolog/epilog) Other than that 1.1196 // there are no callee save registers no that adapter frames are gone. 1.1197 1.1198 - __ movq(rbp, Address(rsp, SimpleRuntimeFrame::rbp_off << LogBytesPerInt)); 1.1199 - 1.1200 - __ addq(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Epilog 1.1201 - __ popq(rdx); // No need for exception pc anymore 1.1202 + __ movptr(rbp, Address(rsp, SimpleRuntimeFrame::rbp_off << LogBytesPerInt)); 1.1203 + 1.1204 + __ addptr(rsp, SimpleRuntimeFrame::return_off << LogBytesPerInt); // Epilog 1.1205 + __ pop(rdx); // No need for exception pc anymore 1.1206 1.1207 // rax: exception handler 1.1208 1.1209 // We have a handler in rax (could be deopt blob). 1.1210 - __ movq(r8, rax); 1.1211 + __ mov(r8, rax); 1.1212 1.1213 // Get the exception oop 1.1214 - __ movq(rax, Address(r15_thread, JavaThread::exception_oop_offset())); 1.1215 + __ movptr(rax, Address(r15_thread, JavaThread::exception_oop_offset())); 1.1216 // Get the exception pc in case we are deoptimized 1.1217 - __ movq(rdx, Address(r15_thread, JavaThread::exception_pc_offset())); 1.1218 + __ movptr(rdx, Address(r15_thread, JavaThread::exception_pc_offset())); 1.1219 #ifdef ASSERT 1.1220 __ movptr(Address(r15_thread, JavaThread::exception_handler_pc_offset()), (int)NULL_WORD); 1.1221 __ movptr(Address(r15_thread, JavaThread::exception_pc_offset()), (int)NULL_WORD);