Merge JDK-8188051-branch
authorlancea
Thu, 12 Jul 2018 15:21:13 -0400
branchJDK-8188051-branch
changeset 56831 21443aec7aa7
parent 56828 64304e37e9b1 (current diff)
parent 51046 69634e97740c (diff)
child 56832 4f7713e6a308
Merge
--- a/.hgtags	Wed Jul 11 19:36:23 2018 -0400
+++ b/.hgtags	Thu Jul 12 15:21:13 2018 -0400
@@ -495,3 +495,4 @@
 9816d7cc655e53ba081f938b656e31971b8f097a jdk-11+20
 14708e1acdc3974f4539027cbbcfa6d69f83cf51 jdk-11+21
 00b16d0457e43d23f6ca5ade6b243edce62750a0 jdk-12+1
+69b438908512d3dfef5852c6a843a5778333a309 jdk-12+2
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.hpp	Wed Jul 11 19:36:23 2018 -0400
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.hpp	Thu Jul 12 15:21:13 2018 -0400
@@ -121,6 +121,11 @@
     safe_object_iterate(cl);
   }
 
+  // Object pinning support: every object is implicitly pinned
+  virtual bool supports_object_pinning() const           { return true; }
+  virtual oop pin_object(JavaThread* thread, oop obj)    { return obj; }
+  virtual void unpin_object(JavaThread* thread, oop obj) { }
+
   // No support for block parsing.
   virtual HeapWord* block_start(const void* addr) const { return NULL;  }
   virtual size_t block_size(const HeapWord* addr) const { return 0;     }
--- a/src/java.base/windows/classes/sun/nio/fs/WindowsSecurity.java	Wed Jul 11 19:36:23 2018 -0400
+++ b/src/java.base/windows/classes/sun/nio/fs/WindowsSecurity.java	Thu Jul 12 15:21:13 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -102,9 +102,8 @@
         final boolean stopImpersontating = impersontating;
         final boolean needToRevert = elevated;
 
-        return new Privilege() {
-            @Override
-            public void drop() {
+        return () -> {
+            try {
                 if (token != 0L) {
                     try {
                         if (stopImpersontating)
@@ -118,6 +117,8 @@
                         CloseHandle(token);
                     }
                 }
+            } finally {
+                LocalFree(pLuid);
             }
         };
     }
--- a/src/java.base/windows/native/libjava/io_util_md.c	Wed Jul 11 19:36:23 2018 -0400
+++ b/src/java.base/windows/native/libjava/io_util_md.c	Thu Jul 12 15:21:13 2018 -0400
@@ -165,9 +165,6 @@
                      pathbuf = (WCHAR*)malloc((pathlen + 6) * sizeof(WCHAR));
                      if (pathbuf != 0) {
                          wcscpy(pathbuf, ps);
-                     } else {
-                         JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
-                         return NULL;
                      }
                  }
             } else {
@@ -191,9 +188,6 @@
                     pathbuf = (WCHAR*)malloc((pathlen + 6) * sizeof(WCHAR));
                     if (pathbuf != 0) {
                         wcscpy(pathbuf, ps);
-                    } else {
-                        JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
-                        return NULL;
                     }
                 }
             }
@@ -210,15 +204,11 @@
             pathbuf = (WCHAR*)malloc(sizeof(WCHAR));
             if (pathbuf != NULL) {
                 pathbuf[0] = L'\0';
-            } else {
-                JNU_ThrowOutOfMemoryError(env, 0);
-                return NULL;
             }
         }
     }
     if (pathbuf == 0) {
-        JNU_ThrowOutOfMemoryError(env, 0);
-        return NULL;
+        JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
     }
     return pathbuf;
 }
