From 813d9e8175b30e2b4dfdf9aa67f3088e38115f2f Mon Sep 17 00:00:00 2001 From: James Laskey Date: Mon, 28 Jan 2013 16:29:10 -0400 Subject: [PATCH 001/274] 8006676: Integrate Nashorn into new build system Reviewed-by: jlaskey --- jdk/THIRD_PARTY_README | 24 +++++++++++------------ jdk/make/launchers/Makefile | 4 ++++ jdk/makefiles/CompileLaunchers.gmk | 5 +++++ jdk/makefiles/CreateJars.gmk | 8 ++++++++ jdk/test/tools/launcher/VersionCheck.java | 1 + 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/jdk/THIRD_PARTY_README b/jdk/THIRD_PARTY_README index 6dc1b331638..61834ab7a5a 100644 --- a/jdk/THIRD_PARTY_README +++ b/jdk/THIRD_PARTY_README @@ -6,7 +6,7 @@ Framework v4.0, which is included with JRE 8, and JDK 8. --- begin of LICENSE --- -Copyright (c) 2000-2011 France Tlcom +Copyright (c) 2000-2011 France TÈlÈcom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -741,7 +741,7 @@ Linux and Solaris. --- begin of LICENSE --- -Copyright ¬© 2001,2003 Keith Packard +Copyright ¬¨¬© 2001,2003 Keith Packard Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the @@ -1955,16 +1955,16 @@ v1.9, which is included with JRE 7, JDK 7, and OpenJDK 7. Unicode Terms of Use For the general privacy policy governing access to this site, see the Unicode -Privacy Policy. For trademark usage, see the Unicode® Consortium Name and +Privacy Policy. For trademark usage, see the Unicode¬Æ Consortium Name and Trademark Usage Policy. A. Unicode Copyright. - 1. Copyright © 1991-2011 Unicode, Inc. All rights reserved. + 1. Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. 2. Certain documents and files on this website contain a legend indicating that "Modification is permitted." Any person is hereby authorized, without fee, to modify such documents and files to create derivative - works conforming to the Unicode® Standard, subject to Terms and + works conforming to the Unicode¬Æ Standard, subject to Terms and Conditions herein. 3. Any person is hereby authorized, without fee, to view, use, reproduce, @@ -2030,14 +2030,14 @@ D. Waiver of Damages. In no event shall Unicode or its licensors be liable for E.Trademarks & Logos. 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode, - Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of + Inc. ‚ÄúThe Unicode Consortium‚Äù and ‚ÄúUnicode, Inc.‚Äù are trade names of Unicode, Inc. Use of the information and materials found on this - website indicates your acknowledgement of Unicode, Inc.’s exclusive + website indicates your acknowledgement of Unicode, Inc.‚Äôs exclusive worldwide rights in the Unicode Word Mark, the Unicode Logo, and the Unicode trade names. - 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark - Policy”) are incorporated herein by reference and you agree to abide by + 2. The Unicode Consortium Name and Trademark Usage Policy (‚ÄúTrademark + Policy‚Äù) are incorporated herein by reference and you agree to abide by the provisions of the Trademark Policy, which may be changed from time to time in the sole discretion of Unicode, Inc. @@ -2060,12 +2060,12 @@ Miscellaneous. 2. Modification by Unicode. Unicode shall have the right to modify this Agreement at any time by posting it to this site. The user may not - assign any part of this Agreement without Unicode’s prior written + assign any part of this Agreement without Unicode‚Äôs prior written consent. 3. Taxes. The user agrees to pay any taxes arising from access to this website or use of the information herein, except for those based on - Unicode’s net income. + Unicode‚Äôs net income. 4. Severability. If any provision of this Agreement is declared invalid or unenforceable, the remaining provisions of this Agreement shall remain @@ -2094,7 +2094,7 @@ SOFTWARE. COPYRIGHT AND PERMISSION NOTICE -Copyright © 1991-2011 Unicode, Inc. All rights reserved. Distributed under the +Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/jdk/make/launchers/Makefile b/jdk/make/launchers/Makefile index be16512e478..4be80722894 100644 --- a/jdk/make/launchers/Makefile +++ b/jdk/make/launchers/Makefile @@ -77,6 +77,10 @@ $(call make-launcher, jmap, sun.tools.jmap.JMap, \ -J-Dsun.jvm.hotspot.debugger.useWindbgDebugger, ) $(call make-launcher, jps, sun.tools.jps.Jps, , ) $(call make-launcher, jrunscript, com.sun.tools.script.shell.Main, , ) +$(call make-launcher, jjs, jdk.nashorn.tools.Shell, \ + -J-XX:-TieredCompilation \ + -J-Xms2G \ + -J-Xmx2G, ) $(call make-launcher, jsadebugd, sun.jvm.hotspot.jdi.SADebugServer, , ) $(call make-launcher, jstack, sun.tools.jstack.JStack, \ -J-Dsun.jvm.hotspot.debugger.useProcDebugger \ diff --git a/jdk/makefiles/CompileLaunchers.gmk b/jdk/makefiles/CompileLaunchers.gmk index 354fea12044..f1ceeedfd34 100644 --- a/jdk/makefiles/CompileLaunchers.gmk +++ b/jdk/makefiles/CompileLaunchers.gmk @@ -311,6 +311,11 @@ $(eval $(call SetupLauncher,jps,\ $(eval $(call SetupLauncher,jrunscript,\ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }')) +$(eval $(call SetupLauncher,jjs,\ + -DJAVA_ARGS='{ "-J-XX:-TieredCompilation"$(COMMA) \ + "-J-Xms2G"$(COMMA) "-J-Xmx2G"$(COMMA) \ + "jdk.nashorn.tools.Shell"$(COMMA) }')) + $(eval $(call SetupLauncher,jsadebugd,\ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \ -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \ diff --git a/jdk/makefiles/CreateJars.gmk b/jdk/makefiles/CreateJars.gmk index 21c3ca98bfb..d67ab5a65f6 100644 --- a/jdk/makefiles/CreateJars.gmk +++ b/jdk/makefiles/CreateJars.gmk @@ -1046,6 +1046,14 @@ endif ########################################################################################## +# Import nashorn.jar from nashorn dist dir. +$(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar: $(NASHORN_DIST)/nashorn.jar + $(install-file) + +JARS += $(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar + +########################################################################################## + -include $(CUSTOM_MAKE_DIR)/CreateJars.gmk ########################################################################################## diff --git a/jdk/test/tools/launcher/VersionCheck.java b/jdk/test/tools/launcher/VersionCheck.java index c30ef424011..dd15d04570f 100644 --- a/jdk/test/tools/launcher/VersionCheck.java +++ b/jdk/test/tools/launcher/VersionCheck.java @@ -73,6 +73,7 @@ public class VersionCheck extends TestHelper { "jmap", "jps", "jrunscript", + "jjs", "jsadebugd", "jstack", "jstat", From d56ceaa96bd493fee496887df21e6d76745391bb Mon Sep 17 00:00:00 2001 From: James Laskey Date: Mon, 28 Jan 2013 16:29:34 -0400 Subject: [PATCH 002/274] 8006676: Integrate Nashorn into new build system Reviewed-by: jlaskey --- common/autoconf/generated-configure.sh | 16 ++++++++ common/autoconf/source-dirs.m4 | 15 ++++++- common/autoconf/spec.gmk.in | 3 ++ common/bin/compare.sh | 30 +++++++++++++- common/makefiles/Main.gmk | 14 +++++-- common/makefiles/MakeBase.gmk | 3 +- make/nashorn-rules.gmk | 56 ++++++++++++++++++++++++++ make/scripts/hgforest.sh | 2 +- 8 files changed, 132 insertions(+), 7 deletions(-) create mode 100644 make/nashorn-rules.gmk diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index ff6a41fc001..ee55de77f12 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -738,6 +738,7 @@ BUILD_OUTPUT OVERRIDE_SRC_ROOT ADD_SRC_ROOT JDK_TOPDIR +NASHORN_TOPDIR HOTSPOT_TOPDIR JAXWS_TOPDIR JAXP_TOPDIR @@ -15627,6 +15628,7 @@ CORBA_TOPDIR="$SRC_ROOT/corba" JAXP_TOPDIR="$SRC_ROOT/jaxp" JAXWS_TOPDIR="$SRC_ROOT/jaxws" HOTSPOT_TOPDIR="$SRC_ROOT/hotspot" +NASHORN_TOPDIR="$SRC_ROOT/nashorn" JDK_TOPDIR="$SRC_ROOT/jdk" @@ -15637,6 +15639,7 @@ JDK_TOPDIR="$SRC_ROOT/jdk" + ############################################################################### # # Pickup additional source for a component from outside of the source root @@ -15867,6 +15870,19 @@ $as_echo_n "checking if hotspot should be overridden... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes with $HOTSPOT_TOPDIR" >&5 $as_echo "yes with $HOTSPOT_TOPDIR" >&6; } fi +if test "x$with_override_nashorn" != x; then + CURDIR="$PWD" + cd "$with_override_nashorn" + NASHORN_TOPDIR="`pwd`" + cd "$CURDIR" + if ! test -f $NASHORN_TOPDIR/makefiles/BuildNashorn.gmk; then + as_fn_error $? "You have to override nashorn with a full nashorn repo!" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if nashorn should be overridden" >&5 +$as_echo_n "checking if nashorn should be overridden... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes with $NASHORN_TOPDIR" >&5 +$as_echo "yes with $NASHORN_TOPDIR" >&6; } +fi if test "x$with_override_jdk" != x; then CURDIR="$PWD" cd "$with_override_jdk" diff --git a/common/autoconf/source-dirs.m4 b/common/autoconf/source-dirs.m4 index eacd056066b..bb0aba1b826 100644 --- a/common/autoconf/source-dirs.m4 +++ b/common/autoconf/source-dirs.m4 @@ -33,12 +33,14 @@ CORBA_TOPDIR="$SRC_ROOT/corba" JAXP_TOPDIR="$SRC_ROOT/jaxp" JAXWS_TOPDIR="$SRC_ROOT/jaxws" HOTSPOT_TOPDIR="$SRC_ROOT/hotspot" +NASHORN_TOPDIR="$SRC_ROOT/nashorn" JDK_TOPDIR="$SRC_ROOT/jdk" AC_SUBST(LANGTOOLS_TOPDIR) AC_SUBST(CORBA_TOPDIR) AC_SUBST(JAXP_TOPDIR) AC_SUBST(JAXWS_TOPDIR) AC_SUBST(HOTSPOT_TOPDIR) +AC_SUBST(NASHORN_TOPDIR) AC_SUBST(JDK_TOPDIR) ]) @@ -233,7 +235,18 @@ if test "x$with_override_hotspot" != x; then fi AC_MSG_CHECKING([if hotspot should be overridden]) AC_MSG_RESULT([yes with $HOTSPOT_TOPDIR]) -fi +fi +if test "x$with_override_nashorn" != x; then + CURDIR="$PWD" + cd "$with_override_nashorn" + NASHORN_TOPDIR="`pwd`" + cd "$CURDIR" + if ! test -f $NASHORN_TOPDIR/makefiles/BuildNashorn.gmk; then + AC_MSG_ERROR([You have to override nashorn with a full nashorn repo!]) + fi + AC_MSG_CHECKING([if nashorn should be overridden]) + AC_MSG_RESULT([yes with $NASHORN_TOPDIR]) +fi if test "x$with_override_jdk" != x; then CURDIR="$PWD" cd "$with_override_jdk" diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 5fde9e7cf16..f7c61f9d228 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -141,6 +141,7 @@ CORBA_TOPDIR:=@CORBA_TOPDIR@ JAXP_TOPDIR:=@JAXP_TOPDIR@ JAXWS_TOPDIR:=@JAXWS_TOPDIR@ HOTSPOT_TOPDIR:=@HOTSPOT_TOPDIR@ +NASHORN_TOPDIR:=@NASHORN_TOPDIR@ COPYRIGHT_YEAR:=@COPYRIGHT_YEAR@ # Location where build customization files may be found @@ -230,6 +231,7 @@ JAXP_OUTPUTDIR=$(BUILD_OUTPUT)/jaxp JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk +NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images JCE_OUTPUTDIR=$(BUILD_OUTPUT)/jce-release @@ -238,6 +240,7 @@ CORBA_DIST=$(CORBA_OUTPUTDIR)/dist JAXP_DIST=$(JAXP_OUTPUTDIR)/dist JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist HOTSPOT_DIST=@HOTSPOT_DIST@ +NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist BUILD_HOTSPOT=@BUILD_HOTSPOT@ diff --git a/common/bin/compare.sh b/common/bin/compare.sh index 1e1ceb08ae6..0ba46727acc 100644 --- a/common/bin/compare.sh +++ b/common/bin/compare.sh @@ -350,9 +350,15 @@ compare_zip_file() { OTHER_DIR=$2 WORK_DIR=$3 ZIP_FILE=$4 + # Optionally provide different name for other zipfile + OTHER_ZIP_FILE=$5 THIS_ZIP=$THIS_DIR/$ZIP_FILE - OTHER_ZIP=$OTHER_DIR/$ZIP_FILE + if [ -n "$OTHER_ZIP_FILE" ]; then + OTHER_ZIP=$OTHER_DIR/$OTHER_ZIP_FILE + else + OTHER_ZIP=$OTHER_DIR/$ZIP_FILE + fi THIS_SUFFIX="${THIS_ZIP##*.}" OTHER_SUFFIX="${OTHER_ZIP##*.}" @@ -962,6 +968,9 @@ if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1 echo "[FILTER] List filenames in the image to compare, works for jars, zips, libs and execs" echo "Example:" echo "bash ./common/bin/compareimages.sh CodePointIM.jar" + echo "" + echo "-2zips Compare two zip files only" + echo "" exit 10 fi @@ -1023,6 +1032,13 @@ while [ -n "$1" ]; do -execs) CMP_EXECS=true ;; + -2zips) + CMP_2_ZIPS=true + THIS_FILE=$2 + OTHER_FILE=$3 + shift + shift + ;; *) CMP_NAMES=false CMP_PERMS=false @@ -1041,6 +1057,18 @@ while [ -n "$1" ]; do shift done +if [ "$CMP_2_ZIPS" = "true" ]; then + THIS_DIR="$(dirname $THIS_FILE)" + THIS_DIR="$(cd "$THIS_DIR" && pwd )" + OTHER_DIR="$(dirname $OTHER_FILE)" + OTHER_DIR="$(cd "$OTHER_DIR" && pwd )" + THIS_FILE_NAME="$(basename $THIS_FILE)" + OTHER_FILE_NAME="$(basename $OTHER_FILE)" + echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME + compare_zip_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2zips $THIS_FILE_NAME $OTHER_FILE_NAME + exit +fi + if [ "$CMP_NAMES" = "false" ] && [ "$CMP_TYPES" = "false" ] && [ "$CMP_PERMS" = "false" ] && [ "$CMP_GENERAL" = "false" ] && [ "$CMP_ZIPS" = "false" ] && [ "$CMP_JARS" = "false" ] && [ "$CMP_LIBS" = "false" ] && [ "$CMP_EXECS" = "false" ]; then CMP_NAMES=true CMP_PERMS=true diff --git a/common/makefiles/Main.gmk b/common/makefiles/Main.gmk index c96747f090c..104a8fdccdb 100644 --- a/common/makefiles/Main.gmk +++ b/common/makefiles/Main.gmk @@ -116,13 +116,19 @@ jdk-only: start-make @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET)) @$(call TargetExit) +nashorn: jdk nashorn-only +nashorn-only: start-make + @$(call TargetEnter) + @($(CD) $(NASHORN_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk) + @$(call TargetExit) + demos: jdk demos-only demos-only: start-make @$(call TargetEnter) @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos) @$(call TargetExit) -images: source-tips demos images-only +images: source-tips demos nashorn images-only images-only: start-make @$(call TargetEnter) @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images) @@ -173,7 +179,7 @@ $(OUTPUT_ROOT)/source_tips: FRC # Remove everything, except the output from configure. -clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build clean-docs +clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build clean-docs @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*) @$(ECHO) Cleaned all build artifacts. @@ -203,6 +209,8 @@ clean-hotspot: $(call CleanComponent,hotspot) clean-jdk: $(call CleanComponent,jdk) +clean-nashorn: + $(call CleanComponent,nashorn) clean-images: $(call CleanComponent,images) clean-overlay-images: @@ -216,6 +224,6 @@ clean-docs: .PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only .PHONY: all test clean dist-clean bootcycle-images start-make -.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build +.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build FRC: # Force target diff --git a/common/makefiles/MakeBase.gmk b/common/makefiles/MakeBase.gmk index 708cbada085..4c1ecc8c8b7 100644 --- a/common/makefiles/MakeBase.gmk +++ b/common/makefiles/MakeBase.gmk @@ -51,8 +51,9 @@ decompress_paths=$(SED) -f $(SRC_ROOT)/common/makefiles/support/ListPathsSafely- -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \ -e 's|X00|X|g' | tr '\n' '$2' +# Subst in an extra $ to prevent it from disappearing. define ListPathsSafely_If - $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(wordlist $3,$4,$($1))))) + $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(subst $$,$$$$,$(wordlist $3,$4,$($1)))))) endef define ListPathsSafely_Printf diff --git a/make/nashorn-rules.gmk b/make/nashorn-rules.gmk new file mode 100644 index 00000000000..a205f2ea97e --- /dev/null +++ b/make/nashorn-rules.gmk @@ -0,0 +1,56 @@ +# +# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +################################################################ +# NASHORN TARGETS +################################################################ + +NASHORN_BUILD_ARGUMENTS = \ + $(COMMON_BUILD_ARGUMENTS) \ + ALT_OUTPUTDIR=$(NASHORN_OUTPUTDIR) \ + ALT_BOOTDIR=$(BOOTDIR) \ + ALT_JDK_IMPORT_PATH=$(JDK_IMPORT_PATH) + +ifeq ($(BUILD_LANGTOOLS), true) + NASHORN_BUILD_ARGUMENTS += ALT_LANGTOOLS_DIST=$(ABS_LANGTOOLS_DIST) +endif + +nashorn: nashorn-build +nashorn-build: + $(MKDIR) -p $(NASHORN_OUTPUTDIR) + @$(call MakeStart,nashorn,all) + ($(CD) $(NASHORN_TOPDIR)/make && \ + $(MAKE) $(NASHORN_BUILD_ARGUMENTS) all) + @$(call MakeFinish,nashorn,all) + +nashorn-clobber:: + $(MKDIR) -p $(NASHORN_OUTPUTDIR) + @$(call MakeStart,nashorn,clobber) + ($(CD) $(NASHORN_TOPDIR)/make && \ + $(MAKE) $(NASHORN_BUILD_ARGUMENTS) clobber) + @$(call MakeFinish,nashorn,clobber) + +.PHONY: nashorn nashorn-build nashorn-clobber + diff --git a/make/scripts/hgforest.sh b/make/scripts/hgforest.sh index ed937f3711e..f30d3eb7768 100644 --- a/make/scripts/hgforest.sh +++ b/make/scripts/hgforest.sh @@ -40,7 +40,7 @@ pull_default="" repos="" repos_extra="" if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then - subrepos="corba jaxp jaxws langtools jdk hotspot" + subrepos="corba jaxp jaxws langtools jdk hotspot nashorn" if [ -f .hg/hgrc ] ; then pull_default=`hg paths default` if [ "${pull_default}" = "" ] ; then From 383e963093f4b9663f59719f1ed3847a94a8d43c Mon Sep 17 00:00:00 2001 From: James Laskey Date: Wed, 6 Feb 2013 13:37:03 -0400 Subject: [PATCH 003/274] 8007666: nashorn missing from hgforest.sh Reviewed-by: jlaskey --- common/bin/hgforest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/bin/hgforest.sh b/common/bin/hgforest.sh index cbda87160ba..e4cb76a45a3 100644 --- a/common/bin/hgforest.sh +++ b/common/bin/hgforest.sh @@ -96,7 +96,7 @@ pull_default="" repos="" repos_extra="" if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then - subrepos="corba jaxp jaxws langtools jdk hotspot" + subrepos="corba jaxp jaxws langtools jdk hotspot nashorn" if [ -f .hg/hgrc ] ; then pull_default=`hg paths default` if [ "${pull_default}" = "" ] ; then From eba603edcf540627aec0d5ac3e6bfef1da8c2d61 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Mon, 18 Feb 2013 19:01:59 -0400 Subject: [PATCH 004/274] 8008420: Fix Nashorn forest to build with NEWBUILD=false Reviewed-by: jjh --- Makefile | 7 +++++++ make/nashorn-rules.gmk | 3 +++ 2 files changed, 10 insertions(+) diff --git a/Makefile b/Makefile index f9162f0b641..f7b9d1b35e3 100644 --- a/Makefile +++ b/Makefile @@ -90,6 +90,7 @@ include ./make/corba-rules.gmk include ./make/jaxp-rules.gmk include ./make/jaxws-rules.gmk include ./make/jdk-rules.gmk +include ./make/nashorn-rules.gmk include ./make/install-rules.gmk include ./make/sponsors-rules.gmk include ./make/deploy-rules.gmk @@ -174,6 +175,11 @@ ifeq ($(BUILD_JDK), true) clobber:: jdk-clobber endif +ifeq ($(BUILD_NASHORN), true) + generic_build_repo_series:: $(NASHORN) + clobber:: nashorn-clobber +endif + ifeq ($(BUILD_DEPLOY), true) generic_build_repo_series:: $(DEPLOY) clobber:: deploy-clobber @@ -336,6 +342,7 @@ deploy_fastdebug_only: BUILD_HOTSPOT=false \ BUILD_JDK=false \ BUILD_LANGTOOLS=false \ + BUILD_NASHORN=false \ BUILD_CORBA=false \ BUILD_JAXP=false \ BUILD_JAXWS=false \ diff --git a/make/nashorn-rules.gmk b/make/nashorn-rules.gmk index a205f2ea97e..a86a0475ced 100644 --- a/make/nashorn-rules.gmk +++ b/make/nashorn-rules.gmk @@ -37,6 +37,9 @@ ifeq ($(BUILD_LANGTOOLS), true) NASHORN_BUILD_ARGUMENTS += ALT_LANGTOOLS_DIST=$(ABS_LANGTOOLS_DIST) endif +# Default targets +NASHORN = nashorn-build + nashorn: nashorn-build nashorn-build: $(MKDIR) -p $(NASHORN_OUTPUTDIR) From 6ac18a4c3b1ca84127fdae0bce1da42a3aa988cb Mon Sep 17 00:00:00 2001 From: James Laskey Date: Tue, 19 Feb 2013 10:02:55 -0400 Subject: [PATCH 005/274] 8008446: Tweaks to make all NEWBUILD=false round 2 Reviewed-by: jjh --- make/Defs-internal.gmk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/make/Defs-internal.gmk b/make/Defs-internal.gmk index 6f40f763bc9..15374ff7c51 100644 --- a/make/Defs-internal.gmk +++ b/make/Defs-internal.gmk @@ -100,6 +100,7 @@ ABS_JAXP_TOPDIR:=$(call OptFullPath,"$(JAXP_TOPDIR)") ABS_JAXWS_TOPDIR:=$(call OptFullPath,"$(JAXWS_TOPDIR)") ABS_JDK_TOPDIR:=$(call OptFullPath,"$(JDK_TOPDIR)") ABS_HOTSPOT_TOPDIR:=$(call OptFullPath,"$(HOTSPOT_TOPDIR)") +ABS_NASHORN_TOPDIR:=$(call OptFullPath,"$(NASHORN_TOPDIR)") ABS_INSTALL_TOPDIR:=$(call OptFullPath,"$(INSTALL_TOPDIR)") ABS_SPONSORS_TOPDIR:=$(call OptFullPath,"$(SPONSORS_TOPDIR)") ABS_DEPLOY_TOPDIR:=$(call OptFullPath,"$(DEPLOY_TOPDIR)") @@ -165,6 +166,15 @@ ifeq ($(JDK_SRC_AVAILABLE),true) endif endif +NASHORN_SRC_AVAILABLE := $(call MkExists,$(NASHORN_TOPDIR)/make/Makefile) +ifndef BUILD_NASHORN + ifdef ALT_NASHORN_DIST + BUILD_NASHORN := false + else + BUILD_NASHORN := $(NASHORN_SRC_AVAILABLE) + endif +endif + DEPLOY_SRC_AVAILABLE := $(call MkExists,$(DEPLOY_TOPDIR)/make/Makefile) ifndef BUILD_DEPLOY BUILD_DEPLOY := $(DEPLOY_SRC_AVAILABLE) @@ -308,6 +318,10 @@ ifndef ALT_JAXWS_DIST JAXWS_OUTPUTDIR = $(ABS_OUTPUTDIR)/jaxws ABS_JAXWS_DIST = $(JAXWS_OUTPUTDIR)/dist endif +ifndef ALT_NASHORN_DIST + NASHORN_OUTPUTDIR = $(ABS_OUTPUTDIR)/nashorn + ABS_NASHORN_DIST = $(NASHORN_OUTPUTDIR)/dist +endif # Common make arguments (supplied to all component builds) COMMON_BUILD_ARGUMENTS = \ From 9441d55bcae9f25bbf0e9b4ae0da2987a14e2327 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Thu, 21 Feb 2013 15:25:07 -0400 Subject: [PATCH 006/274] 8008447: Tweaks to make all NEWBUILD=false round 3 Reviewed-by: jjh, sundar --- jdk/make/launchers/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jdk/make/launchers/Makefile b/jdk/make/launchers/Makefile index 4be80722894..e88742a992b 100644 --- a/jdk/make/launchers/Makefile +++ b/jdk/make/launchers/Makefile @@ -77,10 +77,12 @@ $(call make-launcher, jmap, sun.tools.jmap.JMap, \ -J-Dsun.jvm.hotspot.debugger.useWindbgDebugger, ) $(call make-launcher, jps, sun.tools.jps.Jps, , ) $(call make-launcher, jrunscript, com.sun.tools.script.shell.Main, , ) +ifeq ("$(NEWBUILD)","true") $(call make-launcher, jjs, jdk.nashorn.tools.Shell, \ -J-XX:-TieredCompilation \ -J-Xms2G \ -J-Xmx2G, ) +endif $(call make-launcher, jsadebugd, sun.jvm.hotspot.jdi.SADebugServer, , ) $(call make-launcher, jstack, sun.tools.jstack.JStack, \ -J-Dsun.jvm.hotspot.debugger.useProcDebugger \ From 9f4d8efb2217275fbdff5004165d3df705926fce Mon Sep 17 00:00:00 2001 From: James Laskey Date: Thu, 21 Feb 2013 15:25:31 -0400 Subject: [PATCH 007/274] 8008447: Tweaks to make all NEWBUILD=false round 3 Reviewed-by: jjh, sundar --- make/jdk-rules.gmk | 3 +++ make/sanity-rules.gmk | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/make/jdk-rules.gmk b/make/jdk-rules.gmk index 42ba6adf627..dc6b5556dd0 100644 --- a/make/jdk-rules.gmk +++ b/make/jdk-rules.gmk @@ -62,6 +62,9 @@ endif ifeq ($(BUILD_JAXWS), true) JDK_BUILD_ARGUMENTS += ALT_JAXWS_DIST=$(ABS_JAXWS_DIST) endif +ifeq ($(BUILD_NASHORN), true) + JDK_BUILD_ARGUMENTS += ALT_NASHORN_DIST=$(ABS_NASHORN_DIST) +endif ifeq ($(BUILD_HOTSPOT), true) JDK_BUILD_ARGUMENTS += ALT_HOTSPOT_IMPORT_PATH=$(HOTSPOT_DIR)/import diff --git a/make/sanity-rules.gmk b/make/sanity-rules.gmk index 544dba10ffd..ee3d6f88ab1 100644 --- a/make/sanity-rules.gmk +++ b/make/sanity-rules.gmk @@ -182,6 +182,14 @@ ifeq ($(JDK_SRC_AVAILABLE), true) "" >> $(WARNING_FILE) endif endif +ifeq ($(NASHORN_SRC_AVAILABLE), true) + ifneq ($(BUILD_NASHORN), true) + @$(ECHO) "WARNING: You are not building the NASHORN sources.\n" \ + " The nashorn files will be obtained from \n" \ + " the location set in ALT_JDK_IMPORT_PATH. \n" \ + "" >> $(WARNING_FILE) + endif +endif ifeq ($(DEPLOY_SRC_AVAILABLE), true) ifneq ($(BUILD_DEPLOY), true) @$(ECHO) "WARNING: You are not building the DEPLOY sources.\n" \ @@ -268,6 +276,9 @@ endif ifeq ($(JDK_SRC_AVAILABLE), true) @$(ECHO) " JDK_TOPDIR = $(JDK_TOPDIR)" >> $(MESSAGE_FILE) endif +ifeq ($(NASHORN_SRC_AVAILABLE), true) + @$(ECHO) " NASHORN_TOPDIR = $(NASHORN_TOPDIR)" >> $(MESSAGE_FILE) +endif ifeq ($(DEPLOY_SRC_AVAILABLE), true) @$(ECHO) " DEPLOY_TOPDIR = $(DEPLOY_TOPDIR)" >> $(MESSAGE_FILE) endif @@ -303,6 +314,9 @@ endif ifeq ($(JDK_SRC_AVAILABLE), true) @$(ECHO) " BUILD_JDK = $(BUILD_JDK) " >> $(MESSAGE_FILE) endif +ifeq ($(NASHORN_SRC_AVAILABLE), true) + @$(ECHO) " BUILD_NASHORN = $(BUILD_NASHORN) " >> $(MESSAGE_FILE) +endif ifeq ($(DEPLOY_SRC_AVAILABLE), true) @$(ECHO) " BUILD_DEPLOY = $(BUILD_DEPLOY) " >> $(MESSAGE_FILE) endif From ff7ec1f667147714920c41cc182bcc5299c4983f Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 10:23:11 -0400 Subject: [PATCH 008/274] 8008721: Tweaks to make all NEWBUILD=false round 4 Reviewed-by: jjh --- jdk/make/launchers/Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/jdk/make/launchers/Makefile b/jdk/make/launchers/Makefile index e88742a992b..47645158793 100644 --- a/jdk/make/launchers/Makefile +++ b/jdk/make/launchers/Makefile @@ -77,12 +77,7 @@ $(call make-launcher, jmap, sun.tools.jmap.JMap, \ -J-Dsun.jvm.hotspot.debugger.useWindbgDebugger, ) $(call make-launcher, jps, sun.tools.jps.Jps, , ) $(call make-launcher, jrunscript, com.sun.tools.script.shell.Main, , ) -ifeq ("$(NEWBUILD)","true") -$(call make-launcher, jjs, jdk.nashorn.tools.Shell, \ - -J-XX:-TieredCompilation \ - -J-Xms2G \ - -J-Xmx2G, ) -endif +$(call make-launcher, jjs, jdk.nashorn.tools.Shell, , ) $(call make-launcher, jsadebugd, sun.jvm.hotspot.jdi.SADebugServer, , ) $(call make-launcher, jstack, sun.tools.jstack.JStack, \ -J-Dsun.jvm.hotspot.debugger.useProcDebugger \ From e99848e82df223de70c6dd5fcd67c8058dadb0e5 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 17:45:37 -0400 Subject: [PATCH 009/274] 8008756: THIRD_PARTY_README contains Unicode Reviewed-by: jjh --- jdk/THIRD_PARTY_README | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/jdk/THIRD_PARTY_README b/jdk/THIRD_PARTY_README index 61834ab7a5a..6dc1b331638 100644 --- a/jdk/THIRD_PARTY_README +++ b/jdk/THIRD_PARTY_README @@ -6,7 +6,7 @@ Framework v4.0, which is included with JRE 8, and JDK 8. --- begin of LICENSE --- -Copyright (c) 2000-2011 France TÈlÈcom +Copyright (c) 2000-2011 France Tlcom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -741,7 +741,7 @@ Linux and Solaris. --- begin of LICENSE --- -Copyright ¬¨¬© 2001,2003 Keith Packard +Copyright ¬© 2001,2003 Keith Packard Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the @@ -1955,16 +1955,16 @@ v1.9, which is included with JRE 7, JDK 7, and OpenJDK 7. Unicode Terms of Use For the general privacy policy governing access to this site, see the Unicode -Privacy Policy. For trademark usage, see the Unicode¬Æ Consortium Name and +Privacy Policy. For trademark usage, see the Unicode® Consortium Name and Trademark Usage Policy. A. Unicode Copyright. - 1. Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. + 1. Copyright © 1991-2011 Unicode, Inc. All rights reserved. 2. Certain documents and files on this website contain a legend indicating that "Modification is permitted." Any person is hereby authorized, without fee, to modify such documents and files to create derivative - works conforming to the Unicode¬Æ Standard, subject to Terms and + works conforming to the Unicode® Standard, subject to Terms and Conditions herein. 3. Any person is hereby authorized, without fee, to view, use, reproduce, @@ -2030,14 +2030,14 @@ D. Waiver of Damages. In no event shall Unicode or its licensors be liable for E.Trademarks & Logos. 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode, - Inc. ‚ÄúThe Unicode Consortium‚Äù and ‚ÄúUnicode, Inc.‚Äù are trade names of + Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of Unicode, Inc. Use of the information and materials found on this - website indicates your acknowledgement of Unicode, Inc.‚Äôs exclusive + website indicates your acknowledgement of Unicode, Inc.’s exclusive worldwide rights in the Unicode Word Mark, the Unicode Logo, and the Unicode trade names. - 2. The Unicode Consortium Name and Trademark Usage Policy (‚ÄúTrademark - Policy‚Äù) are incorporated herein by reference and you agree to abide by + 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark + Policy”) are incorporated herein by reference and you agree to abide by the provisions of the Trademark Policy, which may be changed from time to time in the sole discretion of Unicode, Inc. @@ -2060,12 +2060,12 @@ Miscellaneous. 2. Modification by Unicode. Unicode shall have the right to modify this Agreement at any time by posting it to this site. The user may not - assign any part of this Agreement without Unicode‚Äôs prior written + assign any part of this Agreement without Unicode’s prior written consent. 3. Taxes. The user agrees to pay any taxes arising from access to this website or use of the information herein, except for those based on - Unicode‚Äôs net income. + Unicode’s net income. 4. Severability. If any provision of this Agreement is declared invalid or unenforceable, the remaining provisions of this Agreement shall remain @@ -2094,7 +2094,7 @@ SOFTWARE. COPYRIGHT AND PERMISSION NOTICE -Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. Distributed under the +Copyright © 1991-2011 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy From 22e895a8979c6b14f8c87d8458e3d0af7c9bae42 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 18:03:07 -0400 Subject: [PATCH 010/274] 8008757: NEWBUILD=true has separate launcher code for jjs Reviewed-by: jjh --- jdk/makefiles/CompileLaunchers.gmk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jdk/makefiles/CompileLaunchers.gmk b/jdk/makefiles/CompileLaunchers.gmk index 8d6f606acfc..501c986082e 100644 --- a/jdk/makefiles/CompileLaunchers.gmk +++ b/jdk/makefiles/CompileLaunchers.gmk @@ -312,9 +312,7 @@ $(eval $(call SetupLauncher,jrunscript,\ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }')) $(eval $(call SetupLauncher,jjs,\ - -DJAVA_ARGS='{ "-J-XX:-TieredCompilation"$(COMMA) \ - "-J-Xms2G"$(COMMA) "-J-Xmx2G"$(COMMA) \ - "jdk.nashorn.tools.Shell"$(COMMA) }')) + -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.nashorn.tools.Shell"$(COMMA) }')) $(eval $(call SetupLauncher,jsadebugd,\ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \ From 636021664aecb3ed1fd8d6419e624baa379a09d3 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 22:58:48 -0400 Subject: [PATCH 011/274] 8008774: nashorn missing from dependencies after merge with tl Reviewed-by: jjh --- common/makefiles/Main.gmk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/makefiles/Main.gmk b/common/makefiles/Main.gmk index 30a966d9b21..c43f590707c 100644 --- a/common/makefiles/Main.gmk +++ b/common/makefiles/Main.gmk @@ -137,7 +137,7 @@ demos-only: start-make # Note: This double-colon rule is intentional, to support # custom make file integration. -images:: source-tips demos images-only +images:: source-tips demos nashorn images-only images-only: start-make @$(call TargetEnter) @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images) @@ -241,8 +241,8 @@ clean-docs: $(call CleanComponent,docs) $(call CleanComponent,docstemp) -.PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install -.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only +.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install +.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only .PHONY: all test clean dist-clean bootcycle-images start-make .PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build .PHONY: profiles profiles-only profiles-oscheck From b5a3cc405ba9f7e113dcd1ac80135bd4a7cf0cd1 Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 22 Feb 2013 23:36:47 -0400 Subject: [PATCH 012/274] 8008775: Remove non-ascii from jdk/THIRD_PARTY_README Reviewed-by: jjh --- jdk/THIRD_PARTY_README | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/jdk/THIRD_PARTY_README b/jdk/THIRD_PARTY_README index 6dc1b331638..458e7537479 100644 --- a/jdk/THIRD_PARTY_README +++ b/jdk/THIRD_PARTY_README @@ -6,7 +6,7 @@ Framework v4.0, which is included with JRE 8, and JDK 8. --- begin of LICENSE --- -Copyright (c) 2000-2011 France Tlcom +Copyright (c) 2000-2011 France Telecom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -741,7 +741,7 @@ Linux and Solaris. --- begin of LICENSE --- -Copyright ¬© 2001,2003 Keith Packard +Copyright ¬¨¬© 2001,2003 Keith Packard Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the @@ -1955,16 +1955,16 @@ v1.9, which is included with JRE 7, JDK 7, and OpenJDK 7. Unicode Terms of Use For the general privacy policy governing access to this site, see the Unicode -Privacy Policy. For trademark usage, see the Unicode® Consortium Name and +Privacy Policy. For trademark usage, see the Unicode¬Æ Consortium Name and Trademark Usage Policy. A. Unicode Copyright. - 1. Copyright © 1991-2011 Unicode, Inc. All rights reserved. + 1. Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. 2. Certain documents and files on this website contain a legend indicating that "Modification is permitted." Any person is hereby authorized, without fee, to modify such documents and files to create derivative - works conforming to the Unicode® Standard, subject to Terms and + works conforming to the Unicode¬Æ Standard, subject to Terms and Conditions herein. 3. Any person is hereby authorized, without fee, to view, use, reproduce, @@ -2030,14 +2030,14 @@ D. Waiver of Damages. In no event shall Unicode or its licensors be liable for E.Trademarks & Logos. 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode, - Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of + Inc. ‚ÄúThe Unicode Consortium‚Äù and ‚ÄúUnicode, Inc.‚Äù are trade names of Unicode, Inc. Use of the information and materials found on this - website indicates your acknowledgement of Unicode, Inc.’s exclusive + website indicates your acknowledgement of Unicode, Inc.‚Äôs exclusive worldwide rights in the Unicode Word Mark, the Unicode Logo, and the Unicode trade names. - 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark - Policy”) are incorporated herein by reference and you agree to abide by + 2. The Unicode Consortium Name and Trademark Usage Policy (‚ÄúTrademark + Policy‚Äù) are incorporated herein by reference and you agree to abide by the provisions of the Trademark Policy, which may be changed from time to time in the sole discretion of Unicode, Inc. @@ -2060,12 +2060,12 @@ Miscellaneous. 2. Modification by Unicode. Unicode shall have the right to modify this Agreement at any time by posting it to this site. The user may not - assign any part of this Agreement without Unicode’s prior written + assign any part of this Agreement without Unicode‚Äôs prior written consent. 3. Taxes. The user agrees to pay any taxes arising from access to this website or use of the information herein, except for those based on - Unicode’s net income. + Unicode‚Äôs net income. 4. Severability. If any provision of this Agreement is declared invalid or unenforceable, the remaining provisions of this Agreement shall remain @@ -2094,7 +2094,7 @@ SOFTWARE. COPYRIGHT AND PERMISSION NOTICE -Copyright © 1991-2011 Unicode, Inc. All rights reserved. Distributed under the +Copyright ¬© 1991-2011 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy From 347f54c3e2c02d2ff32eb4d73803e2ec4642a794 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Thu, 10 Oct 2013 18:59:01 +0400 Subject: [PATCH 013/274] 7058618: PNG parser bugs found via zzuf fuzzing Reviewed-by: prr, vadim --- .../imageio/plugins/png/PNGImageReader.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java index e2ab9577dc4..abef6740f74 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java @@ -688,6 +688,21 @@ public class PNGImageReader extends ImageReader { loop: while (true) { int chunkLength = stream.readInt(); int chunkType = stream.readInt(); + int chunkCRC; + + // verify the chunk length + if (chunkLength < 0) { + throw new IIOException("Invalid chunk lenght " + chunkLength); + }; + + try { + stream.mark(); + stream.seek(stream.getStreamPosition() + chunkLength); + chunkCRC = stream.readInt(); + stream.reset(); + } catch (IOException e) { + throw new IIOException("Invalid chunk length " + chunkLength); + } switch (chunkType) { case IDAT_TYPE: @@ -762,7 +777,11 @@ public class PNGImageReader extends ImageReader { break; } - int chunkCRC = stream.readInt(); + // double check whether all chunk data were consumed + if (chunkCRC != stream.readInt()) { + throw new IIOException("Failed to read a chunk of type " + + chunkType); + } stream.flushBefore(stream.getStreamPosition()); } } catch (IOException e) { @@ -1277,6 +1296,16 @@ public class PNGImageReader extends ImageReader { is = new BufferedInputStream(is); this.pixelStream = new DataInputStream(is); + /* + * NB: the PNG spec declares that valid range for width + * and height is [1, 2^31-1], so here we may fail to allocate + * a buffer for destination image due to memory limitation. + * + * However, the recovery strategy for this case should be + * defined on the level of application, so we will not + * try to estimate the required amount of the memory and/or + * handle OOM in any way. + */ theImage = getDestination(param, getImageTypes(0), width, From 532ecca465ebd09dd1daeed76da06145faff8f1c Mon Sep 17 00:00:00 2001 From: Morris Meyer Date: Fri, 11 Oct 2013 12:40:14 -0700 Subject: [PATCH 014/274] 7195597: ThreadStateTest gets different results with -Xcomp Reviewed-by: kvn --- jdk/test/java/lang/Thread/ThreadStateTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/java/lang/Thread/ThreadStateTest.java b/jdk/test/java/lang/Thread/ThreadStateTest.java index c4fa18850b2..51429e9a7ef 100644 --- a/jdk/test/java/lang/Thread/ThreadStateTest.java +++ b/jdk/test/java/lang/Thread/ThreadStateTest.java @@ -30,7 +30,7 @@ * @author Mandy Chung * * @build ThreadStateTest - * @run main ThreadStateTest + * @run main/othervm -Xmixed ThreadStateTest */ import java.util.concurrent.locks.LockSupport; From 89b5a10c5ff96ec5a8e04de655a9f959ec170d6a Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 14 Oct 2013 15:32:29 +0400 Subject: [PATCH 015/274] 7058602: BMP parser bugs found via zzuf fuzzing Reviewed-by: prr, vadim --- .../imageio/plugins/bmp/BMPImageReader.java | 65 +++++++++++++++---- .../plugins/common/iio-plugin.properties | 4 +- .../java/awt/image/ComponentSampleModel.java | 50 +++++++++++--- 3 files changed, 95 insertions(+), 24 deletions(-) diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java index 94fd920ba31..b8c9a1e2b36 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java @@ -187,15 +187,24 @@ public class BMPImageReader extends ImageReader implements BMPConstants { return 1; } + @Override public int getWidth(int imageIndex) throws IOException { checkIndex(imageIndex); - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } return width; } public int getHeight(int imageIndex) throws IOException { checkIndex(imageIndex); - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } return height; } @@ -205,7 +214,18 @@ public class BMPImageReader extends ImageReader implements BMPConstants { } } - public void readHeader() throws IOException { + /** + * Process the image header. + * + * @exception IllegalStateException if source stream is not set. + * + * @exception IOException if image stream is corrupted. + * + * @exception IllegalArgumentException if the image stream does not contain + * a BMP image, or if a sample model instance to describe the + * image can not be created. + */ + protected void readHeader() throws IOException, IllegalArgumentException { if (gotHeader) return; @@ -307,6 +327,9 @@ public class BMPImageReader extends ImageReader implements BMPConstants { case BI_RLE4: // 4-bit RLE compression // Read in the palette + if (bitmapOffset < (size + 14)) { + throw new IIOException(I18N.getString("BMPImageReader7")); + } int numberOfEntries = (int)((bitmapOffset-14-size) / 4); int sizeOfPalette = numberOfEntries * 4; palette = new byte[sizeOfPalette]; @@ -375,7 +398,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { break; default: throw new - RuntimeException(I18N.getString("BMPImageReader2")); + IIOException(I18N.getString("BMPImageReader2")); } } else if (size == 108 || size == 124) { // Windows 4.x BMP @@ -478,7 +501,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { } } else { throw new - RuntimeException(I18N.getString("BMPImageReader3")); + IIOException(I18N.getString("BMPImageReader3")); } } @@ -660,7 +683,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants { public Iterator getImageTypes(int imageIndex) throws IOException { checkIndex(imageIndex); - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } ArrayList list = new ArrayList(1); list.add(new ImageTypeSpecifier(originalColorModel, originalSampleModel)); @@ -675,7 +702,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants { throws IOException { checkIndex(imageIndex); if (metadata == null) { - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } } return metadata; } @@ -686,7 +717,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants { public boolean isRandomAccessEasy(int imageIndex) throws IOException { checkIndex(imageIndex); - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } return metadata.compression == BI_RGB; } @@ -705,7 +740,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants { param = getDefaultReadParam(); //read header - readHeader(); + try { + readHeader(); + } catch (IllegalArgumentException e) { + throw new IIOException(I18N.getString("BMPImageReader6"), e); + } sourceRegion = new Rectangle(0, 0, 0, 0); destinationRegion = new Rectangle(0, 0, 0, 0); @@ -817,7 +856,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } break; @@ -833,7 +872,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } break; @@ -874,7 +913,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } case VERSION_4_8_BIT: @@ -890,7 +929,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { default: throw new - RuntimeException(I18N.getString("BMPImageReader1")); + IIOException(I18N.getString("BMPImageReader1")); } break; diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties b/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties index 70a6f715211..85b108f8e3b 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties +++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties @@ -21,6 +21,8 @@ BMPImageReader2=Invalid compression specified in BMP stream. BMPImageReader3=New BMP version not implemented yet. BMPImageReader4=No ImageIO-style reader is found for BMPImageReader5=Input has not been set. +BMPImageReader6=Unable to read the image header. +BMPImageReader7=Invalid bitmap offset. BMPImageWriter0=Output is not an ImageOutputStream. BMPImageWriter1=The image region to be encoded is empty. BMPImageWriter2=Only 1 or 3 band image is encoded. @@ -34,7 +36,7 @@ BMPMetadata0=The provided metadata format isn't recognized. BMPMetadata1=Metadata is read-only. -# WBMP plugin properties +# WBMP plugin properties WBMPImageReader0=Only one image exists in the stream. WBMPImageReader1=Input has not been set. WBMPImageReader2=Bad WBMP header. diff --git a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java index d5f86f35287..5dee98cc55b 100644 --- a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java +++ b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java @@ -167,6 +167,7 @@ public class ComponentSampleModel extends SampleModel for (int i=0; i (Integer.MAX_VALUE - 1)) { + throw new IllegalArgumentException("Invalid band offset"); + } + + if (pixelStride < 0 || pixelStride > (Integer.MAX_VALUE / width)) { + throw new IllegalArgumentException("Invalid pixel stride"); + } + + if (scanlineStride < 0 || scanlineStride > (Integer.MAX_VALUE / height)) { + throw new IllegalArgumentException("Invalid scanline stride"); + } + + int size = maxBandOff + 1; + + int val = pixelStride * (width - 1); + + if (val > (Integer.MAX_VALUE - size)) { + throw new IllegalArgumentException("Invalid pixel stride"); + } + + size += val; + + val = scanlineStride * (height - 1); + + if (val > (Integer.MAX_VALUE - size)) { + throw new IllegalArgumentException("Invalid scan stride"); + } + + size += val; - long size = 0; - if (maxBandOff >= 0) - size += maxBandOff+1; - if (pixelStride > 0) - size += pixelStride * (width-1); - if (scanlineStride > 0) - size += scanlineStride*(height-1); return size; } @@ -409,7 +439,7 @@ public class ComponentSampleModel extends SampleModel public DataBuffer createDataBuffer() { DataBuffer dataBuffer = null; - int size = (int)getBufferSize(); + int size = getBufferSize(); switch (dataType) { case DataBuffer.TYPE_BYTE: dataBuffer = new DataBufferByte(size, numBanks); From a1e06f7eaca68822bdb07b295e4269eff662c9b2 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 14 Oct 2013 15:49:05 +0400 Subject: [PATCH 016/274] 7058607: GIF parser bugs found via zzuf fuzzing Reviewed-by: prr, vadim --- .../imageio/plugins/gif/GIFImageReader.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java index 0fbdefb8e0e..5e3d852275d 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java @@ -115,6 +115,8 @@ public class GIFImageReader extends ImageReader { // The current interlace pass, starting with 0. int interlacePass = 0; + private byte[] fallbackColorTable = null; + // End per-stream settings // Constants used to control interlacing. @@ -239,10 +241,22 @@ public class GIFImageReader extends ImageReader { byte[] colorTable; if (imageMetadata.localColorTable != null) { colorTable = imageMetadata.localColorTable; + fallbackColorTable = imageMetadata.localColorTable; } else { colorTable = streamMetadata.globalColorTable; } + if (colorTable == null) { + if (fallbackColorTable == null) { + this.processWarningOccurred("Use default color table."); + + // no color table, the spec allows to use any palette. + fallbackColorTable = getDefaultPalette(); + } + + colorTable = fallbackColorTable; + } + // Normalize color table length to 2^1, 2^2, 2^4, or 2^8 int length = colorTable.length/3; int bits; @@ -1036,5 +1050,34 @@ public class GIFImageReader extends ImageReader { streamY = -1; rowsDone = 0; interlacePass = 0; + + fallbackColorTable = null; + } + + private static byte[] defaultPalette = null; + + private static synchronized byte[] getDefaultPalette() { + if (defaultPalette == null) { + BufferedImage img = new BufferedImage(1, 1, + BufferedImage.TYPE_BYTE_INDEXED); + IndexColorModel icm = (IndexColorModel) img.getColorModel(); + + final int size = icm.getMapSize(); + byte[] r = new byte[size]; + byte[] g = new byte[size]; + byte[] b = new byte[size]; + icm.getReds(r); + icm.getGreens(g); + icm.getBlues(b); + + defaultPalette = new byte[size * 3]; + + for (int i = 0; i < size; i++) { + defaultPalette[3 * i + 0] = r[i]; + defaultPalette[3 * i + 1] = g[i]; + defaultPalette[3 * i + 2] = b[i]; + } + } + return defaultPalette; } } From 9eb9388a8193b88f6da95cbf2ee9d58e67cfd7e0 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 14 Oct 2013 16:00:03 +0400 Subject: [PATCH 017/274] 7058611: JPG parser bugs found via zzuf fuzzing Reviewed-by: prr, vadim --- .../classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java | 5 +++++ .../com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java index fd8d1cd53c1..f38e30f3ae8 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java @@ -28,6 +28,7 @@ package com.sun.imageio.plugins.jpeg; import javax.imageio.metadata.IIOInvalidTreeException; import javax.imageio.metadata.IIOMetadataNode; import javax.imageio.stream.ImageOutputStream; +import javax.imageio.IIOException; import java.io.IOException; @@ -60,6 +61,10 @@ class MarkerSegment implements Cloneable { length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8; length |= buffer.buf[buffer.bufPtr++] & 0xff; length -= 2; // JPEG length includes itself, we don't + + if (length < 0) { + throw new IIOException("Invalid segment length: " + length); + } buffer.bufAvail -= 3; // Now that we know the true length, ensure that we've got it, // or at least a bufferful if length is too big. diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java index c1359e7b09d..904fa73777c 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java @@ -78,7 +78,7 @@ class SOFMarkerSegment extends MarkerSegment { numLines |= buffer.buf[buffer.bufPtr++] & 0xff; samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8; samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff; - int numComponents = buffer.buf[buffer.bufPtr++]; + int numComponents = buffer.buf[buffer.bufPtr++] & 0xff; componentSpecs = new ComponentSpec [numComponents]; for (int i = 0; i < numComponents; i++) { componentSpecs[i] = new ComponentSpec(buffer); From d8f5fe01b245647eb93017e38c37559566d10691 Mon Sep 17 00:00:00 2001 From: Jennifer Godinez Date: Mon, 14 Oct 2013 09:15:21 -0700 Subject: [PATCH 018/274] 8022536: closed/javax/print/TextFlavorTest.java fails Reviewed-by: prr, jchen --- .../classes/sun/print/CUPSPrinter.java | 25 ++++++-- .../classes/sun/print/IPPPrintService.java | 3 + .../sun/print/UnixPrintServiceLookup.java | 64 ++++++++++++++----- .../print/PrinterJob/PrintLatinCJKTest.java | 4 +- jdk/test/javax/print/TextFlavorTest.java | 61 ++++++++++++++++++ 5 files changed, 134 insertions(+), 23 deletions(-) create mode 100644 jdk/test/javax/print/TextFlavorTest.java diff --git a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java index ab2d707a89e..a4c1082e78c 100644 --- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java +++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java @@ -237,8 +237,9 @@ public class CUPSPrinter { /** * Get CUPS default printer using IPP. + * Returns 2 values - index 0 is printer name, index 1 is the uri. */ - public static String getDefaultPrinter() { + static String[] getDefaultPrinter() { try { URL url = new URL("http", getServer(), getPort(), ""); final HttpURLConnection urlConnection = @@ -264,8 +265,8 @@ public class CUPSPrinter { AttributeClass.ATTRIBUTES_CHARSET, AttributeClass.ATTRIBUTES_NATURAL_LANGUAGE, new AttributeClass("requested-attributes", - AttributeClass.TAG_KEYWORD, - "printer-name") + AttributeClass.TAG_URI, + "printer-uri") }; if (IPPPrintService.writeIPPRequest(os, @@ -273,6 +274,7 @@ public class CUPSPrinter { attCl)) { HashMap defaultMap = null; + String[] printerInfo = new String[2]; InputStream is = urlConnection.getInputStream(); HashMap[] responseMap = IPPPrintService.readIPPResponse( is); @@ -293,21 +295,30 @@ public class CUPSPrinter { * special behaviour for this built in. */ if (UnixPrintServiceLookup.isMac()) { - return UnixPrintServiceLookup. + printerInfo[0] = UnixPrintServiceLookup. getDefaultPrinterNameSysV(); + printerInfo[1] = null; + return (String[])printerInfo.clone(); } else { return null; } } + AttributeClass attribClass = (AttributeClass) defaultMap.get("printer-name"); if (attribClass != null) { - String nameStr = attribClass.getStringValue(); + printerInfo[0] = attribClass.getStringValue(); + attribClass = (AttributeClass)defaultMap.get("device-uri"); + if (attribClass != null) { + printerInfo[1] = attribClass.getStringValue(); + } else { + printerInfo[1] = null; + } os.close(); urlConnection.disconnect(); - return nameStr; + return (String [])printerInfo.clone(); } } os.close(); @@ -322,7 +333,7 @@ public class CUPSPrinter { /** * Get list of all CUPS printers using IPP. */ - public static String[] getAllPrinters() { + static String[] getAllPrinters() { try { URL url = new URL("http", getServer(), getPort(), ""); diff --git a/jdk/src/solaris/classes/sun/print/IPPPrintService.java b/jdk/src/solaris/classes/sun/print/IPPPrintService.java index da796b9d495..329bb2934a9 100644 --- a/jdk/src/solaris/classes/sun/print/IPPPrintService.java +++ b/jdk/src/solaris/classes/sun/print/IPPPrintService.java @@ -366,6 +366,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService { " IPPPrintService, myURL="+ myURL+" Exception= "+ e); + throw new IllegalArgumentException("invalid url"); } isCupsPrinter = isCups; @@ -1145,6 +1146,8 @@ public class IPPPrintService implements PrintService, SunPrinterJobService { // REMIND: check attribute values return (T)PDLOverrideSupported.NOT_ATTEMPTED; } + } else if (category == PrinterURI.class) { + return (T)(new PrinterURI(myURI)); } else { return null; } diff --git a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java index 54dc8b666fc..a83aebb1eb8 100644 --- a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java +++ b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java @@ -48,6 +48,7 @@ import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.PrintServiceAttributeSet; import javax.print.attribute.standard.PrinterName; +import javax.print.attribute.standard.PrinterURI; import java.io.File; import java.io.FileReader; import java.net.URL; @@ -203,6 +204,33 @@ public class UnixPrintServiceLookup extends PrintServiceLookup } } + private int addPrintServiceToList(ArrayList printerList, PrintService ps) { + int index = printerList.indexOf(ps); + // Check if PrintService with same name is already in the list. + if (CUPSPrinter.isCupsRunning() && index != -1) { + // Bug in Linux: Duplicate entry of a remote printer + // and treats it as local printer but it is returning wrong + // information when queried using IPP. Workaround is to remove it. + // Even CUPS ignores these entries as shown in lpstat or using + // their web configuration. + PrinterURI uri = (PrinterURI)ps.getAttribute(PrinterURI.class); + if (uri.getURI().getHost().equals("localhost")) { + IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, ignoring the new local printer: "+ps); + return index; // Do not add this. + } + PrintService oldPS = (PrintService)(printerList.get(index)); + uri = (PrinterURI)oldPS.getAttribute(PrinterURI.class); + if (uri.getURI().getHost().equals("localhost")) { + IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, removing existing local printer: "+oldPS); + printerList.remove(oldPS); + } else { + return index; + } + } + printerList.add(ps); + return (printerList.size() - 1); + } + // refreshes "printServices" public synchronized void refreshServices() { @@ -246,8 +274,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup } if ((defaultPrintService != null) && printers[p].equals(getPrinterDestName(defaultPrintService))) { - printerList.add(defaultPrintService); - defaultIndex = printerList.size() - 1; + defaultIndex = addPrintServiceToList(printerList, defaultPrintService); } else { if (printServices == null) { IPPPrintService.debug_println(debugPrefix+ @@ -255,9 +282,10 @@ public class UnixPrintServiceLookup extends PrintServiceLookup if (CUPSPrinter.isCupsRunning()) { try { - printerList.add(new IPPPrintService(printers[p], - printerURIs[p], - true)); + addPrintServiceToList(printerList, + new IPPPrintService(printers[p], + printerURIs[p], + true)); } catch (Exception e) { IPPPrintService.debug_println(debugPrefix+ " getAllPrinters Exception "+ @@ -282,10 +310,10 @@ public class UnixPrintServiceLookup extends PrintServiceLookup if (j == printServices.length) { // not found? if (CUPSPrinter.isCupsRunning()) { try { - printerList.add(new IPPPrintService( - printers[p], - printerURIs[p], - true)); + addPrintServiceToList(printerList, + new IPPPrintService(printers[p], + printerURIs[p], + true)); } catch (Exception e) { IPPPrintService.debug_println(debugPrefix+ " getAllPrinters Exception "+ @@ -312,9 +340,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup //if defaultService is not found in printerList if (defaultIndex == -1 && defaultPrintService != null) { - //add default to the list - printerList.add(defaultPrintService); - defaultIndex = printerList.size() - 1; + defaultIndex = addPrintServiceToList(printerList, defaultPrintService); } printServices = (PrintService[])printerList.toArray( @@ -563,11 +589,14 @@ public class UnixPrintServiceLookup extends PrintServiceLookup // clear defaultPrintService defaultPrintService = null; + String psuri = null; IPPPrintService.debug_println("isRunning ? "+ (CUPSPrinter.isCupsRunning())); if (CUPSPrinter.isCupsRunning()) { - defaultPrinter = CUPSPrinter.getDefaultPrinter(); + String[] printerInfo = CUPSPrinter.getDefaultPrinter(); + defaultPrinter = printerInfo[0]; + psuri = printerInfo[1]; } else { if (isMac() || isSysV()) { defaultPrinter = getDefaultPrinterNameSysV(); @@ -590,12 +619,17 @@ public class UnixPrintServiceLookup extends PrintServiceLookup if (defaultPrintService == null) { if (CUPSPrinter.isCupsRunning()) { try { - PrintService defaultPS = - new IPPPrintService(defaultPrinter, + PrintService defaultPS; + if (psuri != null) { + defaultPS = new IPPPrintService(defaultPrinter, + psuri, true); + } else { + defaultPS = new IPPPrintService(defaultPrinter, new URL("http://"+ CUPSPrinter.getServer()+":"+ CUPSPrinter.getPort()+"/"+ defaultPrinter)); + } defaultPrintService = defaultPS; } catch (Exception e) { } diff --git a/jdk/test/java/awt/print/PrinterJob/PrintLatinCJKTest.java b/jdk/test/java/awt/print/PrinterJob/PrintLatinCJKTest.java index 02ccba7641d..a6853c97eac 100644 --- a/jdk/test/java/awt/print/PrinterJob/PrintLatinCJKTest.java +++ b/jdk/test/java/awt/print/PrinterJob/PrintLatinCJKTest.java @@ -23,7 +23,7 @@ /** * @test - * @bug 800535 + * @bug 800535 8022536 * @summary JDK7 Printing: CJK and Latin Text in string overlap * @run main/manual=yesno PrintLatinCJKTest */ @@ -49,6 +49,8 @@ public class PrintLatinCJKTest implements Printable, ActionListener { private PageFormat pf; static String info = + "To test 8022536, if a remote printer is the system default,"+ + "it should show in the dialog as the selected printer.\n"+ "You need a printer for this test. If you have none, let "+ "the test pass. If there is a printer, press Print, send "+ "the output to the printer, and examine it. It should have "+ diff --git a/jdk/test/javax/print/TextFlavorTest.java b/jdk/test/javax/print/TextFlavorTest.java new file mode 100644 index 00000000000..f703e8aacc5 --- /dev/null +++ b/jdk/test/javax/print/TextFlavorTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + @test + @bug 6334074 8022536 + @summary test supported text flavors reported properly + @run main TextFlavorTest +*/ + +import javax.print.*; +import javax.print.attribute.standard.*; +import javax.print.attribute.*; +import java.io.*; + +public class TextFlavorTest { + + public static void main(String[] args) throws Exception { + + PrintService service[] = + PrintServiceLookup.lookupPrintServices(null, null); + + if (service.length == 0) { + System.out.println("No print service found."); + return; + } + + for (int y = 0; y < service.length; y ++) { + DocFlavor flavors[] = service[y].getSupportedDocFlavors(); + if (flavors == null) continue; + for (int x = 0; x < flavors.length; x ++) { + if (!service[y].isDocFlavorSupported(flavors[x])) { + String msg = "DocFlavor " + flavors[x] + + " is not supported by service "+ service[y]; + throw new RuntimeException(msg); + } + } + } + System.out.println("Test passed."); + } +} From 26b8f332621bd3b13b23e9fc5cda79aa372e7d18 Mon Sep 17 00:00:00 2001 From: Vadim Pakhnushev Date: Tue, 15 Oct 2013 08:39:26 +0400 Subject: [PATCH 019/274] 8023590: REGRESSION: large count of graphics artifacts with Java 8 on Windows 8 on Intel HD card Reviewed-by: prr, bae --- .../native/sun/java2d/d3d/D3DBadHardware.h | 133 ++++++++++++------ 1 file changed, 90 insertions(+), 43 deletions(-) diff --git a/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h b/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h index 379a167500f..5f4cee4fa61 100644 --- a/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h +++ b/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h @@ -53,26 +53,73 @@ static const ADAPTER_INFO badHardware[] = { // Intel HD // Clarkdale (Desktop) GMA HD Lines - { 0x8086, 0x0042, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0042, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0042, D_VERSION(6,14,10,5394), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0042, D_VERSION(8,15,10,2993), OS_VISTA | OS_WINDOWS7 }, // Arrandale (Mobile) GMA HD Lines - { 0x8086, 0x0046, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0046, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - // Sandy Bridge GMA HD Lines - { 0x8086, 0x0102, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0102, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0106, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0106, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0112, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0112, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0116, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0116, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0122, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0122, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x0126, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x0126, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x010A, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x010A, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0046, D_VERSION(6,14,10,5394), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0046, D_VERSION(8,15,10,2993), OS_VISTA | OS_WINDOWS7 }, + + // Sandy Bridge HD Graphics 3000/2000 + { 0x8086, 0x0102, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0102, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0106, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0106, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0112, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0112, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0116, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0116, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0122, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0122, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0126, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0126, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x010A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x010A, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 }, + + // Ivy Bridge + { 0x8086, 0x0162, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0162, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0166, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0166, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x016A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x016A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0152, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0152, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0156, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0156, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x015A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x015A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + + // Haswell + { 0x8086, 0x0402, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0402, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0406, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0406, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0412, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0412, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0416, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0416, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x041E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x041E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x040A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x040A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x041A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x041A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0A06, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0A06, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0A16, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0A16, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0A26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0A26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0A2E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0A2E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0A1E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0A1E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0A0E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0A0E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0D26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0D26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x0D22, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x0D22, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 }, // Reason: workaround for 6620073, 6612195 // Intel 740 @@ -123,33 +170,33 @@ static const ADAPTER_INFO badHardware[] = { { 0x8086, 0x2A13, NO_VERSION, OS_ALL }, // Eaglelake (Desktop) GMA 4500 Lines - { 0x8086, 0x2E42, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E42, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x2E43, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E43, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x2E92, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E92, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x2E93, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E93, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x2E12, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E12, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x2E13, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E13, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E42, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E42, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E43, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E43, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E92, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E92, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E93, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E93, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E12, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E12, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E13, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E13, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, // Eaglelake (Desktop) GMA X4500 Lines - { 0x8086, 0x2E32, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E32, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x2E33, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E33, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x2E22, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E22, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E32, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E32, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E33, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E33, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E22, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E22, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, // Eaglelake (Desktop) GMA X4500HD Lines - { 0x8086, 0x2E23, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2E23, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2E23, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2E23, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, // Cantiga (Mobile) GMA 4500MHD Lines - { 0x8086, 0x2A42, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2A42, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, - { 0x8086, 0x2A43, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 }, - { 0x8086, 0x2A43, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2A42, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2A42, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, + { 0x8086, 0x2A43, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 }, + { 0x8086, 0x2A43, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 }, // ATI Mobility Radeon X1600, X1400, X1450, X1300, X1350 // Reason: workaround for 6613066, 6687166 From 1c047b640d2ab02568a6664b2a166777aba7fdfa Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Wed, 23 Oct 2013 11:15:24 -0700 Subject: [PATCH 020/274] 8026495: JVM Crashes when started with -XX:+DTraceMethodProbes on Solaris x86_64 Fix wrong calling convention in LIR_Assembler::emit_unwind_handler(), T_METADATA support in calling convention generator, C1 register allocator Reviewed-by: twisti, jrose --- .../src/cpu/sparc/vm/c1_FrameMap_sparc.cpp | 2 ++ hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp | 2 ++ .../src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | 20 ++++++++++++------- hotspot/src/share/vm/c1/c1_LIR.cpp | 4 ++-- hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 6 +++--- hotspot/src/share/vm/c1/c1_LinearScan.cpp | 4 ++-- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp index 97ec2239549..e6e7212ed4a 100644 --- a/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp @@ -53,6 +53,8 @@ LIR_Opr FrameMap::map_to_opr(BasicType type, VMRegPair* reg, bool outgoing) { opr = as_long_opr(reg); } else if (type == T_OBJECT || type == T_ARRAY) { opr = as_oop_opr(reg); + } else if (type == T_METADATA) { + opr = as_metadata_opr(reg); } else { opr = as_opr(reg); } diff --git a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp index bd3ad930b70..8ef1bea5d83 100644 --- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp @@ -52,6 +52,8 @@ LIR_Opr FrameMap::map_to_opr(BasicType type, VMRegPair* reg, bool) { #endif // _LP64 } else if (type == T_OBJECT || type == T_ARRAY) { opr = as_oop_opr(reg); + } else if (type == T_METADATA) { + opr = as_metadata_opr(reg); } else { opr = as_opr(reg); } diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp index a8773c594da..af13192330b 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -432,15 +432,16 @@ int LIR_Assembler::emit_unwind_handler() { int offset = code_offset(); // Fetch the exception from TLS and clear out exception related thread state - __ get_thread(rsi); - __ movptr(rax, Address(rsi, JavaThread::exception_oop_offset())); - __ movptr(Address(rsi, JavaThread::exception_oop_offset()), (intptr_t)NULL_WORD); - __ movptr(Address(rsi, JavaThread::exception_pc_offset()), (intptr_t)NULL_WORD); + Register thread = NOT_LP64(rsi) LP64_ONLY(r15_thread); + NOT_LP64(__ get_thread(rsi)); + __ movptr(rax, Address(thread, JavaThread::exception_oop_offset())); + __ movptr(Address(thread, JavaThread::exception_oop_offset()), (intptr_t)NULL_WORD); + __ movptr(Address(thread, JavaThread::exception_pc_offset()), (intptr_t)NULL_WORD); __ bind(_unwind_handler_entry); __ verify_not_null_oop(rax); if (method()->is_synchronized() || compilation()->env()->dtrace_method_probes()) { - __ mov(rsi, rax); // Preserve the exception + __ mov(rbx, rax); // Preserve the exception (rbx is always callee-saved) } // Preform needed unlocking @@ -448,19 +449,24 @@ int LIR_Assembler::emit_unwind_handler() { if (method()->is_synchronized()) { monitor_address(0, FrameMap::rax_opr); stub = new MonitorExitStub(FrameMap::rax_opr, true, 0); - __ unlock_object(rdi, rbx, rax, *stub->entry()); + __ unlock_object(rdi, rsi, rax, *stub->entry()); __ bind(*stub->continuation()); } if (compilation()->env()->dtrace_method_probes()) { +#ifdef _LP64 + __ mov(rdi, r15_thread); + __ mov_metadata(rsi, method()->constant_encoding()); +#else __ get_thread(rax); __ movptr(Address(rsp, 0), rax); __ mov_metadata(Address(rsp, sizeof(void*)), method()->constant_encoding()); +#endif __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit))); } if (method()->is_synchronized() || compilation()->env()->dtrace_method_probes()) { - __ mov(rax, rsi); // Restore the exception + __ mov(rax, rbx); // Restore the exception } // remove the activation and dispatch to the unwind handler diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp index f40d9133306..2634f5f4105 100644 --- a/hotspot/src/share/vm/c1/c1_LIR.cpp +++ b/hotspot/src/share/vm/c1/c1_LIR.cpp @@ -183,10 +183,10 @@ char LIR_OprDesc::type_char(BasicType t) { case T_LONG: case T_OBJECT: case T_ADDRESS: - case T_METADATA: case T_VOID: return ::type2char(t); - + case T_METADATA: + return 'M'; case T_ILLEGAL: return '?'; diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index 44ad61f642d..e3098911d88 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -1175,7 +1175,7 @@ void LIRGenerator::do_Return(Return* x) { if (compilation()->env()->dtrace_method_probes()) { BasicTypeList signature; signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT)); // thread - signature.append(T_OBJECT); // Method* + signature.append(T_METADATA); // Method* LIR_OprList* args = new LIR_OprList(); args->append(getThreadPointer()); LIR_Opr meth = new_register(T_METADATA); @@ -2720,7 +2720,7 @@ void LIRGenerator::do_Base(Base* x) { if (compilation()->env()->dtrace_method_probes()) { BasicTypeList signature; signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT)); // thread - signature.append(T_OBJECT); // Method* + signature.append(T_METADATA); // Method* LIR_OprList* args = new LIR_OprList(); args->append(getThreadPointer()); LIR_Opr meth = new_register(T_METADATA); @@ -3331,7 +3331,7 @@ void LIRGenerator::do_RuntimeCall(RuntimeCall* x) { BasicTypeList* signature = new BasicTypeList(x->number_of_arguments()); if (x->pass_thread()) { - signature->append(T_ADDRESS); + signature->append(LP64_ONLY(T_LONG) NOT_LP64(T_INT)); // thread args->append(getThreadPointer()); } diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp index 65d4c60b670..b7c04dbe825 100644 --- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp +++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp @@ -75,9 +75,9 @@ // Map BasicType to spill size in 32-bit words, matching VMReg's notion of words #ifdef _LP64 -static int type2spill_size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 0, 1, -1}; +static int type2spill_size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 0, 2, 1, 2, 1, -1}; #else -static int type2spill_size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 0, 1, -1}; +static int type2spill_size[T_CONFLICT+1]={ -1, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 0, 1, -1, 1, 1, -1}; #endif From be1ae599ee48109a67875ff27f114b283c41af36 Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Wed, 23 Oct 2013 15:44:12 -0700 Subject: [PATCH 021/274] 8026502: java/lang/invoke/MethodHandleConstants.java fails on all platforms Reviewed-by: iveresov, jrose --- hotspot/src/share/vm/classfile/systemDictionary.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index b6731c2e83a..b4dfe7475b9 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -2360,6 +2360,11 @@ methodHandle SystemDictionary::find_method_handle_invoker(Symbol* name, objArrayHandle appendix_box = oopFactory::new_objArray(SystemDictionary::Object_klass(), 1, CHECK_(empty)); assert(appendix_box->obj_at(0) == NULL, ""); + // This should not happen. JDK code should take care of that. + if (accessing_klass.is_null() || method_type.is_null()) { + THROW_MSG_(vmSymbols::java_lang_InternalError(), "bad invokehandle", empty); + } + // call java.lang.invoke.MethodHandleNatives::linkMethod(... String, MethodType) -> MemberName JavaCallArguments args; args.push_oop(accessing_klass()->java_mirror()); @@ -2485,6 +2490,9 @@ Handle SystemDictionary::link_method_handle_constant(KlassHandle caller, Handle type; if (signature->utf8_length() > 0 && signature->byte_at(0) == '(') { type = find_method_handle_type(signature, caller, CHECK_(empty)); + } else if (caller.is_null()) { + // This should not happen. JDK code should take care of that. + THROW_MSG_(vmSymbols::java_lang_InternalError(), "bad MH constant", empty); } else { ResourceMark rm(THREAD); SignatureStream ss(signature, false); @@ -2548,6 +2556,11 @@ methodHandle SystemDictionary::find_dynamic_call_site_invoker(KlassHandle caller Handle method_name = java_lang_String::create_from_symbol(name, CHECK_(empty)); Handle method_type = find_method_handle_type(type, caller, CHECK_(empty)); + // This should not happen. JDK code should take care of that. + if (caller.is_null() || method_type.is_null()) { + THROW_MSG_(vmSymbols::java_lang_InternalError(), "bad invokedynamic", empty); + } + objArrayHandle appendix_box = oopFactory::new_objArray(SystemDictionary::Object_klass(), 1, CHECK_(empty)); assert(appendix_box->obj_at(0) == NULL, ""); From 615376fb9bb90dbc36ff4fbf63d851277d7cb18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rickard=20B=C3=A4ckman?= Date: Fri, 18 Oct 2013 10:41:56 +0200 Subject: [PATCH 022/274] 8026844: Various Math functions needs intrinsification Reviewed-by: kvn, twisti --- hotspot/src/cpu/sparc/vm/sparc.ad | 4 + hotspot/src/cpu/x86/vm/assembler_x86.cpp | 17 + hotspot/src/cpu/x86/vm/assembler_x86.hpp | 4 + hotspot/src/cpu/x86/vm/x86_32.ad | 111 ++- hotspot/src/cpu/x86/vm/x86_64.ad | 234 ++++++ hotspot/src/share/vm/adlc/archDesc.cpp | 7 + hotspot/src/share/vm/classfile/vmSymbols.hpp | 19 +- hotspot/src/share/vm/opto/classes.hpp | 9 + hotspot/src/share/vm/opto/library_call.cpp | 168 ++++- hotspot/src/share/vm/opto/matcher.hpp | 1 + hotspot/src/share/vm/opto/mathexactnode.cpp | 313 +++++++- hotspot/src/share/vm/opto/mathexactnode.hpp | 74 +- hotspot/src/share/vm/opto/node.hpp | 3 + hotspot/src/share/vm/opto/type.cpp | 6 + hotspot/src/share/vm/opto/type.hpp | 1 + hotspot/src/share/vm/runtime/vmStructs.cpp | 8 +- .../{CondTest.java => AddExactICondTest.java} | 8 +- ...ntTest.java => AddExactIConstantTest.java} | 18 +- ...nstantTest.java => AddExactILoadTest.java} | 20 +- ...t.java => AddExactILoopDependentTest.java} | 19 +- .../mathexact/AddExactINonConstantTest.java | 37 + .../mathexact/AddExactIRepeatTest.java | 109 +++ .../mathexact/AddExactLConstantTest.java | 37 + .../mathexact/AddExactLNonConstantTest.java | 37 + .../intrinsics/mathexact/DecExactITest.java | 53 ++ .../intrinsics/mathexact/DecExactLTest.java | 53 ++ .../intrinsics/mathexact/IncExactITest.java | 51 ++ .../{LoadTest.java => IncExactLTest.java} | 41 +- .../mathexact/MulExactICondTest.java | 57 ++ .../mathexact/MulExactIConstantTest.java | 37 + .../mathexact/MulExactILoadTest.java | 38 + .../mathexact/MulExactILoopDependentTest.java | 36 + .../mathexact/MulExactINonConstantTest.java | 38 + .../mathexact/MulExactIRepeatTest.java | 109 +++ .../mathexact/MulExactLConstantTest.java | 37 + .../mathexact/MulExactLNonConstantTest.java | 37 + .../mathexact/NegExactIConstantTest.java | 37 + .../mathexact/NegExactILoadTest.java | 39 + .../mathexact/NegExactILoopDependentTest.java | 36 + .../mathexact/NegExactINonConstantTest.java | 37 + .../mathexact/NegExactLConstantTest.java | 37 + .../mathexact/NegExactLNonConstantTest.java | 37 + .../intrinsics/mathexact/RepeatTest.java | 107 --- .../mathexact/SubExactICondTest.java | 57 ++ .../mathexact/SubExactIConstantTest.java | 37 + .../mathexact/SubExactILoadTest.java | 38 + .../mathexact/SubExactILoopDependentTest.java | 37 + .../mathexact/SubExactINonConstantTest.java | 37 + .../mathexact/SubExactIRepeatTest.java | 111 +++ .../mathexact/SubExactLConstantTest.java | 37 + .../mathexact/SubExactLNonConstantTest.java | 37 + .../compiler/intrinsics/mathexact/Verify.java | 668 +++++++++++++++++- 52 files changed, 2970 insertions(+), 270 deletions(-) rename hotspot/test/compiler/intrinsics/mathexact/{CondTest.java => AddExactICondTest.java} (93%) rename hotspot/test/compiler/intrinsics/mathexact/{ConstantTest.java => AddExactIConstantTest.java} (69%) rename hotspot/test/compiler/intrinsics/mathexact/{NonConstantTest.java => AddExactILoadTest.java} (70%) rename hotspot/test/compiler/intrinsics/mathexact/{LoopDependentTest.java => AddExactILoopDependentTest.java} (68%) create mode 100644 hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java rename hotspot/test/compiler/intrinsics/mathexact/{LoadTest.java => IncExactLTest.java} (56%) create mode 100644 hotspot/test/compiler/intrinsics/mathexact/MulExactICondTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java delete mode 100644 hotspot/test/compiler/intrinsics/mathexact/RepeatTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java create mode 100644 hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index 06235820bb8..eea306b4130 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -2022,6 +2022,10 @@ const RegMask Matcher::mathExactI_result_proj_mask() { return G1_REGI_mask(); } +const RegMask Matcher::mathExactL_result_proj_mask() { + return G1_REGL_mask(); +} + const RegMask Matcher::mathExactI_flags_proj_mask() { return INT_FLAGS_mask(); } diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index 53f201b5033..49cc9ed65cf 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -1405,6 +1405,15 @@ void Assembler::imull(Register dst, Register src, int value) { } } +void Assembler::imull(Register dst, Address src) { + InstructionMark im(this); + prefix(src, dst); + emit_int8(0x0F); + emit_int8((unsigned char) 0xAF); + emit_operand(dst, src); +} + + void Assembler::incl(Address dst) { // Don't use it directly. Use MacroAssembler::increment() instead. InstructionMark im(this); @@ -5024,6 +5033,14 @@ void Assembler::imulq(Register dst, Register src, int value) { } } +void Assembler::imulq(Register dst, Address src) { + InstructionMark im(this); + prefixq(src, dst); + emit_int8(0x0F); + emit_int8((unsigned char) 0xAF); + emit_operand(dst, src); +} + void Assembler::incl(Register dst) { // Don't use it directly. Use MacroAssembler::incrementl() instead. // Use two-byte form (one-byte from is a REX prefix in 64-bit mode) diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp index 31481b5808f..1ad66bd6a95 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp @@ -1162,9 +1162,13 @@ private: void imull(Register dst, Register src); void imull(Register dst, Register src, int value); + void imull(Register dst, Address src); void imulq(Register dst, Register src); void imulq(Register dst, Register src, int value); +#ifdef _LP64 + void imulq(Register dst, Address src); +#endif // jcc is the generic conditional branch generator to run- diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad index 8ef13d90bd2..2aa9e5f5793 100644 --- a/hotspot/src/cpu/x86/vm/x86_32.ad +++ b/hotspot/src/cpu/x86/vm/x86_32.ad @@ -1538,6 +1538,11 @@ const RegMask Matcher::mathExactI_result_proj_mask() { return EAX_REG_mask(); } +const RegMask Matcher::mathExactL_result_proj_mask() { + ShouldNotReachHere(); + return RegMask(); +} + const RegMask Matcher::mathExactI_flags_proj_mask() { return INT_FLAGS_mask(); } @@ -7519,7 +7524,7 @@ instruct cmovL_regUCF(cmpOpUCF cop, eFlagsRegUCF cr, eRegL dst, eRegL src) %{ //----------Arithmetic Instructions-------------------------------------------- //----------Addition Instructions---------------------------------------------- -instruct addExactI_rReg(eAXRegI dst, rRegI src, eFlagsReg cr) +instruct addExactI_eReg(eAXRegI dst, rRegI src, eFlagsReg cr) %{ match(AddExactI dst src); effect(DEF cr); @@ -7531,7 +7536,7 @@ instruct addExactI_rReg(eAXRegI dst, rRegI src, eFlagsReg cr) ins_pipe(ialu_reg_reg); %} -instruct addExactI_rReg_imm(eAXRegI dst, immI src, eFlagsReg cr) +instruct addExactI_eReg_imm(eAXRegI dst, immI src, eFlagsReg cr) %{ match(AddExactI dst src); effect(DEF cr); @@ -7543,6 +7548,20 @@ instruct addExactI_rReg_imm(eAXRegI dst, immI src, eFlagsReg cr) ins_pipe(ialu_reg_reg); %} +instruct addExactI_eReg_mem(eAXRegI dst, memory src, eFlagsReg cr) +%{ + match(AddExactI dst (LoadI src)); + effect(DEF cr); + + ins_cost(125); + format %{ "ADD $dst,$src\t# addExact int" %} + ins_encode %{ + __ addl($dst$$Register, $src$$Address); + %} + ins_pipe( ialu_reg_mem ); +%} + + // Integer Addition Instructions instruct addI_eReg(rRegI dst, rRegI src, eFlagsReg cr) %{ match(Set dst (AddI dst src)); @@ -7851,6 +7870,44 @@ instruct xchgP( memory mem, pRegP newval) %{ %} //----------Subtraction Instructions------------------------------------------- + +instruct subExactI_eReg(eAXRegI dst, rRegI src, eFlagsReg cr) +%{ + match(SubExactI dst src); + effect(DEF cr); + + format %{ "SUB $dst, $src\t# subExact int" %} + ins_encode %{ + __ subl($dst$$Register, $src$$Register); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct subExactI_eReg_imm(eAXRegI dst, immI src, eFlagsReg cr) +%{ + match(SubExactI dst src); + effect(DEF cr); + + format %{ "SUB $dst, $src\t# subExact int" %} + ins_encode %{ + __ subl($dst$$Register, $src$$constant); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct subExactI_eReg_mem(eAXRegI dst, memory src, eFlagsReg cr) +%{ + match(SubExactI dst (LoadI src)); + effect(DEF cr); + + ins_cost(125); + format %{ "SUB $dst,$src\t# subExact int" %} + ins_encode %{ + __ subl($dst$$Register, $src$$Address); + %} + ins_pipe( ialu_reg_mem ); +%} + // Integer Subtraction Instructions instruct subI_eReg(rRegI dst, rRegI src, eFlagsReg cr) %{ match(Set dst (SubI dst src)); @@ -7919,6 +7976,16 @@ instruct negI_eReg(rRegI dst, immI0 zero, eFlagsReg cr) %{ ins_pipe( ialu_reg ); %} +instruct negExactI_eReg(eAXRegI dst, eFlagsReg cr) %{ + match(NegExactI dst); + effect(DEF cr); + + format %{ "NEG $dst\t# negExact int"%} + ins_encode %{ + __ negl($dst$$Register); + %} + ins_pipe(ialu_reg); +%} //----------Multiplication/Division Instructions------------------------------- // Integer Multiplication Instructions @@ -8131,6 +8198,46 @@ instruct mulL_eReg_con(eADXRegL dst, immL_127 src, rRegI tmp, eFlagsReg cr) %{ ins_pipe( pipe_slow ); %} +instruct mulExactI_eReg(eAXRegI dst, rRegI src, eFlagsReg cr) +%{ + match(MulExactI dst src); + effect(DEF cr); + + ins_cost(300); + format %{ "IMUL $dst, $src\t# mulExact int" %} + ins_encode %{ + __ imull($dst$$Register, $src$$Register); + %} + ins_pipe(ialu_reg_reg_alu0); +%} + +instruct mulExactI_eReg_imm(eAXRegI dst, rRegI src, immI imm, eFlagsReg cr) +%{ + match(MulExactI src imm); + effect(DEF cr); + + ins_cost(300); + format %{ "IMUL $dst, $src, $imm\t# mulExact int" %} + ins_encode %{ + __ imull($dst$$Register, $src$$Register, $imm$$constant); + %} + ins_pipe(ialu_reg_reg_alu0); +%} + +instruct mulExactI_eReg_mem(eAXRegI dst, memory src, eFlagsReg cr) +%{ + match(MulExactI dst (LoadI src)); + effect(DEF cr); + + ins_cost(350); + format %{ "IMUL $dst, $src\t# mulExact int" %} + ins_encode %{ + __ imull($dst$$Register, $src$$Address); + %} + ins_pipe(ialu_reg_mem_alu0); +%} + + // Integer DIV with Register instruct divI_eReg(eAXRegI rax, eDXRegI rdx, eCXRegI div, eFlagsReg cr) %{ match(Set rax (DivI rax div)); diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad index 288f606cc15..182a7012ac8 100644 --- a/hotspot/src/cpu/x86/vm/x86_64.ad +++ b/hotspot/src/cpu/x86/vm/x86_64.ad @@ -1653,6 +1653,10 @@ const RegMask Matcher::mathExactI_result_proj_mask() { return INT_RAX_REG_mask(); } +const RegMask Matcher::mathExactL_result_proj_mask() { + return LONG_RAX_REG_mask(); +} + const RegMask Matcher::mathExactI_flags_proj_mask() { return INT_FLAGS_mask(); } @@ -6962,6 +6966,58 @@ instruct addExactI_rReg_imm(rax_RegI dst, immI src, rFlagsReg cr) ins_pipe(ialu_reg_reg); %} +instruct addExactI_rReg_mem(rax_RegI dst, memory src, rFlagsReg cr) +%{ + match(AddExactI dst (LoadI src)); + effect(DEF cr); + + ins_cost(125); // XXX + format %{ "addl $dst, $src\t# addExact int" %} + ins_encode %{ + __ addl($dst$$Register, $src$$Address); + %} + + ins_pipe(ialu_reg_mem); +%} + +instruct addExactL_rReg(rax_RegL dst, rRegL src, rFlagsReg cr) +%{ + match(AddExactL dst src); + effect(DEF cr); + + format %{ "addq $dst, $src\t# addExact long" %} + ins_encode %{ + __ addq($dst$$Register, $src$$Register); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct addExactL_rReg_imm(rax_RegL dst, immL32 src, rFlagsReg cr) +%{ + match(AddExactL dst src); + effect(DEF cr); + + format %{ "addq $dst, $src\t# addExact long" %} + ins_encode %{ + __ addq($dst$$Register, $src$$constant); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct addExactL_rReg_mem(rax_RegL dst, memory src, rFlagsReg cr) +%{ + match(AddExactL dst (LoadL src)); + effect(DEF cr); + + ins_cost(125); // XXX + format %{ "addq $dst, $src\t# addExact long" %} + ins_encode %{ + __ addq($dst$$Register, $src$$Address); + %} + + ins_pipe(ialu_reg_mem); +%} + instruct addI_rReg(rRegI dst, rRegI src, rFlagsReg cr) %{ match(Set dst (AddI dst src)); @@ -7574,6 +7630,80 @@ instruct subI_mem_imm(memory dst, immI src, rFlagsReg cr) ins_pipe(ialu_mem_imm); %} +instruct subExactI_rReg(rax_RegI dst, rRegI src, rFlagsReg cr) +%{ + match(SubExactI dst src); + effect(DEF cr); + + format %{ "subl $dst, $src\t# subExact int" %} + ins_encode %{ + __ subl($dst$$Register, $src$$Register); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct subExactI_rReg_imm(rax_RegI dst, immI src, rFlagsReg cr) +%{ + match(SubExactI dst src); + effect(DEF cr); + + format %{ "subl $dst, $src\t# subExact int" %} + ins_encode %{ + __ subl($dst$$Register, $src$$constant); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct subExactI_rReg_mem(rax_RegI dst, memory src, rFlagsReg cr) +%{ + match(SubExactI dst (LoadI src)); + effect(DEF cr); + + ins_cost(125); + format %{ "subl $dst, $src\t# subExact int" %} + ins_encode %{ + __ subl($dst$$Register, $src$$Address); + %} + ins_pipe(ialu_reg_mem); +%} + +instruct subExactL_rReg(rax_RegL dst, rRegL src, rFlagsReg cr) +%{ + match(SubExactL dst src); + effect(DEF cr); + + format %{ "subq $dst, $src\t# subExact long" %} + ins_encode %{ + __ subq($dst$$Register, $src$$Register); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct subExactL_rReg_imm(rax_RegL dst, immL32 src, rFlagsReg cr) +%{ + match(SubExactL dst (LoadL src)); + effect(DEF cr); + + format %{ "subq $dst, $src\t# subExact long" %} + ins_encode %{ + __ subq($dst$$Register, $src$$constant); + %} + ins_pipe(ialu_reg_reg); +%} + +instruct subExactL_rReg_mem(rax_RegI dst, memory src, rFlagsReg cr) +%{ + match(SubExactI dst src); + effect(DEF cr); + + ins_cost(125); + format %{ "subq $dst, $src\t# subExact long" %} + ins_encode %{ + __ subq($dst$$Register, $src$$Address); + %} + ins_pipe(ialu_reg_mem); +%} + instruct subL_rReg(rRegL dst, rRegL src, rFlagsReg cr) %{ match(Set dst (SubL dst src)); @@ -7690,6 +7820,30 @@ instruct negL_mem(memory dst, immL0 zero, rFlagsReg cr) ins_pipe(ialu_reg); %} +instruct negExactI_rReg(rax_RegI dst, rFlagsReg cr) +%{ + match(NegExactI dst); + effect(KILL cr); + + format %{ "negl $dst\t# negExact int" %} + ins_encode %{ + __ negl($dst$$Register); + %} + ins_pipe(ialu_reg); +%} + +instruct negExactL_rReg(rax_RegL dst, rFlagsReg cr) +%{ + match(NegExactL dst); + effect(KILL cr); + + format %{ "negq $dst\t# negExact long" %} + ins_encode %{ + __ negq($dst$$Register); + %} + ins_pipe(ialu_reg); +%} + //----------Multiplication/Division Instructions------------------------------- // Integer Multiplication Instructions @@ -7807,6 +7961,86 @@ instruct mulHiL_rReg(rdx_RegL dst, no_rax_RegL src, rax_RegL rax, rFlagsReg cr) ins_pipe(ialu_reg_reg_alu0); %} + +instruct mulExactI_rReg(rax_RegI dst, rRegI src, rFlagsReg cr) +%{ + match(MulExactI dst src); + effect(DEF cr); + + ins_cost(300); + format %{ "imull $dst, $src\t# mulExact int" %} + ins_encode %{ + __ imull($dst$$Register, $src$$Register); + %} + ins_pipe(ialu_reg_reg_alu0); +%} + + +instruct mulExactI_rReg_imm(rax_RegI dst, rRegI src, immI imm, rFlagsReg cr) +%{ + match(MulExactI src imm); + effect(DEF cr); + + ins_cost(300); + format %{ "imull $dst, $src, $imm\t# mulExact int" %} + ins_encode %{ + __ imull($dst$$Register, $src$$Register, $imm$$constant); + %} + ins_pipe(ialu_reg_reg_alu0); +%} + +instruct mulExactI_rReg_mem(rax_RegI dst, memory src, rFlagsReg cr) +%{ + match(MulExactI dst (LoadI src)); + effect(DEF cr); + + ins_cost(350); + format %{ "imull $dst, $src\t# mulExact int" %} + ins_encode %{ + __ imull($dst$$Register, $src$$Address); + %} + ins_pipe(ialu_reg_mem_alu0); +%} + +instruct mulExactL_rReg(rax_RegL dst, rRegL src, rFlagsReg cr) +%{ + match(MulExactL dst src); + effect(DEF cr); + + ins_cost(300); + format %{ "imulq $dst, $src\t# mulExact long" %} + ins_encode %{ + __ imulq($dst$$Register, $src$$Register); + %} + ins_pipe(ialu_reg_reg_alu0); +%} + +instruct mulExactL_rReg_imm(rax_RegL dst, rRegL src, immL32 imm, rFlagsReg cr) +%{ + match(MulExactL src imm); + effect(DEF cr); + + ins_cost(300); + format %{ "imulq $dst, $src, $imm\t# mulExact long" %} + ins_encode %{ + __ imulq($dst$$Register, $src$$Register, $imm$$constant); + %} + ins_pipe(ialu_reg_reg_alu0); +%} + +instruct mulExactL_rReg_mem(rax_RegL dst, memory src, rFlagsReg cr) +%{ + match(MulExactL dst (LoadL src)); + effect(DEF cr); + + ins_cost(350); + format %{ "imulq $dst, $src\t# mulExact long" %} + ins_encode %{ + __ imulq($dst$$Register, $src$$Address); + %} + ins_pipe(ialu_reg_mem_alu0); +%} + instruct divI_rReg(rax_RegI rax, rdx_RegI rdx, no_rax_rdx_RegI div, rFlagsReg cr) %{ diff --git a/hotspot/src/share/vm/adlc/archDesc.cpp b/hotspot/src/share/vm/adlc/archDesc.cpp index 9447af252fc..fd60e25acb7 100644 --- a/hotspot/src/share/vm/adlc/archDesc.cpp +++ b/hotspot/src/share/vm/adlc/archDesc.cpp @@ -1193,6 +1193,13 @@ void ArchDesc::buildMustCloneMap(FILE *fp_hpp, FILE *fp_cpp) { || strcmp(idealName,"FastLock") == 0 || strcmp(idealName,"FastUnlock") == 0 || strcmp(idealName,"AddExactI") == 0 + || strcmp(idealName,"AddExactL") == 0 + || strcmp(idealName,"SubExactI") == 0 + || strcmp(idealName,"SubExactL") == 0 + || strcmp(idealName,"MulExactI") == 0 + || strcmp(idealName,"MulExactL") == 0 + || strcmp(idealName,"NegExactI") == 0 + || strcmp(idealName,"NegExactL") == 0 || strcmp(idealName,"FlagsProj") == 0 || strcmp(idealName,"Bool") == 0 || strcmp(idealName,"Binary") == 0 ) { diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index fe966e89eeb..8ff789f81e5 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -624,6 +624,7 @@ do_class(java_lang_StrictMath, "java/lang/StrictMath") \ do_signature(double2_double_signature, "(DD)D") \ do_signature(int2_int_signature, "(II)I") \ + do_signature(long2_long_signature, "(JJ)J") \ \ /* here are the math names, all together: */ \ do_name(abs_name,"abs") do_name(sin_name,"sin") do_name(cos_name,"cos") \ @@ -632,8 +633,11 @@ do_name(exp_name,"exp") do_name(min_name,"min") do_name(max_name,"max") \ \ do_name(addExact_name,"addExact") \ - do_name(subtractExact_name,"subtractExact") \ + do_name(decrementExact_name,"decrementExact") \ + do_name(incrementExact_name,"incrementExact") \ do_name(multiplyExact_name,"multiplyExact") \ + do_name(negateExact_name,"negateExact") \ + do_name(subtractExact_name,"subtractExact") \ \ do_intrinsic(_dabs, java_lang_Math, abs_name, double_double_signature, F_S) \ do_intrinsic(_dsin, java_lang_Math, sin_name, double_double_signature, F_S) \ @@ -647,7 +651,18 @@ do_intrinsic(_dexp, java_lang_Math, exp_name, double_double_signature, F_S) \ do_intrinsic(_min, java_lang_Math, min_name, int2_int_signature, F_S) \ do_intrinsic(_max, java_lang_Math, max_name, int2_int_signature, F_S) \ - do_intrinsic(_addExact, java_lang_Math, addExact_name, int2_int_signature, F_S) \ + do_intrinsic(_addExactI, java_lang_Math, addExact_name, int2_int_signature, F_S) \ + do_intrinsic(_addExactL, java_lang_Math, addExact_name, long2_long_signature, F_S) \ + do_intrinsic(_decrementExactI, java_lang_Math, decrementExact_name, int_int_signature, F_S) \ + do_intrinsic(_decrementExactL, java_lang_Math, decrementExact_name, long2_long_signature, F_S) \ + do_intrinsic(_incrementExactI, java_lang_Math, incrementExact_name, int_int_signature, F_S) \ + do_intrinsic(_incrementExactL, java_lang_Math, incrementExact_name, long2_long_signature, F_S) \ + do_intrinsic(_multiplyExactI, java_lang_Math, multiplyExact_name, int2_int_signature, F_S) \ + do_intrinsic(_multiplyExactL, java_lang_Math, multiplyExact_name, long2_long_signature, F_S) \ + do_intrinsic(_negateExactI, java_lang_Math, negateExact_name, int_int_signature, F_S) \ + do_intrinsic(_negateExactL, java_lang_Math, negateExact_name, long_long_signature, F_S) \ + do_intrinsic(_subtractExactI, java_lang_Math, subtractExact_name, int2_int_signature, F_S) \ + do_intrinsic(_subtractExactL, java_lang_Math, subtractExact_name, long2_long_signature, F_S) \ \ do_intrinsic(_floatToRawIntBits, java_lang_Float, floatToRawIntBits_name, float_int_signature, F_S) \ do_name( floatToRawIntBits_name, "floatToRawIntBits") \ diff --git a/hotspot/src/share/vm/opto/classes.hpp b/hotspot/src/share/vm/opto/classes.hpp index 3217c4fb492..002d2db636d 100644 --- a/hotspot/src/share/vm/opto/classes.hpp +++ b/hotspot/src/share/vm/opto/classes.hpp @@ -30,6 +30,7 @@ macro(AbsF) macro(AbsI) macro(AddD) macro(AddExactI) +macro(AddExactL) macro(AddF) macro(AddI) macro(AddL) @@ -170,6 +171,8 @@ macro(LoopLimit) macro(Mach) macro(MachProj) macro(MathExact) +macro(MathExactI) +macro(MathExactL) macro(MaxI) macro(MemBarAcquire) macro(MemBarAcquireLock) @@ -189,12 +192,16 @@ macro(MoveF2I) macro(MoveL2D) macro(MoveD2L) macro(MulD) +macro(MulExactI) +macro(MulExactL) macro(MulF) macro(MulHiL) macro(MulI) macro(MulL) macro(Multi) macro(NegD) +macro(NegExactI) +macro(NegExactL) macro(NegF) macro(NeverBranch) macro(Opaque1) @@ -244,6 +251,8 @@ macro(StrComp) macro(StrEquals) macro(StrIndexOf) macro(SubD) +macro(SubExactI) +macro(SubExactL) macro(SubF) macro(SubI) macro(SubL) diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 73809613a04..6a7ee628844 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -203,8 +203,15 @@ class LibraryCallKit : public GraphKit { bool inline_math_native(vmIntrinsics::ID id); bool inline_trig(vmIntrinsics::ID id); bool inline_math(vmIntrinsics::ID id); - bool inline_math_mathExact(Node* math); - bool inline_math_addExact(); + void inline_math_mathExact(Node* math); + bool inline_math_addExactI(bool is_increment); + bool inline_math_addExactL(bool is_increment); + bool inline_math_multiplyExactI(); + bool inline_math_multiplyExactL(); + bool inline_math_negateExactI(); + bool inline_math_negateExactL(); + bool inline_math_subtractExactI(bool is_decrement); + bool inline_math_subtractExactL(bool is_decrement); bool inline_exp(); bool inline_pow(); void finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName); @@ -507,13 +514,33 @@ CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) { if (!UseCRC32Intrinsics) return NULL; break; - case vmIntrinsics::_addExact: - if (!Matcher::match_rule_supported(Op_AddExactI)) { - return NULL; - } - if (!UseMathExactIntrinsics) { - return NULL; - } + case vmIntrinsics::_incrementExactI: + case vmIntrinsics::_addExactI: + if (!Matcher::match_rule_supported(Op_AddExactI) || !UseMathExactIntrinsics) return NULL; + break; + case vmIntrinsics::_incrementExactL: + case vmIntrinsics::_addExactL: + if (!Matcher::match_rule_supported(Op_AddExactL) || !UseMathExactIntrinsics) return NULL; + break; + case vmIntrinsics::_decrementExactI: + case vmIntrinsics::_subtractExactI: + if (!Matcher::match_rule_supported(Op_SubExactI) || !UseMathExactIntrinsics) return NULL; + break; + case vmIntrinsics::_decrementExactL: + case vmIntrinsics::_subtractExactL: + if (!Matcher::match_rule_supported(Op_SubExactL) || !UseMathExactIntrinsics) return NULL; + break; + case vmIntrinsics::_negateExactI: + if (!Matcher::match_rule_supported(Op_NegExactI) || !UseMathExactIntrinsics) return NULL; + break; + case vmIntrinsics::_negateExactL: + if (!Matcher::match_rule_supported(Op_NegExactL) || !UseMathExactIntrinsics) return NULL; + break; + case vmIntrinsics::_multiplyExactI: + if (!Matcher::match_rule_supported(Op_MulExactI) || !UseMathExactIntrinsics) return NULL; + break; + case vmIntrinsics::_multiplyExactL: + if (!Matcher::match_rule_supported(Op_MulExactL) || !UseMathExactIntrinsics) return NULL; break; default: @@ -686,7 +713,18 @@ bool LibraryCallKit::try_to_inline() { case vmIntrinsics::_min: case vmIntrinsics::_max: return inline_min_max(intrinsic_id()); - case vmIntrinsics::_addExact: return inline_math_addExact(); + case vmIntrinsics::_addExactI: return inline_math_addExactI(false /* add */); + case vmIntrinsics::_addExactL: return inline_math_addExactL(false /* add */); + case vmIntrinsics::_decrementExactI: return inline_math_subtractExactI(true /* decrement */); + case vmIntrinsics::_decrementExactL: return inline_math_subtractExactL(true /* decrement */); + case vmIntrinsics::_incrementExactI: return inline_math_addExactI(true /* increment */); + case vmIntrinsics::_incrementExactL: return inline_math_addExactL(true /* increment */); + case vmIntrinsics::_multiplyExactI: return inline_math_multiplyExactI(); + case vmIntrinsics::_multiplyExactL: return inline_math_multiplyExactL(); + case vmIntrinsics::_negateExactI: return inline_math_negateExactI(); + case vmIntrinsics::_negateExactL: return inline_math_negateExactL(); + case vmIntrinsics::_subtractExactI: return inline_math_subtractExactI(false /* subtract */); + case vmIntrinsics::_subtractExactL: return inline_math_subtractExactL(false /* subtract */); case vmIntrinsics::_arraycopy: return inline_arraycopy(); @@ -1931,7 +1969,14 @@ bool LibraryCallKit::inline_min_max(vmIntrinsics::ID id) { return true; } -bool LibraryCallKit::inline_math_mathExact(Node* math) { +void LibraryCallKit::inline_math_mathExact(Node* math) { + // If we didn't get the expected opcode it means we have optimized + // the node to something else and don't need the exception edge. + if (!math->is_MathExact()) { + set_result(math); + return; + } + Node* result = _gvn.transform( new(C) ProjNode(math, MathExactNode::result_proj_node)); Node* flags = _gvn.transform( new(C) FlagsProjNode(math, MathExactNode::flags_proj_node)); @@ -1954,19 +1999,106 @@ bool LibraryCallKit::inline_math_mathExact(Node* math) { set_control(fast_path); set_result(result); +} + +bool LibraryCallKit::inline_math_addExactI(bool is_increment) { + Node* arg1 = argument(0); + Node* arg2 = NULL; + + if (is_increment) { + arg2 = intcon(1); + } else { + arg2 = argument(1); + } + + Node* add = _gvn.transform( new(C) AddExactINode(NULL, arg1, arg2) ); + inline_math_mathExact(add); return true; } -bool LibraryCallKit::inline_math_addExact() { +bool LibraryCallKit::inline_math_addExactL(bool is_increment) { + Node* arg1 = argument(0); // type long + // argument(1) == TOP + Node* arg2 = NULL; + + if (is_increment) { + arg2 = longcon(1); + } else { + arg2 = argument(2); // type long + // argument(3) == TOP + } + + Node* add = _gvn.transform(new(C) AddExactLNode(NULL, arg1, arg2)); + inline_math_mathExact(add); + return true; +} + +bool LibraryCallKit::inline_math_subtractExactI(bool is_decrement) { + Node* arg1 = argument(0); + Node* arg2 = NULL; + + if (is_decrement) { + arg2 = intcon(1); + } else { + arg2 = argument(1); + } + + Node* sub = _gvn.transform(new(C) SubExactINode(NULL, arg1, arg2)); + inline_math_mathExact(sub); + return true; +} + +bool LibraryCallKit::inline_math_subtractExactL(bool is_decrement) { + Node* arg1 = argument(0); // type long + // argument(1) == TOP + Node* arg2 = NULL; + + if (is_decrement) { + arg2 = longcon(1); + } else { + Node* arg2 = argument(2); // type long + // argument(3) == TOP + } + + Node* sub = _gvn.transform(new(C) SubExactLNode(NULL, arg1, arg2)); + inline_math_mathExact(sub); + return true; +} + +bool LibraryCallKit::inline_math_negateExactI() { + Node* arg1 = argument(0); + + Node* neg = _gvn.transform(new(C) NegExactINode(NULL, arg1)); + inline_math_mathExact(neg); + return true; +} + +bool LibraryCallKit::inline_math_negateExactL() { + Node* arg1 = argument(0); + // argument(1) == TOP + + Node* neg = _gvn.transform(new(C) NegExactLNode(NULL, arg1)); + inline_math_mathExact(neg); + return true; +} + +bool LibraryCallKit::inline_math_multiplyExactI() { Node* arg1 = argument(0); Node* arg2 = argument(1); - Node* add = _gvn.transform( new(C) AddExactINode(NULL, arg1, arg2) ); - if (add->Opcode() == Op_AddExactI) { - return inline_math_mathExact(add); - } else { - set_result(add); - } + Node* mul = _gvn.transform(new(C) MulExactINode(NULL, arg1, arg2)); + inline_math_mathExact(mul); + return true; +} + +bool LibraryCallKit::inline_math_multiplyExactL() { + Node* arg1 = argument(0); + // argument(1) == TOP + Node* arg2 = argument(2); + // argument(3) == TOP + + Node* mul = _gvn.transform(new(C) MulExactLNode(NULL, arg1, arg2)); + inline_math_mathExact(mul); return true; } diff --git a/hotspot/src/share/vm/opto/matcher.hpp b/hotspot/src/share/vm/opto/matcher.hpp index 23ad64d2b83..1131d09f1d5 100644 --- a/hotspot/src/share/vm/opto/matcher.hpp +++ b/hotspot/src/share/vm/opto/matcher.hpp @@ -338,6 +338,7 @@ public: static RegMask modL_proj_mask(); static const RegMask mathExactI_result_proj_mask(); + static const RegMask mathExactL_result_proj_mask(); static const RegMask mathExactI_flags_proj_mask(); // Use hardware DIV instruction when it is faster than diff --git a/hotspot/src/share/vm/opto/mathexactnode.cpp b/hotspot/src/share/vm/opto/mathexactnode.cpp index 7e68daf8ca5..bb930b37d52 100644 --- a/hotspot/src/share/vm/opto/mathexactnode.cpp +++ b/hotspot/src/share/vm/opto/mathexactnode.cpp @@ -31,10 +31,17 @@ #include "opto/mathexactnode.hpp" #include "opto/subnode.hpp" -MathExactNode::MathExactNode(Node* ctrl, Node* n1, Node* n2) : MultiNode(3) { +MathExactNode::MathExactNode(Node* ctrl, Node* in1) : MultiNode(2) { + init_class_id(Class_MathExact); init_req(0, ctrl); - init_req(1, n1); - init_req(2, n2); + init_req(1, in1); +} + +MathExactNode::MathExactNode(Node* ctrl, Node* in1, Node* in2) : MultiNode(3) { + init_class_id(Class_MathExact); + init_req(0, ctrl); + init_req(1, in1); + init_req(2, in2); } BoolNode* MathExactNode::bool_node() const { @@ -64,23 +71,10 @@ Node* MathExactNode::non_throwing_branch() const { return ifnode->proj_out(1); } -Node* AddExactINode::match(const ProjNode* proj, const Matcher* m) { - uint ideal_reg = proj->ideal_reg(); - RegMask rm; - if (proj->_con == result_proj_node) { - rm = m->mathExactI_result_proj_mask(); - } else { - assert(proj->_con == flags_proj_node, "must be result or flags"); - assert(ideal_reg == Op_RegFlags, "sanity"); - rm = m->mathExactI_flags_proj_mask(); - } - return new (m->C) MachProjNode(this, proj->_con, rm, ideal_reg); -} - // If the MathExactNode won't overflow we have to replace the // FlagsProjNode and ProjNode that is generated by the MathExactNode -Node* MathExactNode::no_overflow(PhaseGVN *phase, Node* new_result) { - PhaseIterGVN *igvn = phase->is_IterGVN(); +Node* MathExactNode::no_overflow(PhaseGVN* phase, Node* new_result) { + PhaseIterGVN* igvn = phase->is_IterGVN(); if (igvn) { ProjNode* result = result_node(); ProjNode* flags = flags_node(); @@ -110,9 +104,35 @@ Node* MathExactNode::no_overflow(PhaseGVN *phase, Node* new_result) { return new_result; } -Node *AddExactINode::Ideal(PhaseGVN *phase, bool can_reshape) { - Node *arg1 = in(1); - Node *arg2 = in(2); +Node* MathExactINode::match(const ProjNode* proj, const Matcher* m) { + uint ideal_reg = proj->ideal_reg(); + RegMask rm; + if (proj->_con == result_proj_node) { + rm = m->mathExactI_result_proj_mask(); + } else { + assert(proj->_con == flags_proj_node, "must be result or flags"); + assert(ideal_reg == Op_RegFlags, "sanity"); + rm = m->mathExactI_flags_proj_mask(); + } + return new (m->C) MachProjNode(this, proj->_con, rm, ideal_reg); +} + +Node* MathExactLNode::match(const ProjNode* proj, const Matcher* m) { + uint ideal_reg = proj->ideal_reg(); + RegMask rm; + if (proj->_con == result_proj_node) { + rm = m->mathExactL_result_proj_mask(); + } else { + assert(proj->_con == flags_proj_node, "must be result or flags"); + assert(ideal_reg == Op_RegFlags, "sanity"); + rm = m->mathExactI_flags_proj_mask(); + } + return new (m->C) MachProjNode(this, proj->_con, rm, ideal_reg); +} + +Node* AddExactINode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node* arg1 = in(1); + Node* arg2 = in(2); const Type* type1 = phase->type(arg1); const Type* type2 = phase->type(arg2); @@ -130,12 +150,7 @@ Node *AddExactINode::Ideal(PhaseGVN *phase, bool can_reshape) { return NULL; } - if (type1 == TypeInt::ZERO) { // (Add 0 x) == x - Node* add_result = new (phase->C) AddINode(arg1, arg2); - return no_overflow(phase, add_result); - } - - if (type2 == TypeInt::ZERO) { // (Add x 0) == x + if (type1 == TypeInt::ZERO || type2 == TypeInt::ZERO) { // (Add 0 x) == x Node* add_result = new (phase->C) AddINode(arg1, arg2); return no_overflow(phase, add_result); } @@ -169,3 +184,247 @@ Node *AddExactINode::Ideal(PhaseGVN *phase, bool can_reshape) { return NULL; } +Node* AddExactLNode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node* arg1 = in(1); + Node* arg2 = in(2); + + const Type* type1 = phase->type(arg1); + const Type* type2 = phase->type(arg2); + + if (type1 != Type::TOP && type1->singleton() && + type2 != Type::TOP && type2->singleton()) { + jlong val1 = arg1->get_long(); + jlong val2 = arg2->get_long(); + jlong result = val1 + val2; + // Hacker's Delight 2-12 Overflow if both arguments have the opposite sign of the result + if ( (((val1 ^ result) & (val2 ^ result)) >= 0)) { + Node* con_result = ConLNode::make(phase->C, result); + return no_overflow(phase, con_result); + } + return NULL; + } + + if (type1 == TypeLong::ZERO || type2 == TypeLong::ZERO) { // (Add 0 x) == x + Node* add_result = new (phase->C) AddLNode(arg1, arg2); + return no_overflow(phase, add_result); + } + + if (type2->singleton()) { + return NULL; // no change - keep constant on the right + } + + if (type1->singleton()) { + // Make it x + Constant - move constant to the right + swap_edges(1, 2); + return this; + } + + if (arg2->is_Load()) { + return NULL; // no change - keep load on the right + } + + if (arg1->is_Load()) { + // Make it x + Load - move load to the right + swap_edges(1, 2); + return this; + } + + if (arg1->_idx > arg2->_idx) { + // Sort the edges + swap_edges(1, 2); + return this; + } + + return NULL; +} + +Node* SubExactINode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node* arg1 = in(1); + Node* arg2 = in(2); + + const Type* type1 = phase->type(arg1); + const Type* type2 = phase->type(arg2); + + if (type1 != Type::TOP && type1->singleton() && + type2 != Type::TOP && type2->singleton()) { + jint val1 = arg1->get_int(); + jint val2 = arg2->get_int(); + jint result = val1 - val2; + + // Hacker's Delight 2-12 Overflow iff the arguments have different signs and + // the sign of the result is different than the sign of arg1 + if (((val1 ^ val2) & (val1 ^ result)) >= 0) { + Node* con_result = ConINode::make(phase->C, result); + return no_overflow(phase, con_result); + } + return NULL; + } + + if (type1 == TypeInt::ZERO || type2 == TypeInt::ZERO) { + // Sub with zero is the same as add with zero + Node* add_result = new (phase->C) AddINode(arg1, arg2); + return no_overflow(phase, add_result); + } + + return NULL; +} + +Node* SubExactLNode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node* arg1 = in(1); + Node* arg2 = in(2); + + const Type* type1 = phase->type(arg1); + const Type* type2 = phase->type(arg2); + + if (type1 != Type::TOP && type1->singleton() && + type2 != Type::TOP && type2->singleton()) { + jlong val1 = arg1->get_long(); + jlong val2 = arg2->get_long(); + jlong result = val1 - val2; + + // Hacker's Delight 2-12 Overflow iff the arguments have different signs and + // the sign of the result is different than the sign of arg1 + if (((val1 ^ val2) & (val1 ^ result)) >= 0) { + Node* con_result = ConLNode::make(phase->C, result); + return no_overflow(phase, con_result); + } + return NULL; + } + + if (type1 == TypeLong::ZERO || type2 == TypeLong::ZERO) { + // Sub with zero is the same as add with zero + Node* add_result = new (phase->C) AddLNode(arg1, arg2); + return no_overflow(phase, add_result); + } + + return NULL; +} + +Node* NegExactINode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node *arg = in(1); + + const Type* type = phase->type(arg); + if (type != Type::TOP && type->singleton()) { + jint value = arg->get_int(); + if (value != min_jint) { + Node* neg_result = ConINode::make(phase->C, -value); + return no_overflow(phase, neg_result); + } + } + return NULL; +} + +Node* NegExactLNode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node *arg = in(1); + + const Type* type = phase->type(arg); + if (type != Type::TOP && type->singleton()) { + jlong value = arg->get_long(); + if (value != min_jlong) { + Node* neg_result = ConLNode::make(phase->C, -value); + return no_overflow(phase, neg_result); + } + } + return NULL; +} + +Node* MulExactINode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node* arg1 = in(1); + Node* arg2 = in(2); + + const Type* type1 = phase->type(arg1); + const Type* type2 = phase->type(arg2); + + if (type1 != Type::TOP && type1->singleton() && + type2 != Type::TOP && type2->singleton()) { + jint val1 = arg1->get_int(); + jint val2 = arg2->get_int(); + jlong result = (jlong) val1 * (jlong) val2; + if ((jint) result == result) { + // no overflow + Node* mul_result = ConINode::make(phase->C, result); + return no_overflow(phase, mul_result); + } + } + + if (type1 == TypeInt::ZERO || type2 == TypeInt::ZERO) { + return no_overflow(phase, ConINode::make(phase->C, 0)); + } + + if (type1 == TypeInt::ONE) { + Node* mul_result = new (phase->C) AddINode(arg2, phase->intcon(0)); + return no_overflow(phase, mul_result); + } + if (type2 == TypeInt::ONE) { + Node* mul_result = new (phase->C) AddINode(arg1, phase->intcon(0)); + return no_overflow(phase, mul_result); + } + + if (type1 == TypeInt::MINUS_1) { + return new (phase->C) NegExactINode(NULL, arg2); + } + + if (type2 == TypeInt::MINUS_1) { + return new (phase->C) NegExactINode(NULL, arg1); + } + + return NULL; +} + +Node* MulExactLNode::Ideal(PhaseGVN* phase, bool can_reshape) { + Node* arg1 = in(1); + Node* arg2 = in(2); + + const Type* type1 = phase->type(arg1); + const Type* type2 = phase->type(arg2); + + if (type1 != Type::TOP && type1->singleton() && + type2 != Type::TOP && type2->singleton()) { + jlong val1 = arg1->get_long(); + jlong val2 = arg2->get_long(); + + jlong result = val1 * val2; + jlong ax = (val1 < 0 ? -val1 : val1); + jlong ay = (val2 < 0 ? -val2 : val2); + + bool overflow = false; + if ((ax | ay) & CONST64(0xFFFFFFFF00000000)) { + // potential overflow if any bit in upper 32 bits are set + if ((val1 == min_jlong && val2 == -1) || (val2 == min_jlong && val1 == -1)) { + // -1 * Long.MIN_VALUE will overflow + overflow = true; + } else if (val2 != 0 && (result / val2 != val1)) { + overflow = true; + } + } + + if (!overflow) { + Node* mul_result = ConLNode::make(phase->C, result); + return no_overflow(phase, mul_result); + } + } + + if (type1 == TypeLong::ZERO || type2 == TypeLong::ZERO) { + return no_overflow(phase, ConLNode::make(phase->C, 0)); + } + + if (type1 == TypeLong::ONE) { + Node* mul_result = new (phase->C) AddLNode(arg2, phase->longcon(0)); + return no_overflow(phase, mul_result); + } + if (type2 == TypeLong::ONE) { + Node* mul_result = new (phase->C) AddLNode(arg1, phase->longcon(0)); + return no_overflow(phase, mul_result); + } + + if (type1 == TypeLong::MINUS_1) { + return new (phase->C) NegExactLNode(NULL, arg2); + } + + if (type2 == TypeLong::MINUS_1) { + return new (phase->C) NegExactLNode(NULL, arg1); + } + + return NULL; +} + diff --git a/hotspot/src/share/vm/opto/mathexactnode.hpp b/hotspot/src/share/vm/opto/mathexactnode.hpp index b58482a1092..59983e10bcd 100644 --- a/hotspot/src/share/vm/opto/mathexactnode.hpp +++ b/hotspot/src/share/vm/opto/mathexactnode.hpp @@ -39,6 +39,7 @@ class PhaseTransform; class MathExactNode : public MultiNode { public: + MathExactNode(Node* ctrl, Node* in1); MathExactNode(Node* ctrl, Node* in1, Node* in2); enum { result_proj_node = 0, @@ -62,15 +63,80 @@ protected: Node* no_overflow(PhaseGVN *phase, Node* new_result); }; -class AddExactINode : public MathExactNode { -public: - AddExactINode(Node* ctrl, Node* in1, Node* in2) : MathExactNode(ctrl, in1, in2) {} +class MathExactINode : public MathExactNode { + public: + MathExactINode(Node* ctrl, Node* in1) : MathExactNode(ctrl, in1) {} + MathExactINode(Node* ctrl, Node* in1, Node* in2) : MathExactNode(ctrl, in1, in2) {} virtual int Opcode() const; - virtual const Type* bottom_type() const { return TypeTuple::INT_CC_PAIR; } virtual Node* match(const ProjNode* proj, const Matcher* m); + virtual const Type* bottom_type() const { return TypeTuple::INT_CC_PAIR; } +}; + +class MathExactLNode : public MathExactNode { +public: + MathExactLNode(Node* ctrl, Node* in1) : MathExactNode(ctrl, in1) {} + MathExactLNode(Node* ctrl, Node* in1, Node* in2) : MathExactNode(ctrl, in1, in2) {} + virtual int Opcode() const; + virtual Node* match(const ProjNode* proj, const Matcher* m); + virtual const Type* bottom_type() const { return TypeTuple::LONG_CC_PAIR; } +}; + +class AddExactINode : public MathExactINode { +public: + AddExactINode(Node* ctrl, Node* in1, Node* in2) : MathExactINode(ctrl, in1, in2) {} + virtual int Opcode() const; virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); }; +class AddExactLNode : public MathExactLNode { +public: + AddExactLNode(Node* ctrl, Node* in1, Node* in2) : MathExactLNode(ctrl, in1, in2) {} + virtual int Opcode() const; + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); +}; + +class SubExactINode : public MathExactINode { +public: + SubExactINode(Node* ctrl, Node* in1, Node* in2) : MathExactINode(ctrl, in1, in2) {} + virtual int Opcode() const; + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); +}; + +class SubExactLNode : public MathExactLNode { +public: + SubExactLNode(Node* ctrl, Node* in1, Node* in2) : MathExactLNode(ctrl, in1, in2) {} + virtual int Opcode() const; + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); +}; + +class NegExactINode : public MathExactINode { +public: + NegExactINode(Node* ctrl, Node* in1) : MathExactINode(ctrl, in1) {} + virtual int Opcode() const; + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); +}; + +class NegExactLNode : public MathExactLNode { +public: + NegExactLNode(Node* ctrl, Node* in1) : MathExactLNode(ctrl, in1) {} + virtual int Opcode() const; + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); +}; + +class MulExactINode : public MathExactINode { +public: + MulExactINode(Node* ctrl, Node* in1, Node* in2) : MathExactINode(ctrl, in1, in2) {} + virtual int Opcode() const; + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); +}; + +class MulExactLNode : public MathExactLNode { +public: + MulExactLNode(Node* ctrl, Node* in1, Node* in2) : MathExactLNode(ctrl, in1, in2) {} + virtual int Opcode() const; + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); +}; + class FlagsProjNode : public ProjNode { public: FlagsProjNode(Node* src, uint con) : ProjNode(src, con) { diff --git a/hotspot/src/share/vm/opto/node.hpp b/hotspot/src/share/vm/opto/node.hpp index 0e58abc8518..924db1b37f9 100644 --- a/hotspot/src/share/vm/opto/node.hpp +++ b/hotspot/src/share/vm/opto/node.hpp @@ -100,6 +100,7 @@ class MachSafePointNode; class MachSpillCopyNode; class MachTempNode; class Matcher; +class MathExactNode; class MemBarNode; class MemBarStoreStoreNode; class MemNode; @@ -568,6 +569,7 @@ public: DEFINE_CLASS_ID(MemBar, Multi, 3) DEFINE_CLASS_ID(Initialize, MemBar, 0) DEFINE_CLASS_ID(MemBarStoreStore, MemBar, 1) + DEFINE_CLASS_ID(MathExact, Multi, 4) DEFINE_CLASS_ID(Mach, Node, 1) DEFINE_CLASS_ID(MachReturn, Mach, 0) @@ -757,6 +759,7 @@ public: DEFINE_CLASS_QUERY(MachSafePoint) DEFINE_CLASS_QUERY(MachSpillCopy) DEFINE_CLASS_QUERY(MachTemp) + DEFINE_CLASS_QUERY(MathExact) DEFINE_CLASS_QUERY(Mem) DEFINE_CLASS_QUERY(MemBar) DEFINE_CLASS_QUERY(MemBarStoreStore) diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index 3dd4bc9e059..faf1555161f 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -435,6 +435,11 @@ void Type::Initialize_shared(Compile* current) { intccpair[1] = TypeInt::CC; TypeTuple::INT_CC_PAIR = TypeTuple::make(2, intccpair); + const Type **longccpair = TypeTuple::fields(2); + longccpair[0] = TypeLong::LONG; + longccpair[1] = TypeInt::CC; + TypeTuple::LONG_CC_PAIR = TypeTuple::make(2, longccpair); + _const_basic_type[T_NARROWOOP] = TypeNarrowOop::BOTTOM; _const_basic_type[T_NARROWKLASS] = Type::BOTTOM; _const_basic_type[T_BOOLEAN] = TypeInt::BOOL; @@ -1675,6 +1680,7 @@ const TypeTuple *TypeTuple::START_I2C; const TypeTuple *TypeTuple::INT_PAIR; const TypeTuple *TypeTuple::LONG_PAIR; const TypeTuple *TypeTuple::INT_CC_PAIR; +const TypeTuple *TypeTuple::LONG_CC_PAIR; //------------------------------make------------------------------------------- diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp index 8c7f14e0dd3..e72baa96b1d 100644 --- a/hotspot/src/share/vm/opto/type.hpp +++ b/hotspot/src/share/vm/opto/type.hpp @@ -593,6 +593,7 @@ public: static const TypeTuple *INT_PAIR; static const TypeTuple *LONG_PAIR; static const TypeTuple *INT_CC_PAIR; + static const TypeTuple *LONG_CC_PAIR; #ifndef PRODUCT virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping #endif diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index ba70ec1933a..7dd50f8e9ea 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -1938,7 +1938,13 @@ typedef BinaryTreeDictionary MetablockTreeDictionary; declare_c2_type(CmpDNode, CmpNode) \ declare_c2_type(CmpD3Node, CmpDNode) \ declare_c2_type(MathExactNode, MultiNode) \ - declare_c2_type(AddExactINode, MathExactNode) \ + declare_c2_type(MathExactINode, MathExactNode) \ + declare_c2_type(AddExactINode, MathExactINode) \ + declare_c2_type(AddExactLNode, MathExactLNode) \ + declare_c2_type(SubExactINode, MathExactINode) \ + declare_c2_type(SubExactLNode, MathExactLNode) \ + declare_c2_type(NegExactINode, MathExactINode) \ + declare_c2_type(MulExactINode, MathExactINode) \ declare_c2_type(FlagsProjNode, ProjNode) \ declare_c2_type(BoolNode, Node) \ declare_c2_type(AbsNode, Node) \ diff --git a/hotspot/test/compiler/intrinsics/mathexact/CondTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactICondTest.java similarity index 93% rename from hotspot/test/compiler/intrinsics/mathexact/CondTest.java rename to hotspot/test/compiler/intrinsics/mathexact/AddExactICondTest.java index a6507cf052f..8862160d8b4 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/CondTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactICondTest.java @@ -25,14 +25,12 @@ * @test * @bug 8024924 * @summary Test non constant addExact - * @compile CondTest.java Verify.java - * @run main CondTest + * @compile AddExactICondTest.java + * @run main AddExactICondTest * */ -import java.lang.ArithmeticException; - -public class CondTest { +public class AddExactICondTest { public static int result = 0; public static void main(String[] args) { diff --git a/hotspot/test/compiler/intrinsics/mathexact/ConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java similarity index 69% rename from hotspot/test/compiler/intrinsics/mathexact/ConstantTest.java rename to hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java index b7bf93f66ec..77000a1d958 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/ConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java @@ -25,23 +25,13 @@ * @test * @bug 8024924 * @summary Test constant addExact - * @compile ConstantTest.java Verify.java - * @run main ConstantTest + * @compile AddExactIConstantTest.java Verify.java + * @run main AddExactIConstantTest * */ -import java.lang.ArithmeticException; - -public class ConstantTest { +public class AddExactIConstantTest { public static void main(String[] args) { - for (int i = 0; i < 50000; ++i) { - Verify.verify(5, 7); - Verify.verify(Integer.MAX_VALUE, 1); - Verify.verify(Integer.MIN_VALUE, -1); - Verify.verify(Integer.MAX_VALUE, -1); - Verify.verify(Integer.MIN_VALUE, 1); - Verify.verify(Integer.MAX_VALUE / 2, Integer.MAX_VALUE / 2); - Verify.verify(Integer.MAX_VALUE / 2, (Integer.MAX_VALUE / 2) + 3); - } + Verify.ConstantTest.verify(new Verify.AddExactI()); } } diff --git a/hotspot/test/compiler/intrinsics/mathexact/NonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java similarity index 70% rename from hotspot/test/compiler/intrinsics/mathexact/NonConstantTest.java rename to hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java index 78c9f9d99e2..2d96bb8b8a6 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java @@ -25,24 +25,14 @@ * @test * @bug 8024924 * @summary Test non constant addExact - * @compile NonConstantTest.java Verify.java - * @run main NonConstantTest + * @compile AddExactILoadTest.java Verify.java + * @run main AddExactILoadTest * */ -import java.lang.ArithmeticException; - -public class NonConstantTest { - public static java.util.Random rnd = new java.util.Random(); - +public class AddExactILoadTest { public static void main(String[] args) { - for (int i = 0; i < 50000; ++i) { - int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt(); - Verify.verify(rnd1, rnd2); - Verify.verify(rnd1, rnd2 + 1); - Verify.verify(rnd1 + 1, rnd2); - Verify.verify(rnd1 - 1, rnd2); - Verify.verify(rnd1, rnd2 - 1); - } + Verify.LoadTest.init(); + Verify.LoadTest.verify(new Verify.AddExactI()); } } diff --git a/hotspot/test/compiler/intrinsics/mathexact/LoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java similarity index 68% rename from hotspot/test/compiler/intrinsics/mathexact/LoopDependentTest.java rename to hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java index 17f58921f28..99aae0d7b21 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/LoopDependentTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java @@ -25,24 +25,13 @@ * @test * @bug 8024924 * @summary Test non constant addExact - * @compile LoopDependentTest.java Verify.java - * @run main LoopDependentTest + * @compile AddExactILoopDependentTest.java Verify.java + * @run main AddExactILoopDependentTest * */ -import java.lang.ArithmeticException; - -public class LoopDependentTest { - public static java.util.Random rnd = new java.util.Random(); - +public class AddExactILoopDependentTest { public static void main(String[] args) { - int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt(); - for (int i = 0; i < 50000; ++i) { - Verify.verify(rnd1 + i, rnd2 + i); - Verify.verify(rnd1 + i, rnd2 + (i & 0xff)); - Verify.verify(rnd1 - i, rnd2 - (i & 0xff)); - Verify.verify(rnd1 + i + 1, rnd2 + i + 2); - Verify.verify(rnd1 + i * 2, rnd2 + i); - } + Verify.LoopDependentTest.verify(new Verify.AddExactI()); } } diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java new file mode 100644 index 00000000000..b3a24758569 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8024924 + * @summary Test non constant addExact + * @compile AddExactINonConstantTest.java Verify.java + * @run main AddExactINonConstantTest + * + */ + +public class AddExactINonConstantTest { + public static void main(String[] args) { + Verify.NonConstantTest.verify(new Verify.AddExactI()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java new file mode 100644 index 00000000000..d111b66ce82 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8025657 + * @summary Test repeating addExact + * @compile AddExactIRepeatTest.java Verify.java + * @run main AddExactIRepeatTest + * + */ + +public class AddExactIRepeatTest { + public static void main(String[] args) { + runTest(new Verify.AddExactI()); + } + + public static int nonExact(int x, int y, Verify.BinaryMethod method) { + int result = method.unchecked(x, y); + result += method.unchecked(x, y); + result += method.unchecked(x, y); + result += method.unchecked(x, y); + return result; + } + + public static void runTest(Verify.BinaryMethod method) { + java.util.Random rnd = new java.util.Random(); + for (int i = 0; i < 50000; ++i) { + int x = Integer.MAX_VALUE - 10; + int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5); + + int c = rnd.nextInt() / 2; + int d = rnd.nextInt() / 2; + + int a = catchingExact(x, y, method); + + if (a != 36) { + throw new RuntimeException("a != 36 : " + a); + } + + int b = nonExact(c, d, method); + int n = exact(c, d, method); + + + if (n != b) { + throw new RuntimeException("n != b : " + n + " != " + b); + } + } + } + + public static int exact(int x, int y, Verify.BinaryMethod method) { + int result = 0; + result += method.checkMethod(x, y); + result += method.checkMethod(x, y); + result += method.checkMethod(x, y); + result += method.checkMethod(x, y); + return result; + } + + public static int catchingExact(int x, int y, Verify.BinaryMethod method) { + int result = 0; + try { + result += 5; + result = method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 1; + } + try { + result += 6; + + result += method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 2; + } + try { + result += 7; + result += method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 3; + } + try { + result += 8; + result += method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 4; + } + return result; + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java new file mode 100644 index 00000000000..dc751406192 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test constant addExact + * @compile AddExactLConstantTest.java Verify.java + * @run main AddExactLConstantTest + * + */ + +public class AddExactLConstantTest { + public static void main(String[] args) { + Verify.ConstantLongTest.verify(new Verify.AddExactL()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java new file mode 100644 index 00000000000..efd5fd7c92b --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test non constant addExact + * @compile AddExactLNonConstantTest.java Verify.java + * @run main AddExactLNonConstantTest + * + */ + +public class AddExactLNonConstantTest { + public static void main(String[] args) { + Verify.NonConstantLongTest.verify(new Verify.AddExactL()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java b/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java new file mode 100644 index 00000000000..7e6e1ca3bde --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test decrementExact + * @compile DecExactITest.java Verify.java + * @run main DecExactITest + * + */ + +public class DecExactITest { + public static int[] values = {1, 1, 1, 1}; + public static int[] minvalues = {Integer.MIN_VALUE, Integer.MIN_VALUE}; + + public static void main(String[] args) { + runTest(new Verify.DecExactI()); + } + + public static void runTest(Verify.UnaryMethod method) { + for (int i = 0; i < 20000; ++i) { + Verify.verifyUnary(Integer.MIN_VALUE, method); + Verify.verifyUnary(minvalues[0], method); + Verify.verifyUnary(Integer.MIN_VALUE - values[2], method); + Verify.verifyUnary(0, method); + Verify.verifyUnary(values[2], method); + Verify.verifyUnary(Integer.MAX_VALUE, method); + Verify.verifyUnary(Integer.MIN_VALUE - values[0] + values[3], method); + Verify.verifyUnary(Integer.MIN_VALUE + 1 - values[0], method); + } + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java b/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java new file mode 100644 index 00000000000..7dca00b963e --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test decrementExact + * @compile DecExactITest.java Verify.java + * @run main DecExactITest + * + */ + +public class DecExactLTest { + public static long[] values = {1, 1, 1, 1}; + public static long[] minvalues = {Long.MIN_VALUE, Long.MIN_VALUE}; + + public static void main(String[] args) { + runTest(new Verify.DecExactL()); + } + + public static void runTest(Verify.UnaryLongMethod method) { + for (int i = 0; i < 20000; ++i) { + Verify.verifyUnary(Long.MIN_VALUE, method); + Verify.verifyUnary(minvalues[0], method); + Verify.verifyUnary(Long.MIN_VALUE - values[2], method); + Verify.verifyUnary(0, method); + Verify.verifyUnary(values[2], method); + Verify.verifyUnary(Long.MAX_VALUE, method); + Verify.verifyUnary(Long.MIN_VALUE - values[0] + values[3], method); + Verify.verifyUnary(Long.MIN_VALUE + 1 - values[0], method); + } + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java b/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java new file mode 100644 index 00000000000..9f7ddbd3211 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test incrementExact + * @compile IncExactITest.java Verify.java + * @run main IncExactITest + * + */ + + +public class IncExactITest { + public static int[] values = {1, 1, 1, 1}; + public static void main(String[] args) { + runTest(new Verify.IncExactI()); + } + + public static void runTest(Verify.UnaryMethod method) { + for (int i = 0; i < 20000; ++i) { + Verify.verifyUnary(Integer.MIN_VALUE, method); + Verify.verifyUnary(Integer.MAX_VALUE - 1, method); + Verify.verifyUnary(0, method); + Verify.verifyUnary(values[1], method); + Verify.verifyUnary(Integer.MAX_VALUE, method); + Verify.verifyUnary(Integer.MAX_VALUE - values[0] + values[3], method); + Verify.verifyUnary(Integer.MAX_VALUE - 1 + values[0], method); + } + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/LoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java similarity index 56% rename from hotspot/test/compiler/intrinsics/mathexact/LoadTest.java rename to hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java index c04180ba634..755d81908ce 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/LoadTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java @@ -23,33 +23,28 @@ /* * @test - * @bug 8024924 - * @summary Test non constant addExact - * @compile LoadTest.java Verify.java - * @run main LoadTest + * @bug 8026844 + * @summary Test incrementExact + * @compile IncExactLTest.java Verify.java + * @run main IncExactLTest * */ -import java.lang.ArithmeticException; - -public class LoadTest { - public static java.util.Random rnd = new java.util.Random(); - public static int[] values = new int[256]; - - public static void main(String[] args) { - for (int i = 0; i < values.length; ++i) { - values[i] = rnd.nextInt(); +public class IncExactLTest { + public static long[] values = {1, 1, 1, 1}; + public static void main(String[] args) { + runTest(new Verify.IncExactL()); } - for (int i = 0; i < 50000; ++i) { - Verify.verify(values[i & 255], values[i & 255] - i); - Verify.verify(values[i & 255] + i, values[i & 255] - i); - Verify.verify(values[i & 255], values[i & 255]); - if ((i & 1) == 1 && i > 5) { - Verify.verify(values[i & 255] + i, values[i & 255] - i); - } else { - Verify.verify(values[i & 255] - i, values[i & 255] + i); - } + public static void runTest(Verify.UnaryLongMethod method) { + for (int i = 0; i < 20000; ++i) { + Verify.verifyUnary(Long.MIN_VALUE, method); + Verify.verifyUnary(Long.MAX_VALUE - 1, method); + Verify.verifyUnary(0, method); + Verify.verifyUnary(values[1], method); + Verify.verifyUnary(Long.MAX_VALUE, method); + Verify.verifyUnary(Long.MAX_VALUE - values[0] + values[3], method); + Verify.verifyUnary(Long.MAX_VALUE - 1 + values[0], method); + } } - } } diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactICondTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactICondTest.java new file mode 100644 index 00000000000..5f3e1e64568 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactICondTest.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test multiplyExact as condition + * @compile MulExactICondTest.java + * @run main MulExactICondTest + * + */ + +public class MulExactICondTest { + public static int result = 0; + + public static void main(String[] args) { + for (int i = 0; i < 50000; ++i) { + runTest(); + } + } + + public static void runTest() { + int i = 7; + while (java.lang.Math.multiplyExact(i, result) < 89361) { + if ((java.lang.Math.multiplyExact(i, i) & 1) == 1) { + i += 3; + } else if ((i & 5) == 4) { + i += 7; + } else if ((i & 0xf) == 6) { + i += 2; + } else { + i += 1; + } + result += 2; + } + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java new file mode 100644 index 00000000000..120bef5e9b9 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test constant multiplyExact + * @compile MulExactIConstantTest.java Verify.java + * @run main MulExactIConstantTest + * + */ + +public class MulExactIConstantTest { + public static void main(String[] args) { + Verify.ConstantTest.verify(new Verify.MulExactI()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java new file mode 100644 index 00000000000..36aa3d46230 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test multiplyExact + * @compile MulExactILoadTest.java Verify.java + * @run main MulExactILoadTest + * + */ + +public class MulExactILoadTest { + public static void main(String[] args) { + Verify.LoadTest.init(); + Verify.LoadTest.verify(new Verify.MulExactI()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java new file mode 100644 index 00000000000..5ba4ad3cfc3 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test loop dependent multiplyExact + * @compile MulExactILoopDependentTest.java Verify.java + * @run main MulExactILoopDependentTest + * + */ +public class MulExactILoopDependentTest { + public static void main(String[] args) { + Verify.LoopDependentTest.verify(new Verify.MulExactI()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java new file mode 100644 index 00000000000..e108059885b --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test non constant multiplyExact + * @compile MulExactINonConstantTest.java Verify.java + * @run main MulExactINonConstantTest + * + */ + +public class MulExactINonConstantTest { + public static void main(String[] args) { + Verify.NonConstantTest.verify(new Verify.MulExactI()); + Verify.LoadTest.verify(new Verify.MulExactI()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java new file mode 100644 index 00000000000..dd14ce21ed6 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test repeating multiplyExact + * @compile MulExactIRepeatTest.java Verify.java + * @run main MulExactIRepeatTest + * + */ + +public class MulExactIRepeatTest { + public static void main(String[] args) { + runTest(new Verify.MulExactI()); + } + + public static int nonExact(int x, int y, Verify.BinaryMethod method) { + int result = method.unchecked(x, y); + result += method.unchecked(x, y); + result += method.unchecked(x, y); + result += method.unchecked(x, y); + return result; + } + + public static void runTest(Verify.BinaryMethod method) { + java.util.Random rnd = new java.util.Random(); + for (int i = 0; i < 50000; ++i) { + int x = Integer.MAX_VALUE - 10; + int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5); + + int c = rnd.nextInt() / 10; + int d = rnd.nextInt(9); + + int a = catchingExact(x, y, method); + + if (a != 36) { + throw new RuntimeException("a != 36 : " + a); + } + + int b = nonExact(c, d, method); + int n = exact(c, d, method); + + + if (n != b) { + throw new RuntimeException("n != b : " + n + " != " + b); + } + } + } + + public static int exact(int x, int y, Verify.BinaryMethod method) { + int result = 0; + result += method.checkMethod(x, y); + result += method.checkMethod(x, y); + result += method.checkMethod(x, y); + result += method.checkMethod(x, y); + return result; + } + + public static int catchingExact(int x, int y, Verify.BinaryMethod method) { + int result = 0; + try { + result += 5; + result = method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 1; + } + try { + result += 6; + + result += method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 2; + } + try { + result += 7; + result += method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 3; + } + try { + result += 8; + result += method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 4; + } + return result; + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java new file mode 100644 index 00000000000..c687cc276f2 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test constant mulExact + * @compile MulExactLConstantTest.java Verify.java + * @run main MulExactLConstantTest + * + */ + +public class MulExactLConstantTest { + public static void main(String[] args) { + Verify.ConstantLongTest.verify(new Verify.MulExactL()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java new file mode 100644 index 00000000000..f9d82ed0876 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test non constant mulExact + * @compile MulExactLNonConstantTest.java Verify.java + * @run main MulExactLNonConstantTest + * + */ + +public class MulExactLNonConstantTest { + public static void main(String[] args) { + Verify.NonConstantLongTest.verify(new Verify.MulExactL()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java new file mode 100644 index 00000000000..ba49d778762 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test constant negExact + * @compile NegExactIConstantTest.java Verify.java + * @run main NegExactIConstantTest + * + */ + +public class NegExactIConstantTest { + public static void main(String[] args) { + Verify.ConstantTest.verify(new Verify.UnaryToBinary(new Verify.NegExactI())); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java new file mode 100644 index 00000000000..371f3aedb6c --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test negExact + * @compile NegExactILoadTest.java Verify.java + * @run main NegExactILoadTest + * + */ + +public class NegExactILoadTest { + public static void main(String[] args) { + Verify.LoadTest.init(); + Verify.LoadTest.verify(new Verify.UnaryToBinary(new Verify.NegExactI())); + } + +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java new file mode 100644 index 00000000000..882f80b91a1 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test negExact loop dependent + * @compile NegExactILoopDependentTest.java Verify.java + * @run main NegExactILoopDependentTest + * + */ +public class NegExactILoopDependentTest { + public static void main(String[] args) { + Verify.LoopDependentTest.verify(new Verify.UnaryToBinary(new Verify.NegExactI())); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java new file mode 100644 index 00000000000..6f044f0d969 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test non constant negExact + * @compile NegExactINonConstantTest.java Verify.java + * @run main NegExactINonConstantTest + * + */ + +public class NegExactINonConstantTest { + public static void main(String[] args) { + Verify.NonConstantTest.verify(new Verify.UnaryToBinary(new Verify.NegExactI())); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java new file mode 100644 index 00000000000..382cd5c5f9e --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test constant negExact + * @compile NegExactLConstantTest.java Verify.java + * @run main NegExactLConstantTest + * + */ + +public class NegExactLConstantTest { + public static void main(String[] args) { + Verify.ConstantLongTest.verify(new Verify.UnaryToBinaryLong(new Verify.NegExactL())); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java new file mode 100644 index 00000000000..0bcad8b2b78 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test constant negExact + * @compile NegExactLNonConstantTest.java Verify.java + * @run main NegExactLNonConstantTest + * + */ + +public class NegExactLNonConstantTest { + public static void main(String[] args) { + Verify.NonConstantLongTest.verify(new Verify.UnaryToBinaryLong(new Verify.NegExactL())); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/RepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/RepeatTest.java deleted file mode 100644 index aaf63de1d0a..00000000000 --- a/hotspot/test/compiler/intrinsics/mathexact/RepeatTest.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2013, 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. - */ - -/* - * @test - * @bug 8025657 - * @summary Test repeating addExact - * @compile RepeatTest.java - * @run main RepeatTest - * - */ - -import java.lang.ArithmeticException; - -public class RepeatTest { - public static void main(String[] args) { - java.util.Random rnd = new java.util.Random(); - for (int i = 0; i < 50000; ++i) { - int x = Integer.MAX_VALUE - 10; - int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5); //rnd.nextInt() / 2; - - int c = rnd.nextInt() / 2; - int d = rnd.nextInt() / 2; - - int a = addExact(x, y); - - if (a != 36) { - throw new RuntimeException("a != 0 : " + a); - } - - int b = nonExact(c, d); - int n = addExact2(c, d); - - - if (n != b) { - throw new RuntimeException("n != b : " + n + " != " + b); - } - } - } - - public static int addExact2(int x, int y) { - int result = 0; - result += java.lang.Math.addExact(x, y); - result += java.lang.Math.addExact(x, y); - result += java.lang.Math.addExact(x, y); - result += java.lang.Math.addExact(x, y); - return result; - } - - public static int addExact(int x, int y) { - int result = 0; - try { - result += 5; - result = java.lang.Math.addExact(x, y); - } catch (ArithmeticException e) { - result += 1; - } - try { - result += 6; - - result += java.lang.Math.addExact(x, y); - } catch (ArithmeticException e) { - result += 2; - } - try { - result += 7; - result += java.lang.Math.addExact(x, y); - } catch (ArithmeticException e) { - result += 3; - } - try { - result += 8; - result += java.lang.Math.addExact(x, y); - } catch (ArithmeticException e) { - result += 4; - } - return result; - } - - public static int nonExact(int x, int y) { - int result = x + y; - result += x + y; - result += x + y; - result += x + y; - return result; - } -} diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java new file mode 100644 index 00000000000..f539bdc7cbe --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test subtractExact as condition + * @compile SubExactICondTest.java Verify.java + * @run main SubExactICondTest + * + */ + +public class SubExactICondTest { + public static int result = 0; + + public static void main(String[] args) { + for (int i = 0; i < 50000; ++i) { + runTest(); + } + } + + public static void runTest() { + int i = 7; + while (java.lang.Math.subtractExact(i, result) > -31361) { + if ((java.lang.Math.subtractExact(i, i) & 1) == 1) { + i -= 3; + } else if ((i & 5) == 4) { + i -= 7; + } else if ((i & 0xf) == 6) { + i -= 2; + } else { + i -= 1; + } + result += 2; + } + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java new file mode 100644 index 00000000000..b450bd90b11 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test constant subtractExact + * @compile SubExactIConstantTest.java Verify.java + * @run main SubExactIConstantTest + * + */ + +public class SubExactIConstantTest { + public static void main(String[] args) { + Verify.ConstantTest.verify(new Verify.SubExactI()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java new file mode 100644 index 00000000000..af2ed018258 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test non constant subtractExact + * @compile SubExactILoadTest.java Verify.java + * @run main SubExactILoadTest + * + */ + +public class SubExactILoadTest { + public static void main(String[] args) { + Verify.LoadTest.init(); + Verify.LoadTest.verify(new Verify.SubExactI()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java new file mode 100644 index 00000000000..67ebcbca321 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test non constant subtractExact + * @compile SubExactILoopDependentTest.java Verify.java + * @run main SubExactILoopDependentTest + * + */ + +public class SubExactILoopDependentTest { + public static void main(String[] args) { + Verify.LoopDependentTest.verify(new Verify.SubExactI()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java new file mode 100644 index 00000000000..b8153810892 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test non constant subtractExact + * @compile SubExactINonConstantTest.java Verify.java + * @run main SubExactINonConstantTest + * + */ + +public class SubExactINonConstantTest { + public static void main(String[] args) { + Verify.NonConstantTest.verify(new Verify.SubExactI()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java new file mode 100644 index 00000000000..3c57f6f3f76 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test repeating subtractExact + * @compile SubExactIRepeatTest.java Verify.java + * @run main SubExactIRepeatTest + * + */ + +import java.lang.ArithmeticException; + +public class SubExactIRepeatTest { + public static void main(String[] args) { + runTest(new Verify.SubExactI()); + } + + public static int nonExact(int x, int y, Verify.BinaryMethod method) { + int result = method.unchecked(x, y); + result += method.unchecked(x, y); + result += method.unchecked(x, y); + result += method.unchecked(x, y); + return result; + } + + public static void runTest(Verify.BinaryMethod method) { + java.util.Random rnd = new java.util.Random(); + for (int i = 0; i < 50000; ++i) { + int x = Integer.MIN_VALUE + 10; + int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5); + + int c = rnd.nextInt() / 2; + int d = rnd.nextInt() / 2; + + int a = catchingExact(x, y, method); + + if (a != 36) { + throw new RuntimeException("a != 36 : " + a); + } + + int b = nonExact(c, d, method); + int n = exact(c, d, method); + + + if (n != b) { + throw new RuntimeException("n != b : " + n + " != " + b); + } + } + } + + public static int exact(int x, int y, Verify.BinaryMethod method) { + int result = 0; + result += method.checkMethod(x, y); + result += method.checkMethod(x, y); + result += method.checkMethod(x, y); + result += method.checkMethod(x, y); + return result; + } + + public static int catchingExact(int x, int y, Verify.BinaryMethod method) { + int result = 0; + try { + result += 5; + result = method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 1; + } + try { + result += 6; + + result += method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 2; + } + try { + result += 7; + result += method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 3; + } + try { + result += 8; + result += method.checkMethod(x, y); + } catch (ArithmeticException e) { + result += 4; + } + return result; + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java new file mode 100644 index 00000000000..46eefcd194a --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test constant subtractExact + * @compile SubExactLConstantTest.java Verify.java + * @run main SubExactLConstantTest + * + */ + +public class SubExactLConstantTest { + public static void main(String[] args) { + Verify.ConstantLongTest.verify(new Verify.SubExactL()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java new file mode 100644 index 00000000000..2bd67bb0f9b --- /dev/null +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8026844 + * @summary Test non constant subtractExact + * @compile SubExactLNonConstantTest.java Verify.java + * @run main SubExactLNonConstantTest + * + */ + +public class SubExactLNonConstantTest { + public static void main(String[] args) { + Verify.NonConstantLongTest.verify(new Verify.SubExactL()); + } +} diff --git a/hotspot/test/compiler/intrinsics/mathexact/Verify.java b/hotspot/test/compiler/intrinsics/mathexact/Verify.java index de5a4cc44ef..a4d728bfd6b 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/Verify.java +++ b/hotspot/test/compiler/intrinsics/mathexact/Verify.java @@ -22,47 +22,641 @@ */ public class Verify { - public static String throwWord(boolean threw) { - return (threw ? "threw" : "didn't throw"); - } - - public static void verify(int a, int b) { - boolean exception1 = false, exception2 = false; - int result1 = 0, result2 = 0; - try { - result1 = testIntrinsic(a, b); - } catch (ArithmeticException e) { - exception1 = true; - } - try { - result2 = testNonIntrinsic(a, b); - } catch (ArithmeticException e) { - exception2 = true; + public static String throwWord(boolean threw) { + return (threw ? "threw" : "didn't throw"); } - if (exception1 != exception2) { - throw new RuntimeException("Intrinsic version " + throwWord(exception1) + " exception, NonIntrinsic version " + throwWord(exception2) + " for: " + a + " + " + b); + public static void verifyResult(UnaryMethod method, int result1, int result2, boolean exception1, boolean exception2, int value) { + if (exception1 != exception2) { + throw new RuntimeException("Intrinsic version [" + method.name() + "]" + throwWord(exception1) + " exception, NonIntrinsic version" + throwWord(exception2) + " for: " + value); + } + if (result1 != result2) { + throw new RuntimeException("Intrinsic version [" + method.name() + "] returned: " + result1 + " while NonIntrinsic version returned: " + result2); + } } - if (result1 != result2) { - throw new RuntimeException("Intrinsic version returned: " + a + " while NonIntrinsic version returned: " + b); + + public static void verifyResult(UnaryLongMethod method, long result1, long result2, boolean exception1, boolean exception2, long value) { + if (exception1 != exception2) { + throw new RuntimeException("Intrinsic version [" + method.name() + "]" + throwWord(exception1) + " exception, NonIntrinsic version" + throwWord(exception2) + " for: " + value); + } + if (result1 != result2) { + throw new RuntimeException("Intrinsic version [" + method.name() + "] returned: " + result1 + " while NonIntrinsic version returned: " + result2); + } } - } - public static int testIntrinsic(int a, int b) { - return java.lang.Math.addExact(a, b); - } - - public static int testNonIntrinsic(int a, int b) { - return safeAddExact(a, b); - } - - // Copied java.lang.Math.addExact to avoid intrinsification - public static int safeAddExact(int x, int y) { - int r = x + y; - // HD 2-12 Overflow iff both arguments have the opposite sign of the result - if (((x ^ r) & (y ^ r)) < 0) { - throw new ArithmeticException("integer overflow"); + private static void verifyResult(BinaryMethod method, int result1, int result2, boolean exception1, boolean exception2, int a, int b) { + if (exception1 != exception2) { + throw new RuntimeException("Intrinsic version [" + method.name() + "]" + throwWord(exception1) + " exception, NonIntrinsic version " + throwWord(exception2) + " for: " + a + " + " + b); + } + if (result1 != result2) { + throw new RuntimeException("Intrinsic version [" + method.name() + "] returned: " + result1 + " while NonIntrinsic version returned: " + result2); + } } - return r; - } + + private static void verifyResult(BinaryLongMethod method, long result1, long result2, boolean exception1, boolean exception2, long a, long b) { + if (exception1 != exception2) { + throw new RuntimeException("Intrinsic version [" + method.name() + "]" + throwWord(exception1) + " exception, NonIntrinsic version " + throwWord(exception2) + " for: " + a + " + " + b); + } + if (result1 != result2) { + throw new RuntimeException("Intrinsic version [" + method.name() + "] returned: " + result1 + " while NonIntrinsic version returned: " + result2); + } + } + + + public static void verifyUnary(int a, UnaryMethod method) { + boolean exception1 = false, exception2 = false; + int result1 = 0, result2 = 0; + try { + result1 = method.checkMethod(a); + } catch (ArithmeticException e) { + exception1 = true; + } + try { + result2 = method.safeMethod(a); + } catch (ArithmeticException e) { + exception2 = true; + } + + verifyResult(method, result1, result2, exception1, exception2, a); + } + + public static void verifyUnary(long a, UnaryLongMethod method) { + boolean exception1 = false, exception2 = false; + long result1 = 0, result2 = 0; + try { + result1 = method.checkMethod(a); + } catch (ArithmeticException e) { + exception1 = true; + } + try { + result2 = method.safeMethod(a); + } catch (ArithmeticException e) { + exception2 = true; + } + + verifyResult(method, result1, result2, exception1, exception2, a); + } + + + public static void verifyBinary(int a, int b, BinaryMethod method) { + boolean exception1 = false, exception2 = false; + int result1 = 0, result2 = 0; + try { + result1 = method.checkMethod(a, b); + } catch (ArithmeticException e) { + exception1 = true; + } + try { + result2 = method.safeMethod(a, b); + } catch (ArithmeticException e) { + exception2 = true; + } + + verifyResult(method, result1, result2, exception1, exception2, a, b); + } + + public static void verifyBinary(long a, long b, BinaryLongMethod method) { + boolean exception1 = false, exception2 = false; + long result1 = 0, result2 = 0; + try { + result1 = method.checkMethod(a, b); + } catch (ArithmeticException e) { + exception1 = true; + } + try { + result2 = method.safeMethod(a, b); + } catch (ArithmeticException e) { + exception2 = true; + } + + verifyResult(method, result1, result2, exception1, exception2, a, b); + } + + + public static class LoadTest { + public static java.util.Random rnd = new java.util.Random(); + public static int[] values = new int[256]; + + public static void init() { + for (int i = 0; i < values.length; ++i) { + values[i] = rnd.nextInt(); + } + } + + public static void verify(BinaryMethod method) { + for (int i = 0; i < 50000; ++i) { + Verify.verifyBinary(values[i & 255], values[i & 255] - i, method); + Verify.verifyBinary(values[i & 255] + i, values[i & 255] - i, method); + Verify.verifyBinary(values[i & 255], values[i & 255], method); + if ((i & 1) == 1 && i > 5) { + Verify.verifyBinary(values[i & 255] + i, values[i & 255] - i, method); + } else { + Verify.verifyBinary(values[i & 255] - i, values[i & 255] + i, method); + } + Verify.verifyBinary(values[i & 255], values[(i + 1) & 255], method); + } + } + } + + public static class NonConstantTest { + public static java.util.Random rnd = new java.util.Random(); + + public static void verify(BinaryMethod method) { + for (int i = 0; i < 50000; ++i) { + int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt(); + Verify.verifyBinary(rnd1, rnd2, method); + Verify.verifyBinary(rnd1, rnd2 + 1, method); + Verify.verifyBinary(rnd1 + 1, rnd2, method); + Verify.verifyBinary(rnd1 - 1, rnd2, method); + Verify.verifyBinary(rnd1, rnd2 - 1, method); + } + } + } + + public static class NonConstantLongTest { + public static long[] values = { Long.MIN_VALUE, Long.MAX_VALUE, 0, Long.MAX_VALUE - 1831 }; + public static java.util.Random rnd = new java.util.Random(); + + public static void verify(BinaryLongMethod method) { + for (int i = 0; i < 50000; ++i) { + long rnd1 = rnd.nextLong(), rnd2 = rnd.nextLong(); + Verify.verifyBinary(rnd1, rnd2, method); + Verify.verifyBinary(rnd1, rnd2 + 1, method); + Verify.verifyBinary(rnd1 + 1, rnd2, method); + Verify.verifyBinary(rnd1 - 1, rnd2, method); + Verify.verifyBinary(rnd1, rnd2 - 1, method); + Verify.verifyBinary(rnd1 + Long.MAX_VALUE - rnd2, rnd2 + 1, method); + Verify.verifyBinary(values[0], values[2], method); + Verify.verifyBinary(values[1], values[2], method); + Verify.verifyBinary(values[3], 74L, method); + } + } + } + + public static class LoopDependentTest { + public static java.util.Random rnd = new java.util.Random(); + + public static void verify(BinaryMethod method) { + int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt(); + runTest(rnd1, rnd2, method); + } + + private static void runTest(int rnd1, int rnd2, BinaryMethod method) { + for (int i = 0; i < 50000; ++i) { + Verify.verifyBinary(rnd1 + i, rnd2 + i, method); + Verify.verifyBinary(rnd1 + i, rnd2 + (i & 0xff), method); + Verify.verifyBinary(rnd1 - i, rnd2 - (i & 0xff), method); + Verify.verifyBinary(rnd1 + i + 1, rnd2 + i + 2, method); + Verify.verifyBinary(rnd1 + i * 2, rnd2 + i, method); + } + } + } + + public static class ConstantTest { + public static void verify(BinaryMethod method) { + for (int i = 0; i < 50000; ++i) { + Verify.verifyBinary(5, 7, method); + Verify.verifyBinary(Integer.MAX_VALUE, 1, method); + Verify.verifyBinary(Integer.MIN_VALUE, -1, method); + Verify.verifyBinary(Integer.MAX_VALUE, -1, method); + Verify.verifyBinary(Integer.MIN_VALUE, 1, method); + Verify.verifyBinary(Integer.MAX_VALUE / 2, Integer.MAX_VALUE / 2, method); + Verify.verifyBinary(Integer.MAX_VALUE / 2, (Integer.MAX_VALUE / 2) + 3, method); + Verify.verifyBinary(Integer.MAX_VALUE, Integer.MIN_VALUE, method); + } + } + } + + public static class ConstantLongTest { + public static void verify(BinaryLongMethod method) { + for (int i = 0; i < 50000; ++i) { + Verify.verifyBinary(5, 7, method); + Verify.verifyBinary(Long.MAX_VALUE, 1, method); + Verify.verifyBinary(Long.MIN_VALUE, -1, method); + Verify.verifyBinary(Long.MAX_VALUE, -1, method); + Verify.verifyBinary(Long.MIN_VALUE, 1, method); + Verify.verifyBinary(Long.MAX_VALUE / 2, Long.MAX_VALUE / 2, method); + Verify.verifyBinary(Long.MAX_VALUE / 2, (Long.MAX_VALUE / 2) + 3, method); + Verify.verifyBinary(Long.MAX_VALUE, Long.MIN_VALUE, method); + } + } + } + + public static interface BinaryMethod { + int safeMethod(int a, int b); + int checkMethod(int a, int b); + int unchecked(int a, int b); + String name(); + } + + public static interface UnaryMethod { + int safeMethod(int value); + int checkMethod(int value); + int unchecked(int value); + String name(); + } + + public static interface BinaryLongMethod { + long safeMethod(long a, long b); + long checkMethod(long a, long b); + long unchecked(long a, long b); + String name(); + } + + public static interface UnaryLongMethod { + long safeMethod(long value); + long checkMethod(long value); + long unchecked(long value); + String name(); + } + + public static class UnaryToBinary implements BinaryMethod { + private final UnaryMethod method; + public UnaryToBinary(UnaryMethod method) { + this.method = method; + } + + @Override + public int safeMethod(int a, int b) { + return method.safeMethod(a); + } + + @Override + public int checkMethod(int a, int b) { + return method.checkMethod(a); + } + + @Override + public int unchecked(int a, int b) { + return method.unchecked(a); + + } + + @Override + public String name() { + return method.name(); + } + } + + public static class UnaryToBinaryLong implements BinaryLongMethod { + private final UnaryLongMethod method; + public UnaryToBinaryLong(UnaryLongMethod method) { + this.method = method; + } + + @Override + public long safeMethod(long a, long b) { + return method.safeMethod(a); + } + + @Override + public long checkMethod(long a, long b) { + return method.checkMethod(a); + } + + @Override + public long unchecked(long a, long b) { + return method.unchecked(a); + + } + + @Override + public String name() { + return method.name(); + } + } + + + public static class AddExactI implements BinaryMethod { + @Override + public int safeMethod(int x, int y) { + int r = x + y; + // HD 2-12 Overflow iff both arguments have the opposite sign of the result + if (((x ^ r) & (y ^ r)) < 0) { + throw new ArithmeticException("integer overflow"); + } + return r; + + } + + @Override + public int checkMethod(int a, int b) { + return Math.addExact(a, b); + } + + @Override + public String name() { + return "addExact"; + } + + @Override + public int unchecked(int a, int b) { + return a + b; + } + } + + public static class AddExactL implements BinaryLongMethod { + @Override + public long safeMethod(long x, long y) { + long r = x + y; + // HD 2-12 Overflow iff both arguments have the opposite sign of the result + if (((x ^ r) & (y ^ r)) < 0) { + throw new ArithmeticException("integer overflow"); + } + return r; + + } + + @Override + public long checkMethod(long a, long b) { + return Math.addExact(a, b); + } + + @Override + public String name() { + return "addExactLong"; + } + + @Override + public long unchecked(long a, long b) { + return a + b; + } + } + + public static class MulExactI implements BinaryMethod { + @Override + public int safeMethod(int x, int y) { + long r = (long)x * (long)y; + if ((int)r != r) { + throw new ArithmeticException("integer overflow"); + } + return (int)r; + + } + + @Override + public int checkMethod(int a, int b) { + return Math.multiplyExact(a, b); + } + + @Override + public int unchecked(int a, int b) { + return a * b; + } + + @Override + public String name() { + return "multiplyExact"; + } + } + + public static class MulExactL implements BinaryLongMethod { + @Override + public long safeMethod(long x, long y) { + long r = x * y; + long ax = Math.abs(x); + long ay = Math.abs(y); + if (((ax | ay) >>> 31 != 0)) { + // Some bits greater than 2^31 that might cause overflow + // Check the result using the divide operator + // and check for the special case of Long.MIN_VALUE * -1 + if (((y != 0) && (r / y != x)) || + (x == Long.MIN_VALUE && y == -1)) { + throw new ArithmeticException("long overflow"); + } + } + return r; + } + + @Override + public long checkMethod(long a, long b) { + return Math.multiplyExact(a, b); + } + + @Override + public long unchecked(long a, long b) { + return a * b; + } + + @Override + public String name() { + return "multiplyExact"; + } + } + + public static class NegExactL implements UnaryLongMethod { + @Override + public long safeMethod(long a) { + if (a == Long.MIN_VALUE) { + throw new ArithmeticException("long overflow"); + } + + return -a; + + } + + @Override + public long checkMethod(long value) { + return Math.negateExact(value); + } + + @Override + public long unchecked(long value) { + return -value; + } + + @Override + public String name() { + return "negateExactLong"; + } + } + + public static class NegExactI implements UnaryMethod { + @Override + public int safeMethod(int a) { + if (a == Integer.MIN_VALUE) { + throw new ArithmeticException("integer overflow"); + } + + return -a; + + } + + @Override + public int checkMethod(int value) { + return Math.negateExact(value); + } + + @Override + public int unchecked(int value) { + return -value; + } + + @Override + public String name() { + return "negateExact"; + } + } + + public static class SubExactI implements BinaryMethod { + @Override + public int safeMethod(int x, int y) { + int r = x - y; + // HD 2-12 Overflow iff the arguments have different signs and + // the sign of the result is different than the sign of x + if (((x ^ y) & (x ^ r)) < 0) { + throw new ArithmeticException("integer overflow"); + } + return r; + } + + @Override + public int checkMethod(int a, int b) { + return Math.subtractExact(a, b); + } + + @Override + public int unchecked(int a, int b) { + return a - b; + } + + @Override + public String name() { + return "subtractExact"; + } + } + + public static class SubExactL implements BinaryLongMethod { + @Override + public long safeMethod(long x, long y) { + long r = x - y; + // HD 2-12 Overflow iff the arguments have different signs and + // the sign of the result is different than the sign of x + if (((x ^ y) & (x ^ r)) < 0) { + throw new ArithmeticException("integer overflow"); + } + return r; + } + + @Override + public long checkMethod(long a, long b) { + return Math.subtractExact(a, b); + } + + @Override + public long unchecked(long a, long b) { + return a - b; + } + + @Override + public String name() { + return "subtractExactLong"; + } + } + + static class IncExactL implements UnaryLongMethod { + @Override + public long safeMethod(long a) { + if (a == Long.MAX_VALUE) { + throw new ArithmeticException("long overflow"); + } + + return a + 1L; + + } + + @Override + public long checkMethod(long value) { + return Math.incrementExact(value); + } + + @Override + public long unchecked(long value) { + return value + 1; + } + + @Override + public String name() { + return "incrementExactLong"; + } + } + + static class IncExactI implements UnaryMethod { + @Override + public int safeMethod(int a) { + if (a == Integer.MAX_VALUE) { + throw new ArithmeticException("integer overflow"); + } + + return a + 1; + } + + @Override + public int checkMethod(int value) { + return Math.incrementExact(value); + } + + @Override + public int unchecked(int value) { + return value + 1; + } + + @Override + public String name() { + return "incrementExact"; + } + } + + static class DecExactL implements UnaryLongMethod { + @Override + public long safeMethod(long a) { + if (a == Long.MIN_VALUE) { + throw new ArithmeticException("long overflow"); + } + + return a - 1L; + } + + @Override + public long checkMethod(long value) { + return Math.decrementExact(value); + } + + @Override + public long unchecked(long value) { + return value - 1; + } + + @Override + public String name() { + return "decExactLong"; + } + } + + static class DecExactI implements UnaryMethod { + @Override + public int safeMethod(int a) { + if (a == Integer.MIN_VALUE) { + throw new ArithmeticException("integer overflow"); + } + + return a - 1; + } + + @Override + public int checkMethod(int value) { + return Math.decrementExact(value); + } + + @Override + public int unchecked(int value) { + return value - 1; + } + + @Override + public String name() { + return "decrementExact"; + } + } + } From 7d4a3ec94ee4532c40d01004890a265ff557c4e1 Mon Sep 17 00:00:00 2001 From: Albert Noll Date: Tue, 15 Oct 2013 08:38:35 +0200 Subject: [PATCH 023/274] 8025740: Typo. Error line for wrong ReservedCodeCacheSize value is printed twice Remove duplicate print Reviewed-by: kvn, twisti --- hotspot/src/share/vm/runtime/arguments.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 9c1400c886e..d9f94f48cd5 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1957,12 +1957,6 @@ bool Arguments::check_gc_consistency() { "please refer to the release notes for the combinations " "allowed\n"); status = false; - } else if (ReservedCodeCacheSize > 2*G) { - // Code cache size larger than MAXINT is not supported. - jio_fprintf(defaultStream::error_stream(), - "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, - (2*G)/M); - status = false; } return status; } From 6b2d8a50492cefe64ea15b97b8c75d0c07547531 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Tue, 15 Oct 2013 18:41:23 +0400 Subject: [PATCH 024/274] 8023390: Test java/net/NetworkInterface/MemLeakTest.java failed with the latest jdk8 build Removing the test as it is unreliable and fails intermittently Reviewed-by: chegar --- .../net/NetworkInterface/MemLeakTest.java | 108 ------------------ 1 file changed, 108 deletions(-) delete mode 100644 jdk/test/java/net/NetworkInterface/MemLeakTest.java diff --git a/jdk/test/java/net/NetworkInterface/MemLeakTest.java b/jdk/test/java/net/NetworkInterface/MemLeakTest.java deleted file mode 100644 index 11791ae20fa..00000000000 --- a/jdk/test/java/net/NetworkInterface/MemLeakTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2013, 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. - */ - -/* @test - * @bug 8022584 - * @summary Some NetworkInterface methods can leak native memory - * @run main/othervm/timeout=700 MemLeakTest - */ - -/* Note: the test can cause a memory leak that's why othervm option is required - */ - -import java.io.BufferedReader; -import java.io.FileReader; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.util.Collection; -import java.util.Collections; - -public class MemLeakTest { - - /** - * Memory leak is assumed, if application consumes more than specified amount of memory during its execution. - * The number is given in Kb. - */ - private static final long MEM_LEAK_THRESHOLD = 32 * 1024; // 32Mb - - public static void main(String[] args) - throws Exception { - - if (!System.getProperty("os.name").equals("Linux")) { - System.out.println("Test only runs on Linux"); - return; - } - - // warm up - accessNetInterfaces(3); - - long vMemBefore = getVMemSize(); - accessNetInterfaces(500_000); - long vMemAfter = getVMemSize(); - - long vMemDelta = vMemAfter - vMemBefore; - if (vMemDelta > MEM_LEAK_THRESHOLD) { - throw new Exception("FAIL: Virtual memory usage increased by " + vMemDelta + "Kb " + - "(greater than " + MEM_LEAK_THRESHOLD + "Kb)"); - } - - System.out.println("PASS: Virtual memory usage increased by " + vMemDelta + "Kb " + - "(not greater than " + MEM_LEAK_THRESHOLD + "Kb)"); - } - - private static void accessNetInterfaces(int times) { - try { - Collection interfaces = - Collections.list(NetworkInterface.getNetworkInterfaces()); - for (int i = 0; i != times; ++i) { - for (NetworkInterface netInterface : interfaces) { - netInterface.getMTU(); - netInterface.isLoopback(); - netInterface.isUp(); - netInterface.isPointToPoint(); - netInterface.supportsMulticast(); - } - } - } catch (SocketException ignore) {} - } - - /** - * Returns size of virtual memory allocated to the process in Kb. - * Linux specific. On other platforms and in case of any errors returns 0. - */ - private static long getVMemSize() { - - // Refer to the Linux proc(5) man page for details about /proc/self/stat file - // - // In short, this file contains status information about the current process - // written in one line. The fields are separated with spaces. - // The 23rd field is defined as 'vsize %lu Virtual memory size in bytes' - - try (FileReader fileReader = new FileReader("/proc/self/stat"); - BufferedReader bufferedReader = new BufferedReader(fileReader)) { - String line = bufferedReader.readLine(); - return Long.parseLong(line.split(" ")[22]) / 1024; - } catch (Exception ignore) {} - return 0; - } -} From 1d45d9a3c1c645667d088aa381428c084442d7f2 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Thu, 17 Oct 2013 19:47:47 -0700 Subject: [PATCH 025/274] 8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided Reviewed-by: alanb, forax, dholmes, twisti --- jdk/makefiles/mapfiles/libjava/mapfile-vers | 3 +- jdk/makefiles/mapfiles/libjava/reorder-sparc | 3 +- .../mapfiles/libjava/reorder-sparcv9 | 3 +- jdk/makefiles/mapfiles/libjava/reorder-x86 | 3 +- .../share/classes/sun/reflect/Reflection.java | 8 ++ jdk/src/share/javavm/export/jvm.h | 2 +- jdk/src/share/native/sun/reflect/Reflection.c | 10 +- .../Reflection/GetCallerClassWithDepth.java | 92 +++++++++++++++++++ 8 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java diff --git a/jdk/makefiles/mapfiles/libjava/mapfile-vers b/jdk/makefiles/mapfiles/libjava/mapfile-vers index 29ce7eb26df..7b4d5472b14 100644 --- a/jdk/makefiles/mapfiles/libjava/mapfile-vers +++ b/jdk/makefiles/mapfiles/libjava/mapfile-vers @@ -267,7 +267,8 @@ SUNWprivate_1.1 { Java_sun_misc_GC_maxObjectInspectionAge; Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0; Java_sun_reflect_NativeMethodAccessorImpl_invoke0; - Java_sun_reflect_Reflection_getCallerClass; + Java_sun_reflect_Reflection_getCallerClass__; + Java_sun_reflect_Reflection_getCallerClass__I; Java_sun_reflect_Reflection_getClassAccessFlags; Java_sun_misc_Version_getJdkVersionInfo; Java_sun_misc_Version_getJdkSpecialVersion; diff --git a/jdk/makefiles/mapfiles/libjava/reorder-sparc b/jdk/makefiles/mapfiles/libjava/reorder-sparc index b64537e3edd..16573052576 100644 --- a/jdk/makefiles/mapfiles/libjava/reorder-sparc +++ b/jdk/makefiles/mapfiles/libjava/reorder-sparc @@ -27,7 +27,8 @@ text: .text%Java_java_io_FileInputStream_initIDs; text: .text%Java_java_io_FileDescriptor_initIDs; text: .text%Java_java_io_FileOutputStream_initIDs; text: .text%Java_java_lang_System_setIn0; -text: .text%Java_sun_reflect_Reflection_getCallerClass; +text: .text%Java_sun_reflect_Reflection_getCallerClass__; +text: .text%Java_sun_reflect_Reflection_getCallerClass__I; text: .text%Java_java_lang_Class_forName0; text: .text%Java_java_lang_Object_getClass; text: .text%Java_sun_reflect_Reflection_getClassAccessFlags; diff --git a/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 b/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 index 8e6d249a440..fe80fca8b59 100644 --- a/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 +++ b/jdk/makefiles/mapfiles/libjava/reorder-sparcv9 @@ -26,7 +26,8 @@ text: .text%Java_java_io_FileInputStream_initIDs; text: .text%Java_java_io_FileDescriptor_initIDs; text: .text%Java_java_io_FileOutputStream_initIDs; text: .text%Java_java_lang_System_setIn0; -text: .text%Java_sun_reflect_Reflection_getCallerClass; +text: .text%Java_sun_reflect_Reflection_getCallerClass__; +text: .text%Java_sun_reflect_Reflection_getCallerClass__I; text: .text%Java_java_lang_Class_forName0; text: .text%Java_java_lang_String_intern; text: .text%Java_java_lang_Float_floatToIntBits; diff --git a/jdk/makefiles/mapfiles/libjava/reorder-x86 b/jdk/makefiles/mapfiles/libjava/reorder-x86 index ff4836f4612..839ee50caa8 100644 --- a/jdk/makefiles/mapfiles/libjava/reorder-x86 +++ b/jdk/makefiles/mapfiles/libjava/reorder-x86 @@ -28,7 +28,8 @@ text: .text%Java_java_io_FileInputStream_initIDs; text: .text%Java_java_io_FileDescriptor_initIDs; text: .text%Java_java_io_FileOutputStream_initIDs; text: .text%Java_java_lang_System_setIn0; -text: .text%Java_sun_reflect_Reflection_getCallerClass; +text: .text%Java_sun_reflect_Reflection_getCallerClass__; +text: .text%Java_sun_reflect_Reflection_getCallerClass__I; text: .text%Java_java_lang_Class_forName0; text: .text%Java_java_lang_String_intern; text: .text%Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0; diff --git a/jdk/src/share/classes/sun/reflect/Reflection.java b/jdk/src/share/classes/sun/reflect/Reflection.java index a57b89b2b1d..63baa42abae 100644 --- a/jdk/src/share/classes/sun/reflect/Reflection.java +++ b/jdk/src/share/classes/sun/reflect/Reflection.java @@ -57,6 +57,14 @@ public class Reflection { @CallerSensitive public static native Class getCallerClass(); + /** + * @deprecated This method will be removed in JDK 9. + * This method is a private JDK API and retained temporarily for + * existing code to run until a replacement API is defined. + */ + @Deprecated + public static native Class getCallerClass(int depth); + /** Retrieves the access flags written to the class file. For inner classes these flags may differ from those returned by Class.getModifiers(), which searches the InnerClasses diff --git a/jdk/src/share/javavm/export/jvm.h b/jdk/src/share/javavm/export/jvm.h index caec0b9306f..46bf75ae57c 100644 --- a/jdk/src/share/javavm/export/jvm.h +++ b/jdk/src/share/javavm/export/jvm.h @@ -351,7 +351,7 @@ JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim); * java.lang.Class and java.lang.ClassLoader */ -#define JVM_DEPTH -1 +#define JVM_CALLER_DEPTH -1 /* * Returns the immediate caller class of the native method invoking diff --git a/jdk/src/share/native/sun/reflect/Reflection.c b/jdk/src/share/native/sun/reflect/Reflection.c index 46cfa570e1c..8da4101b8b1 100644 --- a/jdk/src/share/native/sun/reflect/Reflection.c +++ b/jdk/src/share/native/sun/reflect/Reflection.c @@ -26,10 +26,16 @@ #include "jvm.h" #include "sun_reflect_Reflection.h" -JNIEXPORT jclass JNICALL Java_sun_reflect_Reflection_getCallerClass +JNIEXPORT jclass JNICALL Java_sun_reflect_Reflection_getCallerClass__ (JNIEnv *env, jclass unused) { - return JVM_GetCallerClass(env, JVM_DEPTH); // JVM_DEPTH is only the expected value + return JVM_GetCallerClass(env, JVM_CALLER_DEPTH); +} + +JNIEXPORT jclass JNICALL Java_sun_reflect_Reflection_getCallerClass__I +(JNIEnv *env, jclass unused, jint depth) +{ + return JVM_GetCallerClass(env, depth); } JNIEXPORT jint JNICALL Java_sun_reflect_Reflection_getClassAccessFlags diff --git a/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java b/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java new file mode 100644 index 00000000000..33eefd54875 --- /dev/null +++ b/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2013, 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. + */ + +/* + * @test + * @bug 8025799 + * @summary sun.reflect.Reflection.getCallerClass(int) + * @run main GetCallerClassWithDepth + */ + +public class GetCallerClassWithDepth { + public static void main(String[] args) throws Exception { + Class c = Test.test(); + assertEquals(c, GetCallerClassWithDepth.class); + Class caller = Test.caller(); + assertEquals(caller, GetCallerClassWithDepth.class); + Test.selfTest(); + + try { + sun.reflect.Reflection.getCallerClass(-1); + throw new RuntimeException("getCallerClass(-1) should fail"); + } catch (Error e) { + System.out.println("Expected: " + e.getMessage()); + } + } + + public Class getCallerClass() { + // 0: Reflection 1: getCallerClass 2: Test.test 3: main + return sun.reflect.Reflection.getCallerClass(3); + } + + static void assertEquals(Class c, Class expected) { + if (c != expected) { + throw new RuntimeException("Incorrect caller: " + c); + } + } + + static class Test { + // Returns the caller of this method + public static Class test() { + return new GetCallerClassWithDepth().getCallerClass(); + } + + // Returns the caller of this method + public static Class caller() { + // 0: Reflection 1: Test.caller 2: main + return sun.reflect.Reflection.getCallerClass(2); + } + public static void selfTest() { + // 0: Reflection 1: Test.selfTest + Class c = sun.reflect.Reflection.getCallerClass(1); + assertEquals(c, Test.class); + Inner1.deep(); + } + + static class Inner1 { + static void deep() { + deeper(); + } + static void deeper() { + Inner2.deepest(); + } + static class Inner2 { + static void deepest() { + // 0: Reflection 1: deepest 2: deeper 3: deep 4: Test.selfTest + Class c = sun.reflect.Reflection.getCallerClass(4); + assertEquals(c, Test.class); + } + } + } + } +} From 31f37c1db4360688ea973a01fb724015be2d3842 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 17 Oct 2013 22:22:14 -0700 Subject: [PATCH 026/274] 8026840: Fix new doclint issues in javax.naming Reviewed-by: mchung --- .../share/classes/javax/naming/CompositeName.java | 12 ++++++------ .../share/classes/javax/naming/CompoundName.java | 4 ++-- jdk/src/share/classes/javax/naming/Context.java | 10 +++++----- .../share/classes/javax/naming/InitialContext.java | 4 ++-- .../classes/javax/naming/ReferralException.java | 4 ++-- .../classes/javax/naming/directory/DirContext.java | 14 +++++++------- .../classes/javax/naming/event/EventContext.java | 4 ++-- .../classes/javax/naming/ldap/LdapContext.java | 2 +- jdk/src/share/classes/javax/naming/ldap/Rdn.java | 3 +-- 9 files changed, 28 insertions(+), 29 deletions(-) diff --git a/jdk/src/share/classes/javax/naming/CompositeName.java b/jdk/src/share/classes/javax/naming/CompositeName.java index ffa837d4a23..7c79d529959 100644 --- a/jdk/src/share/classes/javax/naming/CompositeName.java +++ b/jdk/src/share/classes/javax/naming/CompositeName.java @@ -41,7 +41,7 @@ import java.util.Properties; * This range may be written as [0,N). * The most significant component is at index 0. * An empty composite name has no components. - *

+ * *

JNDI Composite Name Syntax

* JNDI defines a standard string representation for composite names. This * representation is the concatenation of the components of a composite name @@ -72,12 +72,12 @@ import java.util.Properties; * A trailing component separator (the composite name string ends with * a separator) denotes a trailing empty component. * Adjacent component separators denote an empty component. - *

+ * *

Composite Name Examples

*This table shows examples of some composite names. Each row shows *the string form of a composite name and its corresponding structural form *(CompositeName). - *

+ * @@ -136,7 +136,7 @@ import java.util.Properties;
{"x", "", "y"}
- *

+ * *

Composition Examples

* Here are some composition examples. The right column shows composing * string composite names while the left column shows composing the @@ -144,7 +144,7 @@ import java.util.Properties; * string forms of two composite names simply involves concatenating * their string forms together. -

+
@@ -188,7 +188,7 @@ import java.util.Properties;
String Names
- *

+ * *

Multithreaded Access

* A CompositeName instance is not synchronized against concurrent * multithreaded access. Multiple threads trying to access and modify a diff --git a/jdk/src/share/classes/javax/naming/CompoundName.java b/jdk/src/share/classes/javax/naming/CompoundName.java index 49269e6bc4a..6d41cf861e4 100644 --- a/jdk/src/share/classes/javax/naming/CompoundName.java +++ b/jdk/src/share/classes/javax/naming/CompoundName.java @@ -38,7 +38,7 @@ import java.util.Properties; * This range may be written as [0,N). * The most significant component is at index 0. * An empty compound name has no components. - *

+ * *

Compound Name Syntax

* The syntax of a compound name is specified using a set of properties: *
@@ -135,7 +135,7 @@ import java.util.Properties; * applied (e.g. embedded separators are escaped or quoted) * so that when the same string is parsed, it will yield the same components * of the original compound name. - *

+ * *

Multithreaded Access

* A CompoundName instance is not synchronized against concurrent * multithreaded access. Multiple threads trying to access and modify a diff --git a/jdk/src/share/classes/javax/naming/Context.java b/jdk/src/share/classes/javax/naming/Context.java index 36040e70fe3..db2acbde8d3 100644 --- a/jdk/src/share/classes/javax/naming/Context.java +++ b/jdk/src/share/classes/javax/naming/Context.java @@ -31,7 +31,7 @@ import java.util.Hashtable; * This interface represents a naming context, which * consists of a set of name-to-object bindings. * It contains methods for examining and updating these bindings. - *

+ * *

Names

* Each name passed as an argument to a Context method is relative * to that context. The empty name is used to name the context itself. @@ -68,12 +68,12 @@ import java.util.Hashtable; * NamingEnumeration may be names in their own namespace rather than * names in a composite namespace, at the discretion of the service * provider. - *

+ * *

Exceptions

* All the methods in this interface can throw a NamingException or * any of its subclasses. See NamingException and their subclasses * for details on each exception. - *

+ * *

Concurrent Access

* A Context instance is not guaranteed to be synchronized against * concurrent access by multiple threads. Threads that need to access @@ -90,7 +90,7 @@ import java.util.Hashtable; * use, or while any referrals generated by that operation are still * being followed. * - *

+ * *

Parameters

* A Name parameter passed to any method of the * Context interface or one of its subinterfaces @@ -102,7 +102,7 @@ import java.util.Hashtable; * A Name returned by any such method is owned by the caller. * The caller may subsequently modify it; the service provider may not. * - *

+ * *

Environment Properties

*

* JNDI applications need a way to communicate various preferences diff --git a/jdk/src/share/classes/javax/naming/InitialContext.java b/jdk/src/share/classes/javax/naming/InitialContext.java index 6a10cf6ce72..7d5b6b45374 100644 --- a/jdk/src/share/classes/javax/naming/InitialContext.java +++ b/jdk/src/share/classes/javax/naming/InitialContext.java @@ -361,7 +361,7 @@ public class InitialContext implements Context { * follows. * Define a new method that uses this method to get an initial * context of the desired subclass. - *

+     * 
      * protected XXXContext getURLOrDefaultInitXXXCtx(Name name)
      * throws NamingException {
      *  Context answer = getURLOrDefaultInitCtx(name);
@@ -377,7 +377,7 @@ public class InitialContext implements Context {
      * 
* When providing implementations for the new methods in the subclass, * use this newly defined method to get the initial context. - *

+     * 
      * public Object XXXMethod1(Name name, ...) {
      *  throws NamingException {
      *    return getURLOrDefaultInitXXXCtx(name).XXXMethod1(name, ...);
diff --git a/jdk/src/share/classes/javax/naming/ReferralException.java b/jdk/src/share/classes/javax/naming/ReferralException.java
index 23d77cf3c65..7d3eaf3a849 100644
--- a/jdk/src/share/classes/javax/naming/ReferralException.java
+++ b/jdk/src/share/classes/javax/naming/ReferralException.java
@@ -156,7 +156,7 @@ public abstract class ReferralException extends NamingException {
      * getReferralContext to allow the processing of
      * other referrals to continue.
      * The following code fragment shows a typical usage pattern.
-     * 

+     * 
      *  } catch (ReferralException e) {
      *      if (!shallIFollow(e.getReferralInfo())) {
      *          if (!e.skipReferral()) {
@@ -177,7 +177,7 @@ public abstract class ReferralException extends NamingException {
      * getReferralContext to allow the current
      * referral to be retried.
      * The following code fragment shows a typical usage pattern.
-     * 

+     * 
      *  } catch (ReferralException e) {
      *      while (true) {
      *          try {
diff --git a/jdk/src/share/classes/javax/naming/directory/DirContext.java b/jdk/src/share/classes/javax/naming/directory/DirContext.java
index e3728792c58..903ccbea421 100644
--- a/jdk/src/share/classes/javax/naming/directory/DirContext.java
+++ b/jdk/src/share/classes/javax/naming/directory/DirContext.java
@@ -31,7 +31,7 @@ import javax.naming.*;
  * The directory service interface, containing
  * methods for examining and updating attributes
  * associated with objects, and for searching the directory.
- * 

+ * *

Names

* Each name passed as an argument to a DirContext method is relative * to that context. The empty name is used to name the context itself. @@ -50,7 +50,7 @@ import javax.naming.*; * See Context for a discussion on the interpretation of the * name argument to the Context methods. These same rules * apply to the name argument to the DirContext methods. - *

+ * *

Attribute Models

* There are two basic models of what attributes should be * associated with. First, attributes may be directly associated with a @@ -80,7 +80,7 @@ import javax.naming.*; * JNDI clients are safest when they do not make assumptions about * whether an object's attributes are stored as part of the object, or stored * within the parent object and associated with the object's name. - *

+ * *

Attribute Type Names

* In the getAttributes() and search() methods, * you can supply the attributes to return by supplying a list of @@ -112,7 +112,7 @@ import javax.naming.*; *
  • description;lang-fr * * - *

    + * *

    Operational Attributes

    *

    * Some directories have the notion of "operational attributes" which are @@ -126,7 +126,7 @@ import javax.naming.*; * The attributes returned do not include operational attributes. * In order to retrieve operational attributes, you must name them explicitly. * - *

    + * *

    Named Context

    *

    * There are certain methods in which the name must resolve to a context @@ -137,7 +137,7 @@ import javax.naming.*; * NotContextException is thrown. * Aside from these methods, there is no requirement that the * named object be a DirContext. - *

    + * *

    Parameters

    *

    * An Attributes, SearchControls, or array object @@ -149,7 +149,7 @@ import javax.naming.*; * An Attributes object returned by any method is owned by * the caller. The caller may subsequently modify it; the service * provider will not. - *

    + * *

    Exceptions

    *

    * All the methods in this interface can throw a NamingException or diff --git a/jdk/src/share/classes/javax/naming/event/EventContext.java b/jdk/src/share/classes/javax/naming/event/EventContext.java index fd44876475b..aacf161ebbe 100644 --- a/jdk/src/share/classes/javax/naming/event/EventContext.java +++ b/jdk/src/share/classes/javax/naming/event/EventContext.java @@ -33,7 +33,7 @@ import javax.naming.NamingException; /** * Contains methods for registering/deregistering listeners to be notified of * events fired when objects named in a context changes. - *

    + * *

    Target

    * The name parameter in the addNamingListener() methods is referred * to as the target. The target, along with the scope, identify @@ -58,7 +58,7 @@ import javax.naming.NamingException; * An application can use the method targetMustExist() to check * whether a EventContext supports registration * of nonexistent targets. - *

    + * *

    Event Source

    * The EventContext instance on which you invoke the * registration methods is the event source of the events that are diff --git a/jdk/src/share/classes/javax/naming/ldap/LdapContext.java b/jdk/src/share/classes/javax/naming/ldap/LdapContext.java index 8cb5fb0be01..ef92b1c49ba 100644 --- a/jdk/src/share/classes/javax/naming/ldap/LdapContext.java +++ b/jdk/src/share/classes/javax/naming/ldap/LdapContext.java @@ -338,7 +338,7 @@ public interface LdapContext extends DirContext { * parameter, a system property, or one or more resource files. *

    * The value of this constant is "java.naming.factory.control". - *

    + * * @see ControlFactory * @see javax.naming.Context#addToEnvironment * @see javax.naming.Context#removeFromEnvironment diff --git a/jdk/src/share/classes/javax/naming/ldap/Rdn.java b/jdk/src/share/classes/javax/naming/ldap/Rdn.java index b9f305ee83b..93ebf339914 100644 --- a/jdk/src/share/classes/javax/naming/ldap/Rdn.java +++ b/jdk/src/share/classes/javax/naming/ldap/Rdn.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, 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 @@ -315,7 +315,6 @@ public class Rdn implements Serializable, Comparable { * @return A negative integer, zero, or a positive integer as this Rdn * is less than, equal to, or greater than the given Object. * @exception ClassCastException if obj is null or not a Rdn. - *

    */ public int compareTo(Object obj) { if (!(obj instanceof Rdn)) { From 73ccbeb833d2ce82fead226ec14def37f597233c Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Thu, 17 Oct 2013 23:43:08 -0700 Subject: [PATCH 027/274] 8025971: Remove ZoneId.OLD_SHORT_IDS 8026197: Slow reading tzdb.dat if the JRE is on a high-latency, remote file system Removed the compatiblity old short-ids mapping Reviewed-by: okutsu --- jdk/src/share/classes/java/time/ZoneId.java | 119 +++++------------- .../java/time/zone/TzdbZoneRulesProvider.java | 4 +- jdk/src/share/classes/java/util/TimeZone.java | 11 +- .../sun/util/calendar/ZoneInfoFile.java | 8 +- .../java/time/tck/java/time/TCKZoneId.java | 41 ------ jdk/test/java/util/Calendar/JavatimeTest.java | 4 +- 6 files changed, 56 insertions(+), 131 deletions(-) diff --git a/jdk/src/share/classes/java/time/ZoneId.java b/jdk/src/share/classes/java/time/ZoneId.java index 42f390937fb..aabc7fce93b 100644 --- a/jdk/src/share/classes/java/time/ZoneId.java +++ b/jdk/src/share/classes/java/time/ZoneId.java @@ -168,51 +168,6 @@ import java.util.TimeZone; */ public abstract class ZoneId implements Serializable { - /** - * A map of zone overrides to enable the older short time-zone names to be used. - *

    - * Use of short zone IDs has been deprecated in {@code java.util.TimeZone}. - * This map allows the IDs to continue to be used via the - * {@link #of(String, Map)} factory method. - *

    - * This map contains an older mapping of the IDs, where 'EST', 'MST' and 'HST' - * map to IDs which include daylight savings. - * This is in line with versions of TZDB before 2005r. - *

    - * This maps as follows: - *

      - *
    • EST - America/New_York
    • - *
    • MST - America/Denver
    • - *
    • HST - Pacific/Honolulu
    • - *
    • ACT - Australia/Darwin
    • - *
    • AET - Australia/Sydney
    • - *
    • AGT - America/Argentina/Buenos_Aires
    • - *
    • ART - Africa/Cairo
    • - *
    • AST - America/Anchorage
    • - *
    • BET - America/Sao_Paulo
    • - *
    • BST - Asia/Dhaka
    • - *
    • CAT - Africa/Harare
    • - *
    • CNT - America/St_Johns
    • - *
    • CST - America/Chicago
    • - *
    • CTT - Asia/Shanghai
    • - *
    • EAT - Africa/Addis_Ababa
    • - *
    • ECT - Europe/Paris
    • - *
    • IET - America/Indiana/Indianapolis
    • - *
    • IST - Asia/Kolkata
    • - *
    • JST - Asia/Tokyo
    • - *
    • MIT - Pacific/Apia
    • - *
    • NET - Asia/Yerevan
    • - *
    • NST - Pacific/Auckland
    • - *
    • PLT - Asia/Karachi
    • - *
    • PNT - America/Phoenix
    • - *
    • PRT - America/Puerto_Rico
    • - *
    • PST - America/Los_Angeles
    • - *
    • SST - Pacific/Guadalcanal
    • - *
    • VST - Asia/Ho_Chi_Minh
    • - *
    - * The map is unmodifiable. - */ - public static final Map OLD_SHORT_IDS; /** * A map of zone overrides to enable the short time-zone names to be used. *

    @@ -220,9 +175,9 @@ public abstract class ZoneId implements Serializable { * This map allows the IDs to continue to be used via the * {@link #of(String, Map)} factory method. *

    - * This map contains a newer mapping of the IDs, where 'EST', 'MST' and 'HST' - * map to IDs which do not include daylight savings - * This is in line with TZDB 2005r and later. + * This map contains a mapping of the IDs that is in line with TZDB 2005r and + * later, where 'EST', 'MST' and 'HST' map to IDs which do not include daylight + * savings. *

    * This maps as follows: *

    * @param in the data to read, not null */ diff --git a/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java index 04192dab890..79cb5c8d594 100644 --- a/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java +++ b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java @@ -191,7 +191,7 @@ public final class ZoneOffsetTransition * out.writeByte(2); // identifies a ZoneOffsetTransition * out.writeEpochSec(toEpochSecond); * out.writeOffset(offsetBefore); - * out.writeOfset(offsetAfter); + * out.writeOffset(offsetAfter); * } * * @return the replacing object, not null diff --git a/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java index 371014f5e5c..f2ff1afbb8a 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java @@ -59,9 +59,6 @@ */ package tck.java.time.serial; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import tck.java.time.AbstractTCKTest; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; @@ -69,6 +66,10 @@ import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.ZoneOffset; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import tck.java.time.AbstractTCKTest; + /** * Test OffsetDateTime serialization. */ @@ -96,11 +97,6 @@ public class TCKOffsetDateTimeSerialization extends AbstractTCKTest { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(baos) ) { dos.writeByte(10); // java.time.Ser.OFFSET_DATE_TIME_TYPE - } - byte[] bytes = baos.toByteArray(); - ByteArrayOutputStream baosDateTime = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baosDateTime) ) { - dos.writeByte(5); dos.writeInt(2012); dos.writeByte(9); dos.writeByte(16); @@ -108,17 +104,11 @@ public class TCKOffsetDateTimeSerialization extends AbstractTCKTest { dos.writeByte(17); dos.writeByte(59); dos.writeInt(464_000_000); - } - byte[] bytesDateTime = baosDateTime.toByteArray(); - ByteArrayOutputStream baosOffset = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baosOffset) ) { - dos.writeByte(8); dos.writeByte(4); // quarter hours stored: 3600 / 900 } - byte[] bytesOffset = baosOffset.toByteArray(); + byte[] bytes = baos.toByteArray(); LocalDateTime ldt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 464_000_000); - assertSerializedBySer(OffsetDateTime.of(ldt, ZoneOffset.ofHours(1)), bytes, bytesDateTime, bytesOffset); + assertSerializedBySer(OffsetDateTime.of(ldt, ZoneOffset.ofHours(1)), bytes); } - } diff --git a/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java index ee04e1e298f..292ef82d142 100644 --- a/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java +++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java @@ -97,25 +97,14 @@ public class TCKOffsetTimeSerialization extends AbstractTCKTest { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(baos) ) { dos.writeByte(9); // java.time.Ser.OFFSET_TIME_TYPE - } - byte[] bytes = baos.toByteArray(); - ByteArrayOutputStream baosTime = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baosTime) ) { - dos.writeByte(4); dos.writeByte(22); dos.writeByte(17); dos.writeByte(59); dos.writeInt(464_000_000); - } - byte[] bytesTime = baosTime.toByteArray(); - ByteArrayOutputStream baosOffset = new ByteArrayOutputStream(); - try (DataOutputStream dos = new DataOutputStream(baosOffset) ) { - dos.writeByte(8); dos.writeByte(4); // quarter hours stored: 3600 / 900 } - byte[] bytesOffset = baosOffset.toByteArray(); - assertSerializedBySer(OffsetTime.of(22, 17, 59, 464_000_000, ZoneOffset.ofHours(1)), bytes, - bytesTime, bytesOffset); + byte[] bytes = baos.toByteArray(); + assertSerializedBySer(OffsetTime.of(22, 17, 59, 464_000_000, ZoneOffset.ofHours(1)), bytes); } From fbd299b074f3cc5c3a1f48ea9848fbf7d8a288d0 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 22 Oct 2013 12:04:30 -0700 Subject: [PATCH 066/274] 8027062: Fix lint and doclint issues in java.lang.{ClassLoader, ClassValue, SecurityManager} Reviewed-by: chegar, forax, alanb, mduigou --- jdk/src/share/classes/java/lang/ClassLoader.java | 4 ++-- jdk/src/share/classes/java/lang/ClassValue.java | 2 +- jdk/src/share/classes/java/lang/SecurityManager.java | 11 +++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/jdk/src/share/classes/java/lang/ClassLoader.java b/jdk/src/share/classes/java/lang/ClassLoader.java index 7aa5087ad2f..875f5ec8e97 100644 --- a/jdk/src/share/classes/java/lang/ClassLoader.java +++ b/jdk/src/share/classes/java/lang/ClassLoader.java @@ -362,7 +362,7 @@ public abstract class ClassLoader { * default implementation of this method searches for classes in the * following order: * - *

      + *
        * *
      1. Invoke {@link #findLoadedClass(String)} to check if the class * has already been loaded.

      2. @@ -488,7 +488,7 @@ public abstract class ClassLoader { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { if (ReflectUtil.isNonPublicProxyClass(cls)) { - for (Class intf: cls.getInterfaces()) { + for (Class intf: cls.getInterfaces()) { checkPackageAccess(intf, pd); } return; diff --git a/jdk/src/share/classes/java/lang/ClassValue.java b/jdk/src/share/classes/java/lang/ClassValue.java index be190c0d4eb..676c2eccb30 100644 --- a/jdk/src/share/classes/java/lang/ClassValue.java +++ b/jdk/src/share/classes/java/lang/ClassValue.java @@ -692,7 +692,7 @@ public abstract class ClassValue { /** Remove all stale entries, everywhere. */ private void removeStaleEntries() { - Entry[] cache = getCache(); + Entry[] cache = getCache(); removeStaleEntries(cache, 0, cache.length + PROBE_LIMIT - 1); } diff --git a/jdk/src/share/classes/java/lang/SecurityManager.java b/jdk/src/share/classes/java/lang/SecurityManager.java index 3565082033c..635f6db093e 100644 --- a/jdk/src/share/classes/java/lang/SecurityManager.java +++ b/jdk/src/share/classes/java/lang/SecurityManager.java @@ -56,7 +56,7 @@ import sun.security.util.SecurityConstants; * are called by various methods in the Java libraries before those * methods perform certain potentially sensitive operations. The * invocation of such a check method typically looks like this: - *

        + * 
          *     SecurityManager security = System.getSecurityManager();
          *     if (security != null) {
          *         security.checkXXX(argument,  . . . );
        @@ -323,7 +323,7 @@ class SecurityManager {
              * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
              * 

        * This method will return - * null in the following three cases:

        + * null in the following three cases: *

          *
        1. All methods on the execution stack are from classes * defined using the system class loader or one of its ancestors. @@ -370,7 +370,7 @@ class SecurityManager { * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. *

          * This method will return - * null in the following three cases:

          + * null in the following three cases: *

            *
          1. All methods on the execution stack are from classes * defined using the system class loader or one of its ancestors. @@ -429,7 +429,7 @@ class SecurityManager { * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. *

            * This method will return - * -1 in the following three cases:

            + * -1 in the following three cases: *

              *
            1. All methods on the execution stack are from classes * defined using the system class loader or one of its ancestors. @@ -1281,7 +1281,6 @@ class SecurityManager { * This method calls checkPermission with the * PropertyPermission(key, "read") permission. *

              - *

              * If you override this method, then you should make a call to * super.checkPropertyAccess * at the point the overridden method would normally throw an @@ -1714,7 +1713,7 @@ class SecurityManager { throw new NullPointerException("class can't be null"); } if (which != Member.PUBLIC) { - Class stack[] = getClassContext(); + Class stack[] = getClassContext(); /* * stack depth of 4 should be the caller of one of the * methods in java.lang.Class that invoke checkMember From 93dcac6266b5e8aa82c4f4093784c7b01910a2a3 Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Tue, 22 Oct 2013 17:02:08 -0400 Subject: [PATCH 067/274] 8026982: javadoc errors in core libs Cleanup of javadoc -Xlint errors Reviewed-by: lancea, mduigou, darcy, mullan, mchung --- .../classes/java/io/ByteArrayInputStream.java | 1 - .../java/io/ByteArrayOutputStream.java | 2 - jdk/src/share/classes/java/io/DataInput.java | 58 +++++++-------- jdk/src/share/classes/java/io/DataOutput.java | 70 +++++++++---------- .../share/classes/java/io/FilePermission.java | 8 +-- .../share/classes/java/io/InputStream.java | 3 +- .../classes/java/io/ObjectInputStream.java | 2 +- .../classes/java/io/PipedInputStream.java | 7 +- .../share/classes/java/io/PipedReader.java | 7 +- .../classes/java/io/RandomAccessFile.java | 2 +- .../share/classes/java/io/Serializable.java | 8 +-- .../java/io/SerializablePermission.java | 1 - .../java/lang/AbstractStringBuilder.java | 30 ++++---- .../java/lang/ArrayStoreException.java | 2 +- jdk/src/share/classes/java/lang/Byte.java | 2 +- .../share/classes/java/lang/Character.java | 12 ++-- jdk/src/share/classes/java/lang/Class.java | 4 +- .../classes/java/lang/ClassCastException.java | 2 +- jdk/src/share/classes/java/lang/Double.java | 8 --- jdk/src/share/classes/java/lang/Float.java | 8 --- jdk/src/share/classes/java/lang/Integer.java | 2 +- jdk/src/share/classes/java/lang/Iterable.java | 1 - jdk/src/share/classes/java/lang/Long.java | 2 +- .../classes/java/lang/RuntimePermission.java | 1 - jdk/src/share/classes/java/lang/Short.java | 2 +- jdk/src/share/classes/java/lang/String.java | 10 +-- jdk/src/share/classes/java/lang/Thread.java | 8 +-- .../lang/management/ManagementFactory.java | 2 +- .../lang/management/ManagementPermission.java | 4 +- .../java/lang/management/MemoryUsage.java | 4 +- .../classes/java/lang/management/package.html | 4 +- .../java/lang/reflect/ReflectPermission.java | 1 - .../classes/java/net/DatagramSocket.java | 4 +- .../share/classes/java/net/Inet6Address.java | 6 +- .../classes/java/net/MulticastSocket.java | 2 +- .../share/classes/java/net/NetPermission.java | 1 - jdk/src/share/classes/java/net/Proxy.java | 4 +- jdk/src/share/classes/java/net/Socket.java | 6 +- .../share/classes/java/net/SocketOptions.java | 6 +- .../classes/java/net/SocketPermission.java | 18 ++--- jdk/src/share/classes/java/net/URI.java | 6 +- .../share/classes/java/net/URLConnection.java | 2 +- .../share/classes/java/net/URLDecoder.java | 2 +- .../share/classes/java/net/URLEncoder.java | 1 - .../share/classes/java/net/URLPermission.java | 6 +- .../share/classes/java/net/package-info.java | 6 +- .../classes/java/nio/X-Buffer.java.template | 2 +- .../classes/java/nio/file/FileSystem.java | 2 +- .../java/rmi/activation/ActivationGroup.java | 6 +- jdk/src/share/classes/java/rmi/dgc/VMID.java | 2 +- .../java/rmi/server/UnicastRemoteObject.java | 6 +- .../java/security/AccessController.java | 4 +- .../security/AlgorithmParameterGenerator.java | 2 +- .../java/security/BasicPermission.java | 5 +- .../classes/java/security/CodeSource.java | 4 +- jdk/src/share/classes/java/security/Key.java | 5 +- .../java/security/KeyPairGenerator.java | 1 - .../share/classes/java/security/KeyStore.java | 1 - .../classes/java/security/MessageDigest.java | 28 ++++---- .../classes/java/security/Permission.java | 4 +- .../java/security/PermissionCollection.java | 1 - .../java/security/SecurityPermission.java | 2 - .../classes/java/security/Signature.java | 6 +- .../classes/java/security/SignedObject.java | 4 +- .../share/classes/java/security/acl/Acl.java | 14 ++-- .../security/cert/CertificateFactory.java | 4 +- .../security/cert/PKIXRevocationChecker.java | 2 +- .../security/cert/PolicyQualifierInfo.java | 2 +- .../java/security/cert/TrustAnchor.java | 1 - .../java/security/cert/X509CertSelector.java | 4 +- .../interfaces/DSAKeyPairGenerator.java | 4 +- .../classes/java/text/MessageFormat.java | 6 +- .../share/classes/java/text/Normalizer.java | 8 +-- .../classes/java/text/SimpleDateFormat.java | 1 - jdk/src/share/classes/java/util/Base64.java | 1 - jdk/src/share/classes/java/util/BitSet.java | 4 +- jdk/src/share/classes/java/util/Deque.java | 3 - jdk/src/share/classes/java/util/Locale.java | 4 +- .../share/classes/java/util/Properties.java | 7 +- .../classes/java/util/PropertyPermission.java | 9 ++- jdk/src/share/classes/java/util/Queue.java | 1 - .../classes/java/util/ResourceBundle.java | 1 - jdk/src/share/classes/java/util/Scanner.java | 1 - jdk/src/share/classes/java/util/TimeZone.java | 2 +- jdk/src/share/classes/java/util/UUID.java | 4 +- .../java/util/concurrent/BlockingDeque.java | 2 - .../java/util/concurrent/BlockingQueue.java | 1 - .../classes/java/util/concurrent/Future.java | 4 +- .../locks/ReentrantReadWriteLock.java | 1 - .../share/classes/java/util/jar/Pack200.java | 2 +- .../classes/java/util/logging/Logger.java | 2 +- .../classes/java/util/regex/Pattern.java | 2 +- .../java/util/spi/LocaleServiceProvider.java | 2 +- 93 files changed, 236 insertions(+), 296 deletions(-) diff --git a/jdk/src/share/classes/java/io/ByteArrayInputStream.java b/jdk/src/share/classes/java/io/ByteArrayInputStream.java index e58c6e64a64..ce0b8d1f183 100644 --- a/jdk/src/share/classes/java/io/ByteArrayInputStream.java +++ b/jdk/src/share/classes/java/io/ByteArrayInputStream.java @@ -275,7 +275,6 @@ class ByteArrayInputStream extends InputStream { * Closing a ByteArrayInputStream has no effect. The methods in * this class can be called after the stream has been closed without * generating an IOException. - *

              */ public void close() throws IOException { } diff --git a/jdk/src/share/classes/java/io/ByteArrayOutputStream.java b/jdk/src/share/classes/java/io/ByteArrayOutputStream.java index d28d397b31c..cd3c139a27e 100644 --- a/jdk/src/share/classes/java/io/ByteArrayOutputStream.java +++ b/jdk/src/share/classes/java/io/ByteArrayOutputStream.java @@ -263,8 +263,6 @@ public class ByteArrayOutputStream extends OutputStream { * Closing a ByteArrayOutputStream has no effect. The methods in * this class can be called after the stream has been closed without * generating an IOException. - *

              - * */ public void close() throws IOException { } diff --git a/jdk/src/share/classes/java/io/DataInput.java b/jdk/src/share/classes/java/io/DataInput.java index 58a3a2bfd3f..c61aeb58eda 100644 --- a/jdk/src/share/classes/java/io/DataInput.java +++ b/jdk/src/share/classes/java/io/DataInput.java @@ -155,7 +155,7 @@ interface DataInput { * to the length of {@code b}. *

              * This method blocks until one of the - * following conditions occurs:

              + * following conditions occurs: *

                *
              • {@code b.length} * bytes of input data are available, in which @@ -197,7 +197,7 @@ interface DataInput { *

                * This method * blocks until one of the following conditions - * occurs:

                + * occurs: *

                  *
                • {@code len} bytes * of input data are available, in which case @@ -316,8 +316,8 @@ interface DataInput { * be the second byte. The value * returned * is: - *

                  (short)((a << 8) | (b & 0xff))
                  -     * 
                  + *
                  {@code (short)((a << 8) | (b & 0xff))
                  +     * }
                  * This method * is suitable for reading the bytes written * by the {@code writeShort} method of @@ -337,8 +337,8 @@ interface DataInput { * be the first byte read and * {@code b} * be the second byte. The value returned is: - *

                  (((a & 0xff) << 8) | (b & 0xff))
                  -     * 
                  + *
                  {@code (((a & 0xff) << 8) | (b & 0xff))
                  +     * }
                  * This method is suitable for reading the bytes * written by the {@code writeShort} method * of interface {@code DataOutput} if @@ -359,8 +359,8 @@ interface DataInput { * be the first byte read and {@code b} * be the second byte. The value * returned is: - *

                  (char)((a << 8) | (b & 0xff))
                  -     * 
                  + *
                  {@code (char)((a << 8) | (b & 0xff))
                  +     * }
                  * This method * is suitable for reading bytes written by * the {@code writeChar} method of interface @@ -377,10 +377,10 @@ interface DataInput { * Reads four input bytes and returns an * {@code int} value. Let {@code a-d} * be the first through fourth bytes read. The value returned is: - *

                  
                  -     * (((a & 0xff) << 24) | ((b & 0xff) << 16) |
                  -     *  ((c & 0xff) << 8) | (d & 0xff))
                  -     * 
                  + *
                  {@code
                  +     * (((a & 0xff) << 24) | ((b & 0xff) << 16) |
                  +     *  ((c & 0xff) <<  8) | (d & 0xff))
                  +     * }
                  * This method is suitable * for reading bytes written by the {@code writeInt} * method of interface {@code DataOutput}. @@ -397,16 +397,16 @@ interface DataInput { * a {@code long} value. Let {@code a-h} * be the first through eighth bytes read. * The value returned is: - *

                  
                  -     * (((long)(a & 0xff) << 56) |
                  -     *  ((long)(b & 0xff) << 48) |
                  -     *  ((long)(c & 0xff) << 40) |
                  -     *  ((long)(d & 0xff) << 32) |
                  -     *  ((long)(e & 0xff) << 24) |
                  -     *  ((long)(f & 0xff) << 16) |
                  -     *  ((long)(g & 0xff) <<  8) |
                  -     *  ((long)(h & 0xff)))
                  -     * 
                  + *
                  {@code
                  +     * (((long)(a & 0xff) << 56) |
                  +     *  ((long)(b & 0xff) << 48) |
                  +     *  ((long)(c & 0xff) << 40) |
                  +     *  ((long)(d & 0xff) << 32) |
                  +     *  ((long)(e & 0xff) << 24) |
                  +     *  ((long)(f & 0xff) << 16) |
                  +     *  ((long)(g & 0xff) <<  8) |
                  +     *  ((long)(h & 0xff)))
                  +     * }
                  *

                  * This method is suitable * for reading bytes written by the {@code writeLong} @@ -540,9 +540,9 @@ interface DataInput { * not match the bit pattern {@code 10xxxxxx}, * then a {@code UTFDataFormatException} * is thrown. Otherwise, the group is converted - * to the character:

                  - *

                  (char)(((a& 0x1F) << 6) | (b & 0x3F))
                  -     * 
                  + * to the character: + *
                  {@code (char)(((a & 0x1F) << 6) | (b & 0x3F))
                  +     * }
                  * If the first byte of a group * matches the bit pattern {@code 1110xxxx}, * then the group consists of that byte {@code a} @@ -554,10 +554,10 @@ interface DataInput { * does not match the bit pattern {@code 10xxxxxx}, * then a {@code UTFDataFormatException} * is thrown. Otherwise, the group is converted - * to the character:

                  - *

                  
                  -     * (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
                  -     * 
                  + * to the character: + *
                  {@code
                  +     * (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
                  +     * }
                  * If the first byte of a group matches the * pattern {@code 1111xxxx} or the pattern * {@code 10xxxxxx}, then a {@code UTFDataFormatException} diff --git a/jdk/src/share/classes/java/io/DataOutput.java b/jdk/src/share/classes/java/io/DataOutput.java index 07fbc3a927d..ce909d10238 100644 --- a/jdk/src/share/classes/java/io/DataOutput.java +++ b/jdk/src/share/classes/java/io/DataOutput.java @@ -134,11 +134,11 @@ interface DataOutput { * Writes two bytes to the output * stream to represent the value of the argument. * The byte values to be written, in the order - * shown, are:

                  - *

                  
                  -     * (byte)(0xff & (v >> 8))
                  -     * (byte)(0xff & v)
                  -     *  

                  + * shown, are: + *

                  {@code
                  +     * (byte)(0xff & (v >> 8))
                  +     * (byte)(0xff & v)
                  +     * }

                  * The bytes written by this method may be * read by the readShort method * of interface DataInput , which @@ -156,10 +156,10 @@ interface DataOutput { * output stream. * The byte values to be written, in the order * shown, are: - *

                  
                  -     * (byte)(0xff & (v >> 8))
                  -     * (byte)(0xff & v)
                  -     * 

                  + *

                  {@code
                  +     * (byte)(0xff & (v >> 8))
                  +     * (byte)(0xff & v)
                  +     * }

                  * The bytes written by this method may be * read by the readChar method * of interface DataInput , which @@ -176,12 +176,12 @@ interface DataOutput { * comprised of four bytes, to the output stream. * The byte values to be written, in the order * shown, are: - *

                  
                  -     * (byte)(0xff & (v >> 24))
                  -     * (byte)(0xff & (v >> 16))
                  -     * (byte)(0xff & (v >>    8))
                  -     * (byte)(0xff & v)
                  -     * 

                  + *

                  {@code
                  +     * (byte)(0xff & (v >> 24))
                  +     * (byte)(0xff & (v >> 16))
                  +     * (byte)(0xff & (v >>  8))
                  +     * (byte)(0xff & v)
                  +     * }

                  * The bytes written by this method may be read * by the readInt method of interface * DataInput , which will then @@ -197,16 +197,16 @@ interface DataOutput { * comprised of eight bytes, to the output stream. * The byte values to be written, in the order * shown, are: - *

                  
                  -     * (byte)(0xff & (v >> 56))
                  -     * (byte)(0xff & (v >> 48))
                  -     * (byte)(0xff & (v >> 40))
                  -     * (byte)(0xff & (v >> 32))
                  -     * (byte)(0xff & (v >> 24))
                  -     * (byte)(0xff & (v >> 16))
                  -     * (byte)(0xff & (v >>  8))
                  -     * (byte)(0xff & v)
                  -     * 

                  + *

                  {@code
                  +     * (byte)(0xff & (v >> 56))
                  +     * (byte)(0xff & (v >> 48))
                  +     * (byte)(0xff & (v >> 40))
                  +     * (byte)(0xff & (v >> 32))
                  +     * (byte)(0xff & (v >> 24))
                  +     * (byte)(0xff & (v >> 16))
                  +     * (byte)(0xff & (v >>  8))
                  +     * (byte)(0xff & v)
                  +     * }

                  * The bytes written by this method may be * read by the readLong method * of interface DataInput , which @@ -314,24 +314,24 @@ interface DataOutput { * If a character c * is in the range \u0001 through * \u007f, it is represented - * by one byte:

                  + * by one byte: *

                  (byte)c 

                  * If a character c is \u0000 * or is in the range \u0080 * through \u07ff, then it is * represented by two bytes, to be written - * in the order shown:

                  
                  -     * (byte)(0xc0 | (0x1f & (c >> 6)))
                  -     * (byte)(0x80 | (0x3f & c))
                  -     *  

                  If a character + * in the order shown:

                  {@code
                  +     * (byte)(0xc0 | (0x1f & (c >> 6)))
                  +     * (byte)(0x80 | (0x3f & c))
                  +     * }

                  If a character * c is in the range \u0800 * through uffff, then it is * represented by three bytes, to be written - * in the order shown:

                  
                  -     * (byte)(0xe0 | (0x0f & (c >> 12)))
                  -     * (byte)(0x80 | (0x3f & (c >>  6)))
                  -     * (byte)(0x80 | (0x3f & c))
                  -     *  

                  First, + * in the order shown:

                  {@code
                  +     * (byte)(0xe0 | (0x0f & (c >> 12)))
                  +     * (byte)(0x80 | (0x3f & (c >>  6)))
                  +     * (byte)(0x80 | (0x3f & c))
                  +     * }

                  First, * the total number of bytes needed to represent * all the characters of s is * calculated. If this number is larger than diff --git a/jdk/src/share/classes/java/io/FilePermission.java b/jdk/src/share/classes/java/io/FilePermission.java index e70d292e0c8..89f2c33287a 100644 --- a/jdk/src/share/classes/java/io/FilePermission.java +++ b/jdk/src/share/classes/java/io/FilePermission.java @@ -55,7 +55,7 @@ import sun.security.util.SecurityConstants; * a list of one or more comma-separated keywords. The possible keywords are * "read", "write", "execute", "delete", and "readlink". Their meaning is * defined as follows: - *

                  + * *

                  *
                  read
                  read permission *
                  write
                  write permission @@ -297,11 +297,11 @@ public final class FilePermission extends Permission implements Serializable { /** * Checks if this FilePermission object "implies" the specified permission. *

                  - * More specifically, this method returns true if:

                  + * More specifically, this method returns true if: *

                    - *
                  • p is an instanceof FilePermission,

                    + *

                  • p is an instanceof FilePermission, *
                  • p's actions are a proper subset of this - * object's actions, and

                    + * object's actions, and *

                  • p's pathname is implied by this object's * pathname. For example, "/tmp/*" implies "/tmp/foo", since * "/tmp/*" encompasses all files in the "/tmp" directory, diff --git a/jdk/src/share/classes/java/io/InputStream.java b/jdk/src/share/classes/java/io/InputStream.java index 3c7ff17f609..6c46a40a8a0 100644 --- a/jdk/src/share/classes/java/io/InputStream.java +++ b/jdk/src/share/classes/java/io/InputStream.java @@ -306,8 +306,7 @@ public abstract class InputStream implements Closeable { * *

                    The general contract of reset is: * - *

                      - * + *
                        *
                      • If the method markSupported returns * true, then: * diff --git a/jdk/src/share/classes/java/io/ObjectInputStream.java b/jdk/src/share/classes/java/io/ObjectInputStream.java index c71681c255d..15ecd9bee65 100644 --- a/jdk/src/share/classes/java/io/ObjectInputStream.java +++ b/jdk/src/share/classes/java/io/ObjectInputStream.java @@ -109,7 +109,7 @@ import sun.reflect.misc.ReflectUtil; * *

                        Serializable classes that require special handling during the * serialization and deserialization process should implement the following - * methods:

                        + * methods: * *

                          * private void writeObject(java.io.ObjectOutputStream stream)
                        diff --git a/jdk/src/share/classes/java/io/PipedInputStream.java b/jdk/src/share/classes/java/io/PipedInputStream.java
                        index af07de5b4e6..83dde31ed42 100644
                        --- a/jdk/src/share/classes/java/io/PipedInputStream.java
                        +++ b/jdk/src/share/classes/java/io/PipedInputStream.java
                        @@ -172,15 +172,14 @@ public class PipedInputStream extends InputStream {
                              * unconnected piped output stream and snk
                              * is an unconnected piped input stream, they
                              * may be connected by either the call:
                        -     * 

                        + * *

                        snk.connect(src) 
                        *

                        * or the call: - *

                        + * *

                        src.connect(snk) 
                        *

                        - * The two - * calls have the same effect. + * The two calls have the same effect. * * @param src The piped output stream to connect to. * @exception IOException if an I/O error occurs. diff --git a/jdk/src/share/classes/java/io/PipedReader.java b/jdk/src/share/classes/java/io/PipedReader.java index bb86022af6f..34716466a44 100644 --- a/jdk/src/share/classes/java/io/PipedReader.java +++ b/jdk/src/share/classes/java/io/PipedReader.java @@ -145,15 +145,14 @@ public class PipedReader extends Reader { * unconnected piped writer and snk * is an unconnected piped reader, they * may be connected by either the call: - *

                        + * *

                        snk.connect(src) 
                        *

                        * or the call: - *

                        + * *

                        src.connect(snk) 
                        *

                        - * The two - * calls have the same effect. + * The two calls have the same effect. * * @param src The piped writer to connect to. * @exception IOException if an I/O error occurs. diff --git a/jdk/src/share/classes/java/io/RandomAccessFile.java b/jdk/src/share/classes/java/io/RandomAccessFile.java index fd1c712d1e3..c48aa99b32f 100644 --- a/jdk/src/share/classes/java/io/RandomAccessFile.java +++ b/jdk/src/share/classes/java/io/RandomAccessFile.java @@ -784,7 +784,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { *

        *

        * then the result is equal to: - *

        +     * 
              *     ((long)b1 << 56) + ((long)b2 << 48)
              *     + ((long)b3 << 40) + ((long)b4 << 32)
              *     + ((long)b5 << 24) + ((long)b6 << 16)
        diff --git a/jdk/src/share/classes/java/io/Serializable.java b/jdk/src/share/classes/java/io/Serializable.java
        index fc717f7570e..2f7bea1833e 100644
        --- a/jdk/src/share/classes/java/io/Serializable.java
        +++ b/jdk/src/share/classes/java/io/Serializable.java
        @@ -55,7 +55,7 @@ package java.io;
          *
          * Classes that require special handling during the serialization and
          * deserialization process must implement special methods with these exact
        - * signatures: 

        + * signatures: * *

          * private void writeObject(java.io.ObjectOutputStream out)
        @@ -101,7 +101,7 @@ package java.io;
          *
          * 

        Serializable classes that need to designate an alternative object to be * used when writing an object to the stream should implement this - * special method with the exact signature:

        + * special method with the exact signature: * *

          * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException;
        @@ -115,7 +115,7 @@ package java.io;
          *
          * Classes that need to designate a replacement when an instance of it
          * is read from the stream should implement this special method with the
        - * exact signature.

        + * exact signature. * *

          * ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;
        @@ -133,7 +133,7 @@ package java.io;
          * deserialization will result in an {@link InvalidClassException}.  A
          * serializable class can declare its own serialVersionUID explicitly by
          * declaring a field named "serialVersionUID" that must be static,
        - * final, and of type long:

        + * final, and of type long: * *

          * ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
        diff --git a/jdk/src/share/classes/java/io/SerializablePermission.java b/jdk/src/share/classes/java/io/SerializablePermission.java
        index eaa2913243d..b208d24d2f5 100644
        --- a/jdk/src/share/classes/java/io/SerializablePermission.java
        +++ b/jdk/src/share/classes/java/io/SerializablePermission.java
        @@ -43,7 +43,6 @@ import java.util.StringTokenizer;
          * The following table lists all the possible SerializablePermission target names,
          * and for each provides a description of what the permission allows
          * and a discussion of the risks of granting code the permission.
        - * 

        * * * diff --git a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java index 3260da6ae99..3cde60d6437 100644 --- a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java +++ b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java @@ -330,9 +330,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * characters to be copied is {@code srcEnd-srcBegin}. The * characters are copied into the subarray of {@code dst} starting * at index {@code dstBegin} and ending at index: - *

        +     * 
        {@code
              * dstbegin + (srcEnd-srcBegin) - 1
        -     * 
        + * } * * @param srcBegin start copying at this offset. * @param srcEnd stop copying at this offset. @@ -859,16 +859,16 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * *

        An invocation of this method of the form * - *

        -     * sb.subSequence(begin, end)
        + *
        {@code
        +     * sb.subSequence(begin, end)}
        * * behaves in exactly the same way as the invocation * - *
        -     * sb.substring(begin, end)
        + *
        {@code
        +     * sb.substring(begin, end)}
        * * This method is provided so that this class can - * implement the {@link CharSequence} interface.

        + * implement the {@link CharSequence} interface. * * @param start the start index, inclusive. * @param end the end index, exclusive. @@ -1287,9 +1287,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * Returns the index within this string of the first occurrence of the * specified substring. The integer returned is the smallest value * k such that: - *
        +     * 
        {@code
              * this.toString().startsWith(str, k)
        -     * 
        + * } * is {@code true}. * * @param str any string. @@ -1306,10 +1306,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * Returns the index within this string of the first occurrence of the * specified substring, starting at the specified index. The integer * returned is the smallest value {@code k} for which: - *
        +     * 
        {@code
              *     k >= Math.min(fromIndex, this.length()) &&
              *                   this.toString().startsWith(str, k)
        -     * 
        + * } * If no such value of k exists, then -1 is returned. * * @param str the substring for which to search. @@ -1326,9 +1326,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * of the specified substring. The rightmost empty string "" is * considered to occur at the index value {@code this.length()}. * The returned index is the largest value k such that - *
        +     * 
        {@code
              * this.toString().startsWith(str, k)
        -     * 
        + * } * is true. * * @param str the substring to search for. @@ -1345,10 +1345,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { * Returns the index within this string of the last occurrence of the * specified substring. The integer returned is the largest value k * such that: - *
        +     * 
        {@code
              *     k <= Math.min(fromIndex, this.length()) &&
              *                   this.toString().startsWith(str, k)
        -     * 
        + * } * If no such value of k exists, then -1 is returned. * * @param str the substring to search for. diff --git a/jdk/src/share/classes/java/lang/ArrayStoreException.java b/jdk/src/share/classes/java/lang/ArrayStoreException.java index aec35f2de34..96fa7447a79 100644 --- a/jdk/src/share/classes/java/lang/ArrayStoreException.java +++ b/jdk/src/share/classes/java/lang/ArrayStoreException.java @@ -29,7 +29,7 @@ package java.lang; * Thrown to indicate that an attempt has been made to store the * wrong type of object into an array of objects. For example, the * following code generates an ArrayStoreException: - *

        + * 
          *     Object x[] = new String[3];
          *     x[0] = new Integer(0);
          * 
        diff --git a/jdk/src/share/classes/java/lang/Byte.java b/jdk/src/share/classes/java/lang/Byte.java index 275e33de5a7..3a894a5f5e2 100644 --- a/jdk/src/share/classes/java/lang/Byte.java +++ b/jdk/src/share/classes/java/lang/Byte.java @@ -244,7 +244,7 @@ public final class Byte extends Number implements Comparable { *
        Signopt {@code 0X} HexDigits *
        Signopt {@code #} HexDigits *
        Signopt {@code 0} OctalDigits - *

        + * *

        Sign: *
        {@code -} *
        {@code +} diff --git a/jdk/src/share/classes/java/lang/Character.java b/jdk/src/share/classes/java/lang/Character.java index 41576cca8d8..0926758b054 100644 --- a/jdk/src/share/classes/java/lang/Character.java +++ b/jdk/src/share/classes/java/lang/Character.java @@ -5394,7 +5394,7 @@ class Character implements java.io.Serializable, Comparable { * Other_Lowercase as defined by the Unicode Standard. *

        * The following are examples of lowercase characters: - *

        +     * 
              * a b c d e f g h i j k l m n o p q r s t u v w x y z
              * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
              * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
        @@ -5430,7 +5430,7 @@ class Character implements java.io.Serializable, Comparable {
              * Other_Lowercase as defined by the Unicode Standard.
              * 

        * The following are examples of lowercase characters: - *

        +     * 
              * a b c d e f g h i j k l m n o p q r s t u v w x y z
              * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
              * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
        @@ -5461,14 +5461,14 @@ class Character implements java.io.Serializable, Comparable {
              * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
              * 

        * The following are examples of uppercase characters: - *

        +     * 
              * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
              * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
              * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
              * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
              * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
              * 
        - *

        Many other Unicode characters are uppercase too.

        + *

        Many other Unicode characters are uppercase too. * *

        Note: This method cannot handle supplementary characters. To support @@ -5496,7 +5496,7 @@ class Character implements java.io.Serializable, Comparable { * or it has contributory property Other_Uppercase as defined by the Unicode Standard. *

        * The following are examples of uppercase characters: - *

        +     * 
              * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
              * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
              * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
        @@ -5540,7 +5540,7 @@ class Character implements java.io.Serializable, Comparable {
              * 
      3. {@code LATIN CAPITAL LETTER N WITH SMALL LETTER J} *
      4. {@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z} * - *

        Many other Unicode characters are titlecase too.

        + *

        Many other Unicode characters are titlecase too. * *

        Note: This method cannot handle supplementary characters. To support diff --git a/jdk/src/share/classes/java/lang/Class.java b/jdk/src/share/classes/java/lang/Class.java index 64376970a97..e11ee1e65e8 100644 --- a/jdk/src/share/classes/java/lang/Class.java +++ b/jdk/src/share/classes/java/lang/Class.java @@ -91,7 +91,7 @@ import sun.reflect.misc.ReflectUtil; *

        The following example uses a {@code Class} object to print the * class name of an object: * - *

        + * 
          *     void printClassName(Object obj) {
          *         System.out.println("The class of " + obj +
          *                            " is " + obj.getClass().getName());
        @@ -103,7 +103,7 @@ import sun.reflect.misc.ReflectUtil;
          * The Java™ Language Specification.
          * For example:
          *
        - * 

        + *
        * {@code System.out.println("The name of class Foo is: "+Foo.class.getName());} *
        * diff --git a/jdk/src/share/classes/java/lang/ClassCastException.java b/jdk/src/share/classes/java/lang/ClassCastException.java index fc9b2616eff..93b61630d21 100644 --- a/jdk/src/share/classes/java/lang/ClassCastException.java +++ b/jdk/src/share/classes/java/lang/ClassCastException.java @@ -29,7 +29,7 @@ package java.lang; * Thrown to indicate that the code has attempted to cast an object * to a subclass of which it is not an instance. For example, the * following code generates a ClassCastException: - *

        + * 
          *     Object x = new Integer(0);
          *     System.out.println((String)x);
          * 
        diff --git a/jdk/src/share/classes/java/lang/Double.java b/jdk/src/share/classes/java/lang/Double.java index 1b1aece8122..690ca6a8dc3 100644 --- a/jdk/src/share/classes/java/lang/Double.java +++ b/jdk/src/share/classes/java/lang/Double.java @@ -361,15 +361,11 @@ public final class Double extends Number implements Comparable { *
        SignedInteger * * - *

        - * *

        *
        HexFloatingPointLiteral: *
        HexSignificand BinaryExponent FloatTypeSuffixopt *
        * - *

        - * *

        *
        HexSignificand: *
        HexNumeral @@ -380,15 +376,11 @@ public final class Double extends Number implements Comparable { * {@code .} HexDigits *
        * - *

        - * *

        *
        BinaryExponent: *
        BinaryExponentIndicator SignedInteger *
        * - *

        - * *

        *
        BinaryExponentIndicator: *
        {@code p} diff --git a/jdk/src/share/classes/java/lang/Float.java b/jdk/src/share/classes/java/lang/Float.java index e130e92314e..5cc28f99bff 100644 --- a/jdk/src/share/classes/java/lang/Float.java +++ b/jdk/src/share/classes/java/lang/Float.java @@ -321,15 +321,11 @@ public final class Float extends Number implements Comparable { *
        SignedInteger *
        * - *

        - * *

        *
        HexFloatingPointLiteral: *
        HexSignificand BinaryExponent FloatTypeSuffixopt *
        * - *

        - * *

        *
        HexSignificand: *
        HexNumeral @@ -340,15 +336,11 @@ public final class Float extends Number implements Comparable { * {@code .} HexDigits *
        * - *

        - * *

        *
        BinaryExponent: *
        BinaryExponentIndicator SignedInteger *
        * - *

        - * *

        *
        BinaryExponentIndicator: *
        {@code p} diff --git a/jdk/src/share/classes/java/lang/Integer.java b/jdk/src/share/classes/java/lang/Integer.java index 7ee4b48855e..c5d971a54ae 100644 --- a/jdk/src/share/classes/java/lang/Integer.java +++ b/jdk/src/share/classes/java/lang/Integer.java @@ -1123,7 +1123,7 @@ public final class Integer extends Number implements Comparable { *
        Signopt {@code 0X} HexDigits *
        Signopt {@code #} HexDigits *
        Signopt {@code 0} OctalDigits - *

        + * *

        Sign: *
        {@code -} *
        {@code +} diff --git a/jdk/src/share/classes/java/lang/Iterable.java b/jdk/src/share/classes/java/lang/Iterable.java index 0a3ca82f5b4..b6b5f26ba45 100644 --- a/jdk/src/share/classes/java/lang/Iterable.java +++ b/jdk/src/share/classes/java/lang/Iterable.java @@ -99,4 +99,3 @@ public interface Iterable { return Spliterators.spliteratorUnknownSize(iterator(), 0); } } - diff --git a/jdk/src/share/classes/java/lang/Long.java b/jdk/src/share/classes/java/lang/Long.java index bfaf0c4412f..fa43fa4d0b5 100644 --- a/jdk/src/share/classes/java/lang/Long.java +++ b/jdk/src/share/classes/java/lang/Long.java @@ -853,7 +853,7 @@ public final class Long extends Number implements Comparable { *
        Signopt {@code 0X} HexDigits *
        Signopt {@code #} HexDigits *
        Signopt {@code 0} OctalDigits - *

        + * *

        Sign: *
        {@code -} *
        {@code +} diff --git a/jdk/src/share/classes/java/lang/RuntimePermission.java b/jdk/src/share/classes/java/lang/RuntimePermission.java index 6dcbc275e9e..9da131ba938 100644 --- a/jdk/src/share/classes/java/lang/RuntimePermission.java +++ b/jdk/src/share/classes/java/lang/RuntimePermission.java @@ -47,7 +47,6 @@ import java.util.StringTokenizer; * The following table lists all the possible RuntimePermission target names, * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. - *

        * *

      5. diff --git a/jdk/src/share/classes/java/lang/Short.java b/jdk/src/share/classes/java/lang/Short.java index c7641807c56..9fb3913beae 100644 --- a/jdk/src/share/classes/java/lang/Short.java +++ b/jdk/src/share/classes/java/lang/Short.java @@ -249,7 +249,7 @@ public final class Short extends Number implements Comparable { *
        Signopt {@code 0X} HexDigits *
        Signopt {@code #} HexDigits *
        Signopt {@code 0} OctalDigits - *

        + * *

        Sign: *
        {@code -} *
        {@code +} diff --git a/jdk/src/share/classes/java/lang/String.java b/jdk/src/share/classes/java/lang/String.java index 5c9a8017f14..9223c0ab54f 100644 --- a/jdk/src/share/classes/java/lang/String.java +++ b/jdk/src/share/classes/java/lang/String.java @@ -47,16 +47,16 @@ import java.util.regex.PatternSyntaxException; * Strings are constant; their values cannot be changed after they * are created. String buffers support mutable strings. * Because String objects are immutable they can be shared. For example: - *

        + * 
          *     String str = "abc";
          * 

        * is equivalent to: - *

        + * 
          *     char data[] = {'a', 'b', 'c'};
          *     String str = new String(data);
          * 

        * Here are some more examples of how strings can be used: - *

        + * 
          *     System.out.println("abc");
          *     String cde = "cde";
          *     System.out.println("abc" + cde);
        @@ -786,7 +786,7 @@ public final class String
              * {@code srcEnd-srcBegin}). The characters are copied into the
              * subarray of {@code dst} starting at index {@code dstBegin}
              * and ending at index:
        -     * 

        +     * 
              *     dstbegin + (srcEnd-srcBegin) - 1
              * 
        * @@ -2662,7 +2662,7 @@ public final class String * {@code String} may be a different length than the original {@code String}. *

        * Examples of locale-sensitive and 1:M case mappings are in the following table. - *

        + * *

        * * diff --git a/jdk/src/share/classes/java/lang/Thread.java b/jdk/src/share/classes/java/lang/Thread.java index c2f5561bdf4..13d8ac26cad 100644 --- a/jdk/src/share/classes/java/lang/Thread.java +++ b/jdk/src/share/classes/java/lang/Thread.java @@ -76,7 +76,7 @@ import sun.security.util.SecurityConstants; * Thread. An instance of the subclass can then be * allocated and started. For example, a thread that computes primes * larger than a stated value could be written as follows: - *


        + * 
          *     class PrimeThread extends Thread {
          *         long minPrime;
          *         PrimeThread(long minPrime) {
        @@ -91,7 +91,7 @@ import sun.security.util.SecurityConstants;
          * 

        *

        * The following code would then create a thread and start it running: - *

        + * 
          *     PrimeThread p = new PrimeThread(143);
          *     p.start();
          * 
        @@ -102,7 +102,7 @@ import sun.security.util.SecurityConstants; * then be allocated, passed as an argument when creating * Thread, and started. The same example in this other * style looks like the following: - *


        + * 
          *     class PrimeRun implements Runnable {
          *         long minPrime;
          *         PrimeRun(long minPrime) {
        @@ -117,7 +117,7 @@ import sun.security.util.SecurityConstants;
          * 

        *

        * The following code would then create a thread and start it running: - *

        + * 
          *     PrimeRun p = new PrimeRun(143);
          *     new Thread(p).start();
          * 
        diff --git a/jdk/src/share/classes/java/lang/management/ManagementFactory.java b/jdk/src/share/classes/java/lang/management/ManagementFactory.java index 6e00706ccd0..0c7297abe95 100644 --- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java +++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java @@ -60,7 +60,7 @@ import sun.management.ManagementFactoryHelper; * one or more platform MXBeans representing * the management interface of a component of the Java virtual * machine. - *

        + * *

        Platform MXBeans

        *

        * A platform MXBean is a managed bean that diff --git a/jdk/src/share/classes/java/lang/management/ManagementPermission.java b/jdk/src/share/classes/java/lang/management/ManagementPermission.java index 7f62c5e396a..ae3dc564518 100644 --- a/jdk/src/share/classes/java/lang/management/ManagementPermission.java +++ b/jdk/src/share/classes/java/lang/management/ManagementPermission.java @@ -33,10 +33,8 @@ package java.lang.management; * The following table * provides a summary description of what the permission allows, * and discusses the risks of granting code the permission. - *

        * - *

        Language Code of Locale
        + *
        * * * diff --git a/jdk/src/share/classes/java/lang/management/MemoryUsage.java b/jdk/src/share/classes/java/lang/management/MemoryUsage.java index bbb75a26484..6d11e323f6d 100644 --- a/jdk/src/share/classes/java/lang/management/MemoryUsage.java +++ b/jdk/src/share/classes/java/lang/management/MemoryUsage.java @@ -79,7 +79,7 @@ import sun.management.MemoryUsageCompositeData; *
        Permission Target NameWhat the Permission Allows
        * * Below is a picture showing an example of a memory pool: - *

        + * *

          *        +----------------------------------------------+
          *        +////////////////           |                  +
        @@ -250,7 +250,7 @@ public class MemoryUsage {
              * Returns a MemoryUsage object represented by the
              * given CompositeData. The given CompositeData
              * must contain the following attributes:
        -     * 

        + * *

        * * diff --git a/jdk/src/share/classes/java/lang/management/package.html b/jdk/src/share/classes/java/lang/management/package.html index 7d2fa99b737..c2c74d0ccdd 100644 --- a/jdk/src/share/classes/java/lang/management/package.html +++ b/jdk/src/share/classes/java/lang/management/package.html @@ -82,7 +82,7 @@ Java virtual machine and the runtime in the following ways: 1. Direct access to an MXBean interface

          -
        • Get an MXBean instance locally in the running Java virtual machine:

          +

        • Get an MXBean instance locally in the running Java virtual machine:
              RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
           
          @@ -103,7 +103,7 @@ Java virtual machine and the runtime in the following ways:
           

        • Construct an MXBean proxy instance that forwards the - method calls to a given MBeanServer:

          + method calls to a given MBeanServer:

              MBeanServerConnection mbs;
           
          diff --git a/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java b/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java
          index 6570e792242..2674de47caa 100644
          --- a/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java
          +++ b/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java
          @@ -31,7 +31,6 @@ package java.lang.reflect;
            * The following table
            * provides a summary description of what the permission allows,
            * and discusses the risks of granting code the permission.
          - * 

          * *

        * diff --git a/jdk/src/share/classes/java/net/DatagramSocket.java b/jdk/src/share/classes/java/net/DatagramSocket.java index ab60a263ac7..9f269ffd660 100644 --- a/jdk/src/share/classes/java/net/DatagramSocket.java +++ b/jdk/src/share/classes/java/net/DatagramSocket.java @@ -196,7 +196,7 @@ class DatagramSocket implements java.io.Closeable { * socket address. *

        * If, if the address is {@code null}, creates an unbound socket. - *

        + * *

        If there is a security manager, * its {@code checkListen} method is first called * with the port from the socket address @@ -1109,7 +1109,7 @@ class DatagramSocket implements java.io.Closeable { * represent the value of the TOS octet in IP packets sent by * the socket. * RFC 1349 defines the TOS values as follows: - *

        + * *

          *
        • IPTOS_LOWCOST (0x02)
        • *
        • IPTOS_RELIABILITY (0x04)
        • diff --git a/jdk/src/share/classes/java/net/Inet6Address.java b/jdk/src/share/classes/java/net/Inet6Address.java index 068a4ce235d..001c55ffc59 100644 --- a/jdk/src/share/classes/java/net/Inet6Address.java +++ b/jdk/src/share/classes/java/net/Inet6Address.java @@ -133,7 +133,7 @@ import java.util.Arrays; * representation. However, it will be converted into an IPv4 * address.
        *
        - *

        + * *

        Textual representation of IPv6 scoped addresses

        * *

        The textual representation of IPv6 addresses as described above can be @@ -150,11 +150,11 @@ import java.util.Arrays; * *

        The general format for specifying the scope_id is the following: * - *

        IPv6-address%scope_id
        + *
        IPv6-address%scope_id
        *

        The IPv6-address is a literal IPv6 address as described above. * The scope_id refers to an interface on the local system, and it can be * specified in two ways. - *

        1. As a numeric identifier. This must be a positive integer + *
          1. As a numeric identifier. This must be a positive integer * that identifies the particular interface and scope as understood by the * system. Usually, the numeric values can be determined through administration * tools on the system. Each interface may have multiple values, one for each diff --git a/jdk/src/share/classes/java/net/MulticastSocket.java b/jdk/src/share/classes/java/net/MulticastSocket.java index 9c5cb05acbb..1d42dfe6e87 100644 --- a/jdk/src/share/classes/java/net/MulticastSocket.java +++ b/jdk/src/share/classes/java/net/MulticastSocket.java @@ -140,7 +140,7 @@ class MulticastSocket extends DatagramSocket { * Create a MulticastSocket bound to the specified socket address. *

            * Or, if the address is {@code null}, create an unbound socket. - *

            + * *

            If there is a security manager, * its {@code checkListen} method is first called * with the SocketAddress port as its argument to ensure the operation is allowed. diff --git a/jdk/src/share/classes/java/net/NetPermission.java b/jdk/src/share/classes/java/net/NetPermission.java index cf7cbd2af67..9178f348723 100644 --- a/jdk/src/share/classes/java/net/NetPermission.java +++ b/jdk/src/share/classes/java/net/NetPermission.java @@ -46,7 +46,6 @@ import java.util.StringTokenizer; * The following table lists all the possible NetPermission target names, * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. - *

            * * * diff --git a/jdk/src/share/classes/java/net/Proxy.java b/jdk/src/share/classes/java/net/Proxy.java index fe481fadfa2..8ba020ef484 100644 --- a/jdk/src/share/classes/java/net/Proxy.java +++ b/jdk/src/share/classes/java/net/Proxy.java @@ -66,8 +66,8 @@ public class Proxy { * Used, for instance, to create sockets bypassing any other global * proxy settings (like SOCKS): *

            - * {@code Socket s = new Socket(Proxy.NO_PROXY);}
            - *

            + * {@code Socket s = new Socket(Proxy.NO_PROXY);} + * */ public final static Proxy NO_PROXY = new Proxy(); diff --git a/jdk/src/share/classes/java/net/Socket.java b/jdk/src/share/classes/java/net/Socket.java index 361260351f5..21cf5aae133 100644 --- a/jdk/src/share/classes/java/net/Socket.java +++ b/jdk/src/share/classes/java/net/Socket.java @@ -1230,13 +1230,13 @@ class Socket implements java.io.Closeable { * Generally, the window size can be modified at any time when a socket is * connected. However, if a receive window larger than 64K is required then * this must be requested before the socket is connected to the - * remote peer. There are two cases to be aware of:

            + * remote peer. There are two cases to be aware of: *

              *
            1. For sockets accepted from a ServerSocket, this must be done by calling * {@link ServerSocket#setReceiveBufferSize(int)} before the ServerSocket * is bound to a local address.

            2. *
            3. For client sockets, setReceiveBufferSize() must be called before - * connecting the socket to its remote peer.

            + * connecting the socket to its remote peer. * @param size the size to which to set the receive buffer * size. This value must be greater than 0. * @@ -1329,7 +1329,7 @@ class Socket implements java.io.Closeable { * represent the value of the TOS octet in IP packets sent by * the socket. * RFC 1349 defines the TOS values as follows: - *

            + * *

              *
            • IPTOS_LOWCOST (0x02)
            • *
            • IPTOS_RELIABILITY (0x04)
            • diff --git a/jdk/src/share/classes/java/net/SocketOptions.java b/jdk/src/share/classes/java/net/SocketOptions.java index b9508dbb266..7e1b0fc85b6 100644 --- a/jdk/src/share/classes/java/net/SocketOptions.java +++ b/jdk/src/share/classes/java/net/SocketOptions.java @@ -134,7 +134,7 @@ public interface SocketOptions { * previously written data. *

              * Valid for TCP only: SocketImpl. - *

              + * * @see Socket#setTcpNoDelay * @see Socket#getTcpNoDelay */ @@ -155,7 +155,7 @@ public interface SocketOptions { * This option must be specified in the constructor. *

              * Valid for: SocketImpl, DatagramSocketImpl - *

              + * * @see Socket#getLocalAddress * @see DatagramSocket#getLocalAddress */ @@ -186,7 +186,7 @@ public interface SocketOptions { * want to use other than the system default. Takes/returns an InetAddress. *

              * Valid for Multicast: DatagramSocketImpl - *

              + * * @see MulticastSocket#setInterface(InetAddress) * @see MulticastSocket#getInterface() */ diff --git a/jdk/src/share/classes/java/net/SocketPermission.java b/jdk/src/share/classes/java/net/SocketPermission.java index e90856eac8e..1b11437b1aa 100644 --- a/jdk/src/share/classes/java/net/SocketPermission.java +++ b/jdk/src/share/classes/java/net/SocketPermission.java @@ -779,27 +779,27 @@ public final class SocketPermission extends Permission * specified permission. *

              * More specifically, this method first ensures that all of the following - * are true (and returns false if any of them are not):

              + * are true (and returns false if any of them are not): *

                - *
              • p is an instanceof SocketPermission,

                + *

              • p is an instanceof SocketPermission, *
              • p's actions are a proper subset of this - * object's actions, and

                + * object's actions, and *

              • p's port range is included in this port range. Note: - * port range is ignored when p only contains the action, 'resolve'.

                + * port range is ignored when p only contains the action, 'resolve'. *

              * * Then {@code implies} checks each of the following, in order, - * and for each returns true if the stated condition is true:

              + * and for each returns true if the stated condition is true: *

                *
              • If this object was initialized with a single IP address and one of p's - * IP addresses is equal to this object's IP address.

                + * IP addresses is equal to this object's IP address. *

              • If this object is a wildcard domain (such as *.sun.com), and * p's canonical name (the name without any preceding *) * ends with this object's canonical host name. For example, *.sun.com - * implies *.eng.sun.com..

                + * implies *.eng.sun.com. *

              • If this object was not initialized with a single IP address, and one of this - * object's IP addresses equals one of p's IP addresses.

                - *

              • If this canonical name equals p's canonical name.

                + * object's IP addresses equals one of p's IP addresses. + *

              • If this canonical name equals p's canonical name. *
              * * If none of the above are true, {@code implies} returns false. diff --git a/jdk/src/share/classes/java/net/URI.java b/jdk/src/share/classes/java/net/URI.java index 71c4f6dc5de..813de5cf453 100644 --- a/jdk/src/share/classes/java/net/URI.java +++ b/jdk/src/share/classes/java/net/URI.java @@ -389,20 +389,20 @@ import java.lang.NullPointerException; // for javadoc * colon following a host name but no port (as in * {@code http://java.sun.com:} ), and that does not encode characters * except those that must be quoted, the following identities also hold: - *

              + * 
                *     new URI(u.getScheme(),
                *             u.getSchemeSpecificPart(),
                *             u.getFragment())
                *     .equals(u)
              * in all cases, - *

              + * 
                *     new URI(u.getScheme(),
                *             u.getUserInfo(), u.getAuthority(),
                *             u.getPath(), u.getQuery(),
                *             u.getFragment())
                *     .equals(u)
              * if u is hierarchical, and - *

              + * 
                *     new URI(u.getScheme(),
                *             u.getUserInfo(), u.getHost(), u.getPort(),
                *             u.getPath(), u.getQuery(),
              diff --git a/jdk/src/share/classes/java/net/URLConnection.java b/jdk/src/share/classes/java/net/URLConnection.java
              index b731ac70d90..785cfc0c9e2 100644
              --- a/jdk/src/share/classes/java/net/URLConnection.java
              +++ b/jdk/src/share/classes/java/net/URLConnection.java
              @@ -45,7 +45,7 @@ import sun.net.www.MessageHeader;
                * application and a URL. Instances of this class can be used both to
                * read from and to write to the resource referenced by the URL. In
                * general, creating a connection to a URL is a multistep process:
              - * 

              + * *

            * * diff --git a/jdk/src/share/classes/java/net/URLDecoder.java b/jdk/src/share/classes/java/net/URLDecoder.java index eb5e36e5d82..acf10e98244 100644 --- a/jdk/src/share/classes/java/net/URLDecoder.java +++ b/jdk/src/share/classes/java/net/URLDecoder.java @@ -43,7 +43,7 @@ import java.io.*; * as the start of a special escaped sequence. *

            * The following rules are applied in the conversion: - *

            + * *

              *
            • The alphanumeric characters "{@code a}" through * "{@code z}", "{@code A}" through diff --git a/jdk/src/share/classes/java/net/URLEncoder.java b/jdk/src/share/classes/java/net/URLEncoder.java index b5c4a8c32f9..7b05e1cde79 100644 --- a/jdk/src/share/classes/java/net/URLEncoder.java +++ b/jdk/src/share/classes/java/net/URLEncoder.java @@ -49,7 +49,6 @@ import sun.security.action.GetPropertyAction; *

              * When encoding a String, the following rules apply: * - *

              *

                *
              • The alphanumeric characters "{@code a}" through * "{@code z}", "{@code A}" through diff --git a/jdk/src/share/classes/java/net/URLPermission.java b/jdk/src/share/classes/java/net/URLPermission.java index f6572cd3575..2a6568f07a8 100644 --- a/jdk/src/share/classes/java/net/URLPermission.java +++ b/jdk/src/share/classes/java/net/URLPermission.java @@ -45,7 +45,7 @@ import java.security.Permission; * * scheme will typically be http or https, but is not restricted by this * class. - * authority is specified as:

                + * authority is specified as: *

                  *     authority = hostrange [ : portrange ]
                  *     portrange = portnumber | -portnumber | portnumber-[portnumber] | *
                @@ -223,7 +223,7 @@ public final class URLPermission extends Permission {
                      * Checks if this URLPermission implies the given permission.
                      * Specifically, the following checks are done as if in the
                      * following sequence:
                -     * 

                  + *
                    *
                  • if 'p' is not an instance of URLPermission return false
                  • *
                  • if any of p's methods are not in this's method list, and if * this's method list is not equal to "*", then return false.
                  • @@ -242,7 +242,7 @@ public final class URLPermission extends Permission { *
                  • otherwise, return false
                  • *
                  *

                  Some examples of how paths are matched are shown below: - *

            {@code openConnection()}{@code connect()}
            + *
            * * * diff --git a/jdk/src/share/classes/java/net/package-info.java b/jdk/src/share/classes/java/net/package-info.java index 6552b30b634..fda2e4f28b8 100644 --- a/jdk/src/share/classes/java/net/package-info.java +++ b/jdk/src/share/classes/java/net/package-info.java @@ -127,9 +127,9 @@ * resources, then convert it into a {@link java.net.URL} when it is time to * access the resource. From that URL, you can either get the * {@link java.net.URLConnection} for fine control, or get directly the - * InputStream.

            + * InputStream. *

            Here is an example:

            - *

            + * 
              * URI uri = new URI("http://java.sun.com/");
              * URL url = uri.toURL();
              * InputStream in = url.openStream();
            @@ -147,7 +147,7 @@
              *    the {@code java.protocol.handler.pkgs} system property. For instance if
              *    it is set to {@code myapp.protocols}, then the URL code will try, in the
              *    case of http, first to load {@code myapp.protocols.http.Handler}, then,
            - *    if this fails, {@code http.Handler} from the default location.

            + * if this fails, {@code http.Handler} from the default location. *

            Note that the Handler class has to be a subclass of the abstract * class {@link java.net.URLStreamHandler}.

            *

            Additional Specification

            diff --git a/jdk/src/share/classes/java/nio/X-Buffer.java.template b/jdk/src/share/classes/java/nio/X-Buffer.java.template index 60f0733c9ab..acc8fc89912 100644 --- a/jdk/src/share/classes/java/nio/X-Buffer.java.template +++ b/jdk/src/share/classes/java/nio/X-Buffer.java.template @@ -1129,7 +1129,7 @@ public abstract class $Type$Buffer * *

            Two $type$ buffers are equal if, and only if, * - *

              + *
                * *
              1. They have the same element type,

              2. * diff --git a/jdk/src/share/classes/java/nio/file/FileSystem.java b/jdk/src/share/classes/java/nio/file/FileSystem.java index 2296cada829..2a961fb8ecf 100644 --- a/jdk/src/share/classes/java/nio/file/FileSystem.java +++ b/jdk/src/share/classes/java/nio/file/FileSystem.java @@ -355,7 +355,7 @@ public abstract class FileSystem * *

                The following rules are used to interpret glob patterns: * - *

                  + *
                    *
                  • The {@code *} character matches zero or more {@link Character * characters} of a {@link Path#getName(int) name} component without * crossing directory boundaries.

                  • diff --git a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java index 49dffd18e0e..9d33b11d5b6 100644 --- a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java +++ b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java @@ -154,21 +154,21 @@ public abstract class ActivationGroup * active). If the object does not call * Activatable.inactive when it deactivates, the * object will never be garbage collected since the group keeps - * strong references to the objects it creates.

                    + * strong references to the objects it creates. * *

                    The group's inactiveObject method unexports the * remote object from the RMI runtime so that the object can no * longer receive incoming RMI calls. An object will only be unexported * if the object has no pending or executing calls. * The subclass of ActivationGroup must override this - * method and unexport the object.

                    + * method and unexport the object. * *

                    After removing the object from the RMI runtime, the group * must inform its ActivationMonitor (via the monitor's * inactiveObject method) that the remote object is * not currently active so that the remote object will be * re-activated by the activator upon a subsequent activation - * request.

                    + * request. * *

                    This method simply informs the group's monitor that the object * is inactive. It is up to the concrete subclass of ActivationGroup diff --git a/jdk/src/share/classes/java/rmi/dgc/VMID.java b/jdk/src/share/classes/java/rmi/dgc/VMID.java index 45e58599d66..913c598be2e 100644 --- a/jdk/src/share/classes/java/rmi/dgc/VMID.java +++ b/jdk/src/share/classes/java/rmi/dgc/VMID.java @@ -67,7 +67,7 @@ public final class VMID implements java.io.Serializable { * conditions: a) the conditions for uniqueness for objects of * the class java.rmi.server.UID are satisfied, and b) an * address can be obtained for this host that is unique and constant - * for the lifetime of this object.

                    + * for the lifetime of this object. */ public VMID() { addr = randomBytes; diff --git a/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java b/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java index be86c275246..80cab6f9ba1 100644 --- a/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java +++ b/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java @@ -36,7 +36,7 @@ import sun.rmi.server.UnicastServerRef2; * below, the stub for a remote object being exported is obtained as * follows: * - *

                      + *
                        * *
                      • If the remote object is exported using the {@link * #exportObject(Remote) UnicastRemoteObject.exportObject(Remote)} method, @@ -66,9 +66,8 @@ import sun.rmi.server.UnicastServerRef2; * could not be loaded, or a problem occurs creating the stub instance, a * {@link StubNotFoundException} is thrown. * - *

                        *

                      • For all other means of exporting: - *

                          + *
                            * *
                          • If the remote object's stub class (as defined above) could not be * loaded or the system property @@ -93,7 +92,6 @@ import sun.rmi.server.UnicastServerRef2; * will be thrown. *
                          * - *

                          *

                        • Otherwise, an instance of the remote object's stub class (as * described above) is used as the stub. * diff --git a/jdk/src/share/classes/java/security/AccessController.java b/jdk/src/share/classes/java/security/AccessController.java index 89392261fe1..36408a8d633 100644 --- a/jdk/src/share/classes/java/security/AccessController.java +++ b/jdk/src/share/classes/java/security/AccessController.java @@ -39,9 +39,9 @@ import sun.reflect.Reflection; *
                            *
                          • to decide whether an access to a critical system * resource is to be allowed or denied, based on the security policy - * currently in effect,

                            + * currently in effect, *

                          • to mark code as being "privileged", thus affecting subsequent - * access determinations, and

                            + * access determinations, and *

                          • to obtain a "snapshot" of the current calling context so * access-control decisions from a different context can be made with * respect to the saved context.
                          diff --git a/jdk/src/share/classes/java/security/AlgorithmParameterGenerator.java b/jdk/src/share/classes/java/security/AlgorithmParameterGenerator.java index 307aaaf17eb..7f9c7cbf4ab 100644 --- a/jdk/src/share/classes/java/security/AlgorithmParameterGenerator.java +++ b/jdk/src/share/classes/java/security/AlgorithmParameterGenerator.java @@ -48,7 +48,7 @@ import java.security.spec.AlgorithmParameterSpec; * of the prime modulus (in bits). * When using this approach, algorithm-specific parameter generation * values - if any - default to some standard values, unless they can be - * derived from the specified size.

                          + * derived from the specified size. * *

                        • The other approach initializes a parameter generator object * using algorithm-specific semantics, which are represented by a set of diff --git a/jdk/src/share/classes/java/security/BasicPermission.java b/jdk/src/share/classes/java/security/BasicPermission.java index 2d0c96665ee..89cc2f92152 100644 --- a/jdk/src/share/classes/java/security/BasicPermission.java +++ b/jdk/src/share/classes/java/security/BasicPermission.java @@ -57,7 +57,6 @@ import java.io.IOException; * Subclasses may implement actions on top of BasicPermission, * if desired. *

                          - *

                          * @see java.security.Permission * @see java.security.Permissions * @see java.security.PermissionCollection @@ -153,9 +152,9 @@ public abstract class BasicPermission extends Permission * Checks if the specified permission is "implied" by * this object. *

                          - * More specifically, this method returns true if:

                          + * More specifically, this method returns true if: *

                            - *
                          • p's class is the same as this object's class, and

                            + *

                          • p's class is the same as this object's class, and *
                          • p's name equals or (in the case of wildcards) * is implied by this object's * name. For example, "a.b.*" implies "a.b.c". diff --git a/jdk/src/share/classes/java/security/CodeSource.java b/jdk/src/share/classes/java/security/CodeSource.java index b6167cb008b..62a5959ecd8 100644 --- a/jdk/src/share/classes/java/security/CodeSource.java +++ b/jdk/src/share/classes/java/security/CodeSource.java @@ -234,7 +234,7 @@ public class CodeSource implements java.io.Serializable { * Returns true if this CodeSource object "implies" the specified CodeSource. *

                            * More specifically, this method makes the following checks. - * If any fail, it returns false. If they all succeed, it returns true.

                            + * If any fail, it returns false. If they all succeed, it returns true. *

                              *
                            • codesource must not be null. *
                            • If this object's certificates are not null, then all @@ -242,7 +242,7 @@ public class CodeSource implements java.io.Serializable { * certificates. *
                            • If this object's location (getLocation()) is not null, then the * following checks are made against this object's location and - * codesource's:

                              + * codesource's: *

                                *
                              • codesource's location must not be null. * diff --git a/jdk/src/share/classes/java/security/Key.java b/jdk/src/share/classes/java/security/Key.java index 0ae4e3851b3..c0c63d7c7c1 100644 --- a/jdk/src/share/classes/java/security/Key.java +++ b/jdk/src/share/classes/java/security/Key.java @@ -39,7 +39,7 @@ package java.security; * RSA), which will work with those algorithms and with related * algorithms (such as MD5 with RSA, SHA-1 with RSA, Raw DSA, etc.) * The name of the algorithm of a key is obtained using the - * {@link #getAlgorithm() getAlgorithm} method.

                                + * {@link #getAlgorithm() getAlgorithm} method. * *

                              • An Encoded Form * @@ -65,12 +65,11 @@ package java.security; * For more information, see * RFC 3280: * Internet X.509 Public Key Infrastructure Certificate and CRL Profile. - *

                                * *

                              • A Format * *

                                This is the name of the format of the encoded key. It is returned - * by the {@link #getFormat() getFormat} method.

                                + * by the {@link #getFormat() getFormat} method. * *

                              * diff --git a/jdk/src/share/classes/java/security/KeyPairGenerator.java b/jdk/src/share/classes/java/security/KeyPairGenerator.java index 78b100c3afa..c09d2510294 100644 --- a/jdk/src/share/classes/java/security/KeyPairGenerator.java +++ b/jdk/src/share/classes/java/security/KeyPairGenerator.java @@ -77,7 +77,6 @@ import sun.security.jca.GetInstance.Instance; * providers might have precomputed parameter sets for more than just the * three modulus sizes mentioned above. Still others might not have a list of * precomputed parameters at all and instead always create new parameter sets. - *

                              * *

                            • Algorithm-Specific Initialization *

                              For situations where a set of algorithm-specific parameters already diff --git a/jdk/src/share/classes/java/security/KeyStore.java b/jdk/src/share/classes/java/security/KeyStore.java index e769bb158e1..19c05a87d4f 100644 --- a/jdk/src/share/classes/java/security/KeyStore.java +++ b/jdk/src/share/classes/java/security/KeyStore.java @@ -98,7 +98,6 @@ import javax.security.auth.callback.*; * KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); *

            * The system will return a keystore implementation for the default type. - *

            * *

          2. To provide a specific keystore type: *
            diff --git a/jdk/src/share/classes/java/security/MessageDigest.java b/jdk/src/share/classes/java/security/MessageDigest.java
            index fa686785c45..60d41ffac72 100644
            --- a/jdk/src/share/classes/java/security/MessageDigest.java
            +++ b/jdk/src/share/classes/java/security/MessageDigest.java
            @@ -54,21 +54,21 @@ import java.nio.ByteBuffer;
              *
              * 

            Implementations are free to implement the Cloneable interface. * Client applications can test cloneability by attempting cloning - * and catching the CloneNotSupportedException:

            + * and catching the CloneNotSupportedException: * -*

            -* MessageDigest md = MessageDigest.getInstance("SHA");
            -*
            -* try {
            -*     md.update(toChapter1);
            -*     MessageDigest tc1 = md.clone();
            -*     byte[] toChapter1Digest = tc1.digest();
            -*     md.update(toChapter2);
            -*     ...etc.
            -* } catch (CloneNotSupportedException cnse) {
            -*     throw new DigestException("couldn't make digest of partial content");
            -* }
            -* 
            + *
            {@code
            + * MessageDigest md = MessageDigest.getInstance("SHA");
            + *
            + * try {
            + *     md.update(toChapter1);
            + *     MessageDigest tc1 = md.clone();
            + *     byte[] toChapter1Digest = tc1.digest();
            + *     md.update(toChapter2);
            + *     ...etc.
            + * } catch (CloneNotSupportedException cnse) {
            + *     throw new DigestException("couldn't make digest of partial content");
            + * }
            + * }
            * *

            Note that if a given implementation is not cloneable, it is * still possible to compute intermediate digests by instantiating diff --git a/jdk/src/share/classes/java/security/Permission.java b/jdk/src/share/classes/java/security/Permission.java index dfa7163b435..088f97c35a6 100644 --- a/jdk/src/share/classes/java/security/Permission.java +++ b/jdk/src/share/classes/java/security/Permission.java @@ -138,14 +138,14 @@ public abstract class Permission implements Guard, java.io.Serializable { * Returns the hash code value for this Permission object. *

            * The required {@code hashCode} behavior for Permission Objects is - * the following:

            + * the following: *

              *
            • Whenever it is invoked on the same Permission object more than * once during an execution of a Java application, the * {@code hashCode} method * must consistently return the same integer. This integer need not * remain consistent from one execution of an application to another - * execution of the same application.

              + * execution of the same application. *

            • If two Permission objects are equal according to the * {@code equals} * method, then calling the {@code hashCode} method on each of the diff --git a/jdk/src/share/classes/java/security/PermissionCollection.java b/jdk/src/share/classes/java/security/PermissionCollection.java index 58b7bdfd99f..3f13b9f93d5 100644 --- a/jdk/src/share/classes/java/security/PermissionCollection.java +++ b/jdk/src/share/classes/java/security/PermissionCollection.java @@ -37,7 +37,6 @@ import java.util.*; * collection, using the {@code implies} method. *
            • enumerate all the permissions, using the {@code elements} method. *
            - *

            * *

            When it is desirable to group together a number of Permission objects * of the same type, the {@code newPermissionCollection} method on that diff --git a/jdk/src/share/classes/java/security/SecurityPermission.java b/jdk/src/share/classes/java/security/SecurityPermission.java index bbdccaeffe3..5bb74569d3f 100644 --- a/jdk/src/share/classes/java/security/SecurityPermission.java +++ b/jdk/src/share/classes/java/security/SecurityPermission.java @@ -44,7 +44,6 @@ import java.util.StringTokenizer; * The following table lists all the possible SecurityPermission target names, * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. - *

            * *

          3. Examples of Path Matching
            this's pathp's pathmatch
            /a/b/a/byes
            * @@ -193,7 +192,6 @@ import java.util.StringTokenizer; * associated with classes that have been deprecated: {@link Identity}, * {@link IdentityScope}, {@link Signer}. Use of them is discouraged. See the * applicable classes for more information. - *

            * *

            * diff --git a/jdk/src/share/classes/java/security/Signature.java b/jdk/src/share/classes/java/security/Signature.java index a40290f8c99..7c5bd96eb28 100644 --- a/jdk/src/share/classes/java/security/Signature.java +++ b/jdk/src/share/classes/java/security/Signature.java @@ -77,13 +77,13 @@ import sun.security.jca.GetInstance.Instance; * (see {@link #initSign(PrivateKey)} * and {@link #initSign(PrivateKey, SecureRandom)}). * - *

            + * * - *

          4. Updating

            + *

          5. Updating * *

            Depending on the type of initialization, this will update the * bytes to be signed or verified. See the - * {@link #update(byte) update} methods.

            + * {@link #update(byte) update} methods. * *

          6. Signing or Verifying a signature on all updated bytes. See the * {@link #sign() sign} methods and the {@link #verify(byte[]) verify} diff --git a/jdk/src/share/classes/java/security/SignedObject.java b/jdk/src/share/classes/java/security/SignedObject.java index dba803d88e4..9ac864ee8a4 100644 --- a/jdk/src/share/classes/java/security/SignedObject.java +++ b/jdk/src/share/classes/java/security/SignedObject.java @@ -43,7 +43,7 @@ import java.io.*; * object passed to the constructor and the {@code verify} method. * A typical usage for signing is the following: * - *

            {@code
            + * 
            {@code
              * Signature signingEngine = Signature.getInstance(algorithm,
              *                                                 provider);
              * SignedObject so = new SignedObject(myobject, signingKey,
            @@ -53,7 +53,7 @@ import java.io.*;
              * 

            A typical usage for verification is the following (having * received SignedObject {@code so}): * - *

            {@code
            + * 
            {@code
              * Signature verificationEngine =
              *     Signature.getInstance(algorithm, provider);
              * if (so.verify(publickey, verificationEngine))
            diff --git a/jdk/src/share/classes/java/security/acl/Acl.java b/jdk/src/share/classes/java/security/acl/Acl.java
            index e7b6a21b28c..b9cf0041d2f 100644
            --- a/jdk/src/share/classes/java/security/acl/Acl.java
            +++ b/jdk/src/share/classes/java/security/acl/Acl.java
            @@ -42,27 +42,27 @@ import java.security.Principal;
              * granted to the associated principal. If negative, the permissions
              * are to be denied.

            * - * The ACL Entries in each ACL observe the following rules:

            + * The ACL Entries in each ACL observe the following rules: * *

            • Each principal can have at most one positive ACL entry and * one negative entry; that is, multiple positive or negative ACL * entries are not allowed for any principal. Each entry specifies * the set of permissions that are to be granted (if positive) or - * denied (if negative).

              + * denied (if negative). * *

            • If there is no entry for a particular principal, then the - * principal is considered to have a null (empty) permission set.

              + * principal is considered to have a null (empty) permission set. * *

            • If there is a positive entry that grants a principal a * particular permission, and a negative entry that denies the * principal the same permission, the result is as though the - * permission was never granted or denied.

              + * permission was never granted or denied. * *

            • Individual permissions always override permissions of the * group(s) to which the individual belongs. That is, individual * negative permissions (specific denial of permissions) override the * groups' positive permissions. And individual positive permissions - * override the groups' negative permissions.

              + * override the groups' negative permissions. * *

            * @@ -159,12 +159,12 @@ public interface Acl extends Owner { * Returns an enumeration for the set of allowed permissions for the * specified principal (representing an entity such as an individual or * a group). This set of allowed permissions is calculated as - * follows:

            + * follows: * *

              * *
            • If there is no entry in this Access Control List for the - * specified principal, an empty permission set is returned.

              + * specified principal, an empty permission set is returned. * *

            • Otherwise, the principal's group permission sets are determined. * (A principal can belong to one or more groups, where a group is a diff --git a/jdk/src/share/classes/java/security/cert/CertificateFactory.java b/jdk/src/share/classes/java/security/cert/CertificateFactory.java index 83ff9fbee92..f45866d1b74 100644 --- a/jdk/src/share/classes/java/security/cert/CertificateFactory.java +++ b/jdk/src/share/classes/java/security/cert/CertificateFactory.java @@ -63,7 +63,7 @@ import sun.security.jca.GetInstance.Instance; * supports those methods), so that each call to * {@code generateCertificate} consumes only one certificate, and the * read position of the input stream is positioned to the next certificate in - * the file:

              + * the file: * *

              {@code
                * FileInputStream fis = new FileInputStream(filename);
              @@ -78,7 +78,7 @@ import sun.security.jca.GetInstance.Instance;
                * }
              * *

              The following example parses a PKCS#7-formatted certificate reply stored - * in a file and extracts all the certificates from it:

              + * in a file and extracts all the certificates from it: * *

                * FileInputStream fis = new FileInputStream(filename);
              diff --git a/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java b/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java
              index 3046a03ed23..a345c96cac8 100644
              --- a/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java
              +++ b/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java
              @@ -299,7 +299,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker {
                       /**
                        * Allow revocation check to succeed if the revocation status cannot be
                        * determined for one of the following reasons:
              -         * 

                + *
                  *
                • The CRL or OCSP response cannot be obtained because of a * network error. *
                • The OCSP responder returns one of the following errors diff --git a/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java b/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java index bc083eb7a43..ec06a88ae58 100644 --- a/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java +++ b/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java @@ -35,7 +35,7 @@ import sun.security.util.DerValue; * structure. * *

                  The ASN.1 definition is as follows: - *

                  + * 
                    *   PolicyQualifierInfo ::= SEQUENCE {
                    *        policyQualifierId       PolicyQualifierId,
                    *        qualifier               ANY DEFINED BY policyQualifierId }
                  diff --git a/jdk/src/share/classes/java/security/cert/TrustAnchor.java b/jdk/src/share/classes/java/security/cert/TrustAnchor.java
                  index fe267a52f66..c98bf814caf 100644
                  --- a/jdk/src/share/classes/java/security/cert/TrustAnchor.java
                  +++ b/jdk/src/share/classes/java/security/cert/TrustAnchor.java
                  @@ -44,7 +44,6 @@ import sun.security.x509.X500Name;
                    * individual parameters.
                    * 

                  * Concurrent Access - *

                  *

                  All {@code TrustAnchor} objects must be immutable and * thread-safe. That is, multiple threads may concurrently invoke the * methods defined in this class on a single {@code TrustAnchor} diff --git a/jdk/src/share/classes/java/security/cert/X509CertSelector.java b/jdk/src/share/classes/java/security/cert/X509CertSelector.java index e44dba125e4..aae32c93f44 100644 --- a/jdk/src/share/classes/java/security/cert/X509CertSelector.java +++ b/jdk/src/share/classes/java/security/cert/X509CertSelector.java @@ -359,7 +359,7 @@ public class X509CertSelector implements CertSelector { * criticality setting, and encapsulating OCTET STRING) * for a SubjectKeyIdentifier extension. * The ASN.1 notation for this structure follows. - *

                  + * *

                  {@code
                        * SubjectKeyIdentifier ::= KeyIdentifier
                        *
                  @@ -399,7 +399,7 @@ public class X509CertSelector implements CertSelector {
                        * criticality setting, and encapsulating OCTET STRING)
                        * for an AuthorityKeyIdentifier extension.
                        * The ASN.1 notation for this structure follows.
                  -     * 

                  + * *

                  {@code
                        * AuthorityKeyIdentifier ::= SEQUENCE {
                        *    keyIdentifier             [0] KeyIdentifier           OPTIONAL,
                  diff --git a/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java b/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java
                  index 390835725b9..e50cfd24c4b 100644
                  --- a/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java
                  +++ b/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java
                  @@ -43,11 +43,11 @@ import java.security.*;
                    *
                    * 
                • Get a key pair generator for the DSA algorithm by calling the * KeyPairGenerator {@code getInstance} method with "DSA" - * as its argument.

                  + * as its argument. * *

                • Initialize the generator by casting the result to a DSAKeyPairGenerator * and calling one of the - * {@code initialize} methods from this DSAKeyPairGenerator interface.

                  + * {@code initialize} methods from this DSAKeyPairGenerator interface. * *

                • Generate a key pair by calling the {@code generateKeyPair} * method from the KeyPairGenerator class. diff --git a/jdk/src/share/classes/java/text/MessageFormat.java b/jdk/src/share/classes/java/text/MessageFormat.java index 402a7fa52d9..2497a490eb0 100644 --- a/jdk/src/share/classes/java/text/MessageFormat.java +++ b/jdk/src/share/classes/java/text/MessageFormat.java @@ -125,7 +125,6 @@ import java.util.Locale; * valid patterns, but "ab {0'}' de", "ab } de" * and "''{''" are not. * - *

                  *

                  Warning:
                  The rules for using quotes within message * format patterns unfortunately have shown to be somewhat confusing. * In particular, it isn't always obvious to localizers whether single @@ -146,7 +145,7 @@ import java.util.Locale; * table shows how the values map to {@code Format} instances. Combinations not * shown in the table are illegal. A SubformatPattern must * be a valid pattern string for the {@code Format} subclass used. - *

                  + * *

          7. * *
            FormatType @@ -215,7 +214,6 @@ import java.util.Locale; * SubformatPattern * {@code new} {@link ChoiceFormat#ChoiceFormat(String) ChoiceFormat}{@code (subformatPattern)} *
            - *

            * *

            Usage Information

            * @@ -761,7 +759,7 @@ public class MessageFormat extends Format { * as indicated by the first matching line of the following table. An * argument is unavailable if arguments is * null or has fewer than argumentIndex+1 elements. - *

            + * * * *
            Subformat diff --git a/jdk/src/share/classes/java/text/Normalizer.java b/jdk/src/share/classes/java/text/Normalizer.java index 88fdf2b29da..a97b4c1d9d9 100644 --- a/jdk/src/share/classes/java/text/Normalizer.java +++ b/jdk/src/share/classes/java/text/Normalizer.java @@ -53,12 +53,12 @@ import sun.text.normalizer.NormalizerImpl; * several different ways in Unicode. For example, take the character A-acute. * In Unicode, this can be encoded as a single character (the "composed" form): * - *

            + * 
              *      U+00C1    LATIN CAPITAL LETTER A WITH ACUTE
            * * or as two separate characters (the "decomposed" form): * - *

            + * 
              *      U+0041    LATIN CAPITAL LETTER A
              *      U+0301    COMBINING ACUTE ACCENT
            * @@ -72,14 +72,14 @@ import sun.text.normalizer.NormalizerImpl; *

            * Similarly, the string "ffi" can be encoded as three separate letters: * - *

            + * 
              *      U+0066    LATIN SMALL LETTER F
              *      U+0066    LATIN SMALL LETTER F
              *      U+0069    LATIN SMALL LETTER I
            * * or as the single character * - *

            + * 
              *      U+FB03    LATIN SMALL LIGATURE FFI
            * * The ffi ligature is not a distinct semantic character, and strictly speaking diff --git a/jdk/src/share/classes/java/text/SimpleDateFormat.java b/jdk/src/share/classes/java/text/SimpleDateFormat.java index fa9f673b8b8..c510d2d78a6 100644 --- a/jdk/src/share/classes/java/text/SimpleDateFormat.java +++ b/jdk/src/share/classes/java/text/SimpleDateFormat.java @@ -356,7 +356,6 @@ import sun.util.locale.provider.LocaleProviderAdapter; * may be replaced with other, locale dependent, pattern letters. * SimpleDateFormat does not deal with the localization of text * other than the pattern letters; that's up to the client of the class. - *

            * *

            Examples

            * diff --git a/jdk/src/share/classes/java/util/Base64.java b/jdk/src/share/classes/java/util/Base64.java index 39da03b7e3c..9418b7169e2 100644 --- a/jdk/src/share/classes/java/util/Base64.java +++ b/jdk/src/share/classes/java/util/Base64.java @@ -40,7 +40,6 @@ import java.nio.charset.StandardCharsets; * RFC 4648 and * RFC 2045. * - *

            *