# HG changeset patch # User alanb # Date 1558606057 -3600 # Node ID 276d3e54026898e6920eae9c20c3b44c946f43c7 # Parent f0a1d9760c5e86101284ebdbc976922ff6ee467a# Parent 4645b6d57f548bbbf61b2f7ee164923886e1e589 Merge diff -r f0a1d9760c5e -r 276d3e540268 .hgtags --- a/.hgtags Fri May 17 13:21:44 2019 +0100 +++ b/.hgtags Thu May 23 11:07:37 2019 +0100 @@ -559,3 +559,4 @@ a43d6467317d8f1e160f67aadec37919c9d64443 jdk-13+19 6ccc7cd7931e34129f6b7e04988fc9a63958dde0 jdk-13+20 f2f11d7f7f4e7128f8aba6ffa576cfa76fbf7d1a jdk-13+21 +181986c5476468bc2dd4532af49599003ee8af37 jdk-13+22 diff -r f0a1d9760c5e -r 276d3e540268 doc/building.html --- a/doc/building.html Fri May 17 13:21:44 2019 +0100 +++ b/doc/building.html Thu May 23 11:07:37 2019 +0100 @@ -297,6 +297,10 @@ +
All compilers are expected to be able to compile to the C99 language standard, +as some C99 features are used in the source code. Microsoft Visual Studio +doesn't fully support C99 so in practice shared code is limited to using C99 +features that it does support.
The minimum accepted version of gcc is 4.8. Older versions will generate a warning by configure
and are unlikely to work.
The JDK is currently known to be able to compile with at least version 7.4 of gcc.
diff -r f0a1d9760c5e -r 276d3e540268 doc/building.md --- a/doc/building.md Fri May 17 13:21:44 2019 +0100 +++ b/doc/building.md Thu May 23 11:07:37 2019 +0100 @@ -328,6 +328,11 @@ Solaris Oracle Solaris Studio 12.6 (with compiler version 5.15) Windows Microsoft Visual Studio 2017 update 15.9.6 +All compilers are expected to be able to compile to the C99 language standard, +as some C99 features are used in the source code. Microsoft Visual Studio +doesn't fully support C99 so in practice shared code is limited to using C99 +features that it does support. + ### gcc The minimum accepted version of gcc is 4.8. Older versions will generate a warning diff -r f0a1d9760c5e -r 276d3e540268 make/Docs.gmk --- a/make/Docs.gmk Fri May 17 13:21:44 2019 +0100 +++ b/make/Docs.gmk Thu May 23 11:07:37 2019 +0100 @@ -85,13 +85,14 @@ -tag param \ -tag return \ -tag throws \ + -taglet build.tools.taglet.JSpec\$$JLS \ + -taglet build.tools.taglet.JSpec\$$JVMS \ -taglet build.tools.taglet.ModuleGraph \ + -taglet build.tools.taglet.ToolGuide \ -tag since \ -tag serialData \ -tag factory \ -tag see \ - -tag 'jvms:a:See The Java™ Virtual Machine Specification:' \ - -tag 'jls:a:See The Java™ Language Specification:' \ -taglet build.tools.taglet.ExtLink \ -taglet build.tools.taglet.Incubating \ -tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \ @@ -275,7 +276,8 @@ $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES)) $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) - $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ + -Djspec.version=$$(VERSION_SPECIFICATION) ifeq ($$(ENABLE_FULL_DOCS), true) # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff -r f0a1d9760c5e -r 276d3e540268 make/autoconf/flags-cflags.m4 --- a/make/autoconf/flags-cflags.m4 Fri May 17 13:21:44 2019 +0100 +++ b/make/autoconf/flags-cflags.m4 Thu May 23 11:07:37 2019 +0100 @@ -300,6 +300,20 @@ C_O_FLAG_DEBUG="-O0" C_O_FLAG_DEBUG_JVM="-O0" C_O_FLAG_NONE="-O0" + # -D_FORTIFY_SOURCE=2 hardening option needs optimization (at least -O1) enabled + # set for lower O-levels -U_FORTIFY_SOURCE to overwrite previous settings + if test "x$OPENJDK_TARGET_OS" = xlinux -a "x$DEBUG_LEVEL" = "xfastdebug"; then + ENABLE_FORTIFY_CFLAGS="-D_FORTIFY_SOURCE=2" + DISABLE_FORTIFY_CFLAGS="-U_FORTIFY_SOURCE" + C_O_FLAG_HIGHEST_JVM="${C_O_FLAG_HIGHEST_JVM} ${ENABLE_FORTIFY_CFLAGS}" + C_O_FLAG_HIGHEST="${C_O_FLAG_HIGHEST} ${ENABLE_FORTIFY_CFLAGS}" + C_O_FLAG_HI="${C_O_FLAG_HI} ${ENABLE_FORTIFY_CFLAGS}" + C_O_FLAG_NORM="${C_O_FLAG_NORM} ${ENABLE_FORTIFY_CFLAGS}" + C_O_FLAG_SIZE="${C_O_FLAG_SIZE} ${DISABLE_FORTIFY_CFLAGS}" + C_O_FLAG_DEBUG="${C_O_FLAG_DEBUG} ${DISABLE_FORTIFY_CFLAGS}" + C_O_FLAG_DEBUG_JVM="${C_O_FLAG_DEBUG_JVM} ${DISABLE_FORTIFY_CFLAGS}" + C_O_FLAG_NONE="${C_O_FLAG_NONE} ${DISABLE_FORTIFY_CFLAGS}" + fi elif test "x$TOOLCHAIN_TYPE" = xclang; then if test "x$OPENJDK_TARGET_OS" = xmacosx; then # On MacOSX we optimize for size, something @@ -550,7 +564,7 @@ TOOLCHAIN_CFLAGS="-errshort=tags" TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS" - TOOLCHAIN_CFLAGS_JDK_CONLY="-xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only + TOOLCHAIN_CFLAGS_JDK_CONLY="-W0,-noglobal $TOOLCHAIN_CFLAGS" # C only TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \ -library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS" @@ -571,6 +585,30 @@ TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-" fi + # CFLAGS C language level for JDK sources (hotspot only uses C++) + # Ideally we would have a common level across all toolchains so that all sources + # are sure to conform to the same standard. Unfortunately neither our sources nor + # our toolchains are in a condition to support that. But what we loosely aim for is + # C99 level. + if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then + # This raises the language level for older 4.8 gcc, while lowering it for later + # versions. clang and xlclang support the same flag. + LANGSTD_CFLAGS="-std=c99" + elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then + # We can't turn on -std=c99 without breaking compilation of the splashscreen/png + # utilities. But we can enable c99 as below (previously achieved by using -Xa). + # It is the no_lib that makes the difference. + LANGSTD_CFLAGS="-xc99=all,no_lib" + elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then + # MSVC doesn't support C99/C11 explicitly, unless you compile as C++: + # LANGSTD_CFLAGS="/TP" + # but that requires numerous changes to the sources files. So we are limited + # to C89/C90 plus whatever extensions Visual Studio has decided to implement. + # This is the lowest bar for shared code. + LANGSTD_CFLAGS="" + fi + TOOLCHAIN_CFLAGS_JDK_CONLY="$LANGSTD_CFLAGS $TOOLCHAIN_CFLAGS_JDK_CONLY" + # CFLAGS WARNINGS STUFF # Set JVM_CFLAGS warning handling if test "x$TOOLCHAIN_TYPE" = xgcc; then diff -r f0a1d9760c5e -r 276d3e540268 make/hotspot/lib/JvmFeatures.gmk --- a/make/hotspot/lib/JvmFeatures.gmk Fri May 17 13:21:44 2019 +0100 +++ b/make/hotspot/lib/JvmFeatures.gmk Thu May 23 11:07:37 2019 +0100 @@ -111,6 +111,7 @@ JVM_EXCLUDE_FILES += \ classListParser.cpp \ classLoaderExt.cpp \ + dynamicArchive.cpp \ filemap.cpp \ heapShared.cpp \ metaspaceShared.cpp \ diff -r f0a1d9760c5e -r 276d3e540268 make/jdk/src/classes/build/tools/taglet/JSpec.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/jdk/src/classes/build/tools/taglet/JSpec.java Thu May 23 11:07:37 2019 +0100 @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2017, 2019, 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. + */ + +package build.tools.taglet; + +import java.util.EnumSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.lang.model.element.Element; + +import com.sun.source.doctree.DocTree; +import com.sun.source.doctree.LiteralTree; +import com.sun.source.doctree.UnknownBlockTagTree; +import com.sun.source.util.SimpleDocTreeVisitor; +import jdk.javadoc.doclet.Taglet; + +import static com.sun.source.doctree.DocTree.Kind.*; + +/** + * A base class for block tags to insert a link to an external copy of JLS or JVMS. + * The tags can be used as follows: + * + *+ * @jls section-number description + *+ * + * For example: + * + *
+ * @jls 3.4 Line Terminators + *+ * + * will produce the following HTML for a docs build configured for Java SE 12. + * + *
{@code + *
");
+ }
+ sb.append(escape(tree.getBody().toString()));
+ if (tree.getKind() == CODE) {
+ sb.append("
");
+ }
+ return sb;
+ }
+
+ private String escape(String s) {
+ return s.replace("&", "&").replace("<", "<").replace(">", ">");
+ }
+ }).visit(tree.getContent(), new StringBuilder()).toString();
+ }
+}
diff -r f0a1d9760c5e -r 276d3e540268 make/jdk/src/classes/build/tools/taglet/ToolGuide.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/jdk/src/classes/build/tools/taglet/ToolGuide.java Thu May 23 11:07:37 2019 +0100
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2017, 2019, 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.
+ */
+
+package build.tools.taglet;
+
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.PackageElement;
+
+import com.sun.source.doctree.DocTree;
+import com.sun.source.doctree.UnknownBlockTagTree;
+import jdk.javadoc.doclet.Taglet;
+
+import static com.sun.source.doctree.DocTree.Kind.*;
+import static jdk.javadoc.doclet.Taglet.Location.*;
+
+/**
+ * A block tag to insert a link to tool guide in a nearby directory.
+ * The tag can be used as follows:
+ * + * @toolGuide javac + *
+ * will produce the following html, depending on the file containing + * the tag. + *
+ * {@code + *