Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/stubRoutines.cpp @ 2446:13bc79b5c9c8
7033154: Improve C1 arraycopy performance
Summary: better static analysis. Take advantage of array copy stubs.
Reviewed-by: never
author | roland |
---|---|
date | Sun, 03 Apr 2011 12:00:54 +0200 |
parents | 0ac769a57c64 |
children | 38fa55e5e792 |
comparison
equal
deleted
inserted
replaced
2445:08eb13460b3a | 2446:13bc79b5c9c8 |
---|---|
431 return NULL; | 431 return NULL; |
432 } | 432 } |
433 | 433 |
434 #undef RETURN_STUB | 434 #undef RETURN_STUB |
435 } | 435 } |
436 | |
437 // constants for computing the copy function | |
438 enum { | |
439 COPYFUNC_UNALIGNED = 0, | |
440 COPYFUNC_ALIGNED = 1, // src, dest aligned to HeapWordSize | |
441 COPYFUNC_CONJOINT = 0, | |
442 COPYFUNC_DISJOINT = 2 // src != dest, or transfer can descend | |
443 }; | |
444 | |
445 // Note: The condition "disjoint" applies also for overlapping copies | |
446 // where an descending copy is permitted (i.e., dest_offset <= src_offset). | |
447 address | |
448 StubRoutines::select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized) { | |
449 int selector = | |
450 (aligned ? COPYFUNC_ALIGNED : COPYFUNC_UNALIGNED) + | |
451 (disjoint ? COPYFUNC_DISJOINT : COPYFUNC_CONJOINT); | |
452 | |
453 #define RETURN_STUB(xxx_arraycopy) { \ | |
454 name = #xxx_arraycopy; \ | |
455 return StubRoutines::xxx_arraycopy(); } | |
456 | |
457 #define RETURN_STUB_PARM(xxx_arraycopy, parm) { \ | |
458 name = #xxx_arraycopy; \ | |
459 return StubRoutines::xxx_arraycopy(parm); } | |
460 | |
461 switch (t) { | |
462 case T_BYTE: | |
463 case T_BOOLEAN: | |
464 switch (selector) { | |
465 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jbyte_arraycopy); | |
466 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jbyte_arraycopy); | |
467 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jbyte_disjoint_arraycopy); | |
468 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jbyte_disjoint_arraycopy); | |
469 } | |
470 case T_CHAR: | |
471 case T_SHORT: | |
472 switch (selector) { | |
473 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jshort_arraycopy); | |
474 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jshort_arraycopy); | |
475 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jshort_disjoint_arraycopy); | |
476 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jshort_disjoint_arraycopy); | |
477 } | |
478 case T_INT: | |
479 case T_FLOAT: | |
480 switch (selector) { | |
481 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jint_arraycopy); | |
482 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jint_arraycopy); | |
483 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jint_disjoint_arraycopy); | |
484 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jint_disjoint_arraycopy); | |
485 } | |
486 case T_DOUBLE: | |
487 case T_LONG: | |
488 switch (selector) { | |
489 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jlong_arraycopy); | |
490 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jlong_arraycopy); | |
491 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB(jlong_disjoint_arraycopy); | |
492 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB(arrayof_jlong_disjoint_arraycopy); | |
493 } | |
494 case T_ARRAY: | |
495 case T_OBJECT: | |
496 switch (selector) { | |
497 case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED: RETURN_STUB_PARM(oop_arraycopy, dest_uninitialized); | |
498 case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED: RETURN_STUB_PARM(arrayof_oop_arraycopy, dest_uninitialized); | |
499 case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED: RETURN_STUB_PARM(oop_disjoint_arraycopy, dest_uninitialized); | |
500 case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED: RETURN_STUB_PARM(arrayof_oop_disjoint_arraycopy, dest_uninitialized); | |
501 } | |
502 default: | |
503 ShouldNotReachHere(); | |
504 return NULL; | |
505 } | |
506 | |
507 #undef RETURN_STUB | |
508 #undef RETURN_STUB_PARM | |
509 } |