--- a/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c	Wed Jul 11 19:36:23 2018 -0400
+++ b/src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c	Thu Jul 12 15:21:13 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -1043,8 +1043,11 @@
     if (pLuid == NULL) {
         JNU_ThrowInternalError(env, "Unable to allocate LUID structure");
     } else {
-        if (LookupPrivilegeValueW(NULL, lpName, pLuid) == 0)
+        if (LookupPrivilegeValueW(NULL, lpName, pLuid) == 0) {
+            LocalFree(pLuid);
             throwWindowsException(env, GetLastError());
+            return (jlong)0;
+        }
     }
     return ptr_to_jlong(pLuid);
 }
--- a/src/java.xml/share/classes/javax/xml/stream/events/StartElement.java	Wed Jul 11 19:36:23 2018 -0400
+++ b/src/java.xml/share/classes/javax/xml/stream/events/StartElement.java	Thu Jul 12 15:21:13 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, 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
@@ -47,11 +47,11 @@
   public QName getName();
 
   /**
-   * Returns an Iterator of non-namespace declared attributes declared on
-   * this START_ELEMENT,
-   * returns an empty iterator if there are no attributes.  The
-   * iterator must contain only implementations of the javax.xml.stream.Attribute
-   * interface.   Attributes are fundamentally unordered and may not be reported
+   * Returns an Iterator of non-namespace attributes declared on this START_ELEMENT.
+   * Returns an empty iterator if there are no attributes.
+   * The iterator must contain only implementations of the
+   * {@link Attribute} interface.
+   * Attributes are fundamentally unordered and may be reported
    * in any order.
    *
    * @return a readonly Iterator over Attribute interfaces, or an
@@ -68,9 +68,9 @@
    * current context of namespace declarations.
    *
    * <p>The iterator must contain only implementations of the
-   * javax.xml.stream.Namespace interface.
+   * {@link Namespace} interface.
    *
-   * <p>A Namespace isA Attribute.  One
+   * <p>A {@link Namespace} is an {@link Attribute}.  One
    * can iterate over a list of namespaces as a list of attributes.
    * However this method returns only the list of namespaces
    * declared on this START_ELEMENT and does not
@@ -85,8 +85,8 @@
   public Iterator<Namespace> getNamespaces();
 
   /**
-   * Returns the attribute referred to by this name
-   * @param name the qname of the desired name
+   * Returns the attribute referred to by the qname.
+   * @param name the qname of the desired attribute
    * @return the attribute corresponding to the name value or null
    */
   public Attribute getAttributeByName(QName name);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskPool.java	Wed Jul 11 19:36:23 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskPool.java	Thu Jul 12 15:21:13 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -27,10 +27,22 @@
 
 import java.io.PrintStream;
 import java.io.Writer;
+import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
 
 import com.sun.source.tree.ClassTree;
 import com.sun.source.tree.CompilationUnitTree;
@@ -53,21 +65,8 @@
 import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.main.Arguments;
 import com.sun.tools.javac.main.JavaCompiler;
+import com.sun.tools.javac.model.JavacElements;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
-
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
-
-import com.sun.tools.javac.model.JavacElements;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
@@ -101,9 +100,10 @@
 public class JavacTaskPool {
 
     private static final JavacTool systemProvider = JavacTool.create();
+    private static final Queue<ReusableContext> EMPTY_QUEUE = new ArrayDeque<>(0);
 
     private final int maxPoolSize;
-    private final Map<List<String>, List<ReusableContext>> options2Contexts = new HashMap<>();
+    private final Map<List<String>, Queue<ReusableContext>> options2Contexts = new HashMap<>();
     private int id;
 
     private int statReused = 0;
@@ -159,14 +159,14 @@
         ReusableContext ctx;
 
         synchronized (this) {
-            List<ReusableContext> cached =
-                    options2Contexts.getOrDefault(opts, Collections.emptyList());
+            Queue<ReusableContext> cached =
+                    options2Contexts.getOrDefault(opts, EMPTY_QUEUE);
 
             if (cached.isEmpty()) {
                 ctx = new ReusableContext(opts);
                 statNew++;
             } else {
-                ctx = cached.remove(0);
+                ctx = cached.remove();
                 statReused++;
             }
         }
@@ -200,7 +200,7 @@
                     options2Contexts.get(toRemove.arguments).remove(toRemove);
                     statRemoved++;
                 }
