From 70e8b7685dff9c5c33ce1edb552f0b643ca4a3c2 Mon Sep 17 00:00:00 2001
From: Bob Vandette <bobv@openjdk.org>
Date: Thu, 9 Feb 2017 15:24:38 -0500
Subject: [PATCH 01/10] 8172670: AOT Platform Support for Windows and Mac OS X
 x64

Reviewed-by: mchung, alanb
---
 .../java.base/unix/classes/module-info.java.extra    |  4 +---
 .../java.base/windows/classes/module-info.java.extra | 12 +++++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/jdk/src/java.base/unix/classes/module-info.java.extra b/jdk/src/java.base/unix/classes/module-info.java.extra
index 43f85b0309a..a19a37a55cb 100644
--- a/jdk/src/java.base/unix/classes/module-info.java.extra
+++ b/jdk/src/java.base/unix/classes/module-info.java.extra
@@ -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
@@ -32,5 +32,3 @@ opens com.sun.crypto.provider to jdk.vm.compiler;
 
 exports jdk.internal.module to jdk.vm.compiler;
 
-// AOT uses jdk.internal.misc.Unsafe
-exports jdk.internal.misc to jdk.aot;
diff --git a/jdk/src/java.base/windows/classes/module-info.java.extra b/jdk/src/java.base/windows/classes/module-info.java.extra
index 1e4a3a6ccb9..d967971708f 100644
--- a/jdk/src/java.base/windows/classes/module-info.java.extra
+++ b/jdk/src/java.base/windows/classes/module-info.java.extra
@@ -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,13 @@
 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;
+
+// jdk.vm.compiler uses Unsafe and VM classes from jdk.internal.misc
+exports jdk.internal.misc to jdk.vm.compiler;
+opens   jdk.internal.misc to jdk.vm.compiler;
+
+// jdk.vm.compiler uses com.sun.crypto.provider to generate crypto intrinsics
+opens com.sun.crypto.provider to jdk.vm.compiler;
+
+exports jdk.internal.module to jdk.vm.compiler;
+

From 6c57d986b0c4665b59df140c34de367e3dd98510 Mon Sep 17 00:00:00 2001
From: Robbin Ehn <rehn@openjdk.org>
Date: Thu, 2 Mar 2017 09:59:46 +0100
Subject: [PATCH 02/10] 8136650: Add support for custom jtreg native tests

Reviewed-by: ctornqvi, erikj
---
 jdk/make/test/JtregNative.gmk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/jdk/make/test/JtregNative.gmk b/jdk/make/test/JtregNative.gmk
index 05a81e8cb5a..b3b85d94941 100644
--- a/jdk/make/test/JtregNative.gmk
+++ b/jdk/make/test/JtregNative.gmk
@@ -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 $(SPEC)
 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 \
     #
 

From 6fe52834571c85f8e53e31580ca98780633d7b6d Mon Sep 17 00:00:00 2001
From: Serguei Spitsyn <sspitsyn@openjdk.org>
Date: Thu, 2 Mar 2017 16:03:38 -0800
Subject: [PATCH 03/10] 8134103: JVMTI_ERROR_WRONG_PHASE(112): on checking for
 an interface

Add guards to the jdwp agent shutdown

