hotspot/src/share/vm/utilities/copy.hpp
changeset 5694 1e0532a6abff
parent 670 ddf3e9583f2f
child 5702 201c5cde25bb
equal deleted inserted replaced
5693:3015c564fcbc 5694:1e0532a6abff
    49 }
    49 }
    50 
    50 
    51 class Copy : AllStatic {
    51 class Copy : AllStatic {
    52  public:
    52  public:
    53   // Block copy methods have four attributes.  We don't define all possibilities.
    53   // Block copy methods have four attributes.  We don't define all possibilities.
    54   //   alignment: aligned according to minimum Java object alignment (MinObjAlignment)
    54   //   alignment: aligned to BytesPerLong
    55   //   arrayof:   arraycopy operation with both operands aligned on the same
    55   //   arrayof:   arraycopy operation with both operands aligned on the same
    56   //              boundary as the first element of an array of the copy unit.
    56   //              boundary as the first element of an array of the copy unit.
    57   //              This is currently a HeapWord boundary on all platforms, except
    57   //              This is currently a HeapWord boundary on all platforms, except
    58   //              for long and double arrays, which are aligned on an 8-byte
    58   //              for long and double arrays, which are aligned on an 8-byte
    59   //              boundary on all platforms.
    59   //              boundary on all platforms.
    68   //     ('conjoint_' | 'disjoint_')
    68   //     ('conjoint_' | 'disjoint_')
    69   //     ('words' | 'bytes' | 'jshorts' | 'jints' | 'jlongs' | 'oops')
    69   //     ('words' | 'bytes' | 'jshorts' | 'jints' | 'jlongs' | 'oops')
    70   //     [ '_atomic' ]
    70   //     [ '_atomic' ]
    71   //
    71   //
    72   // Except in the arrayof case, whatever the alignment is, we assume we can copy
    72   // Except in the arrayof case, whatever the alignment is, we assume we can copy
    73   // whole alignment units.  E.g., if MinObjAlignment is 2x word alignment, an odd
    73   // whole alignment units.  E.g., if BytesPerLong is 2x word alignment, an odd
    74   // count may copy an extra word.  In the arrayof case, we are allowed to copy
    74   // count may copy an extra word.  In the arrayof case, we are allowed to copy
    75   // only the number of copy units specified.
    75   // only the number of copy units specified.
    76 
    76 
    77   // HeapWords
    77   // HeapWords
    78 
    78 
   303       basic_fatal("not word aligned");
   303       basic_fatal("not word aligned");
   304 #endif
   304 #endif
   305   }
   305   }
   306   static void assert_params_aligned(HeapWord* from, HeapWord* to) {
   306   static void assert_params_aligned(HeapWord* from, HeapWord* to) {
   307 #ifdef ASSERT
   307 #ifdef ASSERT
   308     if (mask_bits((uintptr_t)from, MinObjAlignmentInBytes-1) != 0)
   308     if (mask_bits((uintptr_t)from, BytesPerLong-1) != 0)
   309       basic_fatal("not object aligned");
   309       basic_fatal("not long aligned");
   310     if (mask_bits((uintptr_t)to, MinObjAlignmentInBytes-1) != 0)
   310     if (mask_bits((uintptr_t)to, BytesPerLong-1) != 0)
   311       basic_fatal("not object aligned");
   311       basic_fatal("not long aligned");
   312 #endif
   312 #endif
   313   }
   313   }
   314 
   314 
   315   static void assert_params_aligned(HeapWord* to) {
   315   static void assert_params_aligned(HeapWord* to) {
   316 #ifdef ASSERT
   316 #ifdef ASSERT
   317     if (mask_bits((uintptr_t)to, MinObjAlignmentInBytes-1) != 0)
   317     if (mask_bits((uintptr_t)to, BytesPerLong-1) != 0)
   318       basic_fatal("not object aligned");
   318       basic_fatal("not long aligned");
   319 #endif
   319 #endif
   320   }
   320   }
   321 
   321 
   322   static void assert_non_zero(size_t count) {
   322   static void assert_non_zero(size_t count) {
   323 #ifdef ASSERT
   323 #ifdef ASSERT