< prev index next >

make/hotspot/lib/JvmDtraceObjects.gmk

Print this page

        

@@ -21,68 +21,32 @@
 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
 
-################################################################################
-# Support for dtrace integration with libjvm, and stand-alone dtrace library
-# compilation.
-
 ifeq ($(call check-jvm-feature, dtrace), true)
-  ##############################################################################
-
   ifeq ($(OPENJDK_TARGET_OS), solaris)
+
     ############################################################################
-    # Integrate with libjvm. Here we generate three object files which are
+    # Integrate with libjvm. Here we generate two object files which are
     # linked with libjvm.so. This step is complicated from a dependency
-    # perspective, since it needs the rest of the compiled object files from the
-    # libjvm compilation, but the output is object files that are to be included
-    # when linking libjvm.so. So this generation must happen as a part of the
-    # libjvm compilation.
-
-    # First we need to generate the dtraceGenOffsets tool. When run, this will
-    # produce more header files and a C++ file.
-
-    # Note that generateJvmOffsets.cpp must be compiled as if it were a file
-    # in the libjvm.so, using JVM_CFLAGS as setup in CompileJvm.gmk. Otherwise
-    # this would preferrably have been done as a part of GensrcDtrace.gmk.
-    $(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
-        NAME := dtraceGenOffsets, \
-        TYPE := EXECUTABLE, \
-        SRC := $(TOPDIR)/make/hotspot/src/native/dtrace, \
-        TOOLCHAIN := $(TOOLCHAIN_BUILD), \
-        LDFLAGS := -m64, \
-        CFLAGS := -m64 $(JVM_CFLAGS), \
-        OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
-        OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
-    ))
-
-    DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET)
-
-    # Argument 1: Output filename
-    # Argument 2: dtrace-gen-offset tool command line option
-    define SetupDtraceOffsetsGeneration
-      $1: $$(BUILD_DTRACE_GEN_OFFSETS)
-        $$(call LogInfo, Generating dtrace $2 file $$(@F))
-        $$(call MakeDir, $$(@D))
-        $$(call ExecuteWithLog, $$@, ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@ ) )
-
-      TARGETS += $1
-    endef
-
-    JVM_OFFSETS_H := $(DTRACE_SUPPORT_DIR)/JvmOffsets.h
-    JVM_OFFSETS_CPP := $(DTRACE_SUPPORT_DIR)/JvmOffsets.cpp
-    JVM_OFFSETS_INDEX_H := $(DTRACE_SUPPORT_DIR)/JvmOffsetsIndex.h
-
-    # Run the dtrace-gen-offset tool to generate these three files.
-    # The generated JvmOffsets.cpp is compiled with the rest of libjvm.
-    $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_H), header))
-    $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_INDEX_H), index))
-    $(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_CPP), table))
+    # perspective. We add these two files to the linking of libjvm using
+    # EXTRA_OBJECT_FILES, but they need to be created outside the call to
+    # SetupNativeCompilation. Also, one of the files is dependent on compiled
+    # object files from the libjvm compilation, so this generation must happen
+    # as a part of the libjvm compilation.
+
+    # These files are are generated by CompileDtracePostJvm.gmk but consumed by
+    # CompileJvm.gmk
+    DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o
+    DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o
+
+    DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ)
 
     ############################################################################
-    # Generate DTRACE_OBJ which is linked with libjvm.so.
+    # Generate DTRACE_OBJ which is linked with libjvm.so. It depends on a set of
+    # object files from the compilation.
 
     # Concatenate all *.d files into a single file
     DTRACE_SOURCE_FILES := $(addprefix $(TOPDIR)/src/hotspot/os/posix/dtrace/, \
         hotspot_jni.d \
         hotspot.d \

@@ -136,17 +100,21 @@
             -s $(DTRACE_SUPPORT_DIR)/$(@F).d $(sort $(DTRACE_INSTRUMENTED_OBJS)))
 
     ############################################################################
     # Generate DTRACE_JHELPER_OBJ which is linked with libjvm.so.
 
+    JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d
+
+    # jhelper.d includes JvmOffsetsIndex.h which was created by the gensrc step.
+    DTRACE_GENSRC_DIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/dtracefiles
+    JVM_OFFSETS_INDEX_H := $(DTRACE_GENSRC_DIR)/JvmOffsetsIndex.h
+
     # Unfortunately dtrace generates incorrect types for some symbols in
     # dtrace_jhelper.o, resulting in "warning: symbol X has differing types"
     # See JDK-6890703 for details.
     # We work around this by fixing the types for these symbols using elfedit,
     # after dtrace has generated the .o file.
-    JHELPER_DTRACE_SRC := $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d
-
     GetElfeditCommands = \
       $(foreach symbol, \
           $(shell $(GREP) ^extern $(JHELPER_DTRACE_SRC) | $(AWK) '{ gsub(";","") ; print $$3 }'), \
           -e 'sym:st_type $(symbol) 1')
 

@@ -154,50 +122,15 @@
     # the dtrace tool pick it on it's own.
     $(DTRACE_JHELPER_OBJ): $(JHELPER_DTRACE_SRC) $(JVM_OFFSETS_INDEX_H)
         $(call LogInfo, Running dtrace for $(<F))
         $(call MakeDir, $(DTRACE_SUPPORT_DIR))
         $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, \
-            ($(CPP) $(DTRACE_CPP_FLAGS) -I$(DTRACE_SUPPORT_DIR) $^ \
+            ($(CPP) $(DTRACE_CPP_FLAGS) -I$(DTRACE_GENSRC_DIR) $^ \
             > $(DTRACE_SUPPORT_DIR)/$(@F).d))
         $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
             -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
         ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
           $(call ExecuteWithLog, $@.elfedit, $(ELFEDIT) $(call GetElfeditCommands) $@)
         endif
 
-    ############################################################################
-    # Build the stand-alone dtrace libraries
-
-    LIBJVM_DTRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_dtrace
-
-    $(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DTRACE, \
-        NAME := jvm_dtrace, \
-        OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
-        SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_dtrace, \
-        CFLAGS := -m64 -G -mt -KPIC, \
-        LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
-        LIBS := $(LIBDL) -lthread -ldoor, \
-        MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_dtrace/mapfile-vers, \
-        OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \
-    ))
-
-    LIBJVM_DB_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_db
-
-    # Note that libjvm_db.c has tests for COMPILER2, but this was never set by
-    # the old build.
-    $(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DB, \
-        NAME := jvm_db, \
-        OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
-        SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_db, \
-        CFLAGS := -I$(JVM_VARIANT_OUTPUTDIR)/gensrc -I$(DTRACE_SUPPORT_DIR) \
-            -m64 -G -mt -KPIC, \
-        LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
-        MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_db/mapfile-vers, \
-        OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \
-    ))
-
-    # We need the generated JvmOffsets.h before we can compile the libjvm_db source code.
-    $(BUILD_LIBJVM_DB_ALL_OBJS): $(JVM_OFFSETS_H)
-
-    TARGETS += $(BUILD_LIBJVM_DTRACE) $(BUILD_LIBJVM_DB)
   endif
 endif
< prev index next >