Reviewed-by: dholmes, dcubed, dsamersoff
---
 .../share/native/libjdwp/debugLoop.c               | 14 +++++---------
 .../share/native/libjdwp/eventHelper.c             |  8 ++++----
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c
index 18389e2715c..55d48947c78 100644
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c
@@ -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 @@ debugLoop_run(void)
             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 @@ debugLoop_run(void)
             /*
              * 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);
diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c
index a17a091aa34..bd5f080ba37 100644
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c
@@ -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 @@ dequeueCommand(void)
 
         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;

From 912c47ccbb5ad6c8d5a5f3776dd6437c1b7eba24 Mon Sep 17 00:00:00 2001
From: Chris Plummer <cjplummer@openjdk.org>
Date: Thu, 16 Mar 2017 18:16:39 -0700
Subject: [PATCH 04/10] 8176797: [TESTBUG] tools/launcher/Settings.java -Xss
 size is too small

Increase from 256000 to 256k

Reviewed-by: dholmes, ctornqvi, stsmirno, ksrini
---
 jdk/test/tools/launcher/Settings.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/jdk/test/tools/launcher/Settings.java b/jdk/test/tools/launcher/Settings.java
index bd8f238108a..d80e61c540e 100644
--- a/jdk/test/tools/launcher/Settings.java
+++ b/jdk/test/tools/launcher/Settings.java
@@ -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
@@ -73,9 +73,9 @@ public class Settings extends TestHelper {
     }
 
     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",
@@ -86,7 +86,7 @@ public class Settings extends TestHelper {
             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);

From c1d2fc5201eab586251ab61f53b8baa6826f8178 Mon Sep 17 00:00:00 2001
From: Harold Seigel <hseigel@openjdk.org>
Date: Fri, 17 Mar 2017 08:40:12 -0400
Subject: [PATCH 05/10] 8175288: [TESTBUG] sun/tools/jcmd/TestJcmdDefaults.java
 failed to parse output of other java process

Enable dotall mode so test can parse Java process names containing line terminators

Reviewed-by: ctornqvi, mseledtsov, gtriantafill
---
 jdk/test/sun/tools/jcmd/TestJcmdDefaults.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java b/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java
index 36481d6ebce..21dc0939ebe 100644
--- a/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java
+++ b/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java
@@ -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
@@ -50,7 +50,7 @@ public class TestJcmdDefaults {
 
     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");

From cacb1c97a064b1646d302c5929e73e01dc3e06c1 Mon Sep 17 00:00:00 2001
From: Chris Plummer <cjplummer@openjdk.org>
Date: Fri, 17 Mar 2017 15:41:14 -0700
Subject: [PATCH 06/10] 8175342:
 assert(InstanceKlass::cast(k)->is_initialized()) failed: need to increase
 java_thread_min_stack_allowed calculation

Remove the pthreads stack guard page from the thread created in ContinueInNewThread0

Reviewed-by: dholmes, dsamersoff
---
 jdk/src/java.base/macosx/native/libjli/java_md_macosx.c | 3 ++-
 jdk/src/java.base/unix/native/libjli/java_md_solinux.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c
index f21201ced6a..7e1a4572f60 100644
--- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c
+++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -886,6 +886,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
     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;
diff --git a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c
index cb9afc09822..f57e7c17b22 100644
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c
@@ -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
@@ -899,6 +899,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
     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;

From 3f321d24c8c66b2d30635e61adfecbc5a9aee2c4 Mon Sep 17 00:00:00 2001
From: Chris Plummer <cjplummer@openjdk.org>
Date: Mon, 27 Mar 2017 11:53:44 -0700
Subject: [PATCH 07/10] 8177015: STACK_SIZE_MINIMUM of 32k is not always enough
 for Mac OS X

Bump up minimum to 64k.

Reviewed-by: dholmes, dcubed
---
 jdk/src/java.base/share/native/libjli/java.c   |  4 ++--
 jdk/test/tools/launcher/TooSmallStackSize.java | 12 +++++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c
index f8265eeb110..16d59ad769f 100644
--- a/jdk/src/java.base/share/native/libjli/java.c
+++ b/jdk/src/java.base/share/native/libjli/java.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, 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
@@ -201,7 +201,7 @@ static jlong initialHeapSize    = 0;  /* inital heap size */
  * 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
 
 /*
diff --git a/jdk/test/tools/launcher/TooSmallStackSize.java b/jdk/test/tools/launcher/TooSmallStackSize.java
index 6220dca2740..21f1cef203c 100644
--- a/jdk/test/tools/launcher/TooSmallStackSize.java
+++ b/jdk/test/tools/launcher/TooSmallStackSize.java
@@ -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 @@ public class TooSmallStackSize extends TestHelper {
         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");
     }
 }

From 13c24bba29dd50af11230b00ae7dd990209a978c Mon Sep 17 00:00:00 2001
From: Rachel Protacio <rprotacio@openjdk.org>
Date: Mon, 24 Apr 2017 12:08:09 -0400
Subject: [PATCH 08/10] 8165896: Use "open" flag from JVM_DefineModule to
 export all module packages

Implemented VM side of open modules, which export all their packages unqualifiedly. Automatic modules and unnamed modules are treated internally as open modules.

Reviewed-by: alanb, hseigel, lfoltan
---
 .../share/classes/java/lang/Module.java       | 24 ++++++-------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/Module.java b/jdk/src/java.base/share/classes/java/lang/Module.java
index 26337d86beb..fd0bf122b47 100644
--- a/jdk/src/java.base/share/classes/java/lang/Module.java
+++ b/jdk/src/java.base/share/classes/java/lang/Module.java
@@ -126,7 +126,7 @@ public final class Module implements AnnotatedElement {
 
         // 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);
@@ -1042,9 +1042,6 @@ public final class Module implements AnnotatedElement {
         if (syncVM) {
             // throws IllegalStateException if defined to another module
             addPackage0(this, pn);
-            if (descriptor.isOpen() || descriptor.isAutomatic()) {
-                addExportsToAll0(this, pn);
-            }
         }
         extraPackages.putIfAbsent(pn, Boolean.TRUE);
     }
@@ -1145,8 +1142,11 @@ public final class Module implements AnnotatedElement {
                 m.implAddReads(ALL_UNNAMED_MODULE, true);
             }
 
-            // exports and opens
-            initExportsAndOpens(m, nameToSource, nameToModule, layer.parents());
+            // export and open packages, skipped for open and automatic
+            // modules since they are treated as if all packages are open
+            if (!descriptor.isOpen() && !descriptor.isAutomatic()) {
+                initExportsAndOpens(m, nameToSource, nameToModule, layer.parents());
+            }
         }
 
         // register the modules in the boot layer
@@ -1207,21 +1207,11 @@ public final class Module implements AnnotatedElement {
                                             Map<String, Module> nameToSource,
                                             Map<String, Module> nameToModule,
                                             List<ModuleLayer> parents) {
-        // The VM doesn't special case open or automatic modules so need to
-        // export all packages
-        ModuleDescriptor descriptor = m.getDescriptor();
-        if (descriptor.isOpen() || descriptor.isAutomatic()) {
-            assert descriptor.opens().isEmpty();
-            for (String source : descriptor.packages()) {
-                addExportsToAll0(m, source);
-            }
-            return;
-        }
-
         Map<String, Set<Module>> openPackages = new HashMap<>();
         Map<String, Set<Module>> exportedPackages = new HashMap<>();
 
         // process the open packages first
+        ModuleDescriptor descriptor = m.getDescriptor();
         for (Opens opens : descriptor.opens()) {
             String source = opens.source();
 

From e258384e060293376b54a9213aa59c67c2562c77 Mon Sep 17 00:00:00 2001
From: Mikael Vidstedt <mikael@openjdk.org>
Date: Thu, 11 May 2017 17:55:05 -0700
Subject: [PATCH 09/10] 8180003: Remove sys/ prefix from poll.h and signal.h
 includes

Reviewed-by: dholmes, bpb
---
 jdk/src/java.base/aix/native/libnet/aix_close.c              | 2 +-
 jdk/src/java.base/aix/native/libnio/ch/AixPollPort.c         | 2 +-
 jdk/src/java.base/linux/native/libnet/linux_close.c          | 2 +-
 jdk/src/java.base/linux/native/libnio/fs/LinuxWatchService.c | 2 +-
 jdk/src/java.base/macosx/native/include/jvm_md.h             | 2 +-
 jdk/src/java.base/macosx/native/libnet/bsd_close.c           | 2 +-
 .../java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c | 2 +-
 jdk/src/java.base/unix/native/include/jvm_md.h               | 2 +-
 jdk/src/java.base/unix/native/libnet/net_util_md.h           | 2 +-
 jdk/src/java.base/unix/native/libnio/ch/NativeThread.c       | 5 +----
 jdk/src/java.base/unix/native/libnio/ch/Net.c                | 2 +-
 jdk/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c  | 2 +-
 12 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/jdk/src/java.base/aix/native/libnet/aix_close.c b/jdk/src/java.base/aix/native/libnet/aix_close.c
index 1588d485640..cf882de85bf 100644
--- a/jdk/src/java.base/aix/native/libnet/aix_close.c
+++ b/jdk/src/java.base/aix/native/libnet/aix_close.c
@@ -64,7 +64,7 @@
 #include <sys/uio.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
 
 /*
  * Stack allocated by thread when doing blocking operation
diff --git a/jdk/src/java.base/aix/native/libnio/ch/AixPollPort.c b/jdk/src/java.base/aix/native/libnio/ch/AixPollPort.c
index b11d286dd68..7a9a273a83f 100644
--- a/jdk/src/java.base/aix/native/libnio/ch/AixPollPort.c
+++ b/jdk/src/java.base/aix/native/libnio/ch/AixPollPort.c
@@ -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>
diff --git a/jdk/src/java.base/linux/native/libnet/linux_close.c b/jdk/src/java.base/linux/native/libnet/linux_close.c
index 2bf7cc72283..c6fd88cba35 100644
--- a/jdk/src/java.base/linux/native/libnet/linux_close.c
+++ b/jdk/src/java.base/linux/native/libnet/linux_close.c
@@ -36,7 +36,7 @@
 #include <sys/uio.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
 
 /*
  * Stack allocated by thread when doing blocking operation
diff --git a/jdk/src/java.base/linux/native/libnio/fs/LinuxWatchService.c b/jdk/src/java.base/linux/native/libnio/fs/LinuxWatchService.c
index 375aaa48505..7606e9ba827 100644
--- a/jdk/src/java.base/linux/native/libnio/fs/LinuxWatchService.c
+++ b/jdk/src/java.base/linux/native/libnio/fs/LinuxWatchService.c
@@ -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"
diff --git a/jdk/src/java.base/macosx/native/include/jvm_md.h b/jdk/src/java.base/macosx/native/include/jvm_md.h
index e369b6c066e..b139bd298c0 100644
--- a/jdk/src/java.base/macosx/native/include/jvm_md.h
+++ b/jdk/src/java.base/macosx/native/include/jvm_md.h
@@ -60,7 +60,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 /* O Flags */
 