-                options2Contexts.computeIfAbsent(ctx.arguments, x -> new ArrayList<>()).add(ctx);
+                options2Contexts.computeIfAbsent(ctx.arguments, x -> new ArrayDeque<>()).add(ctx);
                 ctx.timeStamp = id++;
             }
         }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Wed Jul 11 19:36:23 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Thu Jul 12 15:21:13 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -25,11 +25,20 @@
 
 package com.sun.tools.javac.comp;
 
-import java.util.ArrayList;
+import java.util.ArrayDeque;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Queue;
+import java.util.function.Predicate;
 
 import com.sun.source.tree.LambdaExpressionTree;
+import com.sun.source.tree.NewClassTree;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Kinds.Kind;
 import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.code.Source.Feature;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Types;
 import com.sun.tools.javac.comp.ArgumentAttr.LocalCacheContext;
@@ -48,7 +57,9 @@
 import com.sun.tools.javac.tree.JCTree.JCNewClass;
 import com.sun.tools.javac.tree.JCTree.JCStatement;
 import com.sun.tools.javac.tree.JCTree.JCSwitch;
+import com.sun.tools.javac.tree.JCTree.JCTry;
 import com.sun.tools.javac.tree.JCTree.JCTypeApply;
+import com.sun.tools.javac.tree.JCTree.JCUnary;
 import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
 import com.sun.tools.javac.tree.JCTree.JCWhileLoop;
 import com.sun.tools.javac.tree.JCTree.Tag;
@@ -56,9 +67,11 @@
 import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.tree.TreeMaker;
 import com.sun.tools.javac.tree.TreeScanner;
+import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
+import com.sun.tools.javac.util.DiagnosticSource;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
@@ -66,20 +79,6 @@
 import com.sun.tools.javac.util.Options;
 import com.sun.tools.javac.util.Position;
 
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Predicate;
-
-import com.sun.source.tree.NewClassTree;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Kinds.Kind;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.tree.JCTree.JCTry;
-import com.sun.tools.javac.tree.JCTree.JCUnary;
-import com.sun.tools.javac.util.Assert;
-import com.sun.tools.javac.util.DiagnosticSource;
-
 import static com.sun.tools.javac.code.Flags.GENERATEDCONSTR;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.tree.JCTree.Tag.APPLY;
@@ -521,11 +520,11 @@
      */
     DeferredAnalysisHelper queueDeferredHelper = new DeferredAnalysisHelper() {
 
-        Map<ClassSymbol, ArrayList<RewritingContext>> Q = new HashMap<>();
+        Map<ClassSymbol, Queue<RewritingContext>> Q = new HashMap<>();
 
         @Override
         public void queue(RewritingContext rewriting) {
-            ArrayList<RewritingContext> s = Q.computeIfAbsent(rewriting.env.enclClass.sym.outermostClass(), k -> new ArrayList<>());
+            Queue<RewritingContext> s = Q.computeIfAbsent(rewriting.env.enclClass.sym.outermostClass(), k -> new ArrayDeque<>());
             s.add(rewriting);
         }
 
@@ -535,9 +534,9 @@
                 DeferredAnalysisHelper prevHelper = deferredAnalysisHelper;
                 try {
                     deferredAnalysisHelper = flushDeferredHelper;
-                    ArrayList<RewritingContext> rewritings = Q.get(flushEnv.enclClass.sym.outermostClass());
+                    Queue<RewritingContext> rewritings = Q.get(flushEnv.enclClass.sym.outermostClass());
                     while (rewritings != null && !rewritings.isEmpty()) {
-                        doAnalysis(rewritings.remove(0));
+                        doAnalysis(rewritings.remove());
                     }
                 } finally {
                     deferredAnalysisHelper = prevHelper;