Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Automatic merge of jdk:master into master
  • Loading branch information
duke committed Mar 10, 2021
2 parents be067d4 + d0c1aec commit 8ba59cf7c557cfdbd5e4f7c24fafa8c95ae9795c
Showing with 859 additions and 1,143 deletions.
  1. +1 −60 src/hotspot/os/aix/os_aix.cpp
  2. +0 −75 src/hotspot/os/bsd/os_bsd.cpp
  3. +1 −1 src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp
  4. +0 −63 src/hotspot/os/linux/os_linux.cpp
  5. +78 −0 src/hotspot/os/posix/os_posix.cpp
  6. +4 −2 src/hotspot/os/windows/os_windows.cpp
  7. +32 −37 src/hotspot/share/classfile/modules.cpp
  8. +8 −8 src/hotspot/share/classfile/modules.hpp
  9. +11 −26 src/hotspot/share/compiler/compilationPolicy.cpp
  10. +10 −0 src/hotspot/share/compiler/compilerDefinitions.cpp
  11. +1 −1 src/hotspot/share/compiler/compilerOracle.cpp
  12. +1 −1 src/hotspot/share/gc/shared/oopStorage.cpp
  13. +2 −10 src/hotspot/share/jfr/periodic/jfrOSInterface.cpp
  14. +17 −7 src/hotspot/share/prims/jvm.cpp
  15. +12 −5 src/hotspot/share/prims/whitebox.cpp
  16. +1 −1 src/hotspot/share/runtime/objectMonitor.cpp
  17. +1 −1 src/hotspot/share/runtime/os.cpp
  18. +8 −2 src/hotspot/share/runtime/os.hpp
  19. +3 −3 src/hotspot/share/runtime/{safefetch.hpp → safefetch.inline.hpp}
  20. +1 −1 src/hotspot/share/runtime/stubRoutines.cpp
  21. +1 −1 src/hotspot/share/utilities/vmError.cpp
  22. +2 −3 src/java.base/share/classes/java/io/DataInputStream.java
  23. +2 −3 src/java.base/share/classes/java/io/DataOutputStream.java
  24. +5 −13 src/java.base/share/classes/java/io/FilePermission.java
  25. +2 −4 src/java.base/share/classes/java/io/ObjectStreamClass.java
  26. +2 −3 src/java.base/share/classes/java/io/PrintStream.java
  27. +2 −3 src/java.base/share/classes/java/io/PrintWriter.java
  28. +1 −2 src/java.base/share/classes/java/math/BigDecimal.java
  29. +2 −3 src/java.base/share/classes/java/math/BigInteger.java
  30. +1 −3 src/java.base/share/classes/java/math/MathContext.java
  31. +3 −6 src/java.base/share/classes/java/text/AttributedString.java
  32. +2 −3 src/java.base/share/classes/java/text/CompactNumberFormat.java
  33. +2 −3 src/java.base/share/classes/java/text/DigitList.java
  34. +2 −3 src/java.base/share/classes/java/text/FieldPosition.java
  35. +2 −3 src/java.base/share/classes/java/text/ParsePosition.java
  36. +2 −4 src/java.base/share/classes/java/text/StringCharacterIterator.java
  37. +8 −6 src/java.base/share/classes/java/util/stream/Stream.java
  38. +2 −2 src/java.desktop/share/classes/java/awt/color/ColorSpace.java
  39. +16 −17 src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java
  40. +145 −389 src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
  41. +2 −3 src/java.desktop/share/classes/java/awt/color/ICC_ProfileGray.java
  42. +1 −80 src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c
  43. +1 −8 src/java.desktop/unix/native/libawt_headless/awt/HeadlessToolkit.c
  44. +1 −132 src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
  45. +20 −7 src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp
  46. +1 −1 src/jdk.hotspot.agent/doc/clhsdb.html
  47. +36 −26 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CLHSDB.java
  48. +11 −3 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java
  49. +34 −34 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
  50. +2 −2 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java
  51. +2 −2 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/CommandProcessorPanel.java
  52. +2 −2 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/DebuggerConsolePanel.java
  53. +5 −16 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/GraphicsUtilities.java
  54. +2 −2 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MemoryPanel.java
  55. +1 −3 src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c
  56. +6 −5 src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c
  57. +3 −3 src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c
  58. +5 −1 src/jdk.jdwp.agent/share/native/libjdwp/standardHandlers.c
  59. +20 −14 src/jdk.jdwp.agent/share/native/libjdwp/stepControl.c
  60. +41 −16 src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c
  61. +1 −2 src/jdk.jdwp.agent/share/native/libjdwp/threadControl.h
  62. +1 −1 src/utils/IdealGraphVisualizer/nbproject/platform.properties
  63. +1 −1 test/hotspot/gtest/runtime/test_safefetch.cpp
  64. +77 −0 test/hotspot/jtreg/compiler/oracle/TestInvalidCompileCommand.java
  65. +1 −1 test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdaForClassInBaseArchive.java
  66. +114 −0 test/hotspot/jtreg/serviceability/sa/sadebugd/ClhsdbAttachToDebugServer.java
  67. +72 −0 test/jdk/java/util/stream/examples/JavadocExamples.java