diff --git a/jdk/src/java.base/macosx/native/libnet/bsd_close.c b/jdk/src/java.base/macosx/native/libnet/bsd_close.c
index 14739b12caf..0b043aaa0b6 100644
--- a/jdk/src/java.base/macosx/native/libnet/bsd_close.c
+++ b/jdk/src/java.base/macosx/native/libnet/bsd_close.c
@@ -38,7 +38,7 @@
 #include <sys/uio.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
 
 /*
  * Stack allocated by thread when doing blocking operation
diff --git a/jdk/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c b/jdk/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c
index 6860a167bbc..20849dabcfc 100644
--- a/jdk/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c
+++ b/jdk/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c
@@ -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>
 
diff --git a/jdk/src/java.base/unix/native/include/jvm_md.h b/jdk/src/java.base/unix/native/include/jvm_md.h
index 818ab732a40..ad7e9d62077 100644
--- a/jdk/src/java.base/unix/native/include/jvm_md.h
+++ b/jdk/src/java.base/unix/native/include/jvm_md.h
@@ -65,7 +65,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 /* O Flags */
 
diff --git a/jdk/src/java.base/unix/native/libnet/net_util_md.h b/jdk/src/java.base/unix/native/libnet/net_util_md.h
index 15e08c48ae9..6ec35c3773a 100644
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.h
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.h
@@ -27,7 +27,7 @@
 #define NET_UTILS_MD_H
 
 #include <netdb.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/socket.h>
 
 /************************************************************************
diff --git a/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c b/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c
index 0b644158537..5167aeccd0f 100644
--- a/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c
+++ b/jdk/src/java.base/unix/native/libnio/ch/NativeThread.c
@@ -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
diff --git a/jdk/src/java.base/unix/native/libnio/ch/Net.c b/jdk/src/java.base/unix/native/libnio/ch/Net.c
index 11587114eb7..ae75d7c368c 100644
--- a/jdk/src/java.base/unix/native/libnio/ch/Net.c
+++ b/jdk/src/java.base/unix/native/libnio/ch/Net.c
@@ -23,7 +23,7 @@
  * questions.
  */
 
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <string.h>
diff --git a/jdk/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c b/jdk/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c
index 9692f4f83ae..33da0486acd 100644
--- a/jdk/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c
+++ b/jdk/src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c
@@ -37,7 +37,7 @@
 #include <thread.h>
 #else
 #include <pthread.h>
-#include <sys/poll.h>
+#include <poll.h>
 #endif
 
 #include "socket_md.h"

From ad874355d35185d82a4d4e89333b9857b58ab784 Mon Sep 17 00:00:00 2001
From: Coleen Phillimore <coleenp@openjdk.org>
Date: Sat, 27 May 2017 09:21:21 -0400
Subject: [PATCH 10/10] 8174749: Use hash table/oops for MemberName table

Add a Java type called ResolvedMethodName which is immutable and can be stored in a hashtable, that is weakly collected by gc

Reviewed-by: sspitsyn, stefank, jrose
---
 .../share/classes/java/lang/invoke/MemberName.java  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
index 41a4545d6bb..86a625b2eed 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
@@ -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 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
  * 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.