Merge
authorjwilhelm
Thu, 17 Aug 2017 19:35:37 +0200
changeset 46885 47470fa93305
parent 46836 2684bef98033 (current diff)
parent 46884 b2c074043e74 (diff)
child 46886 0831cfe33d5e
Merge
--- a/jdk/make/launcher/Launcher-jdk.aot.gmk	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/make/launcher/Launcher-jdk.aot.gmk	Thu Aug 17 19:35:37 2017 +0200
@@ -46,6 +46,7 @@
         --add-exports=jdk.internal.vm.ci/jdk.vm.ci.runtime=$(call CommaList, jdk.internal.vm.compiler  jdk.aot) \
         --add-exports=jdk.internal.vm.ci/jdk.vm.ci.sparc=$(call CommaList, jdk.internal.vm.compiler  jdk.aot)  \
         -XX:+UseAOT \
+        -XX:+CalculateClassFingerprint \
         -Djvmci.UseProfilingInformation=false \
         -Dgraal.UseExceptionProbability=false \
         -Djvmci.Compiler=graal \
--- a/jdk/make/test/JtregNative.gmk	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/make/test/JtregNative.gmk	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, 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
@@ -35,12 +35,14 @@
 include MakeBase.gmk
 include TestFilesCompilation.gmk
 
+$(eval $(call IncludeCustomExtension, jdk, test/JtregNative.gmk))
+
 ################################################################################
 # Targets for building the native tests themselves.
 ################################################################################
 
 # Add more directories here when needed.
-BUILD_JDK_JTREG_NATIVE_SRC := \
+BUILD_JDK_JTREG_NATIVE_SRC += \
     $(JDK_TOPDIR)/test/native_sanity \
     $(JDK_TOPDIR)/test/java/lang/String/nativeEncoding \
     #
--- a/jdk/src/java.base/aix/native/libnet/aix_close.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/aix/native/libnet/aix_close.c	Thu Aug 17 19:35:37 2017 +0200
@@ -64,7 +64,7 @@
 #include <sys/uio.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include "jvm.h"
 #include "net_util.h"
 
--- a/jdk/src/java.base/aix/native/libnio/ch/AixPollPort.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/aix/native/libnio/ch/AixPollPort.c	Thu Aug 17 19:35:37 2017 +0200
@@ -34,7 +34,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/pollset.h>
 #include <fcntl.h>
 #include <stddef.h>
--- a/jdk/src/java.base/linux/native/libnet/linux_close.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/linux/native/libnet/linux_close.c	Thu Aug 17 19:35:37 2017 +0200
@@ -36,7 +36,7 @@
 #include <sys/uio.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include "jvm.h"
 #include "net_util.h"
 
--- a/jdk/src/java.base/linux/native/libnio/fs/LinuxWatchService.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/linux/native/libnio/fs/LinuxWatchService.c	Thu Aug 17 19:35:37 2017 +0200
@@ -32,7 +32,7 @@
 #include <dlfcn.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/inotify.h>
 
 #include "sun_nio_fs_LinuxWatchService.h"
--- a/jdk/src/java.base/macosx/native/include/jvm_md.h	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/macosx/native/include/jvm_md.h	Thu Aug 17 19:35:37 2017 +0200
@@ -60,7 +60,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 /* O Flags */
 
--- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c	Thu Aug 17 19:35:37 2017 +0200
@@ -290,8 +290,6 @@
  */
 static void *apple_main (void *arg)
 {
-    objc_registerThreadWithCollector();
-
     if (main_fptr == NULL) {
 #ifdef STATIC_BUILD
         extern int main(int argc, char **argv);
@@ -732,6 +730,7 @@
     if (stack_size > 0) {
       pthread_attr_setstacksize(&attr, stack_size);
     }
+    pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads
 
     if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
       void * tmp;
@@ -771,7 +770,7 @@
 void
 RegisterThread()
 {
-    objc_registerThreadWithCollector();
+    // stubbed out for windows and *nixes.
 }
 
 static void
--- a/jdk/src/java.base/macosx/native/libnet/bsd_close.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/macosx/native/libnet/bsd_close.c	Thu Aug 17 19:35:37 2017 +0200
@@ -38,7 +38,7 @@
 #include <sys/uio.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include "jvm.h"
 #include "net_util.h"
 
--- a/jdk/src/java.base/share/classes/java/io/File.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/io/File.java	Thu Aug 17 19:35:37 2017 +0200
@@ -2241,22 +2241,12 @@
         UNSAFE.putIntVolatile(this, PREFIX_LENGTH_OFFSET, fs.prefixLength(path));
     }
 
-    private static final long PATH_OFFSET;
-    private static final long PREFIX_LENGTH_OFFSET;
-    private static final jdk.internal.misc.Unsafe UNSAFE;
-    static {
-        try {
-            jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
-            PATH_OFFSET = unsafe.objectFieldOffset(
-                    File.class.getDeclaredField("path"));
-            PREFIX_LENGTH_OFFSET = unsafe.objectFieldOffset(
-                    File.class.getDeclaredField("prefixLength"));
-            UNSAFE = unsafe;
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
-    }
-
+    private static final jdk.internal.misc.Unsafe UNSAFE
+            = jdk.internal.misc.Unsafe.getUnsafe();
+    private static final long PATH_OFFSET
+            = UNSAFE.objectFieldOffset(File.class, "path");
+    private static final long PREFIX_LENGTH_OFFSET
+            = UNSAFE.objectFieldOffset(File.class, "prefixLength");
 
     /** use serialVersionUID from JDK 1.0.2 for interoperability */
     private static final long serialVersionUID = 301077366599181567L;
--- a/jdk/src/java.base/share/classes/java/lang/Class.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java	Thu Aug 17 19:35:37 2017 +0200
@@ -2864,26 +2864,14 @@
         // and have to avoid calling it in the static initializer of the Class class...
         private static final Unsafe unsafe = Unsafe.getUnsafe();
         // offset of Class.reflectionData instance field
-        private static final long reflectionDataOffset;
+        private static final long reflectionDataOffset
+                = unsafe.objectFieldOffset(Class.class, "reflectionData");
         // offset of Class.annotationType instance field
-        private static final long annotationTypeOffset;
+        private static final long annotationTypeOffset
+                = unsafe.objectFieldOffset(Class.class, "annotationType");
         // offset of Class.annotationData instance field
-        private static final long annotationDataOffset;
-
-        static {
-            Field[] fields = Class.class.getDeclaredFields0(false); // bypass caches
-            reflectionDataOffset = objectFieldOffset(fields, "reflectionData");
-            annotationTypeOffset = objectFieldOffset(fields, "annotationType");
-            annotationDataOffset = objectFieldOffset(fields, "annotationData");
-        }
-
-        private static long objectFieldOffset(Field[] fields, String fieldName) {
-            Field field = searchFields(fields, fieldName);
-            if (field == null) {
-                throw new Error("No " + fieldName + " field found in java.lang.Class");
-            }
-            return unsafe.objectFieldOffset(field);
-        }
+        private static final long annotationDataOffset
+                = unsafe.objectFieldOffset(Class.class, "annotationData");
 
         static <T> boolean casReflectionData(Class<?> clazz,
                                              SoftReference<ReflectionData<T>> oldData,
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Aug 17 19:35:37 2017 +0200
@@ -30,7 +30,6 @@
 import java.io.UncheckedIOException;
 import java.io.File;
 import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.AccessControlContext;
@@ -2895,12 +2894,7 @@
         Unsafe unsafe = Unsafe.getUnsafe();
         Class<?> k = ClassLoader.class;
         long offset;
-        try {
-            Field f = k.getDeclaredField(name);
-            offset = unsafe.objectFieldOffset(f);
-        } catch (NoSuchFieldException e) {
-            throw new InternalError(e);
-        }
+        offset = unsafe.objectFieldOffset(k, name);
         return unsafe.compareAndSetObject(this, offset, null, obj);
     }
 }
--- a/jdk/src/java.base/share/classes/java/lang/Module.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Module.java	Thu Aug 17 19:35:37 2017 +0200
@@ -130,7 +130,7 @@
 
         // define module to VM
 
-        boolean isOpen = descriptor.isOpen();
+        boolean isOpen = descriptor.isOpen() || descriptor.isAutomatic();
         Version version = descriptor.version().orElse(null);
         String vs = Objects.toString(version, null);
         String loc = Objects.toString(uri, null);
@@ -1156,18 +1156,14 @@
                 m.implAddReads(ALL_UNNAMED_MODULE, true);
             }
 
-            // exports and opens
-            if (descriptor.isOpen() || descriptor.isAutomatic()) {
-                // The VM doesn't special case open or automatic modules yet
-                // so need to export all packages
-                for (String source : descriptor.packages()) {
-                    addExportsToAll0(m, source);
+            // exports and opens, skipped for open and automatic
+            if (!descriptor.isOpen() && !descriptor.isAutomatic()) {
+                if (isBootLayer && descriptor.opens().isEmpty()) {
+                    // no open packages, no qualified exports to modules in parent layers
+                    initExports(m, nameToModule);
+                } else {
+                    initExportsAndOpens(m, nameToSource, nameToModule, layer.parents());
                 }
-            } else if (isBootLayer && descriptor.opens().isEmpty()) {
-                // no open packages, no qualified exports to modules in parent layers
-                initExports(m, nameToModule);
-            } else {
-                initExportsAndOpens(m, nameToSource, nameToModule, layer.parents());
             }
         }
 
--- a/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java	Thu Aug 17 19:35:37 2017 +0200
@@ -276,11 +276,9 @@
         if (offset > 0) {
             return offset;
         }
-        try {
-            offset = TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target"));
-            assert(offset > 0);
-            return offset;
-        } catch (Exception ex) { throw newInternalError(ex); }
+        offset = TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class, "target");
+        assert(offset > 0);
+        return offset;
     }
 
     /*package-private*/
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, 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
@@ -70,13 +70,18 @@
  * and those seven fields omit much of the information in Method.
  * @author jrose
  */
