changeset 47358:cf678680408a lvti

Automatic merge with default
author mcimadamore
date Mon, 02 Oct 2017 18:40:54 +0200
parents 7ff79f8d6b57 7d02545ec122
children b6bb3f49a1b1
files
diffstat 22 files changed, 417 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Sep 29 11:59:29 2017 +0100
+++ b/.hgtags	Mon Oct 02 18:40:54 2017 +0200
@@ -449,3 +449,4 @@
 e5357aa85dadacc6562175ff74714fecfb4470cf jdk-10+22
 22850b3a55240253841b9a425ad60a7fcdb22d47 jdk-10+23
 3b201865d5c1f244f555cad58da599c9261286d8 jdk-10+24
+8eb5e3ccee560c28ac9b1df2670adac2b3d36fad jdk-10+25
--- a/bin/jib.sh	Fri Sep 29 11:59:29 2017 +0100
+++ b/bin/jib.sh	Mon Oct 02 18:40:54 2017 +0200
@@ -28,8 +28,8 @@
 mydir="$(dirname "${BASH_SOURCE[0]}")"
 myname="$(basename "${BASH_SOURCE[0]}")"
 
-installed_jib_script=${mydir}/../../.jib/jib
-install_data=${mydir}/../../.jib/.data
+installed_jib_script=${mydir}/../.jib/jib
+install_data=${mydir}/../.jib/.data
 
 setup_url() {
     if [ -f ~/.config/jib/jib.conf ]; then
@@ -42,7 +42,7 @@
     jib_revision="2.0-SNAPSHOT"
     jib_ext="jib.sh.gz"
 
-    closed_script="${mydir}/../../../closed/conf/jib-install.conf"
+    closed_script="${mydir}/../../closed/make/conf/jib-install.conf"
     if [ -f "${closed_script}" ]; then
         source "${closed_script}"
     fi
--- a/doc/nashorn/JavaScriptingProgrammersGuide.html	Fri Sep 29 11:59:29 2017 +0100
+++ b/doc/nashorn/JavaScriptingProgrammersGuide.html	Mon Oct 02 18:40:54 2017 +0200
@@ -127,7 +127,7 @@
 <hr>
 <span><a name="package" id="package"></a></span>
 <h2><span>Scripting Package</span></h2>
-<p><span>The Java Scripting functionality is in the <code><a href="http://docs.oracle.com/javase/6/docs/api/javax/script/package-summary.html">javax.script</a></code>
+<p><span>The Java Scripting functionality is in the <code><a href="http://docs.oracle.com/javase/9/docs/api/javax/script/package-summary.html">javax.script</a></code>
 package. This is a relatively small, simple API. The starting point
 of the scripting API is the <code>ScriptEngineManager</code> class.
 A ScriptEngineManager object can discover script engines through
--- a/make/InitSupport.gmk	Fri Sep 29 11:59:29 2017 +0100
+++ b/make/InitSupport.gmk	Mon Oct 02 18:40:54 2017 +0200
@@ -36,7 +36,7 @@
 
   # Include the corresponding closed file, if present.
   # Normal hook mechanism cannot be used since we have no SPEC.
-  -include $(topdir)/closed/make/InitSupport.gmk
+  -include $(topdir)/../closed/make/InitSupport.gmk
 
   ##############################################################################
   # Helper functions for the initial part of Init.gmk, before the spec file is
--- a/make/conf/jib-profiles.js	Fri Sep 29 11:59:29 2017 +0100
+++ b/make/conf/jib-profiles.js	Mon Oct 02 18:40:54 2017 +0200
@@ -900,6 +900,45 @@
             }
         },
 
