Print this page


Split Close
Expand all
Collapse all
          --- old/src/cpu/x86/vm/stubGenerator_x86_32.cpp
          +++ new/src/cpu/x86/vm/stubGenerator_x86_32.cpp
   1    1  /*
   2      - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
        2 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
   3    3   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4    4   *
   5    5   * This code is free software; you can redistribute it and/or modify it
   6    6   * under the terms of the GNU General Public License version 2 only, as
   7    7   * published by the Free Software Foundation.
   8    8   *
   9    9   * This code is distributed in the hope that it will be useful, but WITHOUT
  10   10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11   11   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12   12   * version 2 for more details (a copy is included in the LICENSE file that
↓ open down ↓ 935 lines elided ↑ open up ↑
 948  948      const Register count    = rcx;  // elements count
 949  949      const Register to_from  = to;   // (to - from)
 950  950      const Register saved_to = rdx;  // saved destination array address
 951  951  
 952  952      __ enter(); // required for proper stackwalking of RuntimeStub frame
 953  953      __ push(rsi);
 954  954      __ push(rdi);
 955  955      __ movptr(from , Address(rsp, 12+ 4));
 956  956      __ movptr(to   , Address(rsp, 12+ 8));
 957  957      __ movl(count, Address(rsp, 12+ 12));
      958 +
      959 +    if (entry != NULL) {
      960 +      *entry = __ pc(); // Entry point from conjoint arraycopy stub.
      961 +      BLOCK_COMMENT("Entry:");
      962 +    }
      963 +
 958  964      if (t == T_OBJECT) {
 959  965        __ testl(count, count);
 960  966        __ jcc(Assembler::zero, L_0_count);
 961  967        gen_write_ref_array_pre_barrier(to, count);
 962  968        __ mov(saved_to, to);          // save 'to'
 963  969      }
 964  970  
 965      -    *entry = __ pc(); // Entry point from conjoint arraycopy stub.
 966      -    BLOCK_COMMENT("Entry:");
 967      -
 968  971      __ subptr(to, from); // to --> to_from
 969  972      __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
 970  973      __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
 971  974      if (!UseUnalignedLoadStores && !aligned && (t == T_BYTE || t == T_SHORT)) {
 972  975        // align source address at 4 bytes address boundary
 973  976        if (t == T_BYTE) {
 974  977          // One byte misalignment happens only for byte arrays
 975  978          __ testl(from, 1);
 976  979          __ jccb(Assembler::zero, L_skip_align1);
 977  980          __ movb(rax, Address(from, 0));
↓ open down ↓ 133 lines elided ↑ open up ↑
1111 1114      const Register to    = rdi;  // destination array address
1112 1115      const Register count = rcx;  // elements count
1113 1116      const Register end   = rax;  // array end address
1114 1117  
1115 1118      __ enter(); // required for proper stackwalking of RuntimeStub frame
1116 1119      __ push(rsi);
1117 1120      __ push(rdi);
1118 1121      __ movptr(src  , Address(rsp, 12+ 4));   // from
1119 1122      __ movptr(dst  , Address(rsp, 12+ 8));   // to
1120 1123      __ movl2ptr(count, Address(rsp, 12+12)); // count
1121      -    if (t == T_OBJECT) {
1122      -       gen_write_ref_array_pre_barrier(dst, count);
1123      -    }
1124 1124  
1125 1125      if (entry != NULL) {
1126 1126        *entry = __ pc(); // Entry point from generic arraycopy stub.
1127 1127        BLOCK_COMMENT("Entry:");
1128 1128      }
1129 1129  
1130      -    if (t == T_OBJECT) {
1131      -      __ testl(count, count);
1132      -      __ jcc(Assembler::zero, L_0_count);
1133      -    }
     1130 +    // nooverlap_target expects arguments in rsi and rdi.
1134 1131      __ mov(from, src);
1135 1132      __ mov(to  , dst);
1136 1133  
1137      -    // arrays overlap test
     1134 +    // arrays overlap test: dispatch to disjoint stub if necessary.
1138 1135      RuntimeAddress nooverlap(nooverlap_target);
1139 1136      __ cmpptr(dst, src);
1140 1137      __ lea(end, Address(src, count, sf, 0)); // src + count * elem_size
1141 1138      __ jump_cc(Assembler::belowEqual, nooverlap);
1142 1139      __ cmpptr(dst, end);
1143 1140      __ jump_cc(Assembler::aboveEqual, nooverlap);
1144 1141  
     1142 +    if (t == T_OBJECT) {
     1143 +      __ testl(count, count);
     1144 +      __ jcc(Assembler::zero, L_0_count);
     1145 +       gen_write_ref_array_pre_barrier(dst, count);
     1146 +    }
     1147 +
1145 1148      // copy from high to low
1146 1149      __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
1147 1150      __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
1148 1151      if (t == T_BYTE || t == T_SHORT) {
1149 1152        // Align the end of destination array at 4 bytes address boundary
1150 1153        __ lea(end, Address(dst, count, sf, 0));
1151 1154        if (t == T_BYTE) {
1152 1155          // One byte misalignment happens only for byte arrays
1153 1156          __ testl(end, 1);
1154 1157          __ jccb(Assembler::zero, L_skip_align1);
↓ open down ↓ 299 lines elided ↑ open up ↑
1454 1457      Address     to_arg(rsp, 16+ 8);     // to
1455 1458      Address length_arg(rsp, 16+12);     // elements count
1456 1459      Address  ckoff_arg(rsp, 16+16);     // super_check_offset
1457 1460      Address  ckval_arg(rsp, 16+20);     // super_klass
1458 1461  
1459 1462      // Load up:
1460 1463      __ movptr(from,     from_arg);
1461 1464      __ movptr(to,         to_arg);
1462 1465      __ movl2ptr(length, length_arg);
1463 1466  
1464      -    *entry = __ pc(); // Entry point from generic arraycopy stub.
1465      -    BLOCK_COMMENT("Entry:");
     1467 +    if (entry != NULL) {
     1468 +      *entry = __ pc(); // Entry point from generic arraycopy stub.
     1469 +      BLOCK_COMMENT("Entry:");
     1470 +    }
1466 1471  
1467 1472      //---------------------------------------------------------------
1468 1473      // Assembler stub will be used for this call to arraycopy
1469 1474      // if the two arrays are subtypes of Object[] but the
1470 1475      // destination array type is not equal to or a supertype
1471 1476      // of the source type.  Each element must be separately
1472 1477      // checked.
1473 1478  
1474 1479      // Loop-invariant addresses.  They are exclusive end pointers.
1475 1480      Address end_from_addr(from, length, Address::times_ptr, 0);
↓ open down ↓ 875 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX