From d4b588d475f705ed08f8da446dc8da290276ed7c Mon Sep 17 00:00:00 2001 From: ccheung Date: Wed, 12 Dec 2018 11:57:22 -0800 Subject: [PATCH 01/38] 8214809: CDS storage improvements Reviewed-by: acorn, iklam, ahgross, rhalade --- src/hotspot/share/classfile/classFileParser.cpp | 4 ++-- test/hotspot/jtreg/runtime/appcds/OldClassTest.java | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 3c3afb2857..075464d5bc 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -6016,9 +6016,9 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream, _minor_version = stream->get_u2_fast(); _major_version = stream->get_u2_fast(); - if (DumpSharedSpaces && _major_version < JAVA_1_5_VERSION) { + if (DumpSharedSpaces && _major_version < JAVA_6_VERSION) { ResourceMark rm; - warning("Pre JDK 1.5 class not supported by CDS: %u.%u %s", + warning("Pre JDK 6 class not supported by CDS: %u.%u %s", _major_version, _minor_version, _class_name->as_C_string()); Exceptions::fthrow( THREAD_AND_LOCATION, diff --git a/test/hotspot/jtreg/runtime/appcds/OldClassTest.java b/test/hotspot/jtreg/runtime/appcds/OldClassTest.java index 72330fd208..22c492c06e 100644 --- a/test/hotspot/jtreg/runtime/appcds/OldClassTest.java +++ b/test/hotspot/jtreg/runtime/appcds/OldClassTest.java @@ -24,7 +24,7 @@ /* * @test - * @summary classes with major version < JDK_1.5 (48) should not be included in CDS + * @summary classes with major version < JDK_6 (50) should not be included in CDS * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm @@ -61,9 +61,9 @@ public static void main(String[] args) throws Exception { String appClasses[] = TestCommon.list("Hello"); - // CASE 1: pre-JDK 1.5 compiled classes should be excluded from the dump + // CASE 1: pre-JDK 6 compiled classes should be excluded from the dump OutputAnalyzer output = TestCommon.dump(jar, appClasses); - TestCommon.checkExecReturn(output, 0, true, "Pre JDK 1.5 class not supported by CDS"); + TestCommon.checkExecReturn(output, 0, true, "Pre JDK 6 class not supported by CDS"); TestCommon.run( "-cp", jar, @@ -74,7 +74,7 @@ public static void main(String[] args) throws Exception { // the newer version of this class in a subsequent classpath element. String classpath = jar + File.pathSeparator + jarSrcFile.getPath(); output = TestCommon.dump(classpath, appClasses); - TestCommon.checkExecReturn(output, 0, true, "Pre JDK 1.5 class not supported by CDS"); + TestCommon.checkExecReturn(output, 0, true, "Pre JDK 6 class not supported by CDS"); TestCommon.run( "-cp", classpath, @@ -127,8 +127,7 @@ static byte[] makeOldHello() throws Exception { MethodVisitor mv; AnnotationVisitor av0; -//WAS cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, "Hello", null, "java/lang/Object", null); - cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, "Hello", null, "java/lang/Object", null); + cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, "Hello", null, "java/lang/Object", null); { mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); From 3eb04e10550ef5751b5a35aa2d3c2013476eaf18 Mon Sep 17 00:00:00 2001 From: mullan Date: Wed, 10 Apr 2019 09:41:22 -0400 Subject: [PATCH 02/38] 8222089: [TESTBUG] sun/security/lib/cacerts/VerifyCACerts.java fails due to cert within 90-day expiry window Reviewed-by: xuelei --- test/jdk/sun/security/lib/cacerts/VerifyCACerts.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java index c227f02389..52e9718153 100644 --- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java +++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ /** * @test * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 - * 8209452 8209506 8210432 8195793 + * 8209452 8209506 8210432 8195793 8222089 * @summary Check root CA entries in cacerts file */ import java.io.File; @@ -237,7 +237,12 @@ public class VerifyCACerts { // Exception list to 90 days expiry policy // No error will be reported if certificate in this list expires - private static final HashSet EXPIRY_EXC_ENTRIES = new HashSet<>(); + private static final HashSet EXPIRY_EXC_ENTRIES = new HashSet<>() { + { + add("certplusclass2primaryca [jdk]"); + add("certplusclass3pprimaryca [jdk]"); + } + }; // Ninety days in milliseconds private static final long NINETY_DAYS = 7776000000L; From 1c86673d90553d38ec4ccfe1707692c118613827 Mon Sep 17 00:00:00 2001 From: rkennke Date: Wed, 27 Mar 2019 22:25:03 +0100 Subject: [PATCH 03/38] 8220664: Simplify ShenandoahUpdateHeapRefsClosure Reviewed-by: shade --- .../gc/shenandoah/shenandoahOopClosures.hpp | 16 ++++------------ .../shenandoah/shenandoahOopClosures.inline.hpp | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOopClosures.hpp b/src/hotspot/share/gc/shenandoah/shenandoahOopClosures.hpp index 30edab3012..13e9bb7360 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOopClosures.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOopClosures.hpp @@ -184,24 +184,16 @@ class ShenandoahMarkRefsMetadataDedupClosure : public ShenandoahMarkRefsSuperClo virtual bool do_metadata() { return true; } }; -class ShenandoahUpdateHeapRefsSuperClosure : public BasicOopIterateClosure { +class ShenandoahUpdateHeapRefsClosure : public BasicOopIterateClosure { private: ShenandoahHeap* _heap; -public: - ShenandoahUpdateHeapRefsSuperClosure() : - _heap(ShenandoahHeap::heap()) {} - - template - void work(T *p); -}; -class ShenandoahUpdateHeapRefsClosure : public ShenandoahUpdateHeapRefsSuperClosure { -private: template - inline void do_oop_work(T* p) { work(p); } + void do_oop_work(T* p); public: - ShenandoahUpdateHeapRefsClosure() : ShenandoahUpdateHeapRefsSuperClosure() {} + ShenandoahUpdateHeapRefsClosure() : + _heap(ShenandoahHeap::heap()) {} virtual void do_oop(narrowOop* p) { do_oop_work(p); } virtual void do_oop(oop* p) { do_oop_work(p); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOopClosures.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahOopClosures.inline.hpp index 3942a608c1..a0e4538168 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOopClosures.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOopClosures.inline.hpp @@ -34,7 +34,7 @@ inline void ShenandoahMarkRefsSuperClosure::work(T *p) { } template -inline void ShenandoahUpdateHeapRefsSuperClosure::work(T* p) { +inline void ShenandoahUpdateHeapRefsClosure::do_oop_work(T* p) { _heap->maybe_update_with_forwarded(p); } From 1134b43b43acd4d42cf8503c2005b5dc9d967bf8 Mon Sep 17 00:00:00 2001 From: rkennke Date: Mon, 8 Apr 2019 18:42:27 +0200 Subject: [PATCH 04/38] 8222125: Shenandoah: Crash when running with ShenandoahParallelSafepointThreads=1 Reviewed-by: shade --- .../share/gc/shenandoah/shenandoahHeap.cpp | 4 +- .../options/TestSafepointWorkers.java | 46 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/jtreg/gc/shenandoah/options/TestSafepointWorkers.java diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 2aa46c67e5..03538a292a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -1223,7 +1223,9 @@ void ShenandoahHeap::print_gc_threads_on(outputStream* st) const { void ShenandoahHeap::gc_threads_do(ThreadClosure* tcl) const { workers()->threads_do(tcl); - _safepoint_workers->threads_do(tcl); + if (_safepoint_workers != NULL) { + _safepoint_workers->threads_do(tcl); + } if (ShenandoahStringDedup::is_enabled()) { ShenandoahStringDedup::threads_do(tcl); } diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestSafepointWorkers.java b/test/hotspot/jtreg/gc/shenandoah/options/TestSafepointWorkers.java new file mode 100644 index 0000000000..6546ae8117 --- /dev/null +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestSafepointWorkers.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. All rights reserved. + * + * 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 TestSingleSafepointWorker + * @key gc + * @requires vm.gc.Shenandoah + * + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahParallelSafepointThreads=1 -Xmx128m TestSafepointWorkers + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahParallelSafepointThreads=2 -Xmx128m TestSafepointWorkers + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahParallelSafepointThreads=4 -Xmx128m TestSafepointWorkers + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahParallelSafepointThreads=8 -Xmx128m TestSafepointWorkers + */ + +public class TestSafepointWorkers { + static final long TARGET_MB = Long.getLong("target", 1000); // 1 Gb allocation + + static volatile Object sink; + + public static void main(String[] args) throws Exception { + long count = TARGET_MB * 1024 * 1024 / 16; + for (long c = 0; c < count; c++) { + sink = new Object(); + } + } +} From a133c970a6dd4135cbea4374b2cf828a31a7df81 Mon Sep 17 00:00:00 2001 From: shade Date: Mon, 8 Apr 2019 19:43:04 +0200 Subject: [PATCH 05/38] 8222130: Shenandoah should verify roots after pre-evacuation Reviewed-by: rkennke, zgu --- .../share/gc/shenandoah/shenandoahHeap.cpp | 4 ++++ .../share/gc/shenandoah/shenandoahVerifier.cpp | 16 ++++++++++++++++ .../share/gc/shenandoah/shenandoahVerifier.hpp | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 03538a292a..c927f4b703 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -1566,6 +1566,10 @@ void ShenandoahHeap::op_final_mark() { if (ShenandoahPacing) { pacer()->setup_for_evac(); } + + if (ShenandoahVerify) { + verifier()->verify_during_evacuation(); + } } else { if (ShenandoahVerify) { verifier()->verify_after_concmark(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp index 062aee6859..b492773183 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp @@ -628,6 +628,10 @@ void ShenandoahVerifier::verify_at_safepoint(const char *label, enabled = true; expected = ShenandoahHeap::HAS_FORWARDED; break; + case _verify_gcstate_evacuation: + enabled = true; + expected = ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::EVACUATION; + break; case _verify_gcstate_stable: enabled = true; expected = ShenandoahHeap::STABLE; @@ -808,6 +812,18 @@ void ShenandoahVerifier::verify_before_evacuation() { ); } +void ShenandoahVerifier::verify_during_evacuation() { + verify_at_safepoint( + "During Evacuation", + _verify_forwarded_allow, // some forwarded references are allowed + _verify_marked_disable, // walk only roots + _verify_cset_disable, // some cset references are not forwarded yet + _verify_liveness_disable, // liveness data might be already stale after pre-evacs + _verify_regions_disable, // trash regions not yet recycled + _verify_gcstate_evacuation // evacuation is in progress + ); +} + void ShenandoahVerifier::verify_after_evacuation() { verify_at_safepoint( "After Evacuation", diff --git a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp index a16169454c..63c9f3b0dd 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp @@ -135,6 +135,9 @@ class ShenandoahVerifier : public CHeapObj { // Nothing is in progress, some objects are forwarded _verify_gcstate_forwarded, + + // Evacuation is in progress, some objects are forwarded + _verify_gcstate_evacuation, } VerifyGCState; struct VerifyOptions { @@ -173,6 +176,7 @@ class ShenandoahVerifier : public CHeapObj { void verify_before_concmark(); void verify_after_concmark(); void verify_before_evacuation(); + void verify_during_evacuation(); void verify_after_evacuation(); void verify_before_updaterefs(); void verify_after_updaterefs(); From 1e98ec264038ab60cf7848c5e51dc6d5b022b1e8 Mon Sep 17 00:00:00 2001 From: shade Date: Sun, 7 Apr 2019 13:28:18 +0200 Subject: [PATCH 06/38] 8222032: x86_32 fails with "wrong size of mach node" on AVX-512 machine Reviewed-by: kvn, vlivanov --- src/hotspot/cpu/x86/x86_32.ad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/cpu/x86/x86_32.ad b/src/hotspot/cpu/x86/x86_32.ad index 87ccfb6ee1..c326551339 100644 --- a/src/hotspot/cpu/x86/x86_32.ad +++ b/src/hotspot/cpu/x86/x86_32.ad @@ -1309,7 +1309,7 @@ void MachSpillCopyNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { } uint MachSpillCopyNode::size(PhaseRegAlloc *ra_) const { - return implementation( NULL, ra_, true, NULL ); + return MachNode::size(ra_); } From 268b6872597cdf41d671562e658b1e8851ca980c Mon Sep 17 00:00:00 2001 From: shade Date: Fri, 5 Apr 2019 09:06:19 +0200 Subject: [PATCH 07/38] 8221918: runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java fails: Shared archive not found Reviewed-by: jiangli, dholmes --- .../serviceability/ReplaceCriticalClasses.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java index 7a4c1825ed..e70021c4ef 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/ReplaceCriticalClasses.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,15 @@ public static void main(String args[]) throws Throwable { public void process(String args[]) throws Throwable { if (args.length == 0) { + // Dump the shared archive in case it was not generated during the JDK build. + // Put the archive at separate file to avoid clashes with concurrent tests. + CDSOptions opts = new CDSOptions() + .setXShareMode("dump") + .setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa") + .setUseVersion(false) + .addSuffix("-showversion"); + CDSTestUtils.run(opts).assertNormalExit(""); + launchChildProcesses(getTests()); } else if (args.length == 3 && args[0].equals("child")) { Class klass = Class.forName(args[2].replace("/", ".")); @@ -152,7 +161,7 @@ static void launchChild(String args[]) throws Throwable { CDSOptions opts = (new CDSOptions()) .setXShareMode("auto") - .setUseSystemArchive(true) + .setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa") .setUseVersion(false) .addSuffix("-showversion", "-Xlog:cds", From 89124e354f0fc1d926aebf9020782fa043bf6d6e Mon Sep 17 00:00:00 2001 From: mullan Date: Wed, 10 Apr 2019 10:32:52 -0400 Subject: [PATCH 08/38] 8222133: Add temporary exceptions for root certs that are due to expire soon Reviewed-by: xuelei --- test/jdk/sun/security/lib/cacerts/VerifyCACerts.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java index 52e9718153..112bcca091 100644 --- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java +++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java @@ -25,7 +25,7 @@ /** * @test * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 - * 8209452 8209506 8210432 8195793 8222089 + * 8209452 8209506 8210432 8195793 8222089 8222133 * @summary Check root CA entries in cacerts file */ import java.io.File; @@ -239,8 +239,18 @@ public class VerifyCACerts { // No error will be reported if certificate in this list expires private static final HashSet EXPIRY_EXC_ENTRIES = new HashSet<>() { { + // Valid until: Sat Jul 06 19:59:59 EDT 2019 add("certplusclass2primaryca [jdk]"); + // Valid until: Sat Jul 06 19:59:59 EDT 2019 add("certplusclass3pprimaryca [jdk]"); + // Valid until: Tue Jul 09 14:40:36 EDT 2019 + add("utnuserfirstobjectca [jdk]"); + // Valid until: Tue Jul 09 19:59:00 EDT 2019 + add("deutschetelekomrootca2 [jdk]"); + // Valid until: Tue Jul 09 13:36:58 EDT 2019 + add("utnuserfirstclientauthemailca [jdk]"); + // Valid until: Tue Jul 09 14:19:22 EDT 2019 + add("utnuserfirsthardwareca [jdk]"); } }; From 05bdb773bb7c68756581f0c3f25bf8022720d481 Mon Sep 17 00:00:00 2001 From: clanger Date: Sat, 30 Mar 2019 21:29:37 +0100 Subject: [PATCH 09/38] 8221610: Resurrect (legacy) JRE bundle target Reviewed-by: erikj, azeller --- make/Bundles.gmk | 37 +++++++++++++++++++++++++++++++++++-- make/Main.gmk | 14 ++++++++++++-- make/autoconf/spec.gmk.in | 2 ++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/make/Bundles.gmk b/make/Bundles.gmk index 891681588d..fe3f998519 100644 --- a/make/Bundles.gmk +++ b/make/Bundles.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ include $(SPEC) include MakeBase.gmk PRODUCT_TARGETS := +LEGACY_TARGETS := TEST_TARGETS := DOCS_TARGETS := @@ -146,19 +147,25 @@ endef # correct base directories. ifeq ($(OPENJDK_TARGET_OS)-$(DEBUG_LEVEL), macosx-release) JDK_IMAGE_DIR := $(JDK_MACOSX_BUNDLE_DIR) + JRE_IMAGE_DIR := $(JRE_MACOSX_BUNDLE_DIR) JDK_IMAGE_HOMEDIR := $(JDK_MACOSX_CONTENTS_DIR)/Home + JRE_IMAGE_HOMEDIR := $(JRE_MACOSX_CONTENTS_DIR)/Home JDK_BUNDLE_SUBDIR := + JRE_BUNDLE_SUBDIR := else JDK_IMAGE_HOMEDIR := $(JDK_IMAGE_DIR) + JRE_IMAGE_HOMEDIR := $(JRE_IMAGE_DIR) JDK_BUNDLE_SUBDIR := jdk-$(VERSION_NUMBER) + JRE_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER) ifneq ($(DEBUG_LEVEL), release) JDK_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL) + JRE_BUNDLE_SUBDIR := $(JRE_BUNDLE_SUBDIR)/$(DEBUG_LEVEL) endif endif ################################################################################ -ifneq ($(filter product-bundles, $(MAKECMDGOALS)), ) +ifneq ($(filter product-bundles legacy-bundles, $(MAKECMDGOALS)), ) $(eval $(call FillCacheFind, $(IMAGES_OUTPUTDIR))) SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.pdb %.map @@ -198,6 +205,22 @@ ifneq ($(filter product-bundles, $(MAKECMDGOALS)), ) TEST_DEMOS_BUNDLE_FILES := $(filter $(JDK_IMAGE_HOMEDIR)/demo/%, $(ALL_JDK_FILES)) + ALL_JRE_FILES := $(call CacheFind, $(JRE_IMAGE_DIR)) + + # Create special filter rules when dealing with unzipped .dSYM directories on + # macosx + ifeq ($(OPENJDK_TARGET_OS), macosx) + ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), false) + JRE_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \ + $(call containing, .dSYM/, $(patsubst $(JRE_IMAGE_DIR)/%, %, $(ALL_JRE_FILES)))) + endif + endif + + JRE_BUNDLE_FILES := $(filter-out \ + $(JRE_SYMBOLS_EXCLUDE_PATTERN) \ + $(SYMBOLS_EXCLUDE_PATTERN), \ + $(ALL_JRE_FILES)) + $(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \ BUNDLE_NAME := $(JDK_BUNDLE_NAME), \ FILES := $(JDK_BUNDLE_FILES), \ @@ -208,6 +231,15 @@ ifneq ($(filter product-bundles, $(MAKECMDGOALS)), ) PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE) + $(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \ + BUNDLE_NAME := $(JRE_BUNDLE_NAME), \ + FILES := $(JRE_BUNDLE_FILES), \ + BASE_DIRS := $(JRE_IMAGE_DIR), \ + SUBDIR := $(JRE_BUNDLE_SUBDIR), \ + )) + + LEGACY_TARGETS += $(BUILD_JRE_BUNDLE) + $(eval $(call SetupBundleFile, BUILD_JDK_SYMBOLS_BUNDLE, \ BUNDLE_NAME := $(JDK_SYMBOLS_BUNDLE_NAME), \ FILES := $(JDK_SYMBOLS_BUNDLE_FILES), \ @@ -283,6 +315,7 @@ $(eval $(call IncludeCustomExtension, Bundles.gmk)) ################################################################################ product-bundles: $(PRODUCT_TARGETS) +legacy-bundles: $(LEGACY_TARGETS) test-bundles: $(TEST_TARGETS) docs-bundles: $(DOCS_TARGETS) jcov-bundles: $(JCOV_TARGETS) diff --git a/make/Main.gmk b/make/Main.gmk index b276a02395..5ece189529 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -576,6 +576,9 @@ ALL_TARGETS += test exploded-test product-bundles: +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk product-bundles) +legacy-bundles: + +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk legacy-bundles) + test-bundles: +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk test-bundles) @@ -587,7 +590,7 @@ ifeq ($(JCOV_ENABLED), true) +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk jcov-bundles) endif -ALL_TARGETS += product-bundles test-bundles docs-bundles jcov-bundles +ALL_TARGETS += product-bundles legacy-bundles test-bundles docs-bundles jcov-bundles ################################################################################ # Install targets @@ -909,6 +912,8 @@ else product-bundles: product-images + legacy-bundles: legacy-images + test-bundles: test-image docs-bundles: docs-image @@ -1011,6 +1016,9 @@ mac-bundles: mac-jdk-bundle # (and possibly other, more specific versions) product-images: jdk-image symbols-image exploded-image +# This target builds the legacy images, e.g. the legacy JRE image +legacy-images: legacy-jre-image + # zip-security is actually a bundle, but for now it needs to be considered # an image until this can be cleaned up properly. product-images: zip-security @@ -1027,6 +1035,8 @@ endif ifeq ($(OPENJDK_TARGET_OS), macosx) product-images: mac-jdk-bundle + + legacy-images: mac-legacy-jre-bundle endif # This target builds the documentation image @@ -1061,7 +1071,7 @@ ALL_TARGETS += buildtools hotspot hotspot-libs hotspot-gensrc gensrc gendata \ jdk.jdwp.agent-gensrc $(ALL_MODULES) demos \ exploded-image-base exploded-image \ create-buildjdk docs-jdk-api docs-javase-api docs-reference-api docs-jdk \ - docs-javase docs-reference docs-javadoc mac-bundles product-images \ + docs-javase docs-reference docs-javadoc mac-bundles product-images legacy-images \ docs-image test-image all-images \ all-bundles diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in index 445c7a49c3..20040b7e3f 100644 --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in @@ -891,6 +891,7 @@ else JDK_BUNDLE_EXTENSION := tar.gz endif JDK_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART).$(JDK_BUNDLE_EXTENSION) +JRE_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART).$(JDK_BUNDLE_EXTENSION) JDK_SYMBOLS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz TEST_DEMOS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin-tests-demos$(DEBUG_PART).tar.gz TEST_BUNDLE_NAME := jdk-$(BASE_NAME)_bin-tests$(DEBUG_PART).tar.gz @@ -898,6 +899,7 @@ DOCS_BUNDLE_NAME := jdk-$(BASE_NAME)_doc-api-spec$(DEBUG_PART).tar.gz JCOV_BUNDLE_NAME := jdk-jcov-$(BASE_NAME)_bin$(DEBUG_PART).$(JDK_BUNDLE_EXTENSION) JDK_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JDK_BUNDLE_NAME) +JRE_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JRE_BUNDLE_NAME) JDK_SYMBOLS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JDK_SYMBOLS_BUNDLE_NAME) TEST_DEMOS_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(TEST_DEMOS_BUNDLE_NAME) TEST_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(TEST_BUNDLE_NAME) From fb337b46fc8b38f6e66fbe3132b1ac899c850b79 Mon Sep 17 00:00:00 2001 From: shade Date: Sun, 7 Apr 2019 13:28:18 +0200 Subject: [PATCH 10/38] 8221917: serviceability/sa/TestPrintMdo.java fails on 32-bit platforms Reviewed-by: cjplummer, dholmes --- .../share/classes/sun/jvm/hotspot/oops/DataLayout.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/DataLayout.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/DataLayout.java index f297cdb9c9..d55fdbc402 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/DataLayout.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/DataLayout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -172,7 +172,7 @@ static int bciOffset() { return 2; } public static int cellOffset(int index) { - return MethodData.cellSize + index * MethodData.cellSize; + return (headerSizeInCells() + index) * MethodData.cellSize; } // // Return a value which, when or-ed as a byte into _flags, sets the flag. // static int flagNumberToByteConstant(int flagNumber) { From 64721a0b25a597a2c42aa144d68ac592c4c0b8e9 Mon Sep 17 00:00:00 2001 From: gziemski Date: Fri, 25 Jan 2019 10:43:02 -0600 Subject: [PATCH 11/38] 8216493: VirtualSpaceNodeTest.half_vsn_is_committed_humongous_chunk_is_used_test_vm crashes on local machine Summary: Make ChunkManagerRestorer more robust Reviewed-by: iignatyev --- .../gtest/memory/test_virtualSpaceNode.cpp | 65 ++++++++++++++----- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/test/hotspot/gtest/memory/test_virtualSpaceNode.cpp b/test/hotspot/gtest/memory/test_virtualSpaceNode.cpp index 9772af2206..e19581d6ec 100644 --- a/test/hotspot/gtest/memory/test_virtualSpaceNode.cpp +++ b/test/hotspot/gtest/memory/test_virtualSpaceNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,9 @@ #include "utilities/formatBuffer.hpp" #include "unittest.hpp" +// include as last, or otherwise we pull in an incompatible "assert" macro +#include + using namespace metaspace; namespace { @@ -71,24 +74,55 @@ class ChunkManagerTest { // removes all the chunks added to the ChunkManager since creation of ChunkManagerRestorer class ChunkManagerRestorer { - ChunkManager* const _cm; - Metachunk* _chunks[NumberOfFreeLists]; - public: - ChunkManagerRestorer(ChunkManager* cm) : _cm(cm) { - for (ChunkIndex i = ZeroIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) { - ChunkList* l = ChunkManagerTest::free_chunks(_cm, i); - _chunks[i] = l->tail(); + metaspace::ChunkManager* const _cm; + std::vector* _free_chunks[metaspace::NumberOfFreeLists]; + int _count_pre_existing; +public: + ChunkManagerRestorer(metaspace::ChunkManager* cm) : _cm(cm), _count_pre_existing(0) { + _cm->locked_verify(); + for (metaspace::ChunkIndex i = metaspace::ZeroIndex; i < metaspace::NumberOfFreeLists; i = next_chunk_index(i)) { + metaspace::ChunkList* l = ChunkManagerTest::free_chunks(_cm, i); + _count_pre_existing += l->count(); + std::vector *v = new std::vector(l->count()); + metaspace::Metachunk* c = l->head(); + while (c) { + v->push_back(c); + c = c->next(); + } + _free_chunks[i] = v; } } ~ChunkManagerRestorer() { + _cm->locked_verify(); + for (metaspace::ChunkIndex i = metaspace::ZeroIndex; i < metaspace::NumberOfFreeLists; i = next_chunk_index(i)) { + metaspace::ChunkList* l = ChunkManagerTest::free_chunks(_cm, i); + std::vector *v = _free_chunks[i]; + ssize_t count = l->count(); + for (ssize_t j = 0; j < count; j++) { + metaspace::Metachunk* c = l->head(); + while (c) { + bool found = false; + for (size_t k = 0; k < v->size() && !found; k++) { + found = (c == v->at(k)); + } + if (found) { + c = c->next(); + } else { + _cm->remove_chunk(c); + break; + } + } + } + delete _free_chunks[i]; + _free_chunks[i] = NULL; + } + int count_after_cleanup = 0; for (ChunkIndex i = ZeroIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) { ChunkList* l = ChunkManagerTest::free_chunks(_cm, i); - Metachunk* t = l->tail(); - while (t != _chunks[i]) { - _cm->remove_chunk(t); - t = l->tail(); - } + count_after_cleanup += l->count(); } + EXPECT_EQ(_count_pre_existing, count_after_cleanup); + _cm->locked_verify(); } }; @@ -121,7 +155,6 @@ TEST_VM(VirtualSpaceNodeTest, four_pages_vsn_is_committed_some_is_used_by_chunks // committed - used = words left to retire const size_t words_left = page_chunks - SmallChunk - SpecializedChunk; - size_t num_medium_chunks, num_small_chunks, num_spec_chunks; chunk_up(words_left, num_medium_chunks, num_small_chunks, num_spec_chunks); @@ -155,7 +188,6 @@ TEST_VM(VirtualSpaceNodeTest, half_vsn_is_committed_humongous_chunk_is_used) { TEST_VM(VirtualSpaceNodeTest, all_vsn_is_committed_half_is_used_by_chunks) { MutexLockerEx ml(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag); - ChunkManager cm(false); VirtualSpaceNode vsn(false, vsn_test_size_bytes); ChunkManagerRestorer c(Metaspace::get_chunk_manager(false)); @@ -165,6 +197,7 @@ TEST_VM(VirtualSpaceNodeTest, all_vsn_is_committed_half_is_used_by_chunks) { vsn.get_chunk_vs(MediumChunk); vsn.get_chunk_vs(MediumChunk); vsn.retire(&cm); + // DISABLED: checks started to fail after 8198423 // EXPECT_EQ(2UL, ChunkManagerTest::sum_free_chunks_count(&cm)) << "should have been memory left for 2 chunks"; // EXPECT_EQ(2UL * MediumChunk, ChunkManagerTest::sum_free_chunks(&cm)) << "sizes should add up"; @@ -172,13 +205,13 @@ TEST_VM(VirtualSpaceNodeTest, all_vsn_is_committed_half_is_used_by_chunks) { TEST_VM(VirtualSpaceNodeTest, no_committed_memory) { MutexLockerEx ml(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag); - ChunkManager cm(false); VirtualSpaceNode vsn(false, vsn_test_size_bytes); ChunkManagerRestorer c(Metaspace::get_chunk_manager(false)); vsn.initialize(); vsn.retire(&cm); + ASSERT_EQ(0UL, ChunkManagerTest::sum_free_chunks_count(&cm)) << "did not commit any memory in the VSN"; } From c9807e01b08f58ffaaf4366752c79f848ff692e7 Mon Sep 17 00:00:00 2001 From: lfoltan Date: Tue, 29 Jan 2019 11:56:51 -0500 Subject: [PATCH 12/38] 8216970: condy causes JVM crash Summary: Fix issue with ConstantPool::constant_tag_at to correctly handle a condy whose return type is an array. Reviewed-by: acorn, hseigel, jrose --- src/hotspot/share/oops/constantPool.cpp | 8 +- .../condy/escapeAnalysis/TestEscapeCondy.java | 52 +++++++ .../TestEscapeThroughInvokeWithCondy$A.jasm | 69 +++++++++ .../TestEscapeThroughInvokeWithCondy.jasm | 141 ++++++++++++++++++ 4 files changed, 266 insertions(+), 4 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java create mode 100644 test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeThroughInvokeWithCondy$A.jasm create mode 100644 test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeThroughInvokeWithCondy.jasm diff --git a/src/hotspot/share/oops/constantPool.cpp b/src/hotspot/share/oops/constantPool.cpp index 9e87bf14da..bb88c7147b 100644 --- a/src/hotspot/share/oops/constantPool.cpp +++ b/src/hotspot/share/oops/constantPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -817,9 +817,9 @@ constantTag ConstantPool::constant_tag_at(int which) { constantTag tag = tag_at(which); if (tag.is_dynamic_constant() || tag.is_dynamic_constant_in_error()) { - // have to look at the signature for this one - Symbol* constant_type = uncached_signature_ref_at(which); - return constantTag::ofBasicType(FieldType::basic_type(constant_type)); + BasicType bt = basic_type_for_constant_at(which); + // dynamic constant could return an array, treat as object + return constantTag::ofBasicType(is_reference_type(bt) ? T_OBJECT : bt); } return tag; } diff --git a/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java new file mode 100644 index 0000000000..1c833f269d --- /dev/null +++ b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8216970 + * @summary Ensure escape analysis can handle an ldc of a dynamic + * constant whose return type is an array of boolean. + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @compile TestEscapeThroughInvokeWithCondy$A.jasm + * @compile TestEscapeThroughInvokeWithCondy.jasm + * @compile TestEscapeCondy.java + * @run main/othervm TestEscapeCondy + */ + +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.compiler.InMemoryJavaCompiler; + +public class TestEscapeCondy { + public static void main(String args[]) throws Throwable { + // 1. Test escape analysis of a method that contains + // a ldc instruction of a condy whose return type is an array of boolean + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:CompileCommand=dontinline,runtime.condy.TestEscapeThroughInvokeWithCondy::create", + "runtime.condy.TestEscapeThroughInvokeWithCondy"); + OutputAnalyzer oa = new OutputAnalyzer(pb.start()); + oa.shouldContain("Test has successfully analyzed ldc bytecode within method create"); + oa.shouldHaveExitValue(0); + } +} diff --git a/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeThroughInvokeWithCondy$A.jasm b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeThroughInvokeWithCondy$A.jasm new file mode 100644 index 0000000000..e7a80ac07f --- /dev/null +++ b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeThroughInvokeWithCondy$A.jasm @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package runtime/condy; + +super class TestEscapeThroughInvokeWithCondy$A + version 55:0 +{ + +private Field saved:"Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;"; + +public Method "":"(Ljava/lang/Integer;)V" + stack 1 locals 2 +{ + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; +} + +public Method saveInto:"(Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;Ljava/lang/Integer;)V" + stack 2 locals 3 +{ + aload_1; + aload_0; + putfield Field saved:"Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;"; + return; +} + +public Method check:"(Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;)V" + stack 3 locals 2 +{ + aload_0; + getfield Field saved:"Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;"; + aload_1; + if_acmpeq L18; + new class java/lang/RuntimeException; + dup; + ldc String "TEST FAILED: Objects not equal."; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L18: stack_frame_type same; + return; +} + +NestHost TestEscapeThroughInvokeWithCondy; +static InnerClass A=class TestEscapeThroughInvokeWithCondy$A of class TestEscapeThroughInvokeWithCondy; + +} // end Class TestEscapeThroughInvokeWithCondy$A diff --git a/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeThroughInvokeWithCondy.jasm b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeThroughInvokeWithCondy.jasm new file mode 100644 index 0000000000..edb81b091d --- /dev/null +++ b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeThroughInvokeWithCondy.jasm @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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. + * + */ + +// The below .jasm code implements the same java code as test +// compiler/escapeAnalysis/TestEscapeThrowInvoke.java with the addition +// of an ldc bytecode of a dynamic constant whose return type is an array of boolean. +// The method bsmArray is the bootstrap method for the dynamic constant. +// The ldc has been added to the method create. + +package runtime/condy; + +super public class TestEscapeThroughInvokeWithCondy + version 55:0 +{ + +private Field a:"Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;"; + +public Method "":"()V" + stack 1 locals 1 +{ + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; +} + +public static Method main:"([Ljava/lang/String;)V" + stack 4 locals 3 +{ + new class TestEscapeThroughInvokeWithCondy; + dup; + invokespecial Method "":"()V"; + astore_1; + aload_1; + new class TestEscapeThroughInvokeWithCondy$A; + dup; + bipush 42; + invokestatic Method java/lang/Integer.valueOf:"(I)Ljava/lang/Integer;"; + invokespecial Method TestEscapeThroughInvokeWithCondy$A."":"(Ljava/lang/Integer;)V"; + putfield Field a:"Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;"; + iconst_0; + istore_2; + L26: stack_frame_type append; + locals_map class TestEscapeThroughInvokeWithCondy, int; + iload_2; + ldc int 100000; + if_icmpge L42; + aload_1; + invokevirtual Method run:"()V"; + iinc 2, 1; + goto L26; + L42: stack_frame_type chop1; + getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; + ldc String "Test has successfully analyzed ldc bytecode within method create"; + invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; + return; +} +public static Method bsmArray:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)[Z" + stack 5 locals 6 +{ + iconst_2; + newarray boolean; + astore_3; + aload_3; + iconst_0; + iconst_1; + bastore; + aload_3; + iconst_1; + iconst_1; + bastore; + aload_3; + areturn; +} + +private Method run:"()V" + stack 2 locals 2 +{ + new class java/lang/Object; + dup; + invokespecial Method java/lang/Object."":"()V"; + pop; + aload_0; + bipush 42; + invokestatic Method java/lang/Integer.valueOf:"(I)Ljava/lang/Integer;"; + invokevirtual Method create:"(Ljava/lang/Integer;)Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;"; + astore_1; + aload_0; + getfield Field a:"Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;"; + aload_1; + invokevirtual Method TestEscapeThroughInvokeWithCondy$A.check:"(Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;)V"; + return; +} + +private Method create:"(Ljava/lang/Integer;)Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;" + stack 5 locals 4 +{ + ldc Dynamic REF_invokeStatic:TestEscapeThroughInvokeWithCondy.bsmArray:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)[Z":name:"[Z"; + astore_2; + aload_2; + iconst_1; + iconst_1; + bastore; + new class TestEscapeThroughInvokeWithCondy$A; + dup; + aload_1; + invokespecial Method TestEscapeThroughInvokeWithCondy$A."":"(Ljava/lang/Integer;)V"; + astore_3; + aload_3; + aload_0; + getfield Field a:"Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;"; + aload_1; + invokevirtual Method TestEscapeThroughInvokeWithCondy$A.saveInto:"(Lruntime/condy/TestEscapeThroughInvokeWithCondy$A;Ljava/lang/Integer;)V"; + aload_3; + areturn; +} + +NestMembers TestEscapeThroughInvokeWithCondy$A; +static InnerClass A=class TestEscapeThroughInvokeWithCondy$A of class TestEscapeThroughInvokeWithCondy; + +} // end Class TestEscapeThroughInvokeWithCondy From 297d0c18ca0f6e66f3400f1654ccce7b624123c5 Mon Sep 17 00:00:00 2001 From: bulasevich Date: Tue, 25 Dec 2018 18:35:42 +0300 Subject: [PATCH 13/38] 8206107: [x86_32] jck tests for ldc2_w bytecode fail Reviewed-by: dsamersoff --- src/hotspot/cpu/x86/templateTable_x86.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp index b794d28f34..432ba6624a 100644 --- a/src/hotspot/cpu/x86/templateTable_x86.cpp +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp @@ -582,8 +582,9 @@ void TemplateTable::condy_helper(Label& Done) { __ cmpl(flags, ltos); __ jcc(Assembler::notEqual, notLong); // ltos - __ movptr(rax, field); + // Loading high word first because movptr clobbers rax NOT_LP64(__ movptr(rdx, field.plus_disp(4))); + __ movptr(rax, field); __ push(ltos); __ jmp(Done); From 1f0df4569020a8a0edafe187057f44f8378d5fdd Mon Sep 17 00:00:00 2001 From: diazhou Date: Fri, 4 Jan 2019 03:33:15 +0000 Subject: [PATCH 14/38] 8216144: RE changes for new forked repos for JDK 12.0.1 Reviewed-by: erikj, tbell --- make/autoconf/version-numbers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/autoconf/version-numbers b/make/autoconf/version-numbers index 57b551acac..1988c19d86 100644 --- a/make/autoconf/version-numbers +++ b/make/autoconf/version-numbers @@ -27,7 +27,7 @@ DEFAULT_VERSION_FEATURE=12 DEFAULT_VERSION_INTERIM=0 -DEFAULT_VERSION_UPDATE=0 +DEFAULT_VERSION_UPDATE=1 DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 From ae1fd4010570e375671e47eb006fa3eb768380ea Mon Sep 17 00:00:00 2001 From: diazhou Date: Fri, 4 Jan 2019 10:36:09 +0000 Subject: [PATCH 15/38] Added tag jdk-12.0.1+1 for changeset 60ff8949381a --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 99bd6945fa..9fb4912ce5 100644 --- a/.hgtags +++ b/.hgtags @@ -529,3 +529,4 @@ eef755718cb24813031a842bbfc716a6cea18e9a jdk-12+23 7d4397b43fa305806160785a4c7210600d59581a jdk-12+24 7496df94b3b79f3da53925d2d137317715f11d97 jdk-12+25 de9fd809bb475401aad188eab2264226788aad81 jdk-12+26 +60ff8949381adea46f489f6bbecf9232a028e830 jdk-12.0.1+1 From 8f839d06ffd5d48386be6f2afe0113b1b0299b46 Mon Sep 17 00:00:00 2001 From: diazhou Date: Wed, 9 Jan 2019 01:51:43 +0000 Subject: [PATCH 16/38] Added tag jdk-12.0.1+2 for changeset c3fc07bf4080 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 9fb4912ce5..5fa40bb04a 100644 --- a/.hgtags +++ b/.hgtags @@ -530,3 +530,4 @@ eef755718cb24813031a842bbfc716a6cea18e9a jdk-12+23 7496df94b3b79f3da53925d2d137317715f11d97 jdk-12+25 de9fd809bb475401aad188eab2264226788aad81 jdk-12+26 60ff8949381adea46f489f6bbecf9232a028e830 jdk-12.0.1+1 +c3fc07bf408084671904abac6b1873aebf7983c7 jdk-12.0.1+2 From e2bbe7f3050ad148d88b53127049360ba5b9beba Mon Sep 17 00:00:00 2001 From: diazhou Date: Wed, 16 Jan 2019 06:23:55 +0000 Subject: [PATCH 17/38] Added tag jdk-12.0.1+3 for changeset d52a133717ee --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index edd41dbbd8..c727720d98 100644 --- a/.hgtags +++ b/.hgtags @@ -532,3 +532,4 @@ de9fd809bb475401aad188eab2264226788aad81 jdk-12+26 f15d443f97318e9b40e6f451e327ff69ed4ec361 jdk-12+27 60ff8949381adea46f489f6bbecf9232a028e830 jdk-12.0.1+1 c3fc07bf408084671904abac6b1873aebf7983c7 jdk-12.0.1+2 +d52a133717eef8e05abd6d12bb75d943607c517c jdk-12.0.1+3 From aba64e18e134b80373e35083db62b51f0c240a10 Mon Sep 17 00:00:00 2001 From: rhalade Date: Wed, 16 Jan 2019 22:29:31 -0800 Subject: [PATCH 18/38] 8216577: Add GlobalSign's R6 Root certificate Reviewed-by: mullan, robm --- src/java.base/share/lib/security/cacerts | Bin 102225 -> 103689 bytes .../certification/GlobalSignR6CA.java | 202 ++++++++++++++++++ .../security/lib/cacerts/VerifyCACerts.java | 8 +- 3 files changed, 207 insertions(+), 3 deletions(-) create mode 100644 test/jdk/security/infra/java/security/cert/CertPathValidator/certification/GlobalSignR6CA.java diff --git a/src/java.base/share/lib/security/cacerts b/src/java.base/share/lib/security/cacerts index 02181bef7e3609e171bb050699d620610c055d5b..ff5bf21d2047d0195fefdf4ac3bdf95e08877c51 100644 GIT binary patch delta 1410 zcmV-|1%3L_o(74k1`Ph~{_Ow&00IC209~;RYd2OHXKZg`VQh10XKr$DZ**f}ayB4a zYGi9&0004KQy)w<00mesH842<00oCIf(3&xf&*)y0|Eg80uDvyy90wW!-Zu?=Kn=e zFbxI?Duzgg_YDC743nuXB>^^*F+nRC9v2NUG%+$UFfcGMFfcG$7Y#EsF)}eQFq5(G zDFHTsvgogSbJGGZdt6f9WdB z#;}NM#kPsj#`L7mTE^Cg?oB!s2JK{K3zC4!MBa0hPV=XUe@}R02*?sp zZ9--*O}Tj}O;Q?)8i2PMfewDeio9e@Asj#C!;zrKQFP|)xgiQnW8dG+d|A1cytE_>&^le=wG;z)dq5C=H_X0mr-e&FhiJgT&$ z_VblW5(jPljIxQ((4b*=$XIl+)FV3gT{_C5+novCT|_OA@qx`(lKOtUPy}N%-)oZ? zzH2tJIpnN=BsRD3@3tHhSCh8hviRbKw{xPnHL6AO;GH(1Z&Zr$a#n6Gh{aJtL=}|o zqs2Iun@&zz3rF(?Hc59dym2?>rtBdIb^PXG7C(2@*^!ro3T)H@O?1E%?fp6XgYsS! zp#-oC>HhAI;cg4E2(w{k32LzhI%Sqw!0`K6)QgAdXF-!KvRh0ilc^~!Bz6fAmJPt!{XNyU|98eQ=l*(1_Mz}A}YB}ATDrd+T~OHgIv>{^8Z8(L}v2RUd>BH_qM(x6r1&R87V|zc) zae;gQ=$Nh!cr?Q$`>zV0AZy(_6OR&%;z1fndUK$6X~(u)e}c#!{#Y9*E2wO(UTwey z(tEe-fc_;n{sNn5tU_JG?)A*v@KANqHffyZdj#KZ25Gk53V#VmS%>R;6kvK}s%b;- zk;hEz7~O2|Q!R{{;a>7`KF?Ihy=UyC4@^b>)44Ds2TYF;zlN6CnOd}&R~)3wyA_F3 zx-10`~UG1H0~l<=S6-i%Ox8bS0;=K1;|fR=vl_?>ORI zlJI%=oP@e`ElptoAbx()@=pg@UyCh6QtL(xl;QPeM|pSER9hddBsa@NT27!uNXXc* znZ*@^3HH`WNx)^e<{EKsps4YJ=tVwk)&kcGXM+V=$)pgoayNkfw>>%m0S347H33Tm zw?04tWevBwQ2_@Ax1>!076iAzR{=8#w>D`3zXZ2JWdZa9lQfVJw*z4TKLoe+Z2=n! zw`O_)cLcW(cmY-dx7~sPD+H54su;KRegWtMx9*AoPXv=tAQ-nBhXKw56sutns??(H QXccunAg&QYd5nmJ$wGQt3d%v1h=X?0RaZL_C*0@ z4Yy%g0T%?fTT=lC2Df=#0Wt}= 1 && "CRL".equalsIgnoreCase(args[0])) { + pathValidator.enableCRLCheck(); + } else { + // OCSP check by default + pathValidator.enableOCSPCheck(); + } + + // Validate valid + pathValidator.validate(new String[]{VALID, INT}, + ValidatePathWithParams.Status.GOOD, null, System.out); + + // Validate Revoked + pathValidator.validate(new String[]{REVOKED, INT}, + ValidatePathWithParams.Status.REVOKED, + "Wed Jun 13 23:36:02 PDT 2018", System.out); + + } +} + diff --git a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java index c227f02389..cd31ffb9bf 100644 --- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java +++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ /** * @test * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 - * 8209452 8209506 8210432 8195793 + * 8209452 8209506 8210432 8195793 8216577 * @summary Check root CA entries in cacerts file */ import java.io.File; @@ -42,7 +42,7 @@ public class VerifyCACerts { + File.separator + "security" + File.separator + "cacerts"; // The numbers of certs now. - private static final int COUNT = 92; + private static final int COUNT = 93; // map of cert alias to SHA-256 fingerprint private static final Map FINGERPRINT_MAP @@ -232,6 +232,8 @@ public class VerifyCACerts { "CA:42:DD:41:74:5F:D0:B8:1E:B9:02:36:2C:F9:D8:BF:71:9D:A1:BD:1B:1E:FC:94:6F:5B:4C:99:F4:2C:1B:9E"); put("teliasonerarootcav1 [jdk]", "DD:69:36:FE:21:F8:F0:77:C1:23:A1:A5:21:C1:22:24:F7:22:55:B7:3E:03:A7:26:06:93:E8:A2:4B:0F:A3:89"); + put("globalsignrootcar6 [jdk]", + "2C:AB:EA:FE:37:D0:6C:A2:2A:BA:73:91:C0:03:3D:25:98:29:52:C4:53:64:73:49:76:3A:3A:B5:AD:6C:CF:69"); } }; From 2eb604177e1df2f26c82cfee38e43169bebe7f83 Mon Sep 17 00:00:00 2001 From: aefimov Date: Mon, 21 Jan 2019 17:58:21 +0000 Subject: [PATCH 19/38] 8215330: javax.xml.catalog.CatalogResolverImpl: GroupEntry.matchURI fails to match Reviewed-by: lancea --- .../classes/javax/xml/catalog/GroupEntry.java | 4 +- .../xml/jaxp/unittest/catalog/GroupTest.java | 87 +++++++++++++++++++ .../xml/jaxp/unittest/catalog/GroupTest.xml | 18 ++++ 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.java create mode 100644 test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.xml diff --git a/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java b/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java index 3f52a7bd8f..103078b155 100644 --- a/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java +++ b/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -372,8 +372,10 @@ public String matchURI(String uri) { return match; } else if (grpEntry.longestRewriteMatch > longestRewriteMatch) { rewriteMatch = match; + longestRewriteMatch = grpEntry.longestRewriteMatch; } else if (grpEntry.longestSuffixMatch > longestSuffixMatch) { suffixMatch = match; + longestSuffixMatch = grpEntry.longestSuffixMatch; } break; } diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.java b/test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.java new file mode 100644 index 0000000000..87210e2f97 --- /dev/null +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package catalog; + +import java.net.URI; +import java.nio.file.Paths; +import javax.xml.catalog.CatalogFeatures; +import javax.xml.catalog.CatalogManager; +import javax.xml.catalog.CatalogResolver; +import javax.xml.transform.Source; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; + +/* + * @test + * @bug 8215330 + * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest + * @run testng catalog.GroupTest + * @summary Tests catalog with Group entries. + */ +@Listeners({jaxp.library.FilePolicy.class}) +public class GroupTest extends CatalogSupportBase { + + String catalogGroup; + /* + * Initializing fields + */ + @BeforeClass + public void setUpClass() throws Exception { + super.setUp(); + catalogGroup = Paths.get(filepath + "GroupTest.xml").toUri().toASCIIString(); + } + + /** + * Tests catalog resolution with entries in a group. + * + * @param catalog the catalog to be used + * @param uri an URI to be resolved by the catalog + * @param expected the expected result string + * @throws Exception + */ + @Test(dataProvider = "data_group") + public void testGroup(String catalog, String uri, String expected) throws Exception { + CatalogResolver resolver = CatalogManager.catalogResolver( + CatalogFeatures.defaults(), URI.create(catalog)); + + Source src = resolver.resolve(uri, null); + Assert.assertTrue(src.getSystemId().endsWith(expected), "uriSuffix match"); + } + + + /* + DataProvider: for testing catalogs with group entries + Data: catalog file, uri, expected result string + */ + @DataProvider(name = "data_group") + public Object[][] getDataDOM() { + return new Object[][]{ + {catalogGroup, "http://openjdk_java_net/xml/catalog/A/CommonFileA1.xml", "LocalFileA1.xml"}, + {catalogGroup, "http://openjdk_java_net/xml/catalog/B/CommonFileB1.xml", "LocalFileB1.xml"}, + {catalogGroup, "http://openjdk_java_net/xml/catalog/C/CommonFileC1.xml", "LocalFileC1.xml"}, + }; + } +} diff --git a/test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.xml b/test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.xml new file mode 100644 index 0000000000..039a77a610 --- /dev/null +++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + From aa92dcffb9cd5c176f6c8ce5f4d00be1fd64ccee Mon Sep 17 00:00:00 2001 From: igerasim Date: Tue, 22 Jan 2019 17:42:30 -0800 Subject: [PATCH 20/38] 8211936: Better String parsing Reviewed-by: bpb, darcy Contributed-by: Brian Burkhalter , Joe Darcy , Paul Hohensee --- .../share/classes/java/math/BigDecimal.java | 50 +++- .../math/BigDecimal/IntValueExactTests.java | 120 +++++++++ .../math/BigDecimal/IntegralValueTests.java | 241 ++++++++++++++++++ .../math/BigDecimal/LongValueExactTests.java | 107 +++++--- 4 files changed, 470 insertions(+), 48 deletions(-) create mode 100644 test/jdk/java/math/BigDecimal/IntValueExactTests.java create mode 100644 test/jdk/java/math/BigDecimal/IntegralValueTests.java diff --git a/src/java.base/share/classes/java/math/BigDecimal.java b/src/java.base/share/classes/java/math/BigDecimal.java index be298d93d8..cac8697620 100644 --- a/src/java.base/share/classes/java/math/BigDecimal.java +++ b/src/java.base/share/classes/java/math/BigDecimal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3410,9 +3410,32 @@ public BigInteger toBigIntegerExact() { */ @Override public long longValue(){ - return (intCompact != INFLATED && scale == 0) ? - intCompact: - toBigInteger().longValue(); + if (intCompact != INFLATED && scale == 0) { + return intCompact; + } else { + // Fastpath zero and small values + if (this.signum() == 0 || fractionOnly() || + // Fastpath very large-scale values that will result + // in a truncated value of zero. If the scale is -64 + // or less, there are at least 64 powers of 10 in the + // value of the numerical result. Since 10 = 2*5, in + // that case there would also be 64 powers of 2 in the + // result, meaning all 64 bits of a long will be zero. + scale <= -64) { + return 0; + } else { + return toBigInteger().longValue(); + } + } + } + + /** + * Return true if a nonzero BigDecimal has an absolute value less + * than one; i.e. only has fraction digits. + */ + private boolean fractionOnly() { + assert this.signum() != 0; + return (this.precision() - this.scale) <= 0; } /** @@ -3430,15 +3453,20 @@ public long longValue(){ public long longValueExact() { if (intCompact != INFLATED && scale == 0) return intCompact; - // If more than 19 digits in integer part it cannot possibly fit - if ((precision() - scale) > 19) // [OK for negative scale too] - throw new java.lang.ArithmeticException("Overflow"); - // Fastpath zero and < 1.0 numbers (the latter can be very slow - // to round if very small) + + // Fastpath zero if (this.signum() == 0) return 0; - if ((this.precision() - this.scale) <= 0) + + // Fastpath numbers less than 1.0 (the latter can be very slow + // to round if very small) + if (fractionOnly()) throw new ArithmeticException("Rounding necessary"); + + // If more than 19 digits in integer part it cannot possibly fit + if ((precision() - scale) > 19) // [OK for negative scale too] + throw new java.lang.ArithmeticException("Overflow"); + // round to an integer, with Exception if decimal part non-0 BigDecimal num = this.setScale(0, ROUND_UNNECESSARY); if (num.precision() >= 19) // need to check carefully @@ -3482,7 +3510,7 @@ public static void check(BigDecimal num) { public int intValue() { return (intCompact != INFLATED && scale == 0) ? (int)intCompact : - toBigInteger().intValue(); + (int)longValue(); } /** diff --git a/test/jdk/java/math/BigDecimal/IntValueExactTests.java b/test/jdk/java/math/BigDecimal/IntValueExactTests.java new file mode 100644 index 0000000000..f0ce1886b6 --- /dev/null +++ b/test/jdk/java/math/BigDecimal/IntValueExactTests.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8211936 + * @summary Tests of BigDecimal.intValueExact + */ +import java.math.*; +import java.util.List; +import java.util.Map; +import static java.util.Map.entry; + +public class IntValueExactTests { + public static void main(String... args) { + int failures = 0; + + failures += intValueExactSuccessful(); + failures += intValueExactExceptional(); + + if (failures > 0) { + throw new RuntimeException("Incurred " + failures + + " failures while testing intValueExact."); + } + } + + private static int simpleIntValueExact(BigDecimal bd) { + return bd.toBigIntegerExact().intValue(); + } + + private static int intValueExactSuccessful() { + int failures = 0; + + // Strings used to create BigDecimal instances on which invoking + // intValueExact() will succeed. + Map successCases = + Map.ofEntries(entry(new BigDecimal("2147483647"), Integer.MAX_VALUE), // 2^31 -1 + entry(new BigDecimal("2147483647.0"), Integer.MAX_VALUE), + entry(new BigDecimal("2147483647.00"), Integer.MAX_VALUE), + + entry(new BigDecimal("-2147483648"), Integer.MIN_VALUE), // -2^31 + entry(new BigDecimal("-2147483648.0"), Integer.MIN_VALUE), + entry(new BigDecimal("-2147483648.00"),Integer.MIN_VALUE), + + entry(new BigDecimal("1e0"), 1), + entry(new BigDecimal(BigInteger.ONE, -9), 1_000_000_000), + + entry(new BigDecimal("0e13"), 0), // Fast path zero + entry(new BigDecimal("0e32"), 0), + entry(new BigDecimal("0e512"), 0), + + entry(new BigDecimal("10.000000000000000000000000000000000"), 10)); + + for (var testCase : successCases.entrySet()) { + BigDecimal bd = testCase.getKey(); + int expected = testCase.getValue(); + try { + int intValueExact = bd.intValueExact(); + if (expected != intValueExact || + intValueExact != simpleIntValueExact(bd)) { + failures++; + System.err.println("Unexpected intValueExact result " + intValueExact + + " on " + bd); + } + } catch (Exception e) { + failures++; + System.err.println("Error on " + bd + "\tException message:" + e.getMessage()); + } + } + return failures; + } + + private static int intValueExactExceptional() { + int failures = 0; + List exceptionalCases = + List.of(new BigDecimal("2147483648"), // Integer.MAX_VALUE + 1 + new BigDecimal("2147483648.0"), + new BigDecimal("2147483648.00"), + new BigDecimal("-2147483649"), // Integer.MIN_VALUE - 1 + new BigDecimal("-2147483649.1"), + new BigDecimal("-2147483649.01"), + + new BigDecimal("9999999999999999999999999999999"), + new BigDecimal("10000000000000000000000000000000"), + + new BigDecimal("0.99"), + new BigDecimal("0.999999999999999999999")); + + for (BigDecimal bd : exceptionalCases) { + try { + int intValueExact = bd.intValueExact(); + failures++; + System.err.println("Unexpected non-exceptional intValueExact on " + bd); + } catch (ArithmeticException e) { + // Success; + } + } + return failures; + } +} diff --git a/test/jdk/java/math/BigDecimal/IntegralValueTests.java b/test/jdk/java/math/BigDecimal/IntegralValueTests.java new file mode 100644 index 0000000000..c51574ea54 --- /dev/null +++ b/test/jdk/java/math/BigDecimal/IntegralValueTests.java @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8211936 + * @summary Tests of BigDecimal.intValue() and BigDecimal.longValue() + */ +import java.math.BigDecimal; +import java.util.Map; + +public class IntegralValueTests { + public static void main(String... args) { + int failures = + integralValuesTest(INT_VALUES, true) + + integralValuesTest(LONG_VALUES, false); + if (failures != 0) { + throw new RuntimeException + ("Incurred " + failures + " failures for {int,long}Value()."); + } + } + + private static final Map INT_VALUES = + Map.ofEntries( + + // 2**31 - 1 + Map.entry(new BigDecimal("2147483647"), Integer.MAX_VALUE), + Map.entry(new BigDecimal("2147483647.0"), Integer.MAX_VALUE), + Map.entry(new BigDecimal("2147483647.00"), Integer.MAX_VALUE), + + Map.entry(new BigDecimal("-2147483647"), -Integer.MAX_VALUE), + Map.entry(new BigDecimal("-2147483647.0"), -Integer.MAX_VALUE), + + // -2**31 + Map.entry(new BigDecimal("-2147483648"), Integer.MIN_VALUE), + Map.entry(new BigDecimal("-2147483648.1"), Integer.MIN_VALUE), + Map.entry(new BigDecimal("-2147483648.01"), Integer.MIN_VALUE), + + // -2**31 + 1 truncation to 2**31 - 1 + Map.entry(new BigDecimal("-2147483649"), Integer.MAX_VALUE), + + // 2**64 - 1 truncation to 1 + Map.entry(new BigDecimal("4294967295"), -1), + + // 2**64 truncation to 0 + Map.entry(new BigDecimal("4294967296"), 0), + + // Fast path truncation to 0 + Map.entry(new BigDecimal("1e32"), 0), + + // Slow path truncation to -2**31 + Map.entry(new BigDecimal("1e31"), Integer.MIN_VALUE), + + // Slow path + Map.entry(new BigDecimal("1e0"), 1), + + // Fast path round to 0 + Map.entry(new BigDecimal("9e-1"), 0), + + // Some random values + Map.entry(new BigDecimal("900e-1"), 90), // Increasing negative exponents + Map.entry(new BigDecimal("900e-2"), 9), + Map.entry(new BigDecimal("900e-3"), 0), + + // Fast path round to 0 + Map.entry(new BigDecimal("123456789e-9"), 0), + + // Slow path round to 1 + Map.entry(new BigDecimal("123456789e-8"), 1), + + // Increasing positive exponents + Map.entry(new BigDecimal("10000001e1"), 100000010), + Map.entry(new BigDecimal("10000001e10"), -1315576832), + Map.entry(new BigDecimal("10000001e100"), 0), + Map.entry(new BigDecimal("10000001e1000"), 0), + Map.entry(new BigDecimal("10000001e10000"), 0), + Map.entry(new BigDecimal("10000001e100000"), 0), + Map.entry(new BigDecimal("10000001e1000000"), 0), + Map.entry(new BigDecimal("10000001e10000000"), 0), + Map.entry(new BigDecimal("10000001e100000000"), 0), + Map.entry(new BigDecimal("10000001e1000000000"), 0), + + // Increasing negative exponents + Map.entry(new BigDecimal("10000001e-1"), 1000000), + Map.entry(new BigDecimal("10000001e-10"), 0), + Map.entry(new BigDecimal("10000001e-100"), 0), + Map.entry(new BigDecimal("10000001e-1000"), 0), + Map.entry(new BigDecimal("10000001e-10000"), 0), + Map.entry(new BigDecimal("10000001e-100000"), 0), + Map.entry(new BigDecimal("10000001e-1000000"), 0), + Map.entry(new BigDecimal("10000001e-10000000"), 0), + Map.entry(new BigDecimal("10000001e-100000000"), 0), + Map.entry(new BigDecimal("10000001e-1000000000"), 0), + + // Currency calculation to 4 places + Map.entry(new BigDecimal("12345.0001"), 12345), + Map.entry(new BigDecimal("12345.9999"), 12345), + Map.entry(new BigDecimal("-12345.0001"), -12345), + Map.entry(new BigDecimal("-12345.9999"), -12345)); + + private static final Map LONG_VALUES = + Map.ofEntries( + // 2**63 - 1 + Map.entry(new BigDecimal("9223372036854775807"), Long.MAX_VALUE), + Map.entry(new BigDecimal("9223372036854775807.0"), Long.MAX_VALUE), + Map.entry(new BigDecimal("9223372036854775807.00"), Long.MAX_VALUE), + + // 2**63 truncation to -2**63 + Map.entry(new BigDecimal("-9223372036854775808"), Long.MIN_VALUE), + Map.entry(new BigDecimal("-9223372036854775808.1"), Long.MIN_VALUE), + Map.entry(new BigDecimal("-9223372036854775808.01"), Long.MIN_VALUE), + + // -2**63 + 1 truncation to 2**63 - 1 + Map.entry(new BigDecimal("-9223372036854775809"), 9223372036854775807L), + + // 2**64 - 1 truncation to -1 + Map.entry(new BigDecimal("18446744073709551615"), -1L), + + // 2**64 truncation to 0 + Map.entry(new BigDecimal("18446744073709551616"), 0L), + + // Slow path truncation to -2**63 + Map.entry(new BigDecimal("1e63"), -9223372036854775808L), + Map.entry(new BigDecimal("-1e63"), -9223372036854775808L), + // Fast path with larger magnitude scale + Map.entry(new BigDecimal("1e64"), 0L), + Map.entry(new BigDecimal("-1e64"), 0L), + Map.entry(new BigDecimal("1e65"), 0L), + Map.entry(new BigDecimal("-1e65"), 0L), + + // Slow path + Map.entry(new BigDecimal("1e0"), 1L), + + // Fast path round to 0 + Map.entry(new BigDecimal("9e-1"), 0L), + + // Some random values + Map.entry(new BigDecimal("900e-1"), 90L), // Increasing negative exponents + Map.entry(new BigDecimal("900e-2"), 9L), + Map.entry(new BigDecimal("900e-3"), 0L), + + // Fast path round to 0 + Map.entry(new BigDecimal("123456789e-9"), 0L), + + // Slow path round to 1 + Map.entry(new BigDecimal("123456789e-8"), 1L), + + // Increasing positive exponents + Map.entry(new BigDecimal("10000001e1"), 100000010L), + Map.entry(new BigDecimal("10000001e10"), 100000010000000000L), + Map.entry(new BigDecimal("10000001e100"), 0L), + Map.entry(new BigDecimal("10000001e1000"), 0L), + Map.entry(new BigDecimal("10000001e10000"), 0L), + Map.entry(new BigDecimal("10000001e100000"), 0L), + Map.entry(new BigDecimal("10000001e1000000"), 0L), + Map.entry(new BigDecimal("10000001e10000000"), 0L), + Map.entry(new BigDecimal("10000001e100000000"), 0L), + Map.entry(new BigDecimal("10000001e1000000000"), 0L), + + // Increasing negative exponents + Map.entry(new BigDecimal("10000001e-1"), 1000000L), + Map.entry(new BigDecimal("10000001e-10"), 0L), + Map.entry(new BigDecimal("10000001e-100"), 0L), + Map.entry(new BigDecimal("10000001e-1000"), 0L), + Map.entry(new BigDecimal("10000001e-10000"), 0L), + Map.entry(new BigDecimal("10000001e-100000"), 0L), + Map.entry(new BigDecimal("10000001e-1000000"), 0L), + Map.entry(new BigDecimal("10000001e-10000000"), 0L), + Map.entry(new BigDecimal("10000001e-100000000"), 0L), + Map.entry(new BigDecimal("10000001e-1000000000"), 0L), + + // Currency calculation to 4 places + Map.entry(new BigDecimal("12345.0001"), 12345L), + Map.entry(new BigDecimal("12345.9999"), 12345L), + Map.entry(new BigDecimal("-12345.0001"), -12345L), + Map.entry(new BigDecimal("-12345.9999"), -12345L)); + + private static int integralValuesTest(Map v, boolean isInt) { + System.err.format("Testing %s%n", isInt ? "Integer" : "Long"); + int failures = 0; + for (var testCase : v.entrySet()) { + BigDecimal bd = testCase.getKey(); + Number expected = testCase.getValue(); + try { + if (isInt) { + int intValue = bd.intValue(); + if (intValue != (int)expected) { + failures += reportError(bd, expected, intValue, isInt); + } + } else { + long longValue = bd.longValue(); + if (longValue != (long)expected) { + failures += reportError(bd, expected, longValue, isInt); + } + } + } catch (Exception e) { + failures++; + System.err.format("Unexpected exception %s for %s%n", + e, bd.toString()); + } + } + return failures; + } + + private static int reportError(BigDecimal bd, Number expected, long longValue, boolean isInt) { + System.err.format("For %s, scale=%d, expected %d, actual %d, simple %d%n", + bd.toString(), bd.scale(), + (isInt ? (Integer) expected : (Long) expected ), + longValue, + (isInt ? simpleIntValue(bd): simpleLongValue(bd) )); + return 1; + } + + private static long simpleLongValue(BigDecimal bd) { + return bd.toBigInteger().longValue(); + } + + private static int simpleIntValue(BigDecimal bd) { + return bd.toBigInteger().intValue(); + } +} diff --git a/test/jdk/java/math/BigDecimal/LongValueExactTests.java b/test/jdk/java/math/BigDecimal/LongValueExactTests.java index f04a345389..7a6ad0b580 100644 --- a/test/jdk/java/math/BigDecimal/LongValueExactTests.java +++ b/test/jdk/java/math/BigDecimal/LongValueExactTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,65 +23,98 @@ /** * @test - * @bug 6806261 + * @bug 6806261 8211936 * @summary Tests of BigDecimal.longValueExact */ import java.math.*; +import java.util.List; +import java.util.Map; +import static java.util.Map.entry; public class LongValueExactTests { + public static void main(String... args) { + int failures = 0; + + failures += longValueExactSuccessful(); + failures += longValueExactExceptional(); + + if (failures > 0) { + throw new RuntimeException("Incurred " + failures + + " failures while testing longValueExact."); + } + } - private static int longValueExactTests() { + private static long simpleLongValueExact(BigDecimal bd) { + return bd.toBigIntegerExact().longValue(); + } + + private static int longValueExactSuccessful() { int failures = 0; - String[] testStrings = { - "9223372036854775807", - "9223372036854775807.0", - "9223372036854775807.00", - "-9223372036854775808", - "-9223372036854775808.0", - "-9223372036854775808.00", - }; + // Strings used to create BigDecimal instances on which invoking + // longValueExact() will succeed. + Map successCases = + Map.ofEntries(entry(new BigDecimal("9223372036854775807"), Long.MAX_VALUE), // 2^63 -1 + entry(new BigDecimal("9223372036854775807.0"), Long.MAX_VALUE), + entry(new BigDecimal("9223372036854775807.00"), Long.MAX_VALUE), + + entry(new BigDecimal("-9223372036854775808"), Long.MIN_VALUE), // -2^63 + entry(new BigDecimal("-9223372036854775808.0"), Long.MIN_VALUE), + entry(new BigDecimal("-9223372036854775808.00"),Long.MIN_VALUE), + + entry(new BigDecimal("1e0"), 1L), + entry(new BigDecimal(BigInteger.ONE, -18), 1_000_000_000_000_000_000L), - for (String longValue : testStrings) { + entry(new BigDecimal("0e13"), 0L), // Fast path zero + entry(new BigDecimal("0e64"), 0L), + entry(new BigDecimal("0e1024"), 0L), + + entry(new BigDecimal("10.000000000000000000000000000000000"), 10L)); + + for (var testCase : successCases.entrySet()) { + BigDecimal bd = testCase.getKey(); + long expected = testCase.getValue(); try { - BigDecimal bd = new BigDecimal(longValue); long longValueExact = bd.longValueExact(); + if (expected != longValueExact || + longValueExact != simpleLongValueExact(bd)) { + failures++; + System.err.println("Unexpected longValueExact result " + longValueExact + + " on " + bd); + } } catch (Exception e) { failures++; + System.err.println("Error on " + bd + "\tException message:" + e.getMessage()); } } + return failures; + } + + private static int longValueExactExceptional() { + int failures = 0; + List exceptionalCases = + List.of(new BigDecimal("9223372036854775808"), // Long.MAX_VALUE + 1 + new BigDecimal("9223372036854775808.0"), + new BigDecimal("9223372036854775808.00"), + new BigDecimal("-9223372036854775809"), // Long.MIN_VALUE - 1 + new BigDecimal("-9223372036854775808.1"), + new BigDecimal("-9223372036854775808.01"), + + new BigDecimal("9999999999999999999"), + new BigDecimal("10000000000000000000"), - // The following Strings are supposed to make longValueExact throw - // ArithmeticException. - String[] testStrings2 = { - "9223372036854775808", - "9223372036854775808.0", - "9223372036854775808.00", - "-9223372036854775809", - "-9223372036854775808.1", - "-9223372036854775808.01", - }; - - for (String bigValue : testStrings2) { + new BigDecimal("0.99"), + new BigDecimal("0.999999999999999999999")); + + for (BigDecimal bd : exceptionalCases) { try { - BigDecimal bd = new BigDecimal(bigValue); long longValueExact = bd.longValueExact(); failures++; + System.err.println("Unexpected non-exceptional longValueExact on " + bd); } catch (ArithmeticException e) { // Success; } } return failures; } - - public static void main(String argv[]) { - int failures = 0; - - failures += longValueExactTests(); - - if (failures > 0) { - throw new RuntimeException("Incurred " + failures + - " failures while testing longValueExact."); - } - } } From 805d6bb02a512c2fe64c49a6d2cc7b60c51315c9 Mon Sep 17 00:00:00 2001 From: diazhou Date: Wed, 23 Jan 2019 12:53:18 +0000 Subject: [PATCH 21/38] Added tag jdk-12.0.1+4 for changeset 9a91d1dc777a --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 930c3b0f0c..dadcff1145 100644 --- a/.hgtags +++ b/.hgtags @@ -534,3 +534,4 @@ f15d443f97318e9b40e6f451e327ff69ed4ec361 jdk-12+27 60ff8949381adea46f489f6bbecf9232a028e830 jdk-12.0.1+1 c3fc07bf408084671904abac6b1873aebf7983c7 jdk-12.0.1+2 d52a133717eef8e05abd6d12bb75d943607c517c jdk-12.0.1+3 +9a91d1dc777a633330e5d99f78123e46c3b2cdf2 jdk-12.0.1+4 From 069e6bc5e6fd59569731eccfd21090e0dc17093b Mon Sep 17 00:00:00 2001 From: diazhou Date: Tue, 29 Jan 2019 00:16:55 +0000 Subject: [PATCH 22/38] 8217469: CPU+Apr+2019: Change builds from ea to fcs for 11.0.3 and 12.0.1 Reviewed-by: erikj, tbell --- make/conf/jib-profiles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 8cf01a4e0e..ab45e1c2c3 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -1154,7 +1154,7 @@ var versionArgs = function(input, common) { args = concat(args, // This needs to be changed when we start building release candidates // with-version-pre must be set to ea for 'ea' and empty for fcs build - "--with-version-pre=ea", + "--with-version-pre=", "--without-version-opt"); } else { args = concat(args, "--with-version-opt=" + common.build_id); From 8098ee2f2b822f5903289e21d66c1f6a28c5eed2 Mon Sep 17 00:00:00 2001 From: diazhou Date: Wed, 30 Jan 2019 00:00:44 +0000 Subject: [PATCH 23/38] 8217973: JDK 12.0.1 - Release Date is wrong Reviewed-by: erikj, tbell --- make/autoconf/version-numbers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/autoconf/version-numbers b/make/autoconf/version-numbers index 1988c19d86..c707cd1c04 100644 --- a/make/autoconf/version-numbers +++ b/make/autoconf/version-numbers @@ -32,7 +32,7 @@ DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 DEFAULT_VERSION_EXTRA3=0 -DEFAULT_VERSION_DATE=2019-03-19 +DEFAULT_VERSION_DATE=2019-04-16 DEFAULT_VERSION_CLASSFILE_MAJOR=56 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 DEFAULT_ACCEPTABLE_BOOT_VERSIONS="11 12" From 8b9bf3024a7b160fb27366d8336a9db550f45b95 Mon Sep 17 00:00:00 2001 From: diazhou Date: Wed, 30 Jan 2019 08:36:41 -0800 Subject: [PATCH 24/38] Added tag jdk-12.0.1+5 for changeset c9c530b917a3 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index dadcff1145..7113ee698d 100644 --- a/.hgtags +++ b/.hgtags @@ -535,3 +535,4 @@ f15d443f97318e9b40e6f451e327ff69ed4ec361 jdk-12+27 c3fc07bf408084671904abac6b1873aebf7983c7 jdk-12.0.1+2 d52a133717eef8e05abd6d12bb75d943607c517c jdk-12.0.1+3 9a91d1dc777a633330e5d99f78123e46c3b2cdf2 jdk-12.0.1+4 +c9c530b917a3479a25c4b9eaca2c31a37e2e5206 jdk-12.0.1+5 From bb4aa6bdbba6287cbd46a2287ecf32f74618df71 Mon Sep 17 00:00:00 2001 From: diazhou Date: Tue, 5 Feb 2019 20:26:35 -0800 Subject: [PATCH 25/38] Added tag jdk-12.0.1+6 for changeset 0c9a2cd825dc --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 3cd773f0fc..a1d067fea5 100644 --- a/.hgtags +++ b/.hgtags @@ -538,3 +538,4 @@ c3fc07bf408084671904abac6b1873aebf7983c7 jdk-12.0.1+2 d52a133717eef8e05abd6d12bb75d943607c517c jdk-12.0.1+3 9a91d1dc777a633330e5d99f78123e46c3b2cdf2 jdk-12.0.1+4 c9c530b917a3479a25c4b9eaca2c31a37e2e5206 jdk-12.0.1+5 +0c9a2cd825dc312270eb7b043baef59a289ad9ec jdk-12.0.1+6 From d19d1b6f7b45f47a2d93d67f971a8fb18d418c54 Mon Sep 17 00:00:00 2001 From: diazhou Date: Tue, 12 Feb 2019 23:53:17 -0800 Subject: [PATCH 26/38] Added tag jdk-12.0.1+7 for changeset e4607e374223 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a1d067fea5..7f1cccdc55 100644 --- a/.hgtags +++ b/.hgtags @@ -539,3 +539,4 @@ d52a133717eef8e05abd6d12bb75d943607c517c jdk-12.0.1+3 9a91d1dc777a633330e5d99f78123e46c3b2cdf2 jdk-12.0.1+4 c9c530b917a3479a25c4b9eaca2c31a37e2e5206 jdk-12.0.1+5 0c9a2cd825dc312270eb7b043baef59a289ad9ec jdk-12.0.1+6 +e4607e374223b6fc9e2883ee52ae4971c21e6757 jdk-12.0.1+7 From d9245d849ef05e94ca6f27f51b8f0b4ad6b17a4f Mon Sep 17 00:00:00 2001 From: diazhou Date: Tue, 19 Feb 2019 22:26:31 -0800 Subject: [PATCH 27/38] Added tag jdk-12.0.1+8 for changeset efc36b43b3f9 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 7f1cccdc55..500a159862 100644 --- a/.hgtags +++ b/.hgtags @@ -540,3 +540,4 @@ d52a133717eef8e05abd6d12bb75d943607c517c jdk-12.0.1+3 c9c530b917a3479a25c4b9eaca2c31a37e2e5206 jdk-12.0.1+5 0c9a2cd825dc312270eb7b043baef59a289ad9ec jdk-12.0.1+6 e4607e374223b6fc9e2883ee52ae4971c21e6757 jdk-12.0.1+7 +efc36b43b3f9fbe174336f364954c85cb7a7747b jdk-12.0.1+8 From 81242cb2c959ef0120d4b3e356c389d00e5dc264 Mon Sep 17 00:00:00 2001 From: igerasim Date: Mon, 18 Feb 2019 11:44:57 -0800 Subject: [PATCH 28/38] 8218453: More dynamic RMI interactions Reviewed-by: ahgross, skoivu, smarks --- .../sun/rmi/registry/RegistryImpl_Skel.java | 22 ++- .../sun/rmi/server/UnicastServerRef.java | 23 +-- .../NonLocalSkeletonTest.java | 171 ++++++++++++++++++ 3 files changed, 202 insertions(+), 14 deletions(-) create mode 100644 test/jdk/java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java diff --git a/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl_Skel.java b/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl_Skel.java index 842d477195..6807a328b1 100644 --- a/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl_Skel.java +++ b/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl_Skel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,8 +58,24 @@ public java.rmi.server.Operation[] getOperations() { public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception { - if (hash != interfaceHash) - throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch"); + if (opnum < 0) { + if (hash == 7583982177005850366L) { + opnum = 0; + } else if (hash == 2571371476350237748L) { + opnum = 1; + } else if (hash == -7538657168040752697L) { + opnum = 2; + } else if (hash == -8381844669958460146L) { + opnum = 3; + } else if (hash == 7305022919901907578L) { + opnum = 4; + } else { + throw new java.rmi.UnmarshalException("invalid method hash"); + } + } else { + if (hash != interfaceHash) + throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch"); + } sun.rmi.registry.RegistryImpl server = (sun.rmi.registry.RegistryImpl) obj; switch (opnum) { diff --git a/src/java.rmi/share/classes/sun/rmi/server/UnicastServerRef.java b/src/java.rmi/share/classes/sun/rmi/server/UnicastServerRef.java index 9dbaed70c5..06980f17c0 100644 --- a/src/java.rmi/share/classes/sun/rmi/server/UnicastServerRef.java +++ b/src/java.rmi/share/classes/sun/rmi/server/UnicastServerRef.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,7 @@ import java.rmi.ServerException; import java.rmi.UnmarshalException; import java.rmi.server.ExportException; +import java.rmi.server.Operation; import java.rmi.server.RemoteCall; import java.rmi.server.RemoteRef; import java.rmi.server.RemoteStub; @@ -292,15 +293,14 @@ public void dispatch(Remote obj, RemoteCall call) throws IOException { throw new UnmarshalException("error unmarshalling call header", readEx); } - if (num >= 0) { - if (skel != null) { + if (skel != null) { + // If there is a skeleton, use it oldDispatch(obj, call, num); return; - } else { - throw new UnmarshalException( - "skeleton class not found but required " + - "for client version"); - } + + } else if (num >= 0){ + throw new UnmarshalException( + "skeleton class not found but required for client version"); } try { op = in.readLong(); @@ -428,8 +428,8 @@ protected void unmarshalCustomCallData(ObjectInput in) /** * Handle server-side dispatch using the RMI 1.1 stub/skeleton - * protocol, given a non-negative operation number that has - * already been read from the call stream. + * protocol, given a non-negative operation number or negative method hash + * that has already been read from the call stream. * Exceptions are handled by the caller to be sent to the remote client. * * @param obj the target remote object for the call @@ -461,7 +461,8 @@ private void oldDispatch(Remote obj, RemoteCall call, int op) } // if calls are being logged, write out object id and operation - logCall(obj, skel.getOperations()[op]); + Operation[] operations = skel.getOperations(); + logCall(obj, op >= 0 && op < operations.length ? operations[op] : "op: " + op); unmarshalCustomCallData(in); // dispatch to skeleton for remote object skel.dispatch(obj, call, op, hash); diff --git a/test/jdk/java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java b/test/jdk/java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java new file mode 100644 index 0000000000..679ae3b0b3 --- /dev/null +++ b/test/jdk/java/rmi/registry/nonLocalRegistry/NonLocalSkeletonTest.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import sun.rmi.server.UnicastRef; +import sun.rmi.transport.LiveRef; +import sun.rmi.transport.tcp.TCPEndpoint; + +import java.lang.reflect.InvocationHandler; + +import java.lang.reflect.Proxy; +import java.net.InetAddress; +import java.rmi.AccessException; +import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; +import java.rmi.server.ObjID; +import java.rmi.server.RemoteObjectInvocationHandler; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Set; + + +/* @test + * @bug 8218453 + * @library ../../testlibrary + * @modules java.rmi/sun.rmi.registry:+open java.rmi/sun.rmi.server:+open + * java.rmi/sun.rmi.transport:+open java.rmi/sun.rmi.transport.tcp:+open + * @summary Verify that Registry rejects non-local access for bind, unbind, rebind. + * The test is manual because the (non-local) host running rmiregistry must be supplied as a property. + * @run main/othervm -Dregistry.host=localhost NonLocalSkeletonTest + */ + +/* + * @test + * @library ../../testlibrary + * @modules java.rmi/sun.rmi.registry:+open java.rmi/sun.rmi.server:+open + * java.rmi/sun.rmi.transport:+open java.rmi/sun.rmi.transport.tcp:+open + * @summary Verify that Registry rejects non-local access for bind, unbind, rebind. + * The test is manual because the (non-local) host running rmiregistry must be supplied as a property. + * @run main/othervm/manual -Dregistry.host=rmi-registry-host NonLocalSkeletonTest + */ + +/** + * Verify that access checks for Registry.bind(), .rebind(), and .unbind() + * are prevented on remote access to the registry. + * + * This test is a manual test and uses a standard rmiregistry running + * on a *different* host. + * The test verifies that the access check is performed *before* the object to be + * bound or rebound is deserialized. + * + * Login or ssh to the different host and invoke {@code $JDK_HOME/bin/rmiregistry}. + * It will not show any output. + * + * On the first host modify the @run command above to replace "rmi-registry-host" + * with the hostname or IP address of the different host and run the test with jtreg. + */ +public class NonLocalSkeletonTest { + + public static void main(String[] args) throws Exception { + String host = System.getProperty("registry.host"); + if (host == null || host.isEmpty()) { + throw new RuntimeException("supply a remote host with -Dregistry.host=hostname"); + } + + // Check if running the test on a local system; it only applies to remote + String myHostName = InetAddress.getLocalHost().getHostName(); + Set myAddrs = Set.of(InetAddress.getAllByName(myHostName)); + Set hostAddrs = Set.of(InetAddress.getAllByName(host)); + boolean isLocal = (hostAddrs.stream().anyMatch(i -> myAddrs.contains(i)) + || hostAddrs.stream().anyMatch(h -> h.isLoopbackAddress())); + + int port; + if (isLocal) { + // Create a local Registry to use for the test + port = TestLibrary.getUnusedRandomPort(); + Registry registry = LocateRegistry.createRegistry(port); + System.out.printf("local registry port: %s%n", registry); + } else { + // Use regular rmi registry for non-local test + port = Registry.REGISTRY_PORT; + } + + try { + + Registry r = nonStaticRegistryProxy(host, port); + + System.out.printf("RegistryRef: %s%n", r); + + r.rebind("anyRef", r); + if (!isLocal) { + throw new RuntimeException("non-local bind should have failed to host: " + host); + } else { + System.out.printf("local rebind succeeded%n"); + } + } catch (RemoteException rex) { + if (!isLocal) { + assertIsAccessException(rex); + } else { + throw rex; + } + } + } + + /* Returns a non-static proxy for the registry. + * Follows the form of sun.rmi.server.Util.createProxy. + * @param implClass the RegistryImpl + * @param clientRef the registry reference + **/ + static Registry nonStaticRegistryProxy(String host, int port) { + final ClassLoader loader = Registry.class.getClassLoader(); + final Class[] interfaces = new Class[]{Registry.class}; + + LiveRef liveRef = new LiveRef(new ObjID(ObjID.REGISTRY_ID), + new TCPEndpoint(host, port, null, null), + false); + + final InvocationHandler handler = new RemoteObjectInvocationHandler(new UnicastRef(liveRef)); + + PrivilegedAction action = () -> (Registry) Proxy.newProxyInstance(loader, + interfaces, handler); + return AccessController.doPrivileged(action); + } + + /** + * Check the exception chain for the expected AccessException and message. + * @param ex the exception from the remote invocation. + */ + private static void assertIsAccessException(Throwable ex) { + Throwable t = ex; + while (!(t instanceof AccessException) && t.getCause() != null) { + t = t.getCause(); + } + if (t instanceof AccessException) { + String msg = t.getMessage(); + int asIndex = msg.indexOf("Registry"); + int rrIndex = msg.indexOf("Registry.Registry"); // Obsolete error text + int disallowIndex = msg.indexOf("disallowed"); + int nonLocalHostIndex = msg.indexOf("non-local host"); + if (asIndex < 0 || + rrIndex != -1 || + disallowIndex < 0 || + nonLocalHostIndex < 0 ) { + throw new RuntimeException("exception message is malformed", t); + } + System.out.printf("Found expected AccessException: %s%n%n", t); + } else { + throw new RuntimeException("AccessException did not occur when expected", ex); + } + } +} From 0e5020806d18c2d9f03d03c0c1e9440c9f0394ce Mon Sep 17 00:00:00 2001 From: mbaesken Date: Fri, 4 Jan 2019 17:46:56 +0100 Subject: [PATCH 29/38] 8215962: Support ThreadPriorityPolicy mode 1 for non-root users on linux/bsd Reviewed-by: dcubed, dholmes --- src/hotspot/os/bsd/os_bsd.cpp | 14 +++++++------- src/hotspot/os/linux/os_linux.cpp | 13 ++++++------- src/hotspot/share/runtime/globals.hpp | 3 ++- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 2ba1bae954..91d59a8f31 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2272,7 +2272,8 @@ void os::naked_yield() { // not the entire user process, and user level threads are 1:1 mapped to kernel // threads. It has always been the case, but could change in the future. For // this reason, the code should not be used as default (ThreadPriorityPolicy=0). -// It is only used when ThreadPriorityPolicy=1 and requires root privilege. +// It is only used when ThreadPriorityPolicy=1 and may require system level permission +// (e.g., root privilege or CAP_SYS_NICE capability). #if !defined(__APPLE__) int os::java_to_os_priority[CriticalPriority + 1] = { @@ -2319,14 +2320,12 @@ int os::java_to_os_priority[CriticalPriority + 1] = { static int prio_init() { if (ThreadPriorityPolicy == 1) { - // Only root can raise thread priority. Don't allow ThreadPriorityPolicy=1 - // if effective uid is not root. Perhaps, a more elegant way of doing - // this is to test CAP_SYS_NICE capability, but that will require libcap.so if (geteuid() != 0) { if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) { - warning("-XX:ThreadPriorityPolicy requires root privilege on Bsd"); + warning("-XX:ThreadPriorityPolicy=1 may require system level permission, " \ + "e.g., being the root user. If the necessary permission is not " \ + "possessed, changes to priority will be silently ignored."); } - ThreadPriorityPolicy = 0; } } if (UseCriticalJavaThreadPriority) { @@ -2343,6 +2342,7 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) { return OS_OK; #elif defined(__FreeBSD__) int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri); + return (ret == 0) ? OS_OK : OS_ERR; #elif defined(__APPLE__) || defined(__NetBSD__) struct sched_param sp; int policy; diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 921b8412a5..0846ccf4eb 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -4091,7 +4091,8 @@ void os::naked_yield() { // not the entire user process, and user level threads are 1:1 mapped to kernel // threads. It has always been the case, but could change in the future. For // this reason, the code should not be used as default (ThreadPriorityPolicy=0). -// It is only used when ThreadPriorityPolicy=1 and requires root privilege. +// It is only used when ThreadPriorityPolicy=1 and may require system level permission +// (e.g., root privilege or CAP_SYS_NICE capability). int os::java_to_os_priority[CriticalPriority + 1] = { 19, // 0 Entry should never be used @@ -4115,14 +4116,12 @@ int os::java_to_os_priority[CriticalPriority + 1] = { static int prio_init() { if (ThreadPriorityPolicy == 1) { - // Only root can raise thread priority. Don't allow ThreadPriorityPolicy=1 - // if effective uid is not root. Perhaps, a more elegant way of doing - // this is to test CAP_SYS_NICE capability, but that will require libcap.so if (geteuid() != 0) { if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) { - warning("-XX:ThreadPriorityPolicy requires root privilege on Linux"); + warning("-XX:ThreadPriorityPolicy=1 may require system level permission, " \ + "e.g., being the root user. If the necessary permission is not " \ + "possessed, changes to priority will be silently ignored."); } - ThreadPriorityPolicy = 0; } } if (UseCriticalJavaThreadPriority) { diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index dc788da28f..647d1e86ef 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -2042,7 +2042,8 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G); " to higher native thread priorities. This policy should be "\ " used with care, as sometimes it can cause performance "\ " degradation in the application and/or the entire system. On "\ - " Linux this policy requires root privilege.") \ + " Linux/BSD/macOS this policy requires root privilege or an "\ + " extended capability.") \ range(0, 1) \ \ product(bool, ThreadPriorityVerbose, false, \ From 30dc53467a9ba980582cb1b7cbfa998cb9ab1249 Mon Sep 17 00:00:00 2001 From: diazhou Date: Wed, 27 Feb 2019 00:34:39 -0800 Subject: [PATCH 30/38] Added tag jdk-12.0.1+9 for changeset edbfbc928f5d --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 500a159862..a649927d50 100644 --- a/.hgtags +++ b/.hgtags @@ -541,3 +541,4 @@ c9c530b917a3479a25c4b9eaca2c31a37e2e5206 jdk-12.0.1+5 0c9a2cd825dc312270eb7b043baef59a289ad9ec jdk-12.0.1+6 e4607e374223b6fc9e2883ee52ae4971c21e6757 jdk-12.0.1+7 efc36b43b3f9fbe174336f364954c85cb7a7747b jdk-12.0.1+8 +edbfbc928f5d928a237d6cc384e75672759a2c6f jdk-12.0.1+9 From 7e480e38d2d92984aaedeefb33d04567bef6c3a1 Mon Sep 17 00:00:00 2001 From: diazhou Date: Tue, 5 Mar 2019 23:17:03 -0800 Subject: [PATCH 31/38] Added tag jdk-12.0.1+10 for changeset e657e6b86884 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a649927d50..f58eef8fbe 100644 --- a/.hgtags +++ b/.hgtags @@ -542,3 +542,4 @@ c9c530b917a3479a25c4b9eaca2c31a37e2e5206 jdk-12.0.1+5 e4607e374223b6fc9e2883ee52ae4971c21e6757 jdk-12.0.1+7 efc36b43b3f9fbe174336f364954c85cb7a7747b jdk-12.0.1+8 edbfbc928f5d928a237d6cc384e75672759a2c6f jdk-12.0.1+9 +e657e6b868841da27767e780f932f221b72e5713 jdk-12.0.1+10 From 4ccbd91439838d278732aabb6caaa2095b5dd498 Mon Sep 17 00:00:00 2001 From: naoto Date: Tue, 29 Jan 2019 07:46:50 -0800 Subject: [PATCH 32/38] 8217609: New era placeholder not recognized by java.text.SimpleDateFormat Reviewed-by: nishjain, rriggs --- .../classes/build/tools/cldrconverter/CalendarType.java | 4 ++-- .../classes/sun/util/cldr/resources/common/main/ja.xml | 2 ++ .../classes/sun/util/cldr/resources/common/main/root.xml | 2 ++ test/jdk/java/util/Calendar/JapaneseEraNameTest.java | 8 ++++---- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/make/jdk/src/classes/build/tools/cldrconverter/CalendarType.java b/make/jdk/src/classes/build/tools/cldrconverter/CalendarType.java index dc0ec14d56..ad44cd89d7 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/CalendarType.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/CalendarType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ GENERIC, GREGORIAN("gregory"), BUDDHIST, JAPANESE, ROC, {0, 2}, // generic {0, 2}, // gregorian {0, 1}, // buddhist - {232, 4}, // japanese (eras from Meiji) + {232, 5}, // japanese (eras from Meiji) {0, 2}, // roc (Minguo) {0, 1}, // islamic (Hijrah) {0, 1}, // islamic-civil (same as islamic) diff --git a/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/ja.xml b/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/ja.xml index c80488f158..b097968080 100644 --- a/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/ja.xml +++ b/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/ja.xml @@ -3633,6 +3633,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ 大正 昭和 平成 + 元号 大化 @@ -3871,6 +3872,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ T S H + N diff --git a/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/root.xml b/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/root.xml index d43102178c..dcc712acfe 100644 --- a/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/root.xml +++ b/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/root.xml @@ -2030,6 +2030,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ Taishō Shōwa Heisei + NewEra Taika (645–650) @@ -2268,6 +2269,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ T S H + N diff --git a/test/jdk/java/util/Calendar/JapaneseEraNameTest.java b/test/jdk/java/util/Calendar/JapaneseEraNameTest.java index a11c77c6cf..7760a939de 100644 --- a/test/jdk/java/util/Calendar/JapaneseEraNameTest.java +++ b/test/jdk/java/util/Calendar/JapaneseEraNameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8202088 8207152 + * @bug 8202088 8207152 8217609 * @summary Test the localized Japanese new era name (May 1st. 2019-) * is retrieved no matter CLDR provider contains the name or not. * @modules jdk.localedata @@ -53,8 +53,8 @@ Object[][] names() { // type, locale, name { LONG, JAPAN, "\u5143\u53f7" }, // NewEra { LONG, US, "NewEra" }, - { SHORT, JAPAN, "N" }, - { SHORT, US, "N" }, + { SHORT, JAPAN, "\u5143\u53f7" }, + { SHORT, US, "NewEra" }, }; } From e2d3c7e7c0d66723d403fd5c4a99e74f85bfa15a Mon Sep 17 00:00:00 2001 From: diazhou Date: Fri, 15 Mar 2019 00:41:19 -0700 Subject: [PATCH 33/38] Added tag jdk-12.0.1+11 for changeset 8afa031910e3 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index f89ee6e65c..681f83fed9 100644 --- a/.hgtags +++ b/.hgtags @@ -546,3 +546,4 @@ e4607e374223b6fc9e2883ee52ae4971c21e6757 jdk-12.0.1+7 efc36b43b3f9fbe174336f364954c85cb7a7747b jdk-12.0.1+8 edbfbc928f5d928a237d6cc384e75672759a2c6f jdk-12.0.1+9 e657e6b868841da27767e780f932f221b72e5713 jdk-12.0.1+10 +8afa031910e32132bb19830b73e26e2991a7d68f jdk-12.0.1+11 From 4acdea0d10894e5b9f8b043fa439d3c0edfc50ef Mon Sep 17 00:00:00 2001 From: dkejriwal Date: Mon, 1 Apr 2019 22:56:25 +0530 Subject: [PATCH 34/38] 8205432: Replace the placeholder Japanese era name Reviewed-by: rpatil, pkoppula, chegar, naoto --- make/data/unicodedata/UnicodeData.txt | 2 +- .../classes/java/time/chrono/JapaneseEra.java | 8 ++-- .../java/util/JapaneseImperialCalendar.java | 12 +++--- .../sun/text/resources/FormatData.java | 6 +-- .../text/resources/JavaTimeSupplementary.java | 4 +- .../share/classes/sun/util/calendar/Era.java | 4 +- .../util/calendar/LocalGregorianCalendar.java | 4 +- .../provider/CalendarNameProviderImpl.java | 6 +-- .../sun/text/resources/ext/FormatData_ja.java | 4 +- .../ext/JavaTimeSupplementary_ja.java | 4 +- .../util/cldr/resources/common/main/ja.xml | 4 +- .../util/cldr/resources/common/main/root.xml | 4 +- test/jdk/java/lang/Character/UnicodeData.txt | 2 +- .../text/Format/DateFormat/WeekDateTest.java | 6 +-- .../time/chrono/TCKJapaneseChronology.java | 14 +++--- .../tck/java/time/chrono/TCKJapaneseEra.java | 4 +- .../time/chrono/TestJapaneseChronology.java | 43 ++++++++++++++----- .../time/chrono/TestUmmAlQuraChronology.java | 8 ++-- .../java/time/format/TestNonIsoFormatter.java | 4 +- .../CalendarTestScripts/CalendarAdapter.java | 4 +- .../Calendar/CalendarTestScripts/Symbol.java | 4 +- .../CalendarTestScripts/japanese/japanese.cts | 2 +- .../japanese/japanese_add.cts | 12 +++--- .../japanese/japanese_minmax.cts | 38 ++++++++-------- .../japanese/japanese_roll.cts | 16 +++---- .../util/Calendar/JapaneseEraNameTest.java | 8 ++-- .../util/Calendar/JapaneseLenientEraTest.java | 4 +- .../java/util/Calendar/NarrowNamesTest.java | 4 +- test/jdk/java/util/Calendar/ZoneOffsets.java | 6 +-- 29 files changed, 132 insertions(+), 109 deletions(-) diff --git a/make/data/unicodedata/UnicodeData.txt b/make/data/unicodedata/UnicodeData.txt index 03cf481f34..72b902a3d7 100644 --- a/make/data/unicodedata/UnicodeData.txt +++ b/make/data/unicodedata/UnicodeData.txt @@ -11836,7 +11836,7 @@ 32FC;CIRCLED KATAKANA WI;So;0;L; 30F0;;;;N;;;;; 32FD;CIRCLED KATAKANA WE;So;0;L; 30F1;;;;N;;;;; 32FE;CIRCLED KATAKANA WO;So;0;L; 30F2;;;;N;;;;; -32FF;SQUARE ERA NAME NEWERA;So;0;L; 5143 53F7;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME NEWERA;;;; +32FF;SQUARE ERA NAME REIWA;So;0;L; 4EE4 548C;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME REIWA;;;; 3300;SQUARE APAATO;So;0;L; 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;; 3301;SQUARE ARUHUA;So;0;L; 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;; 3302;SQUARE ANPEA;So;0;L; 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;; diff --git a/src/java.base/share/classes/java/time/chrono/JapaneseEra.java b/src/java.base/share/classes/java/time/chrono/JapaneseEra.java index e998a4da6f..9e3d8b112d 100644 --- a/src/java.base/share/classes/java/time/chrono/JapaneseEra.java +++ b/src/java.base/share/classes/java/time/chrono/JapaneseEra.java @@ -151,14 +151,14 @@ public final class JapaneseEra */ public static final JapaneseEra HEISEI = new JapaneseEra(2, LocalDate.of(1989, 1, 8)); /** - * The singleton instance for the 'NewEra' era (2019-05-01 - current) + * The singleton instance for the 'Reiwa' era (2019-05-01 - current) * which has the value 3. */ - private static final JapaneseEra NEWERA = new JapaneseEra(3, LocalDate.of(2019, 5, 1)); + private static final JapaneseEra REIWA = new JapaneseEra(3, LocalDate.of(2019, 5, 1)); // The number of predefined JapaneseEra constants. // There may be a supplemental era defined by the property. - private static final int N_ERA_CONSTANTS = NEWERA.getValue() + ERA_OFFSET; + private static final int N_ERA_CONSTANTS = REIWA.getValue() + ERA_OFFSET; /** * Serialization version. @@ -176,7 +176,7 @@ public final class JapaneseEra KNOWN_ERAS[1] = TAISHO; KNOWN_ERAS[2] = SHOWA; KNOWN_ERAS[3] = HEISEI; - KNOWN_ERAS[4] = NEWERA; + KNOWN_ERAS[4] = REIWA; for (int i = N_ERA_CONSTANTS; i < ERA_CONFIG.length; i++) { CalendarDate date = ERA_CONFIG[i].getSinceDate(); LocalDate isoDate = LocalDate.of(date.getYear(), date.getMonth(), date.getDayOfMonth()); diff --git a/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java b/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java index 65c223e929..3ff49c7953 100644 --- a/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java +++ b/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ * 2 Taisho 1912-07-30T00:00:00 local time * 3 Showa 1926-12-25T00:00:00 local time * 4 Heisei 1989-01-08T00:00:00 local time - * 5 NewEra 2019-05-01T00:00:00 local time + * 5 Reiwa 2019-05-01T00:00:00 local time * ------------------------------------------------------ * } * @@ -129,9 +129,9 @@ class JapaneseImperialCalendar extends Calendar { public static final int HEISEI = 4; /** - * The ERA constant designating the NewEra era. + * The ERA constant designating the Reiwa era. */ - private static final int NEWERA = 5; + private static final int REIWA = 5; private static final int EPOCH_OFFSET = 719163; // Fixed date of January 1, 1970 (Gregorian) @@ -1759,12 +1759,12 @@ private int computeFields(int fieldMask, int tzMask) { } } else if (transitionYear) { if (jdate.getYear() == 1) { - // As of NewEra (since Meiji) there's no case + // As of Reiwa (since Meiji) there's no case // that there are multiple transitions in a // year. Historically there was such // case. There might be such case again in the // future. - if (era > NEWERA) { + if (era > REIWA) { CalendarDate pd = eras[era - 1].getSinceDate(); if (normalizedYear == pd.getYear()) { d.setMonth(pd.getMonth()).setDayOfMonth(pd.getDayOfMonth()); diff --git a/src/java.base/share/classes/sun/text/resources/FormatData.java b/src/java.base/share/classes/sun/text/resources/FormatData.java index e93183ff9d..f90317ee69 100644 --- a/src/java.base/share/classes/sun/text/resources/FormatData.java +++ b/src/java.base/share/classes/sun/text/resources/FormatData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,7 @@ protected final Object[][] getContents() { "T", "S", "H", - "N", // NewEra + "R", }; // Japanese imperial calendar era strings @@ -116,7 +116,7 @@ protected final Object[][] getContents() { "Taisho", "Showa", "Heisei", - "NewEra", // NewEra + "Reiwa", }; return new Object[][] { diff --git a/src/java.base/share/classes/sun/text/resources/JavaTimeSupplementary.java b/src/java.base/share/classes/sun/text/resources/JavaTimeSupplementary.java index 0f59634022..7b041591c6 100644 --- a/src/java.base/share/classes/sun/text/resources/JavaTimeSupplementary.java +++ b/src/java.base/share/classes/sun/text/resources/JavaTimeSupplementary.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -159,7 +159,7 @@ protected final Object[][] getContents() { "Taisho", "Showa", "Heisei", - "NewEra", // New Era + "Reiwa", }; final String[] sharedShortEras = { diff --git a/src/java.base/share/classes/sun/util/calendar/Era.java b/src/java.base/share/classes/sun/util/calendar/Era.java index c622e52f3d..3687952225 100644 --- a/src/java.base/share/classes/sun/util/calendar/Era.java +++ b/src/java.base/share/classes/sun/util/calendar/Era.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ * Taisho 1912-07-30T00:00:00 local time * Showa 1926-12-25T00:00:00 local time * Heisei 1989-01-08T00:00:00 local time - * NewEra 2019-05-01T00:00:00 local time + * Reiwa 2019-05-01T00:00:00 local time * ----------------------------------------------------------------------- * } * diff --git a/src/java.base/share/classes/sun/util/calendar/LocalGregorianCalendar.java b/src/java.base/share/classes/sun/util/calendar/LocalGregorianCalendar.java index cbc5ee195d..c26b700c81 100644 --- a/src/java.base/share/classes/sun/util/calendar/LocalGregorianCalendar.java +++ b/src/java.base/share/classes/sun/util/calendar/LocalGregorianCalendar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ public class LocalGregorianCalendar extends BaseCalendar { new Era("Taisho", "T", -1812153600000L, true), new Era("Showa", "S", -1357603200000L, true), new Era("Heisei", "H", 600220800000L, true), - new Era("NewEra", "N", 1556668800000L, true), + new Era("Reiwa", "R", 1556668800000L, true), }; private static boolean isValidEra(Era newEra, Era[] eras) { diff --git a/src/java.base/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java b/src/java.base/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java index fe8b95b788..7293e9fad3 100644 --- a/src/java.base/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java +++ b/src/java.base/share/classes/sun/util/locale/provider/CalendarNameProviderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,10 +84,10 @@ public String getDisplayNameImpl(String calendarType, int field, int value, int Era[] jeras = CalendarSystem.forName("japanese").getEras(); if (value <= jeras.length) { // Localized era name could not be retrieved from this provider. - // This can occur either for NewEra or SupEra. + // This can occur either for Reiwa or SupEra. // // If it's CLDR provider, try COMPAT first, which is guaranteed to have - // the name for NewEra. + // the name for Reiwa. if (type == LocaleProviderAdapter.Type.CLDR) { lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale); key = getResourceKeyFor(LocaleProviderAdapter.Type.JRE, diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_ja.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_ja.java index 1d25c34fe1..93d35187c5 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_ja.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,7 +91,7 @@ protected final Object[][] getContents() { "\u5927\u6b63", // Taisho "\u662d\u548c", // Showa "\u5e73\u6210", // Heisei - "\u5143\u53f7", // NewEra + "\u4ee4\u548c", // Reiwa }; final String[] rocEras = { "\u6c11\u56fd\u524d", diff --git a/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_ja.java b/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_ja.java index 97ce4d222a..922885aeb0 100644 --- a/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_ja.java +++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/JavaTimeSupplementary_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -154,7 +154,7 @@ protected final Object[][] getContents() { "\u5927\u6b63", "\u662d\u548c", "\u5e73\u6210", - "\u5143\u53f7", // NewEra + "\u4ee4\u548c", }; final String[] sharedJavaTimeShortEras = { diff --git a/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/ja.xml b/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/ja.xml index b097968080..f9fc872e42 100644 --- a/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/ja.xml +++ b/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/ja.xml @@ -3633,7 +3633,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ 大正 昭和 平成 - 元号 + 令和 大化 @@ -3872,7 +3872,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ T S H - N + R diff --git a/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/root.xml b/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/root.xml index dcc712acfe..b9b41b6d64 100644 --- a/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/root.xml +++ b/src/jdk.localedata/share/classes/sun/util/cldr/resources/common/main/root.xml @@ -2030,7 +2030,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ Taishō Shōwa Heisei - NewEra + Reiwa Taika (645–650) @@ -2269,7 +2269,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/ T S H - N + R diff --git a/test/jdk/java/lang/Character/UnicodeData.txt b/test/jdk/java/lang/Character/UnicodeData.txt index 03cf481f34..72b902a3d7 100644 --- a/test/jdk/java/lang/Character/UnicodeData.txt +++ b/test/jdk/java/lang/Character/UnicodeData.txt @@ -11836,7 +11836,7 @@ 32FC;CIRCLED KATAKANA WI;So;0;L; 30F0;;;;N;;;;; 32FD;CIRCLED KATAKANA WE;So;0;L; 30F1;;;;N;;;;; 32FE;CIRCLED KATAKANA WO;So;0;L; 30F2;;;;N;;;;; -32FF;SQUARE ERA NAME NEWERA;So;0;L; 5143 53F7;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME NEWERA;;;; +32FF;SQUARE ERA NAME REIWA;So;0;L; 4EE4 548C;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME REIWA;;;; 3300;SQUARE APAATO;So;0;L; 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;; 3301;SQUARE ARUHUA;So;0;L; 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;; 3302;SQUARE ANPEA;So;0;L; 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;; diff --git a/test/jdk/java/text/Format/DateFormat/WeekDateTest.java b/test/jdk/java/text/Format/DateFormat/WeekDateTest.java index afa2bf8447..5b947e0f93 100644 --- a/test/jdk/java/text/Format/DateFormat/WeekDateTest.java +++ b/test/jdk/java/text/Format/DateFormat/WeekDateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -137,9 +137,9 @@ private static void noWeekDateSupport() throws Exception { Calendar jcal = Calendar.getInstance(TimeZone.getTimeZone("GMT"), new Locale("ja", "JP", "JP")); - String format = "2-W01-2"; // 2019-12-31 == N1-12-31 + String format = "2-W01-2"; // 2019-12-31 == R1-12-31 int expectedYear = 2019; - // Check the current era, Heisei or NewEra + // Check the current era, Heisei or Reiwa if (System.currentTimeMillis() < 1556668800000L) { format = "21-W01-3"; // 2008-12-31 == H20-12-31 expectedYear = 2008; diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseChronology.java b/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseChronology.java index fbec5920f6..80a53398c2 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseChronology.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseChronology.java @@ -1,5 +1,5 @@ /* - o Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + o Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,7 +111,7 @@ o Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. */ @Test public class TCKJapaneseChronology { - private static final int YDIFF_NEWERA = 2018; + private static final int YDIFF_REIWA = 2018; private static final int YDIFF_HEISEI = 1988; private static final int YDIFF_MEIJI = 1867; private static final int YDIFF_SHOWA = 1925; @@ -174,7 +174,7 @@ public void test_chrono_byLocale_iso() { @DataProvider(name="createByEra") Object[][] data_createByEra() { return new Object[][] { - {JapaneseEra.of(3), 2020 - YDIFF_NEWERA, 2, 29, 60, LocalDate.of(2020, 2, 29)}, // NEWERA + {JapaneseEra.of(3), 2020 - YDIFF_REIWA, 2, 29, 60, LocalDate.of(2020, 2, 29)}, {JapaneseEra.HEISEI, 1996 - YDIFF_HEISEI, 2, 29, 60, LocalDate.of(1996, 2, 29)}, {JapaneseEra.HEISEI, 2000 - YDIFF_HEISEI, 2, 29, 60, LocalDate.of(2000, 2, 29)}, {JapaneseEra.MEIJI, 1874 - YDIFF_MEIJI, 2, 28, 59, LocalDate.of(1874, 2, 28)}, @@ -367,8 +367,8 @@ public void test_badDates(int year, int month, int dom) { @DataProvider(name="prolepticYear") Object[][] data_prolepticYear() { return new Object[][] { - {3, JapaneseEra.of(3), 1, 1 + YDIFF_NEWERA, false}, // NEWERA - {3, JapaneseEra.of(3), 102, 102 + YDIFF_NEWERA, true}, // NEWERA + {3, JapaneseEra.of(3), 1, 1 + YDIFF_REIWA, false}, + {3, JapaneseEra.of(3), 102, 102 + YDIFF_REIWA, true}, {2, JapaneseEra.HEISEI, 1, 1 + YDIFF_HEISEI, false}, {2, JapaneseEra.HEISEI, 4, 4 + YDIFF_HEISEI, true}, @@ -553,7 +553,7 @@ Object[][] data_japanseseEras() { { JapaneseEra.TAISHO, 0, "Taisho"}, { JapaneseEra.SHOWA, 1, "Showa"}, { JapaneseEra.HEISEI, 2, "Heisei"}, - { JapaneseEra.of(3), 3, "NewEra"}, // NEWERA + { JapaneseEra.of(3), 3, "Reiwa"}, }; } @@ -689,7 +689,7 @@ Object[][] data_toString() { {JapaneseChronology.INSTANCE.date(1989, 1, 7), "Japanese Showa 64-01-07"}, {JapaneseChronology.INSTANCE.date(1989, 1, 8), "Japanese Heisei 1-01-08"}, {JapaneseChronology.INSTANCE.date(2012, 12, 6), "Japanese Heisei 24-12-06"}, - {JapaneseChronology.INSTANCE.date(2020, 1, 6), "Japanese NewEra 2-01-06"}, + {JapaneseChronology.INSTANCE.date(2020, 1, 6), "Japanese Reiwa 2-01-06"}, }; } diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseEra.java b/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseEra.java index f10770196b..57cb9ebee8 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseEra.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseEra.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,7 @@ public class TCKJapaneseEra { @DataProvider(name = "JapaneseEras") Object[][] data_of_eras() { return new Object[][] { - {JapaneseEra.of(3), "NewEra", 3}, // NEWERA + {JapaneseEra.of(3), "Reiwa", 3}, {JapaneseEra.HEISEI, "Heisei", 2}, {JapaneseEra.SHOWA, "Showa", 1}, {JapaneseEra.TAISHO, "Taisho", 0}, diff --git a/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronology.java b/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronology.java index 08883cf281..995a500a8f 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronology.java +++ b/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronology.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; /** * Tests for the Japanese chronology @@ -59,7 +60,7 @@ Object[][] transitionData() { { JapaneseEra.SHOWA, 64, 1, 7, 1989 }, { JapaneseEra.HEISEI, 1, 1, 8, 1989 }, { JapaneseEra.HEISEI, 31, 4, 30, 2019 }, - { JapaneseEra.of(3), 1, 5, 1, 2019 }, // NEWERA + { JapaneseEra.of(3), 1, 5, 1, 2019 }, }; } @@ -77,7 +78,7 @@ Object[][] dayYearData() { { JapaneseEra.HEISEI, 1, 1, 1, 8 }, { JapaneseEra.HEISEI, 2, 8, 1, 8 }, { JapaneseEra.HEISEI, 31, 120, 4, 30 }, - { JapaneseEra.of(3), 1, 1, 5, 1 }, // NEWERA + { JapaneseEra.of(3), 1, 1, 5, 1 }, }; } @@ -110,8 +111,8 @@ Object[][] invalidDatesData() { { JapaneseEra.HEISEI, 1, 1, 7 }, { JapaneseEra.HEISEI, 1, 2, 29 }, { JapaneseEra.HEISEI, 31, 5, 1 }, - { JapaneseEra.of(3), 1, 4, 30 }, // NEWERA - { JapaneseEra.of(3), Year.MAX_VALUE, 12, 31 }, // NEWERA + { JapaneseEra.of(3), 1, 4, 30 }, + { JapaneseEra.of(3), Year.MAX_VALUE, 12, 31 }, }; } @@ -131,9 +132,9 @@ Object[][] invalidEraYearData() { { JapaneseEra.HEISEI, -1 }, { JapaneseEra.HEISEI, 0 }, { JapaneseEra.HEISEI, 32 }, - { JapaneseEra.of(3), -1 }, // NEWERA - { JapaneseEra.of(3), 0 }, // NEWERA - { JapaneseEra.of(3), Year.MAX_VALUE }, // NEWERA + { JapaneseEra.of(3), -1 }, + { JapaneseEra.of(3), 0 }, + { JapaneseEra.of(3), Year.MAX_VALUE }, }; } @@ -151,8 +152,21 @@ Object[][] invalidDayYearData() { { JapaneseEra.HEISEI, 1, 360 }, { JapaneseEra.HEISEI, 2, 366 }, { JapaneseEra.HEISEI, 31, 121 }, - { JapaneseEra.of(3), 1, 246 }, // NEWERA - { JapaneseEra.of(3), 2, 367 }, // NEWERA + { JapaneseEra.of(3), 1, 246 }, + { JapaneseEra.of(3), 2, 367 }, + }; + } + + @DataProvider + Object[][] eraNameData() { + return new Object[][] { + // Japanese era, name, exception + { "Meiji", JapaneseEra.MEIJI, null }, + { "Taisho", JapaneseEra.TAISHO, null }, + { "Showa", JapaneseEra.SHOWA, null }, + { "Heisei", JapaneseEra.HEISEI, null }, + { "Reiwa", JapaneseEra.of(3), null }, + { "NewEra", null, IllegalArgumentException.class}, }; } @@ -204,4 +218,13 @@ public void test_invalidDayYear(JapaneseEra era, int yearOfEra, int dayOfYear) { JapaneseDate date = JAPANESE.dateYearDay(era, yearOfEra, dayOfYear); System.out.printf("No DateTimeException with era=%s, year=%d, dayOfYear=%d%n", era, yearOfEra, dayOfYear); } + + @Test(dataProvider="eraNameData") + public void test_eraName(String eraName, JapaneseEra era, Class expectedEx) { + try { + assertEquals(JapaneseEra.valueOf(eraName), era); + } catch (Exception ex) { + assertTrue(expectedEx.isInstance(ex)); + } + } } diff --git a/test/jdk/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java b/test/jdk/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java index f10a0da03b..7bd8a6dec8 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java +++ b/test/jdk/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -776,9 +776,9 @@ Object[][] data_hijrahToJapanese() { {HijrahDate.of(1434,5,1), "Japanese Heisei 25-03-13"}, {HijrahDate.of(1436,1,1), "Japanese Heisei 26-10-25"}, {HijrahDate.of(1440,8,25), "Japanese Heisei 31-04-30"}, - {HijrahDate.of(1440,8,26), "Japanese NewEra 1-05-01"}, - {HijrahDate.of(1500,6,12), "Japanese NewEra 59-05-05"}, - {HijrahDate.of(1550,3,11), "Japanese NewEra 107-08-11"}, + {HijrahDate.of(1440,8,26), "Japanese Reiwa 1-05-01"}, + {HijrahDate.of(1500,6,12), "Japanese Reiwa 59-05-05"}, + {HijrahDate.of(1550,3,11), "Japanese Reiwa 107-08-11"}, }; } diff --git a/test/jdk/java/time/test/java/time/format/TestNonIsoFormatter.java b/test/jdk/java/time/test/java/time/format/TestNonIsoFormatter.java index 345e3eb635..8f990c1af5 100644 --- a/test/jdk/java/time/test/java/time/format/TestNonIsoFormatter.java +++ b/test/jdk/java/time/test/java/time/format/TestNonIsoFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,7 +143,7 @@ Object[][] lenientEraYear() { // Chronology, lenient era/year, strict era/year { JAPANESE, "Meiji 123", "Heisei 2" }, { JAPANESE, "Showa 65", "Heisei 2" }, - { JAPANESE, "Heisei 32", "NewEra 2" }, // NewEra + { JAPANESE, "Heisei 32", "Reiwa 2" }, }; } diff --git a/test/jdk/java/util/Calendar/CalendarTestScripts/CalendarAdapter.java b/test/jdk/java/util/Calendar/CalendarTestScripts/CalendarAdapter.java index 1f3f1d0f2c..90d63e287d 100644 --- a/test/jdk/java/util/Calendar/CalendarTestScripts/CalendarAdapter.java +++ b/test/jdk/java/util/Calendar/CalendarTestScripts/CalendarAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -364,7 +364,7 @@ String toDateString() { "Taisho", "Showa", "Heisei", - "NewEra" + "Reiwa" }; break; } diff --git a/test/jdk/java/util/Calendar/CalendarTestScripts/Symbol.java b/test/jdk/java/util/Calendar/CalendarTestScripts/Symbol.java index 7368a6da8d..a310f968de 100644 --- a/test/jdk/java/util/Calendar/CalendarTestScripts/Symbol.java +++ b/test/jdk/java/util/Calendar/CalendarTestScripts/Symbol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -322,7 +322,7 @@ private static final void put(String key, Symbol sym) { put("taisho", new Symbol(Type.ERA, 2)); put("showa", new Symbol(Type.ERA, 3)); put("heisei", new Symbol(Type.ERA, 4)); - put("newera", new Symbol(Type.ERA, 5)); + put("reiwa", new Symbol(Type.ERA, 5)); } } diff --git a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese.cts b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese.cts index bf4c8cba13..71b6e945b3 100644 --- a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese.cts +++ b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese.cts @@ -57,7 +57,7 @@ test Default dates check millisecond 0 clear all - set era NewEra + set era Reiwa check era Heisei check datetime 31 Jan 1 0 0 0 check millisecond 0 diff --git a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_add.cts b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_add.cts index 63e5debc84..b698b78581 100644 --- a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_add.cts +++ b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_add.cts @@ -16,10 +16,10 @@ set non-lenient test add ERA use jcal clear all - set date NewEra 17 Mar 8 + set date Reiwa 17 Mar 8 add era 10 - # as of NewEra 17 March 8 - check era NewEra + # as of Reiwa 17 March 8 + check era Reiwa add era -100 check era BeforeMeiji @@ -342,12 +342,12 @@ test add MONTH check date BeforeMeiji $minyear May 18 check timeofday 1 47 4 191 - set date NewEra 17 Jan 1 + set date Reiwa 17 Jan 1 get max year assign $result $max - set date NewEra $max Jul 17 + set date Reiwa $max Jul 17 add month 1 - check date NewEra $max Aug 17 + check date Reiwa $max Aug 17 # set date Heisei $max Jul 28 # set timeofday 23 59 59 999 # add month 1 diff --git a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_minmax.cts b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_minmax.cts index 1faea67908..b907a378fc 100644 --- a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_minmax.cts +++ b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_minmax.cts @@ -14,10 +14,10 @@ new instance tokyocal test Make sure that the maximum year value doesn't depent on era use jcal - # Note: the max year value is as of NewEra + # Note: the max year value is as of Reiwa assign 292276976 $max clear all - set date NewEra 1 May 1 + set date Reiwa 1 May 1 get millis check max year $max assign $max $maxyear @@ -39,9 +39,9 @@ test Make sure that the maximum year value doesn't depent on era test Max of ERA use jcal - # Assumption: NewEra is the current era - check maximum era NewEra - check leastmax era NewEra + # Assumption: Reiwa is the current era + check maximum era Reiwa + check leastmax era Reiwa test Actual max MONTH use jcal @@ -78,7 +78,7 @@ test Actual max MONTH check actualmax month Apr clear all - set date NewEra 2 Jan 1 + set date Reiwa 2 Jan 1 set year $maxyear check actualmax month Aug get millis @@ -133,8 +133,8 @@ test Actual max DAY_OF_YEAR # time zone dependent use tokyocal clear all - set date NewEra $maxyear Jan 1 - # the last date of NewEra is N292276976.08.17T16:12:55.807+0900 + set date Reiwa $maxyear Jan 1 + # the last date of Reiwa is R292276976.08.17T16:12:55.807+0900 check actualmax day_of_year 229 # 31+28+31+30+31+30+31+17 test Actual max WEEK_OF_YEAR @@ -165,12 +165,12 @@ test Actual max WEEK_OF_YEAR clear all set date Heisei 31 Apr 28 check actualmax week_of_year 17 - set date NewEra 1 Aug 9 + set date Reiwa 1 Aug 9 check actualmax week_of_year 35 use tokyocal - set date NewEra $maxyear Jan 1 - # the last date of NewEra is N292276976.08.17T16:12:55.807+0900 (Sunday) + set date Reiwa $maxyear Jan 1 + # the last date of Reiwa is R292276976.08.17T16:12:55.807+0900 (Sunday) # The year is equivalent to 2003 (Gregorian). check actualmax week_of_year 34 @@ -197,12 +197,12 @@ test Actual max WEEK_OF_MONTH clear all set date Heisei 31 Apr 30 check actualmax week_of_month 5 - set date NewEra 1 May 1 + set date Reiwa 1 May 1 check actualmax week_of_month 5 use tokyocal - set date NewEra $maxyear Jan 1 - # the last date of NewEra is N292276976.08.17T16:12:55.807+0900 (Sunday) + set date Reiwa $maxyear Jan 1 + # the last date of Reiwa is R292276976.08.17T16:12:55.807+0900 (Sunday) # The year is equivalent to 2003 (Gregorian). check actualmax week_of_month 4 @@ -229,13 +229,13 @@ test Actual max DAY_OF_WEEK_IN_MONTH clear all set date Heisei 31 Apr 30 check actualmax week_of_month 5 - set date NewEra 1 May 1 + set date Reiwa 1 May 1 check actualmax week_of_month 5 use tokyocal clear all - set date NewEra $maxyear Jan 1 - # the last date of NewEra is N292276976.08.17T16:12:55.807+0900 (Sunday) + set date Reiwa $maxyear Jan 1 + # the last date of Reiwa is R292276976.08.17T16:12:55.807+0900 (Sunday) # The year is equivalent to 2003 (Gregorian). check actualmax week_of_month 4 @@ -269,11 +269,11 @@ test Actual max YEAR set date Heisei 1 Aug 18 check actualmax year 30 - set date NewEra 1 Apr 30 + set date Reiwa 1 Apr 30 check actualmax year 31 # Date/time beyond the last date in the max year. - set date NewEra 1 Aug 18 + set date Reiwa 1 Aug 18 check actualmax year 292276975 test Least max YEAR diff --git a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_roll.cts b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_roll.cts index fe82f6aa5e..daa2bd4d8f 100644 --- a/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_roll.cts +++ b/test/jdk/java/util/Calendar/CalendarTestScripts/japanese/japanese_roll.cts @@ -147,13 +147,13 @@ test roll YEAR roll year -1 check date Heisei 31 Apr 30 - set date NewEra 2 Apr 30 + set date Reiwa 2 Apr 30 get max year assign $result $hmax roll year -1 - check date NewEra $hmax Apr 30 + check date Reiwa $hmax Apr 30 roll year 1 - check date NewEra 2 Apr 30 + check date Reiwa 2 Apr 30 test roll MONTH set date BeforeMeiji 1867 Dec 1 @@ -276,16 +276,16 @@ test roll MONTH check date BeforeMeiji $minyear May 18 check timeofday 1 47 4 191 - set date NewEra 17 Jan 1 + set date Reiwa 17 Jan 1 get max year assign $result $max - set date NewEra $max Jul 28 + set date Reiwa $max Jul 28 roll month 1 - check date NewEra $max Aug 17 - set date NewEra $max Jul 28 + check date Reiwa $max Aug 17 + set date Reiwa $max Jul 28 set timeofday 23 59 59 999 roll month 1 - check date NewEra $max Aug 16 + check date Reiwa $max Aug 16 check timeofday 23 59 59 999 test roll WEEK_OF_YEAR diff --git a/test/jdk/java/util/Calendar/JapaneseEraNameTest.java b/test/jdk/java/util/Calendar/JapaneseEraNameTest.java index 7760a939de..a0850eddbc 100644 --- a/test/jdk/java/util/Calendar/JapaneseEraNameTest.java +++ b/test/jdk/java/util/Calendar/JapaneseEraNameTest.java @@ -51,10 +51,10 @@ public class JapaneseEraNameTest { Object[][] names() { return new Object[][] { // type, locale, name - { LONG, JAPAN, "\u5143\u53f7" }, // NewEra - { LONG, US, "NewEra" }, - { SHORT, JAPAN, "\u5143\u53f7" }, - { SHORT, US, "NewEra" }, + { LONG, JAPAN, "\u4ee4\u548c" }, + { LONG, US, "Reiwa" }, + { SHORT, JAPAN, "\u4ee4\u548c" }, + { SHORT, US, "Reiwa" }, }; } diff --git a/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java b/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java index f5d03bb303..6a909a23a1 100644 --- a/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java +++ b/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ Object[][] names() { // lenient era/year, strict era/year { "Meiji 123", "Heisei 2" }, { "Sh\u014dwa 65", "Heisei 2" }, - { "Heisei 32", "NewEra 2" }, // NewEra + { "Heisei 32", "Reiwa 2" }, }; } diff --git a/test/jdk/java/util/Calendar/NarrowNamesTest.java b/test/jdk/java/util/Calendar/NarrowNamesTest.java index b1508212c2..9788f47b24 100644 --- a/test/jdk/java/util/Calendar/NarrowNamesTest.java +++ b/test/jdk/java/util/Calendar/NarrowNamesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,7 +68,7 @@ public static void main(String[] args) { HOUR_OF_DAY, 23); test(JAJPJP, DAY_OF_WEEK, LocalDateTime.now().isBefore(LocalDateTime.of(2019, 5, 1, 0, 0)) ? - "\u65e5" : "\u706b", // "Sun" for HEISEI, "Tue" for NEWERA + "\u65e5" : "\u706b", // "Sun" for HEISEI, "Tue" for REIWA YEAR, 24, MONTH, DECEMBER, DAY_OF_MONTH, 23); test(THTH, MONTH, NARROW_STANDALONE, "\u0e18.\u0e04.", YEAR, 2555, MONTH, DECEMBER, DAY_OF_MONTH, 5); diff --git a/test/jdk/java/util/Calendar/ZoneOffsets.java b/test/jdk/java/util/Calendar/ZoneOffsets.java index d63f096565..dac32397a7 100644 --- a/test/jdk/java/util/Calendar/ZoneOffsets.java +++ b/test/jdk/java/util/Calendar/ZoneOffsets.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -240,11 +240,11 @@ private static void error(String msg, Locale loc, Calendar cal2, int gmtOffset, } private static void adjustJapaneseEra(Calendar cal) { - // In case of Japanese calendar, explicitly set the last era; NEWERA so that + // In case of Japanese calendar, explicitly set the last era; REIWA so that // year 2005 won't throw exception if (!cal.isLenient() && cal.getCalendarType().equals("japanese") && - System.currentTimeMillis() < 1556668800000L) { // Current time not in NEWERA + System.currentTimeMillis() < 1556668800000L) { // Current time not in REIWA cal.set(Calendar.ERA, 5); cal.add(Calendar.YEAR, -30); // -30: Subtract year-length of HEISEI era } From d701affe5906f0b2d5577dfde815b6d47b720a5a Mon Sep 17 00:00:00 2001 From: robm Date: Mon, 1 Apr 2019 19:24:06 -0700 Subject: [PATCH 35/38] Added tag jdk-12.0.1+12 for changeset e831fc6bca9e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 6569994413..4b990edb1b 100644 --- a/.hgtags +++ b/.hgtags @@ -548,3 +548,4 @@ efc36b43b3f9fbe174336f364954c85cb7a7747b jdk-12.0.1+8 edbfbc928f5d928a237d6cc384e75672759a2c6f jdk-12.0.1+9 e657e6b868841da27767e780f932f221b72e5713 jdk-12.0.1+10 8afa031910e32132bb19830b73e26e2991a7d68f jdk-12.0.1+11 +e831fc6bca9e6afa6b486f07d386146e1ae0f6e1 jdk-12.0.1+12 From 896771b37ddddcb9d9a87175f779f63c1fd70d37 Mon Sep 17 00:00:00 2001 From: shade Date: Tue, 9 Apr 2019 21:20:15 +0200 Subject: [PATCH 36/38] 8222185: Shenandoah should report "committed" as capacity Reviewed-by: zgu, rkennke --- .../heuristics/shenandoahAdaptiveHeuristics.cpp | 8 ++++---- .../shenandoah/heuristics/shenandoahCompactHeuristics.cpp | 4 ++-- .../shenandoah/heuristics/shenandoahPassiveHeuristics.cpp | 2 +- .../shenandoah/heuristics/shenandoahStaticHeuristics.cpp | 2 +- .../heuristics/shenandoahTraversalHeuristics.cpp | 8 ++++---- src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp | 2 +- src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp | 6 ++---- .../share/gc/shenandoah/shenandoahMonitoringSupport.cpp | 6 +++--- src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp | 4 ++-- 9 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp index 3d8d3f39f7..1a4c57f7a5 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp @@ -75,7 +75,7 @@ void ShenandoahAdaptiveHeuristics::choose_collection_set_from_regiondata(Shenand // we hit max_cset. When max_cset is hit, we terminate the cset selection. Note that in this scheme, // ShenandoahGarbageThreshold is the soft threshold which would be ignored until min_garbage is hit. - size_t capacity = ShenandoahHeap::heap()->capacity(); + size_t capacity = ShenandoahHeap::heap()->max_capacity(); size_t free_target = ShenandoahMinFreeThreshold * capacity / 100; size_t min_garbage = free_target > actual_free ? (free_target - actual_free) : 0; size_t max_cset = (size_t)(1.0 * ShenandoahEvacReserve * capacity / 100 / ShenandoahEvacWaste); @@ -126,12 +126,12 @@ void ShenandoahAdaptiveHeuristics::record_phase_time(ShenandoahPhaseTimings::Pha bool ShenandoahAdaptiveHeuristics::should_start_normal_gc() const { ShenandoahHeap* heap = ShenandoahHeap::heap(); - size_t capacity = heap->capacity(); + size_t capacity = heap->max_capacity(); size_t available = heap->free_set()->available(); // Check if we are falling below the worst limit, time to trigger the GC, regardless of // anything else. - size_t min_threshold = ShenandoahMinFreeThreshold * heap->capacity() / 100; + size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100; if (available < min_threshold) { log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below minimum threshold (" SIZE_FORMAT "M)", available / M, min_threshold / M); @@ -141,7 +141,7 @@ bool ShenandoahAdaptiveHeuristics::should_start_normal_gc() const { // Check if are need to learn a bit about the application const size_t max_learn = ShenandoahLearningSteps; if (_gc_times_learned < max_learn) { - size_t init_threshold = ShenandoahInitFreeThreshold * heap->capacity() / 100; + size_t init_threshold = ShenandoahInitFreeThreshold * heap->max_capacity() / 100; if (available < init_threshold) { log_info(gc)("Trigger: Learning " SIZE_FORMAT " of " SIZE_FORMAT ". Free (" SIZE_FORMAT "M) is below initial threshold (" SIZE_FORMAT "M)", _gc_times_learned + 1, max_learn, available / M, init_threshold / M); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp index 7447c3200e..08fa8a15cc 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp @@ -56,8 +56,8 @@ bool ShenandoahCompactHeuristics::should_start_normal_gc() const { ShenandoahHeap* heap = ShenandoahHeap::heap(); size_t available = heap->free_set()->available(); - size_t threshold_bytes_allocated = heap->capacity() * ShenandoahAllocationThreshold / 100; - size_t min_threshold = ShenandoahMinFreeThreshold * heap->capacity() / 100; + size_t threshold_bytes_allocated = heap->max_capacity() * ShenandoahAllocationThreshold / 100; + size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100; if (available < min_threshold) { log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below minimum threshold (" SIZE_FORMAT "M)", diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp index 6bb325185a..916fa25667 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp @@ -84,7 +84,7 @@ void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(Shenando // Do not select too large CSet that would overflow the available free space. // Take at least the entire evacuation reserve, and be free to overflow to free space. - size_t capacity = ShenandoahHeap::heap()->capacity(); + size_t capacity = ShenandoahHeap::heap()->max_capacity(); size_t available = MAX2(ShenandoahEvacReserve * capacity / 100, actual_free); size_t max_cset = (size_t)(available / ShenandoahEvacWaste); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp index db6aa6fcd6..65b8054576 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp @@ -55,7 +55,7 @@ ShenandoahStaticHeuristics::~ShenandoahStaticHeuristics() {} bool ShenandoahStaticHeuristics::should_start_normal_gc() const { ShenandoahHeap* heap = ShenandoahHeap::heap(); - size_t capacity = heap->capacity(); + size_t capacity = heap->max_capacity(); size_t available = heap->free_set()->available(); size_t threshold_available = (capacity * ShenandoahFreeThreshold) / 100; diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp index c57002c0fd..0f19ec54ca 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp @@ -127,7 +127,7 @@ void ShenandoahTraversalHeuristics::choose_collection_set(ShenandoahCollectionSe // The significant complication is that liveness data was collected at the previous cycle, and only // for those regions that were allocated before previous cycle started. - size_t capacity = heap->capacity(); + size_t capacity = heap->max_capacity(); size_t actual_free = heap->free_set()->available(); size_t free_target = ShenandoahMinFreeThreshold * capacity / 100; size_t min_garbage = free_target > actual_free ? (free_target - actual_free) : 0; @@ -216,12 +216,12 @@ bool ShenandoahTraversalHeuristics::should_start_traversal_gc() { ShenandoahHeap* heap = ShenandoahHeap::heap(); assert(!heap->has_forwarded_objects(), "no forwarded objects here"); - size_t capacity = heap->capacity(); + size_t capacity = heap->max_capacity(); size_t available = heap->free_set()->available(); // Check if we are falling below the worst limit, time to trigger the GC, regardless of // anything else. - size_t min_threshold = ShenandoahMinFreeThreshold * heap->capacity() / 100; + size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100; if (available < min_threshold) { log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below minimum threshold (" SIZE_FORMAT "M)", available / M, min_threshold / M); @@ -231,7 +231,7 @@ bool ShenandoahTraversalHeuristics::should_start_traversal_gc() { // Check if are need to learn a bit about the application const size_t max_learn = ShenandoahLearningSteps; if (_gc_times_learned < max_learn) { - size_t init_threshold = ShenandoahInitFreeThreshold * heap->capacity() / 100; + size_t init_threshold = ShenandoahInitFreeThreshold * heap->max_capacity() / 100; if (available < init_threshold) { log_info(gc)("Trigger: Learning " SIZE_FORMAT " of " SIZE_FORMAT ". Free (" SIZE_FORMAT "M) is below initial threshold (" SIZE_FORMAT "M)", _gc_times_learned + 1, max_learn, available / M, init_threshold / M); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp index e059f09b21..ec0b352831 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp @@ -430,7 +430,7 @@ void ShenandoahFreeSet::rebuild() { } // Evac reserve: reserve trailing space for evacuations - size_t to_reserve = ShenandoahEvacReserve * _heap->capacity() / 100; + size_t to_reserve = ShenandoahEvacReserve * _heap->max_capacity() / 100; size_t reserved = 0; for (size_t idx = _heap->num_regions() - 1; idx > 0; idx--) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index c927f4b703..7a42f9b915 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -504,7 +504,7 @@ void ShenandoahHeap::reset_mark_bitmap() { void ShenandoahHeap::print_on(outputStream* st) const { st->print_cr("Shenandoah Heap"); st->print_cr(" " SIZE_FORMAT "K total, " SIZE_FORMAT "K committed, " SIZE_FORMAT "K used", - capacity() / K, committed() / K, used() / K); + max_capacity() / K, committed() / K, used() / K); st->print_cr(" " SIZE_FORMAT " x " SIZE_FORMAT"K regions", num_regions(), ShenandoahHeapRegion::region_size_bytes() / K); @@ -617,7 +617,7 @@ void ShenandoahHeap::notify_mutator_alloc_words(size_t words, bool waste) { } size_t ShenandoahHeap::capacity() const { - return num_regions() * ShenandoahHeapRegion::region_size_bytes(); + return committed(); } size_t ShenandoahHeap::max_capacity() const { @@ -651,8 +651,6 @@ void ShenandoahHeap::op_uncommit(double shrink_before) { } if (count > 0) { - log_info(gc)("Uncommitted " SIZE_FORMAT "M. Heap: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M committed, " SIZE_FORMAT "M used", - count * ShenandoahHeapRegion::region_size_bytes() / M, capacity() / M, committed() / M, used() / M); control_thread()->notify_heap_changed(); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp index e12fac7cca..70b1d6c10d 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMonitoringSupport.cpp @@ -46,12 +46,12 @@ class ShenandoahGenerationCounters : public GenerationCounters { ShenandoahHeap* _heap; public: ShenandoahGenerationCounters(ShenandoahHeap* heap) : - GenerationCounters("Heap", 1, 1, heap->initial_capacity(), heap->max_capacity(), heap->committed()), + GenerationCounters("Heap", 1, 1, heap->initial_capacity(), heap->max_capacity(), heap->capacity()), _heap(heap) {}; virtual void update_all() { - _current_size->set_value(_heap->committed()); + _current_size->set_value(_heap->capacity()); } }; @@ -94,7 +94,7 @@ void ShenandoahMonitoringSupport::update_counters() { if (UsePerfData) { ShenandoahHeap* heap = ShenandoahHeap::heap(); size_t used = heap->used(); - size_t capacity = heap->capacity(); + size_t capacity = heap->max_capacity(); _heap_counters->update_all(); _space_counters->update_all(capacity, used); _heap_region_counters->update(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp index 0069d2793a..b796628b40 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp @@ -153,7 +153,7 @@ void ShenandoahPacer::setup_for_traversal() { void ShenandoahPacer::setup_for_idle() { assert(ShenandoahPacing, "Only be here when pacing is enabled"); - size_t initial = _heap->capacity() * ShenandoahPacingIdleSlack / 100; + size_t initial = _heap->max_capacity() * ShenandoahPacingIdleSlack / 100; double tax = 1; restart_with(initial, tax); @@ -166,7 +166,7 @@ size_t ShenandoahPacer::update_and_get_progress_history() { if (_progress == -1) { // First initialization, report some prior Atomic::store((intptr_t)PACING_PROGRESS_ZERO, &_progress); - return (size_t) (_heap->capacity() * 0.1); + return (size_t) (_heap->max_capacity() * 0.1); } else { // Record history, and reply historical data _progress_history->add(_progress); From ec6557908253c909faaff9670e6a6f8ca5622fec Mon Sep 17 00:00:00 2001 From: shade Date: Tue, 9 Apr 2019 21:20:16 +0200 Subject: [PATCH 37/38] 8222186: Shenandoah should not uncommit below minimum heap size Reviewed-by: zgu, rkennke --- .../gc/shenandoah/shenandoahArguments.cpp | 5 +++ .../gc/shenandoah/shenandoahControlThread.cpp | 8 +++-- .../share/gc/shenandoah/shenandoahHeap.cpp | 33 ++++++++++++++++--- .../share/gc/shenandoah/shenandoahHeap.hpp | 2 ++ .../shenandoah/mxbeans/TestMemoryMXBeans.java | 15 ++++++++- 5 files changed, 54 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp b/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp index 907a91a58b..b7201dca94 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp @@ -159,6 +159,11 @@ void ShenandoahArguments::initialize() { FLAG_SET_DEFAULT(ShenandoahUncommit, false); } + if ((InitialHeapSize == MaxHeapSize) && ShenandoahUncommit) { + log_info(gc)("Min heap equals to max heap, disabling ShenandoahUncommit"); + FLAG_SET_DEFAULT(ShenandoahUncommit, false); + } + // If class unloading is disabled, no unloading for concurrent cycles as well. // If class unloading is enabled, users should opt-in for unloading during // concurrent cycles. diff --git a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp index 7b13ccb694..ca071a6005 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp @@ -462,9 +462,11 @@ void ShenandoahControlThread::service_stw_degenerated_cycle(GCCause::Cause cause void ShenandoahControlThread::service_uncommit(double shrink_before) { ShenandoahHeap* heap = ShenandoahHeap::heap(); - // Scan through the heap and determine if there is work to do. This avoids taking - // heap lock if there is no work available, avoids spamming logs with superfluous - // logging messages, and minimises the amount of work while locks are taken. + // Determine if there is work to do. This avoids taking heap lock if there is + // no work available, avoids spamming logs with superfluous logging messages, + // and minimises the amount of work while locks are taken. + + if (heap->committed() <= heap->min_capacity()) return; bool has_work = false; for (size_t i = 0; i < heap->num_regions(); i++) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 7a42f9b915..b3c713702a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -139,6 +139,7 @@ jint ShenandoahHeap::initialize() { // size_t init_byte_size = collector_policy()->initial_heap_byte_size(); + size_t min_byte_size = collector_policy()->min_heap_byte_size(); size_t max_byte_size = collector_policy()->max_heap_byte_size(); size_t heap_alignment = collector_policy()->heap_alignment(); @@ -157,8 +158,13 @@ jint ShenandoahHeap::initialize() { size_t num_committed_regions = init_byte_size / reg_size_bytes; num_committed_regions = MIN2(num_committed_regions, _num_regions); assert(num_committed_regions <= _num_regions, "sanity"); - _initial_size = num_committed_regions * reg_size_bytes; + + size_t num_min_regions = min_byte_size / reg_size_bytes; + num_min_regions = MIN2(num_min_regions, _num_regions); + assert(num_min_regions <= _num_regions, "sanity"); + _minimum_size = num_min_regions * reg_size_bytes; + _committed = _initial_size; size_t heap_page_size = UseLargePages ? (size_t)os::large_page_size() : (size_t)os::vm_page_size(); @@ -350,8 +356,11 @@ jint ShenandoahHeap::initialize() { _control_thread = new ShenandoahControlThread(); - log_info(gc, init)("Initialize Shenandoah heap with initial size " SIZE_FORMAT "%s", - byte_size_in_proper_unit(_initial_size), proper_unit_for_byte_size(_initial_size)); + log_info(gc, init)("Initialize Shenandoah heap: " SIZE_FORMAT "%s initial, " SIZE_FORMAT "%s min, " SIZE_FORMAT "%s max", + byte_size_in_proper_unit(_initial_size), proper_unit_for_byte_size(_initial_size), + byte_size_in_proper_unit(_minimum_size), proper_unit_for_byte_size(_minimum_size), + byte_size_in_proper_unit(max_capacity()), proper_unit_for_byte_size(max_capacity()) + ); log_info(gc, init)("Safepointing mechanism: %s", SafepointMechanism::uses_thread_local_poll() ? "thread-local poll" : @@ -624,6 +633,10 @@ size_t ShenandoahHeap::max_capacity() const { return _num_regions * ShenandoahHeapRegion::region_size_bytes(); } +size_t ShenandoahHeap::min_capacity() const { + return _minimum_size; +} + size_t ShenandoahHeap::initial_capacity() const { return _initial_size; } @@ -637,12 +650,22 @@ bool ShenandoahHeap::is_in(const void* p) const { void ShenandoahHeap::op_uncommit(double shrink_before) { assert (ShenandoahUncommit, "should be enabled"); + // Application allocates from the beginning of the heap, and GC allocates at + // the end of it. It is more efficient to uncommit from the end, so that applications + // could enjoy the near committed regions. GC allocations are much less frequent, + // and therefore can accept the committing costs. + size_t count = 0; - for (size_t i = 0; i < num_regions(); i++) { - ShenandoahHeapRegion* r = get_region(i); + for (size_t i = num_regions(); i > 0; i--) { // care about size_t underflow + ShenandoahHeapRegion* r = get_region(i - 1); if (r->is_empty_committed() && (r->empty_time() < shrink_before)) { ShenandoahHeapLocker locker(lock()); if (r->is_empty_committed()) { + // Do not uncommit below minimal capacity + if (committed() < min_capacity() + ShenandoahHeapRegion::region_size_bytes()) { + break; + } + r->make_uncommitted(); count++; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index 2ad39ed40a..0de7b90a5a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -198,6 +198,7 @@ class ShenandoahHeap : public CollectedHeap { // private: size_t _initial_size; + size_t _minimum_size; DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t)); volatile size_t _used; volatile size_t _committed; @@ -216,6 +217,7 @@ class ShenandoahHeap : public CollectedHeap { size_t bytes_allocated_since_gc_start(); void reset_bytes_allocated_since_gc_start(); + size_t min_capacity() const; size_t max_capacity() const; size_t initial_capacity() const; size_t capacity() const; diff --git a/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java b/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java index d27d57cacd..18a7102f40 100644 --- a/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java +++ b/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java @@ -31,6 +31,8 @@ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g TestMemoryMXBeans -1 1024 * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xms1g -Xmx1g TestMemoryMXBeans 1024 1024 * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xms128m -Xmx1g TestMemoryMXBeans 128 1024 + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xms1g -Xmx1g -XX:ShenandoahUncommitDelay=0 TestMemoryMXBeans 1024 1024 + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xms128m -Xmx1g -XX:ShenandoahUncommitDelay=0 TestMemoryMXBeans 128 1024 */ import java.lang.management.*; @@ -46,6 +48,9 @@ public static void main(String[] args) throws Exception { long initSize = 1L * Integer.parseInt(args[0]) * 1024 * 1024; long maxSize = 1L * Integer.parseInt(args[1]) * 1024 * 1024; + // wait for GC to uncommit + Thread.sleep(1000); + testMemoryBean(initSize, maxSize); } @@ -65,7 +70,15 @@ public static void testMemoryBean(long initSize, long maxSize) { throw new IllegalStateException("Max heap size is wrong: " + heapMax + " vs " + maxSize); } if (initSize > 0 && maxSize > 0 && initSize != maxSize && heapCommitted == heapMax) { - throw new IllegalStateException("Init committed heap size is wrong: " + heapCommitted + + throw new IllegalStateException("Committed heap size is max: " + heapCommitted + + " (init: " + initSize + ", max: " + maxSize + ")"); + } + if (initSize > 0 && maxSize > 0 && initSize == maxSize && heapCommitted != heapMax) { + throw new IllegalStateException("Committed heap size is not max: " + heapCommitted + + " (init: " + initSize + ", max: " + maxSize + ")"); + } + if (initSize > 0 && heapCommitted < initSize) { + throw new IllegalStateException("Committed heap size is below min: " + heapCommitted + " (init: " + initSize + ", max: " + maxSize + ")"); } } From 68d8dd74f28a1fb8a03431fdec2342b03d7faa7b Mon Sep 17 00:00:00 2001 From: robm Date: Tue, 16 Apr 2019 06:44:04 -0700 Subject: [PATCH 38/38] Added tag jdk-12.0.1-ga for changeset e831fc6bca9e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 4b990edb1b..999640d284 100644 --- a/.hgtags +++ b/.hgtags @@ -549,3 +549,4 @@ edbfbc928f5d928a237d6cc384e75672759a2c6f jdk-12.0.1+9 e657e6b868841da27767e780f932f221b72e5713 jdk-12.0.1+10 8afa031910e32132bb19830b73e26e2991a7d68f jdk-12.0.1+11 e831fc6bca9e6afa6b486f07d386146e1ae0f6e1 jdk-12.0.1+12 +e831fc6bca9e6afa6b486f07d386146e1ae0f6e1 jdk-12.0.1-ga