changeset: 49521:66bf73fcdf4d
branch: ihse-cflags-rewrite-branch
tag: tip
user: ihse
date: Thu Mar 01 01:24:12 2018 +0100
summary: Clean up dtrace compilation.
--- a/make/hotspot/gensrc/GensrcDtrace.gmk Wed Feb 28 20:59:50 2018 +0100
+++ b/make/hotspot/gensrc/GensrcDtrace.gmk Thu Mar 01 01:30:10 2018 +0100
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
$(call LogInfo, Generating dtrace header file $(@F))
$(call MakeDir, $(@D) $(DTRACE_SUPPORT_DIR))
$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, \
- ( $(CC) -E $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d ) )
+ $(CPP) $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d)
$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -h -o $@ -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
# Process all .d files in DTRACE_SOURCE_DIR. They are:
--- a/make/hotspot/lib/CompileDtracePostJvm.gmk Wed Feb 28 20:59:50 2018 +0100
+++ b/make/hotspot/lib/CompileDtracePostJvm.gmk Thu Mar 01 01:30:10 2018 +0100
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -47,13 +47,9 @@
# this would preferrably have been done as a part of GensrcDtrace.gmk.
$(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
SRC := $(TOPDIR)/make/hotspot/src/native/dtrace, \
- CC := $(BUILD_CXX), \
- CXX := $(BUILD_CXX), \
- LDEXE := $(BUILD_CXX), \
- generateJvmOffsets.cpp_CXXFLAGS := $(JVM_CFLAGS) -mt -xnolib -norunpath, \
- generateJvmOffsetsMain.c_CFLAGS := -mt -m64 -norunpath -z nodefs, \
+ TOOLCHAIN := $(TOOLCHAIN_BUILD), \
LDFLAGS := -m64, \
- LIBS := -lc, \
+ CFLAGS := -m64 $(JVM_CFLAGS), \
OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
PROGRAM := dtraceGenOffsets, \
@@ -67,7 +63,7 @@
$1: $$(BUILD_DTRACE_GEN_OFFSETS)
$$(call LogInfo, Generating dtrace $2 file $$(@F))
$$(call MakeDir, $$(@D))
- $$(call ExecuteWithLog, $$@, ( $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@ ) )
+ $$(call ExecuteWithLog, $$@, $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@)
TARGETS += $1
endef
@@ -77,25 +73,12 @@
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))
############################################################################
- # Compile JVM_OFFSETS_OBJ which is linked with libjvm.so.
-
- # JvmOffsets.cpp is compiled without the common JVM_CFLAGS. Otherwise, the
- # natural way would have been to included this source code in BUILD_LIBJVM.
- JVM_OFFSETS_CFLAGS := -m64
- ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
- JVM_OFFSETS_CFLAGS += -xarch=sparc
- endif
-
- $(JVM_OFFSETS_OBJ): $(JVM_OFFSETS_CPP) $(JVM_OFFSETS_H)
- $(call LogInfo, Compiling dtrace file JvmOffsets.cpp (for libjvm.so))
- $(call ExecuteWithLog, $@, $(CXX) -c -I$(<D) -o $@ $(JVM_OFFSETS_CFLAGS) $<)
-
- ############################################################################
# Generate DTRACE_OBJ which is linked with libjvm.so.
# Concatenate all *.d files into a single file
@@ -146,7 +129,7 @@
$(DTRACE_OBJ): $(JVM_OUTPUTDIR)/objs/dtrace.d $(DTRACE_INSTRUMENTED_OBJS)
$(call LogInfo, Generating $(@F) from $(<F) and object files)
$(call MakeDir, $(DTRACE_SUPPORT_DIR))
- $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CC) -E \
+ $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CPP) \
$(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d)
$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -xlazyload -o $@ \
-s $(DTRACE_SUPPORT_DIR)/$(@F).d $(sort $(DTRACE_INSTRUMENTED_OBJS)))
@@ -157,20 +140,18 @@
# Unfortunately dtrace generates incorrect types for some symbols in
# dtrace_jhelper.o, resulting in "warning: symbol X has differing types"
# This is tracked in JDK-6890703.
+ #
+ # Make sure we run our selected compiler for preprocessing instead of letting
+ # the dtrace tool pick it on it's own.
$(DTRACE_JHELPER_OBJ): $(TOPDIR)/src/hotspot/os/solaris/dtrace/jhelper.d \
$(JVM_OFFSETS_INDEX_H)
$(call LogInfo, Running dtrace for $(<F))
- $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) $(DTRACE_CPP_FLAGS) -C \
- -I$(DTRACE_SUPPORT_DIR) -o $@ -s $<)
-
- # NOTE: We should really do something like this, but unfortunately this
- # results in a compilation error. :-(
- # $(call MakeDir, $(DTRACE_SUPPORT_DIR))
- # $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CC) -E \
- # $(DTRACE_CPP_FLAGS) -I$(DTRACE_SUPPORT_DIR) $^ \
- # > $(DTRACE_SUPPORT_DIR)/$(@F).d)
- # $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
- # -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
+ $(call MakeDir, $(DTRACE_SUPPORT_DIR))
+ $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CPP) \
+ $(DTRACE_CPP_FLAGS) -I$(DTRACE_SUPPORT_DIR) $^ \
+ > $(DTRACE_SUPPORT_DIR)/$(@F).d)
+ $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
+ -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
############################################################################
# Build the stand-alone dtrace libraries
--- a/make/hotspot/lib/CompileDtracePreJvm.gmk Wed Feb 28 20:59:50 2018 +0100
+++ b/make/hotspot/lib/CompileDtracePreJvm.gmk Thu Mar 01 01:30:10 2018 +0100
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -29,8 +29,11 @@
# CompileJvm.gmk
DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o
DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o
- JVM_OFFSETS_OBJ := $(JVM_OUTPUTDIR)/objs/JvmOffsets.o
+ DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ)
- DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ) $(JVM_OFFSETS_OBJ)
+ # Since we cannot generated JvmOffsets.cpp as part of the gensrc step,
+ # we need this special hook to get it to compile with the rest of libjvm.
+ JVM_OFFSETS_CPP := $(DTRACE_SUPPORT_DIR)/JvmOffsets.cpp
+ DTRACE_EXTRA_SOURCE_FILES := $(JVM_OFFSETS_CPP)
endif
endif
--- a/make/hotspot/lib/CompileJvm.gmk Wed Feb 28 20:59:50 2018 +0100
+++ b/make/hotspot/lib/CompileJvm.gmk Thu Mar 01 01:30:10 2018 +0100
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -214,6 +214,7 @@
LIBRARY := jvm, \
OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
SRC := $(JVM_SRC_DIRS), \
+ EXTRA_FILES := $(DTRACE_EXTRA_SOURCE_FILES), \
EXCLUDES := $(JVM_EXCLUDES), \
EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \
EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
--- a/make/hotspot/src/native/dtrace/generateJvmOffsetsMain.c Wed Feb 28 20:59:50 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * 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.
- *
- */
-
-
-#include "generateJvmOffsets.h"
-
-const char *HELP =
- "HELP: generateJvmOffsets {-header | -index | -table} \n";
-
-int main(int argc, const char *argv[]) {
- GEN_variant gen_var;
-
- if (argc != 2) {
- printf("%s", HELP);
- return 1;
- }
-
- if (0 == strcmp(argv[1], "-header")) {
- gen_var = GEN_OFFSET;
- }
- else if (0 == strcmp(argv[1], "-index")) {
- gen_var = GEN_INDEX;
- }
- else if (0 == strcmp(argv[1], "-table")) {
- gen_var = GEN_TABLE;
- }
- else {
- printf("%s", HELP);
- return 1;
- }
- return generateJvmOffsets(gen_var);
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/hotspot/src/native/dtrace/generateJvmOffsetsMain.cpp Thu Mar 01 01:30:10 2018 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * 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.
+ *
+ */
+
+
+#include "generateJvmOffsets.h"
+
+const char *HELP =
+ "HELP: generateJvmOffsets {-header | -index | -table} \n";
+
+int main(int argc, const char *argv[]) {
+ GEN_variant gen_var;
+
+ if (argc != 2) {
+ printf("%s", HELP);
+ return 1;
+ }
+
+ if (0 == strcmp(argv[1], "-header")) {
+ gen_var = GEN_OFFSET;
+ }
+ else if (0 == strcmp(argv[1], "-index")) {
+ gen_var = GEN_INDEX;
+ }
+ else if (0 == strcmp(argv[1], "-table")) {
+ gen_var = GEN_TABLE;
+ }
+ else {
+ printf("%s", HELP);
+ return 1;
+ }
+ return generateJvmOffsets(gen_var);
+}
--- a/src/hotspot/os/solaris/dtrace/jhelper.d Wed Feb 28 20:59:50 2018 +0100
+++ b/src/hotspot/os/solaris/dtrace/jhelper.d Thu Mar 01 01:30:10 2018 +0100
@@ -19,7 +19,7 @@
* 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.
- *
+ *
*/
/* This file is auto-generated */
@@ -30,7 +30,7 @@
#ifdef DEBUG
#define MARK_LINE this->line = __LINE__
#else
-#define MARK_LINE
+#define MARK_LINE
#endif
#ifdef _LP64
@@ -41,7 +41,7 @@
#define pointer uint32_t
#endif
-extern pointer __JvmOffsets;
+extern uint64_t* __JvmOffsets;
/* GrowableArray<CodeHeaps*>* */
extern pointer __1cJCodeCacheG_heaps_;
@@ -59,9 +59,8 @@
#define copyin_int32(ADDR) *(int32_t*) copyin((pointer) (ADDR), sizeof(int32_t))
#define copyin_uint8(ADDR) *(uint8_t*) copyin((pointer) (ADDR), sizeof(uint8_t))
-#define SAME(x) x
#define copyin_offset(JVM_CONST) JVM_CONST = \
- copyin_int32(JvmOffsetsPtr + SAME(IDX_)JVM_CONST * sizeof(int32_t))
+ copyin_int32(JvmOffsetsPtr + IDX_##JVM_CONST * sizeof(int32_t))
int init_done;
@@ -97,7 +96,7 @@
/!init_done && !this->done/
{
MARK_LINE;
-
+
copyin_offset(POINTER_SIZE);
copyin_offset(COMPILER);
copyin_offset(OFFSET_CollectedHeap_reserved);
@@ -158,7 +157,9 @@
#endif
/* Read address of GrowableArray<CodeHeaps*> */
- this->code_heaps_address = copyin_ptr(&``__1cJCodeCacheG_heaps_);
+ // this->code_heaps_address = copyin_ptr(&``__1cJCodeCacheG_heaps_);
+ this->code_heaps_address = * ( uint64_t * ) copyin ( ( uint64_t ) ( &``__1cJCodeCacheG_heaps_ ) , sizeof ( uint64_t ) );
+
/* Read address of _data array field in GrowableArray */
this->code_heaps_array_address = copyin_ptr(this->code_heaps_address + OFFSET_GrowableArray_CodeHeap_data);
this->number_of_heaps = copyin_uint32(this->code_heaps_address + OFFSET_GrowableArray_CodeHeap_len);
@@ -168,7 +169,9 @@
/*
* Get Java heap bounds
*/
- this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);
+ // this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);
+ this->Universe_collectedHeap = * ( uint64_t * ) copyin ( ( uint64_t ) ( &``__1cIUniverseO_collectedHeap_ ) , sizeof ( uint64_t ) );
+
this->heap_start = copyin_ptr(this->Universe_collectedHeap +
OFFSET_CollectedHeap_reserved +
OFFSET_MemRegion_start);
@@ -181,8 +184,8 @@
}
/*
- * IMPORTANT: At the moment the ustack helper supports up to 5 code heaps in
- * the code cache. If more code heaps are added the following probes have to
+ * IMPORTANT: At the moment the ustack helper supports up to 5 code heaps in
+ * the code cache. If more code heaps are added the following probes have to
* be extended. This is done by simply adding a probe to get the heap bounds
* and another probe to set the code heap address of the newly created heap.
*/
@@ -197,7 +200,7 @@
/* CodeHeap 1 */
init_done = 1;
this->code_heap1_address = copyin_ptr(this->code_heaps_array_address);
- this->code_heap1_low = copyin_ptr(this->code_heap1_address +
+ this->code_heap1_low = copyin_ptr(this->code_heap1_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
this->code_heap1_high = copyin_ptr(this->code_heap1_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
@@ -211,7 +214,7 @@
init_done = 2;
this->code_heaps_array_address = this->code_heaps_array_address + POINTER_SIZE;
this->code_heap2_address = copyin_ptr(this->code_heaps_array_address);
- this->code_heap2_low = copyin_ptr(this->code_heap2_address +
+ this->code_heap2_low = copyin_ptr(this->code_heap2_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
this->code_heap2_high = copyin_ptr(this->code_heap2_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
@@ -224,7 +227,7 @@
init_done = 3;
this->code_heaps_array_address = this->code_heaps_array_address + POINTER_SIZE;
this->code_heap3_address = copyin_ptr(this->code_heaps_array_address);
- this->code_heap3_low = copyin_ptr(this->code_heap3_address +
+ this->code_heap3_low = copyin_ptr(this->code_heap3_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
this->code_heap3_high = copyin_ptr(this->code_heap3_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
@@ -237,7 +240,7 @@
init_done = 4;
this->code_heaps_array_address = this->code_heaps_array_address + POINTER_SIZE;
this->code_heap4_address = copyin_ptr(this->code_heaps_array_address);
- this->code_heap4_low = copyin_ptr(this->code_heap4_address +
+ this->code_heap4_low = copyin_ptr(this->code_heap4_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
this->code_heap4_high = copyin_ptr(this->code_heap4_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
@@ -250,7 +253,7 @@
init_done = 5;
this->code_heaps_array_address = this->code_heaps_array_address + POINTER_SIZE;
this->code_heap5_address = copyin_ptr(this->code_heaps_array_address);
- this->code_heap5_low = copyin_ptr(this->code_heap5_address +
+ this->code_heap5_low = copyin_ptr(this->code_heap5_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
this->code_heap5_high = copyin_ptr(this->code_heap5_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
@@ -309,10 +312,10 @@
/!this->done && this->codecache/
{
MARK_LINE;
- /*
+ /*
* Get code heap configuration
*/
- this->code_heap_low = copyin_ptr(this->code_heap_address +
+ this->code_heap_low = copyin_ptr(this->code_heap_address +
OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
this->code_heap_segmap_low = copyin_ptr(this->code_heap_address +
OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low);
@@ -506,10 +509,10 @@
/*
* Now we need to add a trailing '\0' and possibly a tag character.
*/
- this->result[this->klassSymbolLength + 1 +
+ this->result[this->klassSymbolLength + 1 +
this->nameSymbolLength +
this->signatureSymbolLength] = this->suffix;
- this->result[this->klassSymbolLength + 2 +
+ this->result[this->klassSymbolLength + 2 +
this->nameSymbolLength +
this->signatureSymbolLength] = '\0';
@@ -519,7 +522,7 @@
dtrace:helper:ustack:
/this->done && this->error == (char *) NULL/
{
- this->result;
+ this->result;
}
dtrace:helper:ustack: