--- a/make/autoconf/spec.gmk.in Mon Jan 07 16:41:59 2019 -0500
+++ b/make/autoconf/spec.gmk.in Mon Jan 07 16:43:30 2019 -0500
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2018, 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
@@ -729,6 +729,7 @@
RC:=@FIXPATH@ @RC@
DUMPBIN:=@FIXPATH@ @DUMPBIN@
CYGPATH:=@CYGPATH@
+WSLPATH:=@WSLPATH@
LDD:=@LDD@
OTOOL:=@OTOOL@
READELF:=@READELF@
--- a/make/hotspot/ide/CreateVSProject.gmk Mon Jan 07 16:41:59 2019 -0500
+++ b/make/hotspot/ide/CreateVSProject.gmk Mon Jan 07 16:43:30 2019 -0500
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2016, 2017, 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
@@ -46,8 +46,17 @@
# Helper macro to convert a unix path to a Windows path, suitable for
# inclusion in a command line.
- FixPath = \
- $(strip $(subst \,\\,$(shell $(CYGPATH) -w $1)))
+ ifeq ($(OPENJDK_BUILD_OS_ENV), windows.cygwin)
+ FixPath = \
+ $(strip $(subst \,\\,$(shell $(CYGPATH) -w $1)))
+ FixLinuxExecutable = \
+ $(call FixPath, $1)
+ else ifeq ($(OPENJDK_BUILD_OS_ENV), windows.wsl)
+ FixPath = \
+ $(strip $(subst \,\\,$(shell $(WSLPATH) -w $1)))
+ FixLinuxExecutable = \
+ "%windir%\Sysnative\wsl.exe $1"
+ endif
JVM_DEFINES_client := $(patsubst -D%,%, $(filter -D%, $(JVM_CFLAGS)))
EXTRACTED_DEFINES_client := $(addprefix -define , $(JVM_DEFINES_client))
@@ -121,7 +130,7 @@
-platformName x64 \
-buildBase $(call FixPath, $(IDE_OUTPUTDIR)/vs-output) \
-buildSpace $(call FixPath, $(IDE_OUTPUTDIR)) \
- -makeBinary $(call FixPath, $(MAKE)) \
+ -makeBinary $(call FixLinuxExecutable, $(MAKE)) \
-makeOutput $(call FixPath, $(JDK_OUTPUTDIR)/bin/server) \
-absoluteInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
-absoluteSrcInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
--- a/make/test/BuildMicrobenchmark.gmk Mon Jan 07 16:41:59 2019 -0500
+++ b/make/test/BuildMicrobenchmark.gmk Mon Jan 07 16:43:30 2019 -0500
@@ -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
@@ -78,7 +78,7 @@
# Build microbenchmark suite for the current JDK
$(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
SETUP := MICROBENCHMARK_JAVA_COMPILER, \
- ADD_JAVAC_FLAGS := -cp $(MICROBENCHMARK_CLASSPATH) -Xlint -Werror, \
+ ADD_JAVAC_FLAGS := -cp $(MICROBENCHMARK_CLASSPATH) -Xlint -Xlint:-processing -Werror, \
SRC := $(MICROBENCHMARK_SRC), \
BIN := $(MICROBENCHMARK_CLASSES), \
))
--- a/src/hotspot/os/bsd/os_bsd.cpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/os/bsd/os_bsd.cpp Mon Jan 07 16:43:30 2019 -0500
@@ -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
@@ -2256,7 +2256,8 @@
// 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] = {
@@ -2303,14 +2304,12 @@
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) {
@@ -2327,6 +2326,7 @@
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;
--- a/src/hotspot/os/linux/os_linux.cpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/os/linux/os_linux.cpp Mon Jan 07 16:43:30 2019 -0500
@@ -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
@@ -4076,7 +4076,8 @@
// 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
@@ -4100,14 +4101,12 @@
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) {
--- a/src/hotspot/share/gc/z/zReferenceProcessor.cpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/share/gc/z/zReferenceProcessor.cpp Mon Jan 07 16:43:30 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018, 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
@@ -68,9 +68,9 @@
java_lang_ref_SoftReference::set_clock(now);
}
-bool ZReferenceProcessor::is_reference_inactive(oop obj) const {
- // A non-null next field means the reference is inactive
- return java_lang_ref_Reference::next(obj) != NULL;
+bool ZReferenceProcessor::is_inactive_final_reference(oop obj, ReferenceType type) const {
+ // A non-null next field for a FinalReference means the reference is inactive.
+ return (type == REF_FINAL) && (java_lang_ref_Reference::next(obj) != NULL);
}
ReferenceType ZReferenceProcessor::reference_type(oop obj) const {
@@ -167,11 +167,6 @@
return type == REF_FINAL;
}
-bool ZReferenceProcessor::should_clear_referent(ReferenceType type) const {
- // Referents that were not marked must be cleared
- return !should_mark_referent(type);
-}
-
void ZReferenceProcessor::keep_referent_alive(oop obj, ReferenceType type) const {
volatile oop* const p = reference_referent_addr(obj);
if (type == REF_PHANTOM) {
@@ -192,8 +187,8 @@
// Update statistics
_encountered_count.get()[type]++;
- if (is_reference_inactive(obj) ||
- is_referent_strongly_alive_or_null(obj, type) ||
+ if (is_referent_strongly_alive_or_null(obj, type) ||
+ is_inactive_final_reference(obj, type) ||
is_referent_softly_alive(obj, type)) {
// Not discovered
return false;
@@ -242,23 +237,19 @@
// Update statistics
_enqueued_count.get()[type]++;
- // Clear referent
- if (should_clear_referent(type)) {
+ if (type != REF_FINAL) {
+ // Clear referent
java_lang_ref_Reference::set_referent(obj, NULL);
+ } else {
+ // For a FinalReference, don't clear the referent, because it is
+ // needed for the finalize call. Instead, make the reference
+ // inactive by self-looping the 'next' field. FinalReference
+ // doesn't allow Reference.enqueue, so there's no race to worry
+ // about when setting 'next'.
+ assert(java_lang_ref_Reference::next(obj) == NULL, "enqueued FinalReference");
+ java_lang_ref_Reference::set_next_raw(obj, obj);
}
- // Make reference inactive by self-looping the next field. We could be racing with a
- // call to Reference.enqueue() from the application, which is why we are using a CAS
- // to make sure we change the next field only if it is NULL. A failing CAS means the
- // reference has already been enqueued. However, we don't check the result of the CAS,
- // since we still have no option other than keeping the reference on the pending list.
- // It's ok to have the reference both on the pending list and enqueued at the same
- // time (the pending list is linked through the discovered field, while the reference
- // queue is linked through the next field). When the ReferenceHandler thread later
- // calls Reference.enqueue() we detect that it has already been enqueued and drop it.
- oop* const next_addr = (oop*)java_lang_ref_Reference::next_addr_raw(obj);
- Atomic::cmpxchg(obj, next_addr, oop(NULL));
-
// Return next in list
return (oop*)java_lang_ref_Reference::discovered_addr_raw(obj);
}
--- a/src/hotspot/share/gc/z/zReferenceProcessor.hpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/share/gc/z/zReferenceProcessor.hpp Mon Jan 07 16:43:30 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018, 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
@@ -52,12 +52,11 @@
const char* reference_type_name(ReferenceType type) const;
volatile oop* reference_referent_addr(oop obj) const;
oop reference_referent(oop obj) const;
- bool is_reference_inactive(oop obj) const;
+ bool is_inactive_final_reference(oop obj, ReferenceType type) const;
bool is_referent_strongly_alive_or_null(oop obj, ReferenceType type) const;
bool is_referent_softly_alive(oop obj, ReferenceType type) const;
bool should_drop_reference(oop obj, ReferenceType type) const;
bool should_mark_referent(ReferenceType type) const;
- bool should_clear_referent(ReferenceType type) const;
void keep_referent_alive(oop obj, ReferenceType type) const;
void discover(oop obj, ReferenceType type);
--- a/src/hotspot/share/oops/metadata.hpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/share/oops/metadata.hpp Mon Jan 07 16:43:30 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, 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
@@ -39,9 +39,6 @@
int identity_hash() { return (int)(uintptr_t)this; }
- // Rehashing support for tables containing pointers to this
- unsigned int new_hash(juint seed) { ShouldNotReachHere(); return 0; }
-
virtual bool is_metadata() const volatile { return true; }
virtual bool is_klass() const volatile { return false; }
virtual bool is_method() const volatile { return false; }
--- a/src/hotspot/share/oops/oop.cpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/share/oops/oop.cpp Mon Jan 07 16:43:30 2019 -0500
@@ -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
@@ -97,21 +97,6 @@
return ObjectSynchronizer::identity_hash_value_for(object);
}
-// When String table needs to rehash
-unsigned int oopDesc::new_hash(juint seed) {
- EXCEPTION_MARK;
- ResourceMark rm;
- int length;
- jchar* chars = java_lang_String::as_unicode_string(this, length, THREAD);
- if (chars != NULL) {
- // Use alternate hashing algorithm on the string
- return AltHashing::murmur3_32(seed, chars, length);
- } else {
- vm_exit_out_of_memory(length, OOM_MALLOC_ERROR, "unable to create Unicode strings for String table rehash");
- return 0;
- }
-}
-
// used only for asserts and guarantees
bool oopDesc::is_oop(oop obj, bool ignore_mark_word) {
if (!Universe::heap()->is_oop(obj)) {
--- a/src/hotspot/share/oops/oop.hpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/share/oops/oop.hpp Mon Jan 07 16:43:30 2019 -0500
@@ -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
@@ -308,9 +308,6 @@
inline intptr_t identity_hash();
intptr_t slow_identity_hash();
- // Alternate hashing code if string table is rehashed
- unsigned int new_hash(juint seed);
-
// marks are forwarded to stack when object is locked
inline bool has_displaced_mark_raw() const;
inline markOop displaced_mark_raw() const;
--- a/src/hotspot/share/oops/symbol.cpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/share/oops/symbol.cpp Mon Jan 07 16:43:30 2019 -0500
@@ -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
@@ -212,13 +212,6 @@
return str;
}
-// Alternate hashing for unbalanced symbol tables.
-unsigned int Symbol::new_hash(juint seed) {
- ResourceMark rm;
- // Use alternate hashing algorithm on this symbol.
- return AltHashing::murmur3_32(seed, (const jbyte*)as_C_string(), utf8_length());
-}
-
// Increment refcount while checking for zero. If the Symbol's refcount becomes zero
// a thread could be concurrently removing the Symbol. This is used during SymbolTable
// lookup to avoid reviving a dead Symbol.
--- a/src/hotspot/share/oops/symbol.hpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/share/oops/symbol.hpp Mon Jan 07 16:43:30 2019 -0500
@@ -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
@@ -164,9 +164,6 @@
((addr_bits ^ (length() << 8) ^ (( _body[0] << 8) | _body[1])) << 16);
}
- // For symbol table alternate hashing
- unsigned int new_hash(juint seed);
-
// Reference counting. See comments above this class for when to use.
int refcount() const { return extract_refcount(_length_and_refcount); }
bool try_increment_refcount();
--- a/src/hotspot/share/runtime/arguments.cpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/share/runtime/arguments.cpp Mon Jan 07 16:43:30 2019 -0500
@@ -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
@@ -532,13 +532,6 @@
{ "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() },
- { "CompilerThreadHintNoPreempt", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "VMThreadHintNoPreempt", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
-
-#if defined(_ALLBSD_SOURCE)
- { "UseSHM", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "UseHugeTLBFS", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
-#endif
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
{ "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
@@ -552,21 +545,6 @@
{ "SharedReadOnlySize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
{ "SharedMiscDataSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
{ "SharedMiscCodeSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
- { "AssumeMP", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "IgnoreUnverifiableClassesDuringDump", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "UnlinkSymbolsALot", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "AllowNonVirtualCalls", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "PrintSafepointStatistics", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "PrintSafepointStatisticsTimeout",JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "PrintSafepointStatisticsCount", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "TransmitErrorReport", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "ErrorReportServer", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "EmitSync", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "SyncVerbose", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "SyncFlags", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "SyncKnobs", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "MonitorInUseLists", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::jdk(13) },
- { "AggressiveOpts", JDK_Version::jdk(11), JDK_Version::jdk(12), JDK_Version::jdk(13) },
#ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
{ "dep > obs", JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
--- a/src/hotspot/share/runtime/globals.hpp Mon Jan 07 16:41:59 2019 -0500
+++ b/src/hotspot/share/runtime/globals.hpp Mon Jan 07 16:43:30 2019 -0500
@@ -2049,7 +2049,8 @@
" 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, \
--- a/src/java.base/share/classes/java/lang/System.java Mon Jan 07 16:41:59 2019 -0500
+++ b/src/java.base/share/classes/java/lang/System.java Mon Jan 07 16:43:30 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -984,7 +984,7 @@
* <p>If a security manager exists, its
* {@link SecurityManager#checkPermission checkPermission}
* method is called with a
- * {@code {@link RuntimePermission}("getenv."+name)}
+ * {@link RuntimePermission RuntimePermission("getenv."+name)}
* permission. This may result in a {@link SecurityException}
* being thrown. If no exception is thrown the value of the
* variable {@code name} is returned.
@@ -1055,7 +1055,7 @@
* <p>If a security manager exists, its
* {@link SecurityManager#checkPermission checkPermission}
* method is called with a
- * {@code {@link RuntimePermission}("getenv.*")} permission.
+ * {@link RuntimePermission RuntimePermission("getenv.*")} permission.
* This may result in a {@link SecurityException} being thrown.
*
* <p>When passing information to a Java subprocess,
--- a/src/java.base/windows/classes/java/lang/ProcessImpl.java Mon Jan 07 16:41:59 2019 -0500
+++ b/src/java.base/windows/classes/java/lang/ProcessImpl.java Mon Jan 07 16:43:30 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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,6 +106,7 @@
FileOutputStream f2 = null;
try {
+ boolean forceNullOutputStream = false;
long[] stdHandles;
if (redirects == null) {
stdHandles = new long[] { -1L, -1L, -1L };
@@ -129,6 +130,9 @@
stdHandles[1] = fdAccess.getHandle(FileDescriptor.out);
} else if (redirects[1] instanceof ProcessBuilder.RedirectPipeImpl) {
stdHandles[1] = fdAccess.getHandle(((ProcessBuilder.RedirectPipeImpl) redirects[1]).getFd());
+ // Force getInputStream to return a null stream,
+ // the handle is directly assigned to the next process.
+ forceNullOutputStream = true;
} else {
f1 = newFileOutputStream(redirects[1].file(),
redirects[1].append());
@@ -149,7 +153,7 @@
}
Process p = new ProcessImpl(cmdarray, envblock, dir,
- stdHandles, redirectErrorStream);
+ stdHandles, forceNullOutputStream, redirectErrorStream);
if (redirects != null) {
// Copy the handles's if they are to be redirected to another process
if (stdHandles[0] >= 0
@@ -349,6 +353,7 @@
final String envblock,
final String path,
final long[] stdHandles,
+ boolean forceNullOutputStream,
final boolean redirectErrorStream)
throws IOException
{
@@ -437,7 +442,7 @@
new FileOutputStream(stdin_fd));
}
- if (stdHandles[1] == -1L)
+ if (stdHandles[1] == -1L || forceNullOutputStream)
stdout_stream = ProcessBuilder.NullInputStream.INSTANCE;
else {
FileDescriptor stdout_fd = new FileDescriptor();
--- a/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java Mon Jan 07 16:41:59 2019 -0500
+++ b/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java Mon Jan 07 16:43:30 2019 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -37,18 +37,18 @@
// Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449)
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "-XX:SafepointSpinBeforeYieldPlusJunk", "-version");
+ "-XX:UseMembarPlusJunk", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("Unrecognized VM option 'SafepointSpinBeforeYieldPlusJunk'"); // Must identify bad option.
+ output.shouldContain("Unrecognized VM option 'UseMembarPlusJunk'"); // Must identify bad option.
output.shouldHaveExitValue(1);
// Case 2: Newly obsolete flags should be recognized as newly obsolete (8073989)
ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder(
- "-XX:+EmitSync", "-version");
+ "-XX:+UseMembar", "-version");
OutputAnalyzer output2 = new OutputAnalyzer(pb2.start());
output2.shouldContain("Ignoring option").shouldContain("support was removed");
- output2.shouldContain("EmitSync");
+ output2.shouldContain("UseMembar");
}
}
--- a/test/jdk/java/lang/ProcessBuilder/PipelineTest.java Mon Jan 07 16:41:59 2019 -0500
+++ b/test/jdk/java/lang/ProcessBuilder/PipelineTest.java Mon Jan 07 16:43:30 2019 -0500
@@ -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
@@ -34,6 +34,8 @@
/*
* @test PipelineTest
+ * @bug 8211844
+ * @summary Tests for ProcessBuilder.startPipeline
*/
public class PipelineTest {
@@ -170,7 +172,7 @@
static void verify(String input, String expected, List<ProcessBuilder> builders) throws IOException {
File infile = new File("test.in");
File outfile = new File("test.out");
- setFileContents(infile, expected);
+ setFileContents(infile, input);
for (int i = 0; i < builders.size(); i++) {
ProcessBuilder b = builders.get(i);
if (i == 0) {
@@ -184,8 +186,8 @@
verifyProcesses(processes);
waitForAll(processes);
String result = fileContents(outfile);
- System.out.printf(" in: %s%nout: %s%n", input, expected);
- check(result.equals(expected), "result not as expected");
+ check(result.equals(expected),
+ "result not as expected: " + result + ", expected: " + expected);
}
/**
@@ -219,11 +221,14 @@
static void verifyProcesses(List<Process> processes) {
for (int i = 0; i < processes.size(); i++) {
Process p = processes.get(i);
+
if (i != 0) {
verifyNullStream(p.getOutputStream(), "getOutputStream");
}
+ if (i <= processes.size() - 1) {
+ verifyNullStream(p.getInputStream(), "getInputStream");
+ }
if (i == processes.size() - 1) {
- verifyNullStream(p.getInputStream(), "getInputStream");
verifyNullStream(p.getErrorStream(), "getErrorStream");
}
}
@@ -232,7 +237,7 @@
static void verifyNullStream(OutputStream s, String msg) {
try {
s.write(0xff);
- fail("Stream should have been a NullStream" + msg);
+ fail("Stream should have been a NullStream: " + msg);
} catch (IOException ie) {
// expected
}
@@ -241,7 +246,7 @@
static void verifyNullStream(InputStream s, String msg) {
try {
int len = s.read();
- check(len == -1, "Stream should have been a NullStream" + msg);
+ check(len == -1, "Stream should have been a NullStream: " + msg);
} catch (IOException ie) {
// expected
}
@@ -271,9 +276,12 @@
//--------------------- Infrastructure ---------------------------
static volatile int passed = 0, failed = 0;
static void pass() {passed++;}
- static void fail() {failed++; Thread.dumpStack();}
- static void fail(String msg) {System.err.println(msg); fail();}
- static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+ static void fail() {failed++; new Exception("Stack trace").printStackTrace(System.out);}
+ static void fail(String msg) {
+ System.out.println(msg); failed++;
+ new Exception("Stack trace: " + msg).printStackTrace(System.out);
+ }
+ static void unexpected(Throwable t) {failed++; t.printStackTrace(System.out);}
static void check(boolean cond) {if (cond) pass(); else fail();}
static void check(boolean cond, String m) {if (cond) pass(); else fail(m);}
static void equal(Object x, Object y) {