< prev index next >

src/cpu/x86/vm/jniFastGetField_x86_32.cpp

Print this page
rev 12653 : [mq]: fastgetfield
rev 12655 : [mq]: kim-review
   1 /*
   2  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  69   //  return pc        0
  70   //  jni env          1
  71   //  obj              2
  72   //  jfieldID         3
  73 
  74   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
  75   __ mov32 (rcx, counter);
  76   __ testb (rcx, 1);
  77   __ jcc (Assembler::notZero, slow);
  78   if (os::is_MP()) {
  79     __ mov(rax, rcx);
  80     __ andptr(rax, 1);                         // rax, must end up 0
  81     __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
  82                                               // obj, notice rax, is 0.
  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
  88 
  89   const intptr_t inverted_jweak_mask = ~static_cast<intptr_t>(JNIHandles::weak_tag_mask);
  90   assert(inverted_jweak_mask == -2, "Otherwise check this code");
  91   __ andl(rdx, inverted_jweak_mask); // mask is subject to sign-extension
  92 
  93   __ movptr(rdx, Address(rdx, 0));           // *obj
  94   __ shrptr (rax, 2);                         // offset
  95 
  96   assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
  97   speculative_load_pclist[count] = __ pc();
  98   switch (type) {
  99     case T_BOOLEAN: __ movzbl (rax, Address(rdx, rax, Address::times_1)); break;
 100     case T_BYTE:    __ movsbl (rax, Address(rdx, rax, Address::times_1)); break;
 101     case T_CHAR:    __ movzwl (rax, Address(rdx, rax, Address::times_1)); break;
 102     case T_SHORT:   __ movswl (rax, Address(rdx, rax, Address::times_1)); break;
 103     case T_INT:     __ movl   (rax, Address(rdx, rax, Address::times_1)); break;
 104     default:        ShouldNotReachHere();
 105   }
 106 
 107   Address ca1;
 108   if (os::is_MP()) {
 109     __ lea(rdx, counter);
 110     __ xorptr(rdx, rax);
 111     __ xorptr(rdx, rax);


 191   //  obj              3
 192   //  jfieldID         4
 193 
 194   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
 195 
 196   __ push  (rsi);
 197   __ mov32 (rcx, counter);
 198   __ testb (rcx, 1);
 199   __ jcc (Assembler::notZero, slow);
 200   if (os::is_MP()) {
 201     __ mov(rax, rcx);
 202     __ andptr(rax, 1);                         // rax, must end up 0
 203     __ movptr(rdx, Address(rsp, rax, Address::times_1, 3*wordSize));
 204                                               // obj, notice rax, is 0.
 205                                               // rdx is data dependent on rcx.
 206   } else {
 207     __ movptr(rdx, Address(rsp, 3*wordSize));  // obj
 208   }
 209   __ movptr(rsi, Address(rsp, 4*wordSize));  // jfieldID
 210 
 211   const intptr_t inverted_jweak_mask = ~static_cast<intptr_t>(JNIHandles::weak_tag_mask);
 212   assert(inverted_jweak_mask == -2, "Otherwise check this code");
 213   __ andl(rdx, inverted_jweak_mask); // mask is subject to sign-extension
 214 
 215   __ movptr(rdx, Address(rdx, 0));           // *obj
 216   __ shrptr(rsi, 2);                         // offset
 217 
 218   assert(count < LIST_CAPACITY-1, "LIST_CAPACITY too small");
 219   speculative_load_pclist[count++] = __ pc();
 220   __ movptr(rax, Address(rdx, rsi, Address::times_1));
 221 #ifndef _LP64
 222   speculative_load_pclist[count] = __ pc();
 223   __ movl(rdx, Address(rdx, rsi, Address::times_1, 4));
 224 #endif // _LP64
 225 
 226   if (os::is_MP()) {
 227     __ lea(rsi, counter);
 228     __ xorptr(rsi, rdx);
 229     __ xorptr(rsi, rax);
 230     __ xorptr(rsi, rdx);
 231     __ xorptr(rsi, rax);
 232     __ cmp32(rcx, Address(rsi, 0));
 233     // ca1 is the same as ca because


 285   //  jni env          1
 286   //  obj              2
 287   //  jfieldID         3
 288 
 289   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
 290 
 291   __ mov32 (rcx, counter);
 292   __ testb (rcx, 1);
 293   __ jcc (Assembler::notZero, slow);
 294   if (os::is_MP()) {
 295     __ mov(rax, rcx);
 296     __ andptr(rax, 1);                         // rax, must end up 0
 297     __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
 298                                               // obj, notice rax, is 0.
 299                                               // rdx is data dependent on rcx.
 300   } else {
 301     __ movptr(rdx, Address(rsp, 2*wordSize)); // obj
 302   }
 303   __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
 304 
 305   const intptr_t inverted_jweak_mask = ~static_cast<intptr_t>(JNIHandles::weak_tag_mask);
 306   assert(inverted_jweak_mask == -2, "Otherwise check this code");
 307   __ andl(rdx, inverted_jweak_mask);         // mask is subject to sign-extension
 308 
 309   __ movptr(rdx, Address(rdx, 0));           // *obj
 310   __ shrptr(rax, 2);                         // offset
 311 
 312   assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
 313   speculative_load_pclist[count] = __ pc();
 314   switch (type) {
 315 #ifndef _LP64
 316     case T_FLOAT:  __ fld_s (Address(rdx, rax, Address::times_1)); break;
 317     case T_DOUBLE: __ fld_d (Address(rdx, rax, Address::times_1)); break;
 318 #else
 319     case T_FLOAT:  __ movflt (xmm0, Address(robj, roffset, Address::times_1)); break;
 320     case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break;
 321 #endif // _LP64
 322     default:       ShouldNotReachHere();
 323   }
 324 
 325   Address ca1;
 326   if (os::is_MP()) {
 327     __ fst_s (Address(rsp, -4));


   1 /*
   2  * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  69   //  return pc        0
  70   //  jni env          1
  71   //  obj              2
  72   //  jfieldID         3
  73 
  74   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
  75   __ mov32 (rcx, counter);
  76   __ testb (rcx, 1);
  77   __ jcc (Assembler::notZero, slow);
  78   if (os::is_MP()) {
  79     __ mov(rax, rcx);
  80     __ andptr(rax, 1);                         // rax, must end up 0
  81     __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
  82                                               // obj, notice rax, is 0.
  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
  88 
  89   __ clear_jweak_tag(rdx);


  90 
  91   __ movptr(rdx, Address(rdx, 0));           // *obj
  92   __ shrptr (rax, 2);                         // offset
  93 
  94   assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
  95   speculative_load_pclist[count] = __ pc();
  96   switch (type) {
  97     case T_BOOLEAN: __ movzbl (rax, Address(rdx, rax, Address::times_1)); break;
  98     case T_BYTE:    __ movsbl (rax, Address(rdx, rax, Address::times_1)); break;
  99     case T_CHAR:    __ movzwl (rax, Address(rdx, rax, Address::times_1)); break;
 100     case T_SHORT:   __ movswl (rax, Address(rdx, rax, Address::times_1)); break;
 101     case T_INT:     __ movl   (rax, Address(rdx, rax, Address::times_1)); break;
 102     default:        ShouldNotReachHere();
 103   }
 104 
 105   Address ca1;
 106   if (os::is_MP()) {
 107     __ lea(rdx, counter);
 108     __ xorptr(rdx, rax);
 109     __ xorptr(rdx, rax);


 189   //  obj              3
 190   //  jfieldID         4
 191 
 192   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
 193 
 194   __ push  (rsi);
 195   __ mov32 (rcx, counter);
 196   __ testb (rcx, 1);
 197   __ jcc (Assembler::notZero, slow);
 198   if (os::is_MP()) {
 199     __ mov(rax, rcx);
 200     __ andptr(rax, 1);                         // rax, must end up 0
 201     __ movptr(rdx, Address(rsp, rax, Address::times_1, 3*wordSize));
 202                                               // obj, notice rax, is 0.
 203                                               // rdx is data dependent on rcx.
 204   } else {
 205     __ movptr(rdx, Address(rsp, 3*wordSize));  // obj
 206   }
 207   __ movptr(rsi, Address(rsp, 4*wordSize));  // jfieldID
 208 
 209   __ clear_jweak_tag(rdx);


 210 
 211   __ movptr(rdx, Address(rdx, 0));           // *obj
 212   __ shrptr(rsi, 2);                         // offset
 213 
 214   assert(count < LIST_CAPACITY-1, "LIST_CAPACITY too small");
 215   speculative_load_pclist[count++] = __ pc();
 216   __ movptr(rax, Address(rdx, rsi, Address::times_1));
 217 #ifndef _LP64
 218   speculative_load_pclist[count] = __ pc();
 219   __ movl(rdx, Address(rdx, rsi, Address::times_1, 4));
 220 #endif // _LP64
 221 
 222   if (os::is_MP()) {
 223     __ lea(rsi, counter);
 224     __ xorptr(rsi, rdx);
 225     __ xorptr(rsi, rax);
 226     __ xorptr(rsi, rdx);
 227     __ xorptr(rsi, rax);
 228     __ cmp32(rcx, Address(rsi, 0));
 229     // ca1 is the same as ca because


 281   //  jni env          1
 282   //  obj              2
 283   //  jfieldID         3
 284 
 285   ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
 286 
 287   __ mov32 (rcx, counter);
 288   __ testb (rcx, 1);
 289   __ jcc (Assembler::notZero, slow);
 290   if (os::is_MP()) {
 291     __ mov(rax, rcx);
 292     __ andptr(rax, 1);                         // rax, must end up 0
 293     __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
 294                                               // obj, notice rax, is 0.
 295                                               // rdx is data dependent on rcx.
 296   } else {
 297     __ movptr(rdx, Address(rsp, 2*wordSize)); // obj
 298   }
 299   __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
 300 
 301   __ clear_jweak_tag(rdx);


 302 
 303   __ movptr(rdx, Address(rdx, 0));           // *obj
 304   __ shrptr(rax, 2);                         // offset
 305 
 306   assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
 307   speculative_load_pclist[count] = __ pc();
 308   switch (type) {
 309 #ifndef _LP64
 310     case T_FLOAT:  __ fld_s (Address(rdx, rax, Address::times_1)); break;
 311     case T_DOUBLE: __ fld_d (Address(rdx, rax, Address::times_1)); break;
 312 #else
 313     case T_FLOAT:  __ movflt (xmm0, Address(robj, roffset, Address::times_1)); break;
 314     case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break;
 315 #endif // _LP64
 316     default:       ShouldNotReachHere();
 317   }
 318 
 319   Address ca1;
 320   if (os::is_MP()) {
 321     __ fst_s (Address(rsp, -4));


< prev index next >