6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86

Modify assembler code to check for 0 count for all copy routines.

Reviewed-by: never, ysr, jcoomes
This commit is contained in:
Vladimir Kozlov 2010-06-10 13:04:20 -07:00
parent 1f4cfb029b
commit 9c7b430e11
11 changed files with 89 additions and 144 deletions

View file

@ -73,6 +73,9 @@ class Copy : AllStatic {
// 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
@ -99,7 +102,6 @@ class Copy : AllStatic {
// Object-aligned words, conjoint, not atomic on each word
static void aligned_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
assert_params_aligned(from, to);
assert_non_zero(count);
pd_aligned_conjoint_words(from, to, count);
}
@ -107,49 +109,42 @@ class Copy : AllStatic {
static void aligned_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
assert_params_aligned(from, to);
assert_disjoint(from, to, count);
assert_non_zero(count);
pd_aligned_disjoint_words(from, to, count);
}
// bytes, jshorts, jints, jlongs, oops
// bytes, conjoint, not atomic on each byte (not that it matters)
static void conjoint_bytes(void* from, void* to, size_t count) {
assert_non_zero(count);
static void conjoint_jbytes(void* from, void* to, size_t count) {
pd_conjoint_bytes(from, to, count);
}
// bytes, conjoint, atomic on each byte (not that it matters)
static void conjoint_bytes_atomic(void* from, void* to, size_t count) {
assert_non_zero(count);
static void conjoint_jbytes_atomic(void* from, void* to, size_t count) {
pd_conjoint_bytes(from, to, count);
}
// jshorts, conjoint, atomic on each jshort
static void conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
assert_params_ok(from, to, LogBytesPerShort);
assert_non_zero(count);
pd_conjoint_jshorts_atomic(from, to, count);
}
// jints, conjoint, atomic on each jint
static void conjoint_jints_atomic(jint* from, jint* to, size_t count) {
assert_params_ok(from, to, LogBytesPerInt);
assert_non_zero(count);
pd_conjoint_jints_atomic(from, to, count);
}
// jlongs, conjoint, atomic on each jlong
static void conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
assert_params_ok(from, to, LogBytesPerLong);
assert_non_zero(count);
pd_conjoint_jlongs_atomic(from, to, count);
}
// oops, conjoint, atomic on each oop
static void conjoint_oops_atomic(oop* from, oop* to, size_t count) {
assert_params_ok(from, to, LogBytesPerHeapOop);
assert_non_zero(count);
pd_conjoint_oops_atomic(from, to, count);
}
@ -157,7 +152,6 @@ class Copy : AllStatic {
static void conjoint_oops_atomic(narrowOop* from, narrowOop* to, size_t count) {
assert(sizeof(narrowOop) == sizeof(jint), "this cast is wrong");
assert_params_ok(from, to, LogBytesPerInt);
assert_non_zero(count);
pd_conjoint_jints_atomic((jint*)from, (jint*)to, count);
}
@ -168,36 +162,31 @@ class Copy : AllStatic {
static void conjoint_memory_atomic(void* from, void* to, size_t size);
// bytes, conjoint array, atomic on each byte (not that it matters)
static void arrayof_conjoint_bytes(HeapWord* from, HeapWord* to, size_t count) {
assert_non_zero(count);
static void arrayof_conjoint_jbytes(HeapWord* from, HeapWord* to, size_t count) {
pd_arrayof_conjoint_bytes(from, to, count);
}
// jshorts, conjoint array, atomic on each jshort
static void arrayof_conjoint_jshorts(HeapWord* from, HeapWord* to, size_t count) {
assert_params_ok(from, to, LogBytesPerShort);
assert_non_zero(count);
pd_arrayof_conjoint_jshorts(from, to, count);
}
// jints, conjoint array, atomic on each jint
static void arrayof_conjoint_jints(HeapWord* from, HeapWord* to, size_t count) {
assert_params_ok(from, to, LogBytesPerInt);
assert_non_zero(count);
pd_arrayof_conjoint_jints(from, to, count);
}
// jlongs, conjoint array, atomic on each jlong
static void arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) {
assert_params_ok(from, to, LogBytesPerLong);
assert_non_zero(count);
pd_arrayof_conjoint_jlongs(from, to, count);
}
// oops, conjoint array, atomic on each oop
static void arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) {
assert_params_ok(from, to, LogBytesPerHeapOop);
assert_non_zero(count);
pd_arrayof_conjoint_oops(from, to, count);
}
@ -319,14 +308,6 @@ class Copy : AllStatic {
#endif
}
static void assert_non_zero(size_t count) {
#ifdef ASSERT
if (count == 0) {
basic_fatal("count must be non-zero");
}
#endif
}
static void assert_byte_count_ok(size_t byte_count, size_t unit_size) {
#ifdef ASSERT
if ((size_t)round_to(byte_count, unit_size) != byte_count) {