--- a/.hgtags Fri Nov 23 09:02:17 2018 -0500
+++ b/.hgtags Fri Nov 23 09:12:00 2018 -0500
@@ -523,3 +523,4 @@
e38473506688e0995e701fc7f77d5a91b438ef93 jdk-12+18
dc1f9dec2018a37fedba47d8a2aedef99faaec64 jdk-12+19
40098289d5804c3b5e7074bc75501a81e70d9b0d jdk-12+20
+f8fb0c86f2b3d24294d39c5685a628e1beb14ba7 jdk-12+21
--- a/doc/building.html Fri Nov 23 09:02:17 2018 -0500
+++ b/doc/building.html Fri Nov 23 09:12:00 2018 -0500
@@ -69,6 +69,7 @@
</ul></li>
<li><a href="#running-tests">Running Tests</a></li>
<li><a href="#cross-compiling">Cross-compiling</a><ul>
+<li><a href="#cross-compiling-the-easy-way-with-openjdk-devkits">Cross compiling the easy way with OpenJDK devkits</a></li>
<li><a href="#boot-jdk-and-build-jdk">Boot JDK and Build JDK</a></li>
<li><a href="#specifying-the-target-platform">Specifying the Target Platform</a></li>
<li><a href="#toolchain-considerations">Toolchain Considerations</a></li>
@@ -570,6 +571,47 @@
<p>This requires a more complex setup and build procedure. This section assumes you are familiar with cross-compiling in general, and will only deal with the particularities of cross-compiling the JDK. If you are new to cross-compiling, please see the <a href="https://en.wikipedia.org/wiki/Cross_compiler#External_links">external links at Wikipedia</a> for a good start on reading materials.</p>
<p>Cross-compiling the JDK requires you to be able to build both for the build platform and for the target platform. The reason for the former is that we need to build and execute tools during the build process, both native tools and Java tools.</p>
<p>If all you want to do is to compile a 32-bit version, for the same OS, on a 64-bit machine, consider using <code>--with-target-bits=32</code> instead of doing a full-blown cross-compilation. (While this surely is possible, it's a lot more work and will take much longer to build.)</p>
+<h3 id="cross-compiling-the-easy-way-with-openjdk-devkits">Cross compiling the easy way with OpenJDK devkits</h3>
+<p>The OpenJDK build system provides out-of-the box support for creating and using so called devkits. A <code>devkit</code> is basically a collection of a cross-compiling toolchain and a sysroot environment which can easily be used together with the <code>--with-devkit</code> configure option to cross compile the OpenJDK. On Linux/x86_64, the following command:</p>
+<pre><code>bash configure --with-devkit=<devkit-path> --openjdk-target=ppc64-linux-gnu && make</code></pre>
+<p>will configure and build OpenJDK for Linux/ppc64 assuming that <code><devkit-path></code> points to a Linux/x86_64 to Linux/ppc64 devkit.</p>
+<p>Devkits can be created from the <code>make/devkit</code> directory by executing:</p>
+<pre><code>make [ TARGETS="<TARGET_TRIPLET>+" ] [ BASE_OS=<OS> ] [ BASE_OS_VERSION=<VER> ]</code></pre>
+<p>where <code>TARGETS</code> contains one or more <code>TARGET_TRIPLET</code>s of the form described in <a href="https://sourceware.org/autobook/autobook/autobook_17.html">section 3.4 of the GNU Autobook</a>. If no targets are given, a native toolchain for the current platform will be created. Currently, at least the following targets are known to work:</p>
+<table>
+<thead>
+<tr class="header">
+<th style="text-align: left;">Supported devkit targets</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td style="text-align: left;">x86_64-linux-gnu</td>
+</tr>
+<tr class="even">
+<td style="text-align: left;">aarch64-linux-gnu</td>
+</tr>
+<tr class="odd">
+<td style="text-align: left;">arm-linux-gnueabihf</td>
+</tr>
+<tr class="even">
+<td style="text-align: left;">ppc64-linux-gnu</td>
+</tr>
+<tr class="odd">
+<td style="text-align: left;">ppc64le-linux-gnu</td>
+</tr>
+<tr class="even">
+<td style="text-align: left;">s390x-linux-gnu</td>
+</tr>
+</tbody>
+</table>
+<p><code>BASE_OS</code> must be one of "OEL6" for Oracle Enterprise Linux 6 or "Fedora" (if not specified "OEL6" will be the default). If the base OS is "Fedora" the corresponding Fedora release can be specified with the help of the <code>BASE_OS_VERSION</code> option (with "27" as default version). If the build is successful, the new devkits can be found in the <code>build/devkit/result</code> subdirectory:</p>
+<pre><code>cd make/devkit
+make TARGETS="ppc64le-linux-gnu aarch64-linux-gnu" BASE_OS=Fedora BASE_OS_VERSION=21
+ls -1 ../../build/devkit/result/
+x86_64-linux-gnu-to-aarch64-linux-gnu
+x86_64-linux-gnu-to-ppc64le-linux-gnu</code></pre>
+<p>Notice that devkits are not only useful for targeting different build platforms. Because they contain the full build dependencies for a system (i.e. compiler and root file system), they can easily be used to build well-known, reliable and reproducible build environments. You can for example create and use a devkit with GCC 7.3 and a Fedora 12 sysroot environment (with glibc 2.11) on Ubuntu 14.04 (which doesn't have GCC 7.3 by default) to produce OpenJDK binaries which will run on all Linux systems with runtime libraries newer than the ones from Fedora 12 (e.g. Ubuntu 16.04, SLES 11 or RHEL 6).</p>
<h3 id="boot-jdk-and-build-jdk">Boot JDK and Build JDK</h3>
<p>When cross-compiling, make sure you use a boot JDK that runs on the <em>build</em> system, and not on the <em>target</em> system.</p>
<p>To be able to build, we need a "Build JDK", which is a JDK built from the current sources (that is, the same as the end result of the entire build process), but able to run on the <em>build</em> system, and not the <em>target</em> system. (In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when building JDK 9.)</p>
@@ -662,8 +704,8 @@
<th style="text-align: left;">Target</th>
<th style="text-align: left;"><code>CC</code></th>
<th style="text-align: left;"><code>CXX</code></th>
-<th><code>--arch=...</code></th>
-<th><code>--openjdk-target=...</code></th>
+<th style="text-align: left;"><code>--arch=...</code></th>
+<th style="text-align: left;"><code>--openjdk-target=...</code></th>
</tr>
</thead>
<tbody>
@@ -671,36 +713,36 @@
<td style="text-align: left;">x86</td>
<td style="text-align: left;">default</td>
<td style="text-align: left;">default</td>
-<td>i386</td>
-<td>i386-linux-gnu</td>
+<td style="text-align: left;">i386</td>
+<td style="text-align: left;">i386-linux-gnu</td>
</tr>
<tr class="even">
<td style="text-align: left;">armhf</td>
<td style="text-align: left;">gcc-arm-linux-gnueabihf</td>
<td style="text-align: left;">g++-arm-linux-gnueabihf</td>
-<td>armhf</td>
-<td>arm-linux-gnueabihf</td>
+<td style="text-align: left;">armhf</td>
+<td style="text-align: left;">arm-linux-gnueabihf</td>
</tr>
<tr class="odd">
<td style="text-align: left;">aarch64</td>
<td style="text-align: left;">gcc-aarch64-linux-gnu</td>
<td style="text-align: left;">g++-aarch64-linux-gnu</td>
-<td>arm64</td>
-<td>aarch64-linux-gnu</td>
+<td style="text-align: left;">arm64</td>
+<td style="text-align: left;">aarch64-linux-gnu</td>
</tr>
<tr class="even">
<td style="text-align: left;">ppc64el</td>
<td style="text-align: left;">gcc-powerpc64le-linux-gnu</td>
<td style="text-align: left;">g++-powerpc64le-linux-gnu</td>
-<td>ppc64el</td>
-<td>powerpc64le-linux-gnu</td>
+<td style="text-align: left;">ppc64el</td>
+<td style="text-align: left;">powerpc64le-linux-gnu</td>
</tr>
<tr class="odd">
<td style="text-align: left;">s390x</td>
<td style="text-align: left;">gcc-s390x-linux-gnu</td>
<td style="text-align: left;">g++-s390x-linux-gnu</td>
-<td>s390x</td>
-<td>s390x-linux-gnu</td>
+<td style="text-align: left;">s390x</td>
+<td style="text-align: left;">s390x-linux-gnu</td>
</tr>
</tbody>
</table>
@@ -813,7 +855,12 @@
spawn failed</code></pre>
<p>This can be a sign of a Cygwin problem. See the information about solving problems in the <a href="#cygwin">Cygwin</a> section. Rebooting the computer might help temporarily.</p>
<h3 id="getting-help">Getting Help</h3>
-<p>If none of the suggestions in this document helps you, or if you find what you believe is a bug in the build system, please contact the Build Group by sending a mail to <a href="mailto:build-dev@openjdk.java.net">build-dev@openjdk.java.net</a>. Please include the relevant parts of the configure and/or build log.</p>
+<p>If none of the suggestions in this document helps you, or if you find what you believe is a bug in the build system, please contact the Build Group by sending a mail to <script type="text/javascript">
+<!--
+h='openjdk.java.net';a='@';n='build-dev';e=n+a+h;
+document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'" clas'+'s="em' + 'ail">'+e+'<\/'+'a'+'>');
+// -->
+</script><noscript>build-dev at openjdk dot java dot net</noscript>. Please include the relevant parts of the configure and/or build log.</p>
<p>If you need general help or advice about developing for the JDK, you can also contact the Adoption Group. See the section on <a href="#contributing-to-openjdk">Contributing to OpenJDK</a> for more information.</p>
<h2 id="hints-and-suggestions-for-advanced-users">Hints and Suggestions for Advanced Users</h2>
<h3 id="setting-up-a-repository-for-pushing-changes-defpath">Setting Up a Repository for Pushing Changes (defpath)</h3>
--- a/doc/building.md Fri Nov 23 09:02:17 2018 -0500
+++ b/doc/building.md Fri Nov 23 09:12:00 2018 -0500
@@ -884,6 +884,64 @@
full-blown cross-compilation. (While this surely is possible, it's a lot more
work and will take much longer to build.)
+### Cross compiling the easy way with OpenJDK devkits
+
+The OpenJDK build system provides out-of-the box support for creating and using
+so called devkits. A `devkit` is basically a collection of a cross-compiling
+toolchain and a sysroot environment which can easily be used together with the
+`--with-devkit` configure option to cross compile the OpenJDK. On Linux/x86_64,
+the following command:
+```
+bash configure --with-devkit=<devkit-path> --openjdk-target=ppc64-linux-gnu && make
+```
+
+will configure and build OpenJDK for Linux/ppc64 assuming that `<devkit-path>`
+points to a Linux/x86_64 to Linux/ppc64 devkit.
+
+Devkits can be created from the `make/devkit` directory by executing:
+```
+make [ TARGETS="<TARGET_TRIPLET>+" ] [ BASE_OS=<OS> ] [ BASE_OS_VERSION=<VER> ]
+```
+
+where `TARGETS` contains one or more `TARGET_TRIPLET`s of the form
+described in [section 3.4 of the GNU Autobook](
+https://sourceware.org/autobook/autobook/autobook_17.html). If no
+targets are given, a native toolchain for the current platform will be
+created. Currently, at least the following targets are known to work:
+
+ Supported devkit targets
+ ------------------------
+ x86_64-linux-gnu
+ aarch64-linux-gnu
+ arm-linux-gnueabihf
+ ppc64-linux-gnu
+ ppc64le-linux-gnu
+ s390x-linux-gnu
+
+`BASE_OS` must be one of "OEL6" for Oracle Enterprise Linux 6 or
+"Fedora" (if not specified "OEL6" will be the default). If the base OS
+is "Fedora" the corresponding Fedora release can be specified with the
+help of the `BASE_OS_VERSION` option (with "27" as default version).
+If the build is successful, the new devkits can be found in the
+`build/devkit/result` subdirectory:
+```
+cd make/devkit
+make TARGETS="ppc64le-linux-gnu aarch64-linux-gnu" BASE_OS=Fedora BASE_OS_VERSION=21
+ls -1 ../../build/devkit/result/
+x86_64-linux-gnu-to-aarch64-linux-gnu
+x86_64-linux-gnu-to-ppc64le-linux-gnu
+```
+
+Notice that devkits are not only useful for targeting different build
+platforms. Because they contain the full build dependencies for a
+system (i.e. compiler and root file system), they can easily be used
+to build well-known, reliable and reproducible build environments. You
+can for example create and use a devkit with GCC 7.3 and a Fedora 12
+sysroot environment (with glibc 2.11) on Ubuntu 14.04 (which doesn't
+have GCC 7.3 by default) to produce OpenJDK binaries which will run on
+all Linux systems with runtime libraries newer than the ones from
+Fedora 12 (e.g. Ubuntu 16.04, SLES 11 or RHEL 6).
+
### Boot JDK and Build JDK
When cross-compiling, make sure you use a boot JDK that runs on the *build*
--- a/make/autoconf/help.m4 Fri Nov 23 09:02:17 2018 -0500
+++ b/make/autoconf/help.m4 Fri Nov 23 09:12:00 2018 -0500
@@ -102,7 +102,7 @@
ffi)
PKGHANDLER_COMMAND="sudo apt-get install libffi-dev" ;;
x11)
- PKGHANDLER_COMMAND="sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev" ;;
+ PKGHANDLER_COMMAND="sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev" ;;
ccache)
PKGHANDLER_COMMAND="sudo apt-get install ccache" ;;
dtrace)
@@ -125,7 +125,7 @@
freetype)
PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
x11)
- PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXi-devel" ;;
+ PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel" ;;
ccache)
PKGHANDLER_COMMAND="sudo yum install ccache" ;;
esac
--- a/make/autoconf/lib-x11.m4 Fri Nov 23 09:02:17 2018 -0500
+++ b/make/autoconf/lib-x11.m4 Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -99,8 +99,14 @@
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS"
+ HEADERS_TO_CHECK="X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h"
+ # There is no Xrandr extension on AIX
+ if test "x$OPENJDK_TARGET_OS" != xaix; then
+ HEADERS_TO_CHECK="$HEADERS_TO_CHECK X11/extensions/Xrandr.h"
+ fi
+
# Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10
- AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h],
+ AC_CHECK_HEADERS([$HEADERS_TO_CHECK],
[X11_HEADERS_OK=yes],
[X11_HEADERS_OK=no; break],
[
@@ -111,7 +117,7 @@
if test "x$X11_HEADERS_OK" = xno; then
HELP_MSG_MISSING_DEPENDENCY([x11])
- AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG])
+ AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h Xrander.h XTest.h Intrinsic.h). $HELP_MSG])
fi
# If XLinearGradient isn't available in Xrender.h, signal that it needs to be
--- a/make/devkit/Makefile Fri Nov 23 09:02:17 2018 -0500
+++ b/make/devkit/Makefile Fri Nov 23 09:12:00 2018 -0500
@@ -41,9 +41,12 @@
# To build the full set of crosstools for additional platforms, use a command
# line looking like this:
#
-# make cross_compile_target="aarch64-linux-gnu" BASE_OS=Fedora27
+# make TARGETS="aarch64-linux-gnu" BASE_OS=Fedora
# or
-# make cross_compile_target="arm-linux-gnueabihf" BASE_OS=Fedora27
+# make TARGETS="arm-linux-gnueabihf ppc64-linux-gnu" BASE_OS=Fedora BASE_OS_VERSION=17
+#
+# to build several devkits for a specific OS version at once.
+# You can find the final results under ../../build/devkit/result/<host>-to-<target>
#
# This is the makefile which iterates over all host and target platforms.
#
@@ -52,18 +55,18 @@
cpu := $(shell uname -p)
# Figure out what platform this is building on.
-me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu)
+me := $(cpu)-$(if $(findstring Linux,$(os)),linux-gnu)
$(info Building on platform $(me))
#
# By default just build for the current platform, which is assumed to be Linux
#
-ifeq ($(cross_compile_target), )
+ifeq ($(TARGETS), )
platforms := $(me)
host_platforms := $(platforms)
else
- platforms := $(cross_compile_target)
+ platforms := $(TARGETS)
host_platforms := $(me)
endif
target_platforms := $(platforms)
@@ -79,37 +82,37 @@
OUTPUT_ROOT = $(abspath ../../build/devkit)
RESULT = $(OUTPUT_ROOT)/result
-submakevars = HOST=$@ BUILD=$(me) \
- RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \
- OUTPUT_ROOT=$(OUTPUT_ROOT)
+submakevars = HOST=$@ BUILD=$(me) RESULT=$(RESULT) OUTPUT_ROOT=$(OUTPUT_ROOT)
+
$(host_platforms) :
@echo 'Building compilers for $@'
@echo 'Targets: $(target_platforms)'
for p in $(filter $@, $(target_platforms)) $(filter-out $@, $(target_platforms)); do \
- $(MAKE) -f Tools.gmk download-rpms $(submakevars) TARGET=$$p && \
+ $(MAKE) -f Tools.gmk download-rpms $(submakevars) \
+ TARGET=$$p PREFIX=$(RESULT)/$@-to-$$p && \
$(MAKE) -f Tools.gmk all $(submakevars) \
- TARGET=$$p || exit 1 ; \
+ TARGET=$$p PREFIX=$(RESULT)/$@-to-$$p && \
+ $(MAKE) -f Tools.gmk ccache $(submakevars) \
+ TARGET=$@ PREFIX=$(RESULT)/$@-to-$$p BUILDDIR=$(OUTPUT_ROOT)/$@/$$p || exit 1 ; \
done
- @echo 'Building ccache program for $@'
- $(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@
@echo 'All done"'
today := $(shell date +%Y%m%d)
define Mktar
- $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz
- $$($(1)_tar) : PLATFORM = $(1)
- TARFILES += $$($(1)_tar)
- $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1))
+ $(1)-to-$(2)_tar = $$(RESULT)/sdk-$(1)-to-$(2)-$$(today).tar.gz
+ $$($(1)-to-$(2)_tar) : PLATFORM = $(1)-to-$(2)
+ TARFILES += $$($(1)-to-$(2)_tar)
+ $$($(1)-to-$(2)_tar) : $$(shell find $$(RESULT)/$(1)-to-$(2) -type f)
endef
-$(foreach p,$(host_platforms),$(eval $(call Mktar,$(p))))
+$(foreach p,$(host_platforms),$(foreach t,$(target_platforms),$(eval $(call Mktar,$(p),$(t)))))
tars : all $(TARFILES)
onlytars : $(TARFILES)
%.tar.gz :
@echo 'Creating compiler package $@'
- cd $(RESULT)/$(PLATFORM) && tar -czf $@ *
+ cd $(RESULT) && tar -czf $@ $(PLATFORM)/*
touch $@
clean :
--- a/make/devkit/Tools.gmk Fri Nov 23 09:02:17 2018 -0500
+++ b/make/devkit/Tools.gmk Fri Nov 23 09:12:00 2018 -0500
@@ -52,16 +52,25 @@
$(info ARCH=$(ARCH))
ifeq ($(BASE_OS), OEL6)
- OEL_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/
+ BASE_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/
LINUX_VERSION := OEL6.4
-else ifeq ($(BASE_OS), Fedora27)
- ifeq ($(ARCH), aarch64)
- FEDORA_TYPE=fedora-secondary
+else ifeq ($(BASE_OS), Fedora)
+ DEFAULT_OS_VERSION := 27
+ ifeq ($(BASE_OS_VERSION), )
+ BASE_OS_VERSION := $(DEFAULT_OS_VERSION)
+ endif
+ ifeq ($(filter x86_64 armhfp, $(ARCH)), )
+ FEDORA_TYPE := fedora-secondary
else
- FEDORA_TYPE=fedora/linux
+ FEDORA_TYPE := fedora/linux
endif
- OEL_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/27/Everything/$(ARCH)/os/Packages/
- LINUX_VERSION := Fedora 27
+ ARCHIVED := $(shell [ $(BASE_OS_VERSION) -lt $(DEFAULT_OS_VERSION) ] && echo true)
+ ifeq ($(ARCHIVED),true)
+ BASE_URL := https://archives.fedoraproject.org/pub/archive/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
+ else
+ BASE_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
+ endif
+ LINUX_VERSION := Fedora_$(BASE_OS_VERSION)
else
$(error Unknown base OS $(BASE_OS))
endif
@@ -137,13 +146,11 @@
endif
# Define directories
-RESULT := $(OUTPUT_ROOT)/result
BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET)
-PREFIX := $(RESULT)/$(HOST)
TARGETDIR := $(PREFIX)/$(TARGET)
SYSROOT := $(TARGETDIR)/sysroot
DOWNLOAD := $(OUTPUT_ROOT)/download
-DOWNLOAD_RPMS := $(DOWNLOAD)/rpms
+DOWNLOAD_RPMS := $(DOWNLOAD)/rpms/$(TARGET)-$(LINUX_VERSION)
SRCDIR := $(OUTPUT_ROOT)/src
# Marker file for unpacking rpms
@@ -159,7 +166,7 @@
# Only run this if rpm dir is empty.
ifeq ($(wildcard $(DOWNLOAD_RPMS)/*.rpm), )
cd $(DOWNLOAD_RPMS) && \
- wget -r -np -nd $(patsubst %, -A "*%*.rpm", $(RPM_LIST)) $(OEL_URL)
+ wget -r -np -nd $(patsubst %, -A "*%*.rpm", $(RPM_LIST)) $(BASE_URL)
endif
##########################################################################################
@@ -190,8 +197,8 @@
##########################################################################################
# Unpack RPMS
+RPM_ARCHS := $(ARCH) noarch
ifeq ($(ARCH),x86_64)
- RPM_ARCHS := x86_64 noarch
ifeq ($(BUILD),$(HOST))
ifeq ($(TARGET),$(HOST))
# When building the native compiler for x86_64, enable mixed mode.
@@ -199,11 +206,9 @@
endif
endif
else ifeq ($(ARCH),i686)
- RPM_ARCHS := i386 i686 noarch
+ RPM_ARCHS += i386
else ifeq ($(ARCH), armhfp)
- RPM_ARCHS := $(ARCH) armv7hl noarch
-else
- RPM_ARCHS := $(ARCH) noarch
+ RPM_ARCHS += armv7hl
endif
RPM_FILE_LIST := $(sort $(foreach a, $(RPM_ARCHS), \
@@ -277,7 +282,7 @@
--host=$(HOST) --build=$(BUILD) \
--prefix=$(PREFIX)
-PATHEXT = $(RESULT)/$(BUILD)/bin:
+PATHEXT = $(PREFIX)/bin:
PATHPRE = PATH=$(PATHEXT)$(PATH)
NUM_CORES := $(shell cat /proc/cpuinfo | grep -c processor)
@@ -427,6 +432,11 @@
$(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --with-float=hard
endif
+ifneq ($(filter ppc64 ppc64le s390x, $(ARCH)), )
+ # We only support 64-bit on these platforms anyway
+ CONFIG += --disable-multilib
+endif
+
# Want:
# c,c++
# shared libs
@@ -552,7 +562,7 @@
##########################################################################################
-$(PREFIX)/devkit.info: FRC
+$(PREFIX)/devkit.info:
@echo 'Creating devkit.info in the root of the kit'
rm -f $@
touch $@
@@ -611,7 +621,4 @@
# this is only built for host. so separate.
ccache : $(ccache)
-# Force target
-FRC:
-
.PHONY : gcc all binutils bfdlib link_libs rpms libs sysroot
--- a/src/hotspot/cpu/ppc/assembler_ppc.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/cpu/ppc/assembler_ppc.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -397,6 +397,7 @@
LWAX_OPCODE = (31u << OPCODE_SHIFT | 341u << XO_21_30_SHIFT), // X-FORM
CNTLZW_OPCODE = (31u << OPCODE_SHIFT | 26u << XO_21_30_SHIFT), // X-FORM
+ CNTTZW_OPCODE = (31u << OPCODE_SHIFT | 538u << XO_21_30_SHIFT), // X-FORM
// 64 bit opcode encodings
@@ -428,6 +429,7 @@
DIVD_OPCODE = (31u << OPCODE_SHIFT | 489u << 1), // XO-FORM
CNTLZD_OPCODE = (31u << OPCODE_SHIFT | 58u << XO_21_30_SHIFT), // X-FORM
+ CNTTZD_OPCODE = (31u << OPCODE_SHIFT | 570u << XO_21_30_SHIFT), // X-FORM
NAND_OPCODE = (31u << OPCODE_SHIFT | 476u << XO_21_30_SHIFT), // X-FORM
NOR_OPCODE = (31u << OPCODE_SHIFT | 124u << XO_21_30_SHIFT), // X-FORM
@@ -1500,6 +1502,10 @@
inline void cntlzw_( Register a, Register s);
inline void cntlzd( Register a, Register s);
inline void cntlzd_( Register a, Register s);
+ inline void cnttzw( Register a, Register s);
+ inline void cnttzw_( Register a, Register s);
+ inline void cnttzd( Register a, Register s);
+ inline void cnttzd_( Register a, Register s);
// PPC 1, section 3.3.12, Fixed-Point Rotate and Shift Instructions
inline void sld( Register a, Register s, Register b);
--- a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -235,6 +235,10 @@
inline void Assembler::cntlzw_( Register a, Register s) { emit_int32(CNTLZW_OPCODE | rta(a) | rs(s) | rc(1)); }
inline void Assembler::cntlzd( Register a, Register s) { emit_int32(CNTLZD_OPCODE | rta(a) | rs(s) | rc(0)); }
inline void Assembler::cntlzd_( Register a, Register s) { emit_int32(CNTLZD_OPCODE | rta(a) | rs(s) | rc(1)); }
+inline void Assembler::cnttzw( Register a, Register s) { emit_int32(CNTTZW_OPCODE | rta(a) | rs(s) | rc(0)); }
+inline void Assembler::cnttzw_( Register a, Register s) { emit_int32(CNTTZW_OPCODE | rta(a) | rs(s) | rc(1)); }
+inline void Assembler::cnttzd( Register a, Register s) { emit_int32(CNTTZD_OPCODE | rta(a) | rs(s) | rc(0)); }
+inline void Assembler::cnttzd_( Register a, Register s) { emit_int32(CNTTZD_OPCODE | rta(a) | rs(s) | rc(1)); }
// PPC 1, section 3.3.12, Fixed-Point Rotate and Shift Instructions
inline void Assembler::sld( Register a, Register s, Register b) { emit_int32(SLD_OPCODE | rta(a) | rs(s) | rb(b) | rc(0)); }
--- a/src/hotspot/cpu/ppc/globals_ppc.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/cpu/ppc/globals_ppc.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -126,6 +126,9 @@
product(bool, UseCountLeadingZerosInstructionsPPC64, true, \
"Use count leading zeros instructions.") \
\
+ product(bool, UseCountTrailingZerosInstructionsPPC64, false, \
+ "Use count trailing zeros instructions.") \
+ \
product(bool, UseExtendedLoadAndReserveInstructionsPPC64, false, \
"Use extended versions of load-and-reserve instructions.") \
\
--- a/src/hotspot/cpu/ppc/ppc.ad Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/cpu/ppc/ppc.ad Fri Nov 23 09:12:00 2018 -0500
@@ -1,6 +1,6 @@
//
-// Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
-// Copyright (c) 2012, 2017 SAP SE. All rights reserved.
+// Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2012, 2018 SAP SE. 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
@@ -2209,9 +2209,13 @@
return VM_Version::has_fsqrt();
case Op_CountLeadingZerosI:
case Op_CountLeadingZerosL:
+ if (!UseCountLeadingZerosInstructionsPPC64)
+ return false;
+ break;
case Op_CountTrailingZerosI:
case Op_CountTrailingZerosL:
- if (!UseCountLeadingZerosInstructionsPPC64)
+ if (!UseCountLeadingZerosInstructionsPPC64 &&
+ !UseCountTrailingZerosInstructionsPPC64)
return false;
break;
@@ -13425,7 +13429,7 @@
instruct countTrailingZerosI_Ex(iRegIdst dst, iRegIsrc src) %{
match(Set dst (CountTrailingZerosI src));
- predicate(UseCountLeadingZerosInstructionsPPC64);
+ predicate(UseCountLeadingZerosInstructionsPPC64 && !UseCountTrailingZerosInstructionsPPC64);
ins_cost(DEFAULT_COST);
expand %{
@@ -13442,9 +13446,22 @@
%}
%}
+instruct countTrailingZerosI_cnttzw(iRegIdst dst, iRegIsrc src) %{
+ match(Set dst (CountTrailingZerosI src));
+ predicate(UseCountTrailingZerosInstructionsPPC64);
+ ins_cost(DEFAULT_COST);
+
+ format %{ "CNTTZW $dst, $src" %}
+ size(4);
+ ins_encode %{
+ __ cnttzw($dst$$Register, $src$$Register);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
instruct countTrailingZerosL_Ex(iRegIdst dst, iRegLsrc src) %{
match(Set dst (CountTrailingZerosL src));
- predicate(UseCountLeadingZerosInstructionsPPC64);
+ predicate(UseCountLeadingZerosInstructionsPPC64 && !UseCountTrailingZerosInstructionsPPC64);
ins_cost(DEFAULT_COST);
expand %{
@@ -13460,6 +13477,19 @@
%}
%}
+instruct countTrailingZerosL_cnttzd(iRegIdst dst, iRegLsrc src) %{
+ match(Set dst (CountTrailingZerosL src));
+ predicate(UseCountTrailingZerosInstructionsPPC64);
+ ins_cost(DEFAULT_COST);
+
+ format %{ "CNTTZD $dst, $src" %}
+ size(4);
+ ins_encode %{
+ __ cnttzd($dst$$Register, $src$$Register);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
// Expand nodes for byte_reverse_int.
instruct insrwi_a(iRegIdst dst, iRegIsrc src, immI16 pos, immI16 shift) %{
effect(DEF dst, USE src, USE pos, USE shift);
--- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -129,6 +129,17 @@
}
}
MaxVectorSize = SuperwordUseVSX ? 16 : 8;
+
+ if (PowerArchitecturePPC64 >= 9) {
+ if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstructionsPPC64)) {
+ FLAG_SET_ERGO(bool, UseCountTrailingZerosInstructionsPPC64, true);
+ }
+ } else {
+ if (UseCountTrailingZerosInstructionsPPC64) {
+ warning("UseCountTrailingZerosInstructionsPPC64 specified, but needs at least Power9.");
+ FLAG_SET_DEFAULT(UseCountTrailingZerosInstructionsPPC64, false);
+ }
+ }
#endif
// Create and print feature-string.
--- a/src/hotspot/share/aot/aotCompiledMethod.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/aot/aotCompiledMethod.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -176,6 +176,8 @@
virtual bool is_alive() const { return _is_alive(); }
virtual bool is_in_use() const { return state() == in_use; }
+ virtual bool is_unloading() { return false; }
+
address exception_begin() const { return (address) _code + _meta->exception_handler_offset(); }
virtual const char* name() const { return _name; }
--- a/src/hotspot/share/code/codeCache.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/code/codeCache.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -657,7 +657,7 @@
void CodeCache::nmethods_do(void f(nmethod* nm)) {
assert_locked_or_safepoint(CodeCache_lock);
- NMethodIterator iter;
+ NMethodIterator iter(NMethodIterator::all_blobs);
while(iter.next()) {
f(iter.method());
}
@@ -665,8 +665,8 @@
void CodeCache::metadata_do(void f(Metadata* m)) {
assert_locked_or_safepoint(CodeCache_lock);
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
iter.method()->metadata_do(f);
}
AOTLoader::metadata_do(f);
@@ -684,8 +684,8 @@
void CodeCache::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) {
assert_locked_or_safepoint(CodeCache_lock);
UnloadingScope scope(is_alive);
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive);
+ while(iter.next()) {
iter.method()->do_unloading(unloading_occurred);
}
}
@@ -842,8 +842,8 @@
// Temporarily mark nmethods that are claimed to be on the scavenge list.
void CodeCache::mark_scavenge_root_nmethods() {
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive);
+ while(iter.next()) {
nmethod* nm = iter.method();
assert(nm->scavenge_root_not_marked(), "clean state");
if (nm->on_scavenge_root_list())
@@ -854,8 +854,8 @@
// If the closure is given, run it on the unlisted nmethods.
// Also make sure that the effects of mark_scavenge_root_nmethods is gone.
void CodeCache::verify_perm_nmethods(CodeBlobClosure* f_or_null) {
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive);
+ while(iter.next()) {
nmethod* nm = iter.method();
bool call_f = (f_or_null != NULL);
assert(nm->scavenge_root_not_marked(), "must be already processed");
@@ -869,8 +869,8 @@
void CodeCache::verify_clean_inline_caches() {
#ifdef ASSERT
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
nmethod* nm = iter.method();
assert(!nm->is_unloaded(), "Tautology");
nm->verify_clean_inline_caches();
@@ -943,8 +943,8 @@
void CodeCache::verify_oops() {
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
VerifyOopClosure voc;
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
nmethod* nm = iter.method();
nm->oops_do(&voc);
nm->verify_oop_relocations();
@@ -1120,16 +1120,16 @@
void CodeCache::clear_inline_caches() {
assert_locked_or_safepoint(CodeCache_lock);
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
iter.method()->clear_inline_caches();
}
}
void CodeCache::cleanup_inline_caches() {
assert_locked_or_safepoint(CodeCache_lock);
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
iter.method()->cleanup_inline_caches(/*clean_all=*/true);
}
}
@@ -1199,8 +1199,8 @@
}
}
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
CompiledMethod* nm = iter.method();
if (nm->is_marked_for_deoptimization()) {
// ...Already marked in the previous pass; don't count it again.
@@ -1222,8 +1222,8 @@
// Deoptimize all methods
void CodeCache::mark_all_nmethods_for_deoptimization() {
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
CompiledMethod* nm = iter.method();
if (!nm->method()->is_method_handle_intrinsic()) {
nm->mark_for_deoptimization();
@@ -1235,8 +1235,8 @@
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
int number_of_marked_CodeBlobs = 0;
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
CompiledMethod* nm = iter.method();
if (nm->is_dependent_on_method(dependee)) {
ResourceMark rm;
@@ -1250,8 +1250,8 @@
void CodeCache::make_marked_nmethods_not_entrant() {
assert_locked_or_safepoint(CodeCache_lock);
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
CompiledMethod* nm = iter.method();
if (nm->is_marked_for_deoptimization() && !nm->is_not_entrant()) {
nm->make_not_entrant();
@@ -1519,7 +1519,7 @@
int *buckets = NEW_C_HEAP_ARRAY(int, bucketLimit, mtCode);
memset(buckets, 0, sizeof(int) * bucketLimit);
- NMethodIterator iter;
+ NMethodIterator iter(NMethodIterator::all_blobs);
while(iter.next()) {
nmethod* nm = iter.method();
if(nm->method() != NULL && nm->is_java_method()) {
@@ -1659,8 +1659,8 @@
void CodeCache::print_codelist(outputStream* st) {
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- CompiledMethodIterator iter;
- while (iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while (iter.next()) {
CompiledMethod* cm = iter.method();
ResourceMark rm;
char* method_name = cm->method()->name_and_sig_as_C_string();
--- a/src/hotspot/share/code/codeCache.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/code/codeCache.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -334,13 +334,21 @@
// Iterator to iterate over nmethods in the CodeCache.
template <class T, class Filter> class CodeBlobIterator : public StackObj {
+ public:
+ enum LivenessFilter { all_blobs, only_alive, only_alive_and_not_unloading };
+
private:
CodeBlob* _code_blob; // Current CodeBlob
GrowableArrayIterator<CodeHeap*> _heap;
GrowableArrayIterator<CodeHeap*> _end;
+ bool _only_alive;
+ bool _only_not_unloading;
public:
- CodeBlobIterator(T* nm = NULL) {
+ CodeBlobIterator(LivenessFilter filter, T* nm = NULL)
+ : _only_alive(filter == only_alive || filter == only_alive_and_not_unloading),
+ _only_not_unloading(filter == only_alive_and_not_unloading)
+ {
if (Filter::heaps() == NULL) {
return;
}
@@ -360,29 +368,35 @@
bool next() {
assert_locked_or_safepoint(CodeCache_lock);
- bool result = next_blob();
- while (!result && _heap != _end) {
- // Advance to next code heap of segmented code cache
- if (++_heap == _end) {
- break;
+ for (;;) {
+ // Walk through heaps as required
+ if (!next_blob()) {
+ if (_heap == _end) {
+ return false;
+ }
+ ++_heap;
+ continue;
}
- result = next_blob();
+
+ // Filter is_alive as required
+ if (_only_alive && !_code_blob->is_alive()) {
+ continue;
+ }
+
+ // Filter is_unloading as required
+ if (_only_not_unloading) {
+ CompiledMethod* cm = _code_blob->as_compiled_method_or_null();
+ if (cm != NULL && cm->is_unloading()) {
+ continue;
+ }
+ }
+
+ return true;
}
-
- return result;
}
- // Advance iterator to next alive blob
- bool next_alive() {
- bool result = next();
- while(result && !_code_blob->is_alive()) {
- result = next();
- }
- return result;
- }
-
- bool end() const { return _code_blob == NULL; }
- T* method() const { return (T*)_code_blob; }
+ bool end() const { return _code_blob == NULL; }
+ T* method() const { return (T*)_code_blob; }
private:
@@ -422,7 +436,6 @@
static const GrowableArray<CodeHeap*>* heaps() { return CodeCache::nmethod_heaps(); }
};
-
typedef CodeBlobIterator<CompiledMethod, CompiledMethodFilter> CompiledMethodIterator;
typedef CodeBlobIterator<nmethod, NMethodFilter> NMethodIterator;
--- a/src/hotspot/share/code/compiledMethod.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/code/compiledMethod.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -44,11 +44,10 @@
bool caller_must_gc_arguments)
: CodeBlob(name, type, layout, frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments),
_mark_for_deoptimization_status(not_marked),
- _is_unloading_state(0),
- _method(method)
+ _method(method),
+ _gc_data(NULL)
{
init_defaults();
- clear_unloading_state();
}
CompiledMethod::CompiledMethod(Method* method, const char* name, CompilerType type, int size,
@@ -57,11 +56,10 @@
: CodeBlob(name, type, CodeBlobLayout((address) this, size, header_size, cb), cb,
frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments),
_mark_for_deoptimization_status(not_marked),
- _is_unloading_state(0),
- _method(method)
+ _method(method),
+ _gc_data(NULL)
{
init_defaults();
- clear_unloading_state();
}
void CompiledMethod::init_defaults() {
@@ -546,74 +544,6 @@
DEBUG_ONLY(metadata_do(check_class));
}
-// The _is_unloading_state encodes a tuple comprising the unloading cycle
-// and the result of IsUnloadingBehaviour::is_unloading() fpr that cycle.
-// This is the bit layout of the _is_unloading_state byte: 00000CCU
-// CC refers to the cycle, which has 2 bits, and U refers to the result of
-// IsUnloadingBehaviour::is_unloading() for that unloading cycle.
-
-class IsUnloadingState: public AllStatic {
- static const uint8_t _is_unloading_mask = 1;
- static const uint8_t _is_unloading_shift = 0;
- static const uint8_t _unloading_cycle_mask = 6;
- static const uint8_t _unloading_cycle_shift = 1;
-
- static uint8_t set_is_unloading(uint8_t state, bool value) {
- state &= ~_is_unloading_mask;
- if (value) {
- state |= 1 << _is_unloading_shift;
- }
- assert(is_unloading(state) == value, "unexpected unloading cycle overflow");
- return state;
- }
-
- static uint8_t set_unloading_cycle(uint8_t state, uint8_t value) {
- state &= ~_unloading_cycle_mask;
- state |= value << _unloading_cycle_shift;
- assert(unloading_cycle(state) == value, "unexpected unloading cycle overflow");
- return state;
- }
-
-public:
- static bool is_unloading(uint8_t state) { return (state & _is_unloading_mask) >> _is_unloading_shift == 1; }
- static uint8_t unloading_cycle(uint8_t state) { return (state & _unloading_cycle_mask) >> _unloading_cycle_shift; }
-
- static uint8_t create(bool is_unloading, uint8_t unloading_cycle) {
- uint8_t state = 0;
- state = set_is_unloading(state, is_unloading);
- state = set_unloading_cycle(state, unloading_cycle);
- return state;
- }
-};
-
-bool CompiledMethod::is_unloading() {
- uint8_t state = RawAccess<MO_RELAXED>::load(&_is_unloading_state);
- bool state_is_unloading = IsUnloadingState::is_unloading(state);
- uint8_t state_unloading_cycle = IsUnloadingState::unloading_cycle(state);
- if (state_is_unloading) {
- return true;
- }
- if (state_unloading_cycle == CodeCache::unloading_cycle()) {
- return false;
- }
-
- // The IsUnloadingBehaviour is responsible for checking if there are any dead
- // oops in the CompiledMethod, by calling oops_do on it.
- state_unloading_cycle = CodeCache::unloading_cycle();
- state_is_unloading = IsUnloadingBehaviour::current()->is_unloading(this);
-
- state = IsUnloadingState::create(state_is_unloading, state_unloading_cycle);
-
- RawAccess<MO_RELAXED>::store(&_is_unloading_state, state);
-
- return state_is_unloading;
-}
-
-void CompiledMethod::clear_unloading_state() {
- uint8_t state = IsUnloadingState::create(false, CodeCache::unloading_cycle());
- RawAccess<MO_RELAXED>::store(&_is_unloading_state, state);
-}
-
// Called to clean up after class unloading for live nmethods and from the sweeper
// for all methods.
void CompiledMethod::cleanup_inline_caches_impl(bool unloading_occurred, bool clean_all) {
--- a/src/hotspot/share/code/compiledMethod.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/code/compiledMethod.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -151,8 +151,6 @@
bool _is_far_code; // Code is far from CodeCache.
// Have to use far call instructions to call it from code in CodeCache.
- volatile uint8_t _is_unloading_state; // Local state used to keep track of whether unloading is happening or not
-
// set during construction
unsigned int _has_unsafe_access:1; // May fault due to unsafe access.
unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes?
@@ -171,6 +169,8 @@
PcDescContainer _pc_desc_container;
ExceptionCache * volatile _exception_cache;
+ void* _gc_data;
+
virtual void flush() = 0;
protected:
CompiledMethod(Method* method, const char* name, CompilerType type, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments);
@@ -179,6 +179,11 @@
public:
virtual bool is_compiled() const { return true; }
+ template<typename T>
+ T* gc_data() const { return reinterpret_cast<T*>(_gc_data); }
+ template<typename T>
+ void set_gc_data(T* gc_data) { _gc_data = reinterpret_cast<void*>(gc_data); }
+
bool has_unsafe_access() const { return _has_unsafe_access; }
void set_has_unsafe_access(bool z) { _has_unsafe_access = z; }
@@ -390,10 +395,9 @@
// GC unloading support
// Cleans unloaded klasses and unloaded nmethods in inline caches
- bool is_unloading();
+ virtual bool is_unloading() = 0;
void unload_nmethod_caches(bool class_unloading_occurred);
- void clear_unloading_state();
virtual void do_unloading(bool unloading_occurred) { }
private:
--- a/src/hotspot/share/code/dependencyContext.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/code/dependencyContext.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -118,13 +118,13 @@
// Safepoints are forbidden during DC lifetime. GC can invalidate
// _dependency_context_addr if it relocates the holder
// (e.g. CallSiteContext Java object).
- int _safepoint_counter;
+ uint64_t _safepoint_counter;
DependencyContext(intptr_t* addr) : _dependency_context_addr(addr),
- _safepoint_counter(SafepointSynchronize::_safepoint_counter) {}
+ _safepoint_counter(SafepointSynchronize::safepoint_counter()) {}
~DependencyContext() {
- assert(_safepoint_counter == SafepointSynchronize::_safepoint_counter, "safepoint happened");
+ assert(_safepoint_counter == SafepointSynchronize::safepoint_counter(), "safepoint happened");
}
#else
DependencyContext(intptr_t* addr) : _dependency_context_addr(addr) {}
--- a/src/hotspot/share/code/nmethod.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/code/nmethod.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -565,6 +565,7 @@
ByteSize basic_lock_sp_offset,
OopMapSet* oop_maps )
: CompiledMethod(method, "native nmethod", type, nmethod_size, sizeof(nmethod), code_buffer, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false),
+ _is_unloading_state(0),
_native_receiver_sp_offset(basic_lock_owner_sp_offset),
_native_basic_lock_sp_offset(basic_lock_sp_offset)
{
@@ -609,6 +610,7 @@
code_buffer->copy_code_and_locs_to(this);
code_buffer->copy_values_to(this);
+ clear_unloading_state();
if (ScavengeRootsInCode) {
Universe::heap()->register_nmethod(this);
}
@@ -672,6 +674,7 @@
#endif
)
: CompiledMethod(method, "nmethod", type, nmethod_size, sizeof(nmethod), code_buffer, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false),
+ _is_unloading_state(0),
_native_receiver_sp_offset(in_ByteSize(-1)),
_native_basic_lock_sp_offset(in_ByteSize(-1))
{
@@ -1016,13 +1019,20 @@
// there are no activations on the stack, not in use by the VM,
// and not in use by the ServiceThread)
bool nmethod::can_convert_to_zombie() {
- assert(is_not_entrant(), "must be a non-entrant method");
+ // Note that this is called when the sweeper has observed the nmethod to be
+ // not_entrant. However, with concurrent code cache unloading, the state
+ // might have moved on to unloaded if it is_unloading(), due to racing
+ // concurrent GC threads.
+ assert(is_not_entrant() || is_unloading(), "must be a non-entrant method");
// Since the nmethod sweeper only does partial sweep the sweeper's traversal
// count can be greater than the stack traversal count before it hits the
// nmethod for the second time.
- return stack_traversal_mark()+1 < NMethodSweeper::traversal_count() &&
- !is_locked_by_vm();
+ // If an is_unloading() nmethod is still not_entrant, then it is not safe to
+ // convert it to zombie due to GC unloading interactions. However, if it
+ // has become unloaded, then it is okay to convert such nmethods to zombie.
+ return stack_traversal_mark() + 1 < NMethodSweeper::traversal_count() &&
+ !is_locked_by_vm() && (!is_unloading() || is_unloaded());
}
void nmethod::inc_decompile_count() {
@@ -1090,8 +1100,6 @@
// Unregister must be done before the state change
Universe::heap()->unregister_nmethod(this);
- _state = unloaded;
-
// Log the unloading.
log_state_change();
@@ -1107,6 +1115,13 @@
set_osr_link(NULL);
NMethodSweeper::report_state_change(this);
+
+ // The release is only needed for compile-time ordering, as accesses
+ // into the nmethod after the store are not safe due to the sweeper
+ // being allowed to free it when the store is observed, during
+ // concurrent nmethod unloading. Therefore, there is no need for
+ // acquire on the loader side.
+ OrderAccess::release_store(&_state, (signed char)unloaded);
}
void nmethod::invalidate_osr_method() {
@@ -1505,6 +1520,74 @@
if (_method != NULL) f(_method);
}
+// The _is_unloading_state encodes a tuple comprising the unloading cycle
+// and the result of IsUnloadingBehaviour::is_unloading() fpr that cycle.
+// This is the bit layout of the _is_unloading_state byte: 00000CCU
+// CC refers to the cycle, which has 2 bits, and U refers to the result of
+// IsUnloadingBehaviour::is_unloading() for that unloading cycle.
+
+class IsUnloadingState: public AllStatic {
+ static const uint8_t _is_unloading_mask = 1;
+ static const uint8_t _is_unloading_shift = 0;
+ static const uint8_t _unloading_cycle_mask = 6;
+ static const uint8_t _unloading_cycle_shift = 1;
+
+ static uint8_t set_is_unloading(uint8_t state, bool value) {
+ state &= ~_is_unloading_mask;
+ if (value) {
+ state |= 1 << _is_unloading_shift;
+ }
+ assert(is_unloading(state) == value, "unexpected unloading cycle overflow");
+ return state;
+ }
+
+ static uint8_t set_unloading_cycle(uint8_t state, uint8_t value) {
+ state &= ~_unloading_cycle_mask;
+ state |= value << _unloading_cycle_shift;
+ assert(unloading_cycle(state) == value, "unexpected unloading cycle overflow");
+ return state;
+ }
+
+public:
+ static bool is_unloading(uint8_t state) { return (state & _is_unloading_mask) >> _is_unloading_shift == 1; }
+ static uint8_t unloading_cycle(uint8_t state) { return (state & _unloading_cycle_mask) >> _unloading_cycle_shift; }
+
+ static uint8_t create(bool is_unloading, uint8_t unloading_cycle) {
+ uint8_t state = 0;
+ state = set_is_unloading(state, is_unloading);
+ state = set_unloading_cycle(state, unloading_cycle);
+ return state;
+ }
+};
+
+bool nmethod::is_unloading() {
+ uint8_t state = RawAccess<MO_RELAXED>::load(&_is_unloading_state);
+ bool state_is_unloading = IsUnloadingState::is_unloading(state);
+ uint8_t state_unloading_cycle = IsUnloadingState::unloading_cycle(state);
+ if (state_is_unloading) {
+ return true;
+ }
+ if (state_unloading_cycle == CodeCache::unloading_cycle()) {
+ return false;
+ }
+
+ // The IsUnloadingBehaviour is responsible for checking if there are any dead
+ // oops in the CompiledMethod, by calling oops_do on it.
+ state_unloading_cycle = CodeCache::unloading_cycle();
+ state_is_unloading = IsUnloadingBehaviour::current()->is_unloading(this);
+
+ state = IsUnloadingState::create(state_is_unloading, state_unloading_cycle);
+
+ RawAccess<MO_RELAXED>::store(&_is_unloading_state, state);
+
+ return state_is_unloading;
+}
+
+void nmethod::clear_unloading_state() {
+ uint8_t state = IsUnloadingState::create(false, CodeCache::unloading_cycle());
+ RawAccess<MO_RELAXED>::store(&_is_unloading_state, state);
+}
+
// This is called at the end of the strong tracing/marking phase of a
// GC to unload an nmethod if it contains otherwise unreachable
@@ -1842,11 +1925,11 @@
// Iterate over live nmethods and check dependencies of all nmethods that are not
// marked for deoptimization. A particular dependency is only checked once.
- NMethodIterator iter;
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
while(iter.next()) {
nmethod* nm = iter.method();
// Only notify for live nmethods
- if (nm->is_alive() && !nm->is_marked_for_deoptimization()) {
+ if (!nm->is_marked_for_deoptimization()) {
for (Dependencies::DepStream deps(nm); deps.next(); ) {
// Construct abstraction of a dependency.
DependencySignature* current_sig = new DependencySignature(deps);
@@ -2841,7 +2924,7 @@
// Update the values in the InstalledCode instance if it still refers to this nmethod
nmethod* nm = (nmethod*)InstalledCode::address(installed_code);
if (nm == this) {
- if (!is_alive()) {
+ if (!is_alive() || is_unloading()) {
// Break the link between nmethod and InstalledCode such that the nmethod
// can subsequently be flushed safely. The link must be maintained while
// the method could have live activations since invalidateInstalledCode
@@ -2856,7 +2939,7 @@
}
}
}
- if (!is_alive()) {
+ if (!is_alive() || is_unloading()) {
// Clear these out after the nmethod has been unregistered and any
// updates to the InstalledCode instance have been performed.
clear_jvmci_installed_code();
@@ -2880,7 +2963,7 @@
{
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
// This relationship can only be checked safely under a lock
- assert(!nm->is_alive() || nm->jvmci_installed_code() == installedCode(), "sanity check");
+ assert(!nm->is_alive() || nm->is_unloading() || nm->jvmci_installed_code() == installedCode(), "sanity check");
}
#endif
--- a/src/hotspot/share/code/nmethod.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/code/nmethod.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -158,6 +158,9 @@
// counter is decreased (by 1) while sweeping.
int _hotness_counter;
+ // Local state used to keep track of whether unloading is happening or not
+ volatile uint8_t _is_unloading_state;
+
// These are used for compiled synchronized native methods to
// locate the owner and stack slot for the BasicLock so that we can
// properly revoke the bias of the owner if necessary. They are
@@ -323,6 +326,8 @@
bool is_zombie() const { return _state == zombie; }
bool is_unloaded() const { return _state == unloaded; }
+ void clear_unloading_state();
+ virtual bool is_unloading();
virtual void do_unloading(bool unloading_occurred);
#if INCLUDE_RTM_OPT
--- a/src/hotspot/share/gc/g1/g1Allocator.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1Allocator.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -262,8 +262,9 @@
// Create the _archive_region_map which is used to identify archive objects.
static inline void enable_archive_object_check();
- // Set the regions containing the specified address range as archive/non-archive.
+ // Mark regions containing the specified address range as archive/non-archive.
static inline void set_range_archive(MemRegion range, bool open);
+ static inline void clear_range_archive(MemRegion range, bool open);
// Check if the object is in closed archive
static inline bool is_closed_archive_object(oop object);
--- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -109,6 +109,10 @@
// Set the regions containing the specified address range as archive.
inline void G1ArchiveAllocator::set_range_archive(MemRegion range, bool open) {
assert(_archive_check_enabled, "archive range check not enabled");
+ log_info(gc, cds)("Mark %s archive regions in map: [" PTR_FORMAT ", " PTR_FORMAT "]",
+ open ? "open" : "closed",
+ p2i(range.start()),
+ p2i(range.last()));
if (open) {
_open_archive_region_map.set_by_address(range, true);
} else {
@@ -116,6 +120,20 @@
}
}
+// Clear the archive regions map containing the specified address range.
+inline void G1ArchiveAllocator::clear_range_archive(MemRegion range, bool open) {
+ assert(_archive_check_enabled, "archive range check not enabled");
+ log_info(gc, cds)("Clear %s archive regions in map: [" PTR_FORMAT ", " PTR_FORMAT "]",
+ open ? "open" : "closed",
+ p2i(range.start()),
+ p2i(range.last()));
+ if (open) {
+ _open_archive_region_map.set_by_address(range, false);
+ } else {
+ _closed_archive_region_map.set_by_address(range, false);
+ }
+}
+
// Check if an object is in a closed archive region using the _archive_region_map.
inline bool G1ArchiveAllocator::in_closed_archive_range(oop object) {
// This is the out-of-line part of is_closed_archive_object test, done separately
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -753,7 +753,7 @@
return result;
}
-void G1CollectedHeap::dealloc_archive_regions(MemRegion* ranges, size_t count) {
+void G1CollectedHeap::dealloc_archive_regions(MemRegion* ranges, size_t count, bool is_open) {
assert(!is_init_completed(), "Expect to be called at JVM init time");
assert(ranges != NULL, "MemRegion array NULL");
assert(count != 0, "No MemRegions provided");
@@ -815,7 +815,7 @@
}
// Notify mark-sweep that this is no longer an archive range.
- G1ArchiveAllocator::set_range_archive(ranges[i], false);
+ G1ArchiveAllocator::clear_range_archive(ranges[i], is_open);
}
if (uncommitted_regions != 0) {
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -683,7 +683,7 @@
// which had been allocated by alloc_archive_regions. This should be called
// rather than fill_archive_regions at JVM init time if the archive file
// mapping failed, with the same non-overlapping and sorted MemRegion array.
- void dealloc_archive_regions(MemRegion* range, size_t count);
+ void dealloc_archive_regions(MemRegion* range, size_t count, bool is_open);
oop materialize_archived_object(oop obj);
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "code/nmethod.hpp"
#include "gc/g1/g1Allocator.inline.hpp"
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/g1ConcurrentMarkThread.hpp"
--- a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -232,14 +232,19 @@
char* volatile _cur_addr;
char* const _start_addr;
char* const _end_addr;
- size_t const _page_size;
+ size_t _page_size;
public:
G1PretouchTask(char* start_address, char* end_address, size_t page_size) :
AbstractGangTask("G1 PreTouch"),
_cur_addr(start_address),
_start_addr(start_address),
_end_addr(end_address),
- _page_size(page_size) {
+ _page_size(0) {
+#ifdef LINUX
+ _page_size = UseTransparentHugePages ? (size_t)os::vm_page_size(): page_size;
+#else
+ _page_size = page_size;
+#endif
}
virtual void work(uint worker_id) {
--- a/src/hotspot/share/gc/g1/g1_globals.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1_globals.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -190,9 +190,6 @@
"to minimize the probability of promotion failure.") \
range(0, 50) \
\
- develop(bool, G1HRRSUseSparseTable, true, \
- "When true, use sparse table to save space.") \
- \
product(size_t, G1HeapRegionSize, 0, \
"Size of the G1 regions.") \
range(0, 32*M) \
--- a/src/hotspot/share/gc/g1/heapRegionRemSet.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/g1/heapRegionRemSet.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -368,8 +368,7 @@
CardIdx_t card_index = card_within_region(from, from_hr);
- if (G1HRRSUseSparseTable &&
- _sparse_table.add_card(from_hrm_ind, card_index)) {
+ if (_sparse_table.add_card(from_hrm_ind, card_index)) {
assert(contains_reference_locked(from), "We just added " PTR_FORMAT " to the Sparse table", p2i(from));
return;
}
@@ -397,18 +396,16 @@
OrderAccess::release_store(&_fine_grain_regions[ind], prt);
_n_fine_entries++;
- if (G1HRRSUseSparseTable) {
- // Transfer from sparse to fine-grain.
- SparsePRTEntry *sprt_entry = _sparse_table.get_entry(from_hrm_ind);
- assert(sprt_entry != NULL, "There should have been an entry");
- for (int i = 0; i < sprt_entry->num_valid_cards(); i++) {
- CardIdx_t c = sprt_entry->card(i);
- prt->add_card(c);
- }
- // Now we can delete the sparse entry.
- bool res = _sparse_table.delete_entry(from_hrm_ind);
- assert(res, "It should have been there.");
+ // Transfer from sparse to fine-grain.
+ SparsePRTEntry *sprt_entry = _sparse_table.get_entry(from_hrm_ind);
+ assert(sprt_entry != NULL, "There should have been an entry");
+ for (int i = 0; i < sprt_entry->num_valid_cards(); i++) {
+ CardIdx_t c = sprt_entry->card(i);
+ prt->add_card(c);
}
+ // Now we can delete the sparse entry.
+ bool res = _sparse_table.delete_entry(from_hrm_ind);
+ assert(res, "It should have been there.");
}
assert(prt != NULL && prt->hr() == from_hr, "consequence");
}
--- a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -281,6 +281,8 @@
// expanded later, then now is the time to do so.
virtual bool expand_macro_nodes(PhaseMacroExpand* macro) const { return false; }
+ virtual bool has_special_unique_user(const Node* node) const { return false; }
+
enum CompilePhase {
BeforeOptimize, /* post_parse = true */
BeforeExpand, /* post_parse = false */
@@ -303,6 +305,10 @@
virtual bool matcher_find_shared_visit(Matcher* matcher, Matcher::MStack& mstack, Node* n, uint opcode, bool& mem_op, int& mem_addr_idx) const { return false; };
virtual bool matcher_find_shared_post_visit(Matcher* matcher, Node* n, uint opcode) const { return false; };
virtual bool matcher_is_store_load_barrier(Node* x, uint xop) const { return false; }
+
+ virtual void igvn_add_users_to_worklist(PhaseIterGVN* igvn, Node* use) const {}
+ virtual void ccp_analyze(PhaseCCP* ccp, Unique_Node_List& worklist, Node* use) const {}
+
};
#endif // SHARE_GC_SHARED_C2_BARRIERSETC2_HPP
--- a/src/hotspot/share/gc/shared/parallelCleaning.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/shared/parallelCleaning.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -74,8 +74,8 @@
_first_nmethod(NULL),
_claimed_nmethod(NULL) {
// Get first alive nmethod
- CompiledMethodIterator iter = CompiledMethodIterator();
- if(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive);
+ if(iter.next()) {
_first_nmethod = iter.method();
}
_claimed_nmethod = _first_nmethod;
@@ -91,18 +91,18 @@
void CodeCacheUnloadingTask::claim_nmethods(CompiledMethod** claimed_nmethods, int *num_claimed_nmethods) {
CompiledMethod* first;
- CompiledMethodIterator last;
+ CompiledMethodIterator last(CompiledMethodIterator::only_alive);
do {
*num_claimed_nmethods = 0;
first = _claimed_nmethod;
- last = CompiledMethodIterator(first);
+ last = CompiledMethodIterator(CompiledMethodIterator::only_alive, first);
if (first != NULL) {
for (int i = 0; i < MaxClaimNmethods; i++) {
- if (!last.next_alive()) {
+ if (!last.next()) {
break;
}
claimed_nmethods[i] = last.method();
--- a/src/hotspot/share/gc/z/zLock.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/z/zLock.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -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
@@ -33,18 +33,35 @@
public:
ZLock();
+ ~ZLock();
void lock();
bool try_lock();
void unlock();
};
+class ZReentrantLock {
+private:
+ ZLock _lock;
+ Thread* volatile _owner;
+ uint64_t _count;
+
+public:
+ ZReentrantLock();
+
+ void lock();
+ void unlock();
+
+ bool is_owned() const;
+};
+
+template <typename T>
class ZLocker : public StackObj {
private:
- ZLock* const _lock;
+ T* const _lock;
public:
- ZLocker(ZLock* lock);
+ ZLocker(T* lock);
~ZLocker();
};
--- a/src/hotspot/share/gc/z/zLock.inline.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/z/zLock.inline.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -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
@@ -25,11 +25,18 @@
#define SHARE_GC_Z_ZLOCK_INLINE_HPP
#include "gc/z/zLock.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/thread.hpp"
+#include "utilities/debug.hpp"
inline ZLock::ZLock() {
pthread_mutex_init(&_lock, NULL);
}
+inline ZLock::~ZLock() {
+ pthread_mutex_destroy(&_lock);
+}
+
inline void ZLock::lock() {
pthread_mutex_lock(&_lock);
}
@@ -42,12 +49,49 @@
pthread_mutex_unlock(&_lock);
}
-inline ZLocker::ZLocker(ZLock* lock) :
+inline ZReentrantLock::ZReentrantLock() :
+ _lock(),
+ _owner(NULL),
+ _count(0) {}
+
+inline void ZReentrantLock::lock() {
+ Thread* const thread = Thread::current();
+ Thread* const owner = Atomic::load(&_owner);
+
+ if (owner != thread) {
+ _lock.lock();
+ Atomic::store(thread, &_owner);
+ }
+
+ _count++;
+}
+
+inline void ZReentrantLock::unlock() {
+ assert(is_owned(), "Invalid owner");
+ assert(_count > 0, "Invalid count");
+
+ _count--;
+
+ if (_count == 0) {
+ Atomic::store((Thread*)NULL, &_owner);
+ _lock.unlock();
+ }
+}
+
+inline bool ZReentrantLock::is_owned() const {
+ Thread* const thread = Thread::current();
+ Thread* const owner = Atomic::load(&_owner);
+ return owner == thread;
+}
+
+template <typename T>
+inline ZLocker<T>::ZLocker(T* lock) :
_lock(lock) {
_lock->lock();
}
-inline ZLocker::~ZLocker() {
+template <typename T>
+inline ZLocker<T>::~ZLocker() {
_lock->unlock();
}
--- a/src/hotspot/share/gc/z/zMarkStackAllocator.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/z/zMarkStackAllocator.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -82,7 +82,7 @@
}
uintptr_t ZMarkStackSpace::expand_and_alloc_space(size_t size) {
- ZLocker locker(&_expand_lock);
+ ZLocker<ZLock> locker(&_expand_lock);
// Retry allocation before expanding
uintptr_t addr = alloc_space(size);
--- a/src/hotspot/share/gc/z/zPageAllocator.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/gc/z/zPageAllocator.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -260,7 +260,7 @@
// Free virtual memory
{
- ZLocker locker(&_lock);
+ ZLocker<ZLock> locker(&_lock);
_virtual.free(page->virtual_memory());
}
@@ -268,7 +268,7 @@
}
void ZPageAllocator::flush_detached_pages(ZList<ZPage>* list) {
- ZLocker locker(&_lock);
+ ZLocker<ZLock> locker(&_lock);
list->transfer(&_detached);
}
@@ -376,7 +376,7 @@
// thread have returned from sem_wait(). To avoid this race we are
// forcing the waiting thread to acquire/release the lock held by the
// posting thread. https://sourceware.org/bugzilla/show_bug.cgi?id=12674
- ZLocker locker(&_lock);
+ ZLocker<ZLock> locker(&_lock);
}
}
@@ -384,7 +384,7 @@
}
ZPage* ZPageAllocator::alloc_page_nonblocking(uint8_t type, size_t size, ZAllocationFlags flags) {
- ZLocker locker(&_lock);
+ ZLocker<ZLock> locker(&_lock);
return alloc_page_common(type, size, flags);
}
@@ -477,7 +477,7 @@
}
void ZPageAllocator::free_page(ZPage* page, bool reclaimed) {
- ZLocker locker(&_lock);
+ ZLocker<ZLock> locker(&_lock);
// Update used statistics
decrease_used(page->size(), reclaimed);
@@ -495,7 +495,7 @@
}
void ZPageAllocator::check_out_of_memory() {
- ZLocker locker(&_lock);
+ ZLocker<ZLock> locker(&_lock);
// Fail allocation requests that were enqueued before the
// last GC cycle started, otherwise start a new GC cycle.
--- a/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -544,12 +544,12 @@
bool heap) : DCmdWithParser(output, heap),
_repository_path("repositorypath", "Path to repository,.e.g \\\"My Repository\\\"", "STRING", false, NULL),
_dump_path("dumppath", "Path to dump,.e.g \\\"My Dump path\\\"", "STRING", false, NULL),
- _stack_depth("stackdepth", "Stack Depth", "JLONG", false, "64"),
- _global_buffer_count("globalbuffercount", "Number of global buffers,", "JLONG", false, "32"),
- _global_buffer_size("globalbuffersize", "Size of a global buffers,", "JLONG", false, "524288"),
- _thread_buffer_size("thread_buffer_size", "Size of a thread buffer", "JLONG", false, "8192"),
- _memory_size("memorysize", "Overall memory size, ", "JLONG", false, "16777216"),
- _max_chunk_size("maxchunksize", "Size of an individual disk chunk", "JLONG", false, "12582912"),
+ _stack_depth("stackdepth", "Stack Depth", "JULONG", false, "64"),
+ _global_buffer_count("globalbuffercount", "Number of global buffers,", "JULONG", false, "20"),
+ _global_buffer_size("globalbuffersize", "Size of a global buffers,", "MEMORY SIZE", false, "512k"),
+ _thread_buffer_size("thread_buffer_size", "Size of a thread buffer", "MEMORY SIZE", false, "8k"),
+ _memory_size("memorysize", "Overall memory size, ", "MEMORY SIZE", false, "10m"),
+ _max_chunk_size("maxchunksize", "Size of an individual disk chunk", "MEMORY SIZE", false, "12m"),
_sample_threads("samplethreads", "Activate Thread sampling", "BOOLEAN", false, "true") {
_dcmdparser.add_dcmd_option(&_repository_path);
_dcmdparser.add_dcmd_option(&_dump_path);
@@ -612,22 +612,22 @@
jobject global_buffer_size = NULL;
if (_global_buffer_size.is_set()) {
- global_buffer_size = JfrJavaSupport::new_java_lang_Long(_global_buffer_size.value(), CHECK);
+ global_buffer_size = JfrJavaSupport::new_java_lang_Long(_global_buffer_size.value()._size, CHECK);
}
jobject thread_buffer_size = NULL;
if (_thread_buffer_size.is_set()) {
- thread_buffer_size = JfrJavaSupport::new_java_lang_Long(_thread_buffer_size.value(), CHECK);
+ thread_buffer_size = JfrJavaSupport::new_java_lang_Long(_thread_buffer_size.value()._size, CHECK);
}
jobject max_chunk_size = NULL;
if (_max_chunk_size.is_set()) {
- max_chunk_size = JfrJavaSupport::new_java_lang_Long(_max_chunk_size.value(), CHECK);
+ max_chunk_size = JfrJavaSupport::new_java_lang_Long(_max_chunk_size.value()._size, CHECK);
}
jobject memory_size = NULL;
if (_memory_size.is_set()) {
- memory_size = JfrJavaSupport::new_java_lang_Long(_memory_size.value(), CHECK);
+ memory_size = JfrJavaSupport::new_java_lang_Long(_memory_size.value()._size, CHECK);
}
jobject sample_threads = NULL;
--- a/src/hotspot/share/jfr/dcmd/jfrDcmds.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/jfr/dcmd/jfrDcmds.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -145,10 +145,10 @@
DCmdArgument<char*> _dump_path;
DCmdArgument<jlong> _stack_depth;
DCmdArgument<jlong> _global_buffer_count;
- DCmdArgument<jlong> _global_buffer_size;
- DCmdArgument<jlong> _thread_buffer_size;
- DCmdArgument<jlong> _memory_size;
- DCmdArgument<jlong> _max_chunk_size;
+ DCmdArgument<MemorySizeArgument> _global_buffer_size;
+ DCmdArgument<MemorySizeArgument> _thread_buffer_size;
+ DCmdArgument<MemorySizeArgument> _memory_size;
+ DCmdArgument<MemorySizeArgument> _max_chunk_size;
DCmdArgument<bool> _sample_threads;
public:
--- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -447,6 +447,7 @@
if (registered_symbol == NULL) {
registered_symbol = SymbolTable::lookup_only(registered_constant, sizeof registered_constant - 1, unused_hash);
if (registered_symbol == NULL) {
+ untypedEventHandler = true;
return false;
}
}
--- a/src/hotspot/share/jfr/metadata/metadata.xml Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/jfr/metadata/metadata.xml Fri Nov 23 09:12:00 2018 -0500
@@ -67,7 +67,7 @@
<Event name="BiasedLockRevocation" category="Java Application" label="Biased Lock Revocation" description="Revoked bias of object" thread="true"
stackTrace="true">
<Field type="Class" name="lockClass" label="Lock Class" description="Class of object whose biased lock was revoked" />
- <Field type="int" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
+ <Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
<Field type="Thread" name="previousOwner" label="Previous Owner" description="Thread owning the bias before revocation" />
</Event>
@@ -80,7 +80,7 @@
thread="true" stackTrace="true">
<Field type="Class" name="revokedClass" label="Revoked Class" description="Class whose biased locks were revoked" />
<Field type="boolean" name="disableBiasing" label="Disable Further Biasing" description="Whether further biasing for instances of this class will be allowed" />
- <Field type="int" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
+ <Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
</Event>
<Event name="ReservedStackActivation" category="Java Virtual Machine, Runtime" label="Reserved Stack Activation"
@@ -519,14 +519,14 @@
</Event>
<Event name="SafepointBegin" category="Java Virtual Machine, Runtime, Safepoint" label="Safepoint Begin" description="Safepointing begin" thread="true">
- <Field type="int" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
+ <Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
<Field type="int" name="totalThreadCount" label="Total Threads" description="The total number of threads at the start of safe point" />
<Field type="int" name="jniCriticalThreadCount" label="JNI Critical Threads" description="The number of threads in JNI critical sections" />
</Event>
<Event name="SafepointStateSynchronization" category="Java Virtual Machine, Runtime, Safepoint" label="Safepoint State Synchronization" description="Synchronize run state of threads"
thread="true">
- <Field type="int" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
+ <Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
<Field type="int" name="initialThreadCount" label="Initial Threads" description="The number of threads running at the beginning of state check" />
<Field type="int" name="runningThreadCount" label="Running Threads" description="The number of threads still running" />
<Field type="int" name="iterations" label="Iterations" description="Number of state check iterations" />
@@ -534,23 +534,23 @@
<Event name="SafepointWaitBlocked" category="Java Virtual Machine, Runtime, Safepoint" label="Safepoint Wait Blocked" description="Safepointing begin waiting on running threads to block"
thread="true">
- <Field type="int" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
+ <Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
<Field type="int" name="runningThreadCount" label="Running Threads" description="The number running of threads wait for safe point" />
</Event>
<Event name="SafepointCleanup" category="Java Virtual Machine, Runtime, Safepoint" label="Safepoint Cleanup" description="Safepointing begin running cleanup tasks"
thread="true">
- <Field type="int" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
+ <Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
</Event>
<Event name="SafepointCleanupTask" category="Java Virtual Machine, Runtime, Safepoint" label="Safepoint Cleanup Task" description="Safepointing begin running cleanup tasks"
thread="true">
- <Field type="int" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
+ <Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
<Field type="string" name="name" label="Task Name" description="The task name" />
</Event>
<Event name="SafepointEnd" category="Java Virtual Machine, Runtime, Safepoint" label="Safepoint End" description="Safepointing end" thread="true">
- <Field type="int" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
+ <Field type="ulong" name="safepointId" label="Safepoint Identifier" relation="SafepointId" />
</Event>
<Event name="ExecuteVMOperation" category="Java Virtual Machine, Runtime" label="VM Operation" description="Execution of a VM Operation" thread="true">
@@ -559,7 +559,7 @@
<Field type="boolean" name="blocking" label="Caller Blocked" description="If the calling thread was blocked until the operation was complete" />
<Field type="Thread" name="caller" label="Caller" transition="from"
description="Thread requesting operation. If non-blocking, will be set to 0 indicating thread is unknown" />
- <Field type="int" name="safepointId" label="Safepoint Identifier" description="The safepoint (if any) under which this operation was completed"
+ <Field type="ulong" name="safepointId" label="Safepoint Identifier" description="The safepoint (if any) under which this operation was completed"
relation="SafepointId" />
</Event>
--- a/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -352,19 +352,19 @@
configure._stack_depth.set_value(_dcmd_stackdepth.value());
configure._thread_buffer_size.set_is_set(_dcmd_threadbuffersize.is_set());
- configure._thread_buffer_size.set_value(_dcmd_threadbuffersize.value()._size);
+ configure._thread_buffer_size.set_value(_dcmd_threadbuffersize.value());
configure._global_buffer_count.set_is_set(_dcmd_numglobalbuffers.is_set());
configure._global_buffer_count.set_value(_dcmd_numglobalbuffers.value());
configure._global_buffer_size.set_is_set(_dcmd_globalbuffersize.is_set());
- configure._global_buffer_size.set_value(_dcmd_globalbuffersize.value()._size);
+ configure._global_buffer_size.set_value(_dcmd_globalbuffersize.value());
configure._max_chunk_size.set_is_set(_dcmd_maxchunksize.is_set());
- configure._max_chunk_size.set_value(_dcmd_maxchunksize.value()._size);
+ configure._max_chunk_size.set_value(_dcmd_maxchunksize.value());
configure._memory_size.set_is_set(_dcmd_memorysize.is_set());
- configure._memory_size.set_value(_dcmd_memorysize.value()._size);
+ configure._memory_size.set_value(_dcmd_memorysize.value());
configure._sample_threads.set_is_set(_dcmd_sample_threads.is_set());
configure._sample_threads.set_value(_dcmd_sample_threads.value());
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -1498,6 +1498,38 @@
}
C2V_END
+C2V_VMENTRY(jobject, asReflectionExecutable, (JNIEnv* env, jobject, jobject jvmci_method))
+ methodHandle m = CompilerToVM::asMethod(jvmci_method);
+ oop executable;
+ if (m->is_initializer()) {
+ if (m->is_static_initializer()) {
+ THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
+ "Cannot create java.lang.reflect.Method for class initializer");
+ }
+ executable = Reflection::new_constructor(m, CHECK_NULL);
+ } else {
+ executable = Reflection::new_method(m, false, CHECK_NULL);
+ }
+ return JNIHandles::make_local(thread, executable);
+}
+
+C2V_VMENTRY(jobject, asReflectionField, (JNIEnv* env, jobject, jobject jvmci_type, jint index))
+ Klass* klass = CompilerToVM::asKlass(jvmci_type);
+ if (!klass->is_instance_klass()) {
+ THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
+ err_msg("Expected non-primitive type, got %s", klass->external_name()));
+ }
+ InstanceKlass* iklass = InstanceKlass::cast(klass);
+ Array<u2>* fields = iklass->fields();
+ if (index < 0 || index > fields->length()) {
+ THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
+ err_msg("Field index %d out of bounds for %s", index, klass->external_name()));
+ }
+ fieldDescriptor fd(iklass, index);
+ oop reflected = Reflection::new_field(&fd, CHECK_NULL);
+ return JNIHandles::make_local(env, reflected);
+}
+
#define CC (char*) /*cast a literal from (const char*)*/
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
@@ -1519,6 +1551,8 @@
#define HS_METADATA "Ljdk/vm/ci/hotspot/HotSpotMetaData;"
#define HS_STACK_FRAME_REF "Ljdk/vm/ci/hotspot/HotSpotStackFrameReference;"
#define HS_SPECULATION_LOG "Ljdk/vm/ci/hotspot/HotSpotSpeculationLog;"
+#define REFLECTION_EXECUTABLE "Ljava/lang/reflect/Executable;"
+#define REFLECTION_FIELD "Ljava/lang/reflect/Field;"
#define METASPACE_METHOD_DATA "J"
JNINativeMethod CompilerToVM::methods[] = {
@@ -1586,6 +1620,8 @@
{CC "interpreterFrameSize", CC "(" BYTECODE_FRAME ")I", FN_PTR(interpreterFrameSize)},
{CC "compileToBytecode", CC "(" OBJECT ")V", FN_PTR(compileToBytecode)},
{CC "getFlagValue", CC "(" STRING ")" OBJECT, FN_PTR(getFlagValue)},
+ {CC "asReflectionExecutable", CC "(" HS_RESOLVED_METHOD ")" REFLECTION_EXECUTABLE, FN_PTR(asReflectionExecutable)},
+ {CC "asReflectionField", CC "(" HS_RESOLVED_KLASS "I)" REFLECTION_FIELD, FN_PTR(asReflectionField)},
};
int CompilerToVM::methods_count() {
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -91,6 +91,7 @@
static HeapWord** _heap_end_addr;
static HeapWord* volatile* _heap_top_addr;
static int _max_oop_map_stack_offset;
+ static int _fields_annotations_base_offset;
static jbyte* cardtable_start_address;
static int cardtable_shift;
@@ -101,7 +102,6 @@
static int sizeof_ExceptionTableElement;
static int sizeof_LocalVariableTableElement;
static int sizeof_ConstantPool;
- static int sizeof_SymbolPointer;
static int sizeof_narrowKlass;
static int sizeof_arrayOopDesc;
static int sizeof_BasicLock;
--- a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -61,6 +61,7 @@
HeapWord** CompilerToVM::Data::_heap_end_addr;
HeapWord* volatile* CompilerToVM::Data::_heap_top_addr;
int CompilerToVM::Data::_max_oop_map_stack_offset;
+int CompilerToVM::Data::_fields_annotations_base_offset;
jbyte* CompilerToVM::Data::cardtable_start_address;
int CompilerToVM::Data::cardtable_shift;
@@ -71,7 +72,6 @@
int CompilerToVM::Data::sizeof_ExceptionTableElement = sizeof(ExceptionTableElement);
int CompilerToVM::Data::sizeof_LocalVariableTableElement = sizeof(LocalVariableTableElement);
int CompilerToVM::Data::sizeof_ConstantPool = sizeof(ConstantPool);
-int CompilerToVM::Data::sizeof_SymbolPointer = sizeof(Symbol*);
int CompilerToVM::Data::sizeof_narrowKlass = sizeof(narrowKlass);
int CompilerToVM::Data::sizeof_arrayOopDesc = sizeof(arrayOopDesc);
int CompilerToVM::Data::sizeof_BasicLock = sizeof(BasicLock);
@@ -122,6 +122,8 @@
symbol_init = (address) vmSymbols::object_initializer_name();
symbol_clinit = (address) vmSymbols::class_initializer_name();
+ _fields_annotations_base_offset = Array<AnnotationArray*>::base_offset_in_bytes();
+
BarrierSet* bs = BarrierSet::barrier_set();
if (bs->is_a(BarrierSet::CardTableBarrierSet)) {
jbyte* base = ci_card_table_address();
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -76,6 +76,7 @@
static_field(CompilerToVM::Data, _heap_top_addr, HeapWord* volatile*) \
\
static_field(CompilerToVM::Data, _max_oop_map_stack_offset, int) \
+ static_field(CompilerToVM::Data, _fields_annotations_base_offset, int) \
\
static_field(CompilerToVM::Data, cardtable_start_address, jbyte*) \
static_field(CompilerToVM::Data, cardtable_shift, int) \
@@ -86,7 +87,6 @@
static_field(CompilerToVM::Data, sizeof_ExceptionTableElement, int) \
static_field(CompilerToVM::Data, sizeof_LocalVariableTableElement, int) \
static_field(CompilerToVM::Data, sizeof_ConstantPool, int) \
- static_field(CompilerToVM::Data, sizeof_SymbolPointer, int) \
static_field(CompilerToVM::Data, sizeof_narrowKlass, int) \
static_field(CompilerToVM::Data, sizeof_arrayOopDesc, int) \
static_field(CompilerToVM::Data, sizeof_BasicLock, int) \
@@ -104,6 +104,8 @@
\
static_field(Abstract_VM_Version, _features, uint64_t) \
\
+ nonstatic_field(Annotations, _fields_annotations, Array<AnnotationArray*>*) \
+ \
nonstatic_field(Array<int>, _length, int) \
unchecked_nonstatic_field(Array<u1>, _data, sizeof(u1)) \
unchecked_nonstatic_field(Array<u2>, _data, sizeof(u2)) \
@@ -164,6 +166,7 @@
nonstatic_field(InstanceKlass, _source_file_name_index, u2) \
nonstatic_field(InstanceKlass, _init_state, u1) \
nonstatic_field(InstanceKlass, _misc_flags, u2) \
+ nonstatic_field(InstanceKlass, _annotations, Annotations*) \
\
volatile_nonstatic_field(JavaFrameAnchor, _last_Java_sp, intptr_t*) \
volatile_nonstatic_field(JavaFrameAnchor, _last_Java_pc, address) \
@@ -462,6 +465,8 @@
declare_constant(ConstMethod::_has_linenumber_table) \
declare_constant(ConstMethod::_has_localvariable_table) \
declare_constant(ConstMethod::_has_exception_table) \
+ declare_constant(ConstMethod::_has_method_annotations) \
+ declare_constant(ConstMethod::_has_parameter_annotations) \
\
declare_constant(CounterData::count_off) \
\
--- a/src/hotspot/share/memory/filemap.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/memory/filemap.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -1096,7 +1096,7 @@
si->_allow_exec);
if (base == NULL || base != addr) {
// dealloc the regions from java heap
- dealloc_archive_heap_regions(regions, region_num);
+ dealloc_archive_heap_regions(regions, region_num, is_open_archive);
log_info(cds)("UseSharedSpaces: Unable to map at required address in java heap. "
INTPTR_FORMAT ", size = " SIZE_FORMAT " bytes",
p2i(addr), regions[i].byte_size());
@@ -1106,7 +1106,7 @@
if (!verify_mapped_heap_regions(first, region_num)) {
// dealloc the regions from java heap
- dealloc_archive_heap_regions(regions, region_num);
+ dealloc_archive_heap_regions(regions, region_num, is_open_archive);
log_info(cds)("UseSharedSpaces: mapped heap regions are corrupt");
return false;
}
@@ -1171,10 +1171,10 @@
}
// dealloc the archive regions from java heap
-void FileMapInfo::dealloc_archive_heap_regions(MemRegion* regions, int num) {
+void FileMapInfo::dealloc_archive_heap_regions(MemRegion* regions, int num, bool is_open) {
if (num > 0) {
assert(regions != NULL, "Null archive ranges array with non-zero count");
- G1CollectedHeap::heap()->dealloc_archive_regions(regions, num);
+ G1CollectedHeap::heap()->dealloc_archive_regions(regions, num, is_open);
}
}
#endif // INCLUDE_CDS_JAVA_HEAP
@@ -1428,9 +1428,11 @@
// Dealloc the archive heap regions only without unmapping. The regions are part
// of the java heap. Unmapping of the heap regions are managed by GC.
map_info->dealloc_archive_heap_regions(open_archive_heap_ranges,
- num_open_archive_heap_ranges);
+ num_open_archive_heap_ranges,
+ true);
map_info->dealloc_archive_heap_regions(closed_archive_heap_ranges,
- num_closed_archive_heap_ranges);
+ num_closed_archive_heap_ranges,
+ false);
} else if (DumpSharedSpaces) {
fail_stop("%s", msg);
}
--- a/src/hotspot/share/memory/filemap.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/memory/filemap.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -327,7 +327,7 @@
bool map_heap_data(MemRegion **heap_mem, int first, int max, int* num,
bool is_open = false) NOT_CDS_JAVA_HEAP_RETURN_(false);
bool verify_mapped_heap_regions(int first, int num) NOT_CDS_JAVA_HEAP_RETURN_(false);
- void dealloc_archive_heap_regions(MemRegion* regions, int num) NOT_CDS_JAVA_HEAP_RETURN;
+ void dealloc_archive_heap_regions(MemRegion* regions, int num, bool is_open) NOT_CDS_JAVA_HEAP_RETURN;
CDSFileMapRegion* space_at(int i) {
return _header->space_at(i);
--- a/src/hotspot/share/memory/iterator.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/memory/iterator.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "code/nmethod.hpp"
#include "memory/iterator.inline.hpp"
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
--- a/src/hotspot/share/oops/annotations.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/oops/annotations.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -42,6 +42,8 @@
// a type_annotation instance.
class Annotations: public MetaspaceObj {
+ friend class JVMCIVMStructs;
+
// If you add a new field that points to any metaspace object, you
// must add this field to Annotations::metaspace_pointers_do().
--- a/src/hotspot/share/opto/node.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/opto/node.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -1142,8 +1142,9 @@
} else if (is_If() && (n->is_IfFalse() || n->is_IfTrue())) {
// See IfProjNode::Identity()
return true;
+ } else {
+ return BarrierSet::barrier_set()->barrier_set_c2()->has_special_unique_user(this);
}
- return false;
};
//--------------------------find_exact_control---------------------------------
--- a/src/hotspot/share/opto/phaseX.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/opto/phaseX.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -1677,6 +1677,8 @@
}
}
}
+
+ BarrierSet::barrier_set()->barrier_set_c2()->igvn_add_users_to_worklist(this, use);
}
}
@@ -1827,7 +1829,7 @@
for (DUIterator_Fast i3max, i3 = u->fast_outs(i3max); i3 < i3max; i3++) {
Node* b = u->fast_out(i3);
if (bs->is_gc_barrier_node(b)) {
- _worklist.push(b);
+ worklist.push(b);
}
}
}
@@ -1835,6 +1837,8 @@
}
}
}
+
+ BarrierSet::barrier_set()->barrier_set_c2()->ccp_analyze(this, worklist, m);
}
}
}
--- a/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -228,8 +228,8 @@
// can be safely skipped.
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
// Iterate over non-profiled and profiled nmethods
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
nmethod* current = iter.method();
// Lock the nmethod so it can't be freed
nmethodLocker nml(current);
--- a/src/hotspot/share/prims/jvmtiTagMap.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/prims/jvmtiTagMap.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -2574,7 +2574,7 @@
return;
}
- oop o = *obj_p;
+ oop o = NativeAccess<AS_NO_KEEPALIVE>::oop_load(obj_p);
// ignore null
if (o == NULL) {
return;
--- a/src/hotspot/share/runtime/javaCalls.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/runtime/javaCalls.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -427,7 +427,7 @@
#if INCLUDE_JVMCI
if (alternative_target != NULL) {
- if (alternative_target->is_alive()) {
+ if (alternative_target->is_alive() && !alternative_target->is_unloading()) {
thread->set_jvmci_alternate_call_target(alternative_target->verified_entry_point());
entry_point = method->adapter()->get_i2c_entry();
} else {
--- a/src/hotspot/share/runtime/safepoint.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/runtime/safepoint.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -141,7 +141,7 @@
SafepointSynchronize::SynchronizeState volatile SafepointSynchronize::_state = SafepointSynchronize::_not_synchronized;
volatile int SafepointSynchronize::_waiting_to_block = 0;
-volatile int SafepointSynchronize::_safepoint_counter = 0;
+volatile uint64_t SafepointSynchronize::_safepoint_counter = 0;
int SafepointSynchronize::_current_jni_active_count = 0;
long SafepointSynchronize::_end_of_last_safepoint = 0;
int SafepointSynchronize::_defer_thr_suspend_loop_count = 4000;
--- a/src/hotspot/share/runtime/safepoint.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/runtime/safepoint.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -25,13 +25,10 @@
#ifndef SHARE_VM_RUNTIME_SAFEPOINT_HPP
#define SHARE_VM_RUNTIME_SAFEPOINT_HPP
-#include "asm/assembler.hpp"
-#include "code/nmethod.hpp"
#include "memory/allocation.hpp"
-#include "runtime/atomic.hpp"
-#include "runtime/extendedPC.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/os.hpp"
+#include "utilities/globalDefinitions.hpp"
#include "utilities/ostream.hpp"
//
@@ -50,8 +47,7 @@
class ThreadSafepointState;
-class SnippetCache;
-class nmethod;
+class JavaThread;
//
// Implements roll-forward to safepoint (safepoint synchronization)
@@ -101,11 +97,11 @@
// safepoint. The fact that Threads_lock is held throughout each pair of
// increments (at the beginning and end of each safepoint) guarantees
// race freedom.
-public:
- static volatile int _safepoint_counter;
+ static volatile uint64_t _safepoint_counter;
+
private:
- static long _end_of_last_safepoint; // Time of last safepoint in milliseconds
- static julong _coalesced_vmop_count; // coalesced vmop count
+ static long _end_of_last_safepoint; // Time of last safepoint in milliseconds
+ static julong _coalesced_vmop_count; // coalesced vmop count
// Statistics
static void begin_statistics(int nof_threads, int nof_running);
@@ -132,9 +128,9 @@
static void check_for_lazy_critical_native(JavaThread *thread, JavaThreadState state);
// Query
- inline static bool is_at_safepoint() { return _state == _synchronized; }
- inline static bool is_synchronizing() { return _state == _synchronizing; }
- inline static int safepoint_counter() { return _safepoint_counter; }
+ inline static bool is_at_safepoint() { return _state == _synchronized; }
+ inline static bool is_synchronizing() { return _state == _synchronizing; }
+ inline static uint64_t safepoint_counter() { return _safepoint_counter; }
inline static void increment_jni_active_count() {
assert_locked_or_safepoint(Safepoint_lock);
@@ -176,8 +172,17 @@
// Assembly support
static address address_of_state() { return (address)&_state; }
- static address safepoint_counter_addr() { return (address)&_safepoint_counter; }
-
+ // Only used for making sure that no safepoint has happened in
+ // JNI_FastGetField. Therefore only the low 32-bits are needed
+ // even if this is a 64-bit counter.
+ static address safepoint_counter_addr() {
+#ifdef VM_LITTLE_ENDIAN
+ return (address)&_safepoint_counter;
+#else /* BIG */
+ // Return pointer to the 32 LSB:
+ return (address) (((uint32_t*)(&_safepoint_counter)) + 1);
+#endif
+ }
};
// Some helper assert macros for safepoint checks.
--- a/src/hotspot/share/runtime/sharedRuntime.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/runtime/sharedRuntime.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -1279,7 +1279,7 @@
(!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||
( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");
- assert(caller_nm->is_alive(), "It should be alive");
+ assert(caller_nm->is_alive() && !caller_nm->is_unloading(), "It should be alive");
#ifndef PRODUCT
// tracing/debugging/statistics
@@ -1606,8 +1606,10 @@
} else if (inline_cache->is_icholder_call()) {
CompiledICHolder* ic_oop = inline_cache->cached_icholder();
if (ic_oop != NULL) {
-
- if (receiver()->klass() == ic_oop->holder_klass()) {
+ if (!ic_oop->is_loader_alive()) {
+ // Deferred IC cleaning due to concurrent class unloading
+ inline_cache->set_to_clean();
+ } else if (receiver()->klass() == ic_oop->holder_klass()) {
// This isn't a real miss. We must have seen that compiled code
// is now available and we want the call site converted to a
// monomorphic compiled call site.
--- a/src/hotspot/share/runtime/sweeper.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/runtime/sweeper.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -142,7 +142,7 @@
#define SWEEP(nm)
#endif
-CompiledMethodIterator NMethodSweeper::_current; // Current compiled method
+CompiledMethodIterator NMethodSweeper::_current(CompiledMethodIterator::all_blobs); // Current compiled method
long NMethodSweeper::_traversals = 0; // Stack scan count, also sweep ID.
long NMethodSweeper::_total_nof_code_cache_sweeps = 0; // Total number of full sweeps of the code cache
long NMethodSweeper::_time_counter = 0; // Virtual time used to periodically invoke sweeper
@@ -274,7 +274,7 @@
assert(wait_for_stack_scanning(), "should only happen between sweeper cycles");
_seen = 0;
- _current = CompiledMethodIterator();
+ _current = CompiledMethodIterator(CompiledMethodIterator::all_blobs);
// Initialize to first nmethod
_current.next();
_traversals += 1;
@@ -653,7 +653,7 @@
JavaThread* current = JavaThread::current();
assert (current->is_Code_cache_sweeper_thread(), "Must be");
_thread = (CodeCacheSweeperThread*)current;
- if (!cm->is_zombie() && !cm->is_unloaded()) {
+ if (!cm->is_zombie() && !cm->is_unloading()) {
// Only expose live nmethods for scanning
_thread->set_scanned_compiled_method(cm);
}
@@ -697,7 +697,7 @@
// Skip methods that are currently referenced by the VM
if (cm->is_locked_by_vm()) {
// But still remember to clean-up inline caches for alive nmethods
- if (cm->is_alive()) {
+ if (cm->is_alive() && !cm->is_unloading()) {
// Clean inline caches that point to zombie/non-entrant/unloaded nmethods
CompiledICLocker ml(cm);
cm->cleanup_inline_caches(false);
@@ -786,7 +786,7 @@
void NMethodSweeper::possibly_flush(nmethod* nm) {
if (UseCodeCacheFlushing) {
- if (!nm->is_locked_by_vm() && !nm->is_native_method() && !nm->is_not_installed()) {
+ if (!nm->is_locked_by_vm() && !nm->is_native_method() && !nm->is_not_installed() && !nm->is_unloading()) {
bool make_not_entrant = false;
// Do not make native methods not-entrant
--- a/src/hotspot/share/runtime/thread.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/runtime/thread.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -26,6 +26,7 @@
#define SHARE_VM_RUNTIME_THREAD_HPP
#include "jni.h"
+#include "code/compiledMethod.hpp"
#include "gc/shared/gcThreadLocalData.hpp"
#include "gc/shared/threadLocalAllocBuffer.hpp"
#include "memory/allocation.hpp"
@@ -40,7 +41,6 @@
#include "runtime/os.hpp"
#include "runtime/osThread.hpp"
#include "runtime/park.hpp"
-#include "runtime/safepoint.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/threadHeapSampler.hpp"
#include "runtime/threadLocalStorage.hpp"
@@ -994,7 +994,7 @@
public: // Expose _thread_state for SafeFetchInt()
volatile JavaThreadState _thread_state;
private:
- ThreadSafepointState *_safepoint_state; // Holds information about a thread during a safepoint
+ ThreadSafepointState* _safepoint_state; // Holds information about a thread during a safepoint
address _saved_exception_pc; // Saved pc of instruction where last implicit exception happened
// JavaThread termination support
@@ -1226,9 +1226,9 @@
inline JavaThreadState thread_state() const;
inline void set_thread_state(JavaThreadState s);
#endif
- ThreadSafepointState *safepoint_state() const { return _safepoint_state; }
- void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; }
- bool is_at_poll_safepoint() { return _safepoint_state->is_at_poll_safepoint(); }
+ inline ThreadSafepointState* safepoint_state() const;
+ inline void set_safepoint_state(ThreadSafepointState* state);
+ inline bool is_at_poll_safepoint();
// JavaThread termination and lifecycle support:
void smr_delete();
@@ -1751,13 +1751,7 @@
// JNI critical regions. These can nest.
bool in_critical() { return _jni_active_critical > 0; }
bool in_last_critical() { return _jni_active_critical == 1; }
- void enter_critical() {
- assert(Thread::current() == this ||
- (Thread::current()->is_VM_thread() &&
- SafepointSynchronize::is_synchronizing()),
- "this must be current thread or synchronizing");
- _jni_active_critical++;
- }
+ inline void enter_critical();
void exit_critical() {
assert(Thread::current() == this, "this must be current thread");
_jni_active_critical--;
--- a/src/hotspot/share/runtime/thread.inline.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/runtime/thread.inline.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -29,6 +29,7 @@
#include "runtime/globals.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/os.inline.hpp"
+#include "runtime/safepoint.hpp"
#include "runtime/thread.hpp"
inline void Thread::set_suspend_flag(SuspendFlags f) {
@@ -130,6 +131,26 @@
}
#endif
+ThreadSafepointState* JavaThread::safepoint_state() const {
+ return _safepoint_state;
+}
+
+void JavaThread::set_safepoint_state(ThreadSafepointState *state) {
+ _safepoint_state = state;
+}
+
+bool JavaThread::is_at_poll_safepoint() {
+ return _safepoint_state->is_at_poll_safepoint();
+}
+
+void JavaThread::enter_critical() {
+ assert(Thread::current() == this ||
+ (Thread::current()->is_VM_thread() &&
+ SafepointSynchronize::is_synchronizing()),
+ "this must be current thread or synchronizing");
+ _jni_active_critical++;
+}
+
inline void JavaThread::set_done_attaching_via_jni() {
_jni_attach_state = _attached_via_jni;
OrderAccess::fence();
--- a/src/hotspot/share/services/threadService.hpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/services/threadService.hpp Fri Nov 23 09:12:00 2018 -0500
@@ -31,6 +31,7 @@
#include "runtime/jniHandles.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/perfData.hpp"
+#include "runtime/safepoint.hpp"
#include "runtime/thread.hpp"
#include "runtime/threadSMR.hpp"
#include "services/management.hpp"
--- a/src/hotspot/share/utilities/hashtable.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/src/hotspot/share/utilities/hashtable.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -31,6 +31,7 @@
#include "classfile/placeholders.hpp"
#include "classfile/protectionDomainCache.hpp"
#include "classfile/stringTable.hpp"
+#include "code/nmethod.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
--- a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java Fri Nov 23 09:12:00 2018 -0500
@@ -656,7 +656,7 @@
return null;
}
SecretKey psk = pskOpt.get();
- Optional<byte[]> pskIdOpt = chc.resumingSession.getPskIdentity();
+ Optional<byte[]> pskIdOpt = chc.resumingSession.consumePskIdentity();
if (!pskIdOpt.isPresent()) {
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
SSLLogger.fine(
@@ -666,6 +666,11 @@
}
byte[] pskId = pskIdOpt.get();
+ //The session cannot be used again. Remove it from the cache.
+ SSLSessionContextImpl sessionCache = (SSLSessionContextImpl)
+ chc.sslContext.engineGetClientSessionContext();
+ sessionCache.remove(chc.resumingSession.getSessionId());
+
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
SSLLogger.fine(
"Found resumable session. Preparing PSK message.");
@@ -828,10 +833,6 @@
"Received pre_shared_key extension: ", shPsk);
}
- // The PSK identity should not be reused, even if it is
- // not selected.
- chc.resumingSession.consumePskIdentity();
-
if (shPsk.selectedIdentity != 0) {
chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
"Selected identity index is not in correct range.");
@@ -841,11 +842,6 @@
SSLLogger.fine(
"Resuming session: ", chc.resumingSession);
}
-
- // remove the session from the cache
- SSLSessionContextImpl sessionCache = (SSLSessionContextImpl)
- chc.sslContext.engineGetClientSessionContext();
- sessionCache.remove(chc.resumingSession.getSessionId());
}
}
@@ -860,13 +856,6 @@
SSLLogger.fine("Handling pre_shared_key absence.");
}
- if (chc.handshakeExtensions.containsKey(
- SSLExtension.CH_PRE_SHARED_KEY)) {
- // The PSK identity should not be reused, even if it is
- // not selected.
- chc.resumingSession.consumePskIdentity();
- }
-
// The server refused to resume, or the client did not
// request 1.3 resumption.
chc.resumingSession = null;
--- a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -305,13 +305,6 @@
return this.identificationProtocol;
}
- /*
- * Get the PSK identity. Take care not to use it in multiple connections.
- */
- synchronized Optional<byte[]> getPskIdentity() {
- return Optional.ofNullable(pskIdentity);
- }
-
/* PSK identities created from new_session_ticket messages should only
* be used once. This method will return the identity and then clear it
* so it cannot be used again.
--- a/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Fri Nov 23 09:02:17 2018 -0500
+++ b/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Fri Nov 23 09:12:00 2018 -0500
@@ -684,19 +684,21 @@
packetAddress = NULL;
}
}
- if (packetAddress == NULL) {
- packetAddress = NET_SockaddrToInetAddress(env, &rmtaddr, &port);
- /* stuff the new Inetaddress in the packet */
- (*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
- } else {
- /* only get the new port number */
- port = NET_GetPortFromSockaddr(&rmtaddr);
+ if (!(*env)->ExceptionCheck(env)){
+ if (packetAddress == NULL ) {
+ packetAddress = NET_SockaddrToInetAddress(env, &rmtaddr, &port);
+ /* stuff the new InetAddress in the packet */
+ (*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
+ } else {
+ /* only get the new port number */
+ port = NET_GetPortFromSockaddr(&rmtaddr);
+ }
+ /* and fill in the data, remote address/port and such */
+ (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
+ (jbyte *)fullPacket);
+ (*env)->SetIntField(env, packet, dp_portID, port);
+ (*env)->SetIntField(env, packet, dp_lengthID, n);
}
- /* and fill in the data, remote address/port and such */
- (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, n,
- (jbyte *)fullPacket);
- (*env)->SetIntField(env, packet, dp_portID, port);
- (*env)->SetIntField(env, packet, dp_lengthID, n);
}
if (mallocedPacket) {
--- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Fri Nov 23 09:02:17 2018 -0500
+++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Fri Nov 23 09:12:00 2018 -0500
@@ -153,10 +153,9 @@
static fdopendir_func* my_fdopendir_func = NULL;
/**
- * fstatat missing from glibc on Linux. Temporary workaround
- * for x86/x64.
+ * fstatat missing from glibc on Linux.
*/
-#if defined(__linux__) && defined(__i386)
+#if defined(__linux__) && (defined(__i386) || defined(__arm__))
#define FSTATAT64_SYSCALL_AVAILABLE
static int fstatat64_wrapper(int dfd, const char *path,
struct stat64 *statbuf, int flag)
--- a/src/java.base/windows/native/libnet/DualStackPlainDatagramSocketImpl.c Fri Nov 23 09:02:17 2018 -0500
+++ b/src/java.base/windows/native/libnet/DualStackPlainDatagramSocketImpl.c Fri Nov 23 09:12:00 2018 -0500
@@ -386,15 +386,14 @@
packetAddress = NULL;
}
}
- if (packetAddress == NULL) {
- packetAddress = NET_SockaddrToInetAddress(env, &sa, &port);
- if (packetAddress != NULL) {
- /* stuff the new Inetaddress into the packet */
- (*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress);
+ if (!(*env)->ExceptionCheck(env)){
+ if (packetAddress == NULL ) {
+ packetAddress = NET_SockaddrToInetAddress(env, &sa, &port);
+ if (packetAddress != NULL) {
+ /* stuff the new InetAddress into the packet */
+ (*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress);
+ }
}
- }
-
- if (!(*env)->ExceptionCheck(env)) {
/* populate the packet */
(*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, rv,
(jbyte *)fullPacket);
--- a/src/java.base/windows/native/libnet/NetworkInterface.c Fri Nov 23 09:02:17 2018 -0500
+++ b/src/java.base/windows/native/libnet/NetworkInterface.c Fri Nov 23 09:12:00 2018 -0500
@@ -202,8 +202,9 @@
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetIfTable function failed");
-
- return -1;
+ // this different error code is to handle the case when we call
+ // GetIpAddrTable in pure IPv6 environment
+ return -2;
}
/*
@@ -400,7 +401,9 @@
}
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetIpAddrTable function failed");
- return -1;
+ // this different error code is to handle the case when we call
+ // GetIpAddrTable in pure IPv6 environment
+ return -2;
}
/*
@@ -557,7 +560,7 @@
*/
if (netaddrCount < 0) {
netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
- if (netaddrCount == -1) {
+ if (netaddrCount < 0) {
return NULL;
}
}
--- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Fri Nov 23 09:02:17 2018 -0500
+++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Fri Nov 23 09:12:00 2018 -0500
@@ -253,6 +253,10 @@
ret = enumInterfaces(env, netifPP);
if (ret == -1) {
return -1;
+ } else if( ret == -2){
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionClear(env);
+ }
} else {
count = ret;
}
@@ -272,10 +276,16 @@
ret = enumAddresses_win(env, curr, &netaddrP);
if (ret == -1) {
return -1;
+ } else if (ret == -2) {
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionClear(env);
+ }
+ break;
+ } else{
+ curr->addrs = netaddrP;
+ curr->naddrs += ret;
+ curr = curr->next;
}
- curr->addrs = netaddrP;
- curr->naddrs += ret;
- curr = curr->next;
}
ret = getAdapters (env, &adapters);
@@ -558,6 +568,12 @@
if (netaddrCount == -1) {
return NULL;
}
+ if (netaddrCount == -2) {
+ // Clear the exception and continue.
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionClear(env);
+ }
+ }
netaddrP = netaddrPToFree;
}
--- a/src/java.base/windows/native/libnet/PlainSocketImpl.c Fri Nov 23 09:02:17 2018 -0500
+++ b/src/java.base/windows/native/libnet/PlainSocketImpl.c Fri Nov 23 09:12:00 2018 -0500
@@ -303,6 +303,10 @@
SetHandleInformation((HANDLE)(UINT_PTR)newfd, HANDLE_FLAG_INHERIT, 0);
ia = NET_SockaddrToInetAddress(env, &sa, &port);
+ if (ia == NULL){
+ closesocket(newfd);
+ return -1;
+ }
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
if (isa == NULL) {
closesocket(newfd);
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c Fri Nov 23 09:02:17 2018 -0500
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -34,7 +34,9 @@
#ifndef HEADLESS
#include <X11/extensions/Xdbe.h>
#include <X11/XKBlib.h>
+#ifndef _AIX
#include <X11/extensions/Xrandr.h>
+#endif
#include "GLXGraphicsConfig.h"
#endif /* !HEADLESS */
@@ -1625,6 +1627,8 @@
#ifndef HEADLESS
+#ifndef _AIX
+
#define BIT_DEPTH_MULTI java_awt_DisplayMode_BIT_DEPTH_MULTI
#define REFRESH_RATE_UNKNOWN java_awt_DisplayMode_REFRESH_RATE_UNKNOWN
@@ -1830,6 +1834,8 @@
}
}
+#endif /* !_AIX */
+
static void
X11GD_SetFullscreenMode(Window win, jboolean enabled)
{
@@ -1869,7 +1875,7 @@
Java_sun_awt_X11GraphicsDevice_initXrandrExtension
(JNIEnv *env, jclass x11gd)
{
-#ifdef HEADLESS
+#if defined(HEADLESS) || defined(_AIX)
return JNI_FALSE;
#else
int opcode = 0, firstEvent = 0, firstError = 0;
@@ -1896,7 +1902,7 @@
Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode
(JNIEnv* env, jclass x11gd, jint screen)
{
-#ifdef HEADLESS
+#if defined(HEADLESS) || defined(_AIX)
return NULL;
#else
XRRScreenConfiguration *config;
@@ -1992,7 +1998,7 @@
(JNIEnv* env, jclass x11gd,
jint screen, jobject arrayList)
{
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(_AIX)
AWT_LOCK();
@@ -2080,7 +2086,7 @@
(JNIEnv* env, jclass x11gd,
jint screen, jint width, jint height, jint refreshRate)
{
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(_AIX)
jboolean success = JNI_FALSE;
XRRScreenConfiguration *config;
Drawable root;
@@ -2197,6 +2203,9 @@
*/
static char *get_output_screen_name(JNIEnv *env, int screen) {
+#ifdef _AIX
+ return NULL;
+#else
if (!awt_XRRGetScreenResources || !awt_XRRGetOutputInfo) {
return NULL;
}
@@ -2226,6 +2235,7 @@
}
AWT_UNLOCK();
return name;
+#endif /* _AIX */
}
/*
--- a/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java Fri Nov 23 09:12:00 2018 -0500
@@ -59,7 +59,9 @@
import com.sun.source.doctree.EntityTree;
import com.sun.source.doctree.ErroneousTree;
import com.sun.source.doctree.IdentifierTree;
+import com.sun.source.doctree.IndexTree;
import com.sun.source.doctree.InheritDocTree;
+import com.sun.source.doctree.InlineTagTree;
import com.sun.source.doctree.LinkTree;
import com.sun.source.doctree.LiteralTree;
import com.sun.source.doctree.ParamTree;
@@ -71,6 +73,7 @@
import com.sun.source.doctree.SinceTree;
import com.sun.source.doctree.StartElementTree;
import com.sun.source.doctree.SummaryTree;
+import com.sun.source.doctree.SystemPropertyTree;
import com.sun.source.doctree.TextTree;
import com.sun.source.doctree.ThrowsTree;
import com.sun.source.doctree.UnknownBlockTagTree;
@@ -765,6 +768,18 @@
}
@Override @DefinedBy(Api.COMPILER_TREE)
+ public Void visitIndex(IndexTree tree, Void ignore) {
+ for (TagStackItem tsi : tagStack) {
+ if (tsi.tag == HtmlTag.A) {
+ env.messages.warning(HTML, tree, "dc.tag.a.within.a",
+ "{@" + tree.getTagName() + "}");
+ break;
+ }
+ }
+ return super.visitIndex(tree, ignore);
+ }
+
+ @Override @DefinedBy(Api.COMPILER_TREE)
public Void visitInheritDoc(InheritDocTree tree, Void ignore) {
markEnclosingTag(Flag.HAS_INLINE_TAG);
// TODO: verify on overridden method
@@ -867,12 +882,15 @@
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitReference(ReferenceTree tree, Void ignore) {
String sig = tree.getSignature();
- if (sig.contains("<") || sig.contains(">"))
+ if (sig.contains("<") || sig.contains(">")) {
env.messages.error(REFERENCE, tree, "dc.type.arg.not.allowed");
-
- Element e = env.trees.getElement(getCurrentPath());
- if (e == null)
- env.messages.error(REFERENCE, tree, "dc.ref.not.found");
+ } else if (isArrayType(sig)) {
+ env.messages.error(REFERENCE, tree, "dc.array.type.not.allowed");
+ } else {
+ Element e = env.trees.getElement(getCurrentPath());
+ if (e == null)
+ env.messages.error(REFERENCE, tree, "dc.ref.not.found");
+ }
return super.visitReference(tree, ignore);
}
@@ -921,6 +939,18 @@
}
@Override @DefinedBy(Api.COMPILER_TREE)
+ public Void visitSystemProperty(SystemPropertyTree tree, Void ignore) {
+ for (TagStackItem tsi : tagStack) {
+ if (tsi.tag == HtmlTag.A) {
+ env.messages.warning(HTML, tree, "dc.tag.a.within.a",
+ "{@" + tree.getTagName() + "}");
+ break;
+ }
+ }
+ return super.visitSystemProperty(tree, ignore);
+ }
+
+ @Override @DefinedBy(Api.COMPILER_TREE)
public Void visitThrows(ThrowsTree tree, Void ignore) {
ReferenceTree exName = tree.getExceptionName();
Element ex = env.trees.getElement(new DocTreePath(getCurrentPath(), exName));
@@ -945,6 +975,12 @@
return scan(tree.getDescription(), ignore);
}
+ private boolean isArrayType(String signature) {
+ int brackets = signature.indexOf('[');
+ int parens = signature.indexOf('(');
+ return brackets >= 0 && (parens < 0 || brackets < parens);
+ }
+
private boolean isThrowable(TypeMirror tm) {
switch (tm.getKind()) {
case DECLARED:
--- a/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties Fri Nov 23 09:12:00 2018 -0500
@@ -25,6 +25,7 @@
dc.anchor.already.defined = anchor already defined: "{0}"
dc.anchor.value.missing = no value given for anchor
+dc.array.type.not.allowed = array type not allowed here
dc.attr.lacks.value = attribute lacks value
dc.attr.not.number = attribute value is not a number
dc.attr.not.supported.html4 = attribute not supported in HTML4: {0}
@@ -60,6 +61,7 @@
dc.service.not.found = service-type not found
dc.tag.code.within.code = '{@code'} within <code>
dc.tag.empty = empty <{0}> tag
+dc.tag.a.within.a = {0} tag, which expands to <a>, within <a>
dc.tag.end.not.permitted = invalid end tag: </{0}>
dc.tag.end.unexpected = unexpected end tag: </{0}>
dc.tag.header.sequence.1 = header used out of sequence: <{0}>
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java Fri Nov 23 09:12:00 2018 -0500
@@ -443,7 +443,11 @@
// we first check if qualifierExpression identifies a type,
// and if not, then we check to see if it identifies a package.
Type t = attr.attribType(ref.qualifierExpression, env);
- if (t.isErroneous()) {
+
+ if (t.getKind() == TypeKind.ARRAY) {
+ // cannot refer to an array type
+ return null;
+ } else if (t.isErroneous()) {
JCCompilationUnit toplevel =
treeMaker.TopLevel(List.nil());
final ModuleSymbol msym = modules.getDefaultModule();
@@ -451,6 +455,9 @@
toplevel.packge = msym.unnamedPackage;
Symbol sym = attr.attribIdent(ref.qualifierExpression, toplevel);
+ if (sym == null)
+ return null;
+
sym.complete();
if ((sym.kind == PCK || sym.kind == TYP) && sym.exists()) {
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Fri Nov 23 09:12:00 2018 -0500
@@ -27,6 +27,7 @@
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
import java.lang.reflect.Executable;
+import java.lang.reflect.Field;
import jdk.vm.ci.code.BytecodeFrame;
import jdk.vm.ci.code.InstalledCode;
@@ -657,4 +658,17 @@
* Gets the host class for {@code type}.
*/
native HotSpotResolvedObjectTypeImpl getHostClass(HotSpotResolvedObjectTypeImpl type);
+
+ /**
+ * Gets a {@link Executable} corresponding to {@code method}.
+ */
+ native Executable asReflectionExecutable(HotSpotResolvedJavaMethodImpl method);
+
+ /**
+ * Gets a {@link Field} denoted by {@code holder} and {@code index}.
+ *
+ * @param holder the class in which the requested field is declared
+ * @param fieldIndex the {@code fieldDescriptor::index()} denoting the field
+ */
+ native Field asReflectionField(HotSpotResolvedObjectTypeImpl holder, int fieldIndex);
}
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -22,11 +22,15 @@
*/
package jdk.vm.ci.hotspot;
+import static jdk.internal.misc.Unsafe.ADDRESS_SIZE;
+import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmFieldModifiers;
import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
+import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
+import java.util.HashMap;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaType;
@@ -156,41 +160,65 @@
return (config().jvmAccFieldStable & modifiers) != 0;
}
+ private boolean hasAnnotations() {
+ if (!isInternal()) {
+ HotSpotVMConfig config = config();
+ final long metaspaceAnnotations = UNSAFE.getAddress(holder.getMetaspaceKlass() + config.instanceKlassAnnotationsOffset);
+ if (metaspaceAnnotations != 0) {
+ long fieldsAnnotations = UNSAFE.getAddress(metaspaceAnnotations + config.annotationsFieldAnnotationsOffset);
+ if (fieldsAnnotations != 0) {
+ long fieldAnnotations = UNSAFE.getAddress(fieldsAnnotations + config.fieldsAnnotationsBaseOffset + (ADDRESS_SIZE * index));
+ return fieldAnnotations != 0;
+ }
+ }
+ }
+ return false;
+ }
+
@Override
public Annotation[] getAnnotations() {
- Field javaField = toJava();
- if (javaField != null) {
- return javaField.getAnnotations();
+ if (!hasAnnotations()) {
+ return new Annotation[0];
}
- return new Annotation[0];
+ return toJava().getAnnotations();
}
@Override
public Annotation[] getDeclaredAnnotations() {
- Field javaField = toJava();
- if (javaField != null) {
- return javaField.getDeclaredAnnotations();
+ if (!hasAnnotations()) {
+ return new Annotation[0];
}
- return new Annotation[0];
+ return toJava().getDeclaredAnnotations();
}
@Override
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
- Field javaField = toJava();
- if (javaField != null) {
- return javaField.getAnnotation(annotationClass);
+ if (!hasAnnotations()) {
+ return null;
}
- return null;
+ return toJava().getAnnotation(annotationClass);
}
+ /**
+ * Gets a {@link Field} object corresponding to this object. This method always returns the same
+ * {@link Field} object for a given {@link HotSpotResolvedJavaFieldImpl}. This ensures
+ * {@link #getDeclaredAnnotations()}, {@link #getAnnotations()} and
+ * {@link #getAnnotation(Class)} are stable with respect to the identity of the
+ * {@link Annotation} objects they return.
+ */
private Field toJava() {
- if (isInternal()) {
- return null;
- }
- try {
- return holder.mirror().getDeclaredField(getName());
- } catch (NoSuchFieldException e) {
- return null;
+ synchronized (holder) {
+ HashMap<HotSpotResolvedJavaFieldImpl, Field> cache = holder.reflectionFieldCache;
+ if (cache == null) {
+ cache = new HashMap<>();
+ holder.reflectionFieldCache = cache;
+ }
+ Field reflect = cache.get(this);
+ if (reflect == null) {
+ reflect = compilerToVM().asReflectionField(holder, index);
+ cache.put(this, reflect);
+ }
+ return reflect;
}
}
}
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -33,10 +33,8 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Executable;
-import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -54,7 +52,6 @@
import jdk.vm.ci.meta.ProfilingInfo;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.vm.ci.meta.Signature;
import jdk.vm.ci.meta.SpeculationLog;
import jdk.vm.ci.meta.TriState;
@@ -75,11 +72,9 @@
private byte[] code;
/**
- * Cache for {@link #toJava()}. Set to {@link #signature} when resolving reflection object fails
- * due to reflection filtering (see {@code Reflection.fieldFilterMap} and
- * {@code Reflection.methodFilterMap}).
+ * Cache for {@link #toJava()}.
*/
- private Object toJavaCache;
+ private volatile Executable toJavaCache;
/**
* Only 30% of {@link HotSpotResolvedJavaMethodImpl}s have their name accessed so compute it
@@ -492,12 +487,10 @@
@Override
public Parameter[] getParameters() {
- Executable javaMethod = toJava();
- if (javaMethod == null) {
- return null;
+ if (signature.getParameterCount(false) == 0) {
+ return new ResolvedJavaMethod.Parameter[0];
}
-
- java.lang.reflect.Parameter[] javaParameters = javaMethod.getParameters();
+ java.lang.reflect.Parameter[] javaParameters = toJava().getParameters();
Parameter[] res = new Parameter[javaParameters.length];
for (int i = 0; i < res.length; i++) {
java.lang.reflect.Parameter src = javaParameters[i];
@@ -509,32 +502,34 @@
@Override
public Annotation[][] getParameterAnnotations() {
- Executable javaMethod = toJava();
- return javaMethod == null ? new Annotation[signature.getParameterCount(false)][0] : javaMethod.getParameterAnnotations();
+ if ((getConstMethodFlags() & config().constMethodHasParameterAnnotations) == 0) {
+ return new Annotation[signature.getParameterCount(false)][0];
+ }
+ return toJava().getParameterAnnotations();
}
@Override
public Annotation[] getAnnotations() {
- Executable javaMethod = toJava();
- if (javaMethod != null) {
- return javaMethod.getAnnotations();
+ if ((getConstMethodFlags() & config().constMethodHasMethodAnnotations) == 0) {
+ return new Annotation[0];
}
- return new Annotation[0];
+ return toJava().getAnnotations();
}
@Override
public Annotation[] getDeclaredAnnotations() {
- Executable javaMethod = toJava();
- if (javaMethod != null) {
- return javaMethod.getDeclaredAnnotations();
+ if ((getConstMethodFlags() & config().constMethodHasMethodAnnotations) == 0) {
+ return new Annotation[0];
}
- return new Annotation[0];
+ return toJava().getDeclaredAnnotations();
}
@Override
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
- Executable javaMethod = toJava();
- return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass);
+ if ((getConstMethodFlags() & config().constMethodHasMethodAnnotations) == 0) {
+ return null;
+ }
+ return toJava().getAnnotation(annotationClass);
}
@Override
@@ -561,60 +556,22 @@
@Override
public Type[] getGenericParameterTypes() {
- Executable javaMethod = toJava();
- return javaMethod == null ? null : javaMethod.getGenericParameterTypes();
- }
-
- public Class<?>[] signatureToTypes() {
- Signature sig = getSignature();
- int count = sig.getParameterCount(false);
- Class<?>[] result = new Class<?>[count];
- for (int i = 0; i < result.length; ++i) {
- JavaType parameterType = sig.getParameterType(i, holder);
- HotSpotResolvedJavaType resolvedParameterType = (HotSpotResolvedJavaType) parameterType.resolve(holder);
- result[i] = resolvedParameterType.mirror();
+ if (isClassInitializer()) {
+ return new Type[0];
}
- return result;
- }
-
- private static Method searchMethods(Method[] methods, String name, Class<?> returnType, Class<?>[] parameterTypes) {
- for (Method m : methods) {
- if (m.getName().equals(name) && returnType.equals(m.getReturnType()) && Arrays.equals(m.getParameterTypes(), parameterTypes)) {
- return m;
- }
- }
- return null;
+ return toJava().getGenericParameterTypes();
}
private Executable toJava() {
- if (toJavaCache != null) {
- if (toJavaCache == signature) {
- return null;
- }
- return (Executable) toJavaCache;
- }
- Class<?>[] parameterTypes = signatureToTypes();
- Class<?> returnType = ((HotSpotResolvedJavaType) getSignature().getReturnType(holder).resolve(holder)).mirror();
-
- Executable result;
- if (isConstructor()) {
- try {
- result = holder.mirror().getDeclaredConstructor(parameterTypes);
- } catch (NoSuchMethodException e) {
- toJavaCache = signature;
- return null;
- }
- } else {
- // Do not use Method.getDeclaredMethod() as it can return a bridge method
- // when this.isBridge() is false and vice versa.
- result = searchMethods(holder.mirror().getDeclaredMethods(), getName(), returnType, parameterTypes);
- if (result == null) {
- toJavaCache = signature;
- return null;
+ if (toJavaCache == null) {
+ assert !isClassInitializer() : this;
+ synchronized (this) {
+ if (toJavaCache == null) {
+ toJavaCache = compilerToVM().asReflectionExecutable(this);
+ }
}
}
- toJavaCache = result;
- return result;
+ return toJavaCache;
}
@Override
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -33,6 +33,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.ByteOrder;
@@ -75,6 +76,11 @@
private HotSpotResolvedObjectType arrayOfType;
/**
+ * Managed exclusively by {@link HotSpotResolvedJavaFieldImpl#toJava}.
+ */
+ HashMap<HotSpotResolvedJavaFieldImpl, Field> reflectionFieldCache;
+
+ /**
* Gets the JVMCI mirror for a {@link Class} object.
*
* @return the {@link HotSpotResolvedJavaType} corresponding to {@code javaClass}
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Fri Nov 23 09:12:00 2018 -0500
@@ -94,6 +94,7 @@
final int instanceKlassInitStateOffset = getFieldOffset("InstanceKlass::_init_state", Integer.class, "u1");
final int instanceKlassConstantsOffset = getFieldOffset("InstanceKlass::_constants", Integer.class, "ConstantPool*");
final int instanceKlassFieldsOffset = getFieldOffset("InstanceKlass::_fields", Integer.class, "Array<u2>*");
+ final int instanceKlassAnnotationsOffset = getFieldOffset("InstanceKlass::_annotations", Integer.class, "Annotations*");
final int instanceKlassMiscFlagsOffset = getFieldOffset("InstanceKlass::_misc_flags", Integer.class, "u2");
final int klassVtableStartOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_start_offset", Integer.class, "int");
final int klassVtableLengthOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_length_offset", Integer.class, "int");
@@ -102,6 +103,9 @@
final int instanceKlassStateFullyInitialized = getConstant("InstanceKlass::fully_initialized", Integer.class);
final int instanceKlassMiscIsUnsafeAnonymous = getConstant("InstanceKlass::_misc_is_unsafe_anonymous", Integer.class);
+ final int annotationsFieldAnnotationsOffset = getFieldOffset("Annotations::_fields_annotations", Integer.class, "Array<AnnotationArray*>*");
+ final int fieldsAnnotationsBaseOffset = getFieldValue("CompilerToVM::Data::_fields_annotations_base_offset", Integer.class, "int");
+
final int arrayU1LengthOffset = getFieldOffset("Array<int>::_length", Integer.class, "int");
final int arrayU1DataOffset = getFieldOffset("Array<u1>::_data", Integer.class);
final int arrayU2DataOffset = getFieldOffset("Array<u2>::_data", Integer.class);
@@ -195,6 +199,8 @@
final int constMethodHasLineNumberTable = getConstant("ConstMethod::_has_linenumber_table", Integer.class);
final int constMethodHasLocalVariableTable = getConstant("ConstMethod::_has_localvariable_table", Integer.class);
+ final int constMethodHasMethodAnnotations = getConstant("ConstMethod::_has_method_annotations", Integer.class);
+ final int constMethodHasParameterAnnotations = getConstant("ConstMethod::_has_parameter_annotations", Integer.class);
final int constMethodHasExceptionTable = getConstant("ConstMethod::_has_exception_table", Integer.class);
final int exceptionTableElementSize = getFieldValue("CompilerToVM::Data::sizeof_ExceptionTableElement", Integer.class, "int");
@@ -244,8 +250,6 @@
final int heapWordSize = getConstant("HeapWordSize", Integer.class);
- final int symbolPointerSize = getFieldValue("CompilerToVM::Data::sizeof_SymbolPointer", Integer.class, "int");
-
final long vmSymbolsSymbols = getFieldAddress("vmSymbols::_symbols[0]", "Symbol*");
final int vmSymbolsFirstSID = getConstant("vmSymbols::FIRST_SID", Integer.class);
final int vmSymbolsSIDLimit = getConstant("vmSymbols::SID_LIMIT", Integer.class);
@@ -263,8 +267,7 @@
String symbolAt(int index) {
HotSpotJVMCIRuntime runtime = runtime();
assert vmSymbolsFirstSID <= index && index < vmSymbolsSIDLimit : "index " + index + " is out of bounds";
- assert symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken";
- int offset = index * symbolPointerSize;
+ int offset = index * Unsafe.ADDRESS_SIZE;
return runtime.getCompilerToVM().getSymbol(UNSAFE.getAddress(vmSymbolsSymbols + offset));
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -440,7 +440,7 @@
if (!configuration.packages.isEmpty()) {
SearchIndexItem si = new SearchIndexItem();
si.setCategory(resources.getText("doclet.Packages"));
- si.setLabel(configuration.getText("doclet.All_Packages"));
+ si.setLabel(resources.getText("doclet.All_Packages"));
si.setUrl(DocPaths.ALLPACKAGES_INDEX.getPath());
configuration.packageSearchIndex.add(si);
}
@@ -448,7 +448,7 @@
DocPaths.PACKAGE_SEARCH_INDEX_JS, configuration.packageSearchIndex, "packageSearchIndex");
SearchIndexItem si = new SearchIndexItem();
si.setCategory(resources.getText("doclet.Types"));
- si.setLabel(configuration.getText("doclet.All_Classes"));
+ si.setLabel(resources.getText("doclet.All_Classes"));
si.setUrl(DocPaths.ALLCLASSES_INDEX.getPath());
configuration.typeSearchIndex.add(si);
createSearchIndexFile(DocPaths.TYPE_SEARCH_INDEX_JSON, DocPaths.TYPE_SEARCH_INDEX_ZIP,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -326,7 +326,7 @@
} else if (utils.isPrivate(member)) {
code.addContent("private ");
} else if (!utils.isPublic(member)) { // Package private
- code.addContent(configuration.getText("doclet.Package_private"));
+ code.addContent(resources.getText("doclet.Package_private"));
code.addContent(" ");
}
boolean isAnnotatedTypeElement = utils.isAnnotationType(member.getEnclosingElement());
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -129,7 +129,7 @@
* @throws DocFileIOException if there is a problem building the module index file
*/
protected void buildModuleIndexFile(String title, boolean includeScript) throws DocFileIOException {
- String windowOverview = configuration.getText(title);
+ String windowOverview = resources.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
Content header = createTagIfAllowed(HtmlTag.HEADER, HtmlTree::HEADER, ContentBuilder::new);
addNavigationBarHeader(header);
@@ -158,7 +158,7 @@
*/
protected void buildModulePackagesIndexFile(String title,
boolean includeScript, ModuleElement mdle) throws DocFileIOException {
- String windowOverview = configuration.getText(title);
+ String windowOverview = resources.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
Content header = createTagIfAllowed(HtmlTag.HEADER, HtmlTree::HEADER, ContentBuilder::new);
addNavigationBarHeader(header);
@@ -190,9 +190,9 @@
*/
protected void addIndex(Content header, Content main) {
addIndexContents(configuration.modules, "doclet.Module_Summary",
- configuration.getText("doclet.Member_Table_Summary",
- configuration.getText("doclet.Module_Summary"),
- configuration.getText("doclet.modules")), header, main);
+ resources.getText("doclet.Member_Table_Summary",
+ resources.getText("doclet.Module_Summary"),
+ resources.getText("doclet.modules")), header, main);
}
/**
@@ -204,9 +204,9 @@
*/
protected void addModulePackagesIndex(Content header, Content main, ModuleElement mdle) {
addModulePackagesIndexContents("doclet.Module_Summary",
- configuration.getText("doclet.Member_Table_Summary",
- configuration.getText("doclet.Module_Summary"),
- configuration.getText("doclet.modules")), header, main, mdle);
+ resources.getText("doclet.Member_Table_Summary",
+ resources.getText("doclet.Module_Summary"),
+ resources.getText("doclet.modules")), header, main, mdle);
}
/**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -114,7 +114,7 @@
* @throws DocFileIOException if there is a problem building the package index file
*/
protected void buildPackageIndexFile(String title, boolean includeScript) throws DocFileIOException {
- String windowOverview = configuration.getText(title);
+ String windowOverview = resources.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
Content header = createTagIfAllowed(HtmlTag.HEADER, HtmlTree::HEADER, ContentBuilder::new);
addNavigationBarHeader(header);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -110,7 +110,7 @@
* @param wantFrames True if we want frames.
*/
protected void buildAllClassesFile(boolean wantFrames) throws DocFileIOException {
- String label = configuration.getText("doclet.All_Classes");
+ String label = resources.getText("doclet.All_Classes");
Content body = getBody(false, getWindowTitle(label));
Content htmlTree = createTagIfAllowed(HtmlTag.MAIN, HtmlTree::MAIN, ContentBuilder::new);
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -101,7 +101,7 @@
* Print all the classes in the file.
*/
protected void buildAllClassesFile() throws DocFileIOException {
- String label = configuration.getText("doclet.All_Classes");
+ String label = resources.getText("doclet.All_Classes");
HtmlTree bodyTree = getBody(true, getWindowTitle(label));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -83,7 +83,7 @@
* Print all the packages in the file.
*/
protected void buildAllPackagesFile() throws DocFileIOException {
- String label = configuration.getText("doclet.All_Packages");
+ String label = resources.getText("doclet.All_Packages");
HtmlTree bodyTree = getBody(true, getWindowTitle(label));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -399,67 +399,67 @@
LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement));
Content pkgLink = getPackageLink(pkg, utils.getPackageName(pkg));
classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg),
- configuration.getContent("doclet.ClassUse_Annotation", classLink,
+ contents.getContent("doclet.ClassUse_Annotation", classLink,
pkgLink), classUseTableSummary, contentTree);
classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg),
- configuration.getContent("doclet.ClassUse_TypeParameter", classLink,
+ contents.getContent("doclet.ClassUse_TypeParameter", classLink,
pkgLink), classUseTableSummary, contentTree);
classSubWriter.addUseInfo(pkgToSubclass.get(pkg),
- configuration.getContent("doclet.ClassUse_Subclass", classLink,
+ contents.getContent("doclet.ClassUse_Subclass", classLink,
pkgLink), subclassUseTableSummary, contentTree);
classSubWriter.addUseInfo(pkgToSubinterface.get(pkg),
- configuration.getContent("doclet.ClassUse_Subinterface", classLink,
+ contents.getContent("doclet.ClassUse_Subinterface", classLink,
pkgLink), subinterfaceUseTableSummary, contentTree);
classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg),
- configuration.getContent("doclet.ClassUse_ImplementingClass", classLink,
+ contents.getContent("doclet.ClassUse_ImplementingClass", classLink,
pkgLink), classUseTableSummary, contentTree);
fieldSubWriter.addUseInfo(pkgToField.get(pkg),
- configuration.getContent("doclet.ClassUse_Field", classLink,
+ contents.getContent("doclet.ClassUse_Field", classLink,
pkgLink), fieldUseTableSummary, contentTree);
fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg),
- configuration.getContent("doclet.ClassUse_FieldAnnotations", classLink,
+ contents.getContent("doclet.ClassUse_FieldAnnotations", classLink,
pkgLink), fieldUseTableSummary, contentTree);
fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg),
- configuration.getContent("doclet.ClassUse_FieldTypeParameter", classLink,
+ contents.getContent("doclet.ClassUse_FieldTypeParameter", classLink,
pkgLink), fieldUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg),
- configuration.getContent("doclet.ClassUse_MethodAnnotations", classLink,
+ contents.getContent("doclet.ClassUse_MethodAnnotations", classLink,
pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg),
- configuration.getContent("doclet.ClassUse_MethodParameterAnnotations", classLink,
+ contents.getContent("doclet.ClassUse_MethodParameterAnnotations", classLink,
pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg),
- configuration.getContent("doclet.ClassUse_MethodTypeParameter", classLink,
+ contents.getContent("doclet.ClassUse_MethodTypeParameter", classLink,
pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg),
- configuration.getContent("doclet.ClassUse_MethodReturn", classLink,
+ contents.getContent("doclet.ClassUse_MethodReturn", classLink,
pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg),
- configuration.getContent("doclet.ClassUse_MethodReturnTypeParameter", classLink,
+ contents.getContent("doclet.ClassUse_MethodReturnTypeParameter", classLink,
pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg),
- configuration.getContent("doclet.ClassUse_MethodArgs", classLink,
+ contents.getContent("doclet.ClassUse_MethodArgs", classLink,
pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg),
- configuration.getContent("doclet.ClassUse_MethodArgsTypeParameters", classLink,
+ contents.getContent("doclet.ClassUse_MethodArgsTypeParameters", classLink,
pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg),
- configuration.getContent("doclet.ClassUse_MethodThrows", classLink,
+ contents.getContent("doclet.ClassUse_MethodThrows", classLink,
pkgLink), methodUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg),
- configuration.getContent("doclet.ClassUse_ConstructorAnnotations", classLink,
+ contents.getContent("doclet.ClassUse_ConstructorAnnotations", classLink,
pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg),
- configuration.getContent("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
+ contents.getContent("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg),
- configuration.getContent("doclet.ClassUse_ConstructorArgs", classLink,
+ contents.getContent("doclet.ClassUse_ConstructorArgs", classLink,
pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg),
- configuration.getContent("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
+ contents.getContent("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg),
- configuration.getContent("doclet.ClassUse_ConstructorThrows", classLink,
+ contents.getContent("doclet.ClassUse_ConstructorThrows", classLink,
pkgLink), constructorUseTableSummary, contentTree);
}
@@ -469,11 +469,11 @@
* @return a content tree representing the class use header
*/
protected HtmlTree getClassUseHeader() {
- String cltype = configuration.getText(utils.isInterface(typeElement)
+ String cltype = resources.getText(utils.isInterface(typeElement)
? "doclet.Interface"
: "doclet.Class");
String clname = utils.getFullyQualifiedName(typeElement);
- String title = configuration.getText("doclet.Window_ClassUse_Header",
+ String title = resources.getText("doclet.Window_ClassUse_Header",
cltype, clname);
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
@@ -485,7 +485,7 @@
navBar.setNavLinkModule(mdleLinkContent);
Content classLinkContent = getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement)
- .label(configuration.getText("doclet.Class")));
+ .label(resources.getText("doclet.Class")));
navBar.setNavLinkClass(classLinkContent);
navBar.setUserHeader(getUserHeaderFooter(true));
htmlTree.addContent(navBar.getContent(true));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -97,8 +97,8 @@
public ConstantsSummaryWriterImpl(HtmlConfiguration configuration) {
super(configuration, DocPaths.CONSTANT_VALUES);
this.configuration = configuration;
- constantsTableSummary = configuration.getText("doclet.Constants_Table_Summary",
- configuration.getText("doclet.Constants_Summary"));
+ constantsTableSummary = resources.getText("doclet.Constants_Table_Summary",
+ resources.getText("doclet.Constants_Summary"));
constantsTableHeader = new TableHeader(
contents.modifierAndTypeLabel, contents.constantFieldLabel, contents.valueLabel);
this.navBar = new Navigation(null, configuration, fixedNavDiv, PageMode.CONSTANTVALUES, path);
@@ -109,7 +109,7 @@
*/
@Override
public Content getHeader() {
- String label = configuration.getText("doclet.Constants_Summary");
+ String label = resources.getText("doclet.Constants_Summary");
HtmlTree bodyTree = getBody(true, getWindowTitle(label));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -308,7 +308,7 @@
code.addContent(Contents.SPACE);
} else {
code.addContent(
- configuration.getText("doclet.Package_private"));
+ resources.getText("doclet.Package_private"));
}
tdSummaryType.addContent(code);
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -378,7 +378,7 @@
* @return a content tree for the header
*/
public HtmlTree getHeader() {
- String title = configuration.getText("doclet.Window_Deprecated_List");
+ String title = resources.getText("doclet.Window_Deprecated_List");
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -249,12 +249,12 @@
Content label;
if (configuration.summarizeOverriddenMethods) {
label = new StringContent(utils.isClass(typeElement)
- ? configuration.getText("doclet.Fields_Declared_In_Class")
- : configuration.getText("doclet.Fields_Declared_In_Interface"));
+ ? resources.getText("doclet.Fields_Declared_In_Class")
+ : resources.getText("doclet.Fields_Declared_In_Interface"));
} else {
label = new StringContent(utils.isClass(typeElement)
- ? configuration.getText("doclet.Fields_Inherited_From_Class")
- : configuration.getText("doclet.Fields_Inherited_From_Interface"));
+ ? resources.getText("doclet.Fields_Inherited_From_Class")
+ : resources.getText("doclet.Fields_Inherited_From_Interface"));
}
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
label);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -115,7 +115,7 @@
if (configuration.windowtitle.length() > 0) {
printFramesDocument(configuration.windowtitle, body);
} else {
- printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"), body);
+ printFramesDocument(resources.getText("doclet.Generated_Docs_Untitled"), body);
}
}
@@ -172,7 +172,7 @@
*/
private void addAllModulesFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.IFRAME(DocPaths.MODULE_OVERVIEW_FRAME.getPath(),
- "packageListFrame", configuration.getText("doclet.All_Modules"));
+ "packageListFrame", resources.getText("doclet.All_Modules"));
HtmlTree leftTop = HtmlTree.DIV(HtmlStyle.leftTop, frame);
contentTree.addContent(leftTop);
}
@@ -184,7 +184,7 @@
*/
private void addAllPackagesFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.IFRAME(DocPaths.OVERVIEW_FRAME.getPath(),
- "packageListFrame", configuration.getText("doclet.All_Packages"));
+ "packageListFrame", resources.getText("doclet.All_Packages"));
HtmlTree leftTop = HtmlTree.DIV(HtmlStyle.leftTop, frame);
contentTree.addContent(leftTop);
}
@@ -196,7 +196,7 @@
*/
private void addAllClassesFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.IFRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
- "packageFrame", configuration.getText("doclet.All_classes_and_interfaces"));
+ "packageFrame", resources.getText("doclet.All_classes_and_interfaces"));
HtmlTree leftBottom = HtmlTree.DIV(HtmlStyle.leftBottom, frame);
contentTree.addContent(leftBottom);
}
@@ -208,7 +208,7 @@
*/
private void addClassFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.IFRAME(configuration.topFile.getPath(), "classFrame",
- configuration.getText("doclet.Package_class_and_interface_descriptions"));
+ resources.getText("doclet.Package_class_and_interface_descriptions"));
frame.setStyle(HtmlStyle.rightIframe);
contentTree.addContent(frame);
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -87,7 +87,7 @@
* @throws DocFileIOException if there is a problem while generating the documentation
*/
protected void generateHelpFile() throws DocFileIOException {
- String title = configuration.getText("doclet.Window_Help_title");
+ String title = resources.getText("doclet.Window_Help_title");
HtmlTree body = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
@@ -314,7 +314,7 @@
: HtmlTree.LI(HtmlStyle.blockList, treeHead);
Content treeIntro = contents.getContent("doclet.help.tree.intro",
links.createLink(DocPaths.OVERVIEW_TREE,
- configuration.getText("doclet.Class_Hierarchy")),
+ resources.getText("doclet.Class_Hierarchy")),
HtmlTree.CODE(new StringContent("java.lang.Object")));
Content treePara = HtmlTree.P(treeIntro);
htmlTree.addContent(treePara);
@@ -338,7 +338,7 @@
: HtmlTree.LI(HtmlStyle.blockList, dHead);
Content deprBody = contents.getContent("doclet.help.deprecated.body",
links.createLink(DocPaths.DEPRECATED_LIST,
- configuration.getText("doclet.Deprecated_API")));
+ resources.getText("doclet.Deprecated_API")));
Content dPara = HtmlTree.P(deprBody);
htmlTree.addContent(dPara);
if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -353,10 +353,10 @@
Content indexlink;
if (configuration.splitindex) {
indexlink = links.createLink(DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)),
- configuration.getText("doclet.Index"));
+ resources.getText("doclet.Index"));
} else {
indexlink = links.createLink(DocPaths.INDEX_ALL,
- configuration.getText("doclet.Index"));
+ resources.getText("doclet.Index"));
}
Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
contents.getContent("doclet.help.index.head"));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Fri Nov 23 09:12:00 2018 -0500
@@ -288,6 +288,10 @@
return resources;
}
+ public Contents getContents() {
+ return contents;
+ }
+
@Override
public Messages getMessages() {
return messages;
@@ -307,7 +311,7 @@
if (!helpfile.isEmpty()) {
DocFile help = DocFile.createFileForInput(this, helpfile);
if (!help.exists()) {
- reporter.print(ERROR, getText("doclet.File_not_found", helpfile));
+ reporter.print(ERROR, resources.getText("doclet.File_not_found", helpfile));
return false;
}
}
@@ -315,7 +319,7 @@
if (!stylesheetfile.isEmpty()) {
DocFile stylesheet = DocFile.createFileForInput(this, stylesheetfile);
if (!stylesheet.exists()) {
- reporter.print(ERROR, getText("doclet.File_not_found", stylesheetfile));
+ reporter.print(ERROR, resources.getText("doclet.File_not_found", stylesheetfile));
return false;
}
}
@@ -323,7 +327,7 @@
for (String ssheet : additionalStylesheets) {
DocFile ssfile = DocFile.createFileForInput(this, ssheet);
if (!ssfile.exists()) {
- reporter.print(ERROR, getText("doclet.File_not_found", ssheet));
+ reporter.print(ERROR, resources.getText("doclet.File_not_found", ssheet));
return false;
}
}
@@ -505,63 +509,6 @@
return (e == null || workArounds.haveDocLint());
}
- @Override
- public String getText(String key) {
- return resources.getText(key);
- }
-
- @Override
- public String getText(String key, String... args) {
- return resources.getText(key, (Object[]) args);
- }
-
- /**
- * {@inheritdoc}
- */
- @Override
- public Content getContent(String key) {
- return contents.getContent(key);
- }
-
- /**
- * Get the configuration string as a content.
- *
- * @param key the key to look for in the configuration file
- * @param o string or content argument added to configuration text
- * @return a content tree for the text
- */
- @Override
- public Content getContent(String key, Object o) {
- return contents.getContent(key, o);
- }
-
- /**
- * Get the configuration string as a content.
- *
- * @param key the key to look for in the configuration file
- * @param o1 resource argument
- * @param o2 resource argument
- * @return a content tree for the text
- */
- @Override
- public Content getContent(String key, Object o1, Object o2) {
- return contents.getContent(key, o1, o2);
- }
-
- /**
- * Get the configuration string as a content.
- *
- * @param key the key to look for in the configuration file
- * @param o0 string or content argument added to configuration text
- * @param o1 string or content argument added to configuration text
- * @param o2 string or content argument added to configuration text
- * @return a content tree for the text
- */
- @Override
- public Content getContent(String key, Object o0, Object o1, Object o2) {
- return contents.getContent(key, o0, o1, o2);
- }
-
protected void buildSearchTagIndex() {
for (SearchIndexItem sii : tagSearchIndex) {
String tagLabel = sii.getLabel();
@@ -628,12 +575,12 @@
@Override
public boolean process(String opt, List<String> args) {
if (nohelp == true) {
- reporter.print(ERROR, getText("doclet.Option_conflict",
+ reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-helpfile", "-nohelp"));
return false;
}
if (!helpfile.isEmpty()) {
- reporter.print(ERROR, getText("doclet.Option_reuse",
+ reporter.print(ERROR, resources.getText("doclet.Option_reuse",
"-helpfile"));
return false;
}
@@ -644,7 +591,7 @@
new Option(resources, "-html4") {
@Override
public boolean process(String opt, List<String> args) {
- reporter.print(WARNING, getText("doclet.HTML_4_specified", helpfile));
+ reporter.print(WARNING, resources.getText("doclet.HTML_4_specified", helpfile));
htmlVersion = HtmlVersion.HTML4;
return true;
}
@@ -661,7 +608,7 @@
public boolean process(String opt, List<String> args) {
nohelp = true;
if (!helpfile.isEmpty()) {
- reporter.print(ERROR, getText("doclet.Option_conflict",
+ reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-nohelp", "-helpfile"));
return false;
}
@@ -680,7 +627,7 @@
public boolean process(String opt, List<String> args) {
createindex = false;
if (splitindex == true) {
- reporter.print(ERROR, getText("doclet.Option_conflict",
+ reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-noindex", "-splitindex"));
return false;
}
@@ -699,7 +646,7 @@
public boolean process(String opt, List<String> args) {
nooverview = true;
if (overviewpath != null) {
- reporter.print(ERROR, getText("doclet.Option_conflict",
+ reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-nooverview", "-overview"));
return false;
}
@@ -718,7 +665,7 @@
public boolean process(String opt, List<String> args) {
overviewpath = args.get(0);
if (nooverview == true) {
- reporter.print(ERROR, getText("doclet.Option_conflict",
+ reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-overview", "-nooverview"));
return false;
}
@@ -728,7 +675,7 @@
new Option(resources, "--frames") {
@Override
public boolean process(String opt, List<String> args) {
- reporter.print(WARNING, getText("doclet.Frames_specified", helpfile));
+ reporter.print(WARNING, resources.getText("doclet.Frames_specified", helpfile));
frames = true;
return true;
}
@@ -752,7 +699,7 @@
public boolean process(String opt, List<String> args) {
splitindex = true;
if (createindex == false) {
- reporter.print(ERROR, getText("doclet.Option_conflict",
+ reporter.print(ERROR, resources.getText("doclet.Option_conflict",
"-splitindex", "-noindex"));
return false;
}
@@ -801,7 +748,7 @@
try {
URL ignored = new URL(docrootparent);
} catch (MalformedURLException e) {
- reporter.print(ERROR, getText("doclet.MalformedURL", docrootparent));
+ reporter.print(ERROR, resources.getText("doclet.MalformedURL", docrootparent));
return false;
}
return true;
@@ -813,11 +760,11 @@
String dopt = opt.replace("-Xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX);
doclintOpts.put(this, dopt);
if (dopt.contains("/")) {
- reporter.print(ERROR, getText("doclet.Option_doclint_no_qualifiers"));
+ reporter.print(ERROR, resources.getText("doclet.Option_doclint_no_qualifiers"));
return false;
}
if (!DocLint.isValidOption(dopt)) {
- reporter.print(ERROR, getText("doclet.Option_doclint_invalid_arg"));
+ reporter.print(ERROR, resources.getText("doclet.Option_doclint_invalid_arg"));
return false;
}
return true;
@@ -829,7 +776,7 @@
String dopt = opt.replace("-Xdoclint/package:", DocLint.XCHECK_PACKAGE);
doclintOpts.put(this, dopt);
if (!DocLint.isValidOption(dopt)) {
- reporter.print(ERROR, getText("doclet.Option_doclint_package_invalid_arg"));
+ reporter.print(ERROR, resources.getText("doclet.Option_doclint_package_invalid_arg"));
return false;
}
return true;
@@ -854,7 +801,7 @@
if (charset == null) {
charset = docencoding;
} else if (!charset.equals(docencoding)) {
- reporter.print(ERROR, getText("doclet.Option_conflict", "-charset", "-docencoding"));
+ reporter.print(ERROR, resources.getText("doclet.Option_conflict", "-charset", "-docencoding"));
return false;
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -297,12 +297,12 @@
Content label;
if (configuration.summarizeOverriddenMethods) {
label = new StringContent(utils.isClass(typeElement)
- ? configuration.getText("doclet.Methods_Declared_In_Class")
- : configuration.getText("doclet.Methods_Declared_In_Interface"));
+ ? resources.getText("doclet.Methods_Declared_In_Class")
+ : resources.getText("doclet.Methods_Declared_In_Interface"));
} else {
label = new StringContent(utils.isClass(typeElement)
- ? configuration.getText("doclet.Methods_Inherited_From_Class")
- : configuration.getText("doclet.Methods_Inherited_From_Interface"));
+ ? resources.getText("doclet.Methods_Inherited_From_Class")
+ : resources.getText("doclet.Methods_Inherited_From_Interface"));
}
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
label);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -118,8 +118,8 @@
= configuration.group.groupModules(configuration.modules);
if (!groupModuleMap.keySet().isEmpty()) {
- String tableSummary = configuration.getText("doclet.Member_Table_Summary",
- configuration.getText("doclet.Module_Summary"), configuration.getText("doclet.modules"));
+ String tableSummary = resources.getText("doclet.Member_Table_Summary",
+ resources.getText("doclet.Module_Summary"), resources.getText("doclet.modules"));
TableHeader header = new TableHeader(contents.moduleLabel, contents.descriptionLabel);
Table table = new Table(configuration.htmlVersion, HtmlStyle.overviewSummary)
.setSummary(tableSummary)
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -538,7 +538,7 @@
String amrText = resources.getText("doclet.Indirect_Requires_Summary");
String amrTableSummary = resources.getText("doclet.Member_Table_Summary",
amrText,
- configuration.getText("doclet.modules"));
+ resources.getText("doclet.modules"));
Content amrCaption = getTableCaption(new StringContent(amrText));
Table amrTable = getTable3(amrCaption, amrTableSummary, HtmlStyle.requiresSummary,
requiresTableHeader);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -153,12 +153,12 @@
Content label;
if (configuration.summarizeOverriddenMethods) {
label = new StringContent(utils.isInterface(typeElement)
- ? configuration.getText("doclet.Nested_Classes_Interfaces_Declared_In_Interface")
- : configuration.getText("doclet.Nested_Classes_Interfaces_Declared_In_Class"));
+ ? resources.getText("doclet.Nested_Classes_Interfaces_Declared_In_Interface")
+ : resources.getText("doclet.Nested_Classes_Interfaces_Declared_In_Class"));
} else {
label = new StringContent(utils.isInterface(typeElement)
- ? configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Interface")
- : configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
+ ? resources.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Interface")
+ : resources.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
}
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
label);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -102,8 +102,8 @@
= configuration.group.groupPackages(packages);
if (!groupPackageMap.keySet().isEmpty()) {
- String tableSummary = configuration.getText("doclet.Member_Table_Summary",
- configuration.getText("doclet.Package_Summary"), configuration.getText("doclet.packages"));
+ String tableSummary = resources.getText("doclet.Member_Table_Summary",
+ resources.getText("doclet.Package_Summary"), resources.getText("doclet.packages"));
Table table = new Table(configuration.htmlVersion, HtmlStyle.overviewSummary)
.setSummary(tableSummary)
.setHeader(getPackageTableHeader())
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -139,7 +139,7 @@
*/
protected HtmlTree getPackageTreeHeader() {
String packageName = packageElement.isUnnamed() ? "" : utils.getPackageName(packageElement);
- String title = packageName + " " + configuration.getText("doclet.Window_Class_Hierarchy");
+ String title = packageName + " " + resources.getText("doclet.Window_Class_Hierarchy");
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
@@ -167,7 +167,7 @@
div.addContent(span);
HtmlTree ul = new HtmlTree (HtmlTag.UL);
ul.setStyle(HtmlStyle.horizontal);
- ul.addContent(getNavLinkMainTree(configuration.getText("doclet.All_Packages")));
+ ul.addContent(getNavLinkMainTree(resources.getText("doclet.All_Packages")));
div.addContent(ul);
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -183,9 +183,9 @@
//Print the heading.
Content className = superClassLink == null ?
- configuration.getContent(
+ contents.getContent(
"doclet.Class_0_implements_serializable", classLink) :
- configuration.getContent(
+ contents.getContent(
"doclet.Class_0_extends_implements_serializable", classLink,
superClassLink);
li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -91,7 +91,7 @@
* @throws DocFileIOException if there is a problem generating the index
*/
protected void generateIndexFile() throws DocFileIOException {
- String title = configuration.getText("doclet.Window_Single_Index");
+ String title = resources.getText("doclet.Window_Single_Index");
HtmlTree body = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -118,7 +118,7 @@
* @throws DocFileIOException if there is a problem generating an index file
*/
protected void generateIndexFile(Character unicode) throws DocFileIOException {
- String title = configuration.getText("doclet.Window_Split_Index",
+ String title = resources.getText("doclet.Window_Split_Index",
unicode.toString());
HtmlTree body = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Fri Nov 23 09:12:00 2018 -0500
@@ -223,7 +223,7 @@
ContentBuilder result = new ContentBuilder();
CommentHelper ch = utils.getCommentHelper(element);
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.returnLabel,
- new StringContent(configuration.getText("doclet.Returns")))));
+ new StringContent(resources.getText("doclet.Returns")))));
result.addContent(HtmlTree.DD(htmlWriter.commentTagsToContent(
returnTag, element, ch.getDescription(configuration, returnTag), false, inSummary)));
return result;
@@ -249,7 +249,7 @@
utils.getSimpleName(holder);
DocLink link = constantsPath.fragment(whichConstant);
body.addContent(htmlWriter.links.createLink(link,
- new StringContent(configuration.getText("doclet.Constants_Summary"))));
+ new StringContent(resources.getText("doclet.Constants_Summary"))));
}
if (utils.isClass(holder) && utils.isSerializable((TypeElement)holder)) {
//Automatically add link to serialized form page for serializable classes.
@@ -259,7 +259,7 @@
DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM);
DocLink link = serialPath.fragment(utils.getFullyQualifiedName(holder));
body.addContent(htmlWriter.links.createLink(link,
- new StringContent(configuration.getText("doclet.Serialized_Form"))));
+ new StringContent(resources.getText("doclet.Serialized_Form"))));
}
}
if (body.isEmpty())
@@ -267,7 +267,7 @@
ContentBuilder result = new ContentBuilder();
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.seeLabel,
- new StringContent(configuration.getText("doclet.See_Also")))));
+ new StringContent(resources.getText("doclet.See_Also")))));
result.addContent(HtmlTree.DD(body));
return result;
@@ -329,7 +329,7 @@
*/
public Content getThrowsHeader() {
HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.throwsLabel,
- new StringContent(configuration.getText("doclet.Throws"))));
+ new StringContent(resources.getText("doclet.Throws"))));
return result;
}
@@ -461,7 +461,8 @@
return null;
}
}.visit(element);
- si.setCategory(configuration.getContent("doclet.SearchTags").toString());
+ Contents contents = configuration.getContents();
+ si.setCategory(contents.getContent("doclet.SearchTags").toString());
configuration.tagSearchIndex.add(si);
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -185,7 +185,7 @@
* @return a content tree for the tree header
*/
protected HtmlTree getTreeHeader() {
- String title = configuration.getText("doclet.Window_Class_Hierarchy");
+ String title = resources.getText("doclet.Window_Class_Hierarchy");
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java Fri Nov 23 09:12:00 2018 -0500
@@ -147,8 +147,8 @@
this.pathToRoot = path.parent().invert();
this.links = new Links(path, configuration.htmlVersion);
this.topBottomNavContents = new HashMap<>();
- this.rowListTitle = configuration.getText("doclet.Navigation");
- this.searchLabel = configuration.getContent("doclet.search");
+ this.rowListTitle = configuration.getResources().getText("doclet.Navigation");
+ this.searchLabel = contents.getContent("doclet.search");
populateNavContents(Position.TOP);
populateNavContents(Position.BOTTOM);
}
@@ -160,7 +160,7 @@
*/
private void populateNavContents(Position position) {
Deque<Content> queue = new ArrayDeque<>();
- Content skipNavLinks = configuration.getContent("doclet.Skip_navigation_links");
+ Content skipNavLinks = contents.getContent("doclet.Skip_navigation_links");
switch (position) {
case TOP:
queue.addLast(links.createAnchor(SectionName.NAVBAR_TOP));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java Fri Nov 23 09:12:00 2018 -0500
@@ -271,7 +271,7 @@
/**
* The tracker of external package links.
*/
- public final Extern extern = new Extern(this);
+ public Extern extern;
public Reporter reporter;
@@ -648,8 +648,8 @@
summarizeOverriddenMethods = false;
break;
default:
- reporter.print(ERROR, getText("doclet.Option_invalid",
- o, "--override-methods"));
+ reporter.print(ERROR,
+ getResources().getText("doclet.Option_invalid",o, "--override-methods"));
return false;
}
return true;
@@ -769,7 +769,7 @@
* initializes certain components before anything else is started.
*/
protected boolean finishOptionSettings0() throws DocletException {
-
+ extern = new Extern(this);
initDestDirectory();
for (String link : linkList) {
extern.link(link, reporter);
@@ -807,17 +807,18 @@
private void initDestDirectory() throws DocletException {
if (!destDirName.isEmpty()) {
+ Resources resources = getResources();
DocFile destDir = DocFile.createFileForDirectory(this, destDirName);
if (!destDir.exists()) {
//Create the output directory (in case it doesn't exist yet)
- reporter.print(NOTE, getText("doclet.dest_dir_create", destDirName));
+ reporter.print(NOTE, resources.getText("doclet.dest_dir_create", destDirName));
destDir.mkdirs();
} else if (!destDir.isDirectory()) {
- throw new SimpleDocletException(getText(
+ throw new SimpleDocletException(resources.getText(
"doclet.destination_directory_not_directory_0",
destDir.getPath()));
} else if (!destDir.canWrite()) {
- throw new SimpleDocletException(getText(
+ throw new SimpleDocletException(resources.getText(
"doclet.destination_directory_not_writable_0",
destDir.getPath()));
}
@@ -974,7 +975,7 @@
try {
osw = new OutputStreamWriter(ost, docencoding);
} catch (UnsupportedEncodingException exc) {
- reporter.print(ERROR, getText("doclet.Encoding_not_supported", docencoding));
+ reporter.print(ERROR, getResources().getText("doclet.Encoding_not_supported", docencoding));
return false;
} finally {
try {
@@ -1035,72 +1036,6 @@
}
/**
- * Convenience method to obtain a resource from the doclet's
- * {@link Resources resources}.
- * Equivalent to <code>getResources.getText(key);</code>.
- *
- * @param key the key for the desired string
- * @return the string for the given key
- * @throws MissingResourceException if the key is not found in either
- * bundle.
- */
- public abstract String getText(String key);
-
- /**
- * Convenience method to obtain a resource from the doclet's
- * {@link Resources resources}.
- * Equivalent to <code>getResources.getText(key, args);</code>.
- *
- * @param key the key for the desired string
- * @param args values to be substituted into the resulting string
- * @return the string for the given key
- * @throws MissingResourceException if the key is not found in either
- * bundle.
- */
- public abstract String getText(String key, String... args);
-
- /**
- * Convenience method to obtain a resource from the doclet's
- * {@link Resources resources} as a {@code Content} object.
- *
- * @param key the key for the desired string
- * @return a content tree for the text
- */
- public abstract Content getContent(String key);
-
- /**
- * Convenience method to obtain a resource from the doclet's
- * {@link Resources resources} as a {@code Content} object.
- *
- * @param key the key for the desired string
- * @param o string or content argument added to configuration text
- * @return a content tree for the text
- */
- public abstract Content getContent(String key, Object o);
-
- /**
- * Convenience method to obtain a resource from the doclet's
- * {@link Resources resources} as a {@code Content} object.
- *
- * @param key the key for the desired string
- * @param o1 resource argument
- * @param o2 resource argument
- * @return a content tree for the text
- */
- public abstract Content getContent(String key, Object o1, Object o2);
-
- /**
- * Get the configuration string as a content.
- *
- * @param key the key for the desired string
- * @param o0 string or content argument added to configuration text
- * @param o1 string or content argument added to configuration text
- * @param o2 string or content argument added to configuration text
- * @return a content tree for the text
- */
- public abstract Content getContent(String key, Object o0, Object o1, Object o2);
-
- /**
* Return true if the TypeElement element is getting documented, depending upon
* -nodeprecated option and the deprecation information. Return true if
* -nodeprecated is not used. Return false if -nodeprecated is used and if
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java Fri Nov 23 09:12:00 2018 -0500
@@ -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
@@ -65,6 +65,7 @@
public class CommentUtils {
final BaseConfiguration configuration;
+ final Resources resources;
final DocTreeFactory treeFactory;
final HashMap<Element, DocCommentDuo> dcTreesMap = new HashMap<>();
final DocTrees trees;
@@ -72,6 +73,7 @@
protected CommentUtils(BaseConfiguration configuration) {
this.configuration = configuration;
+ resources = configuration.getResources();
trees = configuration.docEnv.getDocTrees();
treeFactory = trees.getDocTreeFactory();
elementUtils = configuration.docEnv.getElementUtils();
@@ -110,15 +112,15 @@
return (DocTree) text;
}
- public void setEnumValuesTree(BaseConfiguration config, Element e) {
- Utils utils = config.utils;
+ public void setEnumValuesTree(Element e) {
+ Utils utils = configuration.utils;
String klassName = utils.getSimpleName(utils.getEnclosingTypeElement(e));
List<DocTree> fullBody = new ArrayList<>();
- fullBody.add(treeFactory.newTextTree(config.getText("doclet.enum_values_doc.fullbody", klassName)));
+ fullBody.add(treeFactory.newTextTree(resources.getText("doclet.enum_values_doc.fullbody", klassName)));
List<DocTree> descriptions = new ArrayList<>();
- descriptions.add(treeFactory.newTextTree(config.getText("doclet.enum_values_doc.return")));
+ descriptions.add(treeFactory.newTextTree(resources.getText("doclet.enum_values_doc.return")));
List<DocTree> tags = new ArrayList<>();
tags.add(treeFactory.newReturnTree(descriptions));
@@ -126,15 +128,15 @@
dcTreesMap.put(e, new DocCommentDuo(null, docTree));
}
- public void setEnumValueOfTree(BaseConfiguration config, Element e) {
+ public void setEnumValueOfTree(Element e) {
List<DocTree> fullBody = new ArrayList<>();
- fullBody.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.fullbody")));
+ fullBody.add(treeFactory.newTextTree(resources.getText("doclet.enum_valueof_doc.fullbody")));
List<DocTree> tags = new ArrayList<>();
List<DocTree> paramDescs = new ArrayList<>();
- paramDescs.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.param_name")));
+ paramDescs.add(treeFactory.newTextTree(resources.getText("doclet.enum_valueof_doc.param_name")));
ExecutableElement ee = (ExecutableElement) e;
java.util.List<? extends VariableElement> parameters = ee.getParameters();
VariableElement param = parameters.get(0);
@@ -142,17 +144,17 @@
tags.add(treeFactory.newParamTree(false, id, paramDescs));
List<DocTree> returnDescs = new ArrayList<>();
- returnDescs.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.return")));
+ returnDescs.add(treeFactory.newTextTree(resources.getText("doclet.enum_valueof_doc.return")));
tags.add(treeFactory.newReturnTree(returnDescs));
List<DocTree> throwsDescs = new ArrayList<>();
- throwsDescs.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.throws_ila")));
+ throwsDescs.add(treeFactory.newTextTree(resources.getText("doclet.enum_valueof_doc.throws_ila")));
ReferenceTree ref = treeFactory.newReferenceTree("java.lang.IllegalArgumentException");
tags.add(treeFactory.newThrowsTree(ref, throwsDescs));
throwsDescs = new ArrayList<>();
- throwsDescs.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.throws_npe")));
+ throwsDescs.add(treeFactory.newTextTree(resources.getText("doclet.enum_valueof_doc.throws_npe")));
ref = treeFactory.newReferenceTree("java.lang.NullPointerException");
tags.add(treeFactory.newThrowsTree(ref, throwsDescs));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -106,7 +106,7 @@
* @throws DocletException if there is a problem building the documentation
*/
protected void buildAnnotationTypeDoc(Content contentTree) throws DocletException {
- contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
+ contentTree = writer.getHeader(resources.getText("doclet.AnnotationType") +
" " + utils.getSimpleName(annotationType));
Content annotationContentTree = writer.getAnnotationContentHeader();
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -135,7 +135,7 @@
} else {
key = "doclet.Class";
}
- contentTree = writer.getHeader(configuration.getText(key) + " "
+ contentTree = writer.getHeader(resources.getText(key) + " "
+ utils.getSimpleName(typeElement));
Content classContentTree = writer.getClassContentHeader();
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java Fri Nov 23 09:12:00 2018 -0500
@@ -358,13 +358,13 @@
//add "[GS]ets the value of the property PROPERTY_NAME."
if (isSetter) {
String text = MessageFormat.format(
- configuration.getText("doclet.PropertySetterWithName"),
+ resources.getText("doclet.PropertySetterWithName"),
utils.propertyName((ExecutableElement)member));
fullBody.addAll(cmtutils.makeFirstSentenceTree(text));
}
if (isGetter) {
String text = MessageFormat.format(
- configuration.getText("doclet.PropertyGetterWithName"),
+ resources.getText("doclet.PropertyGetterWithName"),
utils.propertyName((ExecutableElement) member));
fullBody.addAll(cmtutils.makeFirstSentenceTree(text));
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -147,7 +147,7 @@
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildSerializedForm(Content serializedTree) throws DocletException {
- serializedTree = writer.getHeader(configuration.getText(
+ serializedTree = writer.getHeader(resources.getText(
"doclet.Serialized_Form"));
buildSerializedFormSummaries(serializedTree);
@@ -297,14 +297,14 @@
}
if (!utils.serializationMethods(currentTypeElement).isEmpty()) {
classContentTree.addContent(methodWriter.getSerializableMethods(
- configuration.getText("doclet.Serialized_Form_methods"),
+ resources.getText("doclet.Serialized_Form_methods"),
serializableMethodTree));
if (utils.isSerializable(currentTypeElement) && !utils.isExternalizable(currentTypeElement)) {
if (utils.serializationMethods(currentTypeElement).isEmpty()) {
Content noCustomizationMsg = methodWriter.getNoCustomizationMsg(
- configuration.getText("doclet.Serializable_no_customization"));
+ resources.getText("doclet.Serializable_no_customization"));
classContentTree.addContent(methodWriter.getSerializableMethods(
- configuration.getText("doclet.Serialized_Form_methods"),
+ resources.getText("doclet.Serialized_Form_methods"),
noCustomizationMsg));
}
}
@@ -404,7 +404,7 @@
}
serializableFieldsTree.addContent(fieldsOverviewContentTree);
classContentTree.addContent(fieldWriter.getSerializableFields(
- configuration.getText("doclet.Serialized_Form_class"),
+ resources.getText("doclet.Serialized_Form_class"),
serializableFieldsTree));
}
}
@@ -437,7 +437,7 @@
}
}
classContentTree.addContent(fieldWriter.getSerializableFields(
- configuration.getText("doclet.Serialized_Form_fields"),
+ resources.getText("doclet.Serialized_Form_fields"),
serializableFieldsTree));
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java Fri Nov 23 09:12:00 2018 -0500
@@ -267,7 +267,8 @@
/**
* Convert the individual ParamTag into Content.
*
- * @param isNonTypeParams true if this is just a regular param tag. False
+ * @param e the owner element
+ * @param isParams true if this is just a regular param tag. False
* if this is a type param tag.
* @param writer the taglet writer for output writing.
* @param paramTag the tag whose inline tags will be printed.
@@ -281,7 +282,7 @@
TagletWriter writer, DocTree paramTag, String name,
boolean isFirstParam) {
Content result = writer.getOutputInstance();
- String header = writer.configuration().getText(
+ String header = writer.configuration().getResources().getText(
isParams ? "doclet.Parameters" : "doclet.TypeParameters");
if (isFirstParam) {
result.addContent(writer.getParamHeader(header));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/PropertyGetterTaglet.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/PropertyGetterTaglet.java Fri Nov 23 09:12:00 2018 -0500
@@ -52,6 +52,6 @@
@Override
String getText(TagletWriter tagletWriter) {
- return tagletWriter.configuration().getText("doclet.PropertyGetter");
+ return tagletWriter.configuration().getResources().getText("doclet.PropertyGetter");
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/PropertySetterTaglet.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/PropertySetterTaglet.java Fri Nov 23 09:12:00 2018 -0500
@@ -37,7 +37,7 @@
public class PropertySetterTaglet extends BasePropertyTaglet {
/**
- * Construct a new PropertyGetterTaglet.
+ * Construct a new PropertySetterTaglet.
*/
public PropertySetterTaglet () {
super("propertySetter");
@@ -45,6 +45,6 @@
@Override
String getText(TagletWriter tagletWriter) {
- return tagletWriter.configuration().getText("doclet.PropertySetter");
+ return tagletWriter.configuration().getResources().getText("doclet.PropertySetter");
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java Fri Nov 23 09:12:00 2018 -0500
@@ -39,6 +39,7 @@
import jdk.javadoc.doclet.Reporter;
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
/**
* Process and manage "-link" and "-linkoffline" to external packages. The
@@ -69,6 +70,10 @@
*/
private final BaseConfiguration configuration;
+ private final Resources resources;
+
+ private final Utils utils;
+
/**
* True if we are using -linkoffline and false if -link is used instead.
*/
@@ -122,6 +127,8 @@
public Extern(BaseConfiguration configuration) {
this.configuration = configuration;
+ this.resources = configuration.getResources();
+ this.utils = configuration.utils;
}
/**
@@ -134,7 +141,7 @@
if (packageItems.isEmpty()) {
return false;
}
- PackageElement pe = configuration.utils.containingPackage(element);
+ PackageElement pe = utils.containingPackage(element);
if (pe.isUnnamed()) {
return false;
}
@@ -242,7 +249,7 @@
try {
return new URL(url);
} catch (MalformedURLException e) {
- throw new Fault(configuration.getText("doclet.MalformedURL", url), e);
+ throw new Fault(resources.getText("doclet.MalformedURL", url), e);
}
}
@@ -262,13 +269,13 @@
private Item findElementItem(Element element) {
Item item = null;
if (element instanceof ModuleElement) {
- item = moduleItems.get(configuration.utils.getModuleName((ModuleElement)element));
+ item = moduleItems.get(utils.getModuleName((ModuleElement)element));
}
else if (element instanceof PackageElement) {
PackageElement packageElement = (PackageElement)element;
- ModuleElement moduleElement = configuration.utils.containingModule(packageElement);
- Map<String, Item> pkgMap = packageItems.get(configuration.utils.getModuleName(moduleElement));
- item = (pkgMap != null) ? pkgMap.get(configuration.utils.getPackageName(packageElement)) : null;
+ ModuleElement moduleElement = utils.containingModule(packageElement);
+ Map<String, Item> pkgMap = packageItems.get(utils.getModuleName(moduleElement));
+ item = (pkgMap != null) ? pkgMap.get(utils.getPackageName(packageElement)) : null;
}
return item;
}
@@ -291,7 +298,7 @@
URL link = elemlisturlpath.toURI().resolve(DocPaths.ELEMENT_LIST.getPath()).toURL();
readElementList(link.openStream(), urlpath, false);
} catch (URISyntaxException | MalformedURLException exc) {
- throw new Fault(configuration.getText("doclet.MalformedURL", elemlisturlpath.toString()), exc);
+ throw new Fault(resources.getText("doclet.MalformedURL", elemlisturlpath.toString()), exc);
} catch (IOException exc) {
readAlternateURL(urlpath, elemlisturlpath);
}
@@ -308,9 +315,9 @@
URL link = elemlisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL();
readElementList(link.openStream(), urlpath, false);
} catch (URISyntaxException | MalformedURLException exc) {
- throw new Fault(configuration.getText("doclet.MalformedURL", elemlisturlpath.toString()), exc);
+ throw new Fault(resources.getText("doclet.MalformedURL", elemlisturlpath.toString()), exc);
} catch (IOException exc) {
- throw new Fault(configuration.getText("doclet.URL_error", elemlisturlpath.toString()), exc);
+ throw new Fault(resources.getText("doclet.URL_error", elemlisturlpath.toString()), exc);
}
}
@@ -338,7 +345,7 @@
if (file1.exists()) {
readElementList(file1, path);
} else {
- throw new Fault(configuration.getText("doclet.File_error", file.getPath()), null);
+ throw new Fault(resources.getText("doclet.File_error", file.getPath()), null);
}
}
}
@@ -351,10 +358,10 @@
&& !DocFile.createFileForInput(configuration, path).isAbsolute();
readElementList(file.openInputStream(), path, pathIsRelative);
} else {
- throw new Fault(configuration.getText("doclet.File_error", file.getPath()), null);
+ throw new Fault(resources.getText("doclet.File_error", file.getPath()), null);
}
} catch (IOException exc) {
- throw new Fault(configuration.getText("doclet.File_error", file.getPath()), exc);
+ throw new Fault(resources.getText("doclet.File_error", file.getPath()), exc);
}
}
@@ -416,10 +423,10 @@
ModuleElement me = (ModuleElement)pe.getEnclosingElement();
if (me == null || me.isUnnamed()) {
if (moduleName != null)
- throw new Fault(configuration.getText("doclet.linkMismatch_PackagedLinkedtoModule",
+ throw new Fault(resources.getText("doclet.linkMismatch_PackagedLinkedtoModule",
path), null);
} else if (moduleName == null)
- throw new Fault(configuration.getText("doclet.linkMismatch_ModuleLinkedtoPackage",
+ throw new Fault(resources.getText("doclet.linkMismatch_ModuleLinkedtoPackage",
path), null);
}
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MetaKeywords.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MetaKeywords.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -128,7 +128,7 @@
public List<String> getOverviewMetaKeywords(String title, String docTitle) {
List<String> result = new ArrayList<>(1);
if (config.keywords) {
- String windowOverview = config.getText(title);
+ String windowOverview = config.getResources().getText(title);
if (docTitle.length() > 0) {
result.add(windowOverview + ", " + docTitle);
} else {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Fri Nov 23 09:12:00 2018 -0500
@@ -86,6 +86,7 @@
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo;
import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
import jdk.javadoc.internal.doclets.toolkit.WorkArounds;
import jdk.javadoc.internal.tool.DocEnvImpl;
@@ -110,6 +111,7 @@
public class Utils {
public final BaseConfiguration configuration;
public final Messages messages;
+ public final Resources resources;
public final DocTrees docTrees;
public final Elements elementUtils;
public final Types typeUtils;
@@ -118,6 +120,7 @@
public Utils(BaseConfiguration c) {
configuration = c;
messages = configuration.getMessages();
+ resources = configuration.getResources();
elementUtils = c.docEnv.getElementUtils();
typeUtils = c.docEnv.getTypeUtils();
docTrees = c.docEnv.getDocTrees();
@@ -1245,7 +1248,7 @@
typeName = "doclet.Class";
}
typeName = lowerCaseOnly ? toLowerCase(typeName) : typeName;
- return typeNameMap.computeIfAbsent(typeName, configuration :: getText);
+ return typeNameMap.computeIfAbsent(typeName, resources::getText);
}
private final Map<String, String> typeNameMap = new HashMap<>();
@@ -1368,11 +1371,11 @@
continue;
if (ee.getSimpleName().contentEquals("values") && ee.getParameters().isEmpty()) {
removeCommentHelper(ee); // purge previous entry
- configuration.cmtUtils.setEnumValuesTree(configuration, e);
+ configuration.cmtUtils.setEnumValuesTree(e);
}
if (ee.getSimpleName().contentEquals("valueOf") && ee.getParameters().size() == 1) {
removeCommentHelper(ee); // purge previous entry
- configuration.cmtUtils.setEnumValueOfTree(configuration, e);
+ configuration.cmtUtils.setEnumValueOfTree(e);
}
}
}
@@ -3087,7 +3090,7 @@
throw new JavaScriptScanner.Fault();
});
} catch (JavaScriptScanner.Fault jsf) {
- String text = configuration.getText("doclet.JavaScript_in_comment");
+ String text = resources.getText("doclet.JavaScript_in_comment");
throw new UncheckedDocletException(new SimpleDocletException(text, jsf));
}
}
@@ -3123,7 +3126,7 @@
throw new JavaScriptScanner.Fault();
});
} catch (JavaScriptScanner.Fault jsf) {
- String text = configuration.getText("doclet.JavaScript_in_option", name);
+ String text = resources.getText("doclet.JavaScript_in_option", name);
throw new UncheckedDocletException(new SimpleDocletException(text, jsf));
}
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java Fri Nov 23 09:12:00 2018 -0500
@@ -32,6 +32,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
+import java.lang.module.ModuleDescriptor;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -39,6 +40,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -74,6 +76,7 @@
protected final Map<Location, Archive> locationToArchive = new HashMap<>();
static final Archive NOT_FOUND
= new Archive(JdepsTask.getMessage("artifact.not.found"));
+ static final Predicate<Archive> ANY = a -> true;
/**
* Constructs an Analyzer instance.
@@ -161,7 +164,7 @@
* Visit the dependencies of the given source.
* If the requested level is SUMMARY, it will visit the required archives list.
*/
- void visitDependences(Archive source, Visitor v, Type level) {
+ void visitDependences(Archive source, Visitor v, Type level, Predicate<Archive> targetFilter) {
if (level == Type.SUMMARY) {
final Dependences result = results.get(source);
final Set<Archive> reqs = result.requires();
@@ -184,7 +187,7 @@
Dependences result = results.get(source);
if (level != type) {
// requesting different level of analysis
- result = new Dependences(source, level);
+ result = new Dependences(source, level, targetFilter);
source.visitDependences(result);
}
result.dependencies().stream()
@@ -196,7 +199,11 @@
}
void visitDependences(Archive source, Visitor v) {
- visitDependences(source, v, type);
+ visitDependences(source, v, type, ANY);
+ }
+
+ void visitDependences(Archive source, Visitor v, Type level) {
+ visitDependences(source, v, level, ANY);
}
/**
@@ -208,12 +215,17 @@
protected final Set<Archive> requires;
protected final Set<Dep> deps;
protected final Type level;
+ protected final Predicate<Archive> targetFilter;
private Profile profile;
Dependences(Archive archive, Type level) {
+ this(archive, level, ANY);
+ }
+ Dependences(Archive archive, Type level, Predicate<Archive> targetFilter) {
this.archive = archive;
this.deps = new HashSet<>();
this.requires = new HashSet<>();
this.level = level;
+ this.targetFilter = targetFilter;
}
Set<Dep> dependencies() {
@@ -266,7 +278,7 @@
@Override
public void visit(Location o, Location t) {
Archive targetArchive = findArchive(t);
- if (filter.accepts(o, archive, t, targetArchive)) {
+ if (filter.accepts(o, archive, t, targetArchive) && targetFilter.test(targetArchive)) {
addDep(o, t);
if (archive != targetArchive && !requires.contains(targetArchive)) {
requires.add(targetArchive);
@@ -368,13 +380,21 @@
}
}
+ /*
+ * Returns true if the given archive represents not found.
+ */
+ static boolean notFound(Archive archive) {
+ return archive == NOT_FOUND || archive == REMOVED_JDK_INTERNALS;
+ }
+
static final Jdk8Internals REMOVED_JDK_INTERNALS = new Jdk8Internals();
static class Jdk8Internals extends Module {
- private final String JDK8_INTERNALS = "/com/sun/tools/jdeps/resources/jdk8_internals.txt";
+ private static final String NAME = "JDK removed internal API";
+ private static final String JDK8_INTERNALS = "/com/sun/tools/jdeps/resources/jdk8_internals.txt";
private final Set<String> jdk8Internals;
private Jdk8Internals() {
- super("JDK removed internal API");
+ super(NAME, ModuleDescriptor.newModule("jdk8internals").build(), true);
try (InputStream in = JdepsTask.class.getResourceAsStream(JDK8_INTERNALS);
BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
this.jdk8Internals = reader.lines()
@@ -394,11 +414,6 @@
}
@Override
- public String name() {
- return getName();
- }
-
- @Override
public boolean isJDK() {
return true;
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Archive.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Archive.java Fri Nov 23 09:12:00 2018 -0500
@@ -37,10 +37,13 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
+import static com.sun.tools.jdeps.Module.trace;
+
/**
* Represents the source of the class files.
*/
@@ -132,6 +135,10 @@
return path != null ? path.toString() : filename;
}
+ public Optional<Path> path() {
+ return Optional.ofNullable(path);
+ }
+
@Override
public int hashCode() {
return Objects.hash(this.filename, this.path);
@@ -152,9 +159,6 @@
return filename;
}
- public Path path() {
- return path;
- }
public static boolean isSameLocation(Archive archive, Archive other) {
if (archive.path == null || other.path == null)
@@ -182,6 +186,7 @@
@Override
public void close() throws IOException {
+ trace("closing %s %n", getPathName());
if (reader != null)
reader.close();
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/DependencyFinder.java Fri Nov 23 09:12:00 2018 -0500
@@ -38,6 +38,7 @@
import java.io.IOException;
import java.io.UncheckedIOException;
+import java.nio.file.Paths;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
@@ -172,7 +173,7 @@
parsedArchives.get(finder).add(archive);
- trace("parsing %s %s%n", archive.getName(), archive.path());
+ trace("parsing %s %s%n", archive.getName(), archive.getPathName());
FutureTask<Set<Location>> task = new FutureTask<>(() -> {
Set<Location> targets = new HashSet<>();
for (ClassFile cf : archive.reader().getClassFiles()) {
@@ -206,7 +207,6 @@
parsedClasses.putIfAbsent(d.getOrigin(), archive);
}
}
-
return targets;
});
tasks.add(task);
@@ -264,8 +264,7 @@
FutureTask<Set<Location>> task;
while ((task = tasks.poll()) != null) {
// wait for completion
- if (!task.isDone())
- targets.addAll(task.get());
+ targets.addAll(task.get());
}
return targets;
} catch (InterruptedException|ExecutionException e) {
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java Fri Nov 23 09:12:00 2018 -0500
@@ -83,42 +83,27 @@
private final List<Archive> classpathArchives = new ArrayList<>();
private final List<Archive> initialArchives = new ArrayList<>();
private final Set<Module> rootModules = new HashSet<>();
- private final Configuration configuration;
private final Runtime.Version version;
- private JdepsConfiguration(SystemModuleFinder systemModulePath,
+ private JdepsConfiguration(Configuration config,
+ SystemModuleFinder systemModulePath,
ModuleFinder finder,
Set<String> roots,
List<Path> classpaths,
List<Archive> initialArchives,
- Set<String> tokens,
Runtime.Version version)
throws IOException
{
trace("root: %s%n", roots);
-
+ trace("initial archives: %s%n", initialArchives);
+ trace("class path: %s%n", classpaths);
this.system = systemModulePath;
this.finder = finder;
this.version = version;
- // build root set for resolution
- Set<String> mods = new HashSet<>(roots);
- if (tokens.contains(ALL_SYSTEM)) {
- systemModulePath.findAll().stream()
- .map(mref -> mref.descriptor().name())
- .forEach(mods::add);
- }
-
- if (tokens.contains(ALL_DEFAULT)) {
- mods.addAll(systemModulePath.defaultSystemRoots());
- }
-
- this.configuration = Configuration.empty()
- .resolve(finder, ModuleFinder.of(), mods);
-
- this.configuration.modules().stream()
- .map(ResolvedModule::reference)
- .forEach(this::addModuleReference);
+ config.modules().stream()
+ .map(ResolvedModule::reference)
+ .forEach(this::addModuleReference);
// packages in unnamed module
initialArchives.forEach(archive -> {
@@ -538,14 +523,6 @@
.forEach(rootModules::add);
}
- // add all modules to the root set for unnamed module or set explicitly
- boolean unnamed = !initialArchives.isEmpty() || !classPaths.isEmpty();
- if ((unnamed || tokens.contains(ALL_MODULE_PATH)) && appModulePath != null) {
- appModulePath.findAll().stream()
- .map(mref -> mref.descriptor().name())
- .forEach(rootModules::add);
- }
-
// no archive is specified for analysis
// add all system modules as root if --add-modules ALL-SYSTEM is specified
if (tokens.contains(ALL_SYSTEM) && rootModules.isEmpty() &&
@@ -556,16 +533,41 @@
.forEach(rootModules::add);
}
- if (unnamed && !tokens.contains(ALL_DEFAULT)) {
- tokens.add(ALL_SYSTEM);
+ // add all modules on app module path as roots if ALL-MODULE-PATH is specified
+ if ((tokens.contains(ALL_MODULE_PATH)) && appModulePath != null) {
+ appModulePath.findAll().stream()
+ .map(mref -> mref.descriptor().name())
+ .forEach(rootModules::add);
}
- return new JdepsConfiguration(systemModulePath,
+
+ // build root set for module resolution
+ Set<String> mods = new HashSet<>(rootModules);
+ // if archives are specified for analysis, then consider as unnamed module
+ boolean unnamed = !initialArchives.isEmpty() || !classPaths.isEmpty();
+ if (tokens.contains(ALL_DEFAULT)) {
+ mods.addAll(systemModulePath.defaultSystemRoots());
+ } else if (tokens.contains(ALL_SYSTEM) || unnamed) {
+ // resolve all system modules as unnamed module may reference any class
+ systemModulePath.findAll().stream()
+ .map(mref -> mref.descriptor().name())
+ .forEach(mods::add);
+ }
+ if (unnamed && appModulePath != null) {
+ // resolve all modules on module path as unnamed module may reference any class
+ appModulePath.findAll().stream()
+ .map(mref -> mref.descriptor().name())
+ .forEach(mods::add);
+ }
+
+ // resolve the module graph
+ Configuration config = Configuration.empty().resolve(finder, ModuleFinder.of(), mods);
+ return new JdepsConfiguration(config,
+ systemModulePath,
finder,
rootModules,
classPaths,
initialArchives,
- tokens,
version);
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsFilter.java Fri Nov 23 09:12:00 2018 -0500
@@ -55,6 +55,7 @@
private final boolean filterSamePackage;
private final boolean filterSameArchive;
private final boolean findJDKInternals;
+ private final boolean findMissingDeps;
private final Pattern includePattern;
private final Set<String> requires;
@@ -64,6 +65,7 @@
boolean filterSamePackage,
boolean filterSameArchive,
boolean findJDKInternals,
+ boolean findMissingDeps,
Pattern includePattern,
Set<String> requires) {
this.filter = filter;
@@ -71,6 +73,7 @@
this.filterSamePackage = filterSamePackage;
this.filterSameArchive = filterSameArchive;
this.findJDKInternals = findJDKInternals;
+ this.findMissingDeps = findMissingDeps;
this.includePattern = includePattern;
this.requires = requires;
}
@@ -153,6 +156,8 @@
Module module = targetArchive.getModule();
return originArchive != targetArchive &&
isJDKInternalPackage(module, target.getPackageName());
+ } else if (findMissingDeps) {
+ return Analyzer.notFound(targetArchive);
} else if (filterSameArchive) {
// accepts origin and target that from different archive
return originArchive != targetArchive;
@@ -188,6 +193,7 @@
boolean filterSamePackage;
boolean filterSameArchive;
boolean findJDKInterals;
+ boolean findMissingDeps;
// source filters
Pattern includePattern;
Set<String> requires = new HashSet<>();
@@ -221,6 +227,10 @@
this.findJDKInterals = value;
return this;
}
+ public Builder findMissingDeps(boolean value) {
+ this.findMissingDeps = value;
+ return this;
+ }
public Builder includePattern(Pattern regex) {
this.includePattern = regex;
return this;
@@ -238,6 +248,7 @@
filterSamePackage,
filterSameArchive,
findJDKInterals,
+ findMissingDeps,
includePattern,
requires);
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java Fri Nov 23 09:12:00 2018 -0500
@@ -357,6 +357,11 @@
task.command = task.listModuleDeps(CommandOption.PRINT_MODULE_DEPS);
}
},
+ new Option(false, "--ignore-missing-deps") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.ignoreMissingDeps = true;
+ }
+ },
// ---- Target filtering options ----
new Option(true, "-p", "-package", "--package") {
@@ -401,6 +406,11 @@
}
}
},
+ new Option(false, "--missing-deps") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.findMissingDeps = true;
+ }
+ },
// ---- Source filtering options ----
new Option(true, "-include") {
@@ -415,15 +425,19 @@
}
},
- new Option(false, "-R", "-recursive") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.depth = 0;
+ new Option(false, "-R", "-recursive", "--recursive") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ task.options.recursive = Options.RECURSIVE;
// turn off filtering
task.options.filterSameArchive = false;
task.options.filterSamePackage = false;
}
},
-
+ new Option(false, "--no-recursive") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ task.options.recursive = Options.NO_RECURSIVE;
+ }
+ },
new Option(false, "-I", "--inverse") {
void process(JdepsTask task, String opt, String arg) {
task.options.inverse = true;
@@ -437,9 +451,9 @@
new Option(false, "--compile-time") {
void process(JdepsTask task, String opt, String arg) {
task.options.compileTimeView = true;
+ task.options.recursive = Options.RECURSIVE;
task.options.filterSamePackage = true;
task.options.filterSameArchive = true;
- task.options.depth = 0;
}
},
@@ -611,6 +625,13 @@
}
private ListModuleDeps listModuleDeps(CommandOption option) throws BadArgs {
+ // do transitive dependence analysis unless --no-recursive is set
+ if (options.recursive != Options.NO_RECURSIVE) {
+ options.recursive = Options.RECURSIVE;
+ }
+ // no need to record the dependences on the same archive or same package
+ options.filterSameArchive = true;
+ options.filterSamePackage = true;
switch (option) {
case LIST_DEPS:
return new ListModuleDeps(option, true, false);
@@ -677,16 +698,16 @@
@Override
boolean checkOptions() {
- if (options.findJDKInternals) {
+ if (options.findJDKInternals || options.findMissingDeps) {
// cannot set any filter, -verbose and -summary option
if (options.showSummary || options.verbose != null) {
reportError("err.invalid.options", "-summary or -verbose",
- "-jdkinternals");
+ options.findJDKInternals ? "-jdkinternals" : "--missing-deps");
return false;
}
if (options.hasFilter()) {
reportError("err.invalid.options", "--package, --regex, --require",
- "-jdkinternals");
+ options.findJDKInternals ? "-jdkinternals" : "--missing-deps");
return false;
}
}
@@ -715,7 +736,7 @@
if (options.showSummary)
return Type.SUMMARY;
- if (options.findJDKInternals)
+ if (options.findJDKInternals || options.findMissingDeps)
return Type.CLASS;
// default to package-level verbose
@@ -744,7 +765,7 @@
type,
options.apiOnly);
- boolean ok = analyzer.run(options.compileTimeView, options.depth);
+ boolean ok = analyzer.run(options.compileTimeView, options.depth());
// print skipped entries, if any
if (!options.nowarning) {
@@ -797,8 +818,8 @@
@Override
boolean checkOptions() {
- if (options.depth != 1) {
- reportError("err.invalid.options", "-R", "--inverse");
+ if (options.recursive != -1 || options.depth != -1) {
+ reportError("err.invalid.options", "--recursive and --no-recursive", "--inverse");
return false;
}
@@ -925,12 +946,7 @@
if (!ok && !options.nowarning) {
reportError("err.missing.dependences");
- builder.visitMissingDeps(
- (origin, originArchive, target, targetArchive) -> {
- if (builder.notFound(targetArchive))
- log.format(" %-50s -> %-50s %s%n",
- origin, target, targetArchive.getName());
- });
+ builder.visitMissingDeps(new SimpleDepVisitor());
}
return ok;
}
@@ -993,13 +1009,15 @@
@Override
boolean checkOptions() {
if (options.showSummary || options.verbose != null) {
- reportError("err.invalid.options", "-summary or -verbose",
- option);
+ reportError("err.invalid.options", "-summary or -verbose", option);
return false;
}
if (options.findJDKInternals) {
- reportError("err.invalid.options", "-jdkinternals",
- option);
+ reportError("err.invalid.options", "-jdkinternals", option);
+ return false;
+ }
+ if (options.findMissingDeps) {
+ reportError("err.invalid.options", "--missing-deps", option);
return false;
}
@@ -1015,16 +1033,22 @@
@Override
boolean run(JdepsConfiguration config) throws IOException {
- return new ModuleExportsAnalyzer(config,
- dependencyFilter(config),
- jdkinternals,
- reduced,
- log,
- separator).run();
+ ModuleExportsAnalyzer analyzer = new ModuleExportsAnalyzer(config,
+ dependencyFilter(config),
+ jdkinternals,
+ reduced,
+ log,
+ separator);
+ boolean ok = analyzer.run(options.depth(), options.ignoreMissingDeps);
+ if (!ok) {
+ reportError("err.cant.list.module.deps");
+ log.println();
+ analyzer.visitMissingDeps(new SimpleDepVisitor());
+ }
+ return ok;
}
}
-
class GenDotFile extends AnalyzeDeps {
final Path dotOutputDir;
GenDotFile(Path dotOutputDir) {
@@ -1053,6 +1077,18 @@
}
}
+ class SimpleDepVisitor implements Analyzer.Visitor {
+ private Archive source;
+ @Override
+ public void visitDependence(String origin, Archive originArchive, String target, Archive targetArchive) {
+ if (source != originArchive) {
+ source = originArchive;
+ log.format("%s%n", originArchive);
+ }
+ log.format(" %-50s -> %-50s %s%n", origin, target, targetArchive.getName());
+ }
+ }
+
/**
* Returns a filter used during dependency analysis
*/
@@ -1066,6 +1102,7 @@
// target filters
builder.filter(options.filterSamePackage, options.filterSameArchive);
builder.findJDKInternals(options.findJDKInternals);
+ builder.findMissingDeps(options.findMissingDeps);
// --require
if (!options.requires.isEmpty()) {
@@ -1158,11 +1195,8 @@
private String version(String key) {
// key=version: mm.nn.oo[-milestone]
// key=full: mm.mm.oo[-milestone]-build
- if (ResourceBundleHelper.versionRB == null) {
- return System.getProperty("java.version");
- }
try {
- return ResourceBundleHelper.versionRB.getString(key);
+ return ResourceBundleHelper.getVersion(key);
} catch (MissingResourceException e) {
return getMessage("version.unknown", System.getProperty("java.version"));
}
@@ -1170,13 +1204,15 @@
static String getMessage(String key, Object... args) {
try {
- return MessageFormat.format(ResourceBundleHelper.bundle.getString(key), args);
+ return MessageFormat.format(ResourceBundleHelper.getMessage(key), args);
} catch (MissingResourceException e) {
throw new InternalError("Missing message: " + key);
}
}
private static class Options {
+ static final int NO_RECURSIVE = 0;
+ static final int RECURSIVE = 1;
boolean help;
boolean version;
boolean fullVersion;
@@ -1186,6 +1222,8 @@
boolean apiOnly;
boolean showLabel;
boolean findJDKInternals;
+ boolean findMissingDeps;
+ boolean ignoreMissingDeps;
boolean nowarning = false;
Analyzer.Type verbose;
// default filter references from same package
@@ -1193,7 +1231,8 @@
boolean filterSameArchive = false;
Pattern filterRegex;
String classpath;
- int depth = 1;
+ int recursive = -1; // 0: --no-recursive, 1: --recursive
+ int depth = -1;
Set<String> requires = new HashSet<>();
Set<String> packageNames = new HashSet<>();
Pattern regex; // apply to the dependences
@@ -1222,9 +1261,23 @@
if (packageNames.size() > 0) count++;
return count;
}
+
+ int depth() {
+ // ignore -depth if --no-recursive is set
+ if (recursive == NO_RECURSIVE)
+ return 1;
+
+ // depth == 0 if recursive
+ if (recursive == RECURSIVE && depth == -1)
+ return 0;
+
+ // default depth is 1 unless specified via -depth option
+ return depth == -1 ? 1 : depth;
+ }
}
private static class ResourceBundleHelper {
+ static final String LS = System.lineSeparator();
static final ResourceBundle versionRB;
static final ResourceBundle bundle;
static final ResourceBundle jdkinternals;
@@ -1247,6 +1300,21 @@
throw new InternalError("Cannot find jdkinternals resource bundle");
}
}
+
+ static String getMessage(String key) {
+ return bundle.getString(key).replace("\n", LS);
+ }
+
+ static String getVersion(String key) {
+ if (ResourceBundleHelper.versionRB == null) {
+ return System.getProperty("java.version");
+ }
+ return versionRB.getString(key).replace("\n", LS);
+ }
+
+ static String getSuggestedReplacement(String key) {
+ return ResourceBundleHelper.jdkinternals.getString(key).replace("\n", LS);
+ }
}
/**
@@ -1258,7 +1326,7 @@
String value = null;
while (value == null && name != null) {
try {
- value = ResourceBundleHelper.jdkinternals.getString(name);
+ value = ResourceBundleHelper.getSuggestedReplacement(name);
} catch (MissingResourceException e) {
// go up one subpackage level
int i = name.lastIndexOf('.');
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsWriter.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsWriter.java Fri Nov 23 09:12:00 2018 -0500
@@ -32,10 +32,12 @@
import java.lang.module.ModuleDescriptor.Requires;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
+import java.util.Optional;
public abstract class JdepsWriter {
public static JdepsWriter newDotWriter(Path outputdir, Analyzer.Type type) {
@@ -79,7 +81,10 @@
archives.stream()
.filter(analyzer::hasDependences)
.forEach(archive -> {
- Path dotfile = outputDir.resolve(archive.getName() + ".dot");
+ // use the filename if path is present; otherwise
+ // use the module name e.g. from jrt file system
+ Path path = archive.path().orElse(Paths.get(archive.getName()));
+ Path dotfile = outputDir.resolve(path.getFileName().toString() + ".dot");
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(dotfile));
DotFileFormatter formatter = new DotFileFormatter(pw, archive)) {
analyzer.visitDependences(archive, formatter);
@@ -92,6 +97,7 @@
generateSummaryDotFile(archives, analyzer);
}
+
private void generateSummaryDotFile(Collection<Archive> archives, Analyzer analyzer)
throws IOException
{
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java Fri Nov 23 09:12:00 2018 -0500
@@ -58,12 +58,16 @@
private final URI location;
protected Module(String name) {
+ this(name, null, false);
+ }
+
+ protected Module(String name, ModuleDescriptor descriptor, boolean isSystem) {
super(name);
- this.descriptor = null;
+ this.descriptor = descriptor;
this.location = null;
this.exports = Collections.emptyMap();
this.opens = Collections.emptyMap();
- this.isSystem = true;
+ this.isSystem = isSystem;
}
private Module(String name,
@@ -89,11 +93,11 @@
}
public boolean isNamed() {
- return true;
+ return descriptor != null;
}
public boolean isAutomatic() {
- return descriptor.isAutomatic();
+ return descriptor != null && descriptor.isAutomatic();
}
public Module getModule() {
@@ -232,9 +236,7 @@
private static class UnnamedModule extends Module {
private UnnamedModule() {
- super("unnamed", null, null,
- Collections.emptyMap(), Collections.emptyMap(),
- false, null);
+ super("unnamed", null, false);
}
@Override
@@ -243,16 +245,6 @@
}
@Override
- public boolean isNamed() {
- return false;
- }
-
- @Override
- public boolean isAutomatic() {
- return false;
- }
-
- @Override
public boolean isExported(String pn) {
return true;
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java Fri Nov 23 09:12:00 2018 -0500
@@ -47,6 +47,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.Function;
@@ -57,10 +58,12 @@
* Generate dot graph for modules
*/
public class ModuleDotGraph {
+ private final JdepsConfiguration config;
private final Map<String, Configuration> configurations;
private final boolean apiOnly;
public ModuleDotGraph(JdepsConfiguration config, boolean apiOnly) {
- this(config.rootModules().stream()
+ this(config,
+ config.rootModules().stream()
.map(Module::name)
.sorted()
.collect(toMap(Function.identity(), mn -> config.resolve(Set.of(mn)))),
@@ -68,8 +71,15 @@
}
public ModuleDotGraph(Map<String, Configuration> configurations, boolean apiOnly) {
+ this(null, configurations, apiOnly);
+ }
+
+ private ModuleDotGraph(JdepsConfiguration config,
+ Map<String, Configuration> configurations,
+ boolean apiOnly) {
this.configurations = configurations;
this.apiOnly = apiOnly;
+ this.config = config;
}
/**
@@ -86,12 +96,22 @@
{
Files.createDirectories(dir);
for (String mn : configurations.keySet()) {
- Path path = dir.resolve(mn + ".dot");
+ Path path = dir.resolve(toDotFileBaseName(mn) + ".dot");
genDotFile(path, mn, configurations.get(mn), attributes);
}
return true;
}
+ private String toDotFileBaseName(String mn) {
+ if (config == null)
+ return mn;
+
+ Optional<Path> path = config.findModule(mn).flatMap(Module::path);
+ if (path.isPresent())
+ return path.get().getFileName().toString();
+ else
+ return mn;
+ }
/**
* Generate dotfile of the given path
*/
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java Fri Nov 23 09:12:00 2018 -0500
@@ -49,42 +49,47 @@
public class ModuleExportsAnalyzer extends DepsAnalyzer {
// source archive to its dependences and JDK internal APIs it references
private final Map<Archive, Map<Archive,Set<String>>> deps = new HashMap<>();
- private final boolean showJdkInternals;
+ private final Map<String, Set<String>> missingDeps = new HashMap<>();
+ private final boolean showInternals;
private final boolean reduced;
private final PrintWriter writer;
private final String separator;
public ModuleExportsAnalyzer(JdepsConfiguration config,
JdepsFilter filter,
- boolean showJdkInternals,
+ boolean showInternals,
boolean reduced,
PrintWriter writer,
String separator) {
super(config, filter, null,
Analyzer.Type.PACKAGE,
false /* all classes */);
- this.showJdkInternals = showJdkInternals;
+ this.showInternals = showInternals;
this.reduced = reduced;
this.writer = writer;
this.separator = separator;
}
- @Override
- public boolean run() throws IOException {
- // analyze dependences
- boolean rc = super.run();
+ public boolean run(int maxDepth, boolean ignoreMissingDeps) throws IOException {
+ // use compile time view so that the entire archive on classpath is analyzed
+ boolean rc = super.run(true, maxDepth);
// A visitor to record the module-level dependences as well as
- // use of JDK internal APIs
+ // use of internal APIs
Analyzer.Visitor visitor = (origin, originArchive, target, targetArchive) -> {
- Set<String> jdkInternals =
+ Set<String> internals =
deps.computeIfAbsent(originArchive, _k -> new HashMap<>())
.computeIfAbsent(targetArchive, _k -> new HashSet<>());
Module module = targetArchive.getModule();
- if (showJdkInternals && originArchive.getModule() != module &&
- module.isJDK() && !module.isExported(target)) {
- // use of JDK internal APIs
- jdkInternals.add(target);
+ if (showInternals && originArchive.getModule() != module &&
+ module.isNamed() && !module.isExported(target, module.name())) {
+ // use of internal APIs
+ internals.add(target);
+ }
+ if (!ignoreMissingDeps && Analyzer.notFound(targetArchive)) {
+ Set<String> notFound =
+ missingDeps.computeIfAbsent(origin, _k -> new HashSet<>());
+ notFound.add(target);
}
};
@@ -94,10 +99,26 @@
.sorted(Comparator.comparing(Archive::getName))
.forEach(archive -> analyzer.visitDependences(archive, visitor));
+ // error if any missing dependence
+ if (!rc || !missingDeps.isEmpty()) {
+ return false;
+ }
+
+ Map<Module, Set<String>> internalPkgs = internalPackages();
Set<Module> modules = modules();
- if (showJdkInternals) {
+ if (showInternals) {
// print modules and JDK internal API dependences
- printDependences(modules);
+ Stream.concat(modules.stream(), internalPkgs.keySet().stream())
+ .sorted(Comparator.comparing(Module::name))
+ .distinct()
+ .forEach(m -> {
+ if (internalPkgs.containsKey(m)) {
+ internalPkgs.get(m).stream()
+ .forEach(pn -> writer.format(" %s/%s%s", m, pn, separator));
+ } else {
+ writer.format(" %s%s", m, separator);
+ }
+ });
} else {
// print module dependences
writer.println(modules.stream().map(Module::name).sorted()
@@ -106,16 +127,28 @@
return rc;
}
+ /*
+ * Prints missing dependences
+ */
+ void visitMissingDeps(Analyzer.Visitor visitor) {
+ archives.stream()
+ .filter(analyzer::hasDependences)
+ .sorted(Comparator.comparing(Archive::getName))
+ .filter(m -> analyzer.requires(m).anyMatch(Analyzer::notFound))
+ .forEach(m -> {
+ analyzer.visitDependences(m, visitor, Analyzer.Type.VERBOSE, Analyzer::notFound);
+ });
+ }
+
private Set<Module> modules() {
// build module graph
ModuleGraphBuilder builder = new ModuleGraphBuilder(configuration);
- Module root = new RootModule("root");
+ Module root = new RootModule();
builder.addModule(root);
// find named module dependences
dependenceStream()
.flatMap(map -> map.keySet().stream())
- .filter(m -> m.getModule().isNamed()
- && !configuration.rootModules().contains(m))
+ .filter(m -> m.getModule().isNamed() && !configuration.rootModules().contains(m))
.map(Archive::getModule)
.forEach(m -> builder.addEdge(root, m));
@@ -125,28 +158,15 @@
return g.adjacentNodes(root);
}
- private void printDependences(Set<Module> modules) {
- // find use of JDK internals
- Map<Module, Set<String>> jdkinternals = new HashMap<>();
+ private Map<Module, Set<String>> internalPackages() {
+ Map<Module, Set<String>> internalPkgs = new HashMap<>();
dependenceStream()
.flatMap(map -> map.entrySet().stream())
.filter(e -> e.getValue().size() > 0)
- .forEach(e -> jdkinternals.computeIfAbsent(e.getKey().getModule(),
- _k -> new TreeSet<>())
+ .forEach(e -> internalPkgs.computeIfAbsent(e.getKey().getModule(),
+ _k -> new TreeSet<>())
.addAll(e.getValue()));
-
- // print modules and JDK internal API dependences
- Stream.concat(modules.stream(), jdkinternals.keySet().stream())
- .sorted(Comparator.comparing(Module::name))
- .distinct()
- .forEach(m -> {
- if (jdkinternals.containsKey(m)) {
- jdkinternals.get(m).stream()
- .forEach(pn -> writer.format(" %s/%s%s", m, pn, separator));
- } else {
- writer.format(" %s%s", m, separator);
- }
- });
+ return internalPkgs;
}
/*
@@ -160,18 +180,13 @@
.map(deps::get);
}
- private class RootModule extends Module {
- final ModuleDescriptor descriptor;
- RootModule(String name) {
- super(name);
-
- ModuleDescriptor.Builder builder = ModuleDescriptor.newModule(name);
- this.descriptor = builder.build();
- }
-
- @Override
- public ModuleDescriptor descriptor() {
- return descriptor;
+ /*
+ * RootModule serves as the root node for building the module graph
+ */
+ private static class RootModule extends Module {
+ static final String NAME = "root";
+ RootModule() {
+ super(NAME, ModuleDescriptor.newModule(NAME).build(), false);
}
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleInfoBuilder.java Fri Nov 23 09:12:00 2018 -0500
@@ -137,17 +137,13 @@
}
}
- boolean notFound(Archive m) {
- return m == NOT_FOUND || m == REMOVED_JDK_INTERNALS;
- }
-
private Module toNormalModule(Module module, Set<Archive> requiresTransitive)
throws IOException
{
// done analysis
module.close();
- if (analyzer.requires(module).anyMatch(this::notFound)) {
+ if (analyzer.requires(module).anyMatch(Analyzer::notFound)) {
// missing dependencies
return null;
}
@@ -182,9 +178,9 @@
void visitMissingDeps(Analyzer.Visitor visitor) {
automaticModules().stream()
- .filter(m -> analyzer.requires(m).anyMatch(this::notFound))
+ .filter(m -> analyzer.requires(m).anyMatch(Analyzer::notFound))
.forEach(m -> {
- analyzer.visitDependences(m, visitor, Analyzer.Type.VERBOSE);
+ analyzer.visitDependences(m, visitor, Analyzer.Type.VERBOSE, Analyzer::notFound);
});
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Fri Nov 23 09:02:17 2018 -0500
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Fri Nov 23 09:12:00 2018 -0500
@@ -57,6 +57,13 @@
\ name (may be given multiple times). --package,\n\
\ --regex, --require are mutual exclusive.
+main.opt.missing-deps=\
+\ --missing-deps Finds missing dependences. This option\n\
+\ cannot be used with -p, -e and -s options.
+
+main.opt.ignore-missing-deps=\
+\ --ignore-missing-deps Ignore missing dependences.
+
main.opt.include=\n\
\Options to filter classes to be analyzed:\n\
\ -include <regex> Restrict analysis to classes matching pattern\n\
@@ -86,13 +93,18 @@
\ Adds modules to the root set for analysis
main.opt.R=\
-\ -R -recursive Recursively traverse all run-time dependences.\n\
+\ -R\n\
+\ --recursive Recursively traverse all run-time dependences.\n\
\ The -R option implies -filter:none. If -p,\n\
\ -e, -f option is specified, only the matching\n\
\ dependences are analyzed.
+main.opt.no-recursive=\
+\ --no-recursive Do not recursively traverse dependences.
+
main.opt.I=\
-\ -I --inverse Analyzes the dependences per other given options\n\
+\ -I\n\
+\ --inverse Analyzes the dependences per other given options\n\
\ and then find all artifacts that directly\n\
\ and indirectly depend on the matching nodes.\n\
\ This is equivalent to the inverse of\n\
@@ -157,9 +169,11 @@
main.opt.list-deps=\
\ --list-deps Lists the module dependences. It also prints\n\
-\ any JDK internal API packages if referenced.\n\
-\ This option does not show dependences on the\n\
-\ class path or not found.
+\ any internal API packages if referenced.\n\
+\ This option transitively analyzes libraries on\n\
+\ class path and module path if referenced.\n\
+\ Use --no-recursive option for non-transitive\n\
+\ dependency analysis.
main.opt.list-reduced-deps=\
\ --list-reduced-deps Same as --list-deps with not listing\n\
@@ -207,6 +221,10 @@
err.multirelease.option.notfound={0} is a multi-release jar file but --multi-release option is not set
err.multirelease.version.associated=class {0} already associated with version {1}, trying to add version {2}
err.multirelease.jar.malformed=malformed multi-release jar, {0}, bad entry: {1}
+err.cant.list.module.deps=\
+Missing dependencies from the module path and classpath.\n\
+To suppress this error, use --ignore-missing-deps to continue.
+
warn.invalid.arg=Path does not exist: {0}
warn.skipped.entry={0}
warn.split.package=split package: {0} {1}
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java Fri Nov 23 09:12:00 2018 -0500
@@ -142,16 +142,15 @@
}
}
}
+
+ private static final String NON_EXISTENT_CLASS_NAME = "XXXXXXXXXXX";
+
static class TestClassLoader extends ClassLoader {
@Override
- protected Class<?> findClass(final String name) {
+ protected Class<?> findClass(final String name) throws ClassNotFoundException {
if (!name.equals(TypeWithUnresolvedFieldType.class.getName())) {
- try {
- return super.findClass(name);
- } catch (ClassNotFoundException e) {
- throw new AssertionError("unexpected: " + e);
- }
+ return super.findClass(name);
}
// copy classfile to byte array
byte[] classData = null;
@@ -176,7 +175,7 @@
int index = -1;
while ((index = indexOf(classData, index + 1, "PrintStream")) != -1) {
- replace(classData, index, "XXXXXXXXXXX");
+ replace(classData, index, NON_EXISTENT_CLASS_NAME);
}
Class<?> c = defineClass(null, classData, 0, classData.length);
@@ -211,13 +210,14 @@
* type of the field is not resolvable.
*/
@Test
- public void testGetType() {
+ public void testGetType() throws ClassNotFoundException {
Class<?> c = new TestClassLoader().findClass(TypeWithUnresolvedFieldType.class.getName());
ResolvedJavaType type = metaAccess.lookupJavaType(c);
for (ResolvedJavaField field : type.getInstanceFields(false)) {
assertTrue(field.getName().equals("fieldWithUnresolvableType"));
field.getType();
field.toString();
+ field.getAnnotations();
}
}
}
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Fri Nov 23 09:12:00 2018 -0500
@@ -855,17 +855,25 @@
}
+ private static ResolvedJavaMethod getClassInitializer(Class<?> c) {
+ ResolvedJavaMethod clinit = metaAccess.lookupJavaType(c).getClassInitializer();
+ if (clinit != null) {
+ assertEquals(0, clinit.getAnnotations().length);
+ assertEquals(0, clinit.getDeclaredAnnotations().length);
+ }
+ return clinit;
+ }
+
@Test
public void getClassInitializerTest() {
- assertNotNull(metaAccess.lookupJavaType(A.class).getClassInitializer());
- assertNotNull(metaAccess.lookupJavaType(D.class).getClassInitializer());
- assertNull(metaAccess.lookupJavaType(B.class).getClassInitializer());
- assertNull(metaAccess.lookupJavaType(C.class).getClassInitializer());
- assertNull(metaAccess.lookupJavaType(int.class).getClassInitializer());
- assertNull(metaAccess.lookupJavaType(void.class).getClassInitializer());
+ assertNotNull(getClassInitializer(A.class));
+ assertNotNull(getClassInitializer(D.class));
+ assertNull(getClassInitializer(B.class));
+ assertNull(getClassInitializer(C.class));
+ assertNull(getClassInitializer(int.class));
+ assertNull(getClassInitializer(void.class));
for (Class<?> c : classes) {
- ResolvedJavaType type = metaAccess.lookupJavaType(c);
- type.getClassInitializer();
+ getClassInitializer(c);
}
}
--- a/test/hotspot/jtreg/serviceability/jvmti/StartPhase/AllowedFunctions/libAllowedFunctions.c Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/serviceability/jvmti/StartPhase/AllowedFunctions/libAllowedFunctions.c Fri Nov 23 09:12:00 2018 -0500
@@ -110,8 +110,8 @@
// This function is only used in a ClassPrepare event context
if ((status & JVMTI_CLASS_STATUS_VERIFIED) == 0 ||
(status & JVMTI_CLASS_STATUS_PREPARED) == 0 ||
- (status & JVMTI_CLASS_STATUS_INITIALIZED) == 1 ||
- (status & JVMTI_CLASS_STATUS_ERROR) == 1) {
+ (status & JVMTI_CLASS_STATUS_INITIALIZED) != 0 ||
+ (status & JVMTI_CLASS_STATUS_ERROR) != 0) {
printf(" ## Error: unexpected class status: 0x%08x\n", status);
}
printf(" Class status: 0x%08x\n", status);
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -36,7 +36,8 @@
// can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here
- if ((jni = (JNIEnv*) nsk_aod_createJNIEnv(vm)) == NULL)
+ jni = (JNIEnv*) nsk_aod_createJNIEnv(vm);
+ if (jni == NULL)
return JNI_ERR;
printf("%s: initialization was done\n", AGENT_NAME);
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -39,7 +39,8 @@
// can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here
- if ((jni = (JNIEnv*) nsk_aod_createJNIEnv(vm)) == NULL)
+ jni = (JNIEnv*) nsk_aod_createJNIEnv(vm);
+ if (jni == NULL)
return JNI_ERR;
printf("%s: initialization was done\n", AGENT_NAME);
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -41,7 +41,8 @@
// can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here
- if ((jni = (JNIEnv*) nsk_aod_createJNIEnv(vm)) == NULL)
+ jni = (JNIEnv*) nsk_aod_createJNIEnv(vm);
+ if (jni == NULL)
return JNI_ERR;
printf("%s: initialization was done\n", AGENT_NAME);
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -38,7 +38,8 @@
JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) {
JNIEnv* jni;
- if ((jni = (JNIEnv*) nsk_aod_createJNIEnv(vm)) == NULL)
+ jni = (JNIEnv*) nsk_aod_createJNIEnv(vm);
+ if (jni == NULL)
return JNI_ERR;
// can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -120,18 +120,22 @@
NSK_COMPLAIN0("TEST FAILURE: unable to obtain a class signature\n");
}
- if ((i = findSig(sig, 1)) != -1) {
+ i = findSig(sig, 1);
+ if (i != -1) {
clsEvents[i]++;
NSK_DISPLAY1("CHECK PASSED: ClassLoad event received for the class \"%s\" as expected\n",
sig);
}
- else if ((i = findSig(sig, 0)) != -1) {
+ else {
+ i = findSig(sig, 0);
+ if (i != -1) {
result = STATUS_FAILED;
primClsEvents[i]++;
NSK_COMPLAIN1(
"TEST FAILED: JVMTI_EVENT_CLASS_LOAD event received for\n"
"\t a primitive class/array of primitive types with the signature \"%s\"\n",
sig);
+ }
}
unlock(jvmti_env, env);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassPrepare/classprep001/classprep001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassPrepare/classprep001/classprep001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -271,7 +271,8 @@
return;
}
- if ((err = (jvmti->GetCurrentThread(&prep_thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&prep_thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
return;
@@ -298,7 +299,8 @@
return STATUS_FAILED;
}
- if ((err = (jvmti->GetCurrentThread(&prep_thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&prep_thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
return STATUS_FAILED;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Exception/exception001/exception001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Exception/exception001/exception001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -270,7 +270,8 @@
return STATUS_FAILED;
}
- if ((err = (jvmti->GetCurrentThread(&thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -80,7 +80,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -63,7 +63,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -438,13 +438,15 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon001/contmon001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon001/contmon001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -58,7 +58,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon002/contmon002.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon002/contmon002.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -58,7 +58,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon003/contmon003.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentContendedMonitor/contmon003/contmon003.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -63,7 +63,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -70,15 +70,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -91,8 +91,8 @@
printf("\ndoRedirect: overwriting the function GetVersion() ...\n");
redir_jni_functions->GetVersion = MyGetVersion;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -108,8 +108,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -126,8 +126,8 @@
redir_calls = 0;
- if ((err = jvmti->GetJNIFunctionTable(&tested_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&tested_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get modified JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -46,9 +46,8 @@
printf("\ntrying to get the JNI function table expecting the error %s to be returned ...\n",
TranslateError(exError));
- if ((err = jvmti->GetJNIFunctionTable(
- (exError==JVMTI_ERROR_NULL_POINTER)?NULL:&orig_jni_functions)) !=
- exError) {
+ err = jvmti->GetJNIFunctionTable((exError == JVMTI_ERROR_NULL_POINTER) ? NULL : &orig_jni_functions);
+ if (err != exError) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: GetJNIFunctionTable() returns %s instead of %s as expected\n",
__FILE__, __LINE__, TranslateError(err), TranslateError(exError));
@@ -80,7 +79,8 @@
only since JDK 1.2 */
if (verbose)
printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n");
- if ((err = vm->DetachCurrentThread()) != 0) {
+ err = vm->DetachCurrentThread();
+ if (err != 0) {
printf(
"(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
"\tcheck with the detached main thread skipped\n",
@@ -90,7 +90,8 @@
if (verbose)
printf("\nattaching the main thread back ...\n");
- if ((err = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != 0) {
+ err = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0);
+ if (err != 0) {
printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
__FILE__, __LINE__, err);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -122,7 +122,8 @@
Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf001_checkMon1(JNIEnv *env,
jclass cls, jint point, jthread thr, jobject lock) {
jobject *monitors;
- if ((monitors = getInfo(env, point, thr, 1)) == NULL) {
+ monitors = getInfo(env, point, thr, 1);
+ if (monitors == NULL) {
return;
}
if (!env->IsSameObject(lock, monitors[0])) {
@@ -135,7 +136,8 @@
Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf001_checkMon2(JNIEnv *env,
jclass cls, jint point, jthread thr, jobject lock1, jobject lock2) {
jobject *monitors;
- if ((monitors = getInfo(env, point, thr, 2)) == NULL) {
+ monitors = getInfo(env, point, thr, 2);
+ if (monitors == NULL) {
return;
}
if (!env->IsSameObject(lock1, monitors[0]) && !env->IsSameObject(lock2, monitors[0])) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadState/thrstat005/thrstat005.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadState/thrstat005/thrstat005.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -144,10 +144,19 @@
printf("checkThreadState: wait %d ms\n", waitTime);
fflush(stdout);
- if ((res = g_ppJvmtiEnv->RawMonitorEnter(g_waitMon)) != JVMTI_ERROR_NONE
- || (res = g_ppJvmtiEnv->RawMonitorWait(g_waitMon, waitTime)) != JVMTI_ERROR_NONE
- || (res = g_ppJvmtiEnv->RawMonitorExit(g_waitMon)) != JVMTI_ERROR_NONE) {
- reportError("GetThreadState: unexpected error", res);
+ res = g_ppJvmtiEnv->RawMonitorEnter(g_waitMon);
+ if (res != JVMTI_ERROR_NONE) {
+ reportError("GetThreadState: unexpected error from RawMontiorEnter", res);
+ return JNI_FALSE;
+ }
+ res = g_ppJvmtiEnv->RawMonitorWait(g_waitMon, waitTime);
+ if (res != JVMTI_ERROR_NONE) {
+ reportError("GetThreadState: unexpected error from RawMontiorWait", res);
+ return JNI_FALSE;
+ }
+ res = g_ppJvmtiEnv->RawMonitorExit(g_waitMon);
+ if (res != JVMTI_ERROR_NONE) {
+ reportError("GetThreadState: unexpected error from RawMonitorExit", res);
return JNI_FALSE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -87,7 +87,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke SuspendThread()\n");
- if ((err = (jvmti->SuspendThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -108,7 +109,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke ResumeThread()\n");
- if ((err = (jvmti->ResumeThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -147,7 +149,8 @@
printf(">>>>>>>> Invoke PopFrame()\n");
set_watch_ev(1); /* watch JVMTI events */
- if ((err = (jvmti->PopFrame(frameThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->PopFrame(frameThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -87,7 +87,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke SuspendThread()\n");
- if ((err = (jvmti->SuspendThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -108,7 +109,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke ResumeThread()\n");
- if ((err = (jvmti->ResumeThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -148,7 +150,8 @@
printf(">>>>>>>> Invoke PopFrame()\n");
set_watch_ev(1); /* watch JVMTI events */
- if ((err = (jvmti->PopFrame(frameThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->PopFrame(frameThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -88,7 +88,8 @@
printf(">>>>>>>> Invoke SuspendThread()\n");
fflush(stdout);
}
- if ((err = (jvmti->SuspendThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -111,7 +112,8 @@
printf(">>>>>>>> Invoke ResumeThread()\n");
fflush(stdout);
}
- if ((err = (jvmti->ResumeThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -160,7 +162,8 @@
}
set_watch_ev(1); /* watch JVMTI events */
- if ((err = (jvmti->PopFrame(frameThr))) == JVMTI_ERROR_NONE) {
+ err = jvmti->PopFrame(frameThr);
+ if (err == JVMTI_ERROR_NONE) {
printf("Check #%d FAILED: PopFrame() was unexpectedly done\n", t_case);
tot_result = STATUS_FAILED;
} else if (err != JVMTI_ERROR_NO_MORE_FRAMES &&
@@ -278,7 +281,8 @@
jclass cls = env->GetObjectClass(frameThr);
jmethodID mid = NULL;
- if ((mid = env->GetMethodID(cls, "activeMethod", "()V")) == NULL) {
+ mid = env->GetMethodID(cls, "activeMethod", "()V");
+ if (mid == NULL) {
printf("TEST FAILURE: nativeMeth2(): Unable to get method ID\n");
tot_result = STATUS_FAILED;
return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -40,7 +40,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -51,7 +51,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -51,7 +51,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -95,7 +96,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke SuspendThread()\n");
- if ((err = (jvmti->SuspendThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread():\n\tthe function returned error %d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
@@ -113,7 +115,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke ResumeThread()\n");
- if ((err = (jvmti->ResumeThread(susThr))) != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(susThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumThread():\n\tthe function returned error %d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
@@ -147,7 +150,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call RedefineClasses():\n\tthe function returned error %d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -53,7 +53,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -110,7 +111,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
if (err == JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED) {
printf("Warning: unrestrictedly redefinition of classes is not implemented,\n"
"\tso the test has no results.\n");
@@ -137,14 +139,16 @@
jint intFld;
jlong longFld;
- if ((fid = env->GetStaticFieldID(redefCls, "intComplNewFld", "I")) == NULL) {
+ fid = env->GetStaticFieldID(redefCls, "intComplNewFld", "I");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the static field \"intComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
}
intFld = env->GetStaticIntField(redefCls, fid);
- if ((fid = env->GetStaticFieldID(redefCls, "longComplNewFld", "J")) == NULL) {
+ fid = env->GetStaticFieldID(redefCls, "longComplNewFld", "J");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the static field \"longComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -58,7 +58,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -115,7 +116,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
if (err == JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED) {
printf(
"Warning: unrestrictedly redefinition of classes is not implemented,\n"
@@ -147,7 +149,8 @@
const char *strFld = NULL;
/* get value of new instance field "intComplNewFld" */
- if ((fid = env->GetFieldID(redefCls, "intComplNewFld", "I")) == NULL) {
+ fid = env->GetFieldID(redefCls, "intComplNewFld", "I");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the field \"intComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
@@ -155,7 +158,8 @@
intFld = env->GetIntField(redefObj, fid);
/* get value of new instance field "longComplNewFld" */
- if ((fid = env->GetFieldID(redefCls, "longComplNewFld", "J")) == NULL) {
+ fid = env->GetFieldID(redefCls, "longComplNewFld", "J");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the field \"longComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
@@ -163,7 +167,8 @@
longFld = env->GetLongField(redefObj, fid);
/* get value of new instance field "stringComplNewFld" */
- if ((fid = env->GetFieldID(redefCls, "stringComplNewFld", "Ljava/lang/String;")) == NULL) {
+ fid = env->GetFieldID(redefCls, "stringComplNewFld", "Ljava/lang/String;");
+ if (fid == NULL) {
printf("%s: Failed to get the field ID for the field \"stringComplNewFld\"\n",
__FILE__);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -106,7 +106,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -172,26 +173,27 @@
return PASSED;
}
- if ((err = (jvmti->GetCurrentThread(&thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
return STATUS_FAILED;
}
- if ((err = (jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable event JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
}
- if ((err = (jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_LOAD, thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable event JVMTI_EVENT_CLASS_LOAD: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
}
- if ((err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_PREPARE, thread)) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable JVMTI_EVENT_CLASS_PREPARE: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
@@ -207,7 +209,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function RedefineClasses() returned error %d: %s\n",
err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -51,7 +51,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -125,7 +126,8 @@
}
/* explode the bomb */
- if ((err = (jvmti->RedefineClasses(1, classDefPtr))) != JVMTI_ERROR_NULL_POINTER) {
+ err = jvmti->RedefineClasses(1, classDefPtr);
+ if (err != JVMTI_ERROR_NULL_POINTER) {
printf("TEST FAILED: the function RedefineClasses() returned error %d: %s\n",
err, TranslateError(err));
printf("\tBut it should return the error JVMTI_ERROR_NULL_POINTER.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -77,7 +77,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -166,15 +167,14 @@
breakpoints[i].m_name, breakpoints[i].m_sign, breakpoints[i].loc);
}
- if ((err = (jvmti->SetBreakpoint(breakpoints[i].mid,
- breakpoints[i].loc))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetBreakpoint(breakpoints[i].mid, breakpoints[i].loc);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SetBreakpoint(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return STATUS_FAILED;
}
- err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_BREAKPOINT, NULL);
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable BREAKPOINT event: %s (%d)\n",
TranslateError(err), err);
@@ -210,7 +210,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call RedefineClasses(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
@@ -261,8 +262,8 @@
}
}
- if ((err = (jvmti->ClearBreakpoint(breakpoints[i].mid,
- breakpoints[i].loc))) != JVMTI_ERROR_NOT_FOUND) {
+ err = jvmti->ClearBreakpoint(breakpoints[i].mid, breakpoints[i].loc);
+ if (err != JVMTI_ERROR_NOT_FOUND) {
printf(
"TEST FAILED: Breakpoint #%d in the %s method:\n"
"\tname=\"%s\"; signature=\"%s\"; location=%d was not cleared:\n"
@@ -282,8 +283,8 @@
breakpoints[i].loc, err, TranslateError(err));
}
- if ((err = (jvmti->SetBreakpoint(breakpoints[i].mid,
- breakpoints[i].loc))) == JVMTI_ERROR_DUPLICATE) {
+ err = jvmti->SetBreakpoint(breakpoints[i].mid, breakpoints[i].loc);
+ if (err == JVMTI_ERROR_DUPLICATE) {
printf(
"TEST FAILED: the function SetBreakpoint() returned the error %d: %s\n"
"\ti.e. the breakpoint #%d has not been really cleared.\n\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -114,7 +114,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -181,8 +182,8 @@
}
/* get the LocalVariableTable attribute */
- if ((err = (jvmti->GetLocalVariableTable(methodsInfo[i].mid,
- &count, &lv_table))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetLocalVariableTable(methodsInfo[i].mid, &count, &lv_table);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call GetLocalVariableTable(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tfor the%s%s method \"%s\", signature \"%s\"\n\n",
@@ -266,7 +267,8 @@
if (vrb)
printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call RedefineClasses(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -93,7 +93,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -159,8 +160,8 @@
}
/* get the LineNumberTable attribute */
- if ((err = (jvmti->GetLineNumberTable(methodsInfo[i].mid,
- &count, &ln_table))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetLineNumberTable(methodsInfo[i].mid, &count, &ln_table);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call GetLineNumberTable(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tfor the%s%s method \"%s\", signature \"%s\"\n\n",
@@ -241,7 +242,8 @@
if (vrb)
printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call RedefineClasses(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -102,7 +102,8 @@
}
/* to check if RedefineClasses is supported */
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -162,7 +162,8 @@
classBytes = (jbyteArray) env->NewGlobalRef(bytes);
- if ((err = (jvmti->GetCurrentThread(&thread))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCurrentThread(&thread);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -77,7 +77,8 @@
jint res;
jvmtiError err;
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -140,8 +141,8 @@
return PASSED;
}
- if ((err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable JVMTI_EVENT_NATIVE_METHOD_BIND: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
@@ -157,7 +158,8 @@
if (vrb == 1)
printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
classDef.class_byte_count);
- if ((err = (jvmti->RedefineClasses(1, &classDef))) != JVMTI_ERROR_NONE) {
+ err = jvmti->RedefineClasses(1, &classDef);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function RedefineClasses() returned error %d: %s\n",
err, TranslateError(err));
printf("\tFor more info about this error see the JVMTI spec.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -76,7 +76,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -101,7 +101,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -113,7 +113,8 @@
return JNI_ERR;
}
- if ((err = (jvmti->GetCapabilities(&caps))) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetCapabilities(&caps);
+ if (err != JVMTI_ERROR_NONE) {
printf("(GetCapabilities) unexpected error: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -70,8 +70,8 @@
static void lock() {
jvmtiError err;
- if ((err = jvmti->RawMonitorEnter(countLock)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->RawMonitorEnter(countLock);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILURE: RawMonitorEnter returns unexpected error: %s\n",
__FILE__, __LINE__, TranslateError(err));
exit(STATUS_FAILED);
@@ -81,8 +81,8 @@
static void unlock() {
jvmtiError err;
- if ((err = jvmti->RawMonitorExit(countLock))
- != JVMTI_ERROR_NONE) {
+ err = jvmti->RawMonitorExit(countLock);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILURE: RawMonitorExit returns unexpected error: %s\n",
__FILE__, __LINE__, TranslateError(err));
exit(STATUS_FAILED);
@@ -116,15 +116,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -137,8 +137,8 @@
printf("\ndoRedirect: overwriting the function MonitorEnter ...\n");
redir_jni_functions->MonitorEnter = MyMonitorEnter;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -154,8 +154,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -168,7 +168,8 @@
void doExec(JNIEnv *env, int thrNum) {
jint res;
- if ((res = env->MonitorEnter(clsObj)) != 0) {
+ res = env->MonitorEnter(clsObj);
+ if (res != 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILURE: MonitorEnter() returns %d for thread #%d\n",
__FILE__, __LINE__, res, thrNum);
@@ -183,7 +184,8 @@
if (verbose)
printf("\ndoExec: thread #%d entered the monitor\n",
thrNum);
- if ((res = env->MonitorExit(clsObj)) != 0) {
+ res = env->MonitorExit(clsObj);
+ if (res != 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILURE: MonitorExit() returns %d for thread #%d\n",
__FILE__, __LINE__, res, thrNum);
@@ -221,7 +223,8 @@
if (verbose)
printf("\nwaitingThread: thread #%d started\n\tattaching the thread to the VM ...\n",
indx);
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
__FILE__, __LINE__, res);
return STATUS_FAILED;
@@ -231,7 +234,8 @@
doExec(env, indx);
- if ((res = vm->DetachCurrentThread()) != 0) {
+ res = vm->DetachCurrentThread();
+ if (res != 0) {
printf("(%s,%d): TEST FAILURE: waitingThread: DetachCurrentThread() returns: %d\n",
__FILE__, __LINE__, res);
return STATUS_FAILED;
@@ -252,7 +256,8 @@
if (verbose)
printf("\ngetObjectFromField: obtaining field ID for name=\"%s\" signature=\"%s\"...\n",
javaField, classSig);
- if ((fid = env->GetFieldID(_objCls, javaField, classSig)) == 0) {
+ fid = env->GetFieldID(_objCls, javaField, classSig);
+ if (fid == 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILURE: failed to get ID for the field \"%s\"\n",
__FILE__, __LINE__, javaField);
@@ -326,7 +331,8 @@
return STATUS_FAILED;
}
- if ((clsObj = env->NewGlobalRef(getObjectFromField(env, obj))) == NULL) {
+ clsObj = env->NewGlobalRef(getObjectFromField(env, obj));
+ if (clsObj == NULL) {
printf("(%s,%d): TEST FAILURE: cannot create a new global reference of class \"%s\"\n",
__FILE__, __LINE__, classSig);
env->FatalError("failed to create a new global reference");
@@ -351,7 +357,8 @@
if (verbose)
printf("\nb) Checking the assertion inside main thread detached and attached again ...\n\ndetaching the main thread ...\n");
- if ((res = vm->DetachCurrentThread()) != 0) {
+ res = vm->DetachCurrentThread();
+ if (res != 0) {
printf(
"(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
"\tcheck with the detached main thread skipped\n",
@@ -359,7 +366,8 @@
} else {
if (verbose)
printf("\nattaching the main thread again ...\n");
- if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0);
+ if (res != 0) {
printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
__FILE__, __LINE__, res);
return STATUS_FAILED;
@@ -419,8 +427,8 @@
vm = jvm;
- if ((err = jvmti->CreateRawMonitor("_counter_lock",
- &countLock)) != JVMTI_ERROR_NONE) {
+ err = jvmti->CreateRawMonitor("_counter_lock", &countLock);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILURE: CreateRawMonitor() returns unexpected error: %s\n",
__FILE__, __LINE__, TranslateError(err));
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -45,8 +45,8 @@
printf("\ntrying to overwrite the JNI function table expecting the error %s to be returned ...\n",
TranslateError(exError));
- if ((err = jvmti->SetJNIFunctionTable(NULL)) !=
- exError) {
+ err = jvmti->SetJNIFunctionTable(NULL);
+ if (err != exError) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: SetJNIFunctionTable() returns %s instead of %s as expected\n",
__FILE__, __LINE__, TranslateError(err), TranslateError(exError));
@@ -78,7 +78,8 @@
only since JDK 1.2 */
if (verbose)
printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n");
- if ((res = vm->DetachCurrentThread()) != JNI_OK) {
+ res = vm->DetachCurrentThread();
+ if (res != JNI_OK) {
printf(
"(%s,%d): Warning: DetachCurrentThread() returns: %d\n"
"\tcheck with the detached main thread skipped\n",
@@ -88,7 +89,8 @@
if (verbose)
printf("\nattaching the main thread back ...\n");
- if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != JNI_OK) {
+ res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0);
+ if (res != JNI_OK) {
printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
__FILE__, __LINE__, res);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -108,7 +108,8 @@
if (jni->IsSameObject(thread, thr) &&
jni->IsSameObject(object_M, obj)) {
- if (!(line = findLineNumber(jvmti, thread))) {
+ line = findLineNumber(jvmti, thread);
+ if (!line) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN2("MonitorContendedEnter event: thread=%p, object=%p\n",
thr, obj);
@@ -152,7 +153,8 @@
if (jni->IsSameObject(thread, thr) &&
jni->IsSameObject(object_M, obj)) {
- if (!(line = findLineNumber(jvmti, thread))) {
+ line = findLineNumber(jvmti, thread);
+ if (!line) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN2("MonitorContendedEntered event: thread=%p, object=%p\n",
thr, obj);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -41,7 +41,7 @@
/* ============================================================================= */
static void JNICALL
-ClassUnload(jvmtiEnv jvmti_env, JNIEnv *jni_env, jthread thread, jclass klass, ...) {
+ClassUnload(jvmtiEnv* jvmti_env, JNIEnv *jni_env, jthread thread, jclass klass, ...) {
/*
* With the CMS GC the event can be posted on
* a ConcurrentGC thread that is not a JavaThread.
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -100,7 +100,8 @@
} else {
NSK_COMPLAIN0("\nMyClass :: Failed to redefine ..\n");
}
- if ((myTestClass = (jclass) jni_env->NewGlobalRef(klass)) == NULL) {
+ myTestClass = (jclass) jni_env->NewGlobalRef(klass);
+ if (myTestClass == NULL) {
NSK_COMPLAIN0("Failed to create global ref...");
}
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -63,16 +63,16 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
result = STATUS_FAILED;
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get redirected JNI function table");
@@ -83,8 +83,8 @@
redir_jni_functions->GetVersion = MyGetVersion;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to set new JNI function table");
@@ -100,8 +100,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to restore original JNI function table");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -98,15 +98,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -137,8 +137,8 @@
if (verbose)
printf("\ndoRedirect: obtaining field ID for \"%s\"...\n",
meth_info[i].f_name);
- if ((meth_info[i].fid = env->GetStaticFieldID(
- cls, meth_info[i].f_name, "I")) == 0) {
+ meth_info[i].fid = env->GetStaticFieldID(cls, meth_info[i].f_name, "I");
+ if (meth_info[i].fid == 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get ID for the field %s\n",
__FILE__, __LINE__, meth_info[i].f_name);
@@ -159,8 +159,8 @@
}
}
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -176,8 +176,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -103,15 +103,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -126,8 +126,8 @@
redir_jni_functions->ThrowNew = MyThrowNew;
redir_jni_functions->ExceptionOccurred = MyExceptionOccurred;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -143,8 +143,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -157,7 +157,8 @@
void doExc(JNIEnv *env, jthrowable thrw, jclass thrCls, const char *msg) {
jint res;
- if ((res = env->ThrowNew(thrCls, msg)) != 0) {
+ res = env->ThrowNew(thrCls, msg);
+ if (res != 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to throw new exception\n",
__FILE__, __LINE__);
@@ -176,7 +177,8 @@
__FILE__, __LINE__, msg);
}
- if ((res = env->Throw(thrw)) != 0) {
+ res = env->Throw(thrw);
+ if (res != 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to throw exception\n",
__FILE__, __LINE__);
@@ -264,7 +266,8 @@
if (verbose)
printf("\ncheck: obtaining field ID for \"name=%s signature=%s\"...\n",
javaField, excClassSig);
- if ((fid = env->GetFieldID(objCls, javaField, excClassSig)) == 0) {
+ fid = env->GetFieldID(objCls, javaField, excClassSig);
+ if (fid == 0) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get ID for the field \"%s\"\n",
__FILE__, __LINE__, javaField);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -78,13 +78,15 @@
if (verbose)
printf("\ndoRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -98,8 +100,8 @@
redir_jni_functions->AllocObject = MyAllocObject;
redir_jni_functions->NewObjectV = MyNewObjectV;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -115,7 +117,8 @@
if (verbose)
printf("\ndoRestore: restoring the original JNI function table ...\n");
- if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
__FILE__, __LINE__, TranslateError(err));
@@ -130,8 +133,8 @@
jobject newObj;
va_list args;
va_start(args, msg);
- if ((allObj = env->AllocObject(allCls))
- == NULL) {
+ allObj = env->AllocObject(allCls);
+ if (allObj == NULL) {
result = STATUS_FAILED;
printf("(%s,%d): TEST FAILED: failed to call %s AllocObject()\n",
__FILE__, __LINE__, msg);
@@ -211,14 +214,15 @@
return STATUS_FAILED;
}
- if ((objCls = env->FindClass(classSig)) == NULL) {
+ objCls = env->FindClass(classSig);
+ if (objCls == NULL) {
printf("(%s,%d): TEST FAILED: failed to call FindClass() for \"%s\"\n",
__FILE__, __LINE__, classSig);
return STATUS_FAILED;
}
- if ((ctorId = env->GetMethodID(objCls, "<init>", "()V"))
- == NULL) {
+ ctorId = env->GetMethodID(objCls, "<init>", "()V");
+ if (ctorId == NULL) {
printf("(%s,%d): TEST FAILED: failed to call GetMethodID() for a constructor\n",
__FILE__, __LINE__);
return STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -99,13 +99,15 @@
NSK_DISPLAY1("\n%s JVMTI env: doRedirect: obtaining the JNI function table ...\n",
(indx==0)?"first":"second");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx])) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx]);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get original JNI function table: %s\n",
(indx==0)?"first":"second", TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx])) != JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx]);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get redirected JNI function table: %s\n",
(indx==0)?"first":"second", TranslateError(err));
@@ -119,7 +121,8 @@
redir_jni_functions[indx]->GetVersion =
(indx==0)?MyGetVersionA:MyGetVersionB;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx])) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx]);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to set new JNI function table: %s\n",
(indx==0)?"first":"second", TranslateError(err));
@@ -194,8 +197,8 @@
callbacks.VMInit = &VMInitB;
break;
}
- if ((err = jvmti[indx]->SetEventCallbacks(
- &callbacks, sizeof(callbacks))) != JVMTI_ERROR_NONE) {
+ err = jvmti[indx]->SetEventCallbacks(&callbacks, sizeof(callbacks));
+ if (err != JVMTI_ERROR_NONE) {
NSK_COMPLAIN1("TEST FAILURE: failed to set event callbacks: %s\n",
TranslateError(err));
result = STATUS_FAILED;
@@ -204,8 +207,8 @@
NSK_DISPLAY1("\nagent %s initializer: setting event callbacks done\n\tenabling events ...\n",
(indx==0)?"A":"B");
- if ((err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_VM_INIT, NULL)) != JVMTI_ERROR_NONE) { /* enable event globally */
+ err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
+ if (err != JVMTI_ERROR_NONE) { /* enable event globally */
NSK_COMPLAIN2("TEST FAILURE: failed to enable JVMTI_EVENT_VM_INIT event for the agent %s: %s\n",
(indx==0)?"A":"B", TranslateError(err));
result = STATUS_FAILED;
@@ -255,7 +258,8 @@
int exitCode = PASSED;
NSK_DISPLAY0("\nthe agent A started\n\tattaching the thread to the VM ...\n");
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n", res);
exit(STATUS_FAILED);
}
@@ -304,7 +308,8 @@
NSK_DISPLAY1("\nagent A: detaching and returning exit code %d\n",
exitCode);
- if ((res = vm->DetachCurrentThread()) != 0) {
+ res = vm->DetachCurrentThread();
+ if (res != 0) {
NSK_COMPLAIN1("TEST WARNING: agent A: DetachCurrentThread() returns: %d\n", res);
}
return exitCode;
@@ -318,7 +323,8 @@
int exitCode = PASSED;
NSK_DISPLAY0("\nthe agent B started\n\tattaching the thread to the VM ...\n");
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n",
res);
exit(STATUS_FAILED);
@@ -366,7 +372,8 @@
NSK_DISPLAY1("\nagent B: detaching and returning exit code %d\n",
exitCode);
- if ((res = vm->DetachCurrentThread()) != 0) {
+ res = vm->DetachCurrentThread();
+ if (res != 0) {
NSK_COMPLAIN1("TEST WARNING: agent B: DetachCurrentThread() returns: %d\n", res);
}
return exitCode;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -106,7 +106,8 @@
static jint enterMonitor(JNIEnv *env, const char *thr) {
jint result;
- if ((result = env->MonitorEnter(clsObj)) != 0) {
+ result = env->MonitorEnter(clsObj);
+ if (result != 0) {
NSK_COMPLAIN2("TEST FAILURE: %s: MonitorEnter() returns: %d\n",
thr, result);
return STATUS_FAILED;
@@ -125,7 +126,8 @@
static jint exitMonitor(JNIEnv *env, const char *thr) {
jint result;
- if ((result = env->MonitorExit(clsObj)) != 0) {
+ result = env->MonitorExit(clsObj);
+ if (result != 0) {
NSK_COMPLAIN2("TEST FAILURE: %s: MonitorExit() returns: %d\n",
thr, result);
return STATUS_FAILED;
@@ -138,15 +140,15 @@
jvmtiError err;
NSK_DISPLAY0("doRedirect: obtaining the JNI function table ...\n");
- if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: failed to get original JNI function table: %s\n",
TranslateError(err));
env->FatalError("failed to get original JNI function table");
}
- if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->GetJNIFunctionTable(&redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: failed to get redirected JNI function table: %s\n",
TranslateError(err));
@@ -158,8 +160,8 @@
redir_jni_functions->MonitorEnter = MyMonitorEnter;
- if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions)) !=
- JVMTI_ERROR_NONE) {
+ err = jvmti->SetJNIFunctionTable(redir_jni_functions);
+ if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILED: failed to set new JNI function table: %s\n",
TranslateError(err));
@@ -198,7 +200,8 @@
"waitingThread: thread #%d started\n"
"\tattaching the thread to the VM ...\n",
indx);
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
res);
return STATUS_FAILED;
@@ -229,7 +232,8 @@
int tries = 0;
NSK_DISPLAY0("ownerThread: thread started\n\tattaching the thread to the VM ...\n");
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: ownerThread: AttachCurrentThread() returns: %d\n",
res);
return STATUS_FAILED;
@@ -270,7 +274,8 @@
int tries = 0;
NSK_DISPLAY0("redirectorThread: thread started\n\tattaching the thread to the VM ...\n");
- if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+ res = vm->AttachCurrentThread((void **) &env, (void *) 0);
+ if (res != 0) {
NSK_COMPLAIN1("TEST FAILURE: redirectorThread: AttachCurrentThread() returns: %d\n",
res);
return STATUS_FAILED;
@@ -294,7 +299,8 @@
NSK_DISPLAY2("getObjectFromField: obtaining field ID for name=\"%s\" signature=\"%s\"...\n",
javaField, classSig);
- if ((fid = env->GetFieldID(_objCls, javaField, classSig)) == 0) {
+ fid = env->GetFieldID(_objCls, javaField, classSig);
+ if (fid == 0) {
result = STATUS_FAILED;
NSK_COMPLAIN1("TEST FAILURE: failed to get ID for the field \"%s\"\n",
javaField);
@@ -322,7 +328,8 @@
}
/* prepare the testing */
- if ((clsObj = env->NewGlobalRef(getObjectFromField(env, obj))) == NULL) {
+ clsObj = env->NewGlobalRef(getObjectFromField(env, obj));
+ if (clsObj == NULL) {
NSK_COMPLAIN1("TEST FAILURE: cannot create a new global reference of class \"%s\"\n",
classSig);
env->FatalError("failed to create a new global reference");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -85,8 +85,8 @@
}
printf(">>>>>>>> Invoke SuspendThread()\n");
- if ((err = (jvmti->SuspendThread(earlyretThr)))
- != JVMTI_ERROR_NONE) {
+ err = jvmti->SuspendThread(earlyretThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -106,8 +106,8 @@
}
printf(">>>>>>>> Invoke ResumeThread()\n");
- if ((err = (jvmti->ResumeThread(earlyretThr)))
- != JVMTI_ERROR_NONE) {
+ err = jvmti->ResumeThread(earlyretThr);
+ if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
__FILE__, err, TranslateError(err));
return JNI_ERR;
@@ -168,8 +168,8 @@
}
printf("After call to GetMethodID(%s, %s)\n", name_exp, sig_exp);
- if ((err = (jvmti->ForceEarlyReturnLong(earlyretThr, valToRet)))
- != JVMTI_ERROR_NONE) {
+ err = jvmti->ForceEarlyReturnLong(earlyretThr, valToRet);
+ if (err != JVMTI_ERROR_NONE) {
printf("TEST FAILED: the function ForceEarlyReturn()"
" returned the error %d: %s\n",
err, TranslateError(err));
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -110,7 +110,8 @@
printdump = JNI_TRUE;
}
- if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
+ res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
+ if (res != JNI_OK) {
printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
return JNI_ERR;
}
@@ -149,15 +150,15 @@
return JNI_ERR;
}
- if ((err = (jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_VM_INIT, NULL))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable event JVMTI_EVENT_VM_INIT: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
}
- if ((err = (jvmti->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) != JVMTI_ERROR_NONE) {
+ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL);
+ if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable event JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: %s (%d)\n",
TranslateError(err), err);
return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -73,7 +73,7 @@
}
static void JNICALL
-ClassUnload(jvmtiEnv jvmti_env, JNIEnv *jni_env, jthread thread, jclass cls) {
+ClassUnload(jvmtiEnv* jvmti_env, JNIEnv *jni_env, jthread thread, jclass cls) {
}
/*
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -581,8 +581,8 @@
jbyteArray classBytes;
jboolean isCopy;
- if ((_clsInfo = (class_info*)
- malloc(sizeof(class_info))) == NULL)
+ _clsInfo = (class_info*) malloc(sizeof(class_info));
+ if (_clsInfo == NULL)
jni_env->FatalError("JVMTIagent: cannot allocate memory for class_info\n");
/* fill the structure class_info */
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -237,7 +237,8 @@
return JNI_FALSE;
}
- if ((pRefRec = findRefToVerify(tagFrom, tagTo, refKind)) != NULL) {
+ pRefRec = findRefToVerify(tagFrom, tagTo, refKind);
+ if (pRefRec != NULL) {
pRefRec->_expectedCount += count;
return JNI_TRUE;
}
@@ -249,7 +250,8 @@
{
RefToVerify * pRefRec;
- if ((pRefRec = findRefToVerify(tagFrom, tagTo, refKind)) != NULL) {
+ pRefRec = findRefToVerify(tagFrom, tagTo, refKind);
+ if (pRefRec != NULL) {
pRefRec->_actualCount++;
return JNI_TRUE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -41,7 +41,8 @@
}
FIND_CLASS(stackOverflowErrorClass, "java/lang/StackOverflowError");
- if ((stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass)) == NULL) {
+ stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass);
+ if (stackOverflowErrorClass == NULL) {
printf("Can't create global ref for stack overflow class\n");
return 0;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -43,7 +43,8 @@
}
FIND_CLASS(stackOverflowErrorClass, "java/lang/StackOverflowError");
- if ((stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass)) == NULL) {
+ stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass);
+ if (stackOverflowErrorClass == NULL) {
printf("Can't create global ref for stack overflow class\n");
return 0;
}
--- a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp Fri Nov 23 09:02:17 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp Fri Nov 23 09:12:00 2018 -0500
@@ -147,7 +147,8 @@
static const char* name = "DBGHELP.DLL";
printf("# TEST: creating Windows minidump...\n");
- if ((size = GetSystemDirectory(path, pathLen)) > 0) {
+ size = GetSystemDirectory(path, pathLen);
+ if (size > 0) {
strcat(path, "\\");
strcat(path, name);
dbghelp = LoadLibrary(path);
@@ -158,12 +159,15 @@
}
// try Windows directory
- if (dbghelp == NULL && ((size = GetWindowsDirectory(path, pathLen)) > 6)) {
- strcat(path, "\\");
- strcat(path, name);
- dbghelp = LoadLibrary(path);
- if (dbghelp == NULL) {
- reportLastError("Load DBGHELP.DLL from Windows directory");
+ if (dbghelp == NULL) {
+ size = GetWindowsDirectory(path, pathLen);
+ if (size > 6) {
+ strcat(path, "\\");
+ strcat(path, name);
+ dbghelp = LoadLibrary(path);
+ if (dbghelp == NULL) {
+ reportLastError("Load DBGHELP.DLL from Windows directory");
+ }
}
}
if (dbghelp == NULL) {
--- a/test/jdk/ProblemList.txt Fri Nov 23 09:02:17 2018 -0500
+++ b/test/jdk/ProblemList.txt Fri Nov 23 09:12:00 2018 -0500
@@ -876,7 +876,7 @@
com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java 8169942 linux-i586,macosx-all,windows-x64
-com/sun/jndi/ldap/LdapTimeoutTest.java 8151678 linux-all
+com/sun/jndi/ldap/LdapTimeoutTest.java 8151678 generic-all
com/sun/jndi/dns/ConfigTests/PortUnreachable.java 7164518 macosx-all
--- a/test/jdk/jdk/jfr/event/runtime/TestBiasedLockRevocationEvents.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/jdk/jdk/jfr/event/runtime/TestBiasedLockRevocationEvents.java Fri Nov 23 09:12:00 2018 -0500
@@ -275,13 +275,13 @@
List<RecordedEvent> events = Events.fromRecording(recording);
// Determine which safepoints included single and bulk revocation VM operations
- Set<Integer> vmOperationsSingle = new HashSet<>();
- Set<Integer> vmOperationsBulk = new HashSet<>();
+ Set<Long> vmOperationsSingle = new HashSet<>();
+ Set<Long> vmOperationsBulk = new HashSet<>();
for (RecordedEvent event : events) {
if (event.getEventType().getName().equals(EventNames.ExecuteVMOperation)) {
String operation = event.getValue("operation");
- Integer safepointId = event.getValue("safepointId");
+ Long safepointId = event.getValue("safepointId");
if (operation.equals("RevokeBias")) {
vmOperationsSingle.add(safepointId);
@@ -297,14 +297,14 @@
// Match all revoke events to a corresponding VMOperation event
for (RecordedEvent event : events) {
if (event.getEventType().getName().equals(EventNames.BiasedLockRevocation)) {
- Integer safepointId = event.getValue("safepointId");
+ Long safepointId = event.getValue("safepointId");
String lockClass = ((RecordedClass)event.getValue("lockClass")).getName();
if (lockClass.equals(MyLock.class.getName())) {
Asserts.assertTrue(vmOperationsSingle.contains(safepointId));
revokeCount++;
}
} else if (event.getEventType().getName().equals(EventNames.BiasedLockClassRevocation)) {
- Integer safepointId = event.getValue("safepointId");
+ Long safepointId = event.getValue("safepointId");
String lockClass = ((RecordedClass)event.getValue("revokedClass")).getName();
if (lockClass.toString().equals(MyLock.class.getName())) {
Asserts.assertTrue(vmOperationsBulk.contains(safepointId));
--- a/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java Fri Nov 23 09:12:00 2018 -0500
@@ -84,9 +84,9 @@
}
// Collect all events grouped by safepoint id
- SortedMap<Integer, Set<String>> safepointIds = new TreeMap<>();
+ SortedMap<Long, Set<String>> safepointIds = new TreeMap<>();
for (RecordedEvent event : Events.fromRecording(recording)) {
- Integer safepointId = event.getValue("safepointId");
+ Long safepointId = event.getValue("safepointId");
if (!safepointIds.containsKey(safepointId)) {
safepointIds.put(safepointId, new HashSet<>());
}
--- a/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java Fri Nov 23 09:12:00 2018 -0500
@@ -99,9 +99,7 @@
private static void testNegative(String configName, Object value) {
try {
- // Syntactically invalid arguments are catched by the JCMD framework where an error code of 1 is returned.
- // Syntactically valid arguments that are semantically invalid (invalid value ranges for example) are handled by JFR code, it will always return a value of 0.
- JcmdHelper.jcmd(configName.equals(UNSUPPORTED_OPTION) ? 1 : 0, "JFR.configure", configName + "=" + value);
+ JcmdHelper.jcmd(1, "JFR.configure", configName + "=" + value);
} catch(Exception e) {
testExceptions.add(e);
}
--- a/test/jdk/jdk/nio/zipfs/ZipFSTester.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/jdk/jdk/nio/zipfs/ZipFSTester.java Fri Nov 23 09:12:00 2018 -0500
@@ -484,8 +484,12 @@
byte[] buf = new byte[1024];
ByteBuffer bb = ByteBuffer.wrap(buf);
for (int i = 0; i < 10; i++) {
- int pos = rdm.nextInt((int)sbc.size());
- int len = rdm.nextInt(Math.min(buf.length, expected.length - pos));
+ int pos = 0;
+ int len = 0;
+ if (expected.length > 0) {
+ pos = rdm.nextInt((int) sbc.size());
+ len = rdm.nextInt(Math.min(buf.length, expected.length - pos));
+ }
// System.out.printf(" --> %d, %d%n", pos, len);
bb.position(0).limit(len); // bb.flip().limit(len);
if (sbc.position(pos).position() != pos ||
--- a/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java Fri Nov 23 09:12:00 2018 -0500
@@ -55,9 +55,17 @@
@Test
void test(Path base) throws Exception {
Path srcDir = base.resolve("src");
- createTestClass(srcDir);
+ Path outDir = base.resolve("out");
+
+ MethodBuilder method = MethodBuilder
+ .parse("public void func(A a) {}")
+ .setComments("test description with {@index search_phrase_a class a}");
- Path outDir = base.resolve("out");
+ new ClassBuilder(tb, "pkg.A")
+ .setModifiers("public", "class")
+ .addMembers(method)
+ .write(srcDir);
+
javadoc("-d", outDir.toString(),
"-sourcepath", srcDir.toString(),
"pkg");
@@ -74,15 +82,24 @@
"<div class=\"block\">test description with search_phrase_a</div>");
}
- void createTestClass(Path srcDir) throws Exception {
- MethodBuilder method = MethodBuilder
- .parse("public void func(A a) {}")
- .setComments("test description with {@index search_phrase_a class a}");
+ @Test
+ void testIndexWithinATag(Path base) throws Exception {
+ Path srcDir = base.resolve("src");
+ Path outDir = base.resolve("out");
- new ClassBuilder(tb, "pkg.A")
+ new ClassBuilder(tb, "pkg2.A")
.setModifiers("public", "class")
- .addMembers(method)
+ .addMembers(MethodBuilder.parse("public void func(){}")
+ .setComments("a within a : <a href='..'>{@index check}</a>"))
.write(srcDir);
+ javadoc("-d", outDir.toString(),
+ "-sourcepath", srcDir.toString(),
+ "pkg2");
+
+ checkExit(Exit.OK);
+
+ checkOutput(Output.OUT, true,
+ "warning: {@index} tag, which expands to <a>, within <a>");
}
}
--- a/test/langtools/jdk/javadoc/doclet/testSeeTag/TestSeeTag.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/jdk/javadoc/doclet/testSeeTag/TestSeeTag.java Fri Nov 23 09:12:00 2018 -0500
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8017191 8182765
+ * @bug 8017191 8182765 8200432
* @summary Javadoc is confused by at-link to imported classes outside of the set of generated packages
* @author jjg
* @library ../lib
@@ -83,5 +83,20 @@
+ "<a href=\"http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#see\">Javadoc</a>, \n"
+ "<a href=\"Test.InnerOne.html#baz-float-\"><code>something</code></a></dd>\n"
+ "</dl>");
+ }
+
+ @Test
+ void testBadReference() {
+ javadoc("-d", "out-badref",
+ "-sourcepath", testSrc,
+ "badref");
+ checkExit(Exit.ERROR);
+
+ checkOutput("badref/Test.html", true,
+ "<dl>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd><code>Object[]</code>, \n"
+ + "<code>Foo<String></code></dd>\n"
+ + "</dl>");
+ }
}
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testSeeTag/badref/Test.java Fri Nov 23 09:12:00 2018 -0500
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 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
+ * 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.
+ */
+
+package badref;
+
+/**
+ * @see Object[]
+ * @see Foo<String>
+ */
+public interface Test {}
--- a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java Fri Nov 23 09:12:00 2018 -0500
@@ -55,9 +55,18 @@
@Test
void test(Path base) throws Exception {
Path srcDir = base.resolve("src");
- createTestClass(srcDir);
+ Path outDir = base.resolve("out");
+
+ MethodBuilder method = MethodBuilder
+ .parse("public void func(A a) {}")
+ .setComments("test with {@systemProperty java.version}");
- Path outDir = base.resolve("out");
+ new ClassBuilder(tb, "pkg.A")
+ .setComments("test with {@systemProperty user.name}")
+ .setModifiers("public", "class")
+ .addMembers(method)
+ .write(srcDir);
+
javadoc("-d", outDir.toString(),
"-sourcepath", srcDir.toString(),
"pkg");
@@ -87,15 +96,24 @@
+ "\"u\":\"pkg/A.html#user.name\"}");
}
- void createTestClass(Path srcDir) throws Exception {
- MethodBuilder method = MethodBuilder
- .parse("public void func(A a) {}")
- .setComments("test with {@systemProperty java.version}");
+ @Test
+ void testSystemProperytWithinATag(Path base) throws Exception {
+ Path srcDir = base.resolve("src");
+ Path outDir = base.resolve("out");
- new ClassBuilder(tb, "pkg.A")
- .setComments("test with {@systemProperty user.name}")
+ new ClassBuilder(tb, "pkg2.A")
.setModifiers("public", "class")
- .addMembers(method)
+ .addMembers(MethodBuilder.parse("public void func(){}")
+ .setComments("a within a : <a href='..'>{@systemProperty user.name}</a>"))
.write(srcDir);
+
+ javadoc("-d", outDir.toString(),
+ "-sourcepath", srcDir.toString(),
+ "pkg2");
+
+ checkExit(Exit.OK);
+
+ checkOutput(Output.OUT, true,
+ "warning: {@systemProperty} tag, which expands to <a>, within <a>");
}
}
--- a/test/langtools/tools/doclint/ReferenceTest.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/tools/doclint/ReferenceTest.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 8004832 8020556 8002154
+ * @bug 8004832 8020556 8002154 8200432
* @summary Add new doclint package
* @modules jdk.compiler/com.sun.tools.doclint
* @build DocLintTester
@@ -59,9 +59,21 @@
/**
* {@link java.util.List<String>}
* {@link java.util.List<String>#equals}
+ * {@link not.Found<String>}
* @see java.util.List<String>
* @see java.util.List<String>#equals
+ * @see not.Found<String>
*/
public void invalid_type_args() { }
+
+ /**
+ * {@link java.lang.String[]}
+ * {@link java.lang.String[]#equals}
+ * {@link not.Found[]}
+ * @see java.lang.String[]
+ * @see java.lang.String[]#equals
+ * @see not.Found[]
+ */
+ public void invalid_array_types() { }
}
--- a/test/langtools/tools/doclint/ReferenceTest.out Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/tools/doclint/ReferenceTest.out Fri Nov 23 09:12:00 2018 -0500
@@ -32,11 +32,35 @@
* {@link java.util.List<String>#equals}
^
ReferenceTest.java:62: error: type arguments not allowed here
+ * {@link not.Found<String>}
+ ^
+ReferenceTest.java:63: error: type arguments not allowed here
* @see java.util.List<String>
^
-ReferenceTest.java:63: error: type arguments not allowed here
+ReferenceTest.java:64: error: type arguments not allowed here
* @see java.util.List<String>#equals
^
-12 errors
+ReferenceTest.java:65: error: type arguments not allowed here
+ * @see not.Found<String>
+ ^
+ReferenceTest.java:70: error: array type not allowed here
+ * {@link java.lang.String[]}
+ ^
+ReferenceTest.java:71: error: array type not allowed here
+ * {@link java.lang.String[]#equals}
+ ^
+ReferenceTest.java:72: error: array type not allowed here
+ * {@link not.Found[]}
+ ^
+ReferenceTest.java:73: error: array type not allowed here
+ * @see java.lang.String[]
+ ^
+ReferenceTest.java:74: error: array type not allowed here
+ * @see java.lang.String[]#equals
+ ^
+ReferenceTest.java:75: error: array type not allowed here
+ * @see not.Found[]
+ ^
+20 errors
1 warning
--- a/test/langtools/tools/jdeps/Basic.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/tools/jdeps/Basic.java Fri Nov 23 09:12:00 2018 -0500
@@ -37,6 +37,7 @@
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.*;
import java.util.regex.*;
import java.util.stream.Collectors;
@@ -135,6 +136,19 @@
new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"},
new String[] {"compact1", "compact1", dir1.toFile().getName(), dir2.toFile().getName()},
new String[] {"-v", "-classpath", cpath.toString(), "Test.class"});
+
+ // tests --missing-deps option
+ test(new File(testDir, "Test.class"),
+ new String[] {"p.Foo", "p.Bar"},
+ new String[] {"not found", "not found"},
+ new String[] {"--missing-deps"});
+
+ // no missing dependence
+ test(new File(testDir, "Test.class"),
+ new String[0],
+ new String[0],
+ new String[] {"--missing-deps", "-classpath", cpath.toString()});
+
return errors;
}
--- a/test/langtools/tools/jdeps/MultiReleaseJar.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/tools/jdeps/MultiReleaseJar.java Fri Nov 23 09:12:00 2018 -0500
@@ -27,7 +27,7 @@
* @summary Tests for jdeps tool with multi-release jar files
* @modules jdk.jdeps/com.sun.tools.jdeps
* @library mrjar mrjar/base mrjar/9 mrjar/10 mrjar/v9 mrjar/v10
- * @build test.* p.* q.* foo/*
+ * @build test.* p.* q.* foo/* Main
* @run testng MultiReleaseJar
*/
@@ -59,10 +59,7 @@
testJdk = System.getProperty("test.jdk");
fileSep = System.getProperty("file.separator");
cmdPath = Paths.get(testJdk, "bin");
- }
- @Test
- public void basic() throws Exception {
// build Version.jar, Version_9.jar and main.jar
Result r = run("jar -cf Version.jar -C base test --release 9 -C 9 test --release 10 -C 10 test");
checkResult(r);
@@ -70,11 +67,20 @@
r = run("jar -cf Version_9.jar -C base test --release 9 -C 9 test");
checkResult(r);
- r = run("jar -cf Main.jar test/Main.class");
+ r = run("jar -cf Main.jar Main.class");
+ checkResult(r);
+
+ r = run("jar -cf Foo.jar -C base p");
checkResult(r);
- // try out a bunch of things
- r = run("jdeps --multi-release 9 -v missing.jar");
+ Path foo = Paths.get(System.getProperty("test.classes")).resolve("modules").resolve("foo");
+ r = run("jar -uf Foo.jar --release 9 -C " + foo.toString() + " module-info.class --release 10 -C v10 q");
+ checkResult(r);
+ }
+
+ @Test
+ public void basic() throws Exception {
+ Result r = run("jdeps --multi-release 9 -v missing.jar");
checkResult(r, false, "Warning: Path does not exist: missing.jar");
r = run("jdeps -v Version.jar");
@@ -115,7 +121,7 @@
r = run("jdeps --multi-release 9.1 -v Version.jar");
checkResult(r, false, "Error: invalid argument for option: 9.1");
- runJdeps("test/Main.class");
+ runJdeps("Main.class");
runJdeps("Main.jar");
}
@@ -124,14 +130,14 @@
Result r = run("jdeps -v -R -cp Version.jar " + path);
checkResult(r, false, "--multi-release option is not set");
- r = run("jdeps -v -R -cp Version.jar -multi-release 9 " + path);
+ r = run("jdeps -v -R -cp Version.jar --module-path Foo.jar -multi-release 9 " + path);
checkResult(r, false,
"Error: unknown option: -multi-release",
"Usage: jdeps <options> <path",
"use --help"
);
- r = run("jdeps -v -R -cp Version.jar --multi-release 9 " + path);
+ r = run("jdeps -v -R -cp Version.jar --module-path Foo.jar --multi-release 9 " + path);
String name = path;
int index = path.lastIndexOf('/');
@@ -139,66 +145,94 @@
name = path.substring(index + 1, path.length());
}
checkResult(r, true,
- name + " ->",
- name + " ->",
- "test.Main",
- "test.Main",
- "test.Main",
- "Version.jar ->",
+ name + " -> Version.jar",
+ name + " -> foo",
+ name + " -> java.base",
+ "Main",
+ "Main",
+ "Main",
+ "Main",
+ "Version.jar -> java.base",
"9/test.NonPublic",
"9/test.NonPublic",
"9/test.Version",
"9/test.Version",
"9/test.Version",
- "9/test.Version"
+ "9/test.Version",
+ "foo",
+ "Foo.jar",
+ "requires mandated java.base",
+ "foo -> java.base",
+ "p.Foo"
);
- r = run("jdeps -v -R -cp Version.jar --multi-release 10 " + path);
+ r = run("jdeps -v -R -cp Version.jar --module-path Foo.jar --multi-release 10 " + path);
checkResult(r, true,
- name + " ->",
- name + " ->",
- "test.Main",
- "test.Main",
- "test.Main",
+ name + " -> Version.jar",
+ name + " -> foo",
+ name + " -> java.base",
+ "Main",
+ "Main",
+ "Main",
+ "Main",
"Version.jar ->",
"10/test.Version",
"10/test.Version",
"10/test.Version",
"10/test.Version",
"9/test.NonPublic",
- "9/test.NonPublic"
+ "9/test.NonPublic",
+ "foo",
+ "Foo.jar",
+ "requires mandated java.base",
+ "foo -> java.base",
+ "p.Foo"
);
- r = run("jdeps -v -R -cp Version.jar --multi-release base " + path);
+ r = run("jdeps -v -R -cp Version.jar --module-path Foo.jar --multi-release base " + path);
checkResult(r, true,
- name + " ->",
- name + " ->",
- "test.Main",
- "test.Main",
- "test.Main",
+ name + " -> Version.jar",
+ name + " -> foo",
+ name + " -> java.base",
+ "Main",
+ "Main",
+ "Main",
+ "Main",
"Version.jar ->",
"test.Version",
- "test.Version"
+ "test.Version",
+ "foo",
+ "Foo.jar",
+ "requires mandated java.base",
+ "foo -> java.base",
+ "p.Foo"
);
- r = run("jdeps -v -R -cp Version.jar --multi-release 9.1 " + path);
+ r = run("jdeps -v -R -cp Version.jar --module-path Foo.jar --multi-release 9.1 " + path);
checkResult(r, false, "Error: invalid argument for option: 9.1");
// Version_9.jar does not have any version 10 entry
- r = run("jdeps -v -R -cp Version_9.jar --multi-release 10 " + path);
+ r = run("jdeps -v -R -cp Version_9.jar --module-path Foo.jar --multi-release 10 " + path);
checkResult(r, true,
- name + " ->",
- name + " ->",
- "test.Main",
- "test.Main",
- "test.Main",
+ name + " -> Version_9.jar",
+ name + " -> foo",
+ name + " -> java.base",
+ "Main",
+ "Main",
+ "Main",
+ "Main",
"Version_9.jar ->",
"9/test.NonPublic",
"9/test.NonPublic",
"9/test.Version",
"9/test.Version",
"9/test.Version",
- "9/test.Version"
+ "9/test.Version",
+ "foo",
+ "Foo.jar",
+ "requires mandated java.base",
+ "foo -> java.base",
+ "p.Foo"
);
}
@@ -236,17 +270,10 @@
@Test
public void modularJar() throws Exception {
- Result r = run("jar -cf foo.jar -C base p");
- checkResult(r);
-
- Path foo = Paths.get(System.getProperty("test.classes")).resolve("modules").resolve("foo");
- r = run("jar -uf foo.jar --release 9 -C " + foo.toString() + " module-info.class --release 10 -C v10 q");
- checkResult(r);
-
- r = run("jdeps -v --multi-release 10 --module-path foo.jar -m foo");
+ Result r = run("jdeps -v --multi-release 10 --module-path Foo.jar -m foo");
checkResult(r, true,
"foo", // module name
- "foo.jar", // the path to foo.jar
+ "Foo.jar", // the path to Foo.jar
"requires mandated java.base", // module dependences
"foo -> java.base",
"10/q.Bar",
@@ -255,27 +282,24 @@
"p.Foo"
);
- r = run("jdeps --multi-release 9 --module-path foo.jar Main.jar");
+ r = run("jdeps --multi-release 9 -cp Version.jar --module-path Foo.jar Main.jar");
checkResult(r, true,
- "Main.jar ->",
- "test",
- "foo", // module name
- "foo.jar", // the path to foo.jar
- "requires mandated java.base", // module dependences
- "foo -> java.base",
- "p"
+ "Main.jar -> Version.jar",
+ "Main.jar -> foo",
+ "Main.jar -> java.base",
+ "-> java.lang",
+ "-> p",
+ "-> test"
);
- r = run("jdeps --multi-release 10 --module-path foo.jar Main.jar");
+ r = run("jdeps --multi-release 10 -cp Version.jar --module-path Foo.jar Main.jar");
checkResult(r, true,
- "Main.jar ->",
- "test",
- "foo", // module name
- "foo.jar", // the path to foo.jar
- "requires mandated java.base", // module dependences
- "foo -> java.base",
- "p",
- "q"
+ "Main.jar -> Version.jar",
+ "Main.jar -> foo",
+ "Main.jar -> java.base",
+ "-> java.lang",
+ "-> p",
+ "-> test"
);
}
--- a/test/langtools/tools/jdeps/Options.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/tools/jdeps/Options.java Fri Nov 23 09:12:00 2018 -0500
@@ -53,7 +53,15 @@
},
{
new String[] { "-jdkinternal", "-p", "java.lang", TEST_CLASSES },
- "--package, --regex, --require cannot be used with -jdkinternals option"
+ "--package, --regex, --require cannot be used with -jdkinternals option"
+ },
+ {
+ new String[] { "--missing-deps", "-summary", TEST_CLASSES },
+ "-summary or -verbose cannot be used with --missing-deps option"
+ },
+ {
+ new String[] { "--missing-deps", "-p", "java.lang", TEST_CLASSES },
+ "--package, --regex, --require cannot be used with --missing-deps option"
},
{
new String[] { "--inverse", TEST_CLASSES },
--- a/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java Fri Nov 23 09:12:00 2018 -0500
@@ -35,9 +35,11 @@
* @run testng ListModuleDeps
*/
+import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
+import java.util.List;
import java.util.stream.Collectors;
import org.testng.annotations.BeforeTest;
@@ -53,6 +55,7 @@
private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
private static final Path CLASSES_DIR = Paths.get("classes");
private static final Path LIB_DIR = Paths.get("lib");
+ private static final Path LIB2_DIR = Paths.get("lib2");
private static final Path HI_CLASS =
CLASSES_DIR.resolve("hi").resolve("Hi.class");
@@ -69,7 +72,8 @@
@BeforeTest
public void compileAll() throws Exception {
// compile library
- assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "lib"), LIB_DIR));
+ assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "lib2"), LIB2_DIR));
+ assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "lib"), LIB_DIR, "-cp", LIB2_DIR.toString()));
// simple program depends only on java.base
assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "hi"), CLASSES_DIR));
@@ -111,7 +115,7 @@
@Test(dataProvider = "listdeps")
public void testListDeps(Path classes, String[] expected) {
JdepsRunner jdeps = JdepsRunner.run(
- "--class-path", LIB_DIR.toString(),
+ "--class-path", LIB_DIR.toString() + File.pathSeparator + LIB2_DIR.toString(),
"--list-deps", classes.toString()
);
String[] output = Arrays.stream(jdeps.output())
@@ -123,7 +127,7 @@
@Test(dataProvider = "reduceddeps")
public void testListReducedDeps(Path classes, String[] expected) {
JdepsRunner jdeps = JdepsRunner.run(
- "--class-path", LIB_DIR.toString(),
+ "--class-path", LIB_DIR.toString() + File.pathSeparator + LIB2_DIR.toString(),
"--list-reduced-deps", classes.toString()
);
String[] output = Arrays.stream(jdeps.output())
@@ -140,6 +144,7 @@
"java.base/jdk.internal.misc",
"java.base/sun.security.util",
"java.logging",
+ "java.management",
"java.sql",
"java.xml/jdk.xml.internal",
"jdk.unsupported"
@@ -154,6 +159,7 @@
{ FOO_CLASS, new String[] {
"java.base",
"java.logging",
+ "java.management",
"java.sql",
"java.xml"
}
@@ -181,6 +187,7 @@
{ CLASSES_DIR, new String[] {
"java.base/jdk.internal.misc",
"java.base/sun.security.util",
+ "java.management",
"java.sql",
"java.xml/jdk.xml.internal",
"jdk.unsupported"
@@ -194,6 +201,7 @@
{ FOO_CLASS, new String[] {
"java.base",
+ "java.management",
"java.sql"
}
},
@@ -215,7 +223,7 @@
@Test(dataProvider = "moduledeps")
public void testPrintModuleDeps(Path classes, String expected) {
JdepsRunner jdeps = JdepsRunner.run(
- "--class-path", LIB_DIR.toString(),
+ "--class-path", LIB_DIR.toString() + File.pathSeparator + LIB2_DIR.toString(),
"--print-module-deps", classes.toString()
);
String output = Arrays.stream(jdeps.output())
@@ -231,6 +239,32 @@
return new Object[][] {
// java.xml is an implied reads edge from java.sql
+ { CLASSES_DIR, "java.base,java.management,java.sql,jdk.unsupported"},
+ { HI_CLASS, "java.base"},
+ { FOO_CLASS, "java.base,java.management,java.sql"},
+ { BAR_CLASS, "java.base,java.xml"},
+ { UNSAFE_CLASS, "java.base,jdk.unsupported"},
+ };
+ }
+
+ @Test(dataProvider = "noRecursiveModuledeps")
+ public void testNoRecursiveModuleDeps(Path classes, String expected) {
+ JdepsRunner jdeps = JdepsRunner.run(
+ "--class-path", LIB_DIR.toString() + File.pathSeparator + LIB2_DIR.toString(),
+ "--print-module-deps", "--no-recursive", classes.toString()
+ );
+ String output = Arrays.stream(jdeps.output())
+ .map(s -> s.trim())
+ .collect(Collectors.joining(","));
+ assertEquals(output, expected);
+ }
+
+ @DataProvider(name = "noRecursiveModuledeps")
+ public Object[][] noRecursiveModuledeps() {
+ Path barClass = CLASSES_DIR.resolve("z").resolve("Bar.class");
+
+ return new Object[][] {
+ // java.xml is an implied reads edge from java.sql
{ CLASSES_DIR, "java.base,java.sql,jdk.unsupported"},
{ HI_CLASS, "java.base"},
{ FOO_CLASS, "java.base,java.sql"},
@@ -238,4 +272,47 @@
{ UNSAFE_CLASS, "java.base,jdk.unsupported"},
};
}
+
+ @DataProvider(name = "recursiveDeps")
+ public Object[][] recursiveDeps() {
+ return new Object[][] {
+ { // lib2 is classpath but not analyzed because lib.Lib is not present
+ // but it is the only class depending on lib2.Lib2
+ List.of("--list-deps", "--class-path", LIB2_DIR.toString(),
+ "--ignore-missing-deps", CLASSES_DIR.toString()),
+ new String[] {
+ "java.base/jdk.internal.misc",
+ "java.base/sun.security.util",
+ "java.logging",
+ "java.sql",
+ "java.xml/jdk.xml.internal",
+ "jdk.unsupported"
+ }
+ },
+ { // lib2 is classpath but not analyzed because lib.Lib is not present
+ // but it is the only class depending on lib2.Lib2
+ List.of("--print-module-deps", "--class-path", LIB2_DIR.toString(),
+ "--ignore-missing-deps", CLASSES_DIR.toString()),
+ new String[] {
+ "java.base,java.sql,jdk.unsupported"
+ }
+ },
+ { // Foo depends on lib.Lib which depends on lib2.Libs
+ List.of("--print-module-deps",
+ "--ignore-missing-deps", FOO_CLASS.toString()),
+ new String[] {
+ "java.base,java.sql"
+ }
+ },
+ };
+ }
+
+ @Test(dataProvider = "recursiveDeps")
+ public void testRecursiveDeps(List<String> options, String[] expected) {
+ JdepsRunner jdeps = JdepsRunner.run(options.toArray(new String[0]));
+ String[] output = Arrays.stream(jdeps.output())
+ .map(s -> s.trim())
+ .toArray(String[]::new);
+ assertEquals(output, expected);
+ }
}
--- a/test/langtools/tools/jdeps/listdeps/src/lib/Lib.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/tools/jdeps/listdeps/src/lib/Lib.java Fri Nov 23 09:12:00 2018 -0500
@@ -28,4 +28,5 @@
public class Lib {
public static final String isCoalescing = XMLInputFactory.IS_COALESCING;
public static boolean check() { return true; }
+ public static long getPid() { return lib2.Lib2.getPid(); }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/jdeps/listdeps/src/lib2/Lib2.java Fri Nov 23 09:12:00 2018 -0500
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 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
+ * 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.
+ */
+
+package lib2;
+
+import java.lang.management.ManagementFactory;
+
+public class Lib2 {
+ public static long getPid() {
+ return ManagementFactory.getRuntimeMXBean().getPid();
+ }
+}
--- a/test/langtools/tools/jdeps/modules/DotFileTest.java Fri Nov 23 09:02:17 2018 -0500
+++ b/test/langtools/tools/jdeps/modules/DotFileTest.java Fri Nov 23 09:12:00 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -28,12 +28,16 @@
* @modules java.desktop
* java.sql
* jdk.jdeps/com.sun.tools.jdeps
+ * jdk.unsupported
+ * @library ../lib
+ * @build CompilerUtils
* @run testng DotFileTest
*/
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
@@ -41,6 +45,7 @@
import java.util.spi.ToolProvider;
import java.util.stream.Collectors;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -50,9 +55,19 @@
public class DotFileTest {
private static final ToolProvider JDEPS = ToolProvider.findFirst("jdeps")
.orElseThrow(() -> new RuntimeException("jdeps not found"));
+ private static final ToolProvider JAR = ToolProvider.findFirst("jar")
+ .orElseThrow(() -> new RuntimeException("jar not found"));
+ private static final String TEST_SRC = System.getProperty("test.src");
private static final Path DOTS_DIR = Paths.get("dots");
private static final Path SPEC_DIR = Paths.get("spec");
+ private static final Path MODS = Paths.get("mods");
+
+
+ @BeforeTest
+ public void setup() throws Exception {
+ assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "unsafe"), MODS));
+ }
@DataProvider(name = "modules")
public Object[][] modules() {
@@ -125,6 +140,79 @@
assertEquals(lines, edges);
}
+ /*
+ * Test if the file name of the dot output file matches the input filename
+ */
+ @Test
+ public void testModularJar() throws Exception {
+ String filename = "org.unsafe-v1.0.jar";
+ assertTrue(JAR.run(System.out, System.out, "cf", filename,
+ "-C", MODS.toString(), ".") == 0);
+
+ // assertTrue(JDEPS.run(System.out, System.out,
+ // "--dot-output", DOTS_DIR.toString(), filename) == 0);
+ assertTrue(JDEPS.run(System.out, System.out,
+ "--dot-output", DOTS_DIR.toString(),
+ "--module-path", filename,
+ "-m", "unsafe") == 0);
+
+ Path path = DOTS_DIR.resolve(filename + ".dot");
+ assertTrue(Files.exists(path));
+
+ // package dependences
+ Set<String> expected = Set.of(
+ "org.indirect -> java.lang",
+ "org.indirect -> org.unsafe",
+ "org.safe -> java.io",
+ "org.safe -> java.lang",
+ "org.unsafe -> java.lang",
+ "org.unsafe -> sun.misc"
+ );
+
+ Pattern pattern = Pattern.compile("(.*) -> +([^ ]*) (.*)");
+ Set<String> lines = new HashSet<>();
+ for (String line : Files.readAllLines(path)) {
+ line = line.replace('"', ' ').replace(';', ' ');
+ Matcher pm = pattern.matcher(line);
+ if (pm.find()) {
+ String origin = pm.group(1).trim();
+ String target = pm.group(2).trim();
+ lines.add(origin + " -> " + target);
+ }
+ }
+ assertEquals(lines, expected);
+ }
+
+ /*
+ * Test module summary with -m option
+ */
+ @Test
+ public void testModuleSummary() throws Exception {
+ String filename = "org.unsafe-v2.0.jar";
+ assertTrue(JAR.run(System.out, System.out, "cf", filename,
+ "-C", MODS.toString(), ".") == 0);
+
+ assertTrue(JDEPS.run(System.out, System.out, "-s",
+ "--dot-output", DOTS_DIR.toString(),
+ "--module-path", filename,
+ "-m", "unsafe") == 0);
+
+ Path path = DOTS_DIR.resolve(filename + ".dot");
+ assertTrue(Files.exists(path));
+
+ // module dependences
+ Set<String> expected = Set.of(
+ "unsafe -> jdk.unsupported",
+ "jdk.unsupported -> java.base"
+ );
+
+ Set<String> lines = Files.readAllLines(path).stream()
+ .filter(l -> l.contains(" -> "))
+ .map(this::split)
+ .collect(Collectors.toSet());
+ assertEquals(lines, expected);
+ }
+
static Pattern PATTERN = Pattern.compile(" *\"(\\S+)\" -> \"(\\S+)\" .*");
String split(String line) {
Matcher pm = PATTERN.matcher(line);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/jdeps/mrjar/Main.java Fri Nov 23 09:12:00 2018 -0500
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+import test.Version;
+import p.Foo;
+
+public class Main {
+ public void run() {
+ Version v = new Version();
+ v.getVersion();
+ }
+
+ public static void main(String[] args) {
+ (new Main()).run();
+ Foo foo = new Foo();
+ }
+}
--- a/test/langtools/tools/jdeps/mrjar/test/Main.java Fri Nov 23 09:02:17 2018 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2016, 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.
- */
-
-package test;
-
-public class Main {
- public void run() {
- Version v = new Version();
- v.getVersion();
- }
-
- public static void main(String[] args) {
- (new Main()).run();
- }
-}