Request for review 7170638: Use DTRACE_PROBE[N] in JNI Set and SetStatic Field.

Mark Wielaard mjw at redhat.com
Tue Oct 2 01:52:51 PDT 2012


On Mon, Oct 01, 2012 at 08:19:20PM -0400, Karen Kinnear wrote:
> 1. If you build with an earlier version of gcc - e.g. 4.3 -
> what happens when you build?

Building with older gcc is fine as long as you don't enable/install
sys/sdt.h. If you do enable it, but don't have a new enough GCC you might
get a build failure.

> And when you run?

If it builds it runs, there are no runtime dependencies. See below.

> - i.e. shouldn't the makefile conditional be on both the existence
> of sys/std.h and the gcc version?

As explained in the original submission for IcedTea I have a configure
feature check so you don't have to depend on specific versions, but
the hotspot build seems to prefer setting variables for things you want.
So I followed that convention in the make file patch.
http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-July/006196.html
But a version check can be added. Does the attached patch work for you?
I put in 4.4 as minimum since that is the oldest GCC that I have installed
that seems to compile things fine.

> 2. If you build on gcc 4.5 with a system that has std.h - what happens
> if you run on a system that does not have a version of SystemTap that
> supports dtrace->std?
> Do you need a runtime check as well so there are not problems in the field?

You don't need any runtime checks since there are no runtime dependencies.
gdb or stap might take advantage of the markers if they are there, but they
are just like debuginfo. If it is there you can take advantage of it with
the right tools to trace/debug hotspot, otherwise it doesn't have any impact.

See also the explanation I gave here:
http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-May/005846.html
 
Cheers,

Mark
-------------- next part --------------
# 7170638: Enable dtrace compatible sdt probes on GNU/Linux builds.
# Summary: If sys/sdt.h is found, then enable dtrace compatible sdt probes.
# Contributed-by: Mark Wielaard <mjw at redhat.com>

diff -r fab6fbf427d2 make/linux/makefiles/dtrace.make
--- a/make/linux/makefiles/dtrace.make	Sun Sep 30 23:24:12 2012 +0100
+++ b/make/linux/makefiles/dtrace.make	Tue Oct 02 09:40:10 2012 +0200
@@ -1,5 +1,6 @@
 #
 # Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012 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
@@ -25,3 +26,31 @@
 # Linux does not build jvm_db
 LIBJVM_DB =
 
+# But it does have a SystemTap dtrace compatible sys/sdt.h
+ifneq ($(ALT_SDT_H),)
+  SDT_H_FILE = $(ALT_SDT_H)
+else
+# We need a recent GCC for the default, otherwise use non-existing file
+ifneq "$(shell expr \( $(CC_VER_MAJOR) \>= 4 \) \& \( $(CC_VER_MINOR) \>= 4 \) )" "0"
+  SDT_H_FILE = /usr/include/sys/sdt.h
+else
+  SDT_H_FILE = /NO/sys/sdt.h/gcc/too/old
+endif
+endif
+DTRACE_ENABLED = $(shell test -f $(SDT_H_FILE) && echo $(SDT_H_FILE))
+
+ifneq ($(DTRACE_ENABLED),)
+  CFLAGS += -DDTRACE_ENABLED
+endif
+
+# Phone target used in vm.make build target to check whether enabled.
+.PHONY: dtraceCheck
+ifeq ($(DTRACE_ENABLED),)
+dtraceCheck:
+	$(QUIETLY) echo "**NOTICE** Dtrace support disabled $(SDT_H_FILE) not found"
+else
+dtraceCheck:
+endif
+
+# It doesn't support HAVE_DTRACE_H though.
+
diff -r fab6fbf427d2 make/linux/makefiles/vm.make
--- a/make/linux/makefiles/vm.make	Sun Sep 30 23:24:12 2012 +0100
+++ b/make/linux/makefiles/vm.make	Tue Oct 02 09:40:10 2012 +0200
@@ -387,7 +387,7 @@
 
 #----------------------------------------------------------------------
 
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR)
 
 install: install_jvm install_jsig install_saproc
 


More information about the hotspot-dev mailing list