changeset 5851:f822db0610e4

8058113: Execution of OnOutOfMemoryError command hangs on linux-sparc Summary: JDK7u specific fix to add Linux-SPARC fork_and_exec() function; JDK8u and JDK9 version will be different. Reviewed-by: dcubed, dlong, dholmes, rdurbin
author gthornbr
date Wed, 04 Feb 2015 08:28:58 -0800
parents fa53911cba48
children 48af02f3c56c
files make/jprt.properties src/os/linux/vm/os_linux.cpp
diffstat 2 files changed, 87 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/make/jprt.properties	Thu Feb 05 09:27:52 2015 -0800
+++ b/make/jprt.properties	Wed Feb 04 08:28:58 2015 -0800
@@ -38,7 +38,7 @@
 
 # This tells jprt what default release we want to build
 
-jprt.hotspot.default.release=jdk7u60
+jprt.hotspot.default.release=jdk7u72
 
 jprt.tools.default.release=${jprt.submit.option.release?${jprt.submit.option.release}:${jprt.hotspot.default.release}}
 
@@ -54,92 +54,94 @@
 # Define the Solaris platforms we want for the various releases
 jprt.my.solaris.sparc.jdk8=solaris_sparc_5.10
 jprt.my.solaris.sparc.jdk7=solaris_sparc_5.10
-jprt.my.solaris.sparc.jdk7u60=${jprt.my.solaris.sparc.jdk7}
+jprt.my.solaris.sparc.jdk7u72=${jprt.my.solaris.sparc.jdk7}
 jprt.my.solaris.sparc=${jprt.my.solaris.sparc.${jprt.tools.default.release}}
 
 jprt.my.solaris.sparcv9.jdk8=solaris_sparcv9_5.10
 jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10
-jprt.my.solaris.sparcv9.jdk7u60=${jprt.my.solaris.sparcv9.jdk7}
+jprt.my.solaris.sparcv9.jdk7u72=${jprt.my.solaris.sparcv9.jdk7}
 jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}}
 
 jprt.my.solaris.i586.jdk8=solaris_i586_5.10
 jprt.my.solaris.i586.jdk7=solaris_i586_5.10
-jprt.my.solaris.i586.jdk7u60=${jprt.my.solaris.i586.jdk7}
+jprt.my.solaris.i586.jdk7u72=${jprt.my.solaris.i586.jdk7}
 jprt.my.solaris.i586=${jprt.my.solaris.i586.${jprt.tools.default.release}}
 
 jprt.my.solaris.x64.jdk8=solaris_x64_5.10
 jprt.my.solaris.x64.jdk7=solaris_x64_5.10
-jprt.my.solaris.x64.jdk7u60=${jprt.my.solaris.x64.jdk7}
+jprt.my.solaris.x64.jdk7u72=${jprt.my.solaris.x64.jdk7}
 jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}}
 
 jprt.my.linux.i586.jdk8=linux_i586_2.6
 jprt.my.linux.i586.jdk7=linux_i586_2.6
-jprt.my.linux.i586.jdk7u60=${jprt.my.linux.i586.jdk7}
+jprt.my.linux.i586.jdk7u72=${jprt.my.linux.i586.jdk7}
 jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}}
 
 jprt.my.linux.x64.jdk8=linux_x64_2.6
 jprt.my.linux.x64.jdk7=linux_x64_2.6
-jprt.my.linux.x64.jdk7u60=${jprt.my.linux.x64.jdk7}
+jprt.my.linux.x64.jdk7u72=${jprt.my.linux.x64.jdk7}
 jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}}
 
 jprt.my.linux.ppc.jdk8=linux_ppc_2.6
 jprt.my.linux.ppc.jdk7=linux_ppc_2.6
-jprt.my.linux.ppc.jdk7u60=${jprt.my.linux.ppc.jdk7}
+jprt.my.linux.ppc.jdk7u72=${jprt.my.linux.ppc.jdk7}
 jprt.my.linux.ppc=${jprt.my.linux.ppc.${jprt.tools.default.release}}
 
 jprt.my.linux.ppcv2.jdk8=linux_ppcv2_2.6
 jprt.my.linux.ppcv2.jdk7=linux_ppcv2_2.6
