src/share/vm/runtime/stubRoutines.cpp

changeset 2728
13bc79b5c9c8
parent 2606
0ac769a57c64
child 2978
d83ac25d0304
     1.1 --- a/src/share/vm/runtime/stubRoutines.cpp	Sat Apr 02 10:54:15 2011 -0700
     1.2 +++ b/src/share/vm/runtime/stubRoutines.cpp	Sun Apr 03 12:00:54 2011 +0200
     1.3 @@ -433,3 +433,77 @@
     1.4  
     1.5  #undef RETURN_STUB
     1.6  }
     1.7 +
     1.8 +// constants for computing the copy function
     1.9 +enum {
    1.10 +  COPYFUNC_UNALIGNED = 0,
    1.11 +  COPYFUNC_ALIGNED = 1,                 // src, dest aligned to HeapWordSize
    1.12 +  COPYFUNC_CONJOINT = 0,
    1.13 +  COPYFUNC_DISJOINT = 2                 // src != dest, or transfer can descend
    1.14 +};
    1.15 +
    1.16 +// Note:  The condition "disjoint" applies also for overlapping copies
    1.17 +// where an descending copy is permitted (i.e., dest_offset <= src_offset).
    1.18 +address
    1.19 +StubRoutines::select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized) {
    1.20 +  int selector =
    1.21 +    (aligned  ? COPYFUNC_ALIGNED  : COPYFUNC_UNALIGNED) +
    1.22 +    (disjoint ? COPYFUNC_DISJOINT : COPYFUNC_CONJOINT);
    1.23 +
    1.24 +#define RETURN_STUB(xxx_arraycopy) { \
    1.25 +  name = #xxx_arraycopy; \
    1.26 +  return StubRoutines::xxx_arraycopy(); }
    1.27 +
    1.28 +#define RETURN_STUB_PARM(xxx_arraycopy, parm) {           \
    1.29 +  name = #xxx_arraycopy; \
    1.30 +  return StubRoutines::xxx_arraycopy(parm); }
    1.31 +
    1.32 +  switch (t) {
    1.33 +  case T_BYTE:
    1.34 +  case T_BOOLEAN:
    1.35 +    switch (selector) {
    1.36 +    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jbyte_arraycopy);
    1.37 +    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jbyte_arraycopy);
    1.38 +    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jbyte_disjoint_arraycopy);
    1.39 +    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jbyte_disjoint_arraycopy);
    1.40 +    }
    1.41 +  case T_CHAR:
    1.42 +  case T_SHORT:
    1.43 +    switch (selector) {
    1.44 +    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jshort_arraycopy);
    1.45 +    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jshort_arraycopy);
    1.46 +    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jshort_disjoint_arraycopy);
    1.47 +    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jshort_disjoint_arraycopy);
    1.48 +    }
    1.49 +  case T_INT:
    1.50 +  case T_FLOAT:
    1.51 +    switch (selector) {
    1.52 +    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jint_arraycopy);
    1.53 +    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jint_arraycopy);
    1.54 +    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jint_disjoint_arraycopy);
    1.55 +    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jint_disjoint_arraycopy);
    1.56 +    }
    1.57 +  case T_DOUBLE:
    1.58 +  case T_LONG:
    1.59 +    switch (selector) {
    1.60 +    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jlong_arraycopy);
    1.61 +    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jlong_arraycopy);
    1.62 +    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jlong_disjoint_arraycopy);
    1.63 +    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jlong_disjoint_arraycopy);
    1.64 +    }
    1.65 +  case T_ARRAY:
    1.66 +  case T_OBJECT:
    1.67 +    switch (selector) {
    1.68 +    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB_PARM(oop_arraycopy, dest_uninitialized);
    1.69 +    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB_PARM(arrayof_oop_arraycopy, dest_uninitialized);
    1.70 +    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB_PARM(oop_disjoint_arraycopy, dest_uninitialized);
    1.71 +    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB_PARM(arrayof_oop_disjoint_arraycopy, dest_uninitialized);
    1.72 +    }
    1.73 +  default:
    1.74 +    ShouldNotReachHere();
    1.75 +    return NULL;
    1.76 +  }
    1.77 +
    1.78 +#undef RETURN_STUB
    1.79 +#undef RETURN_STUB_PARM
    1.80 +}

mercurial