src/cpu/x86/vm/stubGenerator_x86_32.cpp

changeset 2595
d89a22843c62
parent 2552
638119ce7cfd
child 2603
1b4e6a5d98e0
     1.1 --- a/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Wed Feb 09 15:02:23 2011 -0800
     1.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Tue Feb 22 15:25:02 2011 -0800
     1.3 @@ -945,6 +945,12 @@
     1.4      __ movptr(from , Address(rsp, 12+ 4));
     1.5      __ movptr(to   , Address(rsp, 12+ 8));
     1.6      __ movl(count, Address(rsp, 12+ 12));
     1.7 +
     1.8 +    if (entry != NULL) {
     1.9 +      *entry = __ pc(); // Entry point from conjoint arraycopy stub.
    1.10 +      BLOCK_COMMENT("Entry:");
    1.11 +    }
    1.12 +
    1.13      if (t == T_OBJECT) {
    1.14        __ testl(count, count);
    1.15        __ jcc(Assembler::zero, L_0_count);
    1.16 @@ -952,9 +958,6 @@
    1.17        __ mov(saved_to, to);          // save 'to'
    1.18      }
    1.19  
    1.20 -    *entry = __ pc(); // Entry point from conjoint arraycopy stub.
    1.21 -    BLOCK_COMMENT("Entry:");
    1.22 -
    1.23      __ subptr(to, from); // to --> to_from
    1.24      __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
    1.25      __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
    1.26 @@ -1108,23 +1111,17 @@
    1.27      __ movptr(src  , Address(rsp, 12+ 4));   // from
    1.28      __ movptr(dst  , Address(rsp, 12+ 8));   // to
    1.29      __ movl2ptr(count, Address(rsp, 12+12)); // count
    1.30 -    if (t == T_OBJECT) {
    1.31 -       gen_write_ref_array_pre_barrier(dst, count);
    1.32 -    }
    1.33  
    1.34      if (entry != NULL) {
    1.35        *entry = __ pc(); // Entry point from generic arraycopy stub.
    1.36        BLOCK_COMMENT("Entry:");
    1.37      }
    1.38  
    1.39 -    if (t == T_OBJECT) {
    1.40 -      __ testl(count, count);
    1.41 -      __ jcc(Assembler::zero, L_0_count);
    1.42 -    }
    1.43 +    // nooverlap_target expects arguments in rsi and rdi.
    1.44      __ mov(from, src);
    1.45      __ mov(to  , dst);
    1.46  
    1.47 -    // arrays overlap test
    1.48 +    // arrays overlap test: dispatch to disjoint stub if necessary.
    1.49      RuntimeAddress nooverlap(nooverlap_target);
    1.50      __ cmpptr(dst, src);
    1.51      __ lea(end, Address(src, count, sf, 0)); // src + count * elem_size
    1.52 @@ -1132,6 +1129,12 @@
    1.53      __ cmpptr(dst, end);
    1.54      __ jump_cc(Assembler::aboveEqual, nooverlap);
    1.55  
    1.56 +    if (t == T_OBJECT) {
    1.57 +      __ testl(count, count);
    1.58 +      __ jcc(Assembler::zero, L_0_count);
    1.59 +       gen_write_ref_array_pre_barrier(dst, count);
    1.60 +    }
    1.61 +
    1.62      // copy from high to low
    1.63      __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
    1.64      __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
    1.65 @@ -1451,8 +1454,10 @@
    1.66      __ movptr(to,         to_arg);
    1.67      __ movl2ptr(length, length_arg);
    1.68  
    1.69 -    *entry = __ pc(); // Entry point from generic arraycopy stub.
    1.70 -    BLOCK_COMMENT("Entry:");
    1.71 +    if (entry != NULL) {
    1.72 +      *entry = __ pc(); // Entry point from generic arraycopy stub.
    1.73 +      BLOCK_COMMENT("Entry:");
    1.74 +    }
    1.75  
    1.76      //---------------------------------------------------------------
    1.77      // Assembler stub will be used for this call to arraycopy

mercurial