src/cpu/x86/vm/stubGenerator_x86_64.cpp

changeset 3314
59bc0d4d9ea3
parent 3310
6729bbc1fcd6
child 3372
dca455dea3a7
child 3391
069ab3f976d3
     1.1 --- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Thu Nov 17 04:07:30 2011 -0800
     1.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Fri Nov 18 10:29:27 2011 -0800
     1.3 @@ -95,6 +95,7 @@
     1.4  #define inc_counter_np(counter) (0)
     1.5  #else
     1.6    void inc_counter_np_(int& counter) {
     1.7 +    // This can destroy rscratch1 if counter is far from the code cache
     1.8      __ incrementl(ExternalAddress((address)&counter));
     1.9    }
    1.10  #define inc_counter_np(counter) \
    1.11 @@ -1466,8 +1467,8 @@
    1.12      __ movb(Address(end_to, 8), rax);
    1.13  
    1.14    __ BIND(L_exit);
    1.15 -    inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr);
    1.16      restore_arg_regs();
    1.17 +    inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); // Update counter after rscratch1 is free
    1.18      __ xorptr(rax, rax); // return 0
    1.19      __ leave(); // required for proper stackwalking of RuntimeStub frame
    1.20      __ ret(0);
    1.21 @@ -1555,8 +1556,8 @@
    1.22      __ decrement(qword_count);
    1.23      __ jcc(Assembler::notZero, L_copy_8_bytes);
    1.24  
    1.25 -    inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr);
    1.26      restore_arg_regs();
    1.27 +    inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); // Update counter after rscratch1 is free
    1.28      __ xorptr(rax, rax); // return 0
    1.29      __ leave(); // required for proper stackwalking of RuntimeStub frame
    1.30      __ ret(0);
    1.31 @@ -1564,8 +1565,8 @@
    1.32      // Copy in 32-bytes chunks
    1.33      copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
    1.34  
    1.35 -    inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr);
    1.36      restore_arg_regs();
    1.37 +    inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); // Update counter after rscratch1 is free
    1.38      __ xorptr(rax, rax); // return 0
    1.39      __ leave(); // required for proper stackwalking of RuntimeStub frame
    1.40      __ ret(0);
    1.41 @@ -1658,8 +1659,8 @@
    1.42      __ movw(Address(end_to, 8), rax);
    1.43  
    1.44    __ BIND(L_exit);
    1.45 -    inc_counter_np(SharedRuntime::_jshort_array_copy_ctr);
    1.46      restore_arg_regs();
    1.47 +    inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); // Update counter after rscratch1 is free
    1.48      __ xorptr(rax, rax); // return 0
    1.49      __ leave(); // required for proper stackwalking of RuntimeStub frame
    1.50      __ ret(0);
    1.51 @@ -1759,8 +1760,8 @@
    1.52      __ decrement(qword_count);
    1.53      __ jcc(Assembler::notZero, L_copy_8_bytes);
    1.54  
    1.55 -    inc_counter_np(SharedRuntime::_jshort_array_copy_ctr);
    1.56      restore_arg_regs();
    1.57 +    inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); // Update counter after rscratch1 is free
    1.58      __ xorptr(rax, rax); // return 0
    1.59      __ leave(); // required for proper stackwalking of RuntimeStub frame
    1.60      __ ret(0);
    1.61 @@ -1768,8 +1769,8 @@
    1.62      // Copy in 32-bytes chunks
    1.63      copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
    1.64  
    1.65 -    inc_counter_np(SharedRuntime::_jshort_array_copy_ctr);
    1.66      restore_arg_regs();
    1.67 +    inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); // Update counter after rscratch1 is free
    1.68      __ xorptr(rax, rax); // return 0
    1.69      __ leave(); // required for proper stackwalking of RuntimeStub frame
    1.70      __ ret(0);
    1.71 @@ -1859,8 +1860,8 @@
    1.72        __ leaq(end_to, Address(saved_to, dword_count, Address::times_4, -4));
    1.73        gen_write_ref_array_post_barrier(saved_to, end_to, rax);
    1.74      }
    1.75 -    inc_counter_np(SharedRuntime::_jint_array_copy_ctr);
    1.76      restore_arg_regs();
    1.77 +    inc_counter_np(SharedRuntime::_jint_array_copy_ctr); // Update counter after rscratch1 is free
    1.78      __ xorptr(rax, rax); // return 0
    1.79      __ leave(); // required for proper stackwalking of RuntimeStub frame
    1.80      __ ret(0);
    1.81 @@ -1940,11 +1941,11 @@
    1.82      __ decrement(qword_count);
    1.83      __ jcc(Assembler::notZero, L_copy_8_bytes);
    1.84  
    1.85 -    inc_counter_np(SharedRuntime::_jint_array_copy_ctr);
    1.86      if (is_oop) {
    1.87        __ jmp(L_exit);
    1.88      }
    1.89      restore_arg_regs();
    1.90 +    inc_counter_np(SharedRuntime::_jint_array_copy_ctr); // Update counter after rscratch1 is free
    1.91      __ xorptr(rax, rax); // return 0
    1.92      __ leave(); // required for proper stackwalking of RuntimeStub frame
    1.93      __ ret(0);
    1.94 @@ -1952,7 +1953,6 @@
    1.95      // Copy in 32-bytes chunks
    1.96      copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
    1.97  
    1.98 -   inc_counter_np(SharedRuntime::_jint_array_copy_ctr);
    1.99     __ bind(L_exit);
   1.100       if (is_oop) {
   1.101         Register end_to = rdx;
   1.102 @@ -1960,6 +1960,7 @@
   1.103         gen_write_ref_array_post_barrier(to, end_to, rax);
   1.104       }
   1.105      restore_arg_regs();
   1.106 +    inc_counter_np(SharedRuntime::_jint_array_copy_ctr); // Update counter after rscratch1 is free
   1.107      __ xorptr(rax, rax); // return 0
   1.108      __ leave(); // required for proper stackwalking of RuntimeStub frame
   1.109      __ ret(0);
   1.110 @@ -2032,8 +2033,8 @@
   1.111      if (is_oop) {
   1.112        __ jmp(L_exit);
   1.113      } else {
   1.114 -      inc_counter_np(SharedRuntime::_jlong_array_copy_ctr);
   1.115        restore_arg_regs();
   1.116 +      inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); // Update counter after rscratch1 is free
   1.117        __ xorptr(rax, rax); // return 0
   1.118        __ leave(); // required for proper stackwalking of RuntimeStub frame
   1.119        __ ret(0);
   1.120 @@ -2045,11 +2046,13 @@
   1.121      if (is_oop) {
   1.122      __ BIND(L_exit);
   1.123        gen_write_ref_array_post_barrier(saved_to, end_to, rax);
   1.124 -      inc_counter_np(SharedRuntime::_oop_array_copy_ctr);
   1.125 -    } else {
   1.126 -      inc_counter_np(SharedRuntime::_jlong_array_copy_ctr);
   1.127      }
   1.128      restore_arg_regs();
   1.129 +    if (is_oop) {
   1.130 +      inc_counter_np(SharedRuntime::_oop_array_copy_ctr); // Update counter after rscratch1 is free
   1.131 +    } else {
   1.132 +      inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); // Update counter after rscratch1 is free
   1.133 +    }
   1.134      __ xorptr(rax, rax); // return 0
   1.135      __ leave(); // required for proper stackwalking of RuntimeStub frame
   1.136      __ ret(0);
   1.137 @@ -2113,8 +2116,8 @@
   1.138      if (is_oop) {
   1.139        __ jmp(L_exit);
   1.140      } else {
   1.141 -      inc_counter_np(SharedRuntime::_jlong_array_copy_ctr);
   1.142        restore_arg_regs();
   1.143 +      inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); // Update counter after rscratch1 is free
   1.144        __ xorptr(rax, rax); // return 0
   1.145        __ leave(); // required for proper stackwalking of RuntimeStub frame
   1.146        __ ret(0);
   1.147 @@ -2127,11 +2130,13 @@
   1.148      __ BIND(L_exit);
   1.149        __ lea(rcx, Address(to, saved_count, Address::times_8, -8));
   1.150        gen_write_ref_array_post_barrier(to, rcx, rax);
   1.151 -      inc_counter_np(SharedRuntime::_oop_array_copy_ctr);
   1.152 -    } else {
   1.153 -      inc_counter_np(SharedRuntime::_jlong_array_copy_ctr);
   1.154      }
   1.155      restore_arg_regs();
   1.156 +    if (is_oop) {
   1.157 +      inc_counter_np(SharedRuntime::_oop_array_copy_ctr); // Update counter after rscratch1 is free
   1.158 +    } else {
   1.159 +      inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); // Update counter after rscratch1 is free
   1.160 +    }
   1.161      __ xorptr(rax, rax); // return 0
   1.162      __ leave(); // required for proper stackwalking of RuntimeStub frame
   1.163      __ ret(0);
   1.164 @@ -2331,8 +2336,8 @@
   1.165      __ BIND(L_done);
   1.166      __ movptr(r13, Address(rsp, saved_r13_offset * wordSize));
   1.167      __ movptr(r14, Address(rsp, saved_r14_offset * wordSize));
   1.168 -    inc_counter_np(SharedRuntime::_checkcast_array_copy_ctr);
   1.169      restore_arg_regs();
   1.170 +    inc_counter_np(SharedRuntime::_checkcast_array_copy_ctr); // Update counter after rscratch1 is free
   1.171      __ leave(); // required for proper stackwalking of RuntimeStub frame
   1.172      __ ret(0);
   1.173  

mercurial