src/cpu/x86/vm/jniFastGetField_x86_32.cpp

changeset 739
dc7f315e41f7
parent 435
a61af66fc99e
child 772
9ee9cf798b59
     1.1 --- a/src/cpu/x86/vm/jniFastGetField_x86_32.cpp	Tue Aug 26 15:49:40 2008 -0700
     1.2 +++ b/src/cpu/x86/vm/jniFastGetField_x86_32.cpp	Wed Aug 27 00:21:55 2008 -0700
     1.3 @@ -72,25 +72,25 @@
     1.4    __ testb (rcx, 1);
     1.5    __ jcc (Assembler::notZero, slow);
     1.6    if (os::is_MP()) {
     1.7 -    __ movl (rax, rcx);
     1.8 -    __ andl (rax, 1);                         // rax, must end up 0
     1.9 -    __ movl (rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
    1.10 +    __ mov(rax, rcx);
    1.11 +    __ andptr(rax, 1);                         // rax, must end up 0
    1.12 +    __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
    1.13                                                // obj, notice rax, is 0.
    1.14                                                // rdx is data dependent on rcx.
    1.15    } else {
    1.16 -    __ movl (rdx, Address(rsp, 2*wordSize));  // obj
    1.17 +    __ movptr (rdx, Address(rsp, 2*wordSize));  // obj
    1.18    }
    1.19 -  __ movl (rax, Address(rsp, 3*wordSize));  // jfieldID
    1.20 -  __ movl (rdx, Address(rdx, 0));           // *obj
    1.21 -  __ shrl (rax, 2);                         // offset
    1.22 +  __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
    1.23 +  __ movptr(rdx, Address(rdx, 0));           // *obj
    1.24 +  __ shrptr (rax, 2);                         // offset
    1.25  
    1.26    assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
    1.27    speculative_load_pclist[count] = __ pc();
    1.28    switch (type) {
    1.29 -    case T_BOOLEAN: __ movzxb (rax, Address(rdx, rax, Address::times_1)); break;
    1.30 -    case T_BYTE:    __ movsxb (rax, Address(rdx, rax, Address::times_1)); break;
    1.31 -    case T_CHAR:    __ movzxw (rax, Address(rdx, rax, Address::times_1)); break;
    1.32 -    case T_SHORT:   __ movsxw (rax, Address(rdx, rax, Address::times_1)); break;
    1.33 +    case T_BOOLEAN: __ movzbl (rax, Address(rdx, rax, Address::times_1)); break;
    1.34 +    case T_BYTE:    __ movsbl (rax, Address(rdx, rax, Address::times_1)); break;
    1.35 +    case T_CHAR:    __ movzwl (rax, Address(rdx, rax, Address::times_1)); break;
    1.36 +    case T_SHORT:   __ movswl (rax, Address(rdx, rax, Address::times_1)); break;
    1.37      case T_INT:     __ movl   (rax, Address(rdx, rax, Address::times_1)); break;
    1.38      default:        ShouldNotReachHere();
    1.39    }
    1.40 @@ -98,8 +98,8 @@
    1.41    Address ca1;
    1.42    if (os::is_MP()) {
    1.43      __ lea(rdx, counter);
    1.44 -    __ xorl(rdx, rax);
    1.45 -    __ xorl(rdx, rax);
    1.46 +    __ xorptr(rdx, rax);
    1.47 +    __ xorptr(rdx, rax);
    1.48      __ cmp32(rcx, Address(rdx, 0));
    1.49      // ca1 is the same as ca because
    1.50      // rax, ^ counter_addr ^ rax, = address
    1.51 @@ -184,35 +184,37 @@
    1.52  
    1.53    ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
    1.54  
    1.55 -  __ pushl (rsi);
    1.56 +  __ push  (rsi);
    1.57    __ mov32 (rcx, counter);
    1.58    __ testb (rcx, 1);
    1.59    __ jcc (Assembler::notZero, slow);
    1.60    if (os::is_MP()) {
    1.61 -    __ movl (rax, rcx);
    1.62 -    __ andl (rax, 1);                         // rax, must end up 0
    1.63 -    __ movl (rdx, Address(rsp, rax, Address::times_1, 3*wordSize));
    1.64 +    __ mov(rax, rcx);
    1.65 +    __ andptr(rax, 1);                         // rax, must end up 0
    1.66 +    __ movptr(rdx, Address(rsp, rax, Address::times_1, 3*wordSize));
    1.67                                                // obj, notice rax, is 0.
    1.68                                                // rdx is data dependent on rcx.
    1.69    } else {
    1.70 -    __ movl (rdx, Address(rsp, 3*wordSize));  // obj
    1.71 +    __ movptr(rdx, Address(rsp, 3*wordSize));  // obj
    1.72    }
    1.73 -  __ movl (rsi, Address(rsp, 4*wordSize));  // jfieldID
    1.74 -  __ movl (rdx, Address(rdx, 0));           // *obj
    1.75 -  __ shrl (rsi, 2);                         // offset
    1.76 +  __ movptr(rsi, Address(rsp, 4*wordSize));  // jfieldID
    1.77 +  __ movptr(rdx, Address(rdx, 0));           // *obj
    1.78 +  __ shrptr(rsi, 2);                         // offset
    1.79  
    1.80    assert(count < LIST_CAPACITY-1, "LIST_CAPACITY too small");
    1.81    speculative_load_pclist[count++] = __ pc();
    1.82 -  __ movl (rax, Address(rdx, rsi, Address::times_1));
    1.83 +  __ movptr(rax, Address(rdx, rsi, Address::times_1));
    1.84 +#ifndef _LP64
    1.85    speculative_load_pclist[count] = __ pc();
    1.86 -  __ movl (rdx, Address(rdx, rsi, Address::times_1, 4));
    1.87 +  __ movl(rdx, Address(rdx, rsi, Address::times_1, 4));
    1.88 +#endif // _LP64
    1.89  
    1.90    if (os::is_MP()) {
    1.91 -    __ lea  (rsi, counter);
    1.92 -    __ xorl (rsi, rdx);
    1.93 -    __ xorl (rsi, rax);
    1.94 -    __ xorl (rsi, rdx);
    1.95 -    __ xorl (rsi, rax);
    1.96 +    __ lea(rsi, counter);
    1.97 +    __ xorptr(rsi, rdx);
    1.98 +    __ xorptr(rsi, rax);
    1.99 +    __ xorptr(rsi, rdx);
   1.100 +    __ xorptr(rsi, rax);
   1.101      __ cmp32(rcx, Address(rsi, 0));
   1.102      // ca1 is the same as ca because
   1.103      // rax, ^ rdx ^ counter_addr ^ rax, ^ rdx = address
   1.104 @@ -222,7 +224,7 @@
   1.105    }
   1.106    __ jcc (Assembler::notEqual, slow);
   1.107  
   1.108 -  __ popl (rsi);
   1.109 +  __ pop (rsi);
   1.110  
   1.111  #ifndef _WINDOWS
   1.112    __ ret (0);
   1.113 @@ -234,7 +236,7 @@
   1.114    slowcase_entry_pclist[count-1] = __ pc();
   1.115    slowcase_entry_pclist[count++] = __ pc();
   1.116    __ bind (slow);
   1.117 -  __ popl (rsi);
   1.118 +  __ pop  (rsi);
   1.119    address slow_case_addr = jni_GetLongField_addr();;
   1.120    // tail call
   1.121    __ jump (ExternalAddress(slow_case_addr));
   1.122 @@ -276,23 +278,28 @@
   1.123    __ testb (rcx, 1);
   1.124    __ jcc (Assembler::notZero, slow);
   1.125    if (os::is_MP()) {
   1.126 -    __ movl (rax, rcx);
   1.127 -    __ andl (rax, 1);                         // rax, must end up 0
   1.128 -    __ movl (rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
   1.129 +    __ mov(rax, rcx);
   1.130 +    __ andptr(rax, 1);                         // rax, must end up 0
   1.131 +    __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize));
   1.132                                                // obj, notice rax, is 0.
   1.133                                                // rdx is data dependent on rcx.
   1.134    } else {
   1.135 -    __ movl (rdx, Address(rsp, 2*wordSize)); // obj
   1.136 +    __ movptr(rdx, Address(rsp, 2*wordSize)); // obj
   1.137    }
   1.138 -  __ movl (rax, Address(rsp, 3*wordSize));  // jfieldID
   1.139 -  __ movl (rdx, Address(rdx, 0));           // *obj
   1.140 -  __ shrl (rax, 2);                         // offset
   1.141 +  __ movptr(rax, Address(rsp, 3*wordSize));  // jfieldID
   1.142 +  __ movptr(rdx, Address(rdx, 0));           // *obj
   1.143 +  __ shrptr(rax, 2);                         // offset
   1.144  
   1.145    assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
   1.146    speculative_load_pclist[count] = __ pc();
   1.147    switch (type) {
   1.148 +#ifndef _LP64
   1.149      case T_FLOAT:  __ fld_s (Address(rdx, rax, Address::times_1)); break;
   1.150      case T_DOUBLE: __ fld_d (Address(rdx, rax, Address::times_1)); break;
   1.151 +#else
   1.152 +    case T_FLOAT:  __ movflt (xmm0, Address(robj, roffset, Address::times_1)); break;
   1.153 +    case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break;
   1.154 +#endif // _LP64
   1.155      default:       ShouldNotReachHere();
   1.156    }
   1.157  
   1.158 @@ -301,8 +308,9 @@
   1.159      __ fst_s (Address(rsp, -4));
   1.160      __ lea(rdx, counter);
   1.161      __ movl (rax, Address(rsp, -4));
   1.162 -    __ xorl(rdx, rax);
   1.163 -    __ xorl(rdx, rax);
   1.164 +    // garbage hi-order bits on 64bit are harmless.
   1.165 +    __ xorptr(rdx, rax);
   1.166 +    __ xorptr(rdx, rax);
   1.167      __ cmp32(rcx, Address(rdx, 0));
   1.168                                            // rax, ^ counter_addr ^ rax, = address
   1.169                                            // ca1 is data dependent on the field

mercurial