copy.hpp revision 2273
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_UTILITIES_COPY_HPP
#define SHARE_VM_UTILITIES_COPY_HPP
#include "runtime/stubRoutines.hpp"
// Assembly code for platforms that need it.
extern "C" {
}
public:
// Block copy methods have four attributes. We don't define all possibilities.
// alignment: aligned to BytesPerLong
// arrayof: arraycopy operation with both operands aligned on the same
// boundary as the first element of an array of the copy unit.
// This is currently a HeapWord boundary on all platforms, except
// for long and double arrays, which are aligned on an 8-byte
// boundary on all platforms.
// arraycopy operations are implicitly atomic on each array element.
// overlap: disjoint or conjoint.
// copy unit: bytes or words (i.e., HeapWords) or oops (i.e., pointers).
// atomicity: atomic or non-atomic on the copy unit.
//
// Names are constructed thusly:
//
// [ 'aligned_' | 'arrayof_' ]
// ('conjoint_' | 'disjoint_')
// ('words' | 'bytes' | 'jshorts' | 'jints' | 'jlongs' | 'oops')
// [ '_atomic' ]
//
// Except in the arrayof case, whatever the alignment is, we assume we can copy
// whole alignment units. E.g., if BytesPerLong is 2x word alignment, an odd
// count may copy an extra word. In the arrayof case, we are allowed to copy
// only the number of copy units specified.
//
// All callees check count for 0.
//
// HeapWords
// Word-aligned words, conjoint, not atomic on each word
}
// Word-aligned words, disjoint, not atomic on each word
}
// Word-aligned words, disjoint, atomic on each word
}
// Object-aligned words, conjoint, not atomic on each word
}
// Object-aligned words, disjoint, not atomic on each word
}
// bytes, jshorts, jints, jlongs, oops
// bytes, conjoint, not atomic on each byte (not that it matters)
}
// bytes, conjoint, atomic on each byte (not that it matters)
}
// jshorts, conjoint, atomic on each jshort
}
// jints, conjoint, atomic on each jint
}
// jlongs, conjoint, atomic on each jlong
}
// oops, conjoint, atomic on each oop
}
// overloaded for UseCompressedOops
}
// Copy a span of memory. If the span is an integral number of aligned
// longs, words, or ints, copy those units atomically.
// The largest atomic transfer unit is 8 bytes, or the largest power
// of two which divides all of from, to, and size, whichever is smaller.
// bytes, conjoint array, atomic on each byte (not that it matters)
}
// jshorts, conjoint array, atomic on each jshort
}
// jints, conjoint array, atomic on each jint
}
// jlongs, conjoint array, atomic on each jlong
}
// oops, conjoint array, atomic on each oop
}
// Known overlap methods
// Copy word-aligned words from higher to lower addresses, not atomic on each word
// byte_count is in bytes to check its alignment
while (count-- > 0) {
}
}
// Copy word-aligned words from lower to higher addresses, not atomic on each word
// byte_count is in bytes to check its alignment
while (count-- > 0) {
}
}
// Fill methods
// Fill word-aligned words, not atomic on each word
// set_words
}
}
// Fill bytes
}
// Fill a span of memory. If the span is an integral number of aligned
// longs, words, or ints, store to those units atomically.
// The largest atomic transfer unit is 8 bytes, or the largest power
// of two which divides both to and size, whichever is smaller.
// Zero-fill methods
// Zero word-aligned words, not atomic on each word
}
// Zero bytes
}
private:
}
}
// These methods raise a fatal if they detect a problem.
#ifdef ASSERT
basic_fatal("source and dest overlap");
#endif
}
#ifdef ASSERT
basic_fatal("not aligned");
basic_fatal("not aligned");
#endif
}
#ifdef ASSERT
basic_fatal("not word aligned");
#endif
}
#ifdef ASSERT
basic_fatal("not long aligned");
basic_fatal("not long aligned");
#endif
}
#ifdef ASSERT
basic_fatal("not long aligned");
#endif
}
#ifdef ASSERT
basic_fatal("byte count must be aligned");
}
#endif
}
// Platform dependent implementations of the above methods.
#ifdef TARGET_ARCH_x86
# include "copy_x86.hpp"
#endif
#ifdef TARGET_ARCH_sparc
# include "copy_sparc.hpp"
#endif
#ifdef TARGET_ARCH_zero
# include "copy_zero.hpp"
#endif
#ifdef TARGET_ARCH_arm
# include "copy_arm.hpp"
#endif
#ifdef TARGET_ARCH_ppc
# include "copy_ppc.hpp"
#endif
};
#endif // SHARE_VM_UTILITIES_COPY_HPP