/hg/icedtea6: Add hotspot_jni tapset.

mjw at icedtea.classpath.org mjw at icedtea.classpath.org
Mon Oct 19 14:25:25 PDT 2009


changeset 974b05e6e033 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=974b05e6e033
author: Mark Wielaard <mark at klomp.org>
date: Mon Oct 19 23:19:26 2009 +0200

	Add hotspot_jni tapset.

	2009-10-19 Mark Wielaard <mjw at redhat.com>

	 * tapset/hotspot_jni.stp.in: New tapset.
	       * scripts/jni_create_stap.c: New file.
	       * scripts/jni_desc: Likewise.
	       * configure.ac (AC_CONFIG_FILES): Add tapset/hotspot_jni.stp.
	       * Makefile.am (EXTRA_DIST): Add tapsets and scripts.
	(stamps/icedtea.stamp): Handle tapset/hotspot_jni.stp.in.
	(stamps/icedtea-debug.stamp): Likewise.


diffstat:

6 files changed, 9071 insertions(+), 1 deletion(-)
ChangeLog                 |   10 
Makefile.am               |   16 
configure.ac              |    1 
scripts/jni_create_stap.c |  190 +
scripts/jni_desc          | 1471 ++++++++
tapset/hotspot_jni.stp.in | 7384 +++++++++++++++++++++++++++++++++++++++++++++

diffs (truncated from 9132 to 500 lines):

diff -r 36c7480eedce -r 974b05e6e033 ChangeLog
--- a/ChangeLog	Mon Oct 19 21:49:33 2009 +0200
+++ b/ChangeLog	Mon Oct 19 23:19:26 2009 +0200
@@ -1,3 +1,13 @@ 2009-10-19  Mark Wielaard  <mjw at redhat.c
+2009-10-19  Mark Wielaard  <mjw at redhat.com>
+
+	* tapset/hotspot_jni.stp.in: New tapset.
+	* scripts/jni_create_stap.c: New file.
+	* scripts/jni_desc: Likewise.
+	* configure.ac (AC_CONFIG_FILES): Add tapset/hotspot_jni.stp.
+	* Makefile.am (EXTRA_DIST): Add tapsets and scripts.
+	(stamps/icedtea.stamp): Handle tapset/hotspot_jni.stp.in.
+	(stamps/icedtea-debug.stamp): Likewise.
+
 2009-10-19  Mark Wielaard  <mjw at redhat.com>
 
 	* patches/icedtea-systemtap.patch: Add fix for JNI
diff -r 36c7480eedce -r 974b05e6e033 Makefile.am
--- a/Makefile.am	Mon Oct 19 21:49:33 2009 +0200
+++ b/Makefile.am	Mon Oct 19 23:19:26 2009 +0200
@@ -120,7 +120,11 @@ EXTRA_DIST = rt generated \
 	HACKING pulseaudio fsg.sh \
 	plugin \
 	hotspot.map \
-	autogen.sh
+	autogen.sh \
+	tapset/hotspot.stp.in \
+	tapset/hotspot_jni.stp.in \
+	scripts/jni_create_stap.c \
+	scripts/jni_desc
 
 # The Binary plugs directory is called jdk1.7.0 for historical reasons. The
 # name is completely irrelevant; only contains the plugs to build IcedTea.
@@ -1199,9 +1203,14 @@ if ENABLE_SYSTEMTAP
 	  sed -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot.stp \
 	    > $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot.stp; \
+	  sed -e '/\/client\/libjvm.so/d' \
+	    < $(abs_top_builddir)/tapset/hotspot_jni.stp \
+	    > $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_jni.stp; \
 	else \
 	  cp $(abs_top_builddir)/tapset/hotspot.stp \
 	    $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot.stp; \
+	  cp $(abs_top_builddir)/tapset/hotspot_jni.stp \
+	    $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_jni.stp; \
 	fi
 endif
 if ENABLE_NSS
@@ -1291,9 +1300,14 @@ if ENABLE_SYSTEMTAP
 	  sed -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot.stp \
 	    > $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot.stp; \
+	  sed -e '/\/client\/libjvm.so/d' \
+	    < $(abs_top_builddir)/tapset/hotspot_jni.stp \
+	    > $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_jni.stp; \
 	else \
 	  cp $(abs_top_builddir)/tapset/hotspot.stp \
 	    $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot.stp; \
+	  cp $(abs_top_builddir)/tapset/hotspot_jni.stp \
+	    $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_jni.stp; \
 	fi
 endif
 if ENABLE_NSS
diff -r 36c7480eedce -r 974b05e6e033 configure.ac
--- a/configure.ac	Mon Oct 19 21:49:33 2009 +0200
+++ b/configure.ac	Mon Oct 19 23:19:26 2009 +0200
@@ -388,6 +388,7 @@ public:
   AC_SUBST(ABS_CLIENT_LIBJVM_SO)
   AC_SUBST(ABS_SERVER_LIBJVM_SO)
   AC_CONFIG_FILES([tapset/hotspot.stp])