-jprt.my.linux.ppcv2.jdk7u60=${jprt.my.linux.ppcv2.jdk7}
+jprt.my.linux.ppcv2.jdk7u72=${jprt.my.linux.ppcv2.jdk7}
 jprt.my.linux.ppcv2=${jprt.my.linux.ppcv2.${jprt.tools.default.release}}
 
 jprt.my.linux.armvfp.jdk8=linux_armvfp_2.6
 jprt.my.linux.armvfp.jdk7=linux_armvfp_2.6
-jprt.my.linux.armvfp.jdk7u60=${jprt.my.linux.armvfp.jdk7}
+jprt.my.linux.armvfp.jdk7u72=${jprt.my.linux.armvfp.jdk7}
 jprt.my.linux.armvfp=${jprt.my.linux.armvfp.${jprt.tools.default.release}}
 
 jprt.my.linux.armvfpsflt.jdk8=linux_armvfpsflt_2.6
 jprt.my.linux.armvfpsflt.jdk7=linux_armvfpsflt_2.6
-jprt.my.linux.armvfpsflt.jdk7u60=${jprt.my.linux.armvfpsflt.jdk7}
+jprt.my.linux.armvfpsflt.jdk7u72=${jprt.my.linux.armvfpsflt.jdk7}
 jprt.my.linux.armvfpsflt=${jprt.my.linux.armvfpsflt.${jprt.tools.default.release}}
 
 jprt.my.linux.armvfphflt.jdk8=linux_armvfphflt_2.6
 jprt.my.linux.armvfphflt.jdk7=linux_armvfphflt_2.6
-jprt.my.linux.armvfphflt.jdk7u60=${jprt.my.linux.armvfphflt.jdk7}
+jprt.my.linux.armvfphflt.jdk7u72=${jprt.my.linux.armvfphflt.jdk7}
 jprt.my.linux.armvfphflt=${jprt.my.linux.armvfphflt.${jprt.tools.default.release}}
 
 jprt.my.linux.armv6.jdk8=linux_armv6_2.6
 jprt.my.linux.armv6.jdk7=linux_armv6_2.6
-jprt.my.linux.armv6.jdk7u60=${jprt.my.linux.armv6.jdk7}
+jprt.my.linux.armv6.jdk7u72=${jprt.my.linux.armv6.jdk7}
 jprt.my.linux.armv6=${jprt.my.linux.armv6.${jprt.tools.default.release}}
 
 jprt.my.linux.armvs.jdk8=linux_armvs_2.6
 jprt.my.linux.armvs.jdk7=linux_armvs_2.6
-jprt.my.linux.armvs.jdk7u60=${jprt.my.linux.armvs.jdk7}
+jprt.my.linux.armvs.jdk7u72=${jprt.my.linux.armvs.jdk7}
 jprt.my.linux.armvs=${jprt.my.linux.armvs.${jprt.tools.default.release}}
 
 jprt.my.linux.armvh.jdk8=linux_armvh_2.6
 jprt.my.linux.armvh.jdk7=linux_armvh_2.6
-jprt.my.linux.armvh.jdk7u60=${jprt.my.linux.armvh.jdk7}
+jprt.my.linux.armvh.jdk7u72=${jprt.my.linux.armvh.jdk7}
 jprt.my.linux.armvh=${jprt.my.linux.armvh.${jprt.tools.default.release}}
 
 jprt.my.linux.armsflt.jdk8=linux_armsflt_2.6
 jprt.my.linux.armsflt.jdk7=linux_armsflt_2.6
-jprt.my.linux.armsflt.jdk7u60=${jprt.my.linux.armsflt.jdk7}
+jprt.my.linux.armsflt.jdk7u72=${jprt.my.linux.armsflt.jdk7}
 jprt.my.linux.armsflt=${jprt.my.linux.armsflt.${jprt.tools.default.release}}
 
