8203221: Makefile fixes after Flight Recorder

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2018-05-25 10:14:27 +02:00
parent 2a629c612e
commit 0e24d79bf9
4 changed files with 60 additions and 46 deletions

View File

@ -119,6 +119,33 @@ AC_DEFUN([BASIC_GET_NON_MATCHING_VALUES],
fi
])
###############################################################################
# Check if a list of space-separated words contains any word(s) from a list of
# space-separated illegal words. Typical use is to see if a user-specified
# set of words contains any from a set of illegal words.
#
# Sets the specified variable to list of matching illegal words, or to
# the empty string if no words are matching the illegal set.
#
# $1: result variable name
# $2: list of values to check
# $3: list of illegal values
AC_DEFUN([BASIC_GET_MATCHING_VALUES],
[
# grep filter function inspired by a comment to http://stackoverflow.com/a/1617326
# Notice that the original variant fails on SLES 10 and 11
# Some grep versions (at least bsd) behaves strangely on the base case with
# no legal_values, so make it explicit.
values_to_check=`$ECHO $2 | $TR ' ' '\n'`
illegal_values=`$ECHO $3 | $TR ' ' '\n'`
if test -z "$illegal_values"; then
$1=""
else
result=`$GREP -Fx "$illegal_values" <<< "$values_to_check" | $GREP -v '^$'`
$1=${result//$'\n'/ }
fi
])
###############################################################################
# Sort a space-separated list, and remove duplicates.
#

View File

@ -28,6 +28,9 @@ VALID_JVM_FEATURES="compiler1 compiler2 zero minimal dtrace jvmti jvmci \
graal vm-structs jni-check services management cmsgc g1gc parallelgc serialgc nmt cds \
static-build link-time-opt aot jfr"
# Deprecated JVM features (these are ignored, but with a warning)
DEPRECATED_JVM_FEATURES="trace"
# All valid JVM variants
VALID_JVM_VARIANTS="server client minimal core zero custom"
@ -269,18 +272,27 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
USER_JVM_FEATURE_LIST=`$ECHO $with_jvm_features | $SED -e 's/,/ /g'`
AC_MSG_RESULT([$user_jvm_feature_list])
# These features will be added to all variant defaults
JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (!match($i, /^-.*/)) print $i }'`
JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (!match($i, /^-.*/)) printf("%s ", $i) }'`
# These features will be removed from all variant defaults
DISABLED_JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (match($i, /^-.*/)) print substr($i, 2) }'`
DISABLED_JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (match($i, /^-.*/)) printf("%s ", substr($i, 2))}'`
# Verify that the user has provided valid features
BASIC_GET_NON_MATCHING_VALUES(INVALID_FEATURES, $JVM_FEATURES $DISABLED_JVM_FEATURES, $VALID_JVM_FEATURES)
BASIC_GET_NON_MATCHING_VALUES(INVALID_FEATURES, $JVM_FEATURES $DISABLED_JVM_FEATURES, $VALID_JVM_FEATURES $DEPRECATED_JVM_FEATURES)
if test "x$INVALID_FEATURES" != x; then
AC_MSG_NOTICE([Unknown JVM features specified: "$INVALID_FEATURES"])
AC_MSG_NOTICE([The available JVM features are: "$VALID_JVM_FEATURES"])
AC_MSG_ERROR([Cannot continue])
fi
# Check if the user has provided deprecated features
BASIC_GET_MATCHING_VALUES(DEPRECATED_FEATURES, $JVM_FEATURES $DISABLED_JVM_FEATURES, $DEPRECATED_JVM_FEATURES)
if test "x$DEPRECATED_FEATURES" != x; then
AC_MSG_WARN([Deprecated JVM features specified (will be ignored): "$DEPRECATED_FEATURES"])
# Filter out deprecated features
BASIC_GET_NON_MATCHING_VALUES(JVM_FEATURES, $JVM_FEATURES, $DEPRECATED_FEATURES)
BASIC_GET_NON_MATCHING_VALUES(DISABLED_JVM_FEATURES, $DISABLED_JVM_FEATURES, $DEPRECATED_FEATURES)
fi
fi
# Override hotspot cpu definitions for ARM platforms

View File

@ -23,13 +23,11 @@
# questions.
#
$(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcJfr.gmk))
################################################################################
# Build tools needed for the Jfr source code generation
# Build tools needed for the JFR source code generation
JFR_TOOLS_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
JFR_TOOLS_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/tools/jfr
JFR_TOOLS_SRCDIR := $(TOPDIR)/make/src/classes
JFR_TOOLS_OUTPUTDIR := $(OUTPUTDIR)/buildtools/tools_classes
$(eval $(call SetupJavaCompiler, GENERATE_JFRBYTECODE, \
JAVAC := $(JAVAC), \
@ -42,53 +40,28 @@ $(eval $(call SetupJavaCompiler, GENERATE_JFRBYTECODE, \
$(eval $(call SetupJavaCompilation, BUILD_JFR_TOOLS, \
SETUP := GENERATE_JFRBYTECODE, \
SRC := $(JFR_TOOLS_SRCDIR), \
INCLUDE_FILES := GenerateJfrFiles.java, \
BIN := $(JFR_TOOLS_OUTPUTDIR), \
))
TOOL_JFR_GEN := $(JAVA_SMALL) -cp $(JFR_TOOLS_OUTPUTDIR) GenerateJfrFiles
TARGETS += $(BUILD_JFR_TOOLS)
################################################################################
# Setup make rules for Jfr file file generation.
# Setup make rules for JFR gensrc file generation.
#
# Parameter 1 is the name of the rule. This name is used as variable prefix,
# and the targets generated are listed in a variable by that name. This name is
# also used as the name of the output file.
#
# Remaining parameters are named arguments. These include:
# XML_FILE -- The input source file to use
# XSD_FILE -- The input schema for validation
# OUTPUT_DIR -- The directory to put the generated file in
SetupJfrGeneration = $(NamedParamsMacroTemplate)
define SetupJfrGenerationBody
$$($1_OUTPUT_DIR)/$1: $$($1_XML_FILE) $$($1_XSD_FILE) $$(BUILD_JFR_TOOLS)
$$(call LogInfo, Generating $$(@F))
$$(call MakeDir, $$(@D))
$$(call ExecuteWithLog, $$@, $$(TOOL_JFR_GEN) $$($1_XML_FILE) $$($1_XSD_FILE) $$($1_OUTPUT_DIR))
test -f $$@
TARGETS += $$($1_OUTPUT_DIR)/$1
endef
################################################################################
# Create files in gensrc/jfrfiles
TOOL_JFR_GEN := $(JAVA_SMALL) -cp $(JFR_TOOLS_OUTPUTDIR) build.tools.jfr.GenerateJfrFiles
JFR_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jfrfiles
JFR_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
METADATA_XML ?= $(JFR_SRCDIR)/metadata.xml
METADATA_XSD ?= $(JFR_SRCDIR)/metadata.xsd
# Changing these will trigger a rebuild of generated jfr files.
JFR_DEPS += \
$(METADATA_XML) \
$(METADATA_XSD) \
#
METADATA_XML := $(JFR_SRCDIR)/metadata.xml
METADATA_XSD := $(JFR_SRCDIR)/metadata.xsd
# our generator will generate all files in one go, so only need to setup one target rule
$(eval $(call SetupJfrGeneration, jfrEventClasses.hpp, \
XML_FILE := $(METADATA_XML), \
XSD_FILE := $(METADATA_XSD), \
OUTPUT_DIR := $(JFR_OUTPUTDIR), \
))
$(JFR_OUTPUTDIR)/jfrEventClasses.hpp: $(METADATA_XML) $(METADATA_XSD) \
$(BUILD_JFR_TOOLS)
$(call LogInfo, Generating $(@F))
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $@, $(TOOL_JFR_GEN) $(METADATA_XML) $(METADATA_XSD) $(JFR_OUTPUTDIR))
test -f $@
TARGETS += $(JFR_OUTPUTDIR)/jfrEventClasses.hpp

View File

@ -1,3 +1,5 @@
package build.tools.jfr;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;