changeset 1793:87de14662618

SystemTap forwardport. 2009-03-27 Mark Wielaard <mjw@redhat.com> * patches/icedtea-systemtap.patch: New patch. * configure.ac: Add AC_ARG_ENABLE systemtap and AC_CHECK_HEADER for sys/sdt.h when --enable-systemtap given. * Makefile.am: Add patches/icedtea-systemtap.patch to ICEDTEA_PATCHES if ENABLE_SYSTEMTAP.
author Andrew John Hughes <ahughes@redhat.com>
date Wed, 20 May 2009 19:38:42 +0100
parents 833e810f111b
children 88af6aafd853
files ChangeLog Makefile.am configure.ac patches/icedtea-systemtap.patch
diffstat 4 files changed, 188 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed May 20 19:35:39 2009 +0100
+++ b/ChangeLog	Wed May 20 19:38:42 2009 +0100
@@ -1,3 +1,11 @@
+2009-03-27  Mark Wielaard  <mjw@redhat.com>
+
+	* patches/icedtea-systemtap.patch: New patch.
+	* configure.ac: Add AC_ARG_ENABLE systemtap and AC_CHECK_HEADER
+	for sys/sdt.h when --enable-systemtap given.
+	* Makefile.am: Add patches/icedtea-systemtap.patch to
+	ICEDTEA_PATCHES if ENABLE_SYSTEMTAP.
+
 2009-04-24  Lillian Angel  <langel@redhat.com>
 
 	Fixes #497191
--- a/Makefile.am	Wed May 20 19:35:39 2009 +0100
+++ b/Makefile.am	Wed May 20 19:38:42 2009 +0100
@@ -2004,6 +2004,10 @@
 ICEDTEA_PATCHES += patches/icedtea-nio2.patch
 endif
 
+if ENABLE_SYSTEMTAP
+ICEDTEA_PATCHES += patches/icedtea-systemtap.patch
+endif
+
 stamps/extract.stamp: stamps/download.stamp
 if OPENJDK_SRC_DIR_FOUND
 	cp -a $(OPENJDK_SRC_DIR) openjdk
--- a/configure.ac	Wed May 20 19:35:39 2009 +0100
+++ b/configure.ac	Wed May 20 19:38:42 2009 +0100
@@ -183,6 +183,14 @@
 AM_CONDITIONAL([ENABLE_NIO2], [test x$ENABLE_NIO2 = xyes])
 AC_MSG_RESULT(${ENABLE_NIO2})
 
