8220383: Incremental build is broken and inefficient

Reviewed-by: tbell
This commit is contained in:
Erik Joelsson 2019-03-12 08:04:33 -07:00
parent 71ac5a6313
commit 2af935c800
9 changed files with 163 additions and 134 deletions

View File

@ -538,8 +538,13 @@ jdk.jfr_ADD_JAVAC_FLAGS := -XDstringConcat=inline -Xlint:-exports
################################################################################
# If this is an imported module that has prebuilt classes, only compile
# module-info.java.
ifneq ($(wildcard $(IMPORT_MODULES_CLASSES)/$(MODULE)), )
ifneq ($(IMPORT_MODULES_CLASSES), )
IMPORT_MODULE_DIR := $(IMPORT_MODULES_CLASSES)/$(MODULE)
ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
$(MODULE)_INCLUDE_FILES := module-info.java
endif
else
IMPORT_MODULE_DIR :=
endif
################################################################################
@ -645,13 +650,13 @@ endif
# If this is an imported module, copy the pre built classes and resources into
# the modules output dir
ifneq ($(wildcard $(IMPORT_MODULES_CLASSES)/$(MODULE)), )
ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
$(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \
$(call CacheFind, $(IMPORT_MODULES_CLASSES)/$(MODULE))
$(call CacheFind, $(IMPORT_MODULE_DIR))
$(call MakeDir, $(@D))
# Do not delete marker and build meta data files
$(RM) -r $(filter-out $(@D)/_%, $(wildcard $(@D)/*))
$(CP) -R $(IMPORT_MODULES_CLASSES)/$(MODULE)/* $(@D)/
$(CP) -R $(IMPORT_MODULE_DIR)/* $(@D)/
$(TOUCH) $@
TARGETS += $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker

View File

@ -112,7 +112,11 @@ $(eval $(call SetupExecute, jlink_jre, \
JLINK_JRE_TARGETS := $(jlink_jre)
ifeq ($(BUILD_CDS_ARCHIVE), true)
ifeq ($(OPENJDK_TARGET_OS), windows)
CDS_ARCHIVE := bin/server/classes.jsa
else
CDS_ARCHIVE := lib/server/classes.jsa
endif
$(eval $(call SetupExecute, gen_cds_archive_jdk, \
WARN := Creating CDS archive for jdk image, \

View File

@ -505,8 +505,9 @@ define SetupNativeCompilationBody
$$(foreach d, $$($1_SRC), $$(if $$(wildcard $$d), , \
$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d)))
# Find all files in the source trees. Preserve order.
$1_SRCS := $$(foreach s, $$($1_SRC), $$(call CacheFind, $$(s)))
$1_SRCS_RAW = $$(call CacheFind, $$($1_SRC))
# Order src files according to the order of the src dirs
$1_SRCS := $$(foreach d, $$($1_SRC), $$(filter $$d%, $$($1_SRCS_RAW)))
$1_SRCS := $$(filter $$(NATIVE_SOURCE_EXTENSIONS), $$($1_SRCS))
# Extract the C/C++ files.
ifneq ($$($1_EXCLUDE_PATTERNS), )
@ -970,10 +971,9 @@ define SetupNativeCompilationBody
$$(shell $(RM) $$($1_TARGET))
endif
$$($1_IMPORT_LIBRARY): $$($1_TARGET)
$$(if $$(CORRECT_FUNCTION_IN_RECIPE_EVALUATION), \
$$(if $$(wildcard $$@), , $$(error $$@ was not created for $$<)) \
)
$(TOUCH) $$@
$1 += $$($1_IMPORT_LIBRARY)
endif
endif

View File

@ -65,10 +65,13 @@ define ProcessMarkdown
endif
endif
$1_$2_OPTIONS := $$(shell $$(GREP) _pandoc-options_: $3/$2 | $$(CUT) -d : -f 2-)
# This does not need to be included in VARDEPS since it's from the actual
# source file. Only run the shell if the recipe gets executed below.
$1_$2_OPTIONS_FROM_SRC = \
$$(shell $$(GREP) _pandoc-options_: $3/$2 | $$(CUT) -d : -f 2-)
ifneq ($$($1_FILTER), )
$1_$2_OPTIONS += --filter $$($1_FILTER)
$1_$2_OPTIONS := --filter $$($1_FILTER)
endif
$1_$2_VARDEPS := $$($1_OPTIONS) $$($1_$2_OPTIONS) $$($1_CSS) \
@ -82,8 +85,8 @@ define ProcessMarkdown
$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
$$(PANDOC) $$($1_OPTIONS) -f $$(PANDOC_MARKDOWN_FLAG) \
-t $$($1_FORMAT) --standalone \
$$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$($1_$2_PANDOC_INPUT)' \
-o '$$($1_$2_PANDOC_OUTPUT)')
$$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS_FROM_SRC) $$($1_$2_OPTIONS) \
'$$($1_$2_PANDOC_INPUT)' -o '$$($1_$2_PANDOC_OUTPUT)')
ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
if [ "x$$$$TOO_LONG_LINES" != x ]; then \

View File

@ -90,8 +90,7 @@ define SetupTestFilesCompilationBody
$$(eval $$(call SetupNativeCompilation, BUILD_TEST_$$(name), \
NAME := $$(unprefixed_name), \
TYPE := $$($1_COMPILATION_TYPE), \
SRC := $$(patsubst %/,%,$$(dir $$(file))), \
INCLUDE_FILES := $$(notdir $$(file)), \
EXTRA_FILES := $$(file), \
OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \
OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
CFLAGS := $$($1_BASE_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \

View File

@ -166,6 +166,9 @@ JVM_OPTIMIZATION ?= HIGHEST_JVM
# default.
JVM_STRIPFLAGS ?= $(STRIPFLAGS)
# This source set is reused so save in cache.
$(eval $(call FillCacheFind, $(JVM_SRC_DIRS)))
################################################################################
# Now set up the actual compilation of the main hotspot native library

View File

@ -41,11 +41,16 @@ TARGETS_EXTRA_LIB :=
ifeq ($(INCLUDE_GRAAL), true)
ifneq ($(GRAALUNIT_LIB), )
SRC_DIR := $(TOPDIR)/src/jdk.internal.vm.compiler/share/classes
TEST_DIR := $(TOPDIR)/test/hotspot/jtreg/compiler/graalunit
COMPILE_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/test/graalunit
LIB_OUTPUTDIR := $(TEST_IMAGE_DIR)/hotspot/jtreg/graal
# This evaluation is expensive and should only be done if this target was
# explicitly called.
ifneq ($(filter build-test-hotspot-jtreg-graal, $(MAKECMDGOALS)), )
TEST_COMPILE_CP := \
$(JDK_OUTPUTDIR)/modules/jdk.internal.vm.compiler \
$(JDK_OUTPUTDIR)/modules/jdk.internal.vm.ci \
@ -150,6 +155,9 @@ ifeq ($(INCLUDE_GRAAL), true)
TARGETS_BUILD += $(BUILD_MXTOOL)
$(TARGETS_BUILD): $(TARGETS_EXTRA_LIB)
endif # build-test-hotspot-jtreg-graal
################################################################################
# Targets for building test-image.
@ -168,7 +176,6 @@ ifeq ($(INCLUDE_GRAAL), true)
endif
endif
$(TARGETS_BUILD): $(TARGETS_EXTRA_LIB)
build-test-hotspot-jtreg-graal: $(TARGETS_BUILD)
test-image-hotspot-jtreg-graal: $(TARGETS_IMAGE)

View File

@ -1513,19 +1513,23 @@ else
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libterminatedThread += -lpthread
endif
$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_LIBRARIES, \
# This evaluation is expensive and should only be done if this target was
# explicitly called.
ifneq ($(filter build-test-hotspot-jtreg-native, $(MAKECMDGOALS)), )
$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_LIBRARIES, \
TYPE := LIBRARY, \
SOURCE_DIRS := $(BUILD_HOTSPOT_JTREG_NATIVE_SRC), \
OUTPUT_DIR := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \
EXCLUDE := $(BUILD_HOTSPOT_JTREG_EXCLUDE), \
))
))
$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_EXECUTABLES, \
$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_EXECUTABLES, \
TYPE := PROGRAM, \
SOURCE_DIRS := $(BUILD_HOTSPOT_JTREG_NATIVE_SRC), \
OUTPUT_DIR := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \
EXCLUDE := $(BUILD_HOTSPOT_JTREG_EXCLUDE), \
))
))
endif
build-test-hotspot-jtreg-native: $(BUILD_HOTSPOT_JTREG_LIBRARIES) $(BUILD_HOTSPOT_JTREG_EXECUTABLES)

View File

@ -82,19 +82,23 @@ else
BUILD_JDK_JTREG_EXCLUDE += exeJniInvocationTest.c
endif
$(eval $(call SetupTestFilesCompilation, BUILD_JDK_JTREG_LIBRARIES, \
# This evaluation is expensive and should only be done if this target was
# explicitly called.
ifneq ($(filter build-test-jdk-jtreg-native, $(MAKECMDGOALS)), )
$(eval $(call SetupTestFilesCompilation, BUILD_JDK_JTREG_LIBRARIES, \
TYPE := LIBRARY, \
SOURCE_DIRS := $(BUILD_JDK_JTREG_NATIVE_SRC), \
OUTPUT_DIR := $(BUILD_JDK_JTREG_OUTPUT_DIR), \
EXCLUDE := $(BUILD_JDK_JTREG_EXCLUDE), \
))
))
$(eval $(call SetupTestFilesCompilation, BUILD_JDK_JTREG_EXECUTABLES, \
$(eval $(call SetupTestFilesCompilation, BUILD_JDK_JTREG_EXECUTABLES, \
TYPE := PROGRAM, \
SOURCE_DIRS := $(BUILD_JDK_JTREG_NATIVE_SRC), \
OUTPUT_DIR := $(BUILD_JDK_JTREG_OUTPUT_DIR), \
EXCLUDE := $(BUILD_JDK_JTREG_EXCLUDE), \
))
))
endif
build-test-jdk-jtreg-native: $(BUILD_JDK_JTREG_LIBRARIES) $(BUILD_JDK_JTREG_EXECUTABLES)