src/cpu/x86/vm/x86_32.ad

changeset 739
dc7f315e41f7
parent 670
9c2ecc2ffb12
child 838
b744678d4d71
     1.1 --- a/src/cpu/x86/vm/x86_32.ad	Tue Aug 26 15:49:40 2008 -0700
     1.2 +++ b/src/cpu/x86/vm/x86_32.ad	Wed Aug 27 00:21:55 2008 -0700
     1.3 @@ -236,7 +236,7 @@
     1.4  // This is a block of C++ code which provides values, functions, and
     1.5  // definitions necessary in the rest of the architecture description
     1.6  source %{
     1.7 -#define   RELOC_IMM32    Assembler::imm32_operand
     1.8 +#define   RELOC_IMM32    Assembler::imm_operand
     1.9  #define   RELOC_DISP32   Assembler::disp32_operand
    1.10  
    1.11  #define __ _masm.
    1.12 @@ -593,11 +593,11 @@
    1.13    if (VerifyStackAtCalls) {
    1.14      Label L;
    1.15      MacroAssembler masm(&cbuf);
    1.16 -    masm.pushl(rax);
    1.17 -    masm.movl(rax, rsp);
    1.18 -    masm.andl(rax, StackAlignmentInBytes-1);
    1.19 -    masm.cmpl(rax, StackAlignmentInBytes-wordSize);
    1.20 -    masm.popl(rax);
    1.21 +    masm.push(rax);
    1.22 +    masm.mov(rax, rsp);
    1.23 +    masm.andptr(rax, StackAlignmentInBytes-1);
    1.24 +    masm.cmpptr(rax, StackAlignmentInBytes-wordSize);
    1.25 +    masm.pop(rax);
    1.26      masm.jcc(Assembler::equal, L);
    1.27      masm.stop("Stack is not properly aligned!");
    1.28      masm.bind(L);
    1.29 @@ -1150,7 +1150,8 @@
    1.30    __ relocate(static_stub_Relocation::spec(mark), RELOC_IMM32);
    1.31    // static stub relocation also tags the methodOop in the code-stream.
    1.32    __ movoop(rbx, (jobject)NULL);  // method is zapped till fixup time
    1.33 -  __ jump(RuntimeAddress((address)-1));
    1.34 +  // This is recognized as unresolved by relocs/nativeInst/ic code
    1.35 +  __ jump(RuntimeAddress(__ pc()));
    1.36  
    1.37    __ end_a_stub();
    1.38    // Update current stubs pointer and restore code_end.
    1.39 @@ -1181,7 +1182,7 @@
    1.40  #ifdef ASSERT
    1.41    uint code_size = cbuf.code_size();
    1.42  #endif
    1.43 -  masm.cmpl(rax, Address(rcx, oopDesc::klass_offset_in_bytes()));
    1.44 +  masm.cmpptr(rax, Address(rcx, oopDesc::klass_offset_in_bytes()));
    1.45    masm.jump_cc(Assembler::notEqual,
    1.46                 RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
    1.47    /* WARNING these NOPs are critical so that verified entry point is properly
    1.48 @@ -1687,20 +1688,20 @@
    1.49      // Compare super with sub directly, since super is not in its own SSA.
    1.50      // The compiler used to emit this test, but we fold it in here,
    1.51      // to allow platform-specific tweaking on sparc.
    1.52 -    __ cmpl(Reax, Resi);
    1.53 +    __ cmpptr(Reax, Resi);
    1.54      __ jcc(Assembler::equal, hit);
    1.55  #ifndef PRODUCT
    1.56 -    __ increment(ExternalAddress((address)&SharedRuntime::_partial_subtype_ctr));
    1.57 +    __ incrementl(ExternalAddress((address)&SharedRuntime::_partial_subtype_ctr));
    1.58  #endif //PRODUCT
    1.59 -    __ movl(Redi,Address(Resi,sizeof(oopDesc) + Klass::secondary_supers_offset_in_bytes()));
    1.60 +    __ movptr(Redi,Address(Resi,sizeof(oopDesc) + Klass::secondary_supers_offset_in_bytes()));
    1.61      __ movl(Recx,Address(Redi,arrayOopDesc::length_offset_in_bytes()));
    1.62 -    __ addl(Redi,arrayOopDesc::base_offset_in_bytes(T_OBJECT));
    1.63 +    __ addptr(Redi,arrayOopDesc::base_offset_in_bytes(T_OBJECT));
    1.64      __ repne_scan();
    1.65      __ jcc(Assembler::notEqual, miss);
    1.66 -    __ movl(Address(Resi,sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes()),Reax);
    1.67 +    __ movptr(Address(Resi,sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes()),Reax);
    1.68      __ bind(hit);
    1.69      if( $primary )
    1.70 -      __ xorl(Redi,Redi);
    1.71 +      __ xorptr(Redi,Redi);
    1.72      __ bind(miss);
    1.73    %}
    1.74  
    1.75 @@ -1749,15 +1750,15 @@
    1.76          // optimizer if the C function is a pure function.
    1.77          __ ffree(0);
    1.78        } else if (rt == T_FLOAT) {
    1.79 -        __ leal(rsp, Address(rsp, -4));
    1.80 +        __ lea(rsp, Address(rsp, -4));
    1.81          __ fstp_s(Address(rsp, 0));
    1.82          __ movflt(xmm0, Address(rsp, 0));
    1.83 -        __ leal(rsp, Address(rsp,  4));
    1.84 +        __ lea(rsp, Address(rsp,  4));
    1.85        } else if (rt == T_DOUBLE) {
    1.86 -        __ leal(rsp, Address(rsp, -8));
    1.87 +        __ lea(rsp, Address(rsp, -8));
    1.88          __ fstp_d(Address(rsp, 0));
    1.89          __ movdbl(xmm0, Address(rsp, 0));
    1.90 -        __ leal(rsp, Address(rsp,  8));
    1.91 +        __ lea(rsp, Address(rsp,  8));
    1.92        }
    1.93      }
    1.94    %}
    1.95 @@ -2888,10 +2889,10 @@
    1.96      __ jccb(Assembler::equal,  done);
    1.97      __ jccb(Assembler::above,  inc);
    1.98      __ bind(nan);
    1.99 -    __ decrement(as_Register($dst$$reg));
   1.100 +    __ decrement(as_Register($dst$$reg)); // NO L qqq
   1.101      __ jmpb(done);
   1.102      __ bind(inc);
   1.103 -    __ increment(as_Register($dst$$reg));
   1.104 +    __ increment(as_Register($dst$$reg)); // NO L qqq
   1.105      __ bind(done);
   1.106    %}
   1.107  
   1.108 @@ -3158,7 +3159,7 @@
   1.109    enc_class mov_i2x(regXD dst, eRegI src) %{
   1.110      MacroAssembler _masm(&cbuf);
   1.111  
   1.112 -    __ movd(as_XMMRegister($dst$$reg), as_Register($src$$reg));
   1.113 +    __ movdl(as_XMMRegister($dst$$reg), as_Register($src$$reg));
   1.114    %}
   1.115  
   1.116  
   1.117 @@ -3258,30 +3259,30 @@
   1.118      }
   1.119      if (EmitSync & 1) {
   1.120          // set box->dhw = unused_mark (3)
   1.121 -        // Force all sync thru slow-path: slow_enter() and slow_exit()
   1.122 -        masm.movl (Address(boxReg, 0), intptr_t(markOopDesc::unused_mark())) ;
   1.123 -        masm.cmpl (rsp, 0) ;
   1.124 -    } else
   1.125 -    if (EmitSync & 2) {
   1.126 -        Label DONE_LABEL ;
   1.127 +        // Force all sync thru slow-path: slow_enter() and slow_exit() 
   1.128 +        masm.movptr (Address(boxReg, 0), int32_t(markOopDesc::unused_mark())) ;             
   1.129 +        masm.cmpptr (rsp, (int32_t)0) ;                        
   1.130 +    } else 
   1.131 +    if (EmitSync & 2) { 
   1.132 +        Label DONE_LABEL ;           
   1.133          if (UseBiasedLocking) {
   1.134             // Note: tmpReg maps to the swap_reg argument and scrReg to the tmp_reg argument.
   1.135             masm.biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, _counters);
   1.136          }
   1.137  
   1.138 -        masm.movl  (tmpReg, Address(objReg, 0)) ;          // fetch markword
   1.139 -        masm.orl   (tmpReg, 0x1);
   1.140 -        masm.movl  (Address(boxReg, 0), tmpReg);           // Anticipate successful CAS
   1.141 +        masm.movptr(tmpReg, Address(objReg, 0)) ;          // fetch markword 
   1.142 +        masm.orptr (tmpReg, 0x1);
   1.143 +        masm.movptr(Address(boxReg, 0), tmpReg);           // Anticipate successful CAS 
   1.144          if (os::is_MP()) { masm.lock();  }
   1.145 -        masm.cmpxchg(boxReg, Address(objReg, 0));          // Updates tmpReg
   1.146 +        masm.cmpxchgptr(boxReg, Address(objReg, 0));          // Updates tmpReg
   1.147          masm.jcc(Assembler::equal, DONE_LABEL);
   1.148          // Recursive locking
   1.149 -        masm.subl(tmpReg, rsp);
   1.150 -        masm.andl(tmpReg, 0xFFFFF003 );
   1.151 -        masm.movl(Address(boxReg, 0), tmpReg);
   1.152 -        masm.bind(DONE_LABEL) ;
   1.153 -    } else {
   1.154 -      // Possible cases that we'll encounter in fast_lock
   1.155 +        masm.subptr(tmpReg, rsp);
   1.156 +        masm.andptr(tmpReg, (int32_t) 0xFFFFF003 );
   1.157 +        masm.movptr(Address(boxReg, 0), tmpReg);
   1.158 +        masm.bind(DONE_LABEL) ; 
   1.159 +    } else {  
   1.160 +      // Possible cases that we'll encounter in fast_lock 
   1.161        // ------------------------------------------------
   1.162        // * Inflated
   1.163        //    -- unlocked
   1.164 @@ -3310,15 +3311,15 @@
   1.165          masm.biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, _counters);
   1.166        }
   1.167  
   1.168 -      masm.movl  (tmpReg, Address(objReg, 0)) ;        // [FETCH]
   1.169 -      masm.testl (tmpReg, 0x02) ;                      // Inflated v (Stack-locked or neutral)
   1.170 +      masm.movptr(tmpReg, Address(objReg, 0)) ;         // [FETCH]
   1.171 +      masm.testptr(tmpReg, 0x02) ;                      // Inflated v (Stack-locked or neutral)
   1.172        masm.jccb  (Assembler::notZero, IsInflated) ;
   1.173  
   1.174        // Attempt stack-locking ...
   1.175 -      masm.orl   (tmpReg, 0x1);
   1.176 -      masm.movl  (Address(boxReg, 0), tmpReg);            // Anticipate successful CAS
   1.177 +      masm.orptr (tmpReg, 0x1);
   1.178 +      masm.movptr(Address(boxReg, 0), tmpReg);          // Anticipate successful CAS
   1.179        if (os::is_MP()) { masm.lock();  }
   1.180 -      masm.cmpxchg(boxReg, Address(objReg, 0));           // Updates tmpReg
   1.181 +      masm.cmpxchgptr(boxReg, Address(objReg, 0));           // Updates tmpReg
   1.182        if (_counters != NULL) {
   1.183          masm.cond_inc32(Assembler::equal,
   1.184                          ExternalAddress((address)_counters->fast_path_entry_count_addr()));
   1.185 @@ -3326,9 +3327,9 @@
   1.186        masm.jccb (Assembler::equal, DONE_LABEL);
   1.187  
   1.188        // Recursive locking
   1.189 -      masm.subl(tmpReg, rsp);
   1.190 -      masm.andl(tmpReg, 0xFFFFF003 );
   1.191 -      masm.movl(Address(boxReg, 0), tmpReg);
   1.192 +      masm.subptr(tmpReg, rsp);
   1.193 +      masm.andptr(tmpReg, 0xFFFFF003 );
   1.194 +      masm.movptr(Address(boxReg, 0), tmpReg);
   1.195        if (_counters != NULL) {
   1.196          masm.cond_inc32(Assembler::equal,
   1.197                          ExternalAddress((address)_counters->fast_path_entry_count_addr()));
   1.198 @@ -3360,36 +3361,33 @@
   1.199        // This is convenient but results a ST-before-CAS penalty.  The following CAS suffers
   1.200        // additional latency as we have another ST in the store buffer that must drain.
   1.201  
   1.202 -      if (EmitSync & 8192) {
   1.203 -         masm.movl  (Address(boxReg, 0), 3) ;            // results in ST-before-CAS penalty
   1.204 -         masm.get_thread (scrReg) ;
   1.205 -         masm.movl  (boxReg, tmpReg);                    // consider: LEA box, [tmp-2]
   1.206 -         masm.movl  (tmpReg, 0);                         // consider: xor vs mov
   1.207 -         if (os::is_MP()) { masm.lock(); }
   1.208 -         masm.cmpxchg (scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
   1.209 -      } else
   1.210 +      if (EmitSync & 8192) { 
   1.211 +         masm.movptr(Address(boxReg, 0), 3) ;            // results in ST-before-CAS penalty
   1.212 +         masm.get_thread (scrReg) ; 
   1.213 +         masm.movptr(boxReg, tmpReg);                    // consider: LEA box, [tmp-2] 
   1.214 +         masm.movptr(tmpReg, 0);                         // consider: xor vs mov
   1.215 +         if (os::is_MP()) { masm.lock(); } 
   1.216 +         masm.cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; 
   1.217 +      } else 
   1.218        if ((EmitSync & 128) == 0) {                      // avoid ST-before-CAS
   1.219 -         masm.movl (scrReg, boxReg) ;
   1.220 -         masm.movl (boxReg, tmpReg);                    // consider: LEA box, [tmp-2]
   1.221 +         masm.movptr(scrReg, boxReg) ; 
   1.222 +         masm.movptr(boxReg, tmpReg);                   // consider: LEA box, [tmp-2] 
   1.223  
   1.224           // Using a prefetchw helps avoid later RTS->RTO upgrades and cache probes
   1.225           if ((EmitSync & 2048) && VM_Version::supports_3dnow() && os::is_MP()) {
   1.226              // prefetchw [eax + Offset(_owner)-2]
   1.227 -            masm.emit_raw (0x0F) ;
   1.228 -            masm.emit_raw (0x0D) ;
   1.229 -            masm.emit_raw (0x48) ;
   1.230 -            masm.emit_raw (ObjectMonitor::owner_offset_in_bytes()-2) ;
   1.231 +            masm.prefetchw(Address(rax, ObjectMonitor::owner_offset_in_bytes()-2));
   1.232           }
   1.233  
   1.234           if ((EmitSync & 64) == 0) {
   1.235             // Optimistic form: consider XORL tmpReg,tmpReg
   1.236 -           masm.movl  (tmpReg, 0 ) ;
   1.237 -         } else {
   1.238 +           masm.movptr(tmpReg, 0 ) ; 
   1.239 +         } else { 
   1.240             // Can suffer RTS->RTO upgrades on shared or cold $ lines
   1.241             // Test-And-CAS instead of CAS
   1.242 -           masm.movl  (tmpReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;   // rax, = m->_owner
   1.243 -           masm.testl (tmpReg, tmpReg) ;                   // Locked ?
   1.244 -           masm.jccb  (Assembler::notZero, DONE_LABEL) ;
   1.245 +           masm.movptr(tmpReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;   // rax, = m->_owner
   1.246 +           masm.testptr(tmpReg, tmpReg) ;                   // Locked ? 
   1.247 +           masm.jccb  (Assembler::notZero, DONE_LABEL) ;                   
   1.248           }
   1.249  
   1.250           // Appears unlocked - try to swing _owner from null to non-null.
   1.251 @@ -3401,41 +3399,38 @@
   1.252           // (rsp or the address of the box) into  m->owner is harmless.
   1.253           // Invariant: tmpReg == 0.  tmpReg is EAX which is the implicit cmpxchg comparand.
   1.254           if (os::is_MP()) { masm.lock();  }
   1.255 -         masm.cmpxchg (scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
   1.256 -         masm.movl  (Address(scrReg, 0), 3) ;          // box->_displaced_header = 3
   1.257 -         masm.jccb  (Assembler::notZero, DONE_LABEL) ;
   1.258 +         masm.cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; 
   1.259 +         masm.movptr(Address(scrReg, 0), 3) ;          // box->_displaced_header = 3
   1.260 +         masm.jccb  (Assembler::notZero, DONE_LABEL) ; 
   1.261           masm.get_thread (scrReg) ;                    // beware: clobbers ICCs
   1.262 -         masm.movl  (Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2), scrReg) ;
   1.263 -         masm.xorl  (boxReg, boxReg) ;                 // set icc.ZFlag = 1 to indicate success
   1.264 -
   1.265 -         // If the CAS fails we can either retry or pass control to the slow-path.
   1.266 -         // We use the latter tactic.
   1.267 +         masm.movptr(Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2), scrReg) ; 
   1.268 +         masm.xorptr(boxReg, boxReg) ;                 // set icc.ZFlag = 1 to indicate success
   1.269 +                       
   1.270 +         // If the CAS fails we can either retry or pass control to the slow-path.  
   1.271 +         // We use the latter tactic.  
   1.272           // Pass the CAS result in the icc.ZFlag into DONE_LABEL
   1.273           // If the CAS was successful ...
   1.274           //   Self has acquired the lock
   1.275           //   Invariant: m->_recursions should already be 0, so we don't need to explicitly set it.
   1.276           // Intentional fall-through into DONE_LABEL ...
   1.277        } else {
   1.278 -         masm.movl (Address(boxReg, 0), 3) ;       // results in ST-before-CAS penalty
   1.279 -         masm.movl (boxReg, tmpReg) ;
   1.280 +         masm.movptr(Address(boxReg, 0), 3) ;       // results in ST-before-CAS penalty
   1.281 +         masm.movptr(boxReg, tmpReg) ; 
   1.282  
   1.283           // Using a prefetchw helps avoid later RTS->RTO upgrades and cache probes
   1.284           if ((EmitSync & 2048) && VM_Version::supports_3dnow() && os::is_MP()) {
   1.285              // prefetchw [eax + Offset(_owner)-2]
   1.286 -            masm.emit_raw (0x0F) ;
   1.287 -            masm.emit_raw (0x0D) ;
   1.288 -            masm.emit_raw (0x48) ;
   1.289 -            masm.emit_raw (ObjectMonitor::owner_offset_in_bytes()-2) ;
   1.290 +            masm.prefetchw(Address(rax, ObjectMonitor::owner_offset_in_bytes()-2));
   1.291           }
   1.292  
   1.293           if ((EmitSync & 64) == 0) {
   1.294             // Optimistic form
   1.295 -           masm.xorl  (tmpReg, tmpReg) ;
   1.296 -         } else {
   1.297 +           masm.xorptr  (tmpReg, tmpReg) ; 
   1.298 +         } else { 
   1.299             // Can suffer RTS->RTO upgrades on shared or cold $ lines
   1.300 -           masm.movl  (tmpReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;   // rax, = m->_owner
   1.301 -           masm.testl (tmpReg, tmpReg) ;                   // Locked ?
   1.302 -           masm.jccb  (Assembler::notZero, DONE_LABEL) ;
   1.303 +           masm.movptr(tmpReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;   // rax, = m->_owner
   1.304 +           masm.testptr(tmpReg, tmpReg) ;                   // Locked ? 
   1.305 +           masm.jccb  (Assembler::notZero, DONE_LABEL) ;                   
   1.306           }
   1.307  
   1.308           // Appears unlocked - try to swing _owner from null to non-null.
   1.309 @@ -3443,7 +3438,7 @@
   1.310           // Invariant: tmpReg == 0.  tmpReg is EAX which is the implicit cmpxchg comparand.
   1.311           masm.get_thread (scrReg) ;
   1.312           if (os::is_MP()) { masm.lock(); }
   1.313 -         masm.cmpxchg (scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
   1.314 +         masm.cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
   1.315  
   1.316           // If the CAS fails we can either retry or pass control to the slow-path.
   1.317           // We use the latter tactic.
   1.318 @@ -3514,19 +3509,19 @@
   1.319  
   1.320      if (EmitSync & 4) {
   1.321        // Disable - inhibit all inlining.  Force control through the slow-path
   1.322 -      masm.cmpl (rsp, 0) ;
   1.323 -    } else
   1.324 +      masm.cmpptr (rsp, 0) ; 
   1.325 +    } else 
   1.326      if (EmitSync & 8) {
   1.327        Label DONE_LABEL ;
   1.328        if (UseBiasedLocking) {
   1.329           masm.biased_locking_exit(objReg, tmpReg, DONE_LABEL);
   1.330        }
   1.331        // classic stack-locking code ...
   1.332 -      masm.movl  (tmpReg, Address(boxReg, 0)) ;
   1.333 -      masm.testl (tmpReg, tmpReg) ;
   1.334 +      masm.movptr(tmpReg, Address(boxReg, 0)) ;
   1.335 +      masm.testptr(tmpReg, tmpReg) ;
   1.336        masm.jcc   (Assembler::zero, DONE_LABEL) ;
   1.337        if (os::is_MP()) { masm.lock(); }
   1.338 -      masm.cmpxchg(tmpReg, Address(objReg, 0));          // Uses EAX which is box
   1.339 +      masm.cmpxchgptr(tmpReg, Address(objReg, 0));          // Uses EAX which is box
   1.340        masm.bind(DONE_LABEL);
   1.341      } else {
   1.342        Label DONE_LABEL, Stacked, CheckSucc, Inflated ;
   1.343 @@ -3536,12 +3531,12 @@
   1.344        if (UseBiasedLocking) {
   1.345           masm.biased_locking_exit(objReg, tmpReg, DONE_LABEL);
   1.346        }
   1.347 -
   1.348 -      masm.cmpl  (Address(boxReg, 0), 0) ;            // Examine the displaced header
   1.349 -      masm.movl  (tmpReg, Address(objReg, 0)) ;       // Examine the object's markword
   1.350 +      
   1.351 +      masm.cmpptr(Address(boxReg, 0), 0) ;            // Examine the displaced header
   1.352 +      masm.movptr(tmpReg, Address(objReg, 0)) ;       // Examine the object's markword
   1.353        masm.jccb  (Assembler::zero, DONE_LABEL) ;      // 0 indicates recursive stack-lock
   1.354  
   1.355 -      masm.testl (tmpReg, 0x02) ;                     // Inflated?
   1.356 +      masm.testptr(tmpReg, 0x02) ;                     // Inflated? 
   1.357        masm.jccb  (Assembler::zero, Stacked) ;
   1.358  
   1.359        masm.bind  (Inflated) ;
   1.360 @@ -3571,11 +3566,8 @@
   1.361  
   1.362        masm.get_thread (boxReg) ;
   1.363        if ((EmitSync & 4096) && VM_Version::supports_3dnow() && os::is_MP()) {
   1.364 -         // prefetchw [ebx + Offset(_owner)-2]
   1.365 -         masm.emit_raw (0x0F) ;
   1.366 -         masm.emit_raw (0x0D) ;
   1.367 -         masm.emit_raw (0x4B) ;
   1.368 -         masm.emit_raw (ObjectMonitor::owner_offset_in_bytes()-2) ;
   1.369 +        // prefetchw [ebx + Offset(_owner)-2]
   1.370 +        masm.prefetchw(Address(rbx, ObjectMonitor::owner_offset_in_bytes()-2));
   1.371        }
   1.372  
   1.373        // Note that we could employ various encoding schemes to reduce
   1.374 @@ -3584,22 +3576,22 @@
   1.375        // In practice the chain of fetches doesn't seem to impact performance, however.
   1.376        if ((EmitSync & 65536) == 0 && (EmitSync & 256)) {
   1.377           // Attempt to reduce branch density - AMD's branch predictor.
   1.378 -         masm.xorl  (boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
   1.379 -         masm.orl   (boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2)) ;
   1.380 -         masm.orl   (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ;
   1.381 -         masm.orl   (boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ;
   1.382 -         masm.jccb  (Assembler::notZero, DONE_LABEL) ;
   1.383 -         masm.movl  (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ;
   1.384 -         masm.jmpb  (DONE_LABEL) ;
   1.385 -      } else {
   1.386 -         masm.xorl  (boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;
   1.387 -         masm.orl   (boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2)) ;
   1.388 -         masm.jccb  (Assembler::notZero, DONE_LABEL) ;
   1.389 -         masm.movl  (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ;
   1.390 -         masm.orl   (boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ;
   1.391 -         masm.jccb  (Assembler::notZero, CheckSucc) ;
   1.392 -         masm.movl  (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ;
   1.393 -         masm.jmpb  (DONE_LABEL) ;
   1.394 +         masm.xorptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;  
   1.395 +         masm.orptr(boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2)) ;
   1.396 +         masm.orptr(boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ; 
   1.397 +         masm.orptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ; 
   1.398 +         masm.jccb  (Assembler::notZero, DONE_LABEL) ; 
   1.399 +         masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ; 
   1.400 +         masm.jmpb  (DONE_LABEL) ; 
   1.401 +      } else { 
   1.402 +         masm.xorptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ;  
   1.403 +         masm.orptr(boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2)) ;
   1.404 +         masm.jccb  (Assembler::notZero, DONE_LABEL) ; 
   1.405 +         masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ; 
   1.406 +         masm.orptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ; 
   1.407 +         masm.jccb  (Assembler::notZero, CheckSucc) ; 
   1.408 +         masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ; 
   1.409 +         masm.jmpb  (DONE_LABEL) ; 
   1.410        }
   1.411  
   1.412        // The Following code fragment (EmitSync & 65536) improves the performance of
   1.413 @@ -3615,9 +3607,9 @@
   1.414           masm.bind  (CheckSucc) ;
   1.415  
   1.416           // Optional pre-test ... it's safe to elide this
   1.417 -         if ((EmitSync & 16) == 0) {
   1.418 -            masm.cmpl  (Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), 0) ;
   1.419 -            masm.jccb  (Assembler::zero, LGoSlowPath) ;
   1.420 +         if ((EmitSync & 16) == 0) { 
   1.421 +            masm.cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), 0) ; 
   1.422 +            masm.jccb  (Assembler::zero, LGoSlowPath) ; 
   1.423           }
   1.424  
   1.425           // We have a classic Dekker-style idiom:
   1.426 @@ -3645,39 +3637,37 @@
   1.427           //
   1.428           // We currently use (3), although it's likely that switching to (2)
   1.429           // is correct for the future.
   1.430 -
   1.431 -         masm.movl  (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ;
   1.432 -         if (os::is_MP()) {
   1.433 -            if (VM_Version::supports_sse2() && 1 == FenceInstruction) {
   1.434 -              masm.emit_raw (0x0F) ;    // MFENCE ...
   1.435 -              masm.emit_raw (0xAE) ;
   1.436 -              masm.emit_raw (0xF0) ;
   1.437 -            } else {
   1.438 -              masm.lock () ; masm.addl (Address(rsp, 0), 0) ;
   1.439 +            
   1.440 +         masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ; 
   1.441 +         if (os::is_MP()) { 
   1.442 +            if (VM_Version::supports_sse2() && 1 == FenceInstruction) { 
   1.443 +              masm.mfence();
   1.444 +            } else { 
   1.445 +              masm.lock () ; masm.addptr(Address(rsp, 0), 0) ; 
   1.446              }
   1.447           }
   1.448           // Ratify _succ remains non-null
   1.449 -         masm.cmpl  (Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), 0) ;
   1.450 -         masm.jccb  (Assembler::notZero, LSuccess) ;
   1.451 -
   1.452 -         masm.xorl  (boxReg, boxReg) ;                  // box is really EAX
   1.453 +         masm.cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), 0) ; 
   1.454 +         masm.jccb  (Assembler::notZero, LSuccess) ; 
   1.455 +
   1.456 +         masm.xorptr(boxReg, boxReg) ;                  // box is really EAX
   1.457           if (os::is_MP()) { masm.lock(); }
   1.458 -         masm.cmpxchg(rsp, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
   1.459 +         masm.cmpxchgptr(rsp, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
   1.460           masm.jccb  (Assembler::notEqual, LSuccess) ;
   1.461           // Since we're low on registers we installed rsp as a placeholding in _owner.
   1.462           // Now install Self over rsp.  This is safe as we're transitioning from
   1.463           // non-null to non=null
   1.464           masm.get_thread (boxReg) ;
   1.465 -         masm.movl  (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), boxReg) ;
   1.466 +         masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), boxReg) ;
   1.467           // Intentional fall-through into LGoSlowPath ...
   1.468  
   1.469 -         masm.bind  (LGoSlowPath) ;
   1.470 -         masm.orl   (boxReg, 1) ;                      // set ICC.ZF=0 to indicate failure
   1.471 -         masm.jmpb  (DONE_LABEL) ;
   1.472 -
   1.473 -         masm.bind  (LSuccess) ;
   1.474 -         masm.xorl  (boxReg, boxReg) ;                 // set ICC.ZF=1 to indicate success
   1.475 -         masm.jmpb  (DONE_LABEL) ;
   1.476 +         masm.bind  (LGoSlowPath) ; 
   1.477 +         masm.orptr(boxReg, 1) ;                      // set ICC.ZF=0 to indicate failure
   1.478 +         masm.jmpb  (DONE_LABEL) ; 
   1.479 +
   1.480 +         masm.bind  (LSuccess) ; 
   1.481 +         masm.xorptr(boxReg, boxReg) ;                 // set ICC.ZF=1 to indicate success
   1.482 +         masm.jmpb  (DONE_LABEL) ; 
   1.483        }
   1.484  
   1.485        masm.bind (Stacked) ;
   1.486 @@ -3686,9 +3676,9 @@
   1.487        // Try to reset the header to displaced header.
   1.488        // The "box" value on the stack is stable, so we can reload
   1.489        // and be assured we observe the same value as above.
   1.490 -      masm.movl (tmpReg, Address(boxReg, 0)) ;
   1.491 +      masm.movptr(tmpReg, Address(boxReg, 0)) ;
   1.492        if (os::is_MP()) {   masm.lock();    }
   1.493 -      masm.cmpxchg(tmpReg, Address(objReg, 0)); // Uses EAX which is box
   1.494 +      masm.cmpxchgptr(tmpReg, Address(objReg, 0)); // Uses EAX which is box
   1.495        // Intention fall-thru into DONE_LABEL
   1.496  
   1.497  
   1.498 @@ -3720,12 +3710,12 @@
   1.499      int count_offset  = java_lang_String::count_offset_in_bytes();
   1.500      int base_offset   = arrayOopDesc::base_offset_in_bytes(T_CHAR);
   1.501  
   1.502 -    masm.movl(rax, Address(rsi, value_offset));
   1.503 +    masm.movptr(rax, Address(rsi, value_offset));
   1.504      masm.movl(rcx, Address(rsi, offset_offset));
   1.505 -    masm.leal(rax, Address(rax, rcx, Address::times_2, base_offset));
   1.506 -    masm.movl(rbx, Address(rdi, value_offset));
   1.507 +    masm.lea(rax, Address(rax, rcx, Address::times_2, base_offset));
   1.508 +    masm.movptr(rbx, Address(rdi, value_offset));
   1.509      masm.movl(rcx, Address(rdi, offset_offset));
   1.510 -    masm.leal(rbx, Address(rbx, rcx, Address::times_2, base_offset));
   1.511 +    masm.lea(rbx, Address(rbx, rcx, Address::times_2, base_offset));
   1.512  
   1.513      // Compute the minimum of the string lengths(rsi) and the
   1.514      // difference of the string lengths (stack)
   1.515 @@ -3736,14 +3726,14 @@
   1.516        masm.movl(rsi, Address(rsi, count_offset));
   1.517        masm.movl(rcx, rdi);
   1.518        masm.subl(rdi, rsi);
   1.519 -      masm.pushl(rdi);
   1.520 +      masm.push(rdi);
   1.521        masm.cmovl(Assembler::lessEqual, rsi, rcx);
   1.522      } else {
   1.523        masm.movl(rdi, Address(rdi, count_offset));
   1.524        masm.movl(rcx, Address(rsi, count_offset));
   1.525        masm.movl(rsi, rdi);
   1.526        masm.subl(rdi, rcx);
   1.527 -      masm.pushl(rdi);
   1.528 +      masm.push(rdi);
   1.529        masm.jcc(Assembler::lessEqual, ECX_GOOD_LABEL);
   1.530        masm.movl(rsi, rcx);
   1.531        // rsi holds min, rcx is unused
   1.532 @@ -3761,14 +3751,14 @@
   1.533      // Compare first characters
   1.534      masm.subl(rcx, rdi);
   1.535      masm.jcc(Assembler::notZero,  POP_LABEL);
   1.536 -    masm.decrement(rsi);
   1.537 +    masm.decrementl(rsi);
   1.538      masm.jcc(Assembler::zero, LENGTH_DIFF_LABEL);
   1.539  
   1.540      {
   1.541        // Check after comparing first character to see if strings are equivalent
   1.542        Label LSkip2;
   1.543        // Check if the strings start at same location
   1.544 -      masm.cmpl(rbx,rax);
   1.545 +      masm.cmpptr(rbx,rax);
   1.546        masm.jcc(Assembler::notEqual, LSkip2);
   1.547  
   1.548        // Check if the length difference is zero (from stack)
   1.549 @@ -3780,8 +3770,8 @@
   1.550      }
   1.551  
   1.552      // Shift rax, and rbx, to the end of the arrays, negate min
   1.553 -    masm.leal(rax, Address(rax, rsi, Address::times_2, 2));
   1.554 -    masm.leal(rbx, Address(rbx, rsi, Address::times_2, 2));
   1.555 +    masm.lea(rax, Address(rax, rsi, Address::times_2, 2));
   1.556 +    masm.lea(rbx, Address(rbx, rsi, Address::times_2, 2));
   1.557      masm.negl(rsi);
   1.558  
   1.559      // Compare the rest of the characters
   1.560 @@ -3790,18 +3780,18 @@
   1.561      masm.load_unsigned_word(rdi, Address(rax, rsi, Address::times_2, 0));
   1.562      masm.subl(rcx, rdi);
   1.563      masm.jcc(Assembler::notZero, POP_LABEL);
   1.564 -    masm.increment(rsi);
   1.565 +    masm.incrementl(rsi);
   1.566      masm.jcc(Assembler::notZero, WHILE_HEAD_LABEL);
   1.567  
   1.568      // Strings are equal up to min length.  Return the length difference.
   1.569      masm.bind(LENGTH_DIFF_LABEL);
   1.570 -    masm.popl(rcx);
   1.571 +    masm.pop(rcx);
   1.572      masm.jmp(DONE_LABEL);
   1.573  
   1.574      // Discard the stored length difference
   1.575      masm.bind(POP_LABEL);
   1.576 -    masm.addl(rsp, 4);
   1.577 -
   1.578 +    masm.addptr(rsp, 4);
   1.579 +       
   1.580      // That's it
   1.581      masm.bind(DONE_LABEL);
   1.582    %}
   1.583 @@ -4315,7 +4305,8 @@
   1.584  
   1.585    enc_class enc_membar_volatile %{
   1.586      MacroAssembler masm(&cbuf);
   1.587 -    masm.membar();
   1.588 +    masm.membar(Assembler::Membar_mask_bits(Assembler::StoreLoad |
   1.589 +                                            Assembler::StoreStore));
   1.590    %}
   1.591  
   1.592    // Atomically load the volatile long
   1.593 @@ -11151,7 +11142,7 @@
   1.594    format %{ "MOVD  $dst,$src\n\t"
   1.595              "CVTDQ2PD $dst,$dst\t# i2d" %}
   1.596    ins_encode %{
   1.597 -    __ movd($dst$$XMMRegister, $src$$Register);
   1.598 +    __ movdl($dst$$XMMRegister, $src$$Register);
   1.599      __ cvtdq2pd($dst$$XMMRegister, $dst$$XMMRegister);
   1.600    %}
   1.601    ins_pipe(pipe_slow); // XXX
   1.602 @@ -11249,7 +11240,7 @@
   1.603    format %{ "MOVD  $dst,$src\n\t"
   1.604              "CVTDQ2PS $dst,$dst\t# i2f" %}
   1.605    ins_encode %{
   1.606 -    __ movd($dst$$XMMRegister, $src$$Register);
   1.607 +    __ movdl($dst$$XMMRegister, $src$$Register);
   1.608      __ cvtdq2ps($dst$$XMMRegister, $dst$$XMMRegister);
   1.609    %}
   1.610    ins_pipe(pipe_slow); // XXX
   1.611 @@ -12262,7 +12253,7 @@
   1.612       "done:" %}
   1.613    ins_encode %{
   1.614      Label p_one, m_one, done;
   1.615 -    __ xorl($dst$$Register, $dst$$Register);
   1.616 +    __ xorptr($dst$$Register, $dst$$Register);
   1.617      __ cmpl(HIGH_FROM_LOW($src1$$Register), HIGH_FROM_LOW($src2$$Register));
   1.618      __ jccb(Assembler::less,    m_one);
   1.619      __ jccb(Assembler::greater, p_one);
   1.620 @@ -12270,10 +12261,10 @@
   1.621      __ jccb(Assembler::below,   m_one);
   1.622      __ jccb(Assembler::equal,   done);
   1.623      __ bind(p_one);
   1.624 -    __ increment($dst$$Register);
   1.625 +    __ incrementl($dst$$Register);
   1.626      __ jmpb(done);
   1.627      __ bind(m_one);
   1.628 -    __ decrement($dst$$Register);
   1.629 +    __ decrementl($dst$$Register);
   1.630      __ bind(done);
   1.631    %}
   1.632    ins_pipe( pipe_slow );

mercurial