Mercurial > hg > icedtea8
changeset 2884:6cefe7d8e165
Bump shenandoah to aarch64-shenandoah-jdk8u201-b12.
Upstream changes:
- S8141491: Unaligned memory access in Bits.c
- S8205714: Initial class initialization
- S8210094: Better loading of classloader classes
- S8210431: Complete backport of libpng 1.6.35 TPRM
- S8213792: Update THIRTD_PARTY_README for LCMS to 2.9
- S8215951: AArch64: jtreg test vmTestbase/nsk/jvmti/PopFrame/popframe005 segfaults
- S8218185: aarch64: missing LoadStore barrier in TemplateTable::putfield_or_static
ChangeLog:
2019-02-25 Andrew John Hughes <gnu_andrew@member.fsf.org>
Bump shenandoah to aarch64-shenandoah-jdk8u201-b12.
* patches/hotspot/shenandoah/8141491-pr3159-g592292.patch:
Removed as applied upstream.
* Makefile.am:
(ICEDTEA_PATCHES): Move upstreamed Shenandoah patches to
AArch32-only section.
* NEWS: Updated.
* hotspot.map.in: Bump shenandoah to
aarch64-shenandoah-jdk8u201-b12.
* patches/hotspot/aarch32/8141491-pr3159-g592292.patch:
Replace symlink with a copy as Shenandoah version removed.
author | Andrew John Hughes <gnu_andrew@member.fsf.org> |
---|---|
date | Tue, 26 Feb 2019 22:15:38 +0000 |
parents | 97c468298911 |
children | dec9eb764f70 |
files | ChangeLog Makefile.am NEWS hotspot.map.in patches/hotspot/aarch32/8141491-pr3159-g592292.patch patches/hotspot/shenandoah/8141491-pr3159-g592292.patch |
diffstat | 6 files changed, 331 insertions(+), 316 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Feb 18 05:39:38 2019 +0000 +++ b/ChangeLog Tue Feb 26 22:15:38 2019 +0000 @@ -1,3 +1,17 @@ +2019-02-25 Andrew John Hughes <gnu_andrew@member.fsf.org> + + Bump shenandoah to aarch64-shenandoah-jdk8u201-b12. + * patches/hotspot/shenandoah/8141491-pr3159-g592292.patch: + Removed as applied upstream. + * Makefile.am: + (ICEDTEA_PATCHES): Move upstreamed Shenandoah patches to + AArch32-only section. + * NEWS: Updated. + * hotspot.map.in: Bump shenandoah to + aarch64-shenandoah-jdk8u201-b12. + * patches/hotspot/aarch32/8141491-pr3159-g592292.patch: + Replace symlink with a copy as Shenandoah version removed. + 2019-02-17 Andrew John Hughes <gnu_andrew@member.fsf.org> Bump to icedtea-3.11.0.
--- a/Makefile.am Mon Feb 18 05:39:38 2019 +0000 +++ b/Makefile.am Tue Feb 26 22:15:38 2019 +0000 @@ -350,7 +350,8 @@ if WITH_AARCH32_HSBUILD ICEDTEA_PATCHES += \ patches/hotspot/$(HSBUILD)/pr3548-aarch32.patch \ - patches/hotspot/$(HSBUILD)/8078628-pr3208.patch + patches/hotspot/$(HSBUILD)/8078628-pr3208.patch \ + patches/hotspot/$(HSBUILD)/8141491-pr3159-g592292.patch endif ICEDTEA_PATCHES += \ @@ -368,7 +369,6 @@ patches/hotspot/$(HSBUILD)/pr1975.patch \ patches/hotspot/$(HSBUILD)/pr2777.patch \ patches/hotspot/$(HSBUILD)/werror.patch \ - patches/hotspot/$(HSBUILD)/8141491-pr3159-g592292.patch \ patches/hotspot/$(HSBUILD)/8043780-pr3368.patch \ patches/hotspot/$(HSBUILD)/8187667-pr3517-readdir_r.patch \ patches/hotspot/$(HSBUILD)/8196978-pr3517-gcc_4_pragmas.patch \
--- a/NEWS Mon Feb 18 05:39:38 2019 +0000 +++ b/NEWS Tue Feb 26 22:15:38 2019 +0000 @@ -110,6 +110,7 @@ - S8201369: Inet4AddressImpl_getLocalHostName reverse lookup on Solaris only - S8202600: [Zero] Undefined behaviour in src/os_cpu/linux_zero/vm/os_linux_zero.cpp - S8202696: Remove exclusion range for phonetic chars in windows fontconfig.properties + - S8203349: 8u hotspot should recognise later Windows compilers - S8203368: ObjectInputStream filterCheck method throws NullPointerException - S8203499: Uninitialised memory in WinAccessBridge.cpp - S8203790: MSVCP dependency introduced in awt.dll @@ -174,7 +175,8 @@ - S8189170, PR3682: [AArch64] Add option to disable stack overflow checking in primordial thread for use with JNI_CreateJavaJVM - S8209414, PR3682: [AArch64] method handle invocation does not respect JVMTI interp_only mode * Shenandoah - - S8203349: 8u hotspot should recognise later Windows compilers + - S8215951: AArch64: jtreg test vmTestbase/nsk/jvmti/PopFrame/popframe005 segfaults + - S8218185: aarch64: missing LoadStore barrier in TemplateTable::putfield_or_static New in release 3.10.0 (2018-12-25):
--- a/hotspot.map.in Mon Feb 18 05:39:38 2019 +0000 +++ b/hotspot.map.in Tue Feb 26 22:15:38 2019 +0000 @@ -1,4 +1,4 @@ # version type(drop/hg) url changeset sha256sum default drop http://icedtea.classpath.org/download/drops/icedtea8/@ICEDTEA_RELEASE@ 36d303abca2b e4a8c33e1f7a49bf3ea62eec6b25f9c4cfb110f7fea8a243a3ce6ddc0f6655cc -shenandoah drop http://icedtea.classpath.org/download/drops/icedtea8/@ICEDTEA_RELEASE@ 106435e9e204 bb55e33d53cb5438fa9e16a1ef5f82ebb793a1248f75c0518e861b8dd60bbaba +shenandoah drop http://icedtea.classpath.org/download/drops/icedtea8/@ICEDTEA_RELEASE@ 1e8639cc8075 60ab5ecbe6a35b57aa70087ccc4b40de03e7079e3d0caedc17c9cff7f9223ae0 aarch32 drop http://icedtea.classpath.org/download/drops/icedtea8/@ICEDTEA_RELEASE@ 8b4e37a274de ce43ce10106cfc06f6b234d917d53765ed7a94168818a468ccf45bedc3683de0
--- a/patches/hotspot/aarch32/8141491-pr3159-g592292.patch Mon Feb 18 05:39:38 2019 +0000 +++ b/patches/hotspot/aarch32/8141491-pr3159-g592292.patch Tue Feb 26 22:15:38 2019 +0000 @@ -1,1 +1,311 @@ -../shenandoah/8141491-pr3159-g592292.patch \ No newline at end of file +# HG changeset patch +# User mikael +# Date 1477450078 -3600 +# Wed Oct 26 03:47:58 2016 +0100 +# Node ID bca09127475293c1938b5413fbf25af2c281c597 +# Parent 3e73be729f73e0466652abea2fa205cf196e9941 +8141491, PR3159, G592292: Unaligned memory access in Bits.c +Summary: Introduce alignment-safe Copy::conjoint_swap and j.i.m.Unsafe.copySwapMemory +Reviewed-by: jrose, dholmes, psandoz + +diff -Nru openjdk.orig/hotspot/src/share/vm/prims/unsafe.cpp openjdk/hotspot/src/share/vm/prims/unsafe.cpp +--- openjdk.orig/hotspot/src/share/vm/prims/unsafe.cpp 2019-01-25 15:09:02.521904826 +0000 ++++ openjdk/hotspot/src/share/vm/prims/unsafe.cpp 2019-01-29 17:57:15.651251367 +0000 +@@ -737,6 +737,36 @@ + Copy::conjoint_memory_atomic(src, dst, sz); + UNSAFE_END + ++// This function is a leaf since if the source and destination are both in native memory ++// the copy may potentially be very large, and we don't want to disable GC if we can avoid it. ++// If either source or destination (or both) are on the heap, the function will enter VM using ++// JVM_ENTRY_FROM_LEAF ++JVM_LEAF(void, Unsafe_CopySwapMemory0(JNIEnv *env, jobject unsafe, jobject srcObj, jlong srcOffset, jobject dstObj, jlong dstOffset, jlong size, jlong elemSize)) { ++ UnsafeWrapper("Unsafe_CopySwapMemory0"); ++ ++ size_t sz = (size_t)size; ++ size_t esz = (size_t)elemSize; ++ ++ if (srcObj == NULL && dstObj == NULL) { ++ // Both src & dst are in native memory ++ address src = (address)srcOffset; ++ address dst = (address)dstOffset; ++ ++ Copy::conjoint_swap(src, dst, sz, esz); ++ } else { ++ // At least one of src/dst are on heap, transition to VM to access raw pointers ++ ++ JVM_ENTRY_FROM_LEAF(env, void, Unsafe_CopySwapMemory0) { ++ oop srcp = JNIHandles::resolve(srcObj); ++ oop dstp = JNIHandles::resolve(dstObj); ++ ++ address src = (address)index_oop_from_field_offset_long(srcp, srcOffset); ++ address dst = (address)index_oop_from_field_offset_long(dstp, dstOffset); ++ ++ Copy::conjoint_swap(src, dst, sz, esz); ++ } JVM_END ++ } ++} JVM_END + + ////// Random queries + +@@ -1712,6 +1742,7 @@ + + JNINativeMethod memcopy_methods_17[] = { + {CC "copyMemory", CC "(" OBJ "J" OBJ "JJ)V", FN_PTR(Unsafe_CopyMemory2)}, ++ {CC "copySwapMemory0", CC "(" OBJ "J" OBJ "JJJ)V", FN_PTR(Unsafe_CopySwapMemory0)}, + {CC "setMemory", CC "(" OBJ "JJB)V", FN_PTR(Unsafe_SetMemory2)} + }; + +diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/interfaceSupport.hpp openjdk/hotspot/src/share/vm/runtime/interfaceSupport.hpp +--- openjdk.orig/hotspot/src/share/vm/runtime/interfaceSupport.hpp 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/runtime/interfaceSupport.hpp 2019-01-29 02:57:27.690537317 +0000 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -431,6 +431,14 @@ + os::verify_stack_alignment(); \ + /* begin of body */ + ++#define VM_ENTRY_BASE_FROM_LEAF(result_type, header, thread) \ ++ TRACE_CALL(result_type, header) \ ++ debug_only(ResetNoHandleMark __rnhm;) \ ++ HandleMarkCleaner __hm(thread); \ ++ Thread* THREAD = thread; \ ++ os::verify_stack_alignment(); \ ++ /* begin of body */ ++ + + // ENTRY routines may lock, GC and throw exceptions + +@@ -592,6 +600,14 @@ + VM_LEAF_BASE(result_type, header) + + ++#define JVM_ENTRY_FROM_LEAF(env, result_type, header) \ ++ { { \ ++ JavaThread* thread=JavaThread::thread_from_jni_environment(env); \ ++ ThreadInVMfromNative __tiv(thread); \ ++ debug_only(VMNativeEntryWrapper __vew;) \ ++ VM_ENTRY_BASE_FROM_LEAF(result_type, header, thread) ++ ++ + #define JVM_END } } + + #endif // SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP +diff -Nru openjdk.orig/hotspot/src/share/vm/utilities/copy.cpp openjdk/hotspot/src/share/vm/utilities/copy.cpp +--- openjdk.orig/hotspot/src/share/vm/utilities/copy.cpp 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/utilities/copy.cpp 2019-01-29 02:57:27.690537317 +0000 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -53,6 +53,175 @@ + } + } + ++class CopySwap : AllStatic { ++public: ++ /** ++ * Copy and byte swap elements ++ * ++ * @param src address of source ++ * @param dst address of destination ++ * @param byte_count number of bytes to copy ++ * @param elem_size size of the elements to copy-swap ++ */ ++ static void conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) { ++ assert(src != NULL, err_msg("address must not be NULL")); ++ assert(dst != NULL, err_msg("address must not be NULL")); ++ assert(elem_size == 2 || elem_size == 4 || elem_size == 8, ++ err_msg("incorrect element size: " SIZE_FORMAT, elem_size)); ++ assert(is_size_aligned(byte_count, elem_size), ++ err_msg("byte_count " SIZE_FORMAT " must be multiple of element size " SIZE_FORMAT, byte_count, elem_size)); ++ ++ address src_end = src + byte_count; ++ ++ if (dst <= src || dst >= src_end) { ++ do_conjoint_swap<RIGHT>(src, dst, byte_count, elem_size); ++ } else { ++ do_conjoint_swap<LEFT>(src, dst, byte_count, elem_size); ++ } ++ } ++ ++private: ++ /** ++ * Byte swap a 16-bit value ++ */ ++ static uint16_t byte_swap(uint16_t x) { ++ return (x << 8) | (x >> 8); ++ } ++ ++ /** ++ * Byte swap a 32-bit value ++ */ ++ static uint32_t byte_swap(uint32_t x) { ++ uint16_t lo = (uint16_t)x; ++ uint16_t hi = (uint16_t)(x >> 16); ++ ++ return ((uint32_t)byte_swap(lo) << 16) | (uint32_t)byte_swap(hi); ++ } ++ ++ /** ++ * Byte swap a 64-bit value ++ */ ++ static uint64_t byte_swap(uint64_t x) { ++ uint32_t lo = (uint32_t)x; ++ uint32_t hi = (uint32_t)(x >> 32); ++ ++ return ((uint64_t)byte_swap(lo) << 32) | (uint64_t)byte_swap(hi); ++ } ++ ++ enum CopyDirection { ++ RIGHT, // lower -> higher address ++ LEFT // higher -> lower address ++ }; ++ ++ /** ++ * Copy and byte swap elements ++ * ++ * <T> - type of element to copy ++ * <D> - copy direction ++ * <is_src_aligned> - true if src argument is aligned to element size ++ * <is_dst_aligned> - true if dst argument is aligned to element size ++ * ++ * @param src address of source ++ * @param dst address of destination ++ * @param byte_count number of bytes to copy ++ */ ++ template <typename T, CopyDirection D, bool is_src_aligned, bool is_dst_aligned> ++ static void do_conjoint_swap(address src, address dst, size_t byte_count) { ++ address cur_src, cur_dst; ++ ++ switch (D) { ++ case RIGHT: ++ cur_src = src; ++ cur_dst = dst; ++ break; ++ case LEFT: ++ cur_src = src + byte_count - sizeof(T); ++ cur_dst = dst + byte_count - sizeof(T); ++ break; ++ } ++ ++ for (size_t i = 0; i < byte_count / sizeof(T); i++) { ++ T tmp; ++ ++ if (is_src_aligned) { ++ tmp = *(T*)cur_src; ++ } else { ++ memcpy(&tmp, cur_src, sizeof(T)); ++ } ++ ++ tmp = byte_swap(tmp); ++ ++ if (is_dst_aligned) { ++ *(T*)cur_dst = tmp; ++ } else { ++ memcpy(cur_dst, &tmp, sizeof(T)); ++ } ++ ++ switch (D) { ++ case RIGHT: ++ cur_src += sizeof(T); ++ cur_dst += sizeof(T); ++ break; ++ case LEFT: ++ cur_src -= sizeof(T); ++ cur_dst -= sizeof(T); ++ break; ++ } ++ } ++ } ++ ++ /** ++ * Copy and byte swap elements ++ * ++ * <T> - type of element to copy ++ * <D> - copy direction ++ * ++ * @param src address of source ++ * @param dst address of destination ++ * @param byte_count number of bytes to copy ++ */ ++ template <typename T, CopyDirection direction> ++ static void do_conjoint_swap(address src, address dst, size_t byte_count) { ++ if (is_ptr_aligned(src, sizeof(T))) { ++ if (is_ptr_aligned(dst, sizeof(T))) { ++ do_conjoint_swap<T,direction,true,true>(src, dst, byte_count); ++ } else { ++ do_conjoint_swap<T,direction,true,false>(src, dst, byte_count); ++ } ++ } else { ++ if (is_ptr_aligned(dst, sizeof(T))) { ++ do_conjoint_swap<T,direction,false,true>(src, dst, byte_count); ++ } else { ++ do_conjoint_swap<T,direction,false,false>(src, dst, byte_count); ++ } ++ } ++ } ++ ++ ++ /** ++ * Copy and byte swap elements ++ * ++ * <D> - copy direction ++ * ++ * @param src address of source ++ * @param dst address of destination ++ * @param byte_count number of bytes to copy ++ * @param elem_size size of the elements to copy-swap ++ */ ++ template <CopyDirection D> ++ static void do_conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) { ++ switch (elem_size) { ++ case 2: do_conjoint_swap<uint16_t,D>(src, dst, byte_count); break; ++ case 4: do_conjoint_swap<uint32_t,D>(src, dst, byte_count); break; ++ case 8: do_conjoint_swap<uint64_t,D>(src, dst, byte_count); break; ++ default: guarantee(false, err_msg("do_conjoint_swap: Invalid elem_size %zd\n", elem_size)); ++ } ++ } ++}; ++ ++void Copy::conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) { ++ CopySwap::conjoint_swap(src, dst, byte_count, elem_size); ++} + + // Fill bytes; larger units are filled atomically if everything is aligned. + void Copy::fill_to_memory_atomic(void* to, size_t size, jubyte value) { +diff -Nru openjdk.orig/hotspot/src/share/vm/utilities/copy.hpp openjdk/hotspot/src/share/vm/utilities/copy.hpp +--- openjdk.orig/hotspot/src/share/vm/utilities/copy.hpp 2019-01-16 07:13:59.000000000 +0000 ++++ openjdk/hotspot/src/share/vm/utilities/copy.hpp 2019-01-29 02:57:27.690537317 +0000 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -227,6 +227,16 @@ + } + } + ++ /** ++ * Copy and *unconditionally* byte swap elements ++ * ++ * @param src address of source ++ * @param dst address of destination ++ * @param byte_count number of bytes to copy ++ * @param elem_size size of the elements to copy-swap ++ */ ++ static void conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size); ++ + // Fill methods + + // Fill word-aligned words, not atomic on each word
--- a/patches/hotspot/shenandoah/8141491-pr3159-g592292.patch Mon Feb 18 05:39:38 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,311 +0,0 @@ -# HG changeset patch -# User mikael -# Date 1477450078 -3600 -# Wed Oct 26 03:47:58 2016 +0100 -# Node ID bca09127475293c1938b5413fbf25af2c281c597 -# Parent 3e73be729f73e0466652abea2fa205cf196e9941 -8141491, PR3159, G592292: Unaligned memory access in Bits.c -Summary: Introduce alignment-safe Copy::conjoint_swap and j.i.m.Unsafe.copySwapMemory -Reviewed-by: jrose, dholmes, psandoz - -diff -Nru openjdk.orig/hotspot/src/share/vm/prims/unsafe.cpp openjdk/hotspot/src/share/vm/prims/unsafe.cpp ---- openjdk.orig/hotspot/src/share/vm/prims/unsafe.cpp 2019-01-25 15:09:02.521904826 +0000 -+++ openjdk/hotspot/src/share/vm/prims/unsafe.cpp 2019-01-29 17:57:15.651251367 +0000 -@@ -737,6 +737,36 @@ - Copy::conjoint_memory_atomic(src, dst, sz); - UNSAFE_END - -+// This function is a leaf since if the source and destination are both in native memory -+// the copy may potentially be very large, and we don't want to disable GC if we can avoid it. -+// If either source or destination (or both) are on the heap, the function will enter VM using -+// JVM_ENTRY_FROM_LEAF -+JVM_LEAF(void, Unsafe_CopySwapMemory0(JNIEnv *env, jobject unsafe, jobject srcObj, jlong srcOffset, jobject dstObj, jlong dstOffset, jlong size, jlong elemSize)) { -+ UnsafeWrapper("Unsafe_CopySwapMemory0"); -+ -+ size_t sz = (size_t)size; -+ size_t esz = (size_t)elemSize; -+ -+ if (srcObj == NULL && dstObj == NULL) { -+ // Both src & dst are in native memory -+ address src = (address)srcOffset; -+ address dst = (address)dstOffset; -+ -+ Copy::conjoint_swap(src, dst, sz, esz); -+ } else { -+ // At least one of src/dst are on heap, transition to VM to access raw pointers -+ -+ JVM_ENTRY_FROM_LEAF(env, void, Unsafe_CopySwapMemory0) { -+ oop srcp = JNIHandles::resolve(srcObj); -+ oop dstp = JNIHandles::resolve(dstObj); -+ -+ address src = (address)index_oop_from_field_offset_long(srcp, srcOffset); -+ address dst = (address)index_oop_from_field_offset_long(dstp, dstOffset); -+ -+ Copy::conjoint_swap(src, dst, sz, esz); -+ } JVM_END -+ } -+} JVM_END - - ////// Random queries - -@@ -1712,6 +1742,7 @@ - - JNINativeMethod memcopy_methods_17[] = { - {CC "copyMemory", CC "(" OBJ "J" OBJ "JJ)V", FN_PTR(Unsafe_CopyMemory2)}, -+ {CC "copySwapMemory0", CC "(" OBJ "J" OBJ "JJJ)V", FN_PTR(Unsafe_CopySwapMemory0)}, - {CC "setMemory", CC "(" OBJ "JJB)V", FN_PTR(Unsafe_SetMemory2)} - }; - -diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/interfaceSupport.hpp openjdk/hotspot/src/share/vm/runtime/interfaceSupport.hpp ---- openjdk.orig/hotspot/src/share/vm/runtime/interfaceSupport.hpp 2019-01-16 07:13:59.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/runtime/interfaceSupport.hpp 2019-01-29 02:57:27.690537317 +0000 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -431,6 +431,14 @@ - os::verify_stack_alignment(); \ - /* begin of body */ - -+#define VM_ENTRY_BASE_FROM_LEAF(result_type, header, thread) \ -+ TRACE_CALL(result_type, header) \ -+ debug_only(ResetNoHandleMark __rnhm;) \ -+ HandleMarkCleaner __hm(thread); \ -+ Thread* THREAD = thread; \ -+ os::verify_stack_alignment(); \ -+ /* begin of body */ -+ - - // ENTRY routines may lock, GC and throw exceptions - -@@ -592,6 +600,14 @@ - VM_LEAF_BASE(result_type, header) - - -+#define JVM_ENTRY_FROM_LEAF(env, result_type, header) \ -+ { { \ -+ JavaThread* thread=JavaThread::thread_from_jni_environment(env); \ -+ ThreadInVMfromNative __tiv(thread); \ -+ debug_only(VMNativeEntryWrapper __vew;) \ -+ VM_ENTRY_BASE_FROM_LEAF(result_type, header, thread) -+ -+ - #define JVM_END } } - - #endif // SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP -diff -Nru openjdk.orig/hotspot/src/share/vm/utilities/copy.cpp openjdk/hotspot/src/share/vm/utilities/copy.cpp ---- openjdk.orig/hotspot/src/share/vm/utilities/copy.cpp 2019-01-16 07:13:59.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/utilities/copy.cpp 2019-01-29 02:57:27.690537317 +0000 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -53,6 +53,175 @@ - } - } - -+class CopySwap : AllStatic { -+public: -+ /** -+ * Copy and byte swap elements -+ * -+ * @param src address of source -+ * @param dst address of destination -+ * @param byte_count number of bytes to copy -+ * @param elem_size size of the elements to copy-swap -+ */ -+ static void conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) { -+ assert(src != NULL, err_msg("address must not be NULL")); -+ assert(dst != NULL, err_msg("address must not be NULL")); -+ assert(elem_size == 2 || elem_size == 4 || elem_size == 8, -+ err_msg("incorrect element size: " SIZE_FORMAT, elem_size)); -+ assert(is_size_aligned(byte_count, elem_size), -+ err_msg("byte_count " SIZE_FORMAT " must be multiple of element size " SIZE_FORMAT, byte_count, elem_size)); -+ -+ address src_end = src + byte_count; -+ -+ if (dst <= src || dst >= src_end) { -+ do_conjoint_swap<RIGHT>(src, dst, byte_count, elem_size); -+ } else { -+ do_conjoint_swap<LEFT>(src, dst, byte_count, elem_size); -+ } -+ } -+ -+private: -+ /** -+ * Byte swap a 16-bit value -+ */ -+ static uint16_t byte_swap(uint16_t x) { -+ return (x << 8) | (x >> 8); -+ } -+ -+ /** -+ * Byte swap a 32-bit value -+ */ -+ static uint32_t byte_swap(uint32_t x) { -+ uint16_t lo = (uint16_t)x; -+ uint16_t hi = (uint16_t)(x >> 16); -+ -+ return ((uint32_t)byte_swap(lo) << 16) | (uint32_t)byte_swap(hi); -+ } -+ -+ /** -+ * Byte swap a 64-bit value -+ */ -+ static uint64_t byte_swap(uint64_t x) { -+ uint32_t lo = (uint32_t)x; -+ uint32_t hi = (uint32_t)(x >> 32); -+ -+ return ((uint64_t)byte_swap(lo) << 32) | (uint64_t)byte_swap(hi); -+ } -+ -+ enum CopyDirection { -+ RIGHT, // lower -> higher address -+ LEFT // higher -> lower address -+ }; -+ -+ /** -+ * Copy and byte swap elements -+ * -+ * <T> - type of element to copy -+ * <D> - copy direction -+ * <is_src_aligned> - true if src argument is aligned to element size -+ * <is_dst_aligned> - true if dst argument is aligned to element size -+ * -+ * @param src address of source -+ * @param dst address of destination -+ * @param byte_count number of bytes to copy -+ */ -+ template <typename T, CopyDirection D, bool is_src_aligned, bool is_dst_aligned> -+ static void do_conjoint_swap(address src, address dst, size_t byte_count) { -+ address cur_src, cur_dst; -+ -+ switch (D) { -+ case RIGHT: -+ cur_src = src; -+ cur_dst = dst; -+ break; -+ case LEFT: -+ cur_src = src + byte_count - sizeof(T); -+ cur_dst = dst + byte_count - sizeof(T); -+ break; -+ } -+ -+ for (size_t i = 0; i < byte_count / sizeof(T); i++) { -+ T tmp; -+ -+ if (is_src_aligned) { -+ tmp = *(T*)cur_src; -+ } else { -+ memcpy(&tmp, cur_src, sizeof(T)); -+ } -+ -+ tmp = byte_swap(tmp); -+ -+ if (is_dst_aligned) { -+ *(T*)cur_dst = tmp; -+ } else { -+ memcpy(cur_dst, &tmp, sizeof(T)); -+ } -+ -+ switch (D) { -+ case RIGHT: -+ cur_src += sizeof(T); -+ cur_dst += sizeof(T); -+ break; -+ case LEFT: -+ cur_src -= sizeof(T); -+ cur_dst -= sizeof(T); -+ break; -+ } -+ } -+ } -+ -+ /** -+ * Copy and byte swap elements -+ * -+ * <T> - type of element to copy -+ * <D> - copy direction -+ * -+ * @param src address of source -+ * @param dst address of destination -+ * @param byte_count number of bytes to copy -+ */ -+ template <typename T, CopyDirection direction> -+ static void do_conjoint_swap(address src, address dst, size_t byte_count) { -+ if (is_ptr_aligned(src, sizeof(T))) { -+ if (is_ptr_aligned(dst, sizeof(T))) { -+ do_conjoint_swap<T,direction,true,true>(src, dst, byte_count); -+ } else { -+ do_conjoint_swap<T,direction,true,false>(src, dst, byte_count); -+ } -+ } else { -+ if (is_ptr_aligned(dst, sizeof(T))) { -+ do_conjoint_swap<T,direction,false,true>(src, dst, byte_count); -+ } else { -+ do_conjoint_swap<T,direction,false,false>(src, dst, byte_count); -+ } -+ } -+ } -+ -+ -+ /** -+ * Copy and byte swap elements -+ * -+ * <D> - copy direction -+ * -+ * @param src address of source -+ * @param dst address of destination -+ * @param byte_count number of bytes to copy -+ * @param elem_size size of the elements to copy-swap -+ */ -+ template <CopyDirection D> -+ static void do_conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) { -+ switch (elem_size) { -+ case 2: do_conjoint_swap<uint16_t,D>(src, dst, byte_count); break; -+ case 4: do_conjoint_swap<uint32_t,D>(src, dst, byte_count); break; -+ case 8: do_conjoint_swap<uint64_t,D>(src, dst, byte_count); break; -+ default: guarantee(false, err_msg("do_conjoint_swap: Invalid elem_size %zd\n", elem_size)); -+ } -+ } -+}; -+ -+void Copy::conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) { -+ CopySwap::conjoint_swap(src, dst, byte_count, elem_size); -+} - - // Fill bytes; larger units are filled atomically if everything is aligned. - void Copy::fill_to_memory_atomic(void* to, size_t size, jubyte value) { -diff -Nru openjdk.orig/hotspot/src/share/vm/utilities/copy.hpp openjdk/hotspot/src/share/vm/utilities/copy.hpp ---- openjdk.orig/hotspot/src/share/vm/utilities/copy.hpp 2019-01-16 07:13:59.000000000 +0000 -+++ openjdk/hotspot/src/share/vm/utilities/copy.hpp 2019-01-29 02:57:27.690537317 +0000 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -227,6 +227,16 @@ - } - } - -+ /** -+ * Copy and *unconditionally* byte swap elements -+ * -+ * @param src address of source -+ * @param dst address of destination -+ * @param byte_count number of bytes to copy -+ * @param elem_size size of the elements to copy-swap -+ */ -+ static void conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size); -+ - // Fill methods - - // Fill word-aligned words, not atomic on each word