src/os_cpu/linux_x86/vm/copy_linux_x86.inline.hpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2004, 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  *
  23  */
  24 



  25 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
  26 #ifdef AMD64
  27   (void)memmove(to, from, count * HeapWordSize);
  28 #else
  29   // Includes a zero-count check.
  30   intx temp;
  31   __asm__ volatile("        testl   %6,%6         ;"
  32                    "        jz      7f            ;"
  33                    "        cmpl    %4,%5         ;"
  34                    "        leal    -4(%4,%6,4),%3;"
  35                    "        jbe     1f            ;"
  36                    "        cmpl    %7,%5         ;"
  37                    "        jbe     4f            ;"
  38                    "1:      cmpl    $32,%6        ;"
  39                    "        ja      3f            ;"
  40                    "        subl    %4,%1         ;"
  41                    "2:      movl    (%4),%3       ;"
  42                    "        movl    %7,(%5,%4,1)  ;"
  43                    "        addl    $4,%0         ;"
  44                    "        subl    $1,%2          ;"


 285   pd_conjoint_jints_atomic((jint*)from, (jint*)to, count);
 286 #endif // AMD64
 287 }
 288 
 289 static void pd_arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) {
 290 #ifdef AMD64
 291   _Copy_arrayof_conjoint_jlongs(from, to, count);
 292 #else
 293   pd_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
 294 #endif // AMD64
 295 }
 296 
 297 static void pd_arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) {
 298 #ifdef AMD64
 299   assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
 300   _Copy_arrayof_conjoint_jlongs(from, to, count);
 301 #else
 302   pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
 303 #endif // AMD64
 304 }


   1 /*
   2  * Copyright (c) 2003, 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  *
  23  */
  24 
  25 #ifndef OS_CPU_LINUX_X86_VM_COPY_LINUX_X86_INLINE_HPP
  26 #define OS_CPU_LINUX_X86_VM_COPY_LINUX_X86_INLINE_HPP
  27 
  28 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
  29 #ifdef AMD64
  30   (void)memmove(to, from, count * HeapWordSize);
  31 #else
  32   // Includes a zero-count check.
  33   intx temp;
  34   __asm__ volatile("        testl   %6,%6         ;"
  35                    "        jz      7f            ;"
  36                    "        cmpl    %4,%5         ;"
  37                    "        leal    -4(%4,%6,4),%3;"
  38                    "        jbe     1f            ;"
  39                    "        cmpl    %7,%5         ;"
  40                    "        jbe     4f            ;"
  41                    "1:      cmpl    $32,%6        ;"
  42                    "        ja      3f            ;"
  43                    "        subl    %4,%1         ;"
  44                    "2:      movl    (%4),%3       ;"
  45                    "        movl    %7,(%5,%4,1)  ;"
  46                    "        addl    $4,%0         ;"
  47                    "        subl    $1,%2          ;"


 288   pd_conjoint_jints_atomic((jint*)from, (jint*)to, count);
 289 #endif // AMD64
 290 }
 291 
 292 static void pd_arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) {
 293 #ifdef AMD64
 294   _Copy_arrayof_conjoint_jlongs(from, to, count);
 295 #else
 296   pd_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
 297 #endif // AMD64
 298 }
 299 
 300 static void pd_arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) {
 301 #ifdef AMD64
 302   assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
 303   _Copy_arrayof_conjoint_jlongs(from, to, count);
 304 #else
 305   pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
 306 #endif // AMD64
 307 }
 308 
 309 #endif // OS_CPU_LINUX_X86_VM_COPY_LINUX_X86_INLINE_HPP