view patches/hotspot/shenandoah/8158260-pr2991-rh1341258.patch @ 2961:2c02d50412c9

Bump shenandoah to aarch64-shenandoah-jdk8u262-b01. Upstream changes: - JDK-8003209: JFR events for network utilization - JDK-8030680: 292 cleanup from default method code assessment - JDK-8041626: Shutdown tracing event - JDK-8141056: Erroneous assignment in HeapRegionSet.cpp - JDK-8165675: Trace event for thread park has incorrect unit for timeout - JDK-8183925: [AArch64] Decouple crash protection from watcher thread - JDK-8183925: Decouple crash protection from watcher thread - JDK-8191393: Random crashes during cfree+0x1c - JDK-8195817: JFR.stop should require name of recording - JDK-8195818: JFR.start should increase autogenerated name by one - JDK-8195819: Remove recording=x from jcmd JFR.check output - JDK-8199712: [AArch64] Flight Recorder - JDK-8199712: Flight Recorder - JDK-8202578: Revisit location for class unload events - JDK-8202835: jfr/event/os/TestSystemProcess.java fails on missing events - JDK-8203287: Zero fails to build after JDK-8199712 (Flight Recorder) - JDK-8203346: JFR: Inconsistent signature of jfr_add_string_constant - JDK-8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording - JDK-8203921: JFR thread sampling is missing fixes from JDK-8194552 - JDK-8203929: Limit amount of data for JFR.dump - JDK-8205516: JFR tool - JDK-8207392: [PPC64] Implement JFR profiling - JDK-8209960: -Xlog:jfr* doesn't work with the JFR - JDK-8210024: JFR calls virtual is_Java_thread from ~Thread() - JDK-8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7 - JDK-8211239: Build fails without JFR: empty JFR events signatures mismatch - JDK-8213015: Inconsistent settings between JFR.configure and -XX:FlightRecorderOptions - JDK-8213421: Line number information for execution samples always 0 - JDK-8213617: JFR should record the PID of the recorded process - JDK-8213966: The ZGC JFR events should be marked as experimental - JDK-8214542: JFR: Old Object Sample event slow on a deep heap in debug builds - JDK-8215175: Inconsistencies in JFR event metadata - JDK-8215284: Reduce noise induced by periodic task getFileSize() - JDK-8215355: Object monitor deadlock with no threads holding the monitor (using jemalloc 5.1) - JDK-8215961: jdk/jfr/event/os/TestCPUInformation.java fails on AArch64 - JDK-8216064: -XX:StartFlightRecording:settings= doesn't work properly - JDK-8216486: Possibility of integer overflow in JfrThreadSampler::run() - JDK-8216559: [JFR] Native libraries not correctly parsed from /proc/self/maps - JDK-8216578: Remove unused/obsolete method in JFR code - JDK-8216995: Clean up JFR command line processing - JDK-8218935: Make jfr strncpy uses GCC 8.x friendly - JDK-8223147: JFR Backport - JDK-8223689: Add JFR Thread Sampling Support - JDK-8223690: Add JFR BiasedLock Event Support - JDK-8223691: Add JFR G1 Region Type Change Event Support - JDK-8223692: Add JFR G1 Heap Summary Event Support - JDK-8224172: assert(jfr_is_event_enabled(id)) failed: invariant - JDK-8227011: Starting a JFR recording in response to JVMTI VMInit and / or Java agent premain corrupts memory - JDK-8227605: Kitchensink fails "assert((((klass)->trace_id() & (JfrTraceIdEpoch::leakp_in_use_this_epoch_bit())) != 0)) failed: invariant" - JDK-8229366: JFR backport allows unchecked writing to memory - JDK-8229401: Fix JFR code cache test failures - JDK-8229708: JFR backport code does not initialize - JDK-8229873: 8229401 broke jdk8u-jfr-incubator - JDK-8230707: JFR related tests are failing - JDK-8231995: two jtreg tests failed after 8229366 is fixed - JDK-8236008: Some backup files were accidentally left in the hotspot tree - JDK-8238076: Fix OpenJDK 7 Bootstrap Broken by JFR Backport - JDK-8238589: Necessary code cleanup in JFR for JDK8u - JDK-8239476: JDK-8238589 broke windows build by moving OrderedPair - JDK-8239867: correct over use of INCLUDE_JFR macro - JDK-8241444: Metaspace::_class_vsm not initialized if compressed class pointers are disabled - JDK-8241902: AIX Build broken after integration of JDK-8223147 (JFR Backport) - JDK-8242788: Non-PCH build is broken after JDK-8191393 ChangeLog: 2020-08-09 Andrew John Hughes <gnu_andrew@member.fsf.org> Bump shenandoah to aarch64-shenandoah-jdk8u262-b01. * Makefile.am: (ICEDTEA_PATCHES): Add backport of JDK-8251120/PR3793 so that JFR in the new Shenandoah HotSpot is not partially enabled. * NEWS: Updated. * hotspot.map.in: Bump shenandoah to aarch64-shenandoah-jdk8u262-b01. * patches/hotspot/aarch32/8143245-pr3548.patch, * patches/hotspot/aarch32/8158260-pr2991-rh1341258.patch, * patches/hotspot/aarch32/pr1975.patch: Replace symlinks with copies of the Shenandoah versions, so the Shenandoah copies can be updated to apply against the new drop. * patches/hotspot/shenandoah/8143245-pr3548.patch: Regenerated due to changed context in thread_linux_zero.cpp from JDK-8203287 (JFR Zero support). * patches/hotspot/shenandoah/8158260-pr2991-rh1341258.patch: Regenerated due to changed globals.hpp context from JDK-8223147 (JFR backport) * patches/hotspot/shenandoah/8251120-pr3793.patch: New patch so that HotSpot builds with ENABLE_JFR unset. * patches/hotspot/shenandoah/pr1975.patch: Regenerated due to changed g1MarkSweep.cpp context from JDK-8223147 (JFR backport)
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Sun, 09 Aug 2020 23:37:37 +0100
parents 6879be7790c8
children
line wrap: on
line source