+jprt.my.linux.sparcv9=linux_sparcv9_3.8
+
 jprt.my.macosx.x64.jdk8=macosx_x64_10.7
 jprt.my.macosx.x64.jdk7=macosx_x64_10.7
-jprt.my.macosx.x64.jdk7u60=${jprt.my.macosx.x64.jdk7}
+jprt.my.macosx.x64.jdk7u72=${jprt.my.macosx.x64.jdk7}
 jprt.my.macosx.x64=${jprt.my.macosx.x64.${jprt.tools.default.release}}
 
 jprt.my.windows.i586.jdk8=windows_i586_5.1
 jprt.my.windows.i586.jdk7=windows_i586_5.1
-jprt.my.windows.i586.jdk7u60=${jprt.my.windows.i586.jdk7}
+jprt.my.windows.i586.jdk7u72=${jprt.my.windows.i586.jdk7}
 jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}}
 
 jprt.my.windows.x64.jdk8=windows_x64_5.2
 jprt.my.windows.x64.jdk7=windows_x64_5.2
-jprt.my.windows.x64.jdk7u60=${jprt.my.windows.x64.jdk7}
+jprt.my.windows.x64.jdk7u72=${jprt.my.windows.x64.jdk7}
 jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}}
 
 # Standard list of jprt build targets for this source tree
@@ -151,6 +153,7 @@
     ${jprt.my.solaris.x64}-{product|fastdebug|debug}, \
     ${jprt.my.linux.i586}-{product|fastdebug|debug}, \
     ${jprt.my.linux.x64}-{product|fastdebug}, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}, \
     ${jprt.my.macosx.x64}-{product|fastdebug|debug}, \
     ${jprt.my.windows.i586}-{product|fastdebug|debug}, \
     ${jprt.my.windows.x64}-{product|fastdebug|debug}, \
@@ -177,7 +180,7 @@
 
 jprt.build.targets.jdk8=${jprt.build.targets.all}
 jprt.build.targets.jdk7=${jprt.build.targets.all}
-jprt.build.targets.jdk7u60=${jprt.build.targets.all}
+jprt.build.targets.jdk7u72=${jprt.build.targets.all}
 jprt.build.targets=${jprt.build.targets.${jprt.tools.default.release}}
 
 # Subset lists of test targets for this source tree
@@ -352,6 +355,30 @@
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-jbb_G1, \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-jbb_ParOldGC
 
+jprt.my.linux.sparcv9.test.targets = \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jvm98, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jvm98_nontiered, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-scimark, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_default, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_SerialGC, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_ParallelGC, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_ParNewGC, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_CMS, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_G1, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_ParOldGC, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_default, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_SerialGC, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_ParallelGC, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_ParNewGC, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_CMS, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_G1, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_ParOldGC, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_default, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_default_nontiered, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_ParallelGC, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_G1, \
+    ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_ParOldGC
+
 jprt.my.macosx.x64.test.targets = \
     ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jvm98, \
     ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jvm98_nontiered, \
@@ -452,6 +479,7 @@
   ${jprt.my.solaris.x64.test.targets}, \
   ${jprt.my.linux.i586.test.targets}, \
   ${jprt.my.linux.x64.test.targets}, \
+  ${jprt.my.linux.sparcv9.test.targets}, \
   ${jprt.my.macosx.x64.test.targets}, \
   ${jprt.my.windows.i586.test.targets}, \
   ${jprt.my.windows.x64.test.targets}, \
@@ -470,7 +498,7 @@
 
 jprt.test.targets.jdk8=${jprt.test.targets.standard}
 jprt.test.targets.jdk7=${jprt.test.targets.standard}
-jprt.test.targets.jdk7u60=${jprt.test.targets.jdk7}
+jprt.test.targets.jdk7u72=${jprt.test.targets.jdk7}
 jprt.test.targets=${jprt.test.targets.${jprt.tools.default.release}}
 
 # The default test/Makefile targets that should be run
@@ -490,6 +518,7 @@
   ${jprt.my.solaris.x64}-*-c2-servertest, \
   ${jprt.my.linux.i586}-*-c2-servertest, \
   ${jprt.my.linux.x64}-*-c2-servertest, \
+  ${jprt.my.linux.sparcv9}-*-c2-servertest, \
   ${jprt.my.macosx.x64}-*-c2-servertest, \
   ${jprt.my.windows.i586}-*-c2-servertest, \
   ${jprt.my.windows.x64}-*-c2-servertest
@@ -501,6 +530,7 @@
   ${jprt.my.solaris.x64}-fastdebug-c2-internalvmtests, \
   ${jprt.my.linux.i586}-fastdebug-c2-internalvmtests, \
   ${jprt.my.linux.x64}-fastdebug-c2-internalvmtests, \
+  ${jprt.my.linux.sparcv9}-fastdebug-c2-internalvmtests, \
   ${jprt.my.macosx.x64}-fastdebug-c2-internalvmtests, \
   ${jprt.my.windows.i586}-fastdebug-c2-internalvmtests, \
   ${jprt.my.windows.x64}-fastdebug-c2-internalvmtests
@@ -512,6 +542,7 @@
   ${jprt.my.solaris.x64}-{product|fastdebug}-c2-wbapitest, \
   ${jprt.my.linux.i586}-{product|fastdebug}-c2-wbapitest, \
   ${jprt.my.linux.x64}-{product|fastdebug}-c2-wbapitest, \
+  ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-wbapitest, \
   ${jprt.my.windows.i586}-{product|fastdebug}-c2-wbapitest, \
   ${jprt.my.windows.x64}-{product|fastdebug}-c2-wbapitest, \
   ${jprt.my.solaris.sparc}-{product|fastdebug}-c1-wbapitest, \
@@ -530,7 +561,7 @@
 
 jprt.make.rule.test.targets.jdk8=${jprt.make.rule.test.targets.standard}
 jprt.make.rule.test.targets.jdk7=${jprt.make.rule.test.targets.standard}
-jprt.make.rule.test.targets.jdk7u60=${jprt.make.rule.test.targets.jdk7}
+jprt.make.rule.test.targets.jdk7u72=${jprt.make.rule.test.targets.jdk7}
 jprt.make.rule.test.targets=${jprt.make.rule.test.targets.${jprt.tools.default.release}}
 
 # 7155453: Work-around to prevent popups on OSX from blocking test completion
--- a/src/os/linux/vm/os_linux.cpp	Thu Feb 05 09:27:52 2015 -0800
+++ b/src/os/linux/vm/os_linux.cpp	Wed Feb 04 08:28:58 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -6065,26 +6065,57 @@
 #define __NR_execve IA32_ONLY(11) IA64_ONLY(1033) AMD64_ONLY(59)
 #endif
 
+#if defined(SPARC)
+// This assembly code makes the call to "syscall(__NR_fork)" and then
+// gets the values for "pid" and "is_child" from the correct registers.
+// This was done to make sure the compiler does not change the order
+// of the instructions while optimizing.
+void sparc_fork(int nr_fork, pid_t *pid, int *ischild) {
+  asm volatile (
+    " mov %2, %%o0\n\t"
+    " call syscall, 0\n\t"
+    " nop\n\t"
+    " mov %%o0, %0\n\t"
+    " mov %%o1, %1\n\t"
+    : "=r" (*pid), "=r" (*ischild)
+    : "r" (nr_fork) :
+  );
+}
+#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) {
   const char * argv[4] = {"sh", "-c", cmd, NULL};
+  int is_child;
+  pid_t pid;
 
   // fork() in LinuxThreads/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 = NOT_IA64(syscall(__NR_fork);)
+#if defined(SPARC)
+  sparc_fork(__NR_fork, &pid, &is_child);
+#else
+  pid = NOT_IA64(syscall(__NR_fork);)
               IA64_ONLY(fork();)
 
+  // set the is_child flag by checking the pid
+  if (pid == 0) {
+    is_child = 1;
+  } else {
+    is_child = 0;
+  }
+#endif
+
   if (pid < 0) {
     // fork failed
     return -1;
 
-  } else if (pid == 0) {
+  } else if (is_child) {
     // child process
 
     // execve() in LinuxThreads will call pthread_kill_other_threads_np()