src/share/vm/utilities/copy.hpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2008, 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 // Assembly code for platforms that need it.
  26 extern "C" {
  27   void _Copy_conjoint_words(HeapWord* from, HeapWord* to, size_t count);
  28   void _Copy_disjoint_words(HeapWord* from, HeapWord* to, size_t count);
  29 
  30   void _Copy_conjoint_words_atomic(HeapWord* from, HeapWord* to, size_t count);
  31   void _Copy_disjoint_words_atomic(HeapWord* from, HeapWord* to, size_t count);
  32 
  33   void _Copy_aligned_conjoint_words(HeapWord* from, HeapWord* to, size_t count);
  34   void _Copy_aligned_disjoint_words(HeapWord* from, HeapWord* to, size_t count);
  35 
  36   void _Copy_conjoint_bytes(void* from, void* to, size_t count);
  37 
  38   void _Copy_conjoint_bytes_atomic  (void*   from, void*   to, size_t count);
  39   void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count);
  40   void _Copy_conjoint_jints_atomic  (jint*   from, jint*   to, size_t count);
  41   void _Copy_conjoint_jlongs_atomic (jlong*  from, jlong*  to, size_t count);
  42   void _Copy_conjoint_oops_atomic   (oop*    from, oop*    to, size_t count);
  43 
  44   void _Copy_arrayof_conjoint_bytes  (HeapWord* from, HeapWord* to, size_t count);


 300       basic_fatal("not long aligned");
 301 #endif
 302   }
 303 
 304   static void assert_params_aligned(HeapWord* to) {
 305 #ifdef ASSERT
 306     if (mask_bits((uintptr_t)to, BytesPerLong-1) != 0)
 307       basic_fatal("not long aligned");
 308 #endif
 309   }
 310 
 311   static void assert_byte_count_ok(size_t byte_count, size_t unit_size) {
 312 #ifdef ASSERT
 313     if ((size_t)round_to(byte_count, unit_size) != byte_count) {
 314       basic_fatal("byte count must be aligned");
 315     }
 316 #endif
 317   }
 318 
 319   // Platform dependent implementations of the above methods.
 320   #include "incls/_copy_pd.hpp.incl"









 321 };


   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 SHARE_VM_UTILITIES_COPY_HPP
  26 #define SHARE_VM_UTILITIES_COPY_HPP
  27 
  28 #include "runtime/stubRoutines.hpp"
  29 
  30 // Assembly code for platforms that need it.
  31 extern "C" {
  32   void _Copy_conjoint_words(HeapWord* from, HeapWord* to, size_t count);
  33   void _Copy_disjoint_words(HeapWord* from, HeapWord* to, size_t count);
  34 
  35   void _Copy_conjoint_words_atomic(HeapWord* from, HeapWord* to, size_t count);
  36   void _Copy_disjoint_words_atomic(HeapWord* from, HeapWord* to, size_t count);
  37 
  38   void _Copy_aligned_conjoint_words(HeapWord* from, HeapWord* to, size_t count);
  39   void _Copy_aligned_disjoint_words(HeapWord* from, HeapWord* to, size_t count);
  40 
  41   void _Copy_conjoint_bytes(void* from, void* to, size_t count);
  42 
  43   void _Copy_conjoint_bytes_atomic  (void*   from, void*   to, size_t count);
  44   void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count);
  45   void _Copy_conjoint_jints_atomic  (jint*   from, jint*   to, size_t count);
  46   void _Copy_conjoint_jlongs_atomic (jlong*  from, jlong*  to, size_t count);
  47   void _Copy_conjoint_oops_atomic   (oop*    from, oop*    to, size_t count);
  48 
  49   void _Copy_arrayof_conjoint_bytes  (HeapWord* from, HeapWord* to, size_t count);


 305       basic_fatal("not long aligned");
 306 #endif
 307   }
 308 
 309   static void assert_params_aligned(HeapWord* to) {
 310 #ifdef ASSERT
 311     if (mask_bits((uintptr_t)to, BytesPerLong-1) != 0)
 312       basic_fatal("not long aligned");
 313 #endif
 314   }
 315 
 316   static void assert_byte_count_ok(size_t byte_count, size_t unit_size) {
 317 #ifdef ASSERT
 318     if ((size_t)round_to(byte_count, unit_size) != byte_count) {
 319       basic_fatal("byte count must be aligned");
 320     }
 321 #endif
 322   }
 323 
 324   // Platform dependent implementations of the above methods.
 325 #ifdef TARGET_ARCH_x86
 326 # include "copy_x86.hpp"
 327 #endif
 328 #ifdef TARGET_ARCH_sparc
 329 # include "copy_sparc.hpp"
 330 #endif
 331 #ifdef TARGET_ARCH_zero
 332 # include "copy_zero.hpp"
 333 #endif
 334 
 335 };
 336 
 337 #endif // SHARE_VM_UTILITIES_COPY_HPP