< prev index next >

src/share/vm/runtime/stubRoutines.cpp

Print this page
rev 12906 : [mq]: gc_interface


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/codeBuffer.hpp"
  27 #include "memory/resourceArea.hpp"
  28 #include "oops/oop.inline.hpp"

  29 #include "runtime/interfaceSupport.hpp"
  30 #include "runtime/timerTrace.hpp"
  31 #include "runtime/sharedRuntime.hpp"
  32 #include "runtime/stubRoutines.hpp"
  33 #include "utilities/copy.hpp"
  34 #ifdef COMPILER2
  35 #include "opto/runtime.hpp"
  36 #endif
  37 
  38 
  39 // Implementation of StubRoutines - for a description
  40 // of how to extend it, see the header file.
  41 
  42 // Class Variables
  43 
  44 BufferBlob* StubRoutines::_code1                                = NULL;
  45 BufferBlob* StubRoutines::_code2                                = NULL;
  46 
  47 address StubRoutines::_call_stub_return_address                 = NULL;
  48 address StubRoutines::_call_stub_entry                          = NULL;


 359   test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::aligned_disjoint_words), sizeof(jlong));
 360 
 361   // test safefetch routines
 362   // Not on Windows 32bit until 8074860 is fixed
 363 #if ! (defined(_WIN32) && defined(_M_IX86))
 364   test_safefetch32();
 365   test_safefetchN();
 366 #endif
 367 
 368 #endif
 369 }
 370 
 371 
 372 void stubRoutines_init1() { StubRoutines::initialize1(); }
 373 void stubRoutines_init2() { StubRoutines::initialize2(); }
 374 
 375 //
 376 // Default versions of arraycopy functions
 377 //
 378 
 379 static void gen_arraycopy_barrier_pre(oop* dest, size_t count, bool dest_uninitialized) {
 380     assert(count != 0, "count should be non-zero");
 381     assert(count <= (size_t)max_intx, "count too large");
 382     BarrierSet* bs = Universe::heap()->barrier_set();
 383     assert(bs->has_write_ref_array_pre_opt(), "Must have pre-barrier opt");
 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     assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt");
 391     bs->write_ref_array((HeapWord*)dest, count);
 392 }
 393 
 394 JRT_LEAF(void, StubRoutines::jbyte_copy(jbyte* src, jbyte* dest, size_t count))
 395 #ifndef PRODUCT
 396   SharedRuntime::_jbyte_array_copy_ctr++;      // Slow-path byte array copy
 397 #endif // !PRODUCT
 398   Copy::conjoint_jbytes_atomic(src, dest, count);
 399 JRT_END
 400 
 401 JRT_LEAF(void, StubRoutines::jshort_copy(jshort* src, jshort* dest, size_t count))
 402 #ifndef PRODUCT
 403   SharedRuntime::_jshort_array_copy_ctr++;     // Slow-path short/char array copy
 404 #endif // !PRODUCT
 405   Copy::conjoint_jshorts_atomic(src, dest, count);
 406 JRT_END
 407 
 408 JRT_LEAF(void, StubRoutines::jint_copy(jint* src, jint* dest, size_t count))
 409 #ifndef PRODUCT
 410   SharedRuntime::_jint_array_copy_ctr++;       // Slow-path int/float array copy
 411 #endif // !PRODUCT
 412   Copy::conjoint_jints_atomic(src, dest, count);
 413 JRT_END
 414 
 415 JRT_LEAF(void, StubRoutines::jlong_copy(jlong* src, jlong* dest, size_t count))
 416 #ifndef PRODUCT
 417   SharedRuntime::_jlong_array_copy_ctr++;      // Slow-path long/double array copy
 418 #endif // !PRODUCT
 419   Copy::conjoint_jlongs_atomic(src, dest, count);
 420 JRT_END
 421 
 422 JRT_LEAF(void, StubRoutines::oop_copy(oop* src, oop* dest, size_t count))
 423 #ifndef PRODUCT
 424   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 425 #endif // !PRODUCT
 426   assert(count != 0, "count should be non-zero");
 427   gen_arraycopy_barrier_pre(dest, count, /*dest_uninitialized*/false);
 428   Copy::conjoint_oops_atomic(src, dest, count);
 429   gen_arraycopy_barrier(dest, count);
 430 JRT_END
 431 
 432 JRT_LEAF(void, StubRoutines::oop_copy_uninit(oop* src, oop* dest, size_t count))
 433 #ifndef PRODUCT
 434   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 435 #endif // !PRODUCT
 436   assert(count != 0, "count should be non-zero");
 437   gen_arraycopy_barrier_pre(dest, count, /*dest_uninitialized*/true);
 438   Copy::conjoint_oops_atomic(src, dest, count);
 439   gen_arraycopy_barrier(dest, count);
 440 JRT_END
 441 
 442 JRT_LEAF(void, StubRoutines::arrayof_jbyte_copy(HeapWord* src, HeapWord* dest, size_t count))
 443 #ifndef PRODUCT
 444   SharedRuntime::_jbyte_array_copy_ctr++;      // Slow-path byte array copy
 445 #endif // !PRODUCT
 446   Copy::arrayof_conjoint_jbytes(src, dest, count);
 447 JRT_END
 448 
 449 JRT_LEAF(void, StubRoutines::arrayof_jshort_copy(HeapWord* src, HeapWord* dest, size_t count))
 450 #ifndef PRODUCT
 451   SharedRuntime::_jshort_array_copy_ctr++;     // Slow-path short/char array copy
 452 #endif // !PRODUCT
 453   Copy::arrayof_conjoint_jshorts(src, dest, count);
 454 JRT_END
 455 
 456 JRT_LEAF(void, StubRoutines::arrayof_jint_copy(HeapWord* src, HeapWord* dest, size_t count))
 457 #ifndef PRODUCT
 458   SharedRuntime::_jint_array_copy_ctr++;       // Slow-path int/float array copy
 459 #endif // !PRODUCT
 460   Copy::arrayof_conjoint_jints(src, dest, count);
 461 JRT_END
 462 
 463 JRT_LEAF(void, StubRoutines::arrayof_jlong_copy(HeapWord* src, HeapWord* dest, size_t count))
 464 #ifndef PRODUCT
 465   SharedRuntime::_jlong_array_copy_ctr++;       // Slow-path int/float array copy
 466 #endif // !PRODUCT
 467   Copy::arrayof_conjoint_jlongs(src, dest, count);
 468 JRT_END
 469 
 470 JRT_LEAF(void, StubRoutines::arrayof_oop_copy(HeapWord* src, HeapWord* dest, size_t count))
 471 #ifndef PRODUCT
 472   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 473 #endif // !PRODUCT
 474   assert(count != 0, "count should be non-zero");
 475   gen_arraycopy_barrier_pre((oop *) dest, count, /*dest_uninitialized*/false);
 476   Copy::arrayof_conjoint_oops(src, dest, count);
 477   gen_arraycopy_barrier((oop *) dest, count);
 478 JRT_END
 479 
 480 JRT_LEAF(void, StubRoutines::arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count))
 481 #ifndef PRODUCT
 482   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 483 #endif // !PRODUCT
 484   assert(count != 0, "count should be non-zero");
 485   gen_arraycopy_barrier_pre((oop *) dest, count, /*dest_uninitialized*/true);
 486   Copy::arrayof_conjoint_oops(src, dest, count);
 487   gen_arraycopy_barrier((oop *) dest, count);
 488 JRT_END
 489 
 490 address StubRoutines::select_fill_function(BasicType t, bool aligned, const char* &name) {
 491 #define RETURN_STUB(xxx_fill) { \
 492   name = #xxx_fill; \
 493   return StubRoutines::xxx_fill(); }
 494 
 495   switch (t) {
 496   case T_BYTE:
 497   case T_BOOLEAN:
 498     if (!aligned) RETURN_STUB(jbyte_fill);
 499     RETURN_STUB(arrayof_jbyte_fill);
 500   case T_CHAR:
 501   case T_SHORT:
 502     if (!aligned) RETURN_STUB(jshort_fill);
 503     RETURN_STUB(arrayof_jshort_fill);
 504   case T_INT:
 505   case T_FLOAT:
 506     if (!aligned) RETURN_STUB(jint_fill);
 507     RETURN_STUB(arrayof_jint_fill);




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/codeBuffer.hpp"
  27 #include "memory/resourceArea.hpp"
  28 #include "oops/oop.inline.hpp"
  29 #include "runtime/access.inline.hpp"
  30 #include "runtime/interfaceSupport.hpp"
  31 #include "runtime/timerTrace.hpp"
  32 #include "runtime/sharedRuntime.hpp"
  33 #include "runtime/stubRoutines.hpp"
  34 #include "utilities/copy.hpp"
  35 #ifdef COMPILER2
  36 #include "opto/runtime.hpp"
  37 #endif
  38 
  39 
  40 // Implementation of StubRoutines - for a description
  41 // of how to extend it, see the header file.
  42 
  43 // Class Variables
  44 
  45 BufferBlob* StubRoutines::_code1                                = NULL;
  46 BufferBlob* StubRoutines::_code2                                = NULL;
  47 
  48 address StubRoutines::_call_stub_return_address                 = NULL;
  49 address StubRoutines::_call_stub_entry                          = NULL;


 360   test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::aligned_disjoint_words), sizeof(jlong));
 361 
 362   // test safefetch routines
 363   // Not on Windows 32bit until 8074860 is fixed
 364 #if ! (defined(_WIN32) && defined(_M_IX86))
 365   test_safefetch32();
 366   test_safefetchN();
 367 #endif
 368 
 369 #endif
 370 }
 371 
 372 
 373 void stubRoutines_init1() { StubRoutines::initialize1(); }
 374 void stubRoutines_init2() { StubRoutines::initialize2(); }
 375 
 376 //
 377 // Default versions of arraycopy functions
 378 //
 379 















 380 JRT_LEAF(void, StubRoutines::jbyte_copy(jbyte* src, jbyte* dest, size_t count))
 381 #ifndef PRODUCT
 382   SharedRuntime::_jbyte_array_copy_ctr++;      // Slow-path byte array copy
 383 #endif // !PRODUCT
 384   Copy::conjoint_jbytes_atomic(src, dest, count);
 385 JRT_END
 386 
 387 JRT_LEAF(void, StubRoutines::jshort_copy(jshort* src, jshort* dest, size_t count))
 388 #ifndef PRODUCT
 389   SharedRuntime::_jshort_array_copy_ctr++;     // Slow-path short/char array copy
 390 #endif // !PRODUCT
 391   Copy::conjoint_jshorts_atomic(src, dest, count);
 392 JRT_END
 393 
 394 JRT_LEAF(void, StubRoutines::jint_copy(jint* src, jint* dest, size_t count))
 395 #ifndef PRODUCT
 396   SharedRuntime::_jint_array_copy_ctr++;       // Slow-path int/float array copy
 397 #endif // !PRODUCT
 398   Copy::conjoint_jints_atomic(src, dest, count);
 399 JRT_END
 400 
 401 JRT_LEAF(void, StubRoutines::jlong_copy(jlong* src, jlong* dest, size_t count))
 402 #ifndef PRODUCT
 403   SharedRuntime::_jlong_array_copy_ctr++;      // Slow-path long/double array copy
 404 #endif // !PRODUCT
 405   Copy::conjoint_jlongs_atomic(src, dest, count);
 406 JRT_END
 407 
 408 JRT_LEAF(void, StubRoutines::oop_copy(oop* src, oop* dest, size_t count))
 409 #ifndef PRODUCT
 410   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 411 #endif // !PRODUCT
 412   assert(count != 0, "count should be non-zero");
 413   HeapAccess<DEST_CONJOINT | DEST_COVARIANT>::oop_copy(NULL, NULL, (HeapWord*)src, (HeapWord*)dest, count);


 414 JRT_END
 415 
 416 JRT_LEAF(void, StubRoutines::oop_copy_uninit(oop* src, oop* dest, size_t count))
 417 #ifndef PRODUCT
 418   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 419 #endif // !PRODUCT
 420   assert(count != 0, "count should be non-zero");
 421   HeapAccess<DEST_CONJOINT | DEST_COVARIANT | DEST_NOT_INITIALIZED>::oop_copy(NULL, NULL, (HeapWord*)src, (HeapWord*)dest, count);


 422 JRT_END
 423 
 424 JRT_LEAF(void, StubRoutines::arrayof_jbyte_copy(HeapWord* src, HeapWord* dest, size_t count))
 425 #ifndef PRODUCT
 426   SharedRuntime::_jbyte_array_copy_ctr++;      // Slow-path byte array copy
 427 #endif // !PRODUCT
 428   Copy::arrayof_conjoint_jbytes(src, dest, count);
 429 JRT_END
 430 
 431 JRT_LEAF(void, StubRoutines::arrayof_jshort_copy(HeapWord* src, HeapWord* dest, size_t count))
 432 #ifndef PRODUCT
 433   SharedRuntime::_jshort_array_copy_ctr++;     // Slow-path short/char array copy
 434 #endif // !PRODUCT
 435   Copy::arrayof_conjoint_jshorts(src, dest, count);
 436 JRT_END
 437 
 438 JRT_LEAF(void, StubRoutines::arrayof_jint_copy(HeapWord* src, HeapWord* dest, size_t count))
 439 #ifndef PRODUCT
 440   SharedRuntime::_jint_array_copy_ctr++;       // Slow-path int/float array copy
 441 #endif // !PRODUCT
 442   Copy::arrayof_conjoint_jints(src, dest, count);
 443 JRT_END
 444 
 445 JRT_LEAF(void, StubRoutines::arrayof_jlong_copy(HeapWord* src, HeapWord* dest, size_t count))
 446 #ifndef PRODUCT
 447   SharedRuntime::_jlong_array_copy_ctr++;       // Slow-path int/float array copy
 448 #endif // !PRODUCT
 449   Copy::arrayof_conjoint_jlongs(src, dest, count);
 450 JRT_END
 451 
 452 JRT_LEAF(void, StubRoutines::arrayof_oop_copy(HeapWord* src, HeapWord* dest, size_t count))
 453 #ifndef PRODUCT
 454   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 455 #endif // !PRODUCT
 456   assert(count != 0, "count should be non-zero");
 457   HeapAccess<DEST_CONJOINT | DEST_COVARIANT | COPY_ARRAYOF>::oop_copy(NULL, NULL, src, dest, count);


 458 JRT_END
 459 
 460 JRT_LEAF(void, StubRoutines::arrayof_oop_copy_uninit(HeapWord* src, HeapWord* dest, size_t count))
 461 #ifndef PRODUCT
 462   SharedRuntime::_oop_array_copy_ctr++;        // Slow-path oop array copy
 463 #endif // !PRODUCT
 464   assert(count != 0, "count should be non-zero");
 465   HeapAccess<DEST_CONJOINT | DEST_COVARIANT | COPY_ARRAYOF | DEST_NOT_INITIALIZED>::oop_copy(NULL, NULL, src, dest, count);


 466 JRT_END
 467 
 468 address StubRoutines::select_fill_function(BasicType t, bool aligned, const char* &name) {
 469 #define RETURN_STUB(xxx_fill) { \
 470   name = #xxx_fill; \
 471   return StubRoutines::xxx_fill(); }
 472 
 473   switch (t) {
 474   case T_BYTE:
 475   case T_BOOLEAN:
 476     if (!aligned) RETURN_STUB(jbyte_fill);
 477     RETURN_STUB(arrayof_jbyte_fill);
 478   case T_CHAR:
 479   case T_SHORT:
 480     if (!aligned) RETURN_STUB(jshort_fill);
 481     RETURN_STUB(arrayof_jshort_fill);
 482   case T_INT:
 483   case T_FLOAT:
 484     if (!aligned) RETURN_STUB(jint_fill);
 485     RETURN_STUB(arrayof_jint_fill);


< prev index next >