1.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Tue Aug 26 15:49:40 2008 -0700 1.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Wed Aug 27 00:21:55 2008 -0700 1.3 @@ -27,6 +27,8 @@ 1.4 1.5 #define __ _masm-> 1.6 1.7 +#ifndef CC_INTERP 1.8 + 1.9 const int method_offset = frame::interpreter_frame_method_offset * wordSize; 1.10 const int bci_offset = frame::interpreter_frame_bcx_offset * wordSize; 1.11 const int locals_offset = frame::interpreter_frame_locals_offset * wordSize; 1.12 @@ -39,11 +41,11 @@ 1.13 #ifdef ASSERT 1.14 { 1.15 Label L; 1.16 - __ leaq(rax, Address(rbp, 1.17 - frame::interpreter_frame_monitor_block_top_offset * 1.18 - wordSize)); 1.19 - __ cmpq(rax, rsp); // rax = maximal rsp for current rbp (stack 1.20 - // grows negative) 1.21 + __ lea(rax, Address(rbp, 1.22 + frame::interpreter_frame_monitor_block_top_offset * 1.23 + wordSize)); 1.24 + __ cmpptr(rax, rsp); // rax = maximal rsp for current rbp (stack 1.25 + // grows negative) 1.26 __ jcc(Assembler::aboveEqual, L); // check if frame is complete 1.27 __ stop ("interpreter frame not set up"); 1.28 __ bind(L); 1.29 @@ -84,7 +86,7 @@ 1.30 address entry = __ pc(); 1.31 1.32 // object is at TOS 1.33 - __ popq(c_rarg1); 1.34 + __ pop(c_rarg1); 1.35 1.36 // expression stack must be empty before entering the VM if an 1.37 // exception happened 1.38 @@ -104,7 +106,7 @@ 1.39 address entry = __ pc(); 1.40 if (pass_oop) { 1.41 // object is at TOS 1.42 - __ popq(c_rarg2); 1.43 + __ pop(c_rarg2); 1.44 } 1.45 // expression stack must be empty before entering the VM if an 1.46 // exception happened 1.47 @@ -137,7 +139,7 @@ 1.48 address TemplateInterpreterGenerator::generate_continuation_for(TosState state) { 1.49 address entry = __ pc(); 1.50 // NULL last_sp until next java call 1.51 - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); 1.52 + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); 1.53 __ dispatch_next(state); 1.54 return entry; 1.55 } 1.56 @@ -153,12 +155,13 @@ 1.57 address entry = __ pc(); 1.58 1.59 // Restore stack bottom in case i2c adjusted stack 1.60 - __ movq(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); 1.61 + __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); 1.62 // and NULL it as marker that esp is now tos until next java call 1.63 - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); 1.64 + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); 1.65 1.66 __ restore_bcp(); 1.67 __ restore_locals(); 1.68 + 1.69 __ get_cache_and_index_at_bcp(rbx, rcx, 1); 1.70 __ movl(rbx, Address(rbx, rcx, 1.71 Address::times_8, 1.72 @@ -166,7 +169,7 @@ 1.73 3 * wordSize)); 1.74 __ andl(rbx, 0xFF); 1.75 if (TaggedStackInterpreter) __ shll(rbx, 1); // 2 slots per parameter. 1.76 - __ leaq(rsp, Address(rsp, rbx, Address::times_8)); 1.77 + __ lea(rsp, Address(rsp, rbx, Address::times_8)); 1.78 __ dispatch_next(state, step); 1.79 return entry; 1.80 } 1.81 @@ -176,13 +179,13 @@ 1.82 int step) { 1.83 address entry = __ pc(); 1.84 // NULL last_sp until next java call 1.85 - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); 1.86 + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); 1.87 __ restore_bcp(); 1.88 __ restore_locals(); 1.89 // handle exceptions 1.90 { 1.91 Label L; 1.92 - __ cmpq(Address(r15_thread, Thread::pending_exception_offset()), (int) NULL); 1.93 + __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL_WORD); 1.94 __ jcc(Assembler::zero, L); 1.95 __ call_VM(noreg, 1.96 CAST_FROM_FN_PTR(address, 1.97 @@ -231,7 +234,7 @@ 1.98 case T_DOUBLE : /* nothing to do */ break; 1.99 case T_OBJECT : 1.100 // retrieve result from frame 1.101 - __ movq(rax, Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize)); 1.102 + __ movptr(rax, Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize)); 1.103 // and verify it 1.104 __ verify_oop(rax); 1.105 break; 1.106 @@ -336,7 +339,7 @@ 1.107 InterpreterRuntime::frequency_counter_overflow), 1.108 c_rarg1); 1.109 1.110 - __ movq(rbx, Address(rbp, method_offset)); // restore methodOop 1.111 + __ movptr(rbx, Address(rbp, method_offset)); // restore methodOop 1.112 // Preserve invariant that r13/r14 contain bcp/locals of sender frame 1.113 // and jump to the interpreted entry. 1.114 __ jmp(*do_continue, relocInfo::none); 1.115 @@ -385,36 +388,36 @@ 1.116 const Address stack_size(r15_thread, Thread::stack_size_offset()); 1.117 1.118 // locals + overhead, in bytes 1.119 - __ movq(rax, rdx); 1.120 - __ shll(rax, Interpreter::logStackElementSize()); // 2 slots per parameter. 1.121 - __ addq(rax, overhead_size); 1.122 + __ mov(rax, rdx); 1.123 + __ shlptr(rax, Interpreter::logStackElementSize()); // 2 slots per parameter. 1.124 + __ addptr(rax, overhead_size); 1.125 1.126 #ifdef ASSERT 1.127 Label stack_base_okay, stack_size_okay; 1.128 // verify that thread stack base is non-zero 1.129 - __ cmpq(stack_base, 0); 1.130 + __ cmpptr(stack_base, (int32_t)NULL_WORD); 1.131 __ jcc(Assembler::notEqual, stack_base_okay); 1.132 __ stop("stack base is zero"); 1.133 __ bind(stack_base_okay); 1.134 // verify that thread stack size is non-zero 1.135 - __ cmpq(stack_size, 0); 1.136 + __ cmpptr(stack_size, 0); 1.137 __ jcc(Assembler::notEqual, stack_size_okay); 1.138 __ stop("stack size is zero"); 1.139 __ bind(stack_size_okay); 1.140 #endif 1.141 1.142 // Add stack base to locals and subtract stack size 1.143 - __ addq(rax, stack_base); 1.144 - __ subq(rax, stack_size); 1.145 + __ addptr(rax, stack_base); 1.146 + __ subptr(rax, stack_size); 1.147 1.148 // add in the red and yellow zone sizes 1.149 - __ addq(rax, (StackRedPages + StackYellowPages) * page_size); 1.150 + __ addptr(rax, (StackRedPages + StackYellowPages) * page_size); 1.151 1.152 // check against the current stack bottom 1.153 - __ cmpq(rsp, rax); 1.154 + __ cmpptr(rsp, rax); 1.155 __ jcc(Assembler::above, after_frame_check); 1.156 1.157 - __ popq(rax); // get return address 1.158 + __ pop(rax); // get return address 1.159 __ jump(ExternalAddress(Interpreter::throw_StackOverflowError_entry())); 1.160 1.161 // all done with frame size check 1.162 @@ -458,17 +461,17 @@ 1.163 __ movl(rax, access_flags); 1.164 __ testl(rax, JVM_ACC_STATIC); 1.165 // get receiver (assume this is frequent case) 1.166 - __ movq(rax, Address(r14, Interpreter::local_offset_in_bytes(0))); 1.167 + __ movptr(rax, Address(r14, Interpreter::local_offset_in_bytes(0))); 1.168 __ jcc(Assembler::zero, done); 1.169 - __ movq(rax, Address(rbx, methodOopDesc::constants_offset())); 1.170 - __ movq(rax, Address(rax, 1.171 - constantPoolOopDesc::pool_holder_offset_in_bytes())); 1.172 - __ movq(rax, Address(rax, mirror_offset)); 1.173 + __ movptr(rax, Address(rbx, methodOopDesc::constants_offset())); 1.174 + __ movptr(rax, Address(rax, 1.175 + constantPoolOopDesc::pool_holder_offset_in_bytes())); 1.176 + __ movptr(rax, Address(rax, mirror_offset)); 1.177 1.178 #ifdef ASSERT 1.179 { 1.180 Label L; 1.181 - __ testq(rax, rax); 1.182 + __ testptr(rax, rax); 1.183 __ jcc(Assembler::notZero, L); 1.184 __ stop("synchronization object is NULL"); 1.185 __ bind(L); 1.186 @@ -479,11 +482,11 @@ 1.187 } 1.188 1.189 // add space for monitor & lock 1.190 - __ subq(rsp, entry_size); // add space for a monitor entry 1.191 - __ movq(monitor_block_top, rsp); // set new monitor block top 1.192 + __ subptr(rsp, entry_size); // add space for a monitor entry 1.193 + __ movptr(monitor_block_top, rsp); // set new monitor block top 1.194 // store object 1.195 - __ movq(Address(rsp, BasicObjectLock::obj_offset_in_bytes()), rax); 1.196 - __ movq(c_rarg1, rsp); // object address 1.197 + __ movptr(Address(rsp, BasicObjectLock::obj_offset_in_bytes()), rax); 1.198 + __ movptr(c_rarg1, rsp); // object address 1.199 __ lock_object(c_rarg1); 1.200 } 1.201 1.202 @@ -498,40 +501,187 @@ 1.203 // rdx: cp cache 1.204 void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { 1.205 // initialize fixed part of activation frame 1.206 - __ pushq(rax); // save return address 1.207 + __ push(rax); // save return address 1.208 __ enter(); // save old & set new rbp 1.209 - __ pushq(r13); // set sender sp 1.210 - __ pushq((int)NULL_WORD); // leave last_sp as null 1.211 - __ movq(r13, Address(rbx, methodOopDesc::const_offset())); // get constMethodOop 1.212 - __ leaq(r13, Address(r13, constMethodOopDesc::codes_offset())); // get codebase 1.213 - __ pushq(rbx); // save methodOop 1.214 + __ push(r13); // set sender sp 1.215 + __ push((int)NULL_WORD); // leave last_sp as null 1.216 + __ movptr(r13, Address(rbx, methodOopDesc::const_offset())); // get constMethodOop 1.217 + __ lea(r13, Address(r13, constMethodOopDesc::codes_offset())); // get codebase 1.218 + __ push(rbx); // save methodOop 1.219 if (ProfileInterpreter) { 1.220 Label method_data_continue; 1.221 - __ movq(rdx, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); 1.222 - __ testq(rdx, rdx); 1.223 + __ movptr(rdx, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); 1.224 + __ testptr(rdx, rdx); 1.225 __ jcc(Assembler::zero, method_data_continue); 1.226 - __ addq(rdx, in_bytes(methodDataOopDesc::data_offset())); 1.227 + __ addptr(rdx, in_bytes(methodDataOopDesc::data_offset())); 1.228 __ bind(method_data_continue); 1.229 - __ pushq(rdx); // set the mdp (method data pointer) 1.230 + __ push(rdx); // set the mdp (method data pointer) 1.231 } else { 1.232 - __ pushq(0); 1.233 + __ push(0); 1.234 } 1.235 1.236 - __ movq(rdx, Address(rbx, methodOopDesc::constants_offset())); 1.237 - __ movq(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes())); 1.238 - __ pushq(rdx); // set constant pool cache 1.239 - __ pushq(r14); // set locals pointer 1.240 + __ movptr(rdx, Address(rbx, methodOopDesc::constants_offset())); 1.241 + __ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes())); 1.242 + __ push(rdx); // set constant pool cache 1.243 + __ push(r14); // set locals pointer 1.244 if (native_call) { 1.245 - __ pushq(0); // no bcp 1.246 + __ push(0); // no bcp 1.247 } else { 1.248 - __ pushq(r13); // set bcp 1.249 + __ push(r13); // set bcp 1.250 } 1.251 - __ pushq(0); // reserve word for pointer to expression stack bottom 1.252 - __ movq(Address(rsp, 0), rsp); // set expression stack bottom 1.253 + __ push(0); // reserve word for pointer to expression stack bottom 1.254 + __ movptr(Address(rsp, 0), rsp); // set expression stack bottom 1.255 } 1.256 1.257 // End of helpers 1.258 1.259 +// Various method entries 1.260 +//------------------------------------------------------------------------------------------------------------------------ 1.261 +// 1.262 +// 1.263 + 1.264 +// Call an accessor method (assuming it is resolved, otherwise drop 1.265 +// into vanilla (slow path) entry 1.266 +address InterpreterGenerator::generate_accessor_entry(void) { 1.267 + // rbx: methodOop 1.268 + 1.269 + // r13: senderSP must preserver for slow path, set SP to it on fast path 1.270 + 1.271 + address entry_point = __ pc(); 1.272 + Label xreturn_path; 1.273 + 1.274 + // do fastpath for resolved accessor methods 1.275 + if (UseFastAccessorMethods) { 1.276 + // Code: _aload_0, _(i|a)getfield, _(i|a)return or any rewrites 1.277 + // thereof; parameter size = 1 1.278 + // Note: We can only use this code if the getfield has been resolved 1.279 + // and if we don't have a null-pointer exception => check for 1.280 + // these conditions first and use slow path if necessary. 1.281 + Label slow_path; 1.282 + // If we need a safepoint check, generate full interpreter entry. 1.283 + __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), 1.284 + SafepointSynchronize::_not_synchronized); 1.285 + 1.286 + __ jcc(Assembler::notEqual, slow_path); 1.287 + // rbx: method 1.288 + __ movptr(rax, Address(rsp, wordSize)); 1.289 + 1.290 + // check if local 0 != NULL and read field 1.291 + __ testptr(rax, rax); 1.292 + __ jcc(Assembler::zero, slow_path); 1.293 + 1.294 + __ movptr(rdi, Address(rbx, methodOopDesc::constants_offset())); 1.295 + // read first instruction word and extract bytecode @ 1 and index @ 2 1.296 + __ movptr(rdx, Address(rbx, methodOopDesc::const_offset())); 1.297 + __ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset())); 1.298 + // Shift codes right to get the index on the right. 1.299 + // The bytecode fetched looks like <index><0xb4><0x2a> 1.300 + __ shrl(rdx, 2 * BitsPerByte); 1.301 + __ shll(rdx, exact_log2(in_words(ConstantPoolCacheEntry::size()))); 1.302 + __ movptr(rdi, Address(rdi, constantPoolOopDesc::cache_offset_in_bytes())); 1.303 + 1.304 + // rax: local 0 1.305 + // rbx: method 1.306 + // rdx: constant pool cache index 1.307 + // rdi: constant pool cache 1.308 + 1.309 + // check if getfield has been resolved and read constant pool cache entry 1.310 + // check the validity of the cache entry by testing whether _indices field 1.311 + // contains Bytecode::_getfield in b1 byte. 1.312 + assert(in_words(ConstantPoolCacheEntry::size()) == 4, 1.313 + "adjust shift below"); 1.314 + __ movl(rcx, 1.315 + Address(rdi, 1.316 + rdx, 1.317 + Address::times_8, 1.318 + constantPoolCacheOopDesc::base_offset() + 1.319 + ConstantPoolCacheEntry::indices_offset())); 1.320 + __ shrl(rcx, 2 * BitsPerByte); 1.321 + __ andl(rcx, 0xFF); 1.322 + __ cmpl(rcx, Bytecodes::_getfield); 1.323 + __ jcc(Assembler::notEqual, slow_path); 1.324 + 1.325 + // Note: constant pool entry is not valid before bytecode is resolved 1.326 + __ movptr(rcx, 1.327 + Address(rdi, 1.328 + rdx, 1.329 + Address::times_8, 1.330 + constantPoolCacheOopDesc::base_offset() + 1.331 + ConstantPoolCacheEntry::f2_offset())); 1.332 + // edx: flags 1.333 + __ movl(rdx, 1.334 + Address(rdi, 1.335 + rdx, 1.336 + Address::times_8, 1.337 + constantPoolCacheOopDesc::base_offset() + 1.338 + ConstantPoolCacheEntry::flags_offset())); 1.339 + 1.340 + Label notObj, notInt, notByte, notShort; 1.341 + const Address field_address(rax, rcx, Address::times_1); 1.342 + 1.343 + // Need to differentiate between igetfield, agetfield, bgetfield etc. 1.344 + // because they are different sizes. 1.345 + // Use the type from the constant pool cache 1.346 + __ shrl(rdx, ConstantPoolCacheEntry::tosBits); 1.347 + // Make sure we don't need to mask edx for tosBits after the above shift 1.348 + ConstantPoolCacheEntry::verify_tosBits(); 1.349 + 1.350 + __ cmpl(rdx, atos); 1.351 + __ jcc(Assembler::notEqual, notObj); 1.352 + // atos 1.353 + __ load_heap_oop(rax, field_address); 1.354 + __ jmp(xreturn_path); 1.355 + 1.356 + __ bind(notObj); 1.357 + __ cmpl(rdx, itos); 1.358 + __ jcc(Assembler::notEqual, notInt); 1.359 + // itos 1.360 + __ movl(rax, field_address); 1.361 + __ jmp(xreturn_path); 1.362 + 1.363 + __ bind(notInt); 1.364 + __ cmpl(rdx, btos); 1.365 + __ jcc(Assembler::notEqual, notByte); 1.366 + // btos 1.367 + __ load_signed_byte(rax, field_address); 1.368 + __ jmp(xreturn_path); 1.369 + 1.370 + __ bind(notByte); 1.371 + __ cmpl(rdx, stos); 1.372 + __ jcc(Assembler::notEqual, notShort); 1.373 + // stos 1.374 + __ load_signed_word(rax, field_address); 1.375 + __ jmp(xreturn_path); 1.376 + 1.377 + __ bind(notShort); 1.378 +#ifdef ASSERT 1.379 + Label okay; 1.380 + __ cmpl(rdx, ctos); 1.381 + __ jcc(Assembler::equal, okay); 1.382 + __ stop("what type is this?"); 1.383 + __ bind(okay); 1.384 +#endif 1.385 + // ctos 1.386 + __ load_unsigned_word(rax, field_address); 1.387 + 1.388 + __ bind(xreturn_path); 1.389 + 1.390 + // _ireturn/_areturn 1.391 + __ pop(rdi); 1.392 + __ mov(rsp, r13); 1.393 + __ jmp(rdi); 1.394 + __ ret(0); 1.395 + 1.396 + // generate a vanilla interpreter entry as the slow path 1.397 + __ bind(slow_path); 1.398 + (void) generate_normal_entry(false); 1.399 + } else { 1.400 + (void) generate_normal_entry(false); 1.401 + } 1.402 + 1.403 + return entry_point; 1.404 +} 1.405 + 1.406 // Interpreter stub for calling a native method. (asm interpreter) 1.407 // This sets up a somewhat different looking stack for calling the 1.408 // native method than the typical interpreter frame setup. 1.409 @@ -561,20 +711,20 @@ 1.410 // rbx: methodOop 1.411 // rcx: size of parameters 1.412 // r13: sender sp 1.413 - __ popq(rax); // get return address 1.414 + __ pop(rax); // get return address 1.415 1.416 // for natives the size of locals is zero 1.417 1.418 // compute beginning of parameters (r14) 1.419 if (TaggedStackInterpreter) __ shll(rcx, 1); // 2 slots per parameter. 1.420 - __ leaq(r14, Address(rsp, rcx, Address::times_8, -wordSize)); 1.421 + __ lea(r14, Address(rsp, rcx, Address::times_8, -wordSize)); 1.422 1.423 // add 2 zero-initialized slots for native calls 1.424 // initialize result_handler slot 1.425 - __ pushq((int) NULL); 1.426 + __ push((int) NULL_WORD); 1.427 // slot for oop temp 1.428 // (static native method holder mirror/jni oop result) 1.429 - __ pushq((int) NULL); 1.430 + __ push((int) NULL_WORD); 1.431 1.432 if (inc_counter) { 1.433 __ movl(rcx, invocation_counter); // (pre-)fetch invocation count 1.434 @@ -651,8 +801,8 @@ 1.435 Label L; 1.436 const Address monitor_block_top(rbp, 1.437 frame::interpreter_frame_monitor_block_top_offset * wordSize); 1.438 - __ movq(rax, monitor_block_top); 1.439 - __ cmpq(rax, rsp); 1.440 + __ movptr(rax, monitor_block_top); 1.441 + __ cmpptr(rax, rsp); 1.442 __ jcc(Assembler::equal, L); 1.443 __ stop("broken stack frame setup in interpreter"); 1.444 __ bind(L); 1.445 @@ -674,22 +824,22 @@ 1.446 methodOopDesc::size_of_parameters_offset())); 1.447 __ shll(t, Interpreter::logStackElementSize()); 1.448 1.449 - __ subq(rsp, t); 1.450 - __ subq(rsp, frame::arg_reg_save_area_bytes); // windows 1.451 - __ andq(rsp, -16); // must be 16 byte boundry (see amd64 ABI) 1.452 + __ subptr(rsp, t); 1.453 + __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows 1.454 + __ andptr(rsp, -16); // must be 16 byte boundry (see amd64 ABI) 1.455 1.456 // get signature handler 1.457 { 1.458 Label L; 1.459 - __ movq(t, Address(method, methodOopDesc::signature_handler_offset())); 1.460 - __ testq(t, t); 1.461 + __ movptr(t, Address(method, methodOopDesc::signature_handler_offset())); 1.462 + __ testptr(t, t); 1.463 __ jcc(Assembler::notZero, L); 1.464 __ call_VM(noreg, 1.465 CAST_FROM_FN_PTR(address, 1.466 InterpreterRuntime::prepare_native_call), 1.467 method); 1.468 __ get_method(method); 1.469 - __ movq(t, Address(method, methodOopDesc::signature_handler_offset())); 1.470 + __ movptr(t, Address(method, methodOopDesc::signature_handler_offset())); 1.471 __ bind(L); 1.472 } 1.473 1.474 @@ -711,9 +861,9 @@ 1.475 1.476 // result handler is in rax 1.477 // set result handler 1.478 - __ movq(Address(rbp, 1.479 - (frame::interpreter_frame_result_handler_offset) * wordSize), 1.480 - rax); 1.481 + __ movptr(Address(rbp, 1.482 + (frame::interpreter_frame_result_handler_offset) * wordSize), 1.483 + rax); 1.484 1.485 // pass mirror handle if static call 1.486 { 1.487 @@ -724,25 +874,25 @@ 1.488 __ testl(t, JVM_ACC_STATIC); 1.489 __ jcc(Assembler::zero, L); 1.490 // get mirror 1.491 - __ movq(t, Address(method, methodOopDesc::constants_offset())); 1.492 - __ movq(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes())); 1.493 - __ movq(t, Address(t, mirror_offset)); 1.494 + __ movptr(t, Address(method, methodOopDesc::constants_offset())); 1.495 + __ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes())); 1.496 + __ movptr(t, Address(t, mirror_offset)); 1.497 // copy mirror into activation frame 1.498 - __ movq(Address(rbp, frame::interpreter_frame_oop_temp_offset * wordSize), 1.499 + __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset * wordSize), 1.500 t); 1.501 // pass handle to mirror 1.502 - __ leaq(c_rarg1, 1.503 - Address(rbp, frame::interpreter_frame_oop_temp_offset * wordSize)); 1.504 + __ lea(c_rarg1, 1.505 + Address(rbp, frame::interpreter_frame_oop_temp_offset * wordSize)); 1.506 __ bind(L); 1.507 } 1.508 1.509 // get native function entry point 1.510 { 1.511 Label L; 1.512 - __ movq(rax, Address(method, methodOopDesc::native_function_offset())); 1.513 + __ movptr(rax, Address(method, methodOopDesc::native_function_offset())); 1.514 ExternalAddress unsatisfied(SharedRuntime::native_method_throw_unsatisfied_link_error_entry()); 1.515 __ movptr(rscratch2, unsatisfied.addr()); 1.516 - __ cmpq(rax, rscratch2); 1.517 + __ cmpptr(rax, rscratch2); 1.518 __ jcc(Assembler::notEqual, L); 1.519 __ call_VM(noreg, 1.520 CAST_FROM_FN_PTR(address, 1.521 @@ -750,12 +900,12 @@ 1.522 method); 1.523 __ get_method(method); 1.524 __ verify_oop(method); 1.525 - __ movq(rax, Address(method, methodOopDesc::native_function_offset())); 1.526 + __ movptr(rax, Address(method, methodOopDesc::native_function_offset())); 1.527 __ bind(L); 1.528 } 1.529 1.530 // pass JNIEnv 1.531 - __ leaq(c_rarg0, Address(r15_thread, JavaThread::jni_environment_offset())); 1.532 + __ lea(c_rarg0, Address(r15_thread, JavaThread::jni_environment_offset())); 1.533 1.534 // It is enough that the pc() points into the right code 1.535 // segment. It does not have to be the correct return pc. 1.536 @@ -786,10 +936,10 @@ 1.537 // register after returning from the JNI Call or verify that 1.538 // it wasn't changed during -Xcheck:jni. 1.539 if (RestoreMXCSROnJNICalls) { 1.540 - __ ldmxcsr(ExternalAddress(StubRoutines::amd64::mxcsr_std())); 1.541 + __ ldmxcsr(ExternalAddress(StubRoutines::x86::mxcsr_std())); 1.542 } 1.543 else if (CheckJNICalls) { 1.544 - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::amd64::verify_mxcsr_entry()))); 1.545 + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::x86::verify_mxcsr_entry()))); 1.546 } 1.547 1.548 // NOTE: The order of these pushes is known to frame::interpreter_frame_result 1.549 @@ -838,12 +988,12 @@ 1.550 // preserved and correspond to the bcp/locals pointers. So we do a 1.551 // runtime call by hand. 1.552 // 1.553 - __ movq(c_rarg0, r15_thread); 1.554 - __ movq(r12, rsp); // remember sp 1.555 - __ subq(rsp, frame::arg_reg_save_area_bytes); // windows 1.556 - __ andq(rsp, -16); // align stack as required by ABI 1.557 + __ mov(c_rarg0, r15_thread); 1.558 + __ mov(r12, rsp); // remember sp 1.559 + __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows 1.560 + __ andptr(rsp, -16); // align stack as required by ABI 1.561 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans))); 1.562 - __ movq(rsp, r12); // restore sp 1.563 + __ mov(rsp, r12); // restore sp 1.564 __ reinit_heapbase(); 1.565 __ bind(Continue); 1.566 } 1.567 @@ -855,8 +1005,8 @@ 1.568 __ reset_last_Java_frame(true, true); 1.569 1.570 // reset handle block 1.571 - __ movq(t, Address(r15_thread, JavaThread::active_handles_offset())); 1.572 - __ movptr(Address(t, JNIHandleBlock::top_offset_in_bytes()), NULL_WORD); 1.573 + __ movptr(t, Address(r15_thread, JavaThread::active_handles_offset())); 1.574 + __ movptr(Address(t, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD); 1.575 1.576 // If result is an oop unbox and store it in frame where gc will see it 1.577 // and result handler will pick it up 1.578 @@ -864,15 +1014,15 @@ 1.579 { 1.580 Label no_oop, store_result; 1.581 __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT))); 1.582 - __ cmpq(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize)); 1.583 + __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize)); 1.584 __ jcc(Assembler::notEqual, no_oop); 1.585 // retrieve result 1.586 __ pop(ltos); 1.587 - __ testq(rax, rax); 1.588 + __ testptr(rax, rax); 1.589 __ jcc(Assembler::zero, store_result); 1.590 - __ movq(rax, Address(rax, 0)); 1.591 + __ movptr(rax, Address(rax, 0)); 1.592 __ bind(store_result); 1.593 - __ movq(Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize), rax); 1.594 + __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize), rax); 1.595 // keep stack depth as expected by pushing oop which will eventually be discarde 1.596 __ push(ltos); 1.597 __ bind(no_oop); 1.598 @@ -885,13 +1035,13 @@ 1.599 JavaThread::stack_guard_yellow_disabled); 1.600 __ jcc(Assembler::notEqual, no_reguard); 1.601 1.602 - __ pushaq(); // XXX only save smashed registers 1.603 - __ movq(r12, rsp); // remember sp 1.604 - __ subq(rsp, frame::arg_reg_save_area_bytes); // windows 1.605 - __ andq(rsp, -16); // align stack as required by ABI 1.606 + __ pusha(); // XXX only save smashed registers 1.607 + __ mov(r12, rsp); // remember sp 1.608 + __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows 1.609 + __ andptr(rsp, -16); // align stack as required by ABI 1.610 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages))); 1.611 - __ movq(rsp, r12); // restore sp 1.612 - __ popaq(); // XXX only restore smashed registers 1.613 + __ mov(rsp, r12); // restore sp 1.614 + __ popa(); // XXX only restore smashed registers 1.615 __ reinit_heapbase(); 1.616 1.617 __ bind(no_reguard); 1.618 @@ -906,12 +1056,12 @@ 1.619 1.620 // restore r13 to have legal interpreter frame, i.e., bci == 0 <=> 1.621 // r13 == code_base() 1.622 - __ movq(r13, Address(method, methodOopDesc::const_offset())); // get constMethodOop 1.623 - __ leaq(r13, Address(r13, constMethodOopDesc::codes_offset())); // get codebase 1.624 + __ movptr(r13, Address(method, methodOopDesc::const_offset())); // get constMethodOop 1.625 + __ lea(r13, Address(r13, constMethodOopDesc::codes_offset())); // get codebase 1.626 // handle exceptions (exception handling will handle unlocking!) 1.627 { 1.628 Label L; 1.629 - __ cmpq(Address(r15_thread, Thread::pending_exception_offset()), (int) NULL); 1.630 + __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL_WORD); 1.631 __ jcc(Assembler::zero, L); 1.632 // Note: At some point we may want to unify this with the code 1.633 // used in call_VM_base(); i.e., we should use the 1.634 @@ -942,10 +1092,10 @@ 1.635 wordSize - sizeof(BasicObjectLock))); 1.636 1.637 // monitor expect in c_rarg1 for slow unlock path 1.638 - __ leaq(c_rarg1, monitor); // address of first monitor 1.639 + __ lea(c_rarg1, monitor); // address of first monitor 1.640 1.641 - __ movq(t, Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes())); 1.642 - __ testq(t, t); 1.643 + __ movptr(t, Address(c_rarg1, BasicObjectLock::obj_offset_in_bytes())); 1.644 + __ testptr(t, t); 1.645 __ jcc(Assembler::notZero, unlock); 1.646 1.647 // Entry already unlocked, need to throw exception 1.648 @@ -973,17 +1123,17 @@ 1.649 __ pop(ltos); 1.650 __ pop(dtos); 1.651 1.652 - __ movq(t, Address(rbp, 1.653 - (frame::interpreter_frame_result_handler_offset) * wordSize)); 1.654 + __ movptr(t, Address(rbp, 1.655 + (frame::interpreter_frame_result_handler_offset) * wordSize)); 1.656 __ call(t); 1.657 1.658 // remove activation 1.659 - __ movq(t, Address(rbp, 1.660 - frame::interpreter_frame_sender_sp_offset * 1.661 - wordSize)); // get sender sp 1.662 + __ movptr(t, Address(rbp, 1.663 + frame::interpreter_frame_sender_sp_offset * 1.664 + wordSize)); // get sender sp 1.665 __ leave(); // remove frame anchor 1.666 - __ popq(rdi); // get return address 1.667 - __ movq(rsp, t); // set sp to sender sp 1.668 + __ pop(rdi); // get return address 1.669 + __ mov(rsp, t); // set sp to sender sp 1.670 __ jmp(rdi); 1.671 1.672 if (inc_counter) { 1.673 @@ -1032,11 +1182,11 @@ 1.674 generate_stack_overflow_check(); 1.675 1.676 // get return address 1.677 - __ popq(rax); 1.678 + __ pop(rax); 1.679 1.680 // compute beginning of parameters (r14) 1.681 if (TaggedStackInterpreter) __ shll(rcx, 1); // 2 slots per parameter. 1.682 - __ leaq(r14, Address(rsp, rcx, Address::times_8, -wordSize)); 1.683 + __ lea(r14, Address(rsp, rcx, Address::times_8, -wordSize)); 1.684 1.685 // rdx - # of additional locals 1.686 // allocate space for locals 1.687 @@ -1046,8 +1196,8 @@ 1.688 __ testl(rdx, rdx); 1.689 __ jcc(Assembler::lessEqual, exit); // do nothing if rdx <= 0 1.690 __ bind(loop); 1.691 - if (TaggedStackInterpreter) __ pushq((int) NULL); // push tag 1.692 - __ pushq((int) NULL); // initialize local variables 1.693 + if (TaggedStackInterpreter) __ push((int) NULL_WORD); // push tag 1.694 + __ push((int) NULL_WORD); // initialize local variables 1.695 __ decrementl(rdx); // until everything initialized 1.696 __ jcc(Assembler::greater, loop); 1.697 __ bind(exit); 1.698 @@ -1137,8 +1287,8 @@ 1.699 Label L; 1.700 const Address monitor_block_top (rbp, 1.701 frame::interpreter_frame_monitor_block_top_offset * wordSize); 1.702 - __ movq(rax, monitor_block_top); 1.703 - __ cmpq(rax, rsp); 1.704 + __ movptr(rax, monitor_block_top); 1.705 + __ cmpptr(rax, rsp); 1.706 __ jcc(Assembler::equal, L); 1.707 __ stop("broken stack frame setup in interpreter"); 1.708 __ bind(L); 1.709 @@ -1160,14 +1310,14 @@ 1.710 CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method), 1.711 r13, true); 1.712 1.713 - __ movq(rbx, Address(rbp, method_offset)); // restore methodOop 1.714 - __ movq(rax, Address(rbx, 1.715 - in_bytes(methodOopDesc::method_data_offset()))); 1.716 - __ movq(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), 1.717 - rax); 1.718 + __ movptr(rbx, Address(rbp, method_offset)); // restore methodOop 1.719 + __ movptr(rax, Address(rbx, 1.720 + in_bytes(methodOopDesc::method_data_offset()))); 1.721 + __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), 1.722 + rax); 1.723 __ test_method_data_pointer(rax, profile_method_continue); 1.724 - __ addq(rax, in_bytes(methodDataOopDesc::data_offset())); 1.725 - __ movq(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), 1.726 + __ addptr(rax, in_bytes(methodDataOopDesc::data_offset())); 1.727 + __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), 1.728 rax); 1.729 __ jmp(profile_method_continue); 1.730 } 1.731 @@ -1357,7 +1507,7 @@ 1.732 Interpreter::_rethrow_exception_entry = __ pc(); 1.733 // Restore sp to interpreter_frame_last_sp even though we are going 1.734 // to empty the expression stack for the exception processing. 1.735 - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); 1.736 + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); 1.737 // rax: exception 1.738 // rdx: return address/pc that threw exception 1.739 __ restore_bcp(); // r13 points to call/send 1.740 @@ -1369,7 +1519,7 @@ 1.741 // rax: exception 1.742 // r13: exception bcp 1.743 __ verify_oop(rax); 1.744 - __ movq(c_rarg1, rax); 1.745 + __ mov(c_rarg1, rax); 1.746 1.747 // expression stack must be empty before entering the VM in case of 1.748 // an exception 1.749 @@ -1424,7 +1574,7 @@ 1.750 // deoptimization blob's unpack entry because of the presence of 1.751 // adapter frames in C2. 1.752 Label caller_not_deoptimized; 1.753 - __ movq(c_rarg1, Address(rbp, frame::return_addr_offset * wordSize)); 1.754 + __ movptr(c_rarg1, Address(rbp, frame::return_addr_offset * wordSize)); 1.755 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, 1.756 InterpreterRuntime::interpreter_contains), c_rarg1); 1.757 __ testl(rax, rax); 1.758 @@ -1437,8 +1587,8 @@ 1.759 size_of_parameters_offset()))); 1.760 __ shll(rax, Interpreter::logStackElementSize()); 1.761 __ restore_locals(); // XXX do we need this? 1.762 - __ subq(r14, rax); 1.763 - __ addq(r14, wordSize); 1.764 + __ subptr(r14, rax); 1.765 + __ addptr(r14, wordSize); 1.766 // Save these arguments 1.767 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, 1.768 Deoptimization:: 1.769 @@ -1477,15 +1627,15 @@ 1.770 // maintain this kind of invariant all the time we call a small 1.771 // fixup routine to move the mutated arguments onto the top of our 1.772 // expression stack if necessary. 1.773 - __ movq(c_rarg1, rsp); 1.774 - __ movq(c_rarg2, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); 1.775 + __ mov(c_rarg1, rsp); 1.776 + __ movptr(c_rarg2, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); 1.777 // PC must point into interpreter here 1.778 __ set_last_Java_frame(noreg, rbp, __ pc()); 1.779 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::popframe_move_outgoing_args), r15_thread, c_rarg1, c_rarg2); 1.780 __ reset_last_Java_frame(true, true); 1.781 // Restore the last_sp and null it out 1.782 - __ movq(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); 1.783 - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); 1.784 + __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); 1.785 + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); 1.786 1.787 __ restore_bcp(); // XXX do we need this? 1.788 __ restore_locals(); // XXX do we need this? 1.789 @@ -1506,12 +1656,12 @@ 1.790 1.791 // preserve exception over this code sequence 1.792 __ pop_ptr(rax); 1.793 - __ movq(Address(r15_thread, JavaThread::vm_result_offset()), rax); 1.794 + __ movptr(Address(r15_thread, JavaThread::vm_result_offset()), rax); 1.795 // remove the activation (without doing throws on illegalMonitorExceptions) 1.796 __ remove_activation(vtos, rdx, false, true, false); 1.797 // restore exception 1.798 - __ movq(rax, Address(r15_thread, JavaThread::vm_result_offset())); 1.799 - __ movptr(Address(r15_thread, JavaThread::vm_result_offset()), NULL_WORD); 1.800 + __ movptr(rax, Address(r15_thread, JavaThread::vm_result_offset())); 1.801 + __ movptr(Address(r15_thread, JavaThread::vm_result_offset()), (int32_t)NULL_WORD); 1.802 __ verify_oop(rax); 1.803 1.804 // In between activations - previous activation type unknown yet 1.805 @@ -1522,14 +1672,14 @@ 1.806 // rdx: return address/pc that threw exception 1.807 // rsp: expression stack of caller 1.808 // rbp: ebp of caller 1.809 - __ pushq(rax); // save exception 1.810 - __ pushq(rdx); // save return address 1.811 + __ push(rax); // save exception 1.812 + __ push(rdx); // save return address 1.813 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, 1.814 SharedRuntime::exception_handler_for_return_address), 1.815 rdx); 1.816 - __ movq(rbx, rax); // save exception handler 1.817 - __ popq(rdx); // restore return address 1.818 - __ popq(rax); // restore exception 1.819 + __ mov(rbx, rax); // save exception handler 1.820 + __ pop(rdx); // restore return address 1.821 + __ pop(rax); // restore exception 1.822 // Note that an "issuing PC" is actually the next PC after the call 1.823 __ jmp(rbx); // jump to exception 1.824 // handler of caller 1.825 @@ -1547,7 +1697,7 @@ 1.826 __ empty_expression_stack(); 1.827 __ load_earlyret_value(state); 1.828 1.829 - __ movq(rdx, Address(r15_thread, JavaThread::jvmti_thread_state_offset())); 1.830 + __ movptr(rdx, Address(r15_thread, JavaThread::jvmti_thread_state_offset())); 1.831 Address cond_addr(rdx, JvmtiThreadState::earlyret_state_offset()); 1.832 1.833 // Clear the earlyret state 1.834 @@ -1609,21 +1759,21 @@ 1.835 address entry = __ pc(); 1.836 1.837 __ push(state); 1.838 - __ pushq(c_rarg0); 1.839 - __ pushq(c_rarg1); 1.840 - __ pushq(c_rarg2); 1.841 - __ pushq(c_rarg3); 1.842 - __ movq(c_rarg2, rax); // Pass itos 1.843 + __ push(c_rarg0); 1.844 + __ push(c_rarg1); 1.845 + __ push(c_rarg2); 1.846 + __ push(c_rarg3); 1.847 + __ mov(c_rarg2, rax); // Pass itos 1.848 #ifdef _WIN64 1.849 __ movflt(xmm3, xmm0); // Pass ftos 1.850 #endif 1.851 __ call_VM(noreg, 1.852 CAST_FROM_FN_PTR(address, SharedRuntime::trace_bytecode), 1.853 c_rarg1, c_rarg2, c_rarg3); 1.854 - __ popq(c_rarg3); 1.855 - __ popq(c_rarg2); 1.856 - __ popq(c_rarg1); 1.857 - __ popq(c_rarg0); 1.858 + __ pop(c_rarg3); 1.859 + __ pop(c_rarg2); 1.860 + __ pop(c_rarg1); 1.861 + __ pop(c_rarg0); 1.862 __ pop(state); 1.863 __ ret(0); // return from result handler 1.864 1.865 @@ -1657,10 +1807,10 @@ 1.866 1.867 assert(Interpreter::trace_code(t->tos_in()) != NULL, 1.868 "entry must have been generated"); 1.869 - __ movq(r12, rsp); // remember sp 1.870 - __ andq(rsp, -16); // align stack as required by ABI 1.871 + __ mov(r12, rsp); // remember sp 1.872 + __ andptr(rsp, -16); // align stack as required by ABI 1.873 __ call(RuntimeAddress(Interpreter::trace_code(t->tos_in()))); 1.874 - __ movq(rsp, r12); // restore sp 1.875 + __ mov(rsp, r12); // restore sp 1.876 __ reinit_heapbase(); 1.877 } 1.878 1.879 @@ -1674,3 +1824,4 @@ 1.880 __ bind(L); 1.881 } 1.882 #endif // !PRODUCT 1.883 +#endif // ! CC_INTERP