+  AC_CONFIG_FILES([tapset/hotspot_jni.stp])
 fi
 
 dnl Check for libpng headers and libraries.
diff -r 36c7480eedce -r 974b05e6e033 scripts/jni_create_stap.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/jni_create_stap.c	Mon Oct 19 23:19:26 2009 +0200
@@ -0,0 +1,190 @@
+/* jni_create_stap.c -- Parses jni_desc into hotspot_jni.stp.in
+   Copyright (C) 2009  Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+// g++ -o jni_create_stap jni_create_stap
+// ./jni_create_stap < jni_desc > hotspot_jni.stp.in
+// (Don't forget to add header plus documentation)
+
+// data file:
+// JNIProbeName<space>Description
+// arg1_name<space><type><space>Description
+// arg2_name...
+// [ret<space><type><space>Description]
+// blank line
+//
+// Notes:
+// JNIProbeName doesn't include __entry or __return.
+// ret is the the return argument (if there is a __return probe)
+// <type>/representation is one of:
+// v - void, s - string, x - hex number, d - number
+// void is only used for return ret arguments.
+
+#include <iostream>
+#include <iterator>
+#include <string>
+#include <vector>
+using namespace std;
+
+struct probe
+{
+  string name;
+  string desc;
+  vector<string> args;
+  vector<char> types;
+  vector<string> descs;
+};
+
+int
+main()
+{
+  vector<probe> probes;
+
+  string line;
+  size_t index;
+  while (getline (cin, line))
+    {
+      if (line.size () == 0 || line[0] == '#')
+	continue;
+      probe p;
+      // probe name and description
+      index = line.find (' ');
+      p.name = line.substr (0, index);
+      p.desc = line.substr (index + 1);
+      
+      // arguments
+      while (getline (cin, line) && line.size () != 0)
+	{
+	  if (line[0] == '#')
+	    continue;
+	  
+	  index = line.find (' ');
+	  p.args.push_back (line.substr (0, index));
+	  p.types.push_back (line[index + 1]);
+	  p.descs.push_back (line.substr (index + 3));
+	}
+
+      probes.push_back (p);
+    }
+
+  vector<probe>::iterator it = probes.begin();
+  while (it != probes.end())
+    {
+      // Output probe entry
+      probe p = *it;
+      cout << "/* hotspot.jni." << p.name << endl;
+      cout << " * " << p.desc << endl;
+      cout << " *" << endl;
+      for (index = 0; index < p.args.size (); index++)
+	{
+	  if (p.args[index] == "ret")
+	    continue;
+	  cout << " * " << p.args[index] << " - " << p.descs[index] << endl;
+	}
+      cout << " */" << endl;
+      cout << "probe hotspot.jni." << p.name << " =" << endl;
+      cout << "  process(\"@ABS_CLIENT_LIBJVM_SO@\").mark(\""
+	   << p.name << "__entry" << "\")," << endl;
+      cout << "  process(\"@ABS_SERVER_LIBJVM_SO@\").mark(\""
+	   << p.name << "__entry" << "\")" << endl;
+      cout << "{" << endl;
+      cout << "  name = \"" << p.name << '"' << endl;
+      for (index = 0; index < p.args.size (); index++)
+	{
+	  if (p.args[index] == "ret")
+	    continue;
+	  cout << "  " << p.args[index] << " = ";
+	  if (p.types[index] == 's')
+	    cout << "user_string(" << "$arg" << (index + 1) << ")" << endl;
+	  else
+	    cout << "$arg" << (index + 1) << endl;
+	}
+      cout << "  probestr = sprintf(\"%s(";
+      for (index = 0; index < p.args.size (); index++)
+	{
+	  if (p.args[index] == "ret")
+            continue;
+	  cout << p.args[index] << '=';
+	  if (p.types[index] == 's')
+	    cout << "'%s'";
+	  else if (p.types[index] == 'x')
+	    cout << "0x%x";
+	  else
+	    cout << "%" << p.types[index];
+	  if (index != p.args.size () - 1 && p.args[index + 1] != "ret")
+	    cout << ',';
+	}
+      cout << ")\", name";
+      for (index = 0; index < p.args.size (); index++)
+        {
+          if (p.args[index] == "ret")
+            continue;
+	  cout << ", " << p.args[index];
+	}
+      cout << ")" << endl;
+      cout << "}" << endl;
+
+      // Output return probe if it exists
+      if (p.args.size () > 0 && p.args[p.args.size () - 1] == "ret")
+	{
+	  char type = p.types[p.args.size () - 1];
+	  cout << endl;
+	  cout << "/* hotspot.jni." << p.name << ".return" << endl;
+	  cout << " * " << p.desc << " Return." << endl;
+	  if (type != 'v')
+	    {
+	      cout << " *" << endl;
+	      cout << " * ret - " << p.descs[p.args.size() - 1] << endl;
+	    }
+	  cout << " */" << endl;
+
+	  cout << "probe hotspot.jni." << p.name << ".return =" << endl;
+	  cout << "  process(\"@ABS_CLIENT_LIBJVM_SO@\").mark(\""
+	       << p.name << "__return" << "\")," << endl;
+	  cout << "  process(\"@ABS_SERVER_LIBJVM_SO@\").mark(\""
+	       << p.name << "__return" << "\")" << endl;
+	  cout << "{" << endl;
+	  cout << "  name = \"" << p.name << '"' << endl;
+	  if (type == 's')
+	    {
+	      cout << "  ret = user_string($arg1)" << endl;
+	      cout << "  retstr = ret" << endl;
+	    }
+	  else if (type == 'x')
+	    {
+	      cout << "  ret = $arg1" << endl;
+	      cout << "  retstr = sprintf(\"0x%x\", ret)" << endl;
+	    }
+	  else if (type != 'v')
+	    {
+	      cout << "  ret = $arg1" << endl;
+	      cout << "  retstr = sprint(ret)" << endl;
+	    }
+	  else
+	    {
+	      cout << "  retstr = \"\"" << endl;
+	    }
+	  cout << "}" << endl;
+	}
+
+      cout << endl;
+      ++it;
+    }
+}
diff -r 36c7480eedce -r 974b05e6e033 scripts/jni_desc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/jni_desc	Mon Oct 19 23:19:26 2009 +0200
@@ -0,0 +1,1471 @@
+# jni_desc -- Descriptor file of JNI probe points for hotspot_jni.stp.in
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# This file is part of IcedTea.
+#
+# IcedTea is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# IcedTea is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with IcedTea; see the file COPYING.  If not, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+
+# JNIProbeName<space>Description
+# arg1_name<space><type><space>Description
+# arg2_name...
+# [ret<space><type><space>Description]
+# blank line
+#
+# Notes:
+# JNIProbeName doesn't include __entry or __return.
+# ret is the the return argument
+# (if there is a __return probe, only FatalError never returns)
+# <type>/representation is one of:
+# v - void, s - string, x - hex number, d - number
+# void is only used for return ret arguments.
+
+AllocObject Allocate object without calling any constructors.
+env x JNIEnv pointer.
+clazz x jclass pointer.
+ret x jobject reference to allocated object or NULL
+
+AttachCurrentThreadAsDaemon Attach the current thread as daemon.
+vm x JavaVM pointer.
+penv x pointer to JNIEnv pointer.
+args x pointer to JavaVMAttachArgs struct.
+ret d Zero on success, negative on error.
+
+AttachCurrentThread Attach the current thread.
+vm x JavaVM pointer.
+penv x pointer to JNIEnv pointer.
+args x pointer to JavaVMAttachArgs struct.
+ret d Zero on success, negative on error.
+
+CallBooleanMethodA Call virtual method returning a boolean using an array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallBooleanMethod Call virtual method returning a boolean.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallBooleanMethodV Call virtual method returning a boolean using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallByteMethodA Call virtual method returning a byte using an array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallByteMethod Call virtual method returning a byte.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallByteMethodV Call virtual method returning a byte using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallCharMethodA Call virtual method returning a char using an array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallCharMethod Call virtual method returning a char.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallCharMethodV Call virtual method returning a char using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallDoubleMethodA Call virtual method returning a double using an array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret v The result of the method call.
+
+CallDoubleMethod Call virtual method returning a double.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret v The result of the method call.
+
+CallDoubleMethodV Call virtual method returning a double using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret v The result of the method call.
+
+CallFloatMethodA Call virtual method returning a float using an array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret v The result of the method call.
+
+CallFloatMethod Call virtual method returning a float.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret v The result of the method call.
+
+CallFloatMethodV Call virtual method returning a float using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret v The result of the method call.
+
+CallIntMethodA Call virtual method returning a int using an array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallIntMethod Call virtual method returning a int.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallIntMethodV Call virtual method returning a int using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallLongMethodA Call virtual method returning a long using an array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallLongMethod Call virtual method returning a long.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallLongMethodV Call virtual method returning a long using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallObjectMethodA Call virtual method returning a object using array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret x The result of the method call.
+
+CallObjectMethod Call virtual method returning a object.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret x The result of the method call.
+
+CallObjectMethodV Call virtual method returning a object using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret x The result of the method call.
+
+CallShortMethodA Call virtual method returning a short using array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallShortMethod Call virtual method returning a short.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallShortMethodV Call virtual method returning a short using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret d The result of the method call.
+
+CallVoidMethodA Call virtual method returning void using array as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret v The result of the method call.
+
+CallVoidMethod Call virtual method returning void.
+env x JNIEnv pointer.
+obj x jobject reference.
+methodid x ID of the method to call.
+ret v The result of the method call.
+
+CallVoidMethodV Call virtual method returning void using va_list as arguments.
+env x JNIEnv pointer.
+obj x jobject reference.



More information about the distro-pkg-dev mailing list