+/*non-public*/ final class ResolvedMethodName {
+    //@Injected JVM_Method* vmtarget;
+    //@Injected Class<?>    vmholder;
+};
+
 /*non-public*/ final class MemberName implements Member, Cloneable {
-    private Class<?> clazz;       // class in which the method is defined
+    private Class<?> clazz;       // class in which the member is defined
     private String   name;        // may be null if not yet materialized
     private Object   type;        // may be null if not yet materialized
     private int      flags;       // modifier bits; see reflect.Modifier
-    //@Injected JVM_Method* vmtarget;
-    //@Injected int         vmindex;
+    private ResolvedMethodName method;    // cached resolved method information
+    //@Injected intptr_t       vmindex;   // vtable index or offset of resolved member
     Object   resolution;  // if null, this guy is resolved
 
     /** Return the declaring class of this member.
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Thu Aug 17 19:35:37 2017 +0200
@@ -1587,12 +1587,6 @@
         }
     }
 
-    private static final long FORM_OFFSET;
-    static {
-        try {
-            FORM_OFFSET = UNSAFE.objectFieldOffset(MethodHandle.class.getDeclaredField("form"));
-        } catch (ReflectiveOperationException ex) {
-            throw newInternalError(ex);
-        }
-    }
+    private static final long FORM_OFFSET
+            = UNSAFE.objectFieldOffset(MethodHandle.class, "form");
 }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java	Thu Aug 17 19:35:37 2017 +0200
@@ -1239,17 +1239,11 @@
     // Support for resetting final fields while deserializing. Implement Holder
     // pattern to make the rarely needed offset calculation lazy.
     private static class OffsetHolder {
-        private static final long rtypeOffset, ptypesOffset;
-        static {
-            try {
-                rtypeOffset = UNSAFE.objectFieldOffset
-                    (MethodType.class.getDeclaredField("rtype"));
-                ptypesOffset = UNSAFE.objectFieldOffset
-                    (MethodType.class.getDeclaredField("ptypes"));
-            } catch (Exception ex) {
-                throw new Error(ex);
-            }
-        }
+        static final long rtypeOffset
+                = UNSAFE.objectFieldOffset(MethodType.class, "rtype");
+
+        static final long ptypesOffset
+                = UNSAFE.objectFieldOffset(MethodType.class, "ptypes");
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Thu Aug 17 19:35:37 2017 +0200
@@ -2014,12 +2014,7 @@
     private static final long VFORM_OFFSET;
 
     static {
-        try {
-            VFORM_OFFSET = UNSAFE.objectFieldOffset(VarHandle.class.getDeclaredField("vform"));
-        }
-        catch (ReflectiveOperationException e) {
-            throw newInternalError(e);
-        }
+        VFORM_OFFSET = UNSAFE.objectFieldOffset(VarHandle.class, "vform");
 
         // The VarHandleGuards must be initialized to ensure correct
         // compilation of the guard methods
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandleByteArrayBase.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandleByteArrayBase.java	Thu Aug 17 19:35:37 2017 +0200
@@ -35,32 +35,20 @@
  */
 abstract class VarHandleByteArrayBase {
     // Buffer.address
-    static final long BUFFER_ADDRESS;
+    static final long BUFFER_ADDRESS
+            = UNSAFE.objectFieldOffset(Buffer.class, "address");
+
     // Buffer.limit
-    static final long BUFFER_LIMIT;
-    // ByteBuffer.hb
-    static final long BYTE_BUFFER_HB;
-    // ByteBuffer.isReadOnly
-    static final long BYTE_BUFFER_IS_READ_ONLY;
-
-    static {
-        try {
-            BUFFER_ADDRESS = UNSAFE.objectFieldOffset(
-                    Buffer.class.getDeclaredField("address"));
+    static final long BUFFER_LIMIT
+            = UNSAFE.objectFieldOffset(Buffer.class, "limit");
 
-            BUFFER_LIMIT = UNSAFE.objectFieldOffset(
-                    Buffer.class.getDeclaredField("limit"));
-
-            BYTE_BUFFER_HB = UNSAFE.objectFieldOffset(
-                    ByteBuffer.class.getDeclaredField("hb"));
+    // ByteBuffer.hb
+    static final long BYTE_BUFFER_HB
+            = UNSAFE.objectFieldOffset(ByteBuffer.class, "hb");
 
-            BYTE_BUFFER_IS_READ_ONLY = UNSAFE.objectFieldOffset(
-                    ByteBuffer.class.getDeclaredField("isReadOnly"));
-        }
-        catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
-    }
+    // ByteBuffer.isReadOnly
+    static final long BYTE_BUFFER_IS_READ_ONLY
+            = UNSAFE.objectFieldOffset(ByteBuffer.class, "isReadOnly");
 
     static final boolean BE = UNSAFE.isBigEndian();
 
--- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java	Thu Aug 17 19:35:37 2017 +0200
@@ -4067,20 +4067,13 @@
     }
 
     private static class UnsafeHolder {
-        private static final jdk.internal.misc.Unsafe unsafe;
-        private static final long intCompactOffset;
-        private static final long intValOffset;
-        static {
-            try {
-                unsafe = jdk.internal.misc.Unsafe.getUnsafe();
-                intCompactOffset = unsafe.objectFieldOffset
-                    (BigDecimal.class.getDeclaredField("intCompact"));
-                intValOffset = unsafe.objectFieldOffset
-                    (BigDecimal.class.getDeclaredField("intVal"));
-            } catch (Exception ex) {
-                throw new ExceptionInInitializerError(ex);
-            }
-        }
+        private static final jdk.internal.misc.Unsafe unsafe
+                = jdk.internal.misc.Unsafe.getUnsafe();
+        private static final long intCompactOffset
+                = unsafe.objectFieldOffset(BigDecimal.class, "intCompact");
+        private static final long intValOffset
+                = unsafe.objectFieldOffset(BigDecimal.class, "intVal");
+
         static void setIntCompact(BigDecimal bd, long val) {
             unsafe.putLong(bd, intCompactOffset, val);
         }
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java	Thu Aug 17 19:35:37 2017 +0200
@@ -4582,20 +4582,12 @@
 
     // Support for resetting final fields while deserializing
     private static class UnsafeHolder {
-        private static final jdk.internal.misc.Unsafe unsafe;
-        private static final long signumOffset;
-        private static final long magOffset;
-        static {
-            try {
-                unsafe = jdk.internal.misc.Unsafe.getUnsafe();
-                signumOffset = unsafe.objectFieldOffset
-                    (BigInteger.class.getDeclaredField("signum"));
-                magOffset = unsafe.objectFieldOffset
-                    (BigInteger.class.getDeclaredField("mag"));
-            } catch (Exception ex) {
-                throw new ExceptionInInitializerError(ex);
-            }
-        }
+        private static final jdk.internal.misc.Unsafe unsafe
+                = jdk.internal.misc.Unsafe.getUnsafe();
+        private static final long signumOffset
+                = unsafe.objectFieldOffset(BigInteger.class, "signum");
+        private static final long magOffset
+                = unsafe.objectFieldOffset(BigInteger.class, "mag");
 
         static void putSign(BigInteger bi, int sign) {
             unsafe.putInt(bi, signumOffset, sign);
--- a/jdk/src/java.base/share/classes/java/net/Inet6Address.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/net/Inet6Address.java	Thu Aug 17 19:35:37 2017 +0200
@@ -576,19 +576,10 @@
          new ObjectStreamField("ifname", String.class)
     };
 
-    private static final long FIELDS_OFFSET;
-    private static final jdk.internal.misc.Unsafe UNSAFE;
-
-    static {
-        try {
-            jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
-            FIELDS_OFFSET = unsafe.objectFieldOffset(
-                    Inet6Address.class.getDeclaredField("holder6"));
-            UNSAFE = unsafe;
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
-    }
+    private static final jdk.internal.misc.Unsafe UNSAFE
+            = jdk.internal.misc.Unsafe.getUnsafe();
+    private static final long FIELDS_OFFSET = UNSAFE.objectFieldOffset(
+                Inet6Address.class, "holder6");
 
     /**
      * restore the state of this object from stream
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java	Thu Aug 17 19:35:37 2017 +0200
@@ -1707,20 +1707,10 @@
         }
     }
 
-    private static final long FIELDS_OFFSET;
-    private static final jdk.internal.misc.Unsafe UNSAFE;
-
-    static {
-        try {
-            jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
-            FIELDS_OFFSET = unsafe.objectFieldOffset(
-                InetAddress.class.getDeclaredField("holder")
-            );
-            UNSAFE = unsafe;
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
-    }
+    private static final jdk.internal.misc.Unsafe UNSAFE
+            = jdk.internal.misc.Unsafe.getUnsafe();
+    private static final long FIELDS_OFFSET
+            = UNSAFE.objectFieldOffset(InetAddress.class, "holder");
 
     private void readObject (ObjectInputStream s) throws
                          IOException, ClassNotFoundException {
--- a/jdk/src/java.base/share/classes/java/net/InetSocketAddress.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/net/InetSocketAddress.java	Thu Aug 17 19:35:37 2017 +0200
@@ -302,18 +302,10 @@
         throw new InvalidObjectException("Stream data required");
     }
 
-    private static final long FIELDS_OFFSET;
-    private static final jdk.internal.misc.Unsafe UNSAFE;
-    static {
-        try {
-            jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
-            FIELDS_OFFSET = unsafe.objectFieldOffset(
-                    InetSocketAddress.class.getDeclaredField("holder"));
-            UNSAFE = unsafe;
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
-    }
+    private static final jdk.internal.misc.Unsafe UNSAFE
+            = jdk.internal.misc.Unsafe.getUnsafe();
+    private static final long FIELDS_OFFSET
+            = UNSAFE.objectFieldOffset(InetSocketAddress.class, "holder");
 
     /**
      * Gets the port number.
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Thu Aug 17 19:35:37 2017 +0200
@@ -3306,15 +3306,8 @@
         }
 
         private static final Unsafe U = Unsafe.getUnsafe();
-        private static final long LOCKSTATE;
-        static {
-            try {
-                LOCKSTATE = U.objectFieldOffset
-                    (TreeBin.class.getDeclaredField("lockState"));
-            } catch (ReflectiveOperationException e) {
-                throw new Error(e);
-            }
-        }
+        private static final long LOCKSTATE
+                = U.objectFieldOffset(TreeBin.class, "lockState");
     }
 
     /* ----------------Table Traversal -------------- */
@@ -6380,27 +6373,23 @@
     private static final int ASHIFT;
 
     static {
-        try {
-            SIZECTL = U.objectFieldOffset
-                (ConcurrentHashMap.class.getDeclaredField("sizeCtl"));
-            TRANSFERINDEX = U.objectFieldOffset
-                (ConcurrentHashMap.class.getDeclaredField("transferIndex"));
-            BASECOUNT = U.objectFieldOffset
-                (ConcurrentHashMap.class.getDeclaredField("baseCount"));
-            CELLSBUSY = U.objectFieldOffset
-                (ConcurrentHashMap.class.getDeclaredField("cellsBusy"));
-
-            CELLVALUE = U.objectFieldOffset
-                (CounterCell.class.getDeclaredField("value"));
-
-            ABASE = U.arrayBaseOffset(Node[].class);
-            int scale = U.arrayIndexScale(Node[].class);
-            if ((scale & (scale - 1)) != 0)
-                throw new Error("array index scale not a power of two");
-            ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
+        SIZECTL = U.objectFieldOffset
+            (ConcurrentHashMap.class, "sizeCtl");
+        TRANSFERINDEX = U.objectFieldOffset
+            (ConcurrentHashMap.class, "transferIndex");
+        BASECOUNT = U.objectFieldOffset
+            (ConcurrentHashMap.class, "baseCount");
+        CELLSBUSY = U.objectFieldOffset
+            (ConcurrentHashMap.class, "cellsBusy");
+
+        CELLVALUE = U.objectFieldOffset
+            (CounterCell.class, "value");
+
+        ABASE = U.arrayBaseOffset(Node[].class);
+        int scale = U.arrayIndexScale(Node[].class);
+        if ((scale & (scale - 1)) != 0)
+            throw new Error("array index scale not a power of two");
+        ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
 
         // Reduce the risk of rare disastrous classloading in first call to
         // LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Thu Aug 17 19:35:37 2017 +0200
@@ -1050,30 +1050,18 @@
 
     // Unsafe mechanics
     private static final Unsafe U = Unsafe.getUnsafe();
-    private static final long SEED;
-    private static final long PROBE;
-    private static final long SECONDARY;
-    private static final long THREADLOCALS;
-    private static final long INHERITABLETHREADLOCALS;
-    private static final long INHERITEDACCESSCONTROLCONTEXT;
-    static {
-        try {
-            SEED = U.objectFieldOffset
-                (Thread.class.getDeclaredField("threadLocalRandomSeed"));
-            PROBE = U.objectFieldOffset
-                (Thread.class.getDeclaredField("threadLocalRandomProbe"));
-            SECONDARY = U.objectFieldOffset
-                (Thread.class.getDeclaredField("threadLocalRandomSecondarySeed"));
-            THREADLOCALS = U.objectFieldOffset
-                (Thread.class.getDeclaredField("threadLocals"));
-            INHERITABLETHREADLOCALS = U.objectFieldOffset
-                (Thread.class.getDeclaredField("inheritableThreadLocals"));
-            INHERITEDACCESSCONTROLCONTEXT = U.objectFieldOffset
-                (Thread.class.getDeclaredField("inheritedAccessControlContext"));
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
-    }
+    private static final long SEED = U.objectFieldOffset
+            (Thread.class, "threadLocalRandomSeed");
+    private static final long PROBE = U.objectFieldOffset
+            (Thread.class, "threadLocalRandomProbe");
+    private static final long SECONDARY = U.objectFieldOffset
+            (Thread.class, "threadLocalRandomSecondarySeed");
+    private static final long THREADLOCALS = U.objectFieldOffset
+            (Thread.class, "threadLocals");
+    private static final long INHERITABLETHREADLOCALS = U.objectFieldOffset
+            (Thread.class, "inheritableThreadLocals");
+    private static final long INHERITEDACCESSCONTROLCONTEXT = U.objectFieldOffset
+            (Thread.class, "inheritedAccessControlContext");
 
     /** Rarely-used holder for the second of a pair of Gaussians */
     private static final ThreadLocal<Double> nextLocalGaussian =
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Thu Aug 17 19:35:37 2017 +0200
@@ -59,16 +59,7 @@
      * are unresolved cyclic startup dependencies.
      */
     private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
-    private static final long VALUE;
-
-    static {
-        try {
-            VALUE = U.objectFieldOffset
-                (AtomicInteger.class.getDeclaredField("value"));
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
-    }
+    private static final long VALUE = U.objectFieldOffset(AtomicInteger.class, "value");
 
     private volatile int value;
 
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java	Thu Aug 17 19:35:37 2017 +0200
@@ -73,16 +73,7 @@
      * are unresolved cyclic startup dependencies.
      */
     private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
-    private static final long VALUE;
-
-    static {
-        try {
-            VALUE = U.objectFieldOffset
-                (AtomicLong.class.getDeclaredField("value"));
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
-    }
+    private static final long VALUE = U.objectFieldOffset(AtomicLong.class, "value");
 
     private volatile long value;
 
--- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java	Thu Aug 17 19:35:37 2017 +0200
@@ -421,21 +421,11 @@
 
     // Hotspot implementation via intrinsics API
     private static final Unsafe U = Unsafe.getUnsafe();
-    private static final long PARKBLOCKER;
-    private static final long SECONDARY;
-    private static final long TID;
-    static {
-        try {
-            PARKBLOCKER = U.objectFieldOffset
-                (Thread.class.getDeclaredField("parkBlocker"));
-            SECONDARY = U.objectFieldOffset
-                (Thread.class.getDeclaredField("threadLocalRandomSecondarySeed"));
-            TID = U.objectFieldOffset
-                (Thread.class.getDeclaredField("tid"));
-
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
-    }
+    private static final long PARKBLOCKER = U.objectFieldOffset
+            (Thread.class, "parkBlocker");
+    private static final long SECONDARY = U.objectFieldOffset
+            (Thread.class, "threadLocalRandomSecondarySeed");
+    private static final long TID = U.objectFieldOffset
+            (Thread.class, "tid");
 
 }
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/InnocuousThread.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/InnocuousThread.java	Thu Aug 17 19:35:37 2017 +0200
@@ -135,17 +135,16 @@
             Class<?> tk = Thread.class;
             Class<?> gk = ThreadGroup.class;
 
-            THREAD_LOCALS = UNSAFE.objectFieldOffset
-                    (tk.getDeclaredField("threadLocals"));
+            THREAD_LOCALS = UNSAFE.objectFieldOffset(tk, "threadLocals");
             INHERITABLE_THREAD_LOCALS = UNSAFE.objectFieldOffset
-                    (tk.getDeclaredField("inheritableThreadLocals"));
+                    (tk, "inheritableThreadLocals");
             INHERITEDACCESSCONTROLCONTEXT = UNSAFE.objectFieldOffset
-                (tk.getDeclaredField("inheritedAccessControlContext"));
+                (tk, "inheritedAccessControlContext");
             CONTEXTCLASSLOADER = UNSAFE.objectFieldOffset
-                (tk.getDeclaredField("contextClassLoader"));
+                (tk, "contextClassLoader");
 
-            long tg = UNSAFE.objectFieldOffset(tk.getDeclaredField("group"));
-            long gp = UNSAFE.objectFieldOffset(gk.getDeclaredField("parent"));
+            long tg = UNSAFE.objectFieldOffset(tk, "group");
+            long gp = UNSAFE.objectFieldOffset(gk, "parent");
             ThreadGroup group = (ThreadGroup)
                 UNSAFE.getObject(Thread.currentThread(), tg);
 
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Thu Aug 17 19:35:37 2017 +0200
@@ -954,6 +954,25 @@
     }
 
     /**
+     * Reports the location of the field with a given name in the storage
+     * allocation of its class.
+     *
+     * @throws NullPointerException if any parameter is {@code null}.
+     * @throws InternalError if there is no field named {@code name} declared
+     *         in class {@code c}, i.e., if {@code c.getDeclaredField(name)}
+     *         would throw {@code java.lang.NoSuchFieldException}.
+     *
+     * @see #objectFieldOffset(Field)
+     */
+    public long objectFieldOffset(Class<?> c, String name) {
+        if (c == null || name == null) {
+            throw new NullPointerException();
+        }
+
+        return objectFieldOffset1(c, name);
+    }
+
+    /**
      * Reports the location of a given static field, in conjunction with {@link
      * #staticFieldBase}.
      * <p>Do not expect to perform any sort of arithmetic on this offset;
@@ -3685,6 +3704,7 @@
     private native void copyMemory0(Object srcBase, long srcOffset, Object destBase, long destOffset, long bytes);
     private native void copySwapMemory0(Object srcBase, long srcOffset, Object destBase, long destOffset, long bytes, long elemSize);
     private native long objectFieldOffset0(Field f);
+    private native long objectFieldOffset1(Class<?> c, String name);
     private native long staticFieldOffset0(Field f);
     private native Object staticFieldBase0(Field f);
     private native boolean shouldBeInitialized0(Class<?> c);
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Thu Aug 17 19:35:37 2017 +0200
@@ -614,20 +614,13 @@
     }
 
     private static class UnsafeAccessor {
-        private static final jdk.internal.misc.Unsafe unsafe;
-        private static final long typeOffset;
-        private static final long memberValuesOffset;
-        static {
-            try {
-                unsafe = jdk.internal.misc.Unsafe.getUnsafe();
-                typeOffset = unsafe.objectFieldOffset
-                        (AnnotationInvocationHandler.class.getDeclaredField("type"));
-                memberValuesOffset = unsafe.objectFieldOffset
-                        (AnnotationInvocationHandler.class.getDeclaredField("memberValues"));
-            } catch (Exception ex) {
-                throw new ExceptionInInitializerError(ex);
-            }
-        }
+        private static final jdk.internal.misc.Unsafe unsafe
+                = jdk.internal.misc.Unsafe.getUnsafe();
+        private static final long typeOffset = unsafe.objectFieldOffset
+                (AnnotationInvocationHandler.class, "type");
+        private static final long memberValuesOffset = unsafe.objectFieldOffset
+                (AnnotationInvocationHandler.class, "memberValues");
+
         static void setType(AnnotationInvocationHandler o,
                             Class<? extends Annotation> type) {
             unsafe.putObject(o, typeOffset, type);
--- a/jdk/src/java.base/share/native/libfdlibm/fdlibm.h	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/native/libfdlibm/fdlibm.h	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, 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
@@ -34,7 +34,7 @@
 #ifdef __NEWVALID       /* special setup for Sun test regime */
 #if defined(i386) || defined(i486) || \
     defined(intel) || defined(x86) || defined(arm) || \
-    defined(i86pc) || defined(_M_IA64) || defined(ia64)
+    defined(i86pc) || defined(ia64)
 #define _LITTLE_ENDIAN
 #endif
 #endif
--- a/jdk/src/java.base/share/native/libjli/java.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/share/native/libjli/java.c	Thu Aug 17 19:35:37 2017 +0200
@@ -206,7 +206,7 @@
  * A minimum -Xss stack size suitable for all platforms.
  */
 #ifndef STACK_SIZE_MINIMUM
-#define STACK_SIZE_MINIMUM (32 * KB)
+#define STACK_SIZE_MINIMUM (64 * KB)
 #endif
 
 /*
--- a/jdk/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c	Thu Aug 17 19:35:37 2017 +0200
@@ -28,7 +28,7 @@
 #include "jvm.h"
 #include "jlong.h"
 #include "sun_nio_ch_DevPollArrayWrapper.h"
-#include <sys/poll.h>
+#include <poll.h>
 #include <unistd.h>
 #include <sys/time.h>
 
--- a/jdk/src/java.base/unix/classes/module-info.java.extra	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/unix/classes/module-info.java.extra	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -23,5 +23,3 @@
  * questions.
  */
 
-// AOT uses jdk.internal.misc.Unsafe
-exports jdk.internal.misc to jdk.aot;
--- a/jdk/src/java.base/unix/native/include/jvm_md.h	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/unix/native/include/jvm_md.h	Thu Aug 17 19:35:37 2017 +0200
@@ -65,7 +65,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 /* O Flags */
 
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Thu Aug 17 19:35:37 2017 +0200
@@ -742,6 +742,7 @@
     if (stack_size > 0) {
       pthread_attr_setstacksize(&attr, stack_size);
     }
+    pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads
 
     if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
       void * tmp;
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.h	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.h	Thu Aug 17 19:35:37 2017 +0200
@@ -27,7 +27,7 @@
 #define NET_UTILS_MD_H
 
 #include <netdb.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/socket.h>
 
 /************************************************************************
--- a/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c	Thu Aug 17 19:35:37 2017 +0200
@@ -31,24 +31,21 @@
 #include "jlong.h"
 #include "sun_nio_ch_NativeThread.h"
 #include "nio_util.h"
+#include <signal.h>
 
 #ifdef __linux__
   #include <pthread.h>
-  #include <sys/signal.h>
   /* Also defined in net/linux_close.c */
   #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
 #elif _AIX
   #include <pthread.h>
-  #include <sys/signal.h>
   /* Also defined in net/aix_close.c */
   #define INTERRUPT_SIGNAL (SIGRTMAX - 1)
 #elif __solaris__
   #include <thread.h>
-  #include <signal.h>
   #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
 #elif _ALLBSD_SOURCE
   #include <pthread.h>
-  #include <signal.h>
   /* Also defined in net/bsd_close.c */
   #define INTERRUPT_SIGNAL SIGIO
 #else
--- a/jdk/src/java.base/unix/native/libnio/ch/Net.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/unix/native/libnio/ch/Net.c	Thu Aug 17 19:35:37 2017 +0200
@@ -23,7 +23,7 @@
  * questions.
  */
 
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <string.h>
--- a/jdk/src/java.base/windows/classes/module-info.java.extra	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/windows/classes/module-info.java.extra	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -26,3 +26,4 @@
 exports sun.security.rsa to jdk.crypto.mscapi;
 exports sun.security.internal.spec to jdk.crypto.mscapi;
 exports sun.security.util to jdk.crypto.mscapi;
+
--- a/jdk/src/java.base/windows/native/libjava/java_props_md.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.base/windows/native/libjava/java_props_md.c	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, 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
@@ -559,9 +559,7 @@
         }
         sprintf(buf, "%d.%d", majorVersion, minorVersion);
         sprops.os_version = _strdup(buf);
-#if _M_IA64
-        sprops.os_arch = "ia64";
-#elif _M_AMD64
+#if _M_AMD64
         sprops.os_arch = "amd64";
 #elif _X86_
         sprops.os_arch = "x86";
--- a/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, 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
@@ -332,7 +332,15 @@
 
 #define DRAGMASK (NSMouseMovedMask | NSLeftMouseDraggedMask | NSRightMouseDownMask | NSRightMouseDraggedMask | NSLeftMouseUpMask | NSRightMouseUpMask | NSFlagsChangedMask | NSKeyDownMask)
 
-- (NSEvent *)nextEventMatchingMask:(NSUInteger)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag {
+#if defined(MAC_OS_X_VERSION_10_12) && \
+   MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12 && \
+   __LP64__
+   // 10.12 changed `mask` to NSEventMask (unsigned long long) for x86_64 builds.
+- (NSEvent *)nextEventMatchingMask:(NSEventMask)mask
+#else
+- (NSEvent *)nextEventMatchingMask:(NSUInteger)mask
+#endif
+untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag {
     if (mask == DRAGMASK && [((NSString *)kCFRunLoopDefaultMode) isEqual:mode]) {
         postEventDuringEventSynthesis = YES;
     }
@@ -449,4 +457,3 @@
         }
     }
 }
-
--- a/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, 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
@@ -394,8 +394,6 @@
 
 void *
 SplashScreenThread(void *param) {
-    objc_registerThreadWithCollector();
-
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     Splash *splash = (Splash *) param;
 
--- a/jdk/src/java.desktop/share/native/libjavajpeg/jdhuff.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/jdhuff.c	Thu Aug 17 19:35:37 2017 +0200
@@ -455,10 +455,15 @@
     0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
 
 static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
-  { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
-    ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
-    ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
-    ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+  { 0,
+    (int)(((unsigned)(~0)<<1)  + 1), (int)(((unsigned)(~0)<<2)  + 1),
+    (int)(((unsigned)(~0)<<3)  + 1), (int)(((unsigned)(~0)<<4)  + 1),
+    (int)(((unsigned)(~0)<<5)  + 1), (int)(((unsigned)(~0)<<6)  + 1),
+    (int)(((unsigned)(~0)<<7)  + 1), (int)(((unsigned)(~0)<<8)  + 1),
+    (int)(((unsigned)(~0)<<9)  + 1), (int)(((unsigned)(~0)<<10) + 1),
+    (int)(((unsigned)(~0)<<11) + 1), (int)(((unsigned)(~0)<<12) + 1),
+    (int)(((unsigned)(~0)<<13) + 1), (int)(((unsigned)(~0)<<14) + 1),
+    (int)(((unsigned)(~0)<<15) + 1) };
 
 #endif /* AVOID_TABLES */
 
--- a/jdk/src/java.desktop/share/native/libjavajpeg/jdphuff.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/jdphuff.c	Thu Aug 17 19:35:37 2017 +0200
@@ -215,10 +215,15 @@
     0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
 
 static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
-  { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
-    ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
-    ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
-    ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
+  { 0,
+    (int)(((unsigned)(~0)<<1)  + 1), (int)(((unsigned)(~0)<<2)  + 1),
+    (int)(((unsigned)(~0)<<3)  + 1), (int)(((unsigned)(~0)<<4)  + 1),
+    (int)(((unsigned)(~0)<<5)  + 1), (int)(((unsigned)(~0)<<6)  + 1),
+    (int)(((unsigned)(~0)<<7)  + 1), (int)(((unsigned)(~0)<<8)  + 1),
+    (int)(((unsigned)(~0)<<9)  + 1), (int)(((unsigned)(~0)<<10) + 1),
+    (int)(((unsigned)(~0)<<11) + 1), (int)(((unsigned)(~0)<<12) + 1),
+    (int)(((unsigned)(~0)<<13) + 1), (int)(((unsigned)(~0)<<14) + 1),
+    (int)(((unsigned)(~0)<<15) + 1) };
 
 #endif /* AVOID_TABLES */
 
--- a/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, 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
@@ -483,15 +483,6 @@
                                                   "available", "()I"));
 }
 
-
-/*
- * The Windows Itanium Aug 2002 SDK generates bad code
- * for this routine.  Disable optimization for now.
- */
-#ifdef _M_IA64
-#pragma optimize ("", off)
-#endif
-
 JNIEXPORT void JNICALL
 Java_sun_awt_image_JPEGImageDecoder_readImage(JNIEnv *env,
                                               jobject this,
@@ -745,10 +736,6 @@
   RELEASE_ARRAYS(env, &jsrc);
   return;
 }
-#ifdef _M_IA64
-#pragma optimize ("", on)
-#endif
-
 
 /*
  * SOME FINE POINTS:
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, 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
@@ -125,15 +125,13 @@
             jboolean replyToSender = JNI_TRUE;
 
             /*
-             * For VirtualMachine commands we hold the vmDeathLock
+             * For all commands we hold the vmDeathLock
              * while executing and replying to the command. This ensures
-             * that a VM command after VM_DEATH will be allowed to complete
+             * that a command after VM_DEATH will be allowed to complete
              * before the thread posting the VM_DEATH continues VM
              * termination.
              */
-            if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){
-                debugMonitorEnter(vmDeathLock);
-            }
+            debugMonitorEnter(vmDeathLock);
 
             /* Initialize the input and output streams */
             inStream_init(&in, p);
@@ -172,9 +170,7 @@
             /*
              * Release the vmDeathLock as the reply has been posted.
              */
-            if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){
-               debugMonitorExit(vmDeathLock);
-            }
+            debugMonitorExit(vmDeathLock);
 
             inStream_destroy(&in);
             outStream_destroy(&out);
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, 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
@@ -240,10 +240,10 @@
 
         size = commandSize(command);
         /*
-         * Immediately close out any commands enqueued from a
-         * previously attached debugger.
+         * Immediately close out any commands enqueued from
+         * a dead VM or a previously attached debugger.
          */
-        if (command->sessionID != currentSessionID) {
+        if (gdata->vmDead || command->sessionID != currentSessionID) {
             log_debugee_location("dequeueCommand(): command session removal", NULL, NULL, 0);
             completeCommand(command);
             command = NULL;
--- a/jdk/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c	Thu Aug 17 19:35:37 2017 +0200
@@ -37,7 +37,7 @@
 #include <thread.h>
 #else
 #include <pthread.h>
-#include <sys/poll.h>
+#include <poll.h>
 #endif
 
 #include "socket_md.h"
--- a/jdk/test/ProblemList.txt	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/test/ProblemList.txt	Thu Aug 17 19:35:37 2017 +0200
@@ -153,6 +153,7 @@
 com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java 8030957 aix-all
 com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java  8030957 aix-all
 sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java    8174734 generic-all
+sun/management/jdp/JdpOffTest.java                              8175542 generic-all
 
 ############################################################################
 
@@ -302,6 +303,14 @@
 
 com/sun/tools/attach/StartManagementAgent.java                  8179700 generic-all
 
+sun/tools/jhsdb/AlternateHashingTest.java                       8184042 macosx-all
+
+sun/tools/jhsdb/BasicLauncherTest.java                          8184042 macosx-all
+
+sun/tools/jhsdb/HeapDumpTest.java                               8184042 macosx-all
+
+sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java              8184042 macosx-all
+
 ############################################################################
 
 # jdk_other
--- a/jdk/test/com/sun/jdi/JdbExprTest.sh	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/test/com/sun/jdi/JdbExprTest.sh	Thu Aug 17 19:35:37 2017 +0200
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2017, 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
@@ -26,6 +26,7 @@
 #  @test
 #  @bug 4660158
 #  @author Staffan Larsen
+#  @requires os.family != "windows"
 #  @key intermittent
 #  @run shell JdbExprTest.sh
 
--- a/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, 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
@@ -49,7 +49,7 @@
 
     private static final String TEST_SRC = System.getProperty("test.src").trim();
     private static final String[] VM_ARGS = new String[] { "-XX:+UsePerfData" };
-    private static final String JCMD_LIST_REGEX = "^\\d+\\s*.*";
+    private static final String JCMD_LIST_REGEX = "(?s)^\\d+\\s*.*";
 
     public static void main(String[] args) throws Exception {
         testJcmdUsage("-h");
--- a/jdk/test/tools/launcher/Settings.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/test/tools/launcher/Settings.java	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, 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
@@ -75,9 +75,9 @@
     }
 
     static void runTestOptionDefault() throws IOException {
-        String stackSize = "256"; // in kb
+        int stackSize = 256; // in kb
         if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
-            stackSize = "800";
+            stackSize = 800;
         }
         TestResult tr;
         tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
@@ -88,7 +88,7 @@
             throw new RuntimeException("test fails");
         }
         tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
-                "-Xss" + stackSize + "000", "-XshowSettings", "-jar", testJar.getAbsolutePath());
+                "-Xss" + (stackSize * 1024), "-XshowSettings", "-jar", testJar.getAbsolutePath());
         containsAllOptions(tr);
         if (!tr.isOK()) {
             System.out.println(tr);
--- a/jdk/test/tools/launcher/TooSmallStackSize.java	Thu Aug 17 16:48:45 2017 +0100
+++ b/jdk/test/tools/launcher/TooSmallStackSize.java	Thu Aug 17 19:35:37 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, 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
@@ -155,15 +155,21 @@
         checkStack("16k");
 
         /*
-         * Try with a 32k stack size, which is the size that the launcher will
+         * Try with a 64k stack size, which is the size that the launcher will
          * set to if you try setting to anything smaller. This should produce the same
          * result as setting to 16k if the fix for 6762191 is in place.
          */
-        String min_stack_allowed = checkStack("32k");
+        String min_stack_allowed = checkStack("64k");
 
         /*
          * Try again with a the minimum stack size that was given in the error message
          */
         checkMinStackAllowed(min_stack_allowed);
+
+        /*
+         * Try again with a size that is not OS page aligned. This is to help test that
+         * asserts added for 8176768 are not triggered.
+         */
+        checkMinStackAllowed("513k");
     }
 }