+        "windows-x64-open": {
+            artifacts: {
+                jdk: {
+                    local: "bundles/\\(jdk.*bin.tar.gz\\)",
+                    remote: [
+                        "bundles/openjdk/GPL/windows-x64/jdk-" + data.version
+                            + "_windows-x64_bin.tar.gz",
+                        "bundles/openjdk/GPL/windows-x64/\\1"
+                    ],
+                    subdir: "jdk-" + data.version
+                },
+                jre: {
+                    local: "bundles/\\(jre.*bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/windows-x64/\\1"
+                },
+                test: {
+                    local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
+                    remote: [
+                        "bundles/openjdk/GPL/windows-x64/jdk-" + data.version
+                            + "_windows-x64_bin-tests.tar.gz",
+                        "bundles/openjdk/GPL/windows-x64/\\1"
+                    ]
+                },
+                jdk_symbols: {
+                    local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+                    remote: [
+                        "bundles/openjdk/GPL/windows-x64/jdk-" + data.version
+                            + "_windows-x64_bin-symbols.tar.gz",
+                        "bundles/openjdk/GPL/windows-x64/\\1"
+                    ],
+                    subdir: "jdk-" + data.version
+                },
+                jre_symbols: {
+                    local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/windows-x64/\\1",
+                }
+            }
+        },
+
         "linux-x86-open-debug": {
             artifacts: {
                 jdk: {
@@ -929,9 +968,10 @@
     profiles["linux-x86-ri-debug"] = clone(profiles["linux-x86-open-debug"]);
     profiles["macosx-x64-ri"] = clone(profiles["macosx-x64-open"]);
     profiles["windows-x86-ri"] = clone(profiles["windows-x86-open"]);
+    profiles["windows-x64-ri"] = clone(profiles["windows-x64-open"]);
 
     // Generate artifacts for ri profiles
-    [ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "macosx-x64-ri", "windows-x86-ri" ]
+    [ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "macosx-x64-ri", "windows-x86-ri", "windows-x64-ri" ]
         .forEach(function (name) {
             // Rewrite all remote dirs to "bundles/openjdk/BCL/..."
             for (artifactName in profiles[name].artifacts) {
@@ -947,6 +987,11 @@
             configure_args: "--with-freetype-license="
                 + input.get("freetype", "install_path")
                 + "/freetype-2.7.1-v120-x86/freetype.md"
+        },
+        "windows-x64-ri": {
+            configure_args: "--with-freetype-license="
+                + input.get("freetype", "install_path")
+                + "/freetype-2.7.1-v120-x64/freetype.md"
         }
     };
     profiles = concatObjects(profiles, profilesRiFreetype);
--- a/src/java.base/share/classes/java/lang/StackFrameInfo.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/src/java.base/share/classes/java/lang/StackFrameInfo.java	Mon Oct 02 18:40:54 2017 +0200
@@ -29,6 +29,7 @@
 
 import static java.lang.StackWalker.Option.*;
 import java.lang.StackWalker.StackFrame;
+import java.lang.invoke.MethodType;
 
 class StackFrameInfo implements StackFrame {
     private final static JavaLangInvokeAccess JLIA =
@@ -79,6 +80,17 @@
     }
 
     @Override
+    public MethodType getMethodType() {
+        walker.ensureAccessEnabled(RETAIN_CLASS_REFERENCE);
+        return JLIA.getMethodType(memberName);
+    }
+
+    @Override
+    public String getDescriptor() {
+        return JLIA.getMethodDescriptor(memberName);
+    }
+
+    @Override
     public int getByteCodeIndex() {
         // bci not available for native methods
         if (isNativeMethod())
--- a/src/java.base/share/classes/java/lang/StackWalker.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/src/java.base/share/classes/java/lang/StackWalker.java	Mon Oct 02 18:40:54 2017 +0200
@@ -26,10 +26,12 @@
 
 import jdk.internal.reflect.CallerSensitive;
 
-import java.util.*;
+import java.lang.invoke.MethodType;
+import java.util.EnumSet;
+import java.util.Objects;
+import java.util.Set;
 import java.util.function.Consumer;
 import java.util.function.Function;
-import java.util.function.Predicate;
 import java.util.stream.Stream;
 
 /**
@@ -96,7 +98,7 @@
      * @since 9
      * @jvms 2.6
      */
-    public static interface StackFrame {
+    public interface StackFrame {
         /**
          * Gets the <a href="ClassLoader.html#name">binary name</a>
          * of the declaring class of the method represented by this stack frame.
@@ -128,6 +130,47 @@
         public Class<?> getDeclaringClass();
 
         /**
+         * Returns the {@link MethodType} representing the parameter types and
+         * the return type for the method represented by this stack frame.
+         *
+         * @implSpec
+         * The default implementation throws {@code UnsupportedOperationException}.
+         *
+         * @return the {@code MethodType} for this stack frame
+         *
+         * @throws UnsupportedOperationException if this {@code StackWalker}
+         *         is not configured with {@link Option#RETAIN_CLASS_REFERENCE
+         *         Option.RETAIN_CLASS_REFERENCE}.
+         *
+         * @since 10
+         */
+        public default MethodType getMethodType() {
+            throw new UnsupportedOperationException();
+        }
+
+        /**
+         * Returns the <i>descriptor</i> of the method represented by
+         * this stack frame as defined by
+         * <cite>The Java Virtual Machine Specification</cite>.
+         *
+         * @implSpec
+         * The default implementation throws {@code UnsupportedOperationException}.
+         *
+         * @return the descriptor of the method represented by
+         *         this stack frame
+         *
+         * @see MethodType#fromMethodDescriptorString(String, ClassLoader)
+         * @see MethodType#toMethodDescriptorString()
+         * @jvms 4.3.3 Method Descriptor
+         *
+         * @since 10
+         */
+        public default String getDescriptor() {
+            throw new UnsupportedOperationException();
+        }
+
+
+        /**
          * Returns the index to the code array of the {@code Code} attribute
          * containing the execution point represented by this stack frame.
          * The code array gives the actual bytes of Java Virtual Machine code
--- a/src/java.base/share/classes/java/lang/invoke/MemberName.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/MemberName.java	Mon Oct 02 18:40:54 2017 +0200
@@ -162,6 +162,29 @@
         return (MethodType) type;
     }
 
+    /** Return the descriptor of this member, which
+     *  must be a method or constructor.
+     */
+    String getMethodDescriptor() {
+        if (type == null) {
+            expandFromVM();
+            if (type == null) {
+                return null;
+            }
+        }
+        if (!isInvocable()) {
+            throw newIllegalArgumentException("not invocable, no method type");
+        }
+
+        // Get a snapshot of type which doesn't get changed by racing threads.
+        final Object type = this.type;
+        if (type instanceof String) {
+            return (String) type;
+        } else {
+            return getMethodType().toMethodDescriptorString();
+        }
+    }
+
     /** Return the actual type under which this method or constructor must be invoked.
      *  For non-static methods or constructors, this is the type with a leading parameter,
      *  a reference to declaring class.  For static methods, it is the same as the declared type.
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Mon Oct 02 18:40:54 2017 +0200
@@ -1786,6 +1786,18 @@
             }
 
             @Override
+            public MethodType getMethodType(Object mname) {
+                MemberName memberName = (MemberName)mname;
+                return memberName.getMethodType();
+            }
+
+            @Override
+            public String getMethodDescriptor(Object mname) {
+                MemberName memberName = (MemberName)mname;
+                return memberName.getMethodDescriptor();
+            }
+
+            @Override
             public boolean isNative(Object mname) {
                 MemberName memberName = (MemberName)mname;
                 return memberName.isNative();
--- a/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java	Mon Oct 02 18:40:54 2017 +0200
@@ -40,6 +40,18 @@
     String getName(Object mname);
 
     /**
+     * Returns the {@code MethodType} for the given MemberName.
+     * Used by {@see StackFrameInfo}.
+     */
+    MethodType getMethodType(Object mname);
+
+    /**
+     * Returns the descriptor for the given MemberName.
+     * Used by {@see StackFrameInfo}.
+     */
+    String getMethodDescriptor(Object mname);
+
+    /**
      * Returns {@code true} if the given MemberName is a native method. Used by
      * {@see StackFrameInfo}.
      */
--- a/src/java.base/windows/native/libjava/io_util_md.c	Fri Sep 29 11:59:29 2017 +0100
+++ b/src/java.base/windows/native/libjava/io_util_md.c	Mon Oct 02 18:40:54 2017 +0200
@@ -550,10 +550,10 @@
 fileDescriptorClose(JNIEnv *env, jobject this)
 {
     FD fd = (*env)->GetLongField(env, this, IO_handle_fdID);
+    HANDLE h = (HANDLE)fd;
     if ((*env)->ExceptionOccurred(env)) {
         return;
     }
-    HANDLE h = (HANDLE)fd;
 
     if (h == INVALID_HANDLE_VALUE) {
         return;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Oct 02 18:40:54 2017 +0200
@@ -117,7 +117,7 @@
         varNotFound = new SymbolNotFoundError(ABSENT_VAR);
         methodNotFound = new SymbolNotFoundError(ABSENT_MTH);
         typeNotFound = new SymbolNotFoundError(ABSENT_TYP);
-        referenceNotFound = new ReferenceLookupResult(methodNotFound, null);
+        referenceNotFound = ReferenceLookupResult.error(methodNotFound);
 
         names = Names.instance(context);
         log = Log.instance(context);
@@ -2968,10 +2968,10 @@
 
         //merge results
         Pair<Symbol, ReferenceLookupHelper> res;
-        Symbol bestSym = referenceChooser.result(boundRes, unboundRes);
-        res = new Pair<>(bestSym,
-                bestSym == unboundSym ? unboundLookupHelper : boundLookupHelper);
-        env.info.pendingResolutionPhase = bestSym == unboundSym ?
+        ReferenceLookupResult bestRes = referenceChooser.result(boundRes, unboundRes);
+        res = new Pair<>(bestRes.sym,
+                bestRes == unboundRes ? unboundLookupHelper : boundLookupHelper);
+        env.info.pendingResolutionPhase = bestRes == unboundRes ?
                 unboundEnv.info.pendingResolutionPhase :
                 boundEnv.info.pendingResolutionPhase;
 
@@ -3027,11 +3027,15 @@
         Symbol sym;
 
         ReferenceLookupResult(Symbol sym, MethodResolutionContext resolutionContext) {
-            this.staticKind = staticKind(sym, resolutionContext);
+            this(sym, staticKind(sym, resolutionContext));
+        }
+
+        private ReferenceLookupResult(Symbol sym, StaticKind staticKind) {
+            this.staticKind = staticKind;
             this.sym = sym;
         }
 
-        private StaticKind staticKind(Symbol sym, MethodResolutionContext resolutionContext) {
+        private static StaticKind staticKind(Symbol sym, MethodResolutionContext resolutionContext) {
             switch (sym.kind) {
                 case MTH:
                 case AMBIGUOUS:
@@ -3080,6 +3084,10 @@
                     return false;
             }
         }
+
+        static ReferenceLookupResult error(Symbol sym) {
+            return new ReferenceLookupResult(sym, StaticKind.UNDEFINED);
+        }
     }
 
     /**
@@ -3092,7 +3100,7 @@
          * Generate a result from a pair of lookup result objects. This method delegates to the
          * appropriate result generation routine.
          */
-        Symbol result(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+        ReferenceLookupResult result(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
             return unboundRes != referenceNotFound ?
                     unboundResult(boundRes, unboundRes) :
                     boundResult(boundRes);
@@ -3101,12 +3109,12 @@
         /**
          * Generate a symbol from a given bound lookup result.
          */
-        abstract Symbol boundResult(ReferenceLookupResult boundRes);
+        abstract ReferenceLookupResult boundResult(ReferenceLookupResult boundRes);
 
         /**
          * Generate a symbol from a pair of bound/unbound lookup results.
          */
-        abstract Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes);
+        abstract ReferenceLookupResult unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes);
     }
 
     /**
@@ -3116,37 +3124,38 @@
     ReferenceChooser basicReferenceChooser = new ReferenceChooser() {
 
         @Override
-        Symbol boundResult(ReferenceLookupResult boundRes) {
+        ReferenceLookupResult boundResult(ReferenceLookupResult boundRes) {
             return !boundRes.isSuccess() || boundRes.hasKind(StaticKind.NON_STATIC) ?
-                    boundRes.sym : //the search produces a non-static method
-                    new BadMethodReferenceError(boundRes.sym, false);
+                    boundRes : //the search produces a non-static method
+                    ReferenceLookupResult.error(new BadMethodReferenceError(boundRes.sym, false));
         }
 
         @Override
-        Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+        ReferenceLookupResult unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
             if (boundRes.hasKind(StaticKind.STATIC) &&
                     (!unboundRes.isSuccess() || unboundRes.hasKind(StaticKind.STATIC))) {
                 //the first search produces a static method and no non-static method is applicable
                 //during the second search
-                return boundRes.sym;
+                return boundRes;
             } else if (unboundRes.hasKind(StaticKind.NON_STATIC) &&
                     (!boundRes.isSuccess() || boundRes.hasKind(StaticKind.NON_STATIC))) {
                 //the second search produces a non-static method and no static method is applicable
                 //during the first search
-                return unboundRes.sym;
+                return unboundRes;
             } else if (boundRes.isSuccess() && unboundRes.isSuccess()) {
                 //both searches produce some result; ambiguity (error recovery)
-                return ambiguityError(boundRes.sym, unboundRes.sym);
+                return ReferenceLookupResult.error(ambiguityError(boundRes.sym, unboundRes.sym));
             } else if (boundRes.isSuccess() || unboundRes.isSuccess()) {
                 //Both searches failed to produce a result with correct staticness (i.e. first search
                 //produces an non-static method). Alternatively, a given search produced a result
                 //with the right staticness, but the other search has applicable methods with wrong
                 //staticness (error recovery)
-                return new BadMethodReferenceError(boundRes.isSuccess() ? boundRes.sym : unboundRes.sym, true);
+                return ReferenceLookupResult.error(new BadMethodReferenceError(boundRes.isSuccess() ?
+                        boundRes.sym : unboundRes.sym, true));
             } else {
                 //both searches fail to produce a result - pick 'better' error using heuristics (error recovery)
                 return (boundRes.canIgnore() && !unboundRes.canIgnore()) ?
-                        unboundRes.sym : boundRes.sym;
+                        unboundRes : boundRes;
             }
         }
     };
@@ -3158,28 +3167,29 @@
     ReferenceChooser structuralReferenceChooser = new ReferenceChooser() {
 
         @Override
-        Symbol boundResult(ReferenceLookupResult boundRes) {
+        ReferenceLookupResult boundResult(ReferenceLookupResult boundRes) {
             return (!boundRes.isSuccess() || !boundRes.hasKind(StaticKind.STATIC)) ?
-                    boundRes.sym : //the search has at least one applicable non-static method
-                    new BadMethodReferenceError(boundRes.sym, false);
+                    boundRes : //the search has at least one applicable non-static method
+                    ReferenceLookupResult.error(new BadMethodReferenceError(boundRes.sym, false));
         }
 
         @Override
-        Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+        ReferenceLookupResult unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
             if (boundRes.isSuccess() && !boundRes.hasKind(StaticKind.NON_STATIC)) {
                 //the first serach has at least one applicable static method
-                return boundRes.sym;
+                return boundRes;
             } else if (unboundRes.isSuccess() && !unboundRes.hasKind(StaticKind.STATIC)) {
                 //the second search has at least one applicable non-static method
-                return unboundRes.sym;
+                return unboundRes;
             } else if (boundRes.isSuccess() || unboundRes.isSuccess()) {
                 //either the first search produces a non-static method, or second search produces
                 //a non-static method (error recovery)
-                return new BadMethodReferenceError(boundRes.isSuccess() ? boundRes.sym : unboundRes.sym, true);
+                return ReferenceLookupResult.error(new BadMethodReferenceError(boundRes.isSuccess() ?
+                        boundRes.sym : unboundRes.sym, true));
             } else {
                 //both searches fail to produce a result - pick 'better' error using heuristics (error recovery)
                 return (boundRes.canIgnore() && !unboundRes.canIgnore()) ?
-                        unboundRes.sym : boundRes.sym;
+                        unboundRes : boundRes;
             }
         }
     };
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Mon Oct 02 18:40:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, 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
@@ -59,7 +59,7 @@
  */
 public class LinkerCallSite extends ChainedCallSite {
     /** Maximum number of arguments passed directly. */
-    public static final int ARGLIMIT = 250;
+    public static final int ARGLIMIT = 125;
 
     private static final String PROFILEFILE = Options.getStringProperty("nashorn.profilefile", "NashornProfile.txt");
 
--- a/src/jdk.scripting.nashorn/share/classes/module-info.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/src/jdk.scripting.nashorn/share/classes/module-info.java	Mon Oct 02 18:40:54 2017 +0200
@@ -44,8 +44,7 @@
 </pre>
  *
  * and then use it just as you would any other JSR-223 script engine. See
- * <a href="jdk/nashorn/api/scripting/package-summary.html">
- * {@code jdk.nashorn.api.scripting}</a> package for details.
+ * {@link jdk.nashorn.api.scripting} package for details.
  * <h1>Compatibility</h1>
  * Nashorn is 100% compliant with the
  * <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"
--- a/test/jdk/java/lang/StackWalker/Basic.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/test/jdk/java/lang/StackWalker/Basic.java	Mon Oct 02 18:40:54 2017 +0200
@@ -29,8 +29,9 @@
  */
 
 import java.lang.StackWalker.StackFrame;
+import java.lang.invoke.MethodType;
 import java.util.List;
-import java.util.Objects;
+import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import static java.lang.StackWalker.Option.*;
@@ -74,6 +75,37 @@
                      found);
     }
 
+    @Test
+    public static void testMethodSignature() throws Exception {
+        List<StackFrame> frames = new StackBuilder(16, 16).build();
+        Map<String, MethodType> methodTypes = StackBuilder.methodTypes();
+        for (StackFrame f : frames) {
+            MethodType type = methodTypes.get(f.getMethodName());
+            if (type != null) {
+                System.out.format("%s.%s %s%n", f.getClassName(), f.getMethodName(),
+                                  f.getDescriptor());
+
+                String descriptor = f.getDescriptor();
+                if (!descriptor.equals(type.toMethodDescriptorString())) {
+                    throw new RuntimeException("Expected: " + type.toMethodDescriptorString()
+                        + " got: " + f.getDescriptor());
+                }
+
+                if (!f.getMethodType().equals(type)) {
+                    throw new RuntimeException("Expected: " + type
+                        + " got: " + f.getMethodType());
+                }
+
+                // verify descriptor returned by getDescriptor() before and after
+                // getMethodType() is called
+                if (!descriptor.equals(f.getDescriptor())) {
+                    throw new RuntimeException("Mismatched: " + descriptor
+                        + " got: " + f.getDescriptor());
+                }
+            }
+        }
+    }
+
     private final int depth;
     Basic(int depth) {
         this.depth = depth;
@@ -132,7 +164,7 @@
         }
     }
 
-    class StackBuilder {
+    static class StackBuilder {
         private final int stackDepth;
         private final int limit;
         private int depth = 0;
@@ -150,15 +182,17 @@
             trace("m1");
             m2();
         }
-        void m2() {
+        List m2() {
             trace("m2");
             m3();
+            return null;
         }
-        void m3() {
+        int m3() {
             trace("m3");
-            m4();
+            m4(null);
+            return 0;
         }
-        void m4() {
+        void m4(Object o) {
             trace("m4");
             int remaining = stackDepth-depth-1;
             if (remaining >= 4) {
@@ -184,6 +218,13 @@
             if (verbose)
                 System.out.format("%2d: %s%n", depth, methodname);
         }
+
+        static Map<String, MethodType> methodTypes() throws Exception {
+            return Map.of("m1", MethodType.methodType(void.class),
+                          "m2", MethodType.methodType(List.class),
+                          "m3", MethodType.methodType(int.class),
+                          "m4", MethodType.methodType(void.class, Object.class));
+        }
     }
 
 }
--- a/test/jdk/java/lang/StackWalker/SanityTest.java	Fri Sep 29 11:59:29 2017 +0100
+++ b/test/jdk/java/lang/StackWalker/SanityTest.java	Mon Oct 02 18:40:54 2017 +0200
@@ -79,4 +79,24 @@
             throw new RuntimeException("NPE expected");
         } catch (NullPointerException e) {}
     }
+
+
+    @Test
+    public static void testUOEFromGetDeclaringClass() {
+        try {
+            StackWalker sw = StackWalker.getInstance();
+            sw.forEach(StackWalker.StackFrame::getDeclaringClass);
+            throw new RuntimeException("UOE expected");
+        } catch (UnsupportedOperationException expected) {
+        }
+    }
+
+    @Test
+    public static void testUOEFromGetMethodType() {
+        try {
+            StackWalker sw = StackWalker.getInstance();
+            sw.forEach(StackWalker.StackFrame::getMethodType);
+            throw new RuntimeException("UOE expected");
+        } catch (UnsupportedOperationException expected) {}
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8187978/FilterOutCandidatesForDiagnosticsTest.java	Mon Oct 02 18:40:54 2017 +0200
@@ -0,0 +1,18 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8187978
+ * @summary javac can show overload error messages that include non-valid candidates
+ * @compile/fail/ref=FilterOutCandidatesForDiagnosticsTest.out -XDrawDiagnostics FilterOutCandidatesForDiagnosticsTest.java
+ */
+
+import java.util.*;
+
+class FilterOutCandidatesForDiagnosticsTest {
+    void test() {
+        make(new ArrayList<String>(), new ArrayList<Integer>()).add("");
+    }
+
+    <Z> Z make(Z z1, Z z2) {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8187978/FilterOutCandidatesForDiagnosticsTest.out	Mon Oct 02 18:40:54 2017 +0200
@@ -0,0 +1,2 @@
+FilterOutCandidatesForDiagnosticsTest.java:12:64: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>,java.lang.Object[],int), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>))),(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(int,compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>), (compiler.misc.arg.length.mismatch))}
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/8188144/T8188144.java	Mon Oct 02 18:40:54 2017 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8188144
+ * @summary regression in method reference type-checking
+ */
+
+import java.util.function.BiFunction;
+
+public class T8188144 {
+    public static void main(String[] args) {
+        BiFunction<String, String, String> format = String::format;
+        if (!format.apply("foo %s", "bar").endsWith("foo bar")) {
+            throw new AssertionError("Unexpected output!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8147076.js	Mon Oct 02 18:40:54 2017 +0200
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 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
+ * 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.
+ */
+
+/**
+ * JDK-8147076: LinkerCallSite.ARGLIMIT is used incorrectly
+ *
+ * @test
+ * @run
+ */
+
+function nonvarargs(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
+           p11, p12, p13, p14, p15, p16, p17, p18, p19, p20,
+           p21, p22, p23, p24, p25, p26, p27, p28, p29, p30,
+           p31, p32, p33, p34, p35, p36, p37, p38, p39, p40,
+           p41, p42, p43, p44, p45, p46, p47, p48, p49, p50,
+           p51, p52, p53, p54, p55, p56, p57, p58, p59, p60,
+           p61, p62, p63, p64, p65, p66, p67, p68, p69, p70,
+           p71, p72, p73, p74, p75, p76, p77, p78, p79, p80,
+           p81, p82, p83, p84, p85, p86, p87, p88, p89, p90,
+           p91, p92, p93, p94, p95, p96, p97, p98, p99, p100,
+           p101, p102, p103, p104, p105, p106, p107, p108, p109, p110,
+           p111, p112, p113, p114, p115, p116, p117, p118, p119, p120,
+           p121, p122, p123, p124, p125) {
+    //eval() is just to make sure this-object and callee are passed as parameters
+    eval();
+    print("non-vararg invocation if arguments <= 125");
+}
+
+nonvarargs(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.10,11.11,12.12,13.13,14.14,15.15,16.16,17.17,18.18,19.19,20.20,
+    21.21,22.22,23.23,24.24,25.25,26.26,27.27,28.28,29.29,30.30,31.31,32.32,33.33,34.34,35.35,36.36,37.37,38.38,39.39,40.40,
+    41.41,42.42,43.43,44.44,45.45,46.46,47.47,48.48,49.49,50.50,51.51,52.52,53.53,54.54,55.55,56.56,57.57,58.58,59.59,60.60,
+    61.61,62.62,63.63,64.64,65.65,66.66,67.67,68.68,69.69,70.70,71.71,72.72,73.73,74.74,75.75,76.76,77.77,78.78,79.79,80.80,
+    81.81,82.82,83.83,84.84,85.85,86.86,87.87,88.88,89.89,90.90,91.91,92.92,93.93,94.94,95.95,96.96,97.97,98.98,99.99,100.100,
+    101.101,102.102,103.103,104.104,105.105,106.106,107.107,108.108,109.109,110.110,111.111,112.112,113.113,114.114,115.115,
+    116.116,117.117,118.118,119.119,120.120,121.121,122.122,123.123,124.124,125.125);
+
+
+
+function varargs(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
+           p11, p12, p13, p14, p15, p16, p17, p18, p19, p20,
+           p21, p22, p23, p24, p25, p26, p27, p28, p29, p30,
+           p31, p32, p33, p34, p35, p36, p37, p38, p39, p40,
+           p41, p42, p43, p44, p45, p46, p47, p48, p49, p50,
+           p51, p52, p53, p54, p55, p56, p57, p58, p59, p60,
+           p61, p62, p63, p64, p65, p66, p67, p68, p69, p70,
+           p71, p72, p73, p74, p75, p76, p77, p78, p79, p80,
+           p81, p82, p83, p84, p85, p86, p87, p88, p89, p90,
+           p91, p92, p93, p94, p95, p96, p97, p98, p99, p100,
+           p101, p102, p103, p104, p105, p106, p107, p108, p109, p110,
+           p111, p112, p113, p114, p115, p116, p117, p118, p119, p120,
+           p121, p122, p123, p124, p125, p126) {
+    //eval() is just to make sure this-object and callee are passed as parameters
+    eval();
+    print("vararg invocation if arguments > 125");
+}
+
+varargs(1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.10,11.11,12.12,13.13,14.14,15.15,16.16,17.17,18.18,19.19,20.20,
+    21.21,22.22,23.23,24.24,25.25,26.26,27.27,28.28,29.29,30.30,31.31,32.32,33.33,34.34,35.35,36.36,37.37,38.38,39.39,40.40,
+    41.41,42.42,43.43,44.44,45.45,46.46,47.47,48.48,49.49,50.50,51.51,52.52,53.53,54.54,55.55,56.56,57.57,58.58,59.59,60.60,
+    61.61,62.62,63.63,64.64,65.65,66.66,67.67,68.68,69.69,70.70,71.71,72.72,73.73,74.74,75.75,76.76,77.77,78.78,79.79,80.80,
+    81.81,82.82,83.83,84.84,85.85,86.86,87.87,88.88,89.89,90.90,91.91,92.92,93.93,94.94,95.95,96.96,97.97,98.98,99.99,100.100,
+    101.101,102.102,103.103,104.104,105.105,106.106,107.107,108.108,109.109,110.110,111.111,112.112,113.113,114.114,115.115,
+    116.116,117.117,118.118,119.119,120.120,121.121,122.122,123.123,124.124,125.125,126.126);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8147076.js.EXPECTED	Mon Oct 02 18:40:54 2017 +0200
@@ -0,0 +1,2 @@
+non-vararg invocation if arguments <= 125
+vararg invocation if arguments > 125
--- a/test/nashorn/script/trusted/JDK-8006529.js	Fri Sep 29 11:59:29 2017 +0100
+++ b/test/nashorn/script/trusted/JDK-8006529.js	Mon Oct 02 18:40:54 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, 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
@@ -256,9 +256,9 @@
 // eval, but at least the parent doesn't have to be vararg.
 testFirstFn("(function f() { function g() { eval() } })", 'usesSelfSymbol', 'needsParentScope', 'needsCallee', 'hasScopeBlock', 'allVarsInScope')
 
-// Function with 250 named parameters is ordinary
-testFirstFn("function f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40, p41, p42, p43, p44, p45, p46, p47, p48, p49, p50, p51, p52, p53, p54, p55, p56, p57, p58, p59, p60, p61, p62, p63, p64, p65, p66, p67, p68, p69, p70, p71, p72, p73, p74, p75, p76, p77, p78, p79, p80, p81, p82, p83, p84, p85, p86, p87, p88, p89, p90, p91, p92, p93, p94, p95, p96, p97, p98, p99, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127, p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143, p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159, p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175, p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191, p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207, p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223, p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250) { p250 = p249 }")
+// Function with 125 named parameters is ordinary
+testFirstFn("function f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40, p41, p42, p43, p44, p45, p46, p47, p48, p49, p50, p51, p52, p53, p54, p55, p56, p57, p58, p59, p60, p61, p62, p63, p64, p65, p66, p67, p68, p69, p70, p71, p72, p73, p74, p75, p76, p77, p78, p79, p80, p81, p82, p83, p84, p85, p86, p87, p88, p89, p90, p91, p92, p93, p94, p95, p96, p97, p98, p99, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125) { p125 = p124 }")
 
-// Function with 251 named parameters is variable arguments
+// Function with 126 named parameters is variable arguments
 // NOTE: hasScopeBlock should be optimized away. Implementation of JDK-8038942 should take care of it.
-testFirstFn("function f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40, p41, p42, p43, p44, p45, p46, p47, p48, p49, p50, p51, p52, p53, p54, p55, p56, p57, p58, p59, p60, p61, p62, p63, p64, p65, p66, p67, p68, p69, p70, p71, p72, p73, p74, p75, p76, p77, p78, p79, p80, p81, p82, p83, p84, p85, p86, p87, p88, p89, p90, p91, p92, p93, p94, p95, p96, p97, p98, p99, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127, p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143, p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159, p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175, p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191, p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207, p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223, p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239, p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251) { p250 = p251 }", 'isVarArg', 'hasScopeBlock')
+testFirstFn("function f(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40, p41, p42, p43, p44, p45, p46, p47, p48, p49, p50, p51, p52, p53, p54, p55, p56, p57, p58, p59, p60, p61, p62, p63, p64, p65, p66, p67, p68, p69, p70, p71, p72, p73, p74, p75, p76, p77, p78, p79, p80, p81, p82, p83, p84, p85, p86, p87, p88, p89, p90, p91, p92, p93, p94, p95, p96, p97, p98, p99, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126) { p125 = p126 }", 'isVarArg', 'hasScopeBlock')