+AC_MSG_CHECKING([whether to include SystemTap tracing support])
+AC_ARG_ENABLE([systemtap],
+	      [AS_HELP_STRING([--enable-systemtap],
+	      		      [Enable inclusion of SystemTap trace support])],
+	      [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no'])
+AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes])
+AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
+
 AC_MSG_CHECKING([how many parallel build jobs to execute])
 AC_ARG_WITH([parallel-jobs],
 	[AS_HELP_STRING([--with-parallel-jobs],
@@ -400,6 +408,12 @@
   fi
 fi
 
+if test "x${ENABLE_SYSTEMTAP}" = xyes; then
+AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'],
+                [SDT_H_FOUND='no';
+                   AC_MSG_ERROR([systemtap support needs sys/sdt.h header])])
+fi
+
 dnl Check for libpng headers and libraries.
 PKG_CHECK_MODULES(LIBPNG, libpng,[LIBPNG_FOUND=yes]
 	,[LIBPNG_FOUND=no])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-systemtap.patch	Wed May 20 19:38:42 2009 +0100
@@ -0,0 +1,162 @@
+diff -r 945bf7540697 make/linux/makefiles/dtrace.make
+--- openjdk/hotspot/make/linux/makefiles/dtrace.make	Thu Jan 22 14:42:01 2009 -0800
++++ openjdk/hotspot/make/linux/makefiles/dtrace.make	Mon Feb 02 13:47:34 2009 +0100
+@@ -25,3 +25,7 @@
+ # Linux does not build jvm_db
+ LIBJVM_DB =
+ 
++# But it does have a Systemtap dtrace compatible sys/sdt.h
++CFLAGS += -DDTRACE_ENABLED
++
++# It doesn't support HAVE_DTRACE_H though.
+diff -r 945bf7540697 src/share/vm/code/nmethod.cpp
+--- openjdk/hotspot/src/share/vm/code/nmethod.cpp	Thu Jan 22 14:42:01 2009 -0800
++++ openjdk/hotspot/src/share/vm/code/nmethod.cpp	Mon Feb 02 13:47:34 2009 +0100
+@@ -22,6 +22,14 @@
+  *
+  */
+ 
++#ifdef __GNUC__
++// GCC seems to have some trouble with the inserted probes.
++// error: _probe_compiled__method__unload causes a section type conflict
++// error: compiled__method__unload_probe_name causes a section type conflict
++// So disable probe insertion for now.
++#undef DTRACE_ENABLED
++#endif
++
+ # include "incls/_precompiled.incl"
+ # include "incls/_nmethod.cpp.incl"
+ 
+diff -r 945bf7540697 src/share/vm/prims/jni.cpp
+--- openjdk/hotspot/src/share/vm/prims/jni.cpp	Thu Jan 22 14:42:01 2009 -0800
++++ openjdk/hotspot/src/share/vm/prims/jni.cpp	Mon Feb 02 13:47:34 2009 +0100
+@@ -22,6 +22,12 @@
+  *
+  */
+ 
++#ifdef __GNUC__
++// Unfortunately the gcc c preprocessor doesn't like some of the
++// FP_SELECT defines below, so for now we make sure to disable them.
++#undef DTRACE_ENABLED
++#endif
++
+ # include "incls/_precompiled.incl"
+ # include "incls/_jni.cpp.incl"
+ 
+diff -r 945bf7540697 src/share/vm/utilities/dtrace.hpp
+--- openjdk/hotspot/src/share/vm/utilities/dtrace.hpp	Thu Jan 22 14:42:01 2009 -0800
++++ openjdk/hotspot/src/share/vm/utilities/dtrace.hpp	Mon Feb 02 13:47:34 2009 +0100
+@@ -1,5 +1,6 @@
+ /*
+  * Copyright 2005-2007 Sun Microsystems, Inc.  All Rights Reserved.
++ * Copyright 2009 Red Hat, Inc.
+  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+  *
+  * This code is free software; you can redistribute it and/or modify it
+@@ -22,14 +23,14 @@
+  *
+  */
+ 
+-#if defined(SOLARIS) && defined(DTRACE_ENABLED)
++#if defined(DTRACE_ENABLED)
+ 
+ #include <sys/sdt.h>
+ 
+ #define DTRACE_ONLY(x) x
+ #define NOT_DTRACE(x)
+ 
+-#else // ndef SOLARIS || ndef DTRACE_ENABLED
++#else // ndef DTRACE_ENABLED
+ 
+ #define DTRACE_ONLY(x)
+ #define NOT_DTRACE(x) x
+@@ -40,9 +41,15 @@
+ #define DTRACE_PROBE3(a,b,c,d,e) {;}
+ #define DTRACE_PROBE4(a,b,c,d,e,f) {;}
+ #define DTRACE_PROBE5(a,b,c,d,e,f,g) {;}
++#define DTRACE_PROBE6(a,b,c,d,e,f,g,h) {;}
++#define DTRACE_PROBE7(a,b,c,d,e,f,g,h,i) {;}
++#define DTRACE_PROBE8(a,b,c,d,e,f,g,h,i,j) {;}
++#define DTRACE_PROBE9(a,b,c,d,e,f,g,h,i,j,k) {;}
+ 
+ #endif
+ 
++#if defined(SOLARIS)
++// Solaris dtrace needs actual extern function decls.
+ #define HS_DTRACE_PROBE_FN(provider,name)\
+   __dtrace_##provider##___##name
+ 
+@@ -50,6 +57,13 @@
+   DTRACE_ONLY(extern "C" void HS_DTRACE_PROBE_FN(provider,name) args)
+ #define HS_DTRACE_PROBE_CDECL_N(provider,name,args) \
+   DTRACE_ONLY(extern void HS_DTRACE_PROBE_FN(provider,name) args)
++#else
++// Systemtap dtrace compatible probes on GNU/Linux don't.
++#define HS_DTRACE_PROBE_FN(provider,name)
++
++#define HS_DTRACE_PROBE_DECL_N(provider,name,args)
++#define HS_DTRACE_PROBE_CDECL_N(provider,name,args)
++#endif 
+ 
+ /* Dtrace probe declarations */
+ #define HS_DTRACE_PROBE_DECL(provider,name) \
+@@ -91,6 +105,8 @@
+ #define HS_DTRACE_PROBE_N(provider,name, args) \
+   DTRACE_ONLY(HS_DTRACE_PROBE_FN(provider,name) args)
+ 
++#if defined(SOLARIS)
++// Solaris dtrace uses actual function calls.
+ #define HS_DTRACE_PROBE(provider,name) HS_DTRACE_PROBE0(provider,name)
+ #define HS_DTRACE_PROBE0(provider,name)\
+   HS_DTRACE_PROBE_N(provider,name,())
+@@ -123,3 +139,27 @@
+   HS_DTRACE_PROBE_N(provider,name,((uintptr_t)a0,(uintptr_t)a1,(uintptr_t)a2,\
+     (uintptr_t)a3,(uintptr_t)a4,(uintptr_t)a5,(uintptr_t)a6,(uintptr_t)a7,\
+     (uintptr_t)a8,(uintptr_t)a9))
++#else
++// Systemtap dtrace compatible probes on GNU/Linux use direct macros.
++#define HS_DTRACE_PROBE(provider,name) HS_DTRACE_PROBE0(provider,name)
++#define HS_DTRACE_PROBE0(provider,name)\
++  DTRACE_PROBE(provider,name)
++#define HS_DTRACE_PROBE1(provider,name,a0)\
++  DTRACE_PROBE1(provider,name,a0)
++#define HS_DTRACE_PROBE2(provider,name,a0,a1)\
++  DTRACE_PROBE2(provider,name,a0,a1)
++#define HS_DTRACE_PROBE3(provider,name,a0,a1,a2)\
++  DTRACE_PROBE3(provider,name,a0,a1,a2)
++#define HS_DTRACE_PROBE4(provider,name,a0,a1,a2,a3)\
++  DTRACE_PROBE4(provider,name,a0,a1,a2,a3)
++#define HS_DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4)\
++  DTRACE_PROBE5(provider,name,a0,a1,a2,a3,a4)
++#define HS_DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5)\
++  DTRACE_PROBE6(provider,name,a0,a1,a2,a3,a4,a5)
++#define HS_DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6)\
++  DTRACE_PROBE7(provider,name,a0,a1,a2,a3,a4,a5,a6)
++#define HS_DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7)\
++  DTRACE_PROBE8(provider,name,a0,a1,a2,a3,a4,a5,a6,a7)
++#define HS_DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)\
++  DTRACE_PROBE9(provider,name,a0,a1,a2,a3,a4,a5,a6,a7,a8)
++#endif
+--- openjdk/hotspot/src/share/vm/runtime/arguments.cpp	2009-03-04 14:39:43.000000000 +0100
++++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp	2009-03-04 22:11:37.000000000 +0100
+@@ -2272,16 +2272,16 @@
+       FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false);
+       FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true);
+     } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) {
+-#ifdef SOLARIS
++#ifdef DTRACE_ENABLED
+       FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true);
+       FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true);
+       FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true);
+       FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true);
+-#else // ndef SOLARIS
++#else // ndef DTRACE_ENABLED
+       jio_fprintf(defaultStream::error_stream(),
+-                  "ExtendedDTraceProbes flag is only applicable on Solaris\n");
++                  "ExtendedDTraceProbes flag is only applicable on dtrace enabled builds\n");
+       return JNI_EINVAL;
+-#endif // ndef SOLARIS
++#endif // ndef DTRACE_ENABLED
+     } else
+ #ifdef ASSERT
+     if (match_option(option, "-XX:+FullGCALot", &tail)) {