# HG changeset patch
# User simonis
# Date 1466155884 -7200
#      Fri Jun 17 11:31:24 2016 +0200
# Node ID 4b40867e627dd9043bc67a4795caa9834ef69478
# Parent  3fc29347b27fdd2075e6ec6d80bb26ab2bf667c1
8158260, PR2991, RH1341258: PPC64: unaligned Unsafe.getInt can lead to the generation of illegal instructions
Summary: Adjust instruction generation. Includes portions of 8026049 for test case.
Reviewed-by: goetz
Contributed-by: gromero@linux.vnet.ibm.com, horii@jp.ibm.com

diff -Nru openjdk.orig/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp openjdk/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp
--- openjdk.orig/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	2019-01-03 15:14:40.000000000 +0000
+++ openjdk/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	2020-07-20 21:22:39.888675486 +0100
@@ -242,6 +242,11 @@
   if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
     UseMontgomerySquareIntrinsic = true;
   }
+
+  // This machine allows unaligned memory accesses
+  if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
+    FLAG_SET_DEFAULT(UseUnalignedAccesses, true);
+  }
 }
 
 void VM_Version::print_features() {
diff -Nru openjdk.orig/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp openjdk/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
--- openjdk.orig/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	2019-01-03 15:14:40.000000000 +0000
+++ openjdk/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	2020-07-20 21:22:39.889675497 +0100
@@ -386,6 +386,13 @@
     (cache_line_size > ContendedPaddingWidth))
     ContendedPaddingWidth = cache_line_size;
 
+  // This machine does not allow unaligned memory accesses
+  if (UseUnalignedAccesses) {
+    if (!FLAG_IS_DEFAULT(UseUnalignedAccesses))
+      warning("Unaligned memory access is not available on this CPU");
+    FLAG_SET_DEFAULT(UseUnalignedAccesses, false);
+  }
+
 #ifndef PRODUCT
   if (PrintMiscellaneous && Verbose) {
     tty->print_cr("L1 data cache line size: %u", L1_data_cache_line_size());
diff -Nru openjdk.orig/hotspot/src/cpu/x86/vm/vm_version_x86.cpp openjdk/hotspot/src/cpu/x86/vm/vm_version_x86.cpp
--- openjdk.orig/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	2019-01-03 15:14:40.000000000 +0000
+++ openjdk/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	2020-07-20 21:22:39.889675497 +0100
@@ -1056,6 +1056,11 @@
      (cache_line_size > ContendedPaddingWidth))
      ContendedPaddingWidth = cache_line_size;
 
