--- old/src/share/vm/runtime/stubRoutines.cpp 2017-04-25 16:45:54.403172427 +0200 +++ new/src/share/vm/runtime/stubRoutines.cpp 2017-04-25 16:45:54.291172431 +0200 @@ -26,6 +26,7 @@ #include "asm/codeBuffer.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" +#include "runtime/access.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/timerTrace.hpp" #include "runtime/sharedRuntime.hpp" @@ -376,21 +377,6 @@ // Default versions of arraycopy functions // -static void gen_arraycopy_barrier_pre(oop* dest, size_t count, bool dest_uninitialized) { - assert(count != 0, "count should be non-zero"); - assert(count <= (size_t)max_intx, "count too large"); - BarrierSet* bs = Universe::heap()->barrier_set(); - assert(bs->has_write_ref_array_pre_opt(), "Must have pre-barrier opt"); - bs->write_ref_array_pre(dest, (int)count, dest_uninitialized); -} - -static void gen_arraycopy_barrier(oop* dest, size_t count) { - assert(count != 0, "count should be non-zero"); - BarrierSet* bs = Universe::heap()->barrier_set(); - assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); - bs->write_ref_array((HeapWord*)dest, count); -} - JRT_LEAF(void, StubRoutines::jbyte_copy(jbyte* src, jbyte* dest, size_t count)) #ifndef PRODUCT SharedRuntime::_jbyte_array_copy_ctr++; // Slow-path byte array copy @@ -424,9 +410,7 @@ SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy #endif // !PRODUCT assert(count != 0, "count should be non-zero"); - gen_arraycopy_barrier_pre(dest, count, /*dest_uninitialized*/false); - Copy::conjoint_oops_atomic(src, dest, count); - gen_arraycopy_barrier(dest, count); + HeapAccess::oop_copy(NULL, NULL, (HeapWord*)src, (HeapWord*)dest, count); JRT_END JRT_LEAF(void, StubRoutines::oop_copy_uninit(oop* src, oop* dest, size_t count)) @@ -434,9 +418,7 @@ SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy #endif // !PRODUCT assert(count != 0, "count should be non-zero"); - gen_arraycopy_barrier_pre(dest, count, /*dest_uninitialized*/true); - Copy::conjoint_oops_atomic(src, dest, count); - gen_arraycopy_barrier(dest, count); + HeapAccess::oop_copy(NULL, NULL, (HeapWord*)src, (HeapWord*)dest, count); JRT_END JRT_LEAF(void, StubRoutines::arrayof_jbyte_copy(HeapWord* src, HeapWord* dest, size_t count)) @@ -472,9 +454,7 @@ SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy #endif // !PRODUCT assert(count != 0, "count should be non-zero"); - gen_arraycopy_barrier_pre((oop *) dest, count, /*dest_uninitialized*/false); - Copy::arrayof_conjoint_oops(src, dest, count); - gen_arraycopy_barrier((oop *) dest, count); + HeapAccess::oop_copy(NULL, NULL, src, dest, count); JRT_END JRT_LEAF(void, StubRoutines::arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count)) @@ -482,9 +462,7 @@ SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy #endif // !PRODUCT assert(count != 0, "count should be non-zero"); - gen_arraycopy_barrier_pre((oop *) dest, count, /*dest_uninitialized*/true); - Copy::arrayof_conjoint_oops(src, dest, count); - gen_arraycopy_barrier((oop *) dest, count); + HeapAccess::oop_copy(NULL, NULL, src, dest, count); JRT_END address StubRoutines::select_fill_function(BasicType t, bool aligned, const char* &name) {