src/hotspot/share/runtime/stubRoutines.cpp
changeset 47998 fb0275c320a0
parent 47658 c2b7fb8e5144
child 48468 7cc7de9bf4a4
equal deleted inserted replaced
47997:55c43e677ded 47998:fb0275c320a0
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "asm/codeBuffer.hpp"
    26 #include "asm/codeBuffer.hpp"
    27 #include "memory/resourceArea.hpp"
    27 #include "memory/resourceArea.hpp"
       
    28 #include "oops/access.inline.hpp"
    28 #include "oops/oop.inline.hpp"
    29 #include "oops/oop.inline.hpp"
    29 #include "runtime/interfaceSupport.hpp"
    30 #include "runtime/interfaceSupport.hpp"
    30 #include "runtime/timerTrace.hpp"
    31 #include "runtime/timerTrace.hpp"
    31 #include "runtime/sharedRuntime.hpp"
    32 #include "runtime/sharedRuntime.hpp"
    32 #include "runtime/stubRoutines.hpp"
    33 #include "runtime/stubRoutines.hpp"
   375 
   376 
   376 //
   377 //
   377 // Default versions of arraycopy functions
   378 // Default versions of arraycopy functions
   378 //
   379 //
   379 
   380 
   380 static void gen_arraycopy_barrier_pre(oop* dest, size_t count, bool dest_uninitialized) {
       
   381     assert(count != 0, "count should be non-zero");
       
   382     assert(count <= (size_t)max_intx, "count too large");
       
   383     BarrierSet* bs = Universe::heap()->barrier_set();
       
   384     bs->write_ref_array_pre(dest, (int)count, dest_uninitialized);
       
   385 }
       
   386 
       
   387 static void gen_arraycopy_barrier(oop* dest, size_t count) {
       
   388     assert(count != 0, "count should be non-zero");
       
   389     BarrierSet* bs = Universe::heap()->barrier_set();
       
   390     bs->write_ref_array((HeapWord*)dest, count);
       
   391 }
       
   392 
       
   393 JRT_LEAF(void, StubRoutines::jbyte_copy(jbyte* src, jbyte* dest, size_t count))
   381 JRT_LEAF(void, StubRoutines::jbyte_copy(jbyte* src, jbyte* dest, size_t count))
   394 #ifndef PRODUCT
   382 #ifndef PRODUCT
   395   SharedRuntime::_jbyte_array_copy_ctr++;      // Slow-path byte array copy
   383   SharedRuntime::_jbyte_array_copy_ctr++;      // Slow-path byte array copy
   396 #endif // !PRODUCT
   384 #endif // !PRODUCT
   397   Copy::conjoint_jbytes_atomic(src, dest, count);
   385   Copy::conjoint_jbytes_atomic(src, dest, count);
   421 JRT_LEAF(void, StubRoutines::oop_copy(oop* src, oop* dest, size_t count))
   409 JRT_LEAF(void, StubRoutines::oop_copy(oop* src, oop* dest, size_t count))
   422 #ifndef PRODUCT
   410 #ifndef PRODUCT
   423   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
   411   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
   424 #endif // !PRODUCT
   412 #endif // !PRODUCT
   425   assert(count != 0, "count should be non-zero");
   413   assert(count != 0, "count should be non-zero");
   426   gen_arraycopy_barrier_pre(dest, count, /*dest_uninitialized*/false);
   414   HeapAccess<>::oop_arraycopy(NULL, NULL, (HeapWord*)src, (HeapWord*)dest, count);
   427   Copy::conjoint_oops_atomic(src, dest, count);
       
   428   gen_arraycopy_barrier(dest, count);
       
   429 JRT_END
   415 JRT_END
   430 
   416 
   431 JRT_LEAF(void, StubRoutines::oop_copy_uninit(oop* src, oop* dest, size_t count))
   417 JRT_LEAF(void, StubRoutines::oop_copy_uninit(oop* src, oop* dest, size_t count))
   432 #ifndef PRODUCT
   418 #ifndef PRODUCT
   433   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
   419   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
   434 #endif // !PRODUCT
   420 #endif // !PRODUCT
   435   assert(count != 0, "count should be non-zero");
   421   assert(count != 0, "count should be non-zero");
   436   gen_arraycopy_barrier_pre(dest, count, /*dest_uninitialized*/true);
   422   HeapAccess<ARRAYCOPY_DEST_NOT_INITIALIZED>::oop_arraycopy(NULL, NULL, (HeapWord*)src, (HeapWord*)dest, count);
   437   Copy::conjoint_oops_atomic(src, dest, count);
       
   438   gen_arraycopy_barrier(dest, count);
       
   439 JRT_END
   423 JRT_END
   440 
   424 
   441 JRT_LEAF(void, StubRoutines::arrayof_jbyte_copy(HeapWord* src, HeapWord* dest, size_t count))
   425 JRT_LEAF(void, StubRoutines::arrayof_jbyte_copy(HeapWord* src, HeapWord* dest, size_t count))
   442 #ifndef PRODUCT
   426 #ifndef PRODUCT
   443   SharedRuntime::_jbyte_array_copy_ctr++;      // Slow-path byte array copy
   427   SharedRuntime::_jbyte_array_copy_ctr++;      // Slow-path byte array copy
   469 JRT_LEAF(void, StubRoutines::arrayof_oop_copy(HeapWord* src, HeapWord* dest, size_t count))
   453 JRT_LEAF(void, StubRoutines::arrayof_oop_copy(HeapWord* src, HeapWord* dest, size_t count))
   470 #ifndef PRODUCT
   454 #ifndef PRODUCT
   471   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
   455   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
   472 #endif // !PRODUCT
   456 #endif // !PRODUCT
   473   assert(count != 0, "count should be non-zero");
   457   assert(count != 0, "count should be non-zero");
   474   gen_arraycopy_barrier_pre((oop *) dest, count, /*dest_uninitialized*/false);
   458   HeapAccess<ARRAYCOPY_ARRAYOF>::oop_arraycopy(NULL, NULL, src, dest, count);
   475   Copy::arrayof_conjoint_oops(src, dest, count);
       
   476   gen_arraycopy_barrier((oop *) dest, count);
       
   477 JRT_END
   459 JRT_END
   478 
   460 
   479 JRT_LEAF(void, StubRoutines::arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count))
   461 JRT_LEAF(void, StubRoutines::arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count))
   480 #ifndef PRODUCT
   462 #ifndef PRODUCT
   481   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
   463   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
   482 #endif // !PRODUCT
   464 #endif // !PRODUCT
   483   assert(count != 0, "count should be non-zero");
   465   assert(count != 0, "count should be non-zero");
   484   gen_arraycopy_barrier_pre((oop *) dest, count, /*dest_uninitialized*/true);
   466   HeapAccess<ARRAYCOPY_ARRAYOF | ARRAYCOPY_DEST_NOT_INITIALIZED>::oop_arraycopy(NULL, NULL, src, dest, count);
   485   Copy::arrayof_conjoint_oops(src, dest, count);
       
   486   gen_arraycopy_barrier((oop *) dest, count);
       
   487 JRT_END
   467 JRT_END
   488 
   468 
   489 address StubRoutines::select_fill_function(BasicType t, bool aligned, const char* &name) {
   469 address StubRoutines::select_fill_function(BasicType t, bool aligned, const char* &name) {
   490 #define RETURN_STUB(xxx_fill) { \
   470 #define RETURN_STUB(xxx_fill) { \
   491   name = #xxx_fill; \
   471   name = #xxx_fill; \