+  // This machine allows unaligned memory accesses
+  if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
+    FLAG_SET_DEFAULT(UseUnalignedAccesses, true);
+  }
+
 #ifndef PRODUCT
   if (PrintMiscellaneous && Verbose) {
     tty->print_cr("Logical CPUs per core: %u",
diff -Nru openjdk.orig/hotspot/src/cpu/zero/vm/vm_version_zero.cpp openjdk/hotspot/src/cpu/zero/vm/vm_version_zero.cpp
--- openjdk.orig/hotspot/src/cpu/zero/vm/vm_version_zero.cpp	2019-01-03 15:14:40.000000000 +0000
+++ openjdk/hotspot/src/cpu/zero/vm/vm_version_zero.cpp	2020-07-20 21:22:39.889675497 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2009 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -36,4 +36,11 @@
 # include "os_bsd.inline.hpp"
 #endif
 
-// This file is intentionally empty
+
+void VM_Version::initialize() {
+  // This machine does not allow unaligned memory accesses
+  if (! FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
+    warning("Unaligned memory access is not available on this CPU");
+    FLAG_SET_DEFAULT(UseUnalignedAccesses, false);
+  }
+}
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-03 15:14:40.000000000 +0000
+++ openjdk/hotspot/src/share/vm/prims/unsafe.cpp	2020-07-20 21:22:39.889675497 +0100
@@ -395,6 +395,24 @@
 
 #endif // not SUPPORTS_NATIVE_CX8
 
+UNSAFE_ENTRY(jboolean, Unsafe_isBigEndian0(JNIEnv *env, jobject unsafe))
+  UnsafeWrapper("Unsafe_IsBigEndian0");
+  {
+#ifdef VM_LITTLE_ENDIAN
+    return false;
+#else
+    return true;
+#endif
+  }
+UNSAFE_END
+
+UNSAFE_ENTRY(jint, Unsafe_unalignedAccess0(JNIEnv *env, jobject unsafe))
+  UnsafeWrapper("Unsafe_UnalignedAccess0");
+  {
+    return UseUnalignedAccesses;
+  }
+UNSAFE_END
+
 #define DEFINE_GETSETOOP(jboolean, Boolean) \
  \
 UNSAFE_ENTRY(jboolean, Unsafe_Get##Boolean##140(JNIEnv *env, jobject unsafe, jobject obj, jint offset)) \
@@ -1715,6 +1733,11 @@
     {CC "fullFence",          CC "()V",                    FN_PTR(Unsafe_FullFence)},
 };
 
+JNINativeMethod cpu_methods[] = {
+    {CC"isBigEndian0",       CC"()Z",                    FN_PTR(Unsafe_isBigEndian0)},
+    {CC"unalignedAccess0",   CC"()Z",                    FN_PTR(Unsafe_unalignedAccess0)}
+};
+
 #undef CC
 #undef FN_PTR
 
@@ -1814,5 +1837,8 @@
 
     // Fence methods
     register_natives("1.8 fence methods", env, unsafecls, fence_methods, sizeof(fence_methods)/sizeof(JNINativeMethod));
+
+    // CPU methods
+    register_natives("1.9 CPU methods", env, unsafecls, cpu_methods, sizeof(cpu_methods)/sizeof(JNINativeMethod));
   }
 JVM_END
diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp openjdk/hotspot/src/share/vm/runtime/globals.hpp
--- openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp	2019-01-03 15:14:40.000000000 +0000
+++ openjdk/hotspot/src/share/vm/runtime/globals.hpp	2020-07-20 21:26:19.916023747 +0100
@@ -4001,6 +4001,9 @@
           "Allocation less than this value will be allocated "              \
           "using malloc. Larger allocations will use mmap.")                \
                                                                             \
