src/cpu/sparc/vm/copy_sparc.hpp

changeset 3206
16f9fa2bf76c
parent 3092
baf763f388e6
child 6704
7f1743e1a14e
     1.1 --- a/src/cpu/sparc/vm/copy_sparc.hpp	Mon Oct 17 21:38:29 2011 -0700
     1.2 +++ b/src/cpu/sparc/vm/copy_sparc.hpp	Wed Oct 19 10:52:30 2011 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -82,13 +82,35 @@
    1.11  }
    1.12  
    1.13  static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
    1.14 -  // FIXME
    1.15 -  (void)memmove(to, from, count << LogBytesPerShort);
    1.16 +  if (from > to) {
    1.17 +    while (count-- > 0) {
    1.18 +      // Copy forwards
    1.19 +      *to++ = *from++;
    1.20 +    }
    1.21 +  } else {
    1.22 +    from += count - 1;
    1.23 +    to   += count - 1;
    1.24 +    while (count-- > 0) {
    1.25 +      // Copy backwards
    1.26 +      *to-- = *from--;
    1.27 +    }
    1.28 +  }
    1.29  }
    1.30  
    1.31  static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
    1.32 -  // FIXME
    1.33 -  (void)memmove(to, from, count << LogBytesPerInt);
    1.34 +  if (from > to) {
    1.35 +    while (count-- > 0) {
    1.36 +      // Copy forwards
    1.37 +      *to++ = *from++;
    1.38 +    }
    1.39 +  } else {
    1.40 +    from += count - 1;
    1.41 +    to   += count - 1;
    1.42 +    while (count-- > 0) {
    1.43 +      // Copy backwards
    1.44 +      *to-- = *from--;
    1.45 +    }
    1.46 +  }
    1.47  }
    1.48  
    1.49  static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {

mercurial