Merge jdk8u202-b06

Wed, 05 Dec 2018 11:22:21 +0000

author
aefimov
date
Wed, 05 Dec 2018 11:22:21 +0000
changeset 9563
2fa643465866
parent 9560
cd639803ef5c
parent 9562
dee6a1ce4a0c
child 9564
faefb1f95881

Merge

THIRD_PARTY_README file | annotate | diff | comparison | revisions
src/share/vm/prims/jvm.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/THIRD_PARTY_README	Fri Nov 30 12:05:39 2018 +0000
     1.2 +++ b/THIRD_PARTY_README	Wed Dec 05 11:22:21 2018 +0000
     1.3 @@ -1668,13 +1668,13 @@
     1.4  
     1.5  -------------------------------------------------------------------------------
     1.6  
     1.7 -%% This notice is provided with respect to Little CMS 2.7, which may be 
     1.8 +%% This notice is provided with respect to Little CMS 2.9, which may be
     1.9  included with JRE 8, JDK 8, and OpenJDK 8.
    1.10  
    1.11  --- begin of LICENSE ---
    1.12  
    1.13  Little CMS
    1.14 -Copyright (c) 1998-2015 Marti Maria Saguer
    1.15 +Copyright (c) 1998-2011 Marti Maria Saguer
    1.16  
    1.17  Permission is hereby granted, free of charge, to any person obtaining a copy
    1.18  of this software and associated documentation files (the "Software"), to deal
     2.1 --- a/make/aix/makefiles/mapfile-vers-debug	Fri Nov 30 12:05:39 2018 +0000
     2.2 +++ b/make/aix/makefiles/mapfile-vers-debug	Wed Dec 05 11:22:21 2018 +0000
     2.3 @@ -1,5 +1,5 @@
     2.4  #
     2.5 -# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     2.6 +# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     2.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8  #
     2.9  # This code is free software; you can redistribute it and/or modify it
    2.10 @@ -63,6 +63,7 @@
    2.11                  JVM_ConstantPoolGetSize;
    2.12                  JVM_ConstantPoolGetStringAt;
    2.13                  JVM_ConstantPoolGetUTF8At;
    2.14 +                JVM_CopySwapMemory;
    2.15                  JVM_CountStackFrames;
    2.16                  JVM_CurrentClassLoader;
    2.17                  JVM_CurrentLoadedClass;
     3.1 --- a/make/aix/makefiles/mapfile-vers-product	Fri Nov 30 12:05:39 2018 +0000
     3.2 +++ b/make/aix/makefiles/mapfile-vers-product	Wed Dec 05 11:22:21 2018 +0000
     3.3 @@ -1,5 +1,5 @@
     3.4  #
     3.5 -# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     3.6 +# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     3.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8  #
     3.9  # This code is free software; you can redistribute it and/or modify it
    3.10 @@ -63,6 +63,7 @@
    3.11                  JVM_ConstantPoolGetSize;
    3.12                  JVM_ConstantPoolGetStringAt;
    3.13                  JVM_ConstantPoolGetUTF8At;
    3.14 +                JVM_CopySwapMemory;
    3.15                  JVM_CountStackFrames;
    3.16                  JVM_CurrentClassLoader;
    3.17                  JVM_CurrentLoadedClass;
     4.1 --- a/make/bsd/makefiles/mapfile-vers-debug	Fri Nov 30 12:05:39 2018 +0000
     4.2 +++ b/make/bsd/makefiles/mapfile-vers-debug	Wed Dec 05 11:22:21 2018 +0000
     4.3 @@ -1,5 +1,5 @@
     4.4  #
     4.5 -# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     4.6 +# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     4.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8  #
     4.9  # This code is free software; you can redistribute it and/or modify it
    4.10 @@ -61,6 +61,7 @@
    4.11                  _JVM_ConstantPoolGetSize
    4.12                  _JVM_ConstantPoolGetStringAt
    4.13                  _JVM_ConstantPoolGetUTF8At
    4.14 +                _JVM_CopySwapMemory
    4.15                  _JVM_CountStackFrames
    4.16                  _JVM_CurrentClassLoader
    4.17                  _JVM_CurrentLoadedClass
     5.1 --- a/make/bsd/makefiles/mapfile-vers-product	Fri Nov 30 12:05:39 2018 +0000
     5.2 +++ b/make/bsd/makefiles/mapfile-vers-product	Wed Dec 05 11:22:21 2018 +0000
     5.3 @@ -1,5 +1,5 @@
     5.4  #
     5.5 -# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     5.6 +# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     5.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8  #
     5.9  # This code is free software; you can redistribute it and/or modify it
    5.10 @@ -61,6 +61,7 @@
    5.11                  _JVM_ConstantPoolGetSize
    5.12                  _JVM_ConstantPoolGetStringAt
    5.13                  _JVM_ConstantPoolGetUTF8At
    5.14 +                _JVM_CopySwapMemory
    5.15                  _JVM_CountStackFrames
    5.16                  _JVM_CurrentClassLoader
    5.17                  _JVM_CurrentLoadedClass
     6.1 --- a/make/linux/makefiles/mapfile-vers-debug	Fri Nov 30 12:05:39 2018 +0000
     6.2 +++ b/make/linux/makefiles/mapfile-vers-debug	Wed Dec 05 11:22:21 2018 +0000
     6.3 @@ -1,5 +1,5 @@
     6.4  #
     6.5 -# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     6.6 +# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     6.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8  #
     6.9  # This code is free software; you can redistribute it and/or modify it
    6.10 @@ -63,6 +63,7 @@
    6.11                  JVM_ConstantPoolGetSize;
    6.12                  JVM_ConstantPoolGetStringAt;
    6.13                  JVM_ConstantPoolGetUTF8At;
    6.14 +                JVM_CopySwapMemory;
    6.15                  JVM_CountStackFrames;
    6.16                  JVM_CurrentClassLoader;
    6.17                  JVM_CurrentLoadedClass;
     7.1 --- a/make/linux/makefiles/mapfile-vers-product	Fri Nov 30 12:05:39 2018 +0000
     7.2 +++ b/make/linux/makefiles/mapfile-vers-product	Wed Dec 05 11:22:21 2018 +0000
     7.3 @@ -1,5 +1,5 @@
     7.4  #
     7.5 -# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     7.6 +# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     7.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8  #
     7.9  # This code is free software; you can redistribute it and/or modify it
    7.10 @@ -63,6 +63,7 @@
    7.11                  JVM_ConstantPoolGetSize;
    7.12                  JVM_ConstantPoolGetStringAt;
    7.13                  JVM_ConstantPoolGetUTF8At;
    7.14 +                JVM_CopySwapMemory;
    7.15                  JVM_CountStackFrames;
    7.16                  JVM_CurrentClassLoader;
    7.17                  JVM_CurrentLoadedClass;
     8.1 --- a/make/solaris/makefiles/mapfile-vers	Fri Nov 30 12:05:39 2018 +0000
     8.2 +++ b/make/solaris/makefiles/mapfile-vers	Wed Dec 05 11:22:21 2018 +0000
     8.3 @@ -1,5 +1,5 @@
     8.4  #
     8.5 -# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     8.6 +# Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
     8.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8  #
     8.9  # This code is free software; you can redistribute it and/or modify it
    8.10 @@ -64,6 +64,7 @@
    8.11                  JVM_ConstantPoolGetStringAt;
    8.12                  JVM_ConstantPoolGetUTF8At;
    8.13                  JVM_CountStackFrames;
    8.14 +                JVM_CopySwapMemory;
    8.15                  JVM_CurrentClassLoader;
    8.16                  JVM_CurrentLoadedClass;
    8.17                  JVM_CurrentThread;
     9.1 --- a/src/share/vm/prims/jvm.cpp	Fri Nov 30 12:05:39 2018 +0000
     9.2 +++ b/src/share/vm/prims/jvm.cpp	Wed Dec 05 11:22:21 2018 +0000
     9.3 @@ -759,6 +759,79 @@
     9.4  JVM_END
     9.5  
     9.6  
     9.7 +// java.nio.Bits ///////////////////////////////////////////////////////////////
     9.8 +
     9.9 +#define MAX_OBJECT_SIZE \
    9.10 +  ( arrayOopDesc::header_size(T_DOUBLE) * HeapWordSize \
    9.11 +    + ((julong)max_jint * sizeof(double)) )
    9.12 +
    9.13 +static inline jlong field_offset_to_byte_offset(jlong field_offset) {
    9.14 +  return field_offset;
    9.15 +}
    9.16 +
    9.17 +static inline void assert_field_offset_sane(oop p, jlong field_offset) {
    9.18 +#ifdef ASSERT
    9.19 +  jlong byte_offset = field_offset_to_byte_offset(field_offset);
    9.20 +
    9.21 +  if (p != NULL) {
    9.22 +    assert(byte_offset >= 0 && byte_offset <= (jlong)MAX_OBJECT_SIZE, "sane offset");
    9.23 +    if (byte_offset == (jint)byte_offset) {
    9.24 +      void* ptr_plus_disp = (address)p + byte_offset;
    9.25 +      assert((void*)p->obj_field_addr<oop>((jint)byte_offset) == ptr_plus_disp,
    9.26 +             "raw [ptr+disp] must be consistent with oop::field_base");
    9.27 +    }
    9.28 +    jlong p_size = HeapWordSize * (jlong)(p->size());
    9.29 +    assert(byte_offset < p_size, err_msg("Unsafe access: offset " INT64_FORMAT
    9.30 +                                         " > object's size " INT64_FORMAT,
    9.31 +                                         (int64_t)byte_offset, (int64_t)p_size));
    9.32 +  }
    9.33 +#endif
    9.34 +}
    9.35 +
    9.36 +static inline void* index_oop_from_field_offset_long(oop p, jlong field_offset) {
    9.37 +  assert_field_offset_sane(p, field_offset);
    9.38 +  jlong byte_offset = field_offset_to_byte_offset(field_offset);
    9.39 +
    9.40 +  if (sizeof(char*) == sizeof(jint)) {   // (this constant folds!)
    9.41 +    return (address)p + (jint) byte_offset;
    9.42 +  } else {
    9.43 +    return (address)p +        byte_offset;
    9.44 +  }
    9.45 +}
    9.46 +
    9.47 +// This function is a leaf since if the source and destination are both in native memory
    9.48 +// the copy may potentially be very large, and we don't want to disable GC if we can avoid it.
    9.49 +// If either source or destination (or both) are on the heap, the function will enter VM using
    9.50 +// JVM_ENTRY_FROM_LEAF
    9.51 +JVM_LEAF(void, JVM_CopySwapMemory(JNIEnv *env, jobject srcObj, jlong srcOffset,
    9.52 +                                  jobject dstObj, jlong dstOffset, jlong size,
    9.53 +                                  jlong elemSize)) {
    9.54 +
    9.55 +  size_t sz = (size_t)size;
    9.56 +  size_t esz = (size_t)elemSize;
    9.57 +
    9.58 +  if (srcObj == NULL && dstObj == NULL) {
    9.59 +    // Both src & dst are in native memory
    9.60 +    address src = (address)srcOffset;
    9.61 +    address dst = (address)dstOffset;
    9.62 +
    9.63 +    Copy::conjoint_swap(src, dst, sz, esz);
    9.64 +  } else {
    9.65 +    // At least one of src/dst are on heap, transition to VM to access raw pointers
    9.66 +
    9.67 +    JVM_ENTRY_FROM_LEAF(env, void, JVM_CopySwapMemory) {
    9.68 +      oop srcp = JNIHandles::resolve(srcObj);
    9.69 +      oop dstp = JNIHandles::resolve(dstObj);
    9.70 +
    9.71 +      address src = (address)index_oop_from_field_offset_long(srcp, srcOffset);
    9.72 +      address dst = (address)index_oop_from_field_offset_long(dstp, dstOffset);
    9.73 +
    9.74 +      Copy::conjoint_swap(src, dst, sz, esz);
    9.75 +    } JVM_END
    9.76 +  }
    9.77 +} JVM_END
    9.78 +
    9.79 +
    9.80  // Misc. class handling ///////////////////////////////////////////////////////////
    9.81  
    9.82  
    10.1 --- a/src/share/vm/prims/jvm.h	Fri Nov 30 12:05:39 2018 +0000
    10.2 +++ b/src/share/vm/prims/jvm.h	Wed Dec 05 11:22:21 2018 +0000
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -145,6 +145,14 @@
   10.11  JVM_OnExit(void (*func)(void));
   10.12  
   10.13  /*
   10.14 + * java.nio.Bits
   10.15 + */
   10.16 +JNIEXPORT void JNICALL
   10.17 +JVM_CopySwapMemory(JNIEnv *env, jobject srcObj, jlong srcOffset,
   10.18 +                   jobject dstObj, jlong dstOffset, jlong size,
   10.19 +                   jlong elemSize);
   10.20 +
   10.21 +/*
   10.22   * java.lang.Runtime
   10.23   */
   10.24  JNIEXPORT void JNICALL
    11.1 --- a/src/share/vm/runtime/interfaceSupport.hpp	Fri Nov 30 12:05:39 2018 +0000
    11.2 +++ b/src/share/vm/runtime/interfaceSupport.hpp	Wed Dec 05 11:22:21 2018 +0000
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    11.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    11.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.8   *
    11.9   * This code is free software; you can redistribute it and/or modify it
   11.10 @@ -431,6 +431,14 @@
   11.11    os::verify_stack_alignment();                                      \
   11.12    /* begin of body */
   11.13  
   11.14 +#define VM_ENTRY_BASE_FROM_LEAF(result_type, header, thread)         \
   11.15 +  TRACE_CALL(result_type, header)                                    \
   11.16 +  debug_only(ResetNoHandleMark __rnhm;)                              \
   11.17 +  HandleMarkCleaner __hm(thread);                                    \
   11.18 +  Thread* THREAD = thread;                                           \
   11.19 +  os::verify_stack_alignment();                                      \
   11.20 +  /* begin of body */
   11.21 +
   11.22  
   11.23  // ENTRY routines may lock, GC and throw exceptions
   11.24  
   11.25 @@ -592,6 +600,14 @@
   11.26      VM_LEAF_BASE(result_type, header)
   11.27  
   11.28  
   11.29 +#define JVM_ENTRY_FROM_LEAF(env, result_type, header)                \
   11.30 +  { {                                                                \
   11.31 +    JavaThread* thread=JavaThread::thread_from_jni_environment(env); \
   11.32 +    ThreadInVMfromNative __tiv(thread);                              \
   11.33 +    debug_only(VMNativeEntryWrapper __vew;)                          \
   11.34 +    VM_ENTRY_BASE_FROM_LEAF(result_type, header, thread)
   11.35 +
   11.36 +
   11.37  #define JVM_END } }
   11.38  
   11.39  #endif // SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP
    12.1 --- a/src/share/vm/utilities/copy.cpp	Fri Nov 30 12:05:39 2018 +0000
    12.2 +++ b/src/share/vm/utilities/copy.cpp	Wed Dec 05 11:22:21 2018 +0000
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    12.6 + * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -53,6 +53,175 @@
   12.11    }
   12.12  }
   12.13  
   12.14 +class CopySwap : AllStatic {
   12.15 +public:
   12.16 +  /**
   12.17 +   * Copy and byte swap elements
   12.18 +   *
   12.19 +   * @param src address of source
   12.20 +   * @param dst address of destination
   12.21 +   * @param byte_count number of bytes to copy
   12.22 +   * @param elem_size size of the elements to copy-swap
   12.23 +   */
   12.24 +  static void conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) {
   12.25 +    assert(src != NULL, "address must not be NULL");
   12.26 +    assert(dst != NULL, "address must not be NULL");
   12.27 +    assert(elem_size == 2 || elem_size == 4 || elem_size == 8,
   12.28 +           err_msg("incorrect element size: " SIZE_FORMAT, elem_size));
   12.29 +    assert(is_size_aligned(byte_count, elem_size),
   12.30 +           err_msg("byte_count " SIZE_FORMAT " must be multiple of element size " SIZE_FORMAT, byte_count, elem_size));
   12.31 +
   12.32 +    address src_end = src + byte_count;
   12.33 +
   12.34 +    if (dst <= src || dst >= src_end) {
   12.35 +      do_conjoint_swap<RIGHT>(src, dst, byte_count, elem_size);
   12.36 +    } else {
   12.37 +      do_conjoint_swap<LEFT>(src, dst, byte_count, elem_size);
   12.38 +    }
   12.39 +  }
   12.40 +
   12.41 +private:
   12.42 +  /**
   12.43 +   * Byte swap a 16-bit value
   12.44 +   */
   12.45 +  static uint16_t byte_swap(uint16_t x) {
   12.46 +    return (x << 8) | (x >> 8);
   12.47 +  }
   12.48 +
   12.49 +  /**
   12.50 +   * Byte swap a 32-bit value
   12.51 +   */
   12.52 +  static uint32_t byte_swap(uint32_t x) {
   12.53 +    uint16_t lo = (uint16_t)x;
   12.54 +    uint16_t hi = (uint16_t)(x >> 16);
   12.55 +
   12.56 +    return ((uint32_t)byte_swap(lo) << 16) | (uint32_t)byte_swap(hi);
   12.57 +  }
   12.58 +
   12.59 +  /**
   12.60 +   * Byte swap a 64-bit value
   12.61 +   */
   12.62 +  static uint64_t byte_swap(uint64_t x) {
   12.63 +    uint32_t lo = (uint32_t)x;
   12.64 +    uint32_t hi = (uint32_t)(x >> 32);
   12.65 +
   12.66 +    return ((uint64_t)byte_swap(lo) << 32) | (uint64_t)byte_swap(hi);
   12.67 +  }
   12.68 +
   12.69 +  enum CopyDirection {
   12.70 +    RIGHT, // lower -> higher address
   12.71 +    LEFT   // higher -> lower address
   12.72 +  };
   12.73 +
   12.74 +  /**
   12.75 +   * Copy and byte swap elements
   12.76 +   *
   12.77 +   * <T> - type of element to copy
   12.78 +   * <D> - copy direction
   12.79 +   * <is_src_aligned> - true if src argument is aligned to element size
   12.80 +   * <is_dst_aligned> - true if dst argument is aligned to element size
   12.81 +   *
   12.82 +   * @param src address of source
   12.83 +   * @param dst address of destination
   12.84 +   * @param byte_count number of bytes to copy
   12.85 +   */
   12.86 +  template <typename T, CopyDirection D, bool is_src_aligned, bool is_dst_aligned>
   12.87 +  static void do_conjoint_swap(address src, address dst, size_t byte_count) {
   12.88 +    address cur_src, cur_dst;
   12.89 +
   12.90 +    switch (D) {
   12.91 +    case RIGHT:
   12.92 +      cur_src = src;
   12.93 +      cur_dst = dst;
   12.94 +      break;
   12.95 +    case LEFT:
   12.96 +      cur_src = src + byte_count - sizeof(T);
   12.97 +      cur_dst = dst + byte_count - sizeof(T);
   12.98 +      break;
   12.99 +    }
  12.100 +
  12.101 +    for (size_t i = 0; i < byte_count / sizeof(T); i++) {
  12.102 +      T tmp;
  12.103 +
  12.104 +      if (is_src_aligned) {
  12.105 +        tmp = *(T*)cur_src;
  12.106 +      } else {
  12.107 +        memcpy(&tmp, cur_src, sizeof(T));
  12.108 +      }
  12.109 +
  12.110 +      tmp = byte_swap(tmp);
  12.111 +
  12.112 +      if (is_dst_aligned) {
  12.113 +        *(T*)cur_dst = tmp;
  12.114 +      } else {
  12.115 +        memcpy(cur_dst, &tmp, sizeof(T));
  12.116 +      }
  12.117 +
  12.118 +      switch (D) {
  12.119 +      case RIGHT:
  12.120 +        cur_src += sizeof(T);
  12.121 +        cur_dst += sizeof(T);
  12.122 +        break;
  12.123 +      case LEFT:
  12.124 +        cur_src -= sizeof(T);
  12.125 +        cur_dst -= sizeof(T);
  12.126 +        break;
  12.127 +      }
  12.128 +    }
  12.129 +  }
  12.130 +
  12.131 +  /**
  12.132 +   * Copy and byte swap elements
  12.133 +   *
  12.134 +   * <T> - type of element to copy
  12.135 +   * <D> - copy direction
  12.136 +   *
  12.137 +   * @param src address of source
  12.138 +   * @param dst address of destination
  12.139 +   * @param byte_count number of bytes to copy
  12.140 +   */
  12.141 +  template <typename T, CopyDirection direction>
  12.142 +  static void do_conjoint_swap(address src, address dst, size_t byte_count) {
  12.143 +    if (is_ptr_aligned(src, sizeof(T))) {
  12.144 +      if (is_ptr_aligned(dst, sizeof(T))) {
  12.145 +        do_conjoint_swap<T,direction,true,true>(src, dst, byte_count);
  12.146 +      } else {
  12.147 +        do_conjoint_swap<T,direction,true,false>(src, dst, byte_count);
  12.148 +      }
  12.149 +    } else {
  12.150 +      if (is_ptr_aligned(dst, sizeof(T))) {
  12.151 +        do_conjoint_swap<T,direction,false,true>(src, dst, byte_count);
  12.152 +      } else {
  12.153 +        do_conjoint_swap<T,direction,false,false>(src, dst, byte_count);
  12.154 +      }
  12.155 +    }
  12.156 +  }
  12.157 +
  12.158 +
  12.159 +  /**
  12.160 +   * Copy and byte swap elements
  12.161 +   *
  12.162 +   * <D> - copy direction
  12.163 +   *
  12.164 +   * @param src address of source
  12.165 +   * @param dst address of destination
  12.166 +   * @param byte_count number of bytes to copy
  12.167 +   * @param elem_size size of the elements to copy-swap
  12.168 +   */
  12.169 +  template <CopyDirection D>
  12.170 +  static void do_conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) {
  12.171 +    switch (elem_size) {
  12.172 +    case 2: do_conjoint_swap<uint16_t,D>(src, dst, byte_count); break;
  12.173 +    case 4: do_conjoint_swap<uint32_t,D>(src, dst, byte_count); break;
  12.174 +    case 8: do_conjoint_swap<uint64_t,D>(src, dst, byte_count); break;
  12.175 +    default: guarantee(false, err_msg("do_conjoint_swap: Invalid elem_size %zd\n", elem_size));
  12.176 +    }
  12.177 +  }
  12.178 +};
  12.179 +
  12.180 +void Copy::conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) {
  12.181 +  CopySwap::conjoint_swap(src, dst, byte_count, elem_size);
  12.182 +}
  12.183  
  12.184  // Fill bytes; larger units are filled atomically if everything is aligned.
  12.185  void Copy::fill_to_memory_atomic(void* to, size_t size, jubyte value) {
    13.1 --- a/src/share/vm/utilities/copy.hpp	Fri Nov 30 12:05:39 2018 +0000
    13.2 +++ b/src/share/vm/utilities/copy.hpp	Wed Dec 05 11:22:21 2018 +0000
    13.3 @@ -1,5 +1,5 @@
    13.4  /*
    13.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    13.6 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
    13.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.8   *
    13.9   * This code is free software; you can redistribute it and/or modify it
   13.10 @@ -227,6 +227,16 @@
   13.11      }
   13.12    }
   13.13  
   13.14 +  /**
   13.15 +   * Copy and *unconditionally* byte swap elements
   13.16 +   *
   13.17 +   * @param src address of source
   13.18 +   * @param dst address of destination
   13.19 +   * @param byte_count number of bytes to copy
   13.20 +   * @param elem_size size of the elements to copy-swap
   13.21 +   */
   13.22 +  static void conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size);
   13.23 +
   13.24    // Fill methods
   13.25  
   13.26    // Fill word-aligned words, not atomic on each word

mercurial