@@ -62,7 +62,7 @@
#include "runtime/os.hpp"
#include "runtime/osThread.hpp"
#include "runtime/perfMemory.hpp"
#include "runtime/safefetch.hpp"
#include "runtime/safefetch.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/statSampler.hpp"
#include "runtime/thread.inline.hpp"
@@ -108,7 +108,6 @@
#include <sys/types.h>
#include <sys/utsname.h>
#include <sys/vminfo.h>
#include <sys/wait.h>

// Missing prototypes for various system APIs.
extern "C"
@@ -3150,64 +3149,6 @@ size_t os::current_stack_size() {
return s;
}

extern char** environ;

// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
char* argv[4] = { (char*)"sh", (char*)"-c", cmd, NULL};

pid_t pid = fork();

if (pid < 0) {
// fork failed
return -1;

} else if (pid == 0) {
// child process

// Try to be consistent with system(), which uses "/usr/bin/sh" on AIX.
execve("/usr/bin/sh", argv, environ);

// execve failed
_exit(-1);

} else {
// copied from J2SE ..._waitForProcessExit() in UNIXProcess_md.c; we don't
// care about the actual exit code, for now.

int status;

// Wait for the child process to exit. This returns immediately if
// the child has already exited. */
while (waitpid(pid, &status, 0) < 0) {
switch (errno) {
case ECHILD: return 0;
case EINTR: break;
default: return -1;
}
}

if (WIFEXITED(status)) {
// The child exited normally; get its exit code.
return WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
// The child exited because of a signal.
// The best value to return is 0x80 + signal number,
// because that is what all Unix shells do, and because
// it allows callers to distinguish between process exit and
// process death by signal.
return 0x80 + WTERMSIG(status);
} else {
// Unknown exit code; pass it through.
return status;
}
}
return -1;
}

// Get the default path to the core file
// Returns the length of the string
int os::get_core_path(char* buffer, size_t bufferSize) {
@@ -93,7 +93,6 @@
# include <sys/time.h>
# include <sys/times.h>
# include <sys/types.h>
# include <sys/wait.h>
# include <time.h>
# include <unistd.h>

@@ -2610,80 +2609,6 @@ void os::pause() {
}
}

// Darwin has no "environ" in a dynamic library.
#ifdef __APPLE__
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
#else
extern char** environ;
#endif

// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
const char * argv[4] = {"sh", "-c", cmd, NULL};

// fork() in BsdThreads/NPTL is not async-safe. It needs to run
// pthread_atfork handlers and reset pthread library. All we need is a
// separate process to execve. Make a direct syscall to fork process.
// On IA64 there's no fork syscall, we have to use fork() and hope for
// the best...
pid_t pid = fork();

if (pid < 0) {
// fork failed
return -1;

} else if (pid == 0) {
// child process

// execve() in BsdThreads will call pthread_kill_other_threads_np()
// first to kill every thread on the thread list. Because this list is
// not reset by fork() (see notes above), execve() will instead kill
// every thread in the parent process. We know this is the only thread
// in the new process, so make a system call directly.
// IA64 should use normal execve() from glibc to match the glibc fork()
// above.
execve("/bin/sh", (char* const*)argv, environ);

// execve failed
_exit(-1);

} else {
// copied from J2SE ..._waitForProcessExit() in UNIXProcess_md.c; we don't
// care about the actual exit code, for now.

int status;

// Wait for the child process to exit. This returns immediately if
// the child has already exited. */
while (waitpid(pid, &status, 0) < 0) {
switch (errno) {
case ECHILD: return 0;
case EINTR: break;
default: return -1;
}
}

if (WIFEXITED(status)) {
// The child exited normally; get its exit code.
return WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
// The child exited because of a signal
// The best value to return is 0x80 + signal number,
// because that is what all Unix shells do, and because
// it allows callers to distinguish between process exit and
// process death by signal.
return 0x80 + WTERMSIG(status);
} else {
// Unknown exit code; pass it through
return status;
}
}
}