+  diagnostic(bool, UseUnalignedAccesses, false,                             \
+          "Use unaligned memory accesses in sun.misc.Unsafe")               \
+                                                                            \
   product_pd(bool, PreserveFramePointer,                                    \
              "Use the FP register for holding the frame pointer "           \
              "and not as a general purpose register.")                      \
diff -Nru openjdk.orig/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java openjdk/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java
--- openjdk.orig/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java	1970-01-01 01:00:00.000000000 +0100
+++ openjdk/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java	2020-07-20 21:22:39.899675604 +0100
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2016 SAP SE. 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8158260
+ * @summary Test unaligned Unsafe accesses
+ * @modules java.base/jdk.internal.misc
+ * @run main/othervm -Diters=20000 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation JdkInternalMiscUnsafeUnalignedAccess
+ * @author volker.simonis@gmail.com
+ */
+
+import java.lang.reflect.Field;
+import java.nio.ByteOrder;
+import sun.misc.Unsafe;
+
+public class JdkInternalMiscUnsafeUnalignedAccess {
+    static final int ITERS = Integer.getInteger("iters", 20_000);
+    private static final boolean BIG_ENDIAN = ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN);
+    private static final Unsafe UNSAFE;
+    private static final int SIZE = 1024;
+    private static long memory;
+
+    static {
+        try {
+            Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
+            unsafeField.setAccessible(true);
+            UNSAFE = (Unsafe) unsafeField.get(null);
+        }
+        catch (Exception e) {
+            throw new RuntimeException("Unable to get Unsafe instance.", e);
+        }
+    }
+
+    static int getInt_0() {
+        return UNSAFE.getInt(memory + 0);
+    }
+    static int getInt_1() {
+        return UNSAFE.getInt(memory + 1);
+    }
+    static int getInt_4() {
+        return UNSAFE.getInt(memory + 4);
+    }
+    static int getInt_17() {
+        return UNSAFE.getInt(memory + 17);
+    }
+
+    static long getIntAsLong_0() {
+        return UNSAFE.getInt(memory + 0);
+    }
+    static long getIntAsLong_1() {
+        return UNSAFE.getInt(memory + 1);
+    }
+    static long getIntAsLong_4() {
+        return UNSAFE.getInt(memory + 4);
+    }
+    static long getIntAsLong_17() {
+        return UNSAFE.getInt(memory + 17);
+    }
+
+    static long getLong_0() {
+        return UNSAFE.getLong(memory + 0);
+    }
+    static long getLong_1() {
+        return UNSAFE.getLong(memory + 1);
+    }
+    static long getLong_4() {
+        return UNSAFE.getLong(memory + 4);
+    }
+    static long getLong_8() {
+        return UNSAFE.getLong(memory + 8);
+    }
+    static long getLong_17() {
+        return UNSAFE.getLong(memory + 17);
+    }
+
+    static void putInt_0(int i) {
+        UNSAFE.putInt(memory + 0, i);
+    }
+    static void putInt_1(int i) {
+        UNSAFE.putInt(memory + 1, i);
+    }
+    static void putInt_4(int i) {
+        UNSAFE.putInt(memory + 4, i);
+    }
+    static void putInt_17(int i) {
+        UNSAFE.putInt(memory + 17, i);
+    }
+
+    static void putLong_0(long l) {
+        UNSAFE.putLong(memory + 0, l);
+    }
+    static void putLong_1(long l) {
+        UNSAFE.putLong(memory + 1, l);
+    }
+    static void putLong_4(long l) {
+        UNSAFE.putLong(memory + 4, l);
+    }
+    static void putLong_8(long l) {
+        UNSAFE.putLong(memory + 8, l);
+    }
+    static void putLong_17(long l) {
+        UNSAFE.putLong(memory + 17, l);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        if (!UNSAFE.unalignedAccess()) {
+            System.out.println("Platform is not supporting unaligned access - nothing to test.");
+            return;
+        }
+
+        memory = UNSAFE.allocateMemory(SIZE);
+
+        UNSAFE.putInt(memory +  0, 0x00112233);
+        UNSAFE.putInt(memory +  4, 0x44556677);
+        UNSAFE.putInt(memory +  8, 0x8899aabb);
+        UNSAFE.putInt(memory + 12, 0xccddeeff);
+        UNSAFE.putInt(memory + 16, 0x01234567);
+        UNSAFE.putInt(memory + 20, 0x89abcdef);
+        UNSAFE.putInt(memory + 24, 0x01234567);
+
+        // Unsafe.getInt()
+        int res;
+        for (int i = 0; i < ITERS; i++) {
+            res = getInt_0();
+            if (res != 0x00112233) {
+                throw new Exception(res + " != 0x00112233");
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            res = getInt_1();
+            if (res != (BIG_ENDIAN ? 0x11223344 : 0x77001122)) {
+                throw new Exception(res + " != " + (BIG_ENDIAN ? 0x11223344 : 0x77001122));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            res = getInt_4();
+            if (res != 0x44556677) {
+                throw new Exception(res + " != 0x44556677");
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            res = getInt_17();
+            if (res != (BIG_ENDIAN ? 0x23456789 : 0xef012345)) {
+                throw new Exception(res + " != " + (BIG_ENDIAN ? 0x23456789 : 0xef012345));
+            }
+        }
+
+        // (long)Unsafe.getInt()
+        long lres;
+        for (int i = 0; i < ITERS; i++) {
+            lres = getIntAsLong_0();
+            if (lres != (long)0x00112233) {
+                throw new Exception(lres + " != 0x00112233");
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            lres = getIntAsLong_1();
+            if (lres != (BIG_ENDIAN ? (long)0x11223344 : (long)0x77001122)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? (long)0x11223344 : (long)0x77001122));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            lres = getIntAsLong_4();
+            if (lres != (long)0x44556677) {
+                throw new Exception(lres + " != 0x44556677");
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            lres = getIntAsLong_17();
+            if (lres != (BIG_ENDIAN ? (long)0x23456789 : (long)0xef012345)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? (long)0x23456789 : (long)0xef012345));
+            }
+        }
+
+        // Unsafe.getLong()
+        for (int i = 0; i < ITERS; i++) {
+            lres = getLong_0();
+            if (lres != (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            lres = getLong_1();
+            if (lres != (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            lres = getLong_4();
+            if (lres != (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            lres = getLong_8();
+            if (lres != (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            lres = getLong_17();
+            if (lres != (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L));
+            }
+        }
+
+        // Unsafe.putInt()
+        for (int i = 0; i < ITERS; i++) {
+            putInt_0(0x00112233);
+            res = getInt_0();
+            if (res != 0x00112233) {
+                throw new Exception(res + " != 0x00112233");
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            putInt_1(BIG_ENDIAN ? 0x11223344 : 0x77001122);
+            res = getInt_1();
+            if (res != (BIG_ENDIAN ? 0x11223344 : 0x77001122)) {
+                throw new Exception(res + " != " + (BIG_ENDIAN ? 0x11223344 : 0x77001122));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            putInt_4(0x44556677);
+            res = getInt_4();
+            if (res != 0x44556677) {
+                throw new Exception(res + " != 0x44556677");
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            putInt_17(BIG_ENDIAN ? 0x23456789 : 0xef012345);
+            res = getInt_17();
+            if (res != (BIG_ENDIAN ? 0x23456789 : 0xef012345)) {
+                throw new Exception(res + " != " + (BIG_ENDIAN ? 0x23456789 : 0xef012345));
+            }
+        }
+
+
+        // Unsafe.putLong()
+        for (int i = 0; i < ITERS; i++) {
+            putLong_0(BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L);
+            lres = getLong_0();
+            if (lres != (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            putLong_1(BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L);
+            lres = getLong_1();
+            if (lres != (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            putLong_4(BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L);
+            lres = getLong_4();
+            if (lres != (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            putLong_8(BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL);
+            lres = getLong_8();
+            if (lres != (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL));
+            }
+        }
+
+        for (int i = 0; i < ITERS; i++) {
+            putLong_17(BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L);
+            lres = getLong_17();
+            if (lres != (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L)) {
+                throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L));
+            }
+        }
+    }
+
+}