src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp
changeset 51996 84743156e780
parent 51953 3aac38c47955
child 57570 d7304cf430f1
equal deleted inserted replaced
51995:f7babf9d1592 51996:84743156e780
    73 
    73 
    74   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
    74   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
    75   __ mov32 (rcx, counter);
    75   __ mov32 (rcx, counter);
    76   __ testb (rcx, 1);
    76   __ testb (rcx, 1);
    77   __ jcc (Assembler::notZero, slow);
    77   __ jcc (Assembler::notZero, slow);
    78   if (os::is_MP()) {
    78   __ mov(rax, rcx);
    79     __ mov(rax, rcx);
    79   __ andptr(rax, 1);                         // rax, must end up 0
    80     __ andptr(rax, 1);                         // rax, must end up 0
    80   __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
    81     __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
    81                                             // obj, notice rax, is 0.
    82                                               // obj, notice rax, is 0.
    82                                             // rdx is data dependent on rcx.
    83                                               // rdx is data dependent on rcx.
       
    84   } else {
       
    85     __ movptr (rdx, Address(rsp, 2*wordSize));  // obj
       
    86   }
       
    87   __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
    83   __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
    88 
    84 
    89   __ clear_jweak_tag(rdx);
    85   __ clear_jweak_tag(rdx);
    90 
    86 
    91   __ movptr(rdx, Address(rdx, 0));           // *obj
    87   __ movptr(rdx, Address(rdx, 0));           // *obj
   101     case T_INT:     __ movl   (rax, Address(rdx, rax, Address::times_1)); break;
    97     case T_INT:     __ movl   (rax, Address(rdx, rax, Address::times_1)); break;
   102     default:        ShouldNotReachHere();
    98     default:        ShouldNotReachHere();
   103   }
    99   }
   104 
   100 
   105   Address ca1;
   101   Address ca1;
   106   if (os::is_MP()) {
   102   __ lea(rdx, counter);
   107     __ lea(rdx, counter);
   103   __ xorptr(rdx, rax);
   108     __ xorptr(rdx, rax);
   104   __ xorptr(rdx, rax);
   109     __ xorptr(rdx, rax);
   105   __ cmp32(rcx, Address(rdx, 0));
   110     __ cmp32(rcx, Address(rdx, 0));
   106   // ca1 is the same as ca because
   111     // ca1 is the same as ca because
   107   // rax, ^ counter_addr ^ rax, = address
   112     // rax, ^ counter_addr ^ rax, = address
   108   // ca1 is data dependent on rax,.
   113     // ca1 is data dependent on rax,.
       
   114   } else {
       
   115     __ cmp32(rcx, counter);
       
   116   }
       
   117   __ jcc (Assembler::notEqual, slow);
   109   __ jcc (Assembler::notEqual, slow);
   118 
   110 
   119 #ifndef _WINDOWS
   111 #ifndef _WINDOWS
   120   __ ret (0);
   112   __ ret (0);
   121 #else
   113 #else
   194 
   186 
   195   __ push  (rsi);
   187   __ push  (rsi);
   196   __ mov32 (rcx, counter);
   188   __ mov32 (rcx, counter);
   197   __ testb (rcx, 1);
   189   __ testb (rcx, 1);
   198   __ jcc (Assembler::notZero, slow);
   190   __ jcc (Assembler::notZero, slow);
   199   if (os::is_MP()) {
   191   __ mov(rax, rcx);
   200     __ mov(rax, rcx);
   192   __ andptr(rax, 1);                         // rax, must end up 0
   201     __ andptr(rax, 1);                         // rax, must end up 0
   193   __ movptr(rdx, Address(rsp, rax, Address::times_1, 3*wordSize));
   202     __ movptr(rdx, Address(rsp, rax, Address::times_1, 3*wordSize));
   194                                             // obj, notice rax, is 0.
   203                                               // obj, notice rax, is 0.
   195                                             // rdx is data dependent on rcx.
   204                                               // rdx is data dependent on rcx.
       
   205   } else {
       
   206     __ movptr(rdx, Address(rsp, 3*wordSize));  // obj
       
   207   }
       
   208   __ movptr(rsi, Address(rsp, 4*wordSize));  // jfieldID
   196   __ movptr(rsi, Address(rsp, 4*wordSize));  // jfieldID
   209 
   197 
   210   __ clear_jweak_tag(rdx);
   198   __ clear_jweak_tag(rdx);
   211 
   199 
   212   __ movptr(rdx, Address(rdx, 0));           // *obj
   200   __ movptr(rdx, Address(rdx, 0));           // *obj
   218 #ifndef _LP64
   206 #ifndef _LP64
   219   speculative_load_pclist[count] = __ pc();
   207   speculative_load_pclist[count] = __ pc();
   220   __ movl(rdx, Address(rdx, rsi, Address::times_1, 4));
   208   __ movl(rdx, Address(rdx, rsi, Address::times_1, 4));
   221 #endif // _LP64
   209 #endif // _LP64
   222 
   210 
   223   if (os::is_MP()) {
   211   __ lea(rsi, counter);
   224     __ lea(rsi, counter);
   212   __ xorptr(rsi, rdx);
   225     __ xorptr(rsi, rdx);
   213   __ xorptr(rsi, rax);
   226     __ xorptr(rsi, rax);
   214   __ xorptr(rsi, rdx);
   227     __ xorptr(rsi, rdx);
   215   __ xorptr(rsi, rax);
   228     __ xorptr(rsi, rax);
   216   __ cmp32(rcx, Address(rsi, 0));
   229     __ cmp32(rcx, Address(rsi, 0));
   217   // ca1 is the same as ca because
   230     // ca1 is the same as ca because
   218   // rax, ^ rdx ^ counter_addr ^ rax, ^ rdx = address
   231     // rax, ^ rdx ^ counter_addr ^ rax, ^ rdx = address
   219   // ca1 is data dependent on both rax, and rdx.
   232     // ca1 is data dependent on both rax, and rdx.
       
   233   } else {
       
   234     __ cmp32(rcx, counter);
       
   235   }
       
   236   __ jcc (Assembler::notEqual, slow);
   220   __ jcc (Assembler::notEqual, slow);
   237 
   221 
   238   __ pop (rsi);
   222   __ pop (rsi);
   239 
   223 
   240 #ifndef _WINDOWS
   224 #ifndef _WINDOWS
   286   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
   270   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
   287 
   271 
   288   __ mov32 (rcx, counter);
   272   __ mov32 (rcx, counter);
   289   __ testb (rcx, 1);
   273   __ testb (rcx, 1);
   290   __ jcc (Assembler::notZero, slow);
   274   __ jcc (Assembler::notZero, slow);
   291   if (os::is_MP()) {
   275   __ mov(rax, rcx);
   292     __ mov(rax, rcx);
   276   __ andptr(rax, 1);                         // rax, must end up 0
   293     __ andptr(rax, 1);                         // rax, must end up 0
   277   __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
   294     __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
   278                                             // obj, notice rax, is 0.
   295                                               // obj, notice rax, is 0.
   279                                             // rdx is data dependent on rcx.
   296                                               // rdx is data dependent on rcx.
       
   297   } else {
       
   298     __ movptr(rdx, Address(rsp, 2*wordSize)); // obj
       
   299   }
       
   300   __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
   280   __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
   301 
   281 
   302   __ clear_jweak_tag(rdx);
   282   __ clear_jweak_tag(rdx);
   303 
   283 
   304   __ movptr(rdx, Address(rdx, 0));           // *obj
   284   __ movptr(rdx, Address(rdx, 0));           // *obj
   316 #endif // _LP64
   296 #endif // _LP64
   317     default:       ShouldNotReachHere();
   297     default:       ShouldNotReachHere();
   318   }
   298   }
   319 
   299 
   320   Address ca1;
   300   Address ca1;
   321   if (os::is_MP()) {
   301   __ fst_s (Address(rsp, -4));
   322     __ fst_s (Address(rsp, -4));
   302   __ lea(rdx, counter);
   323     __ lea(rdx, counter);
   303   __ movl (rax, Address(rsp, -4));
   324     __ movl (rax, Address(rsp, -4));
   304   // garbage hi-order bits on 64bit are harmless.
   325     // garbage hi-order bits on 64bit are harmless.
   305   __ xorptr(rdx, rax);
   326     __ xorptr(rdx, rax);
   306   __ xorptr(rdx, rax);
   327     __ xorptr(rdx, rax);
   307   __ cmp32(rcx, Address(rdx, 0));
   328     __ cmp32(rcx, Address(rdx, 0));
   308   // rax, ^ counter_addr ^ rax, = address
   329                                           // rax, ^ counter_addr ^ rax, = address
   309   // ca1 is data dependent on the field
   330                                           // ca1 is data dependent on the field
   310   // access.
   331                                           // access.
       
   332   } else {
       
   333     __ cmp32(rcx, counter);
       
   334   }
       
   335   __ jcc (Assembler::notEqual, slow_with_pop);
   311   __ jcc (Assembler::notEqual, slow_with_pop);
   336 
   312 
   337 #ifndef _WINDOWS
   313 #ifndef _WINDOWS
   338   __ ret (0);
   314   __ ret (0);
   339 #else
   315 #else