// Get the kern.corefile setting, or otherwise the default path to the core file
// Returns the length of the string
int os::get_core_path(char* buffer, size_t bufferSize) {
@@ -34,7 +34,7 @@
#include "logging/log.hpp"
#include "runtime/init.hpp"
#include "runtime/os.hpp"
#include "runtime/safefetch.hpp"
#include "runtime/safefetch.inline.hpp"
#include "utilities/align.hpp"
#include "utilities/debug.hpp"
#include "utilities/growableArray.hpp"
@@ -97,7 +97,6 @@
# include <sys/times.h>
# include <sys/utsname.h>
# include <sys/socket.h>
# include <sys/wait.h>
# include <pwd.h>
# include <poll.h>
# include <fcntl.h>
@@ -5219,68 +5218,6 @@ void os::pause() {
}
}

extern char** environ;

// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
const char * argv[4] = {"sh", "-c", cmd, NULL};

pid_t pid ;

if (use_vfork_if_available) {
pid = vfork();
} else {
pid = fork();
}

if (pid < 0) {
// fork failed
return -1;

} else if (pid == 0) {
// child process

execve("/bin/sh", (char* const*)argv, environ);

// execve failed
_exit(-1);

} else {
// copied from J2SE ..._waitForProcessExit() in UNIXProcess_md.c; we don't
// care about the actual exit code, for now.

int status;

// Wait for the child process to exit. This returns immediately if
// the child has already exited. */
while (waitpid(pid, &status, 0) < 0) {
switch (errno) {
case ECHILD: return 0;
case EINTR: break;
default: return -1;
}
}

if (WIFEXITED(status)) {
// The child exited normally; get its exit code.
return WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
// The child exited because of a signal
// The best value to return is 0x80 + signal number,
// because that is what all Unix shells do, and because
// it allows callers to distinguish between process exit and
// process death by signal.
return 0x80 + WTERMSIG(status);
} else {
// Unknown exit code; pass it through
return status;
}
}
}

// Get the default path to the core file
// Returns the length of the string
int os::get_core_path(char* buffer, size_t bufferSize) {
@@ -51,11 +51,17 @@
#include <signal.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include <utmpx.h>

#ifdef __APPLE__
#include <crt_externs.h>
#endif

#define ROOT_UID 0

#ifndef MAP_ANONYMOUS
@@ -1765,3 +1771,75 @@ int os::PlatformMonitor::wait(jlong millis) {
return OS_OK;
}
}

// Darwin has no "environ" in a dynamic library.
#ifdef __APPLE__
#define environ (*_NSGetEnviron())
#else
extern char** environ;
#endif

char** os::get_environ() { return environ; }

// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't fork a new process).
// Notes: -Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
// -this function is unsafe to use in non-error situations, mainly
// because the child process will inherit all parent descriptors.
int os::fork_and_exec(const char* cmd, bool prefer_vfork) {
const char * argv[4] = {"sh", "-c", cmd, NULL};

pid_t pid ;

char** env = os::get_environ();

// Use always vfork on AIX, since its safe and helps with analyzing OOM situations.
// Otherwise leave it up to the caller.
AIX_ONLY(prefer_vfork = true;)
pid = prefer_vfork ? ::vfork() : ::fork();

if (pid < 0) {
// fork failed
return -1;

} else if (pid == 0) {
// child process

::execve("/bin/sh", (char* const*)argv, env);

// execve failed
::_exit(-1);

} else {
// copied from J2SE ..._waitForProcessExit() in UNIXProcess_md.c; we don't
// care about the actual exit code, for now.

int status;

// Wait for the child process to exit. This returns immediately if
// the child has already exited. */
while (::waitpid(pid, &status, 0) < 0) {
switch (errno) {
case ECHILD: return 0;
case EINTR: break;
default: return -1;
}
}

if (WIFEXITED(status)) {
// The child exited normally; get its exit code.
return WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
// The child exited because of a signal
// The best value to return is 0x80 + signal number,
// because that is what all Unix shells do, and because
// it allows callers to distinguish between process exit and
// process death by signal.
return 0x80 + WTERMSIG(status);
} else {
// Unknown exit code; pass it through
return status;
}
}
}
@@ -57,7 +57,7 @@
#include "runtime/orderAccess.hpp"
#include "runtime/osThread.hpp"
#include "runtime/perfMemory.hpp"
#include "runtime/safefetch.hpp"
#include "runtime/safefetch.inline.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/statSampler.hpp"
@@ -266,6 +266,8 @@ bool os::unsetenv(const char* name) {
return (SetEnvironmentVariable(name, NULL) == TRUE);
}

char** os::get_environ() { return _environ; }

// No setuid programs under Windows.
bool os::have_special_privileges() {
return false;
@@ -5512,7 +5514,7 @@ int os::PlatformMonitor::wait(jlong millis) {

// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't create a new process).
int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
int os::fork_and_exec(const char* cmd, bool dummy /* ignored */) {
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD exit_code;

0 comments on commit 8ba59cf

Please sign in to comment.