8203301: Linux-sparc fails to build after JDK-8199712 (Flight Recorder)
authorglaubitz
Wed, 13 Jun 2018 10:34:51 +0200
changeset 50538 f36d08a3e700
parent 50537 d12828b7cd64
child 50539 7bf4f1b5e438
8203301: Linux-sparc fails to build after JDK-8199712 (Flight Recorder) Reviewed-by: kvn, thartmann
src/hotspot/cpu/sparc/vm_version_ext_sparc.cpp
src/hotspot/cpu/sparc/vm_version_ext_sparc.hpp
src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.cpp
src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.hpp
--- a/src/hotspot/cpu/sparc/vm_version_ext_sparc.cpp	Wed Jun 13 10:15:35 2018 +0200
+++ b/src/hotspot/cpu/sparc/vm_version_ext_sparc.cpp	Wed Jun 13 10:34:51 2018 +0200
@@ -31,10 +31,13 @@
 int   VM_Version_Ext::_no_of_threads = 0;
 int   VM_Version_Ext::_no_of_cores = 0;
 int   VM_Version_Ext::_no_of_sockets = 0;
+#if defined(SOLARIS)
 kid_t VM_Version_Ext::_kcid = -1;
+#endif
 char  VM_Version_Ext::_cpu_name[CPU_TYPE_DESC_BUF_SIZE] = {0};
 char  VM_Version_Ext::_cpu_desc[CPU_DETAILED_DESC_BUF_SIZE] = {0};
 
+#if defined(SOLARIS)
 // get cpu information. It takes into account if the kstat chain id
 // has been changed and update the info if necessary.
 bool VM_Version_Ext::initialize_cpu_information(void) {
@@ -144,6 +147,13 @@
   kstat_close(kc);
   return true;
 }
+#elif defined(LINUX)
+// get cpu information.
+bool VM_Version_Ext::initialize_cpu_information(void) {
+  // Not yet implemented.
+  return false;
+}
+#endif
 
 int VM_Version_Ext::number_of_threads(void) {
   initialize_cpu_information();
--- a/src/hotspot/cpu/sparc/vm_version_ext_sparc.hpp	Wed Jun 13 10:15:35 2018 +0200
+++ b/src/hotspot/cpu/sparc/vm_version_ext_sparc.hpp	Wed Jun 13 10:34:51 2018 +0200
@@ -27,8 +27,11 @@
 
 #include "utilities/macros.hpp"
 #include "vm_version_sparc.hpp"
+
+#if defined(SOLARIS)
 #include <kstat.h>
 #include <sys/processor.h>
+#endif
 
 #define CPU_INFO        "cpu_info"
 #define CPU_TYPE        "fpu_type"
@@ -45,7 +48,9 @@
   static int               _no_of_threads;
   static int               _no_of_cores;
   static int               _no_of_sockets;
+#if defined(SOLARIS)
   static kid_t             _kcid;
+#endif
   static char              _cpu_name[CPU_TYPE_DESC_BUF_SIZE];
   static char              _cpu_desc[CPU_DETAILED_DESC_BUF_SIZE];
 
--- a/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.cpp	Wed Jun 13 10:15:35 2018 +0200
+++ b/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.cpp	Wed Jun 13 10:34:51 2018 +0200
@@ -35,6 +35,13 @@
   return frame(last_Java_sp(), frame::unpatchable, _anchor.last_Java_pc());
 }
 
+bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) {
+  ucontext_t* uc = (ucontext_t*) ucontext;
+  *fr_addr = frame((intptr_t*)uc->uc_mcontext.mc_i7, frame::unpatchable,
+                   (address)uc->uc_mcontext.mc_gregs[MC_PC]);
+  return true;
+}
+
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
 // currently interrupted by SIGPROF
 bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
--- a/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.hpp	Wed Jun 13 10:15:35 2018 +0200
+++ b/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.hpp	Wed Jun 13 10:34:51 2018 +0200
@@ -85,8 +85,9 @@
     _base_of_stack_pointer = sp;
   }
 
-  bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext,
-    bool isInJava);
+  bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava);
+
+  bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava);
 
   // These routines are only used on cpu architectures that
   // have separate register stacks (Itanium).