This commit is contained in:
Jayathirth D V 2018-10-16 14:26:22 +05:30
commit eb1b046a1d
866 changed files with 13210 additions and 11938 deletions

View file

@ -515,3 +515,6 @@ f0f5d23449d31f1b3580c8a73313918cafeaefd7 jdk-12+11
15094d12a632f452a2064318a4e416d0c7a9ce0c jdk-12+12 15094d12a632f452a2064318a4e416d0c7a9ce0c jdk-12+12
511a9946f83e3e3c7b9dbe1840367063fb39b4e1 jdk-12+13 511a9946f83e3e3c7b9dbe1840367063fb39b4e1 jdk-12+13
8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14 8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14
8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14
6f04692c7d5137ee34a6bd94c0c8a6c9219cb127 jdk-12+14
f8626bcc169813a4b2a15880386b952719d1d6d1 jdk-12+15

View file

@ -42,7 +42,7 @@ MODULES_SYMBOLS_FILES := $(foreach module, $(EXPORTED_SYMBOLS_MODULES), \
$(GLOBAL_SYMBOLS_FILE): $(MODULES_SYMBOLS_FILES) $(GLOBAL_SYMBOLS_FILE): $(MODULES_SYMBOLS_FILES)
$(call LogInfo, Generating global exported.symbols file) $(call LogInfo, Generating global exported.symbols file)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(CAT) $^ > $@ $(CAT) $^ > $@
TARGETS += $(GLOBAL_SYMBOLS_FILE) TARGETS += $(GLOBAL_SYMBOLS_FILE)

View file

@ -70,6 +70,7 @@ define SetupBundleFileBody
$$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false) $$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
$(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES) $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
$$(call MakeTargetDir)
# If any of the files contain a space in the file name, CacheFind # If any of the files contain a space in the file name, CacheFind
# will have replaced it with ?. Tar does not accept that so need to # will have replaced it with ?. Tar does not accept that so need to
# switch it back. # switch it back.
@ -79,7 +80,6 @@ define SetupBundleFileBody
$$(CAT) $$($1_$$d_LIST_FILE) | $$(TR) '?' ' ' > $$($1_$$d_LIST_FILE).tmp \ $$(CAT) $$($1_$$d_LIST_FILE) | $$(TR) '?' ' ' > $$($1_$$d_LIST_FILE).tmp \
&& $(MV) $$($1_$$d_LIST_FILE).tmp $$($1_$$d_LIST_FILE) $$(NEWLINE) \ && $(MV) $$($1_$$d_LIST_FILE).tmp $$($1_$$d_LIST_FILE) $$(NEWLINE) \
) )
$$(call MakeDir, $$(@D))
ifneq ($$($1_SPECIAL_INCLUDES), ) ifneq ($$($1_SPECIAL_INCLUDES), )
$$(foreach i, $$($1_SPECIAL_INCLUDES), \ $$(foreach i, $$($1_SPECIAL_INCLUDES), \
$$(foreach d, $$($1_BASE_DIRS), \ $$(foreach d, $$($1_BASE_DIRS), \

60
make/CompileCommands.gmk Normal file
View file

@ -0,0 +1,60 @@
#
# Copyright (c) 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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.
#
default: all
include $(SPEC)
include MakeBase.gmk
# When FIXPATH is set, let it process the file to make sure all paths are usable
# by system native tools. The FIXPATH tool assumes arguments preceeded by an @
# character points to a text file containing further arguments (similar to a
# linker). It replaces any such arguments with a different temporary filename,
# whose contents has been processed to make any paths native. To obtain a
# properly processed compile_commands.json, FIXPATH is then made to invoke an
# AWK script with the unprocessed json file as the only argument, prepended with
# an @ character. The AWK script simply copies the contents of this processed
# file.
#
# The sed command encloses the fragments inside brackets and removes the final
# trailing comma.
$(OUTPUTDIR)/compile_commands.json: $(wildcard $(MAKESUPPORT_OUTPUTDIR)/compile-commands/*.json)
$(call LogWarn, Updating compile_commands.json)
$(RM) $@
$(FIND) $(MAKESUPPORT_OUTPUTDIR)/compile-commands/ -name \*.json | \
$(SORT) | $(XARGS) $(CAT) >> $@.tmp
$(if $(FIXPATH),$(FIXPATH) $(AWK) 'BEGIN { \
tmpfile = substr(ARGV[2],2); \
cmd = "$(CP) " "\047" tmpfile "\047" " $@.tmp"; \
system(cmd); \
}' -- @$@.tmp)
$(SED) -e '1s/^/[\$(NEWLINE)/' -e '$(DOLLAR)s/,\s\{0,\}$(DOLLAR)/\$(NEWLINE)]/' $@.tmp > $@
$(RM) $@.tmp
TARGETS += $(OUTPUTDIR)/compile_commands.json
all: $(TARGETS)
.PHONY: all

View file

@ -33,7 +33,7 @@ include MakeBase.gmk
### CLDRConverter needs the JRE time zone names from the java.base source. ### CLDRConverter needs the JRE time zone names from the java.base source.
define cldrconverter_copytznames define cldrconverter_copytznames
$(MKDIR) -p '$(@D)' $(call MakeTargetDir)
$(RM) '$@' $(RM) '$@'
$(SED) -e "s/package sun.util.resources/package build.tools.cldrconverter/" \ $(SED) -e "s/package sun.util.resources/package build.tools.cldrconverter/" \
-e "s/extends TimeZoneNamesBundle//" \ -e "s/extends TimeZoneNamesBundle//" \
@ -46,7 +46,7 @@ $(eval $(call SetupCopyFiles,COPY_INTERIM_CLDRCONVERTER, \
DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes/build/tools/cldrconverter, \ DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes/build/tools/cldrconverter, \
FILES := TimeZoneNames.java, \ FILES := TimeZoneNames.java, \
MACRO := cldrconverter_copytznames)) MACRO := cldrconverter_copytznames))
########################################################################################## ##########################################################################################
all: $(COPY_INTERIM_CLDRCONVERTER) all: $(COPY_INTERIM_CLDRCONVERTER)

View file

@ -41,7 +41,7 @@ COPY_CLASSES_TARGET := $(BUILDJDK_OUTPUTDIR)/jdk/modules/java.base/_the.buildjdk
$(COPY_CLASSES_TARGET): $(call CacheFind, $(wildcard \ $(COPY_CLASSES_TARGET): $(call CacheFind, $(wildcard \
$(addprefix $(JDK_OUTPUTDIR)/modules/, $(MODULES_TO_COPY)))) $(addprefix $(JDK_OUTPUTDIR)/modules/, $(MODULES_TO_COPY))))
$(ECHO) $(LOG_INFO) "Copying java modules to buildjdk: $(MODULES_TO_COPY)" $(call LogInfo, Copying java modules to buildjdk: $(MODULES_TO_COPY))
$(RM) -r $(BUILDJDK_OUTPUTDIR)/jdk/modules $(RM) -r $(BUILDJDK_OUTPUTDIR)/jdk/modules
$(MKDIR) -p $(BUILDJDK_OUTPUTDIR)/jdk/modules $(MKDIR) -p $(BUILDJDK_OUTPUTDIR)/jdk/modules
$(foreach m, $(MODULES_TO_COPY), \ $(foreach m, $(MODULES_TO_COPY), \

View file

@ -35,18 +35,18 @@ SPEC_DOTFILES_DIR := $(GENGRAPHS_DIR)/spec-dotfiles
TOOLS_MODULE_SRCDIR := $(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw TOOLS_MODULE_SRCDIR := $(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw
$(GENGRAPHS_DIR)/jdk.dot: $(BUILD_JIGSAW_TOOLS) $(GENGRAPHS_DIR)/jdk.dot: $(BUILD_JIGSAW_TOOLS)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(TOOL_GENGRAPHS) --output $(GENGRAPHS_DIR) $(TOOL_GENGRAPHS) --output $(GENGRAPHS_DIR)
$(SPEC_DOTFILES_DIR)/java.se.dot: $(BUILD_JIGSAW_TOOLS) $(SPEC_DOTFILES_DIR)/java.se.dot: $(BUILD_JIGSAW_TOOLS)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(TOOL_GENGRAPHS) --spec --output $(SPEC_DOTFILES_DIR) $(TOOL_GENGRAPHS) --spec --output $(SPEC_DOTFILES_DIR)
$(GENGRAPHS_DIR)/technology-summary.html: $(TOOLS_MODULE_SRCDIR)/technology-summary.html $(GENGRAPHS_DIR)/technology-summary.html: $(TOOLS_MODULE_SRCDIR)/technology-summary.html
$(install-file) $(install-file)
$(GENGRAPHS_DIR)/module-summary.html: $(BUILD_JIGSAW_TOOLS) $(GENGRAPHS_DIR)/technology-summary.html $(GENGRAPHS_DIR)/module-summary.html: $(BUILD_JIGSAW_TOOLS) $(GENGRAPHS_DIR)/technology-summary.html
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(TOOL_MODULESUMMARY) -o $@ --module-path $(IMAGES_OUTPUTDIR)/jmods $(TOOL_MODULESUMMARY) -o $@ --module-path $(IMAGES_OUTPUTDIR)/jmods
all: $(GENGRAPHS_DIR)/jdk.dot $(GENGRAPHS_DIR)/module-summary.html $(SPEC_DOTFILES_DIR)/java.se.dot all: $(GENGRAPHS_DIR)/jdk.dot $(GENGRAPHS_DIR)/module-summary.html $(SPEC_DOTFILES_DIR)/java.se.dot

View file

@ -79,7 +79,7 @@ ifneq ($(MOD_FILES), )
$(BUILD_TOOLS_JDK) \ $(BUILD_TOOLS_JDK) \
$(MOD_FILES) \ $(MOD_FILES) \
$(call DependOnVariable, ALL_MODULES) $(call DependOnVariable, ALL_MODULES)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $@.tmp $(RM) $@ $@.tmp
$(TOOL_GENMODULEINFOSOURCE) -o $@.tmp \ $(TOOL_GENMODULEINFOSOURCE) -o $@.tmp \
--source-file $< \ --source-file $< \

View file

@ -119,7 +119,7 @@ print-configurations:
run-test-prebuilt: run-test-prebuilt:
@( cd $(topdir) && \ @( cd $(topdir) && \
$(MAKE) --no-print-directory -r -R -I make/common/ -f make/RunTestsPrebuilt.gmk \ $(MAKE) --no-print-directory -r -R -I make/common/ -f make/RunTestsPrebuilt.gmk \
run-test-prebuilt TEST="$(TEST)" ) run-test-prebuilt CUSTOM_MAKE_DIR=$(CUSTOM_MAKE_DIR) TEST="$(TEST)" )
ALL_GLOBAL_TARGETS := help print-configurations run-test-prebuilt ALL_GLOBAL_TARGETS := help print-configurations run-test-prebuilt

View file

@ -90,24 +90,32 @@ endif
$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \ $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
$(call DependOnVariable, JDK_MODULES_LIST) $(BASE_RELEASE_FILE) $(call DependOnVariable, JDK_MODULES_LIST) $(BASE_RELEASE_FILE)
$(ECHO) Creating jdk image $(call LogWarn, Creating jdk image)
$(RM) -r $(JDK_IMAGE_DIR) $(RM) -r $(JDK_IMAGE_DIR)
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jdk, \ $(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jdk, \
$(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \ $(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
$(JLINK_JDK_EXTRA_OPTS) \ $(JLINK_JDK_EXTRA_OPTS) \
--output $(JDK_IMAGE_DIR) \ --output $(JDK_IMAGE_DIR) \
) )
ifeq ($(BUILD_CDS_ARCHIVE), true)
$(call LogWarn, Creating CDS archive for jdk image)
$(JDK_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
endif
$(TOUCH) $@ $(TOUCH) $@
$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \ $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
$(call DependOnVariable, JRE_MODULES_LIST) $(BASE_RELEASE_FILE) $(call DependOnVariable, JRE_MODULES_LIST) $(BASE_RELEASE_FILE)
$(ECHO) Creating legacy jre image $(call LogWarn, Creating legacy jre image)
$(RM) -r $(JRE_IMAGE_DIR) $(RM) -r $(JRE_IMAGE_DIR)
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jre, \ $(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jre, \
$(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \ $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
$(JLINK_JRE_EXTRA_OPTS) \ $(JLINK_JRE_EXTRA_OPTS) \
--output $(JRE_IMAGE_DIR) \ --output $(JRE_IMAGE_DIR) \
) )
ifeq ($(BUILD_CDS_ARCHIVE), true)
$(call LogWarn, Creating CDS archive for jre image)
$(JRE_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
endif
$(TOUCH) $@ $(TOUCH) $@
TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE) TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)

View file

@ -63,13 +63,13 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
$(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib: $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
$(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@)) $(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $(RM) $@
$(LN) -s ../Home/lib/libjli.dylib $@ $(LN) -s ../Home/lib/libjli.dylib $@
$(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib: $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
$(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@)) $(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $(RM) $@
$(LN) -s ../Home/lib/libjli.dylib $@ $(LN) -s ../Home/lib/libjli.dylib $@

View file

@ -262,6 +262,31 @@ hotspot-ide-project:
ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \ ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
$(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-ide-project $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-ide-project
################################################################################
# Generate libs and launcher targets for creating compile_commands.json fragments
define DeclareCompileCommandsRecipe
$1-compile-commands:
$$(call LogInfo, Generating compile_commands.json fragments for $1)
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Main.gmk $1-only \
GENERATE_COMPILE_COMMANDS_ONLY=true)
COMPILE_COMMANDS_TARGETS_$2 += $1-compile-commands
endef
$(foreach t, $(HOTSPOT_VARIANT_LIBS_TARGETS), \
$(eval $(call DeclareCompileCommandsRecipe,$t,HOTSPOT)) \
)
$(foreach t, $(LIBS_TARGETS) $(LAUNCHER_TARGETS), \
$(eval $(call DeclareCompileCommandsRecipe,$t,JDK)) \
)
compile-commands compile-commands-hotspot:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileCommands.gmk)
ALL_TARGETS += $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
ALL_TARGETS += compile-commands compile-commands-hotspot
################################################################################ ################################################################################
# Build demos targets # Build demos targets
@ -559,8 +584,12 @@ test-jdk-jtreg-native:
test-make: test-make:
($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET)) ($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
test-compile-commands:
($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk test-compile-commands)
ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \ ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \
test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make \
test-compile-commands
################################################################################ ################################################################################
# Bundles # Bundles
@ -735,6 +764,20 @@ else
$(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS))) $(foreach m, $(ALL_MODULES), $(eval $m-jmod: $($(m)_JMOD_DEPS)))
$(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS))) $(foreach m, $(INTERIM_IMAGE_MODULES), $(eval $m-interim-jmod: $($(m)_JMOD_DEPS)))
# Setup the minimal set of generated native source dependencies for hotspot
$(foreach v, $(JVM_VARIANTS), \
$(eval hotspot-$v-libs-compile-commands: hotspot-$v-gensrc) \
$(foreach m, $(filter java.desktop jdk.hotspot.agent, $(GENSRC_MODULES)), \
$(eval hotspot-$v-libs-compile-commands: $m-gensrc)) \
)
# For the full JDK compile commands, create all possible generated sources
$(foreach m, $(GENSRC_MODULES), $(eval $m-libs-compile-commands: $m-gensrc))
$(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs-compile-commands: $m-java))
compile-commands-hotspot: $(COMPILE_COMMANDS_TARGETS_HOTSPOT)
compile-commands: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
# Jmods cannot be created until we have the jmod tool ready to run. During # Jmods cannot be created until we have the jmod tool ready to run. During
# a normal build we run it from the exploded image, but when cross compiling # a normal build we run it from the exploded image, but when cross compiling
# it's run from the buildjdk, which is either created at build time or user # it's run from the buildjdk, which is either created at build time or user
@ -849,6 +892,8 @@ else
test-make: clean-test-make test-make: clean-test-make
test-compile-commands: compile-commands
build-test-lib: exploded-image-optimize build-test-lib: exploded-image-optimize
build-test-failure-handler: interim-langtools build-test-failure-handler: interim-langtools
@ -1071,7 +1116,7 @@ CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
# Remove everything, except the output from configure. # Remove everything, except the output from configure.
clean: $(CLEAN_DIR_TARGETS) clean: $(CLEAN_DIR_TARGETS)
($(CD) $(OUTPUTDIR) && $(RM) -r build*.log*) ($(CD) $(OUTPUTDIR) && $(RM) -r build*.log* compile_commands.json)
$(ECHO) Cleaned all build artifacts. $(ECHO) Cleaned all build artifacts.
clean-docs: clean-docs:

View file

@ -100,5 +100,9 @@ $(eval $(call SetupCopyFiles, COPY_CONF, \
$(TARGETS)), \ $(TARGETS)), \
)) ))
all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \ ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
$(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF) $(LINK_LIBS_TO_LIB) all: $(filter $(MAKESUPPORT_OUTPUTDIR)/compile-commands/%, $(TARGETS))
else
all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
$(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
endif

View file

@ -45,8 +45,8 @@ ifneq ($(TEST_VM_OPTS), )
endif endif
$(eval $(call ParseKeywordVariable, TEST_OPTS, \ $(eval $(call ParseKeywordVariable, TEST_OPTS, \
KEYWORDS := JOBS TIMEOUT, \ SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR, \
STRING_KEYWORDS := VM_OPTIONS, \ STRING_KEYWORDS := VM_OPTIONS JAVA_OPTIONS, \
)) ))
# Helper function to propagate TEST_OPTS values. # Helper function to propagate TEST_OPTS values.
@ -103,6 +103,31 @@ endif
GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher)) GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher))
GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS))) GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS)))
################################################################################
# Setup global test running parameters
################################################################################
# Each factor variable comes in 3 variants. The first one is reserved for users
# to use on command line. The other two are for predifined configurations in JDL
# and for machine specific configurations respectively.
TEST_JOBS_FACTOR ?= 1
TEST_JOBS_FACTOR_JDL ?= 1
TEST_JOBS_FACTOR_MACHINE ?= 1
ifeq ($(TEST_JOBS), 0)
# Concurrency based on min(cores / 2, 12) * TEST_JOBS_FACTOR
TEST_JOBS := $(shell $(AWK) \
'BEGIN { \
c = $(NUM_CORES) / 2; \
if (c > 12) c = 12; \
c = c * $(TEST_JOBS_FACTOR); \
c = c * $(TEST_JOBS_FACTOR_JDL); \
c = c * $(TEST_JOBS_FACTOR_MACHINE); \
if (c < 1) c = 1; \
printf "%.0f", c; \
}')
endif
################################################################################ ################################################################################
# Parse control variables # Parse control variables
################################################################################ ################################################################################
@ -110,16 +135,19 @@ GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTE
ifneq ($(TEST_OPTS), ) ifneq ($(TEST_OPTS), )
# Inform the user # Inform the user
$(info Running tests using TEST_OPTS control variable '$(TEST_OPTS)') $(info Running tests using TEST_OPTS control variable '$(TEST_OPTS)')
$(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
$(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
$(eval $(call SetTestOpt,JOBS,JTREG))
$(eval $(call SetTestOpt,TIMEOUT,JTREG))
endif endif
$(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
$(eval $(call SetTestOpt,JAVA_OPTIONS,JTREG))
$(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
$(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
$(eval $(call SetTestOpt,JOBS,JTREG))
$(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
$(eval $(call ParseKeywordVariable, JTREG, \ $(eval $(call ParseKeywordVariable, JTREG, \
KEYWORDS := JOBS TIMEOUT TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM, \ SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM \
EXTRA_PROBLEM_LISTS KEYWORDS, \
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \ STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \
)) ))
@ -129,8 +157,8 @@ ifneq ($(JTREG), )
endif endif
$(eval $(call ParseKeywordVariable, GTEST, \ $(eval $(call ParseKeywordVariable, GTEST, \
KEYWORDS := REPEAT, \ SINGLE_KEYWORDS := REPEAT, \
STRING_KEYWORDS := OPTIONS VM_OPTIONS, \ STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS, \
)) ))
ifneq ($(GTEST), ) ifneq ($(GTEST), )
@ -143,17 +171,6 @@ endif
# Component-specific Jtreg settings # Component-specific Jtreg settings
################################################################################ ################################################################################
ifeq ($(TEST_JOBS), 0)
# If TEST_JOBS is not specified, hotspot fallback default is
# min(num_cores / 2, 12).
hotspot_JTREG_JOBS := $(shell $(EXPR) $(NUM_CORES) / 2)
ifeq ($(hotspot_JTREG_JOBS), 0)
hotspot_JTREG_JOBS := 1
else ifeq ($(shell $(EXPR) $(hotspot_JTREG_JOBS) \> 12), 1)
hotspot_JTREG_JOBS := 12
endif
endif
hotspot_JTREG_MAX_MEM := 0 hotspot_JTREG_MAX_MEM := 0
hotspot_JTREG_ASSERT := false hotspot_JTREG_ASSERT := false
hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native
@ -165,6 +182,8 @@ langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt
nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt
hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
langtools_JTREG_MAX_MEM := 768m
################################################################################ ################################################################################
# Parse test selection # Parse test selection
# #
@ -368,15 +387,16 @@ define SetupRunGtestTestBody
$1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT) $1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT)
endif endif
run-test-$1: run-test-$1: $(TEST_PREREQS)
$$(call LogWarn) $$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)') $$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \ $$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \
$$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \ $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
-jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \ -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
--gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \ --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
$$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \ $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
$$($1_GTEST_JAVA_OPTIONS) \
> >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \ > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \ && $$(ECHO) $$$$? > $$($1_EXITCODE) \
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \ || $$(ECHO) $$$$? > $$($1_EXITCODE) \
@ -447,12 +467,11 @@ define SetupRunJtregTestBody
$1_TEST_NAME := $$(strip $$(patsubst jtreg:%, %, $$($1_TEST))) $1_TEST_NAME := $$(strip $$(patsubst jtreg:%, %, $$($1_TEST)))
$1_COMPONENT := \ $1_TEST_ROOT := \
$$(strip $$(foreach root, $$(JTREG_TESTROOTS), \ $$(strip $$(foreach root, $$(JTREG_TESTROOTS), \
$$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), \ $$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), $$(root)) \
$$(lastword $$(subst /, $$(SPACE), $$(root))) \
) \
)) ))
$1_COMPONENT := $$(lastword $$(subst /, $$(SPACE), $$($1_TEST_ROOT)))
# This will work only as long as just hotspot has the additional "jtreg" directory # This will work only as long as just hotspot has the additional "jtreg" directory
ifeq ($$($1_COMPONENT), jtreg) ifeq ($$($1_COMPONENT), jtreg)
$1_COMPONENT := hotspot $1_COMPONENT := hotspot
@ -475,11 +494,12 @@ define SetupRunJtregTestBody
$$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS)) $$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
$$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST)) $$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
# Only the problem list for the current test root should be used.
$1_JTREG_PROBLEM_LIST := $$(filter $$($1_TEST_ROOT)%, $$($1_JTREG_PROBLEM_LIST))
ifneq ($(TEST_JOBS), 0) ifneq ($(TEST_JOBS), 0)
# User has specified TEST_JOBS, use that as fallback default
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS))) $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS)))
else else
# Use JOBS as default (except for hotspot)
$$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS))) $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
endif endif
@ -487,7 +507,7 @@ define SetupRunJtregTestBody
# we may end up with a lot of JVM's # we may end up with a lot of JVM's
$1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS)) $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS))
JTREG_TIMEOUT ?= 4 JTREG_TIMEOUT_FACTOR ?= 4
JTREG_VERBOSE ?= fail,error,summary JTREG_VERBOSE ?= fail,error,summary
JTREG_RETAIN ?= fail,error JTREG_RETAIN ?= fail,error
@ -498,10 +518,10 @@ define SetupRunJtregTestBody
$1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \ $1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
-verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \ -verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
-concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT) \ -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT_FACTOR) \
-vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE) -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
$1_JTREG_BASIC_OPTIONS += -automatic -keywords:\!ignore -ignore:quiet $1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet
# Make it possible to specify the JIB_DATA_DIR for tests using the # Make it possible to specify the JIB_DATA_DIR for tests using the
# JIB Artifact resolver # JIB Artifact resolver
@ -531,6 +551,14 @@ define SetupRunJtregTestBody
$1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$($1_JTREG_PROBLEM_LIST)) $1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$($1_JTREG_PROBLEM_LIST))
endif endif
ifneq ($$(JTREG_EXTRA_PROBLEM_LISTS), )
# Accept both absolute paths as well as relative to the current test root.
$1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$(wildcard \
$$(JTREG_EXTRA_PROBLEM_LISTS) \
$$(addprefix $$($1_TEST_ROOT)/, $$(JTREG_EXTRA_PROBLEM_LISTS)) \
))
endif
ifneq ($$(JIB_HOME), ) ifneq ($$(JIB_HOME), )
$1_JTREG_BASIC_OPTIONS += -e:JIB_HOME=$$(JIB_HOME) $1_JTREG_BASIC_OPTIONS += -e:JIB_HOME=$$(JIB_HOME)
endif endif
@ -541,10 +569,21 @@ define SetupRunJtregTestBody
$1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)" $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
endif endif
ifneq ($$(JTREG_KEYWORDS), )
# The keywords string may contain problematic characters and may be quoted
# already when it arrives here. Remove any existing quotes and replace them
# with one set of single quotes.
$1_JTREG_KEYWORDS := \
$$(strip $$(subst $$(SQUOTE),,$$(subst $$(DQUOTE),,$$(JTREG_KEYWORDS))))
ifneq ($$($1_JTREG_KEYWORDS), )
$1_JTREG_BASIC_OPTIONS += -k:'$$($1_JTREG_KEYWORDS)'
endif
endif
clean-workdir-$1: clean-workdir-$1:
$$(RM) -r $$($1_TEST_SUPPORT_DIR) $$(RM) -r $$($1_TEST_SUPPORT_DIR)
run-test-$1: clean-workdir-$1 run-test-$1: clean-workdir-$1 $(TEST_PREREQS)
$$(call LogWarn) $$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)') $$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
@ -631,7 +670,7 @@ define SetupRunSpecialTestBody
$$(error Invalid special test specification: $$($1_TEST_NAME)) $$(error Invalid special test specification: $$($1_TEST_NAME))
endif endif
run-test-$1: run-test-$1: $(TEST_PREREQS)
$$(call LogWarn) $$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)') $$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))

View file

@ -49,10 +49,11 @@ TOPDIR := $(strip $(patsubst %/make/, %, $(dir $(makefile_path))))
# given. # given.
# Note: No spaces are allowed around the arguments. # Note: No spaces are allowed around the arguments.
# #
# $1: The name of the argument # $1: The name of the variable
# $2: The default value, if any, or OPTIONAL (do not provide a default but # $2: The default value, if any, or OPTIONAL (do not provide a default but
# do not exit if it is missing) # do not exit if it is missing)
# $3: If NO_CHECK, disable checking for target file/directory existence # $3: If NO_CHECK, disable checking for target file/directory existence
# If MKDIR, create the default directory
define SetupVariable define SetupVariable
ifeq ($$($1), ) ifeq ($$($1), )
ifeq ($2, ) ifeq ($2, )
@ -75,10 +76,17 @@ define SetupVariable
endif endif
# If $1 has a value (is not optional), and $3 is not set (to NO_CHECK), # If $1 has a value (is not optional), and $3 is not set (to NO_CHECK),
# and if wildcard is empty, then complain that the file is missing. # and if wildcard is empty, then complain that the file is missing.
ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1)) $3), ) ifeq ($3, MKDIR)
$$(info Error: Prebuilt variable $1 points to missing file/directory:) ifneq ($$(findstring $$(LOG), info debug trace), )
$$(info '$$($1)') $$(info Creating directory for $1)
$$(error Cannot continue.) endif
$$(shell mkdir -p $$($1))
else ifneq ($3, NO_CHECK)
ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1))), )
$$(info Error: Prebuilt variable $1 points to missing file/directory:)
$$(info '$$($1)')
$$(error Cannot continue.)
endif
endif endif
endef endef
@ -106,14 +114,14 @@ endef
# Verify that user has given correct additional input. # Verify that user has given correct additional input.
# These variables are absolutely necessary # These variables are absolutely necessary
$(eval $(call SetupVariable,OUTPUTDIR)) $(eval $(call SetupVariable,OUTPUTDIR,$(TOPDIR)/build/run-test-prebuilt,MKDIR))
$(eval $(call SetupVariable,BOOT_JDK)) $(eval $(call SetupVariable,BOOT_JDK))
$(eval $(call SetupVariable,JT_HOME)) $(eval $(call SetupVariable,JT_HOME))
# These can have default values based on the ones above # These can have default values based on the ones above
$(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk)) $(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
$(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test)) $(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))
$(eval $(call SetupVariable,SYMBOLS_IMAGE_DIR,$(OUTPUTDIR)/images/symbols)) $(eval $(call SetupVariable,SYMBOLS_IMAGE_DIR,$(OUTPUTDIR)/images/symbols,NO_CHECK))
# Provide default values for tools that we need # Provide default values for tools that we need
$(eval $(call SetupVariable,MAKE,make,NO_CHECK)) $(eval $(call SetupVariable,MAKE,make,NO_CHECK))
@ -202,8 +210,8 @@ endif
ifeq ($(OPENJDK_TARGET_OS), windows) ifeq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(wildcard $(TEST_IMAGE_DIR)/bin/fixpath.exe), ) ifeq ($(wildcard $(TEST_IMAGE_DIR)/bin/fixpath.exe), )
$$(info Error: fixpath is missing from test image '$(TEST_IMAGE_DIR)') $(info Error: fixpath is missing from test image '$(TEST_IMAGE_DIR)')
$$(error Cannot continue.) $(error Cannot continue.)
endif endif
FIXPATH := $(TEST_IMAGE_DIR)/bin/fixpath.exe -c FIXPATH := $(TEST_IMAGE_DIR)/bin/fixpath.exe -c
PATH_SEP:=; PATH_SEP:=;
@ -214,15 +222,17 @@ endif
# Check number of cores # Check number of cores
ifeq ($(OPENJDK_TARGET_OS), linux) ifeq ($(OPENJDK_TARGET_OS), linux)
NUM_CORES := $(shell $(CAT) /proc/cpuinfo | $(GREP) -c processor) NUM_CORES := $(shell $(CAT) /proc/cpuinfo | $(GREP) -c processor)
else ifeq ($(OPENJDK_TARGET_OS), macosx) else ifeq ($(OPENJDK_TARGET_OS), macosx)
NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu) NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
else ifeq ($(OPENJDK_TARGET_OS), solaris) else ifeq ($(OPENJDK_TARGET_OS), solaris)
NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | $(GREP) -c on-line) NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | $(GREP) -c on-line)
else ifeq ($(OPENJDK_TARGET_OS), windows) else ifeq ($(OPENJDK_TARGET_OS), windows)
NUM_CORES := $(NUMBER_OF_PROCESSORS) NUM_CORES := $(NUMBER_OF_PROCESSORS)
else endif
NUM_CORES := 1 ifeq ($(NUM_CORES), )
$(warn Could not find number of CPUs, assuming 1)
NUM_CORES := 1
endif endif
################################################################################ ################################################################################
@ -276,9 +286,6 @@ run-test-prebuilt:
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error @$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error
@cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/RunTests.gmk run-test \ @cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/RunTests.gmk run-test \
TEST="$(TEST)" TEST="$(TEST)"
@if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
exit 1 ; \
fi
all: run-test-prebuilt all: run-test-prebuilt

View file

@ -124,7 +124,7 @@ JLINK := $(FIXPATH) $(JLINK_CMD)
JMOD := $(FIXPATH) $(JMOD_CMD) JMOD := $(FIXPATH) $(JMOD_CMD)
JARSIGNER := $(FIXPATH) $(JARSIGNER_CMD) JARSIGNER := $(FIXPATH) $(JARSIGNER_CMD)
BUILD_JAVA := $(JAVA) BUILD_JAVA := $(JDK_IMAGE_DIR)/bin/JAVA
################################################################################ ################################################################################
# Some common tools. Assume most common name and no path. # Some common tools. Assume most common name and no path.
AWK := awk AWK := awk
@ -172,3 +172,13 @@ UNZIP := unzip
EXPR := expr EXPR := expr
FILE := file FILE := file
HG := hg HG := hg
# On Solaris gnu versions of some tools are required.
ifeq ($(OPENJDK_BUILD_OS), solaris)
AWK := gawk
GREP := ggrep
EGREP := ggrep -E
FGREP := grep -F
SED := gsed
TAR := gtar
endif

View file

@ -569,7 +569,8 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
BASIC_REQUIRE_PROGS(GZIP, pigz gzip) BASIC_REQUIRE_PROGS(GZIP, pigz gzip)
BASIC_REQUIRE_PROGS(LN, ln) BASIC_REQUIRE_PROGS(LN, ln)
BASIC_REQUIRE_PROGS(LS, ls) BASIC_REQUIRE_PROGS(LS, ls)
BASIC_REQUIRE_PROGS(MKDIR, mkdir) # gmkdir is known to be safe for concurrent invocations with -p flag.
BASIC_REQUIRE_PROGS(MKDIR, [gmkdir mkdir])
BASIC_REQUIRE_PROGS(MKTEMP, mktemp) BASIC_REQUIRE_PROGS(MKTEMP, mktemp)
BASIC_REQUIRE_PROGS(MV, mv) BASIC_REQUIRE_PROGS(MV, mv)
BASIC_REQUIRE_PROGS(NAWK, [nawk gawk awk]) BASIC_REQUIRE_PROGS(NAWK, [nawk gawk awk])

View file

@ -233,6 +233,7 @@ JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER
JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
JDKOPT_EXCLUDE_TRANSLATIONS JDKOPT_EXCLUDE_TRANSLATIONS
JDKOPT_ENABLE_DISABLE_MANPAGES JDKOPT_ENABLE_DISABLE_MANPAGES
JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE
############################################################################### ###############################################################################
# #

View file

@ -252,14 +252,6 @@ AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_CDS],
AC_MSG_ERROR([Invalid value for --enable-cds: $enable_cds]) AC_MSG_ERROR([Invalid value for --enable-cds: $enable_cds])
fi fi
# Disable CDS on AIX.
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
ENABLE_CDS="false"
if test "x$enable_cds" = "xyes"; then
AC_MSG_ERROR([CDS is currently not supported on AIX. Remove --enable-cds.])
fi
fi
AC_SUBST(ENABLE_CDS) AC_SUBST(ENABLE_CDS)
]) ])
@ -489,6 +481,34 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
# All variants but minimal (and custom) get these features # All variants but minimal (and custom) get these features
NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cmsgc g1gc parallelgc serialgc epsilongc jni-check jvmti management nmt services vm-structs" NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cmsgc g1gc parallelgc serialgc epsilongc jni-check jvmti management nmt services vm-structs"
# Disable CDS on AIX.
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
ENABLE_CDS="false"
if test "x$enable_cds" = "xyes"; then
AC_MSG_ERROR([CDS is currently not supported on AIX. Remove --enable-cds.])
fi
fi
# Disable CDS if user requested it with --with-jvm-features=-cds.
DISABLE_CDS=`$ECHO $DISABLED_JVM_FEATURES | $GREP cds`
if test "x$DISABLE_CDS" = "xcds"; then
ENABLE_CDS="false"
if test "x$enable_cds" = "xyes"; then
AC_MSG_ERROR([CDS was disabled by --with-jvm-features=-cds. Remove --enable-cds.])
fi
fi
# Disable CDS for zero, minimal, core..
if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(minimal) || HOTSPOT_CHECK_JVM_VARIANT(core); then
# ..except when the user explicitely requested it with --enable-jvm-features
if ! HOTSPOT_CHECK_JVM_FEATURE(cds); then
ENABLE_CDS="false"
if test "x$enable_cds" = "xyes"; then
AC_MSG_ERROR([CDS not implemented for variants zero, minimal, core. Remove --enable-cds.])
fi
fi
fi
AC_MSG_CHECKING([if cds should be enabled]) AC_MSG_CHECKING([if cds should be enabled])
if test "x$ENABLE_CDS" = "xtrue"; then if test "x$ENABLE_CDS" = "xtrue"; then
if test "x$enable_cds" = "xyes"; then if test "x$enable_cds" = "xyes"; then

View file

@ -527,7 +527,7 @@ AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST],
# Check if it's likely that it's possible to generate the classlist. Depending # Check if it's likely that it's possible to generate the classlist. Depending
# on exact jvm configuration it could be possible anyway. # on exact jvm configuration it could be possible anyway.
if test "x$ENABLE_CDS" = "xtrue" && (HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client)); then if test "x$ENABLE_CDS" = "xtrue" && (HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client) || HOTSPOT_CHECK_JVM_FEATURE(cds)); then
ENABLE_GENERATE_CLASSLIST_POSSIBLE="true" ENABLE_GENERATE_CLASSLIST_POSSIBLE="true"
else else
ENABLE_GENERATE_CLASSLIST_POSSIBLE="false" ENABLE_GENERATE_CLASSLIST_POSSIBLE="false"
@ -605,3 +605,37 @@ AC_DEFUN([JDKOPT_ENABLE_DISABLE_MANPAGES],
AC_SUBST(BUILD_MANPAGES) AC_SUBST(BUILD_MANPAGES)
]) ])
################################################################################
#
# Disable the default CDS archive generation
# cross compilation - disabled
#
AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
[
AC_ARG_ENABLE([cds-archive], [AS_HELP_STRING([--disable-cds-archive],
[Set to disable generation of a default CDS archive in the product image @<:@enabled@:>@])])
AC_MSG_CHECKING([if a default CDS archive should be generated])
if test "x$ENABLE_CDS" = "xfalse"; then
AC_MSG_RESULT([no, because CDS is disabled])
BUILD_CDS_ARCHIVE="false"
elif test "x$COMPILE_TYPE" = "xcross"; then
AC_MSG_RESULT([no, not possible with cross compilation])
BUILD_CDS_ARCHIVE="false"
elif test "x$enable_cds_archive" = "xyes"; then
AC_MSG_RESULT([yes, forced])
BUILD_CDS_ARCHIVE="true"
elif test "x$enable_cds_archive" = "x"; then
AC_MSG_RESULT([yes])
BUILD_CDS_ARCHIVE="true"
elif test "x$enable_cds_archive" = "xno"; then
AC_MSG_RESULT([no, forced])
BUILD_CDS_ARCHIVE="false"
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([--enable-cds_archive can only be yes/no or empty])
fi
AC_SUBST(BUILD_CDS_ARCHIVE)
])

View file

@ -309,6 +309,8 @@ EXCLUDE_TRANSLATIONS := @EXCLUDE_TRANSLATIONS@
BUILD_MANPAGES := @BUILD_MANPAGES@ BUILD_MANPAGES := @BUILD_MANPAGES@
BUILD_CDS_ARCHIVE := @BUILD_CDS_ARCHIVE@
# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep # The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
# it in sync. # it in sync.
BOOT_JDK:=@BOOT_JDK@ BOOT_JDK:=@BOOT_JDK@

View file

@ -235,7 +235,7 @@ define SetupJarArchiveBody
# Here is the rule that creates/updates the jar file. # Here is the rule that creates/updates the jar file.
$$($1_JAR) : $$($1_DEPENDENCIES) $$($1_MANIFEST) $$($1_VARDEPS_FILE) $$($1_JAR) : $$($1_DEPENDENCIES) $$($1_MANIFEST) $$($1_VARDEPS_FILE)
$(MKDIR) -p $$($1_BIN) $$(call MakeTargetDir)
$$($1_GREP_INCLUDE_OUTPUT) $$($1_GREP_INCLUDE_OUTPUT)
$$($1_GREP_EXCLUDE_OUTPUT) $$($1_GREP_EXCLUDE_OUTPUT)
# If the vardeps file is part of the newer prereq list, it means that # If the vardeps file is part of the newer prereq list, it means that

View file

@ -76,8 +76,8 @@ define add_file_to_copy
$1_COPY_$$($2_TARGET) := 1 $1_COPY_$$($2_TARGET) := 1
# Now we can setup the dependency that will trigger the copying. # Now we can setup the dependency that will trigger the copying.
$$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2 $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
$(MKDIR) -p $$(@D) $$(call LogInfo, Copying $$(patsubst $(OUTPUTDIR)/%,%, $$@))
$(CP) $$< $$@ $$(install-file)
$(CHMOD) -f ug+w $$@ $(CHMOD) -f ug+w $$@
# And do not forget this target # And do not forget this target
@ -120,7 +120,8 @@ define add_file_to_clean
ifneq ($$($1_CLEAN_$$($2_TARGET)), 1) ifneq ($$($1_CLEAN_$$($2_TARGET)), 1)
$1_CLEAN_$$($2_TARGET) := 1 $1_CLEAN_$$($2_TARGET) := 1
$$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2 $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2
$(MKDIR) -p $$(@D) $$(call LogInfo, Cleaning $$(patsubst $(OUTPUTDIR)/%,%, $$@))
$$(call MakeTargetDir)
export LC_ALL=C ; ( $(CAT) $$< && $(ECHO) "" ) \ export LC_ALL=C ; ( $(CAT) $$< && $(ECHO) "" ) \
| $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \ | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
-e 's/\([^\\]\)!/\1\\!/g' -e 's/^[ ]*#.*/#/g' \ -e 's/\([^\\]\)!/\1\\!/g' -e 's/^[ ]*#.*/#/g' \
@ -422,7 +423,7 @@ define SetupJavaCompilationBody
$1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp $1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp
$$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET) $$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
$(MKDIR) -p $$(@D) $$(call MakeTargetDir)
if [ -d "$$($1_HEADERS).$1.tmp" ]; then \ if [ -d "$$($1_HEADERS).$1.tmp" ]; then \
for f in `$(CD) $$($1_HEADERS).$1.tmp && $(FIND) . -type f`; do \ for f in `$(CD) $$($1_HEADERS).$1.tmp && $(FIND) . -type f`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] \ if [ ! -f "$$($1_HEADERS)/$$$$f" ] \

View file

@ -47,6 +47,29 @@ FindSrcDirsForComponent += \
$(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \ $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \
$(TOPDIR)/src/$(strip $1)/share/native/$(strip $2))) $(TOPDIR)/src/$(strip $1)/share/native/$(strip $2)))
# Find a library
# Param 1 - module name
# Param 2 - library name
# Param 3 - optional subdir for library
FindLib = \
$(call FindLibDirForModule, \
$(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
# Find a static library
# Param 1 - module name
# Param 2 - library name
# Param 3 - optional subdir for library
FindStaticLib = \
$(addprefix $(SUPPORT_OUTPUTDIR)/native/, \
$(strip $1)$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(STATIC_LIBRARY_SUFFIX))
# If only generating compile_commands.json, make these return empty to avoid
# declaring dependencies.
ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
FindLib =
FindStaticLib =
endif
GetJavaHeaderDir = \ GetJavaHeaderDir = \
$(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)) $(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1))

View file

@ -842,7 +842,7 @@ endef
# Parameter 1 is the name of the rule, and is also the name of the variable. # Parameter 1 is the name of the rule, and is also the name of the variable.
# #
# Remaining parameters are named arguments. These include: # Remaining parameters are named arguments. These include:
# KEYWORDS A list of valid keywords # SINGLE_KEYWORDS A list of valid keywords with single string values
# STRING_KEYWORDS A list of valid keywords, processed as string. This means # STRING_KEYWORDS A list of valid keywords, processed as string. This means
# that '%20' will be replaced by ' ' to allow for multi-word strings. # that '%20' will be replaced by ' ' to allow for multi-word strings.
# #
@ -856,7 +856,7 @@ define ParseKeywordVariableBody
$$(eval mangled_part_eval := $$(call DoubleDollar, $$(mangled_part))) \ $$(eval mangled_part_eval := $$(call DoubleDollar, $$(mangled_part))) \
$$(eval part := $$$$(subst ||||,$$$$(SPACE),$$$$(mangled_part_eval))) \ $$(eval part := $$$$(subst ||||,$$$$(SPACE),$$$$(mangled_part_eval))) \
$$(eval $1_NO_MATCH := true) \ $$(eval $1_NO_MATCH := true) \
$$(foreach keyword, $$($1_KEYWORDS), \ $$(foreach keyword, $$($1_SINGLE_KEYWORDS), \
$$(eval keyword_eval := $$(call DoubleDollar, $$(keyword))) \ $$(eval keyword_eval := $$(call DoubleDollar, $$(keyword))) \
$$(if $$(filter $$(keyword)=%, $$(part)), \ $$(if $$(filter $$(keyword)=%, $$(part)), \
$$(eval $(strip $1)_$$$$(keyword_eval) := $$$$(strip $$$$(patsubst $$$$(keyword_eval)=%, %, $$$$(part)))) \ $$(eval $(strip $1)_$$$$(keyword_eval) := $$$$(strip $$$$(patsubst $$$$(keyword_eval)=%, %, $$$$(part)))) \
@ -871,11 +871,11 @@ define ParseKeywordVariableBody
) \ ) \
) \ ) \
$$(if $$($1_NO_MATCH), \ $$(if $$($1_NO_MATCH), \
$$(if $$(filter $$(part), $$($1_KEYWORDS) $$($1_STRING_KEYWORDS)), \ $$(if $$(filter $$(part), $$($1_SINGLE_KEYWORDS) $$($1_STRING_KEYWORDS)), \
$$(info Keyword $$(part) for $1 needs to be assigned a value.) \ $$(info Keyword $$(part) for $1 needs to be assigned a value.) \
, \ , \
$$(info $$(part) is not a valid keyword for $1.) \ $$(info $$(part) is not a valid keyword for $1.) \
$$(info Valid keywords: $$($1_KEYWORDS) $$($1_STRING_KEYWORDS).) \ $$(info Valid keywords: $$($1_SINGLE_KEYWORDS) $$($1_STRING_KEYWORDS).) \
) \ ) \
$$(error Cannot continue) \ $$(error Cannot continue) \
) \ ) \

View file

@ -321,7 +321,7 @@ MODULE_INFOS := $(call FindAllModuleInfos, *)
$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
$(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps) $(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $(RM) $@
$(foreach m, $(MODULE_INFOS), \ $(foreach m, $(MODULE_INFOS), \
( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \ ( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \

View file

@ -59,6 +59,29 @@ define GetSymbols
fi fi
endef endef
################################################################################
# Creates a recipe that creates a compile_commands.json fragment. Remove any
# occurences of FIXPATH programs from the command to show the actual invocation.
#
# Param 1: Name of file to create
# Param 2: Working directory
# Param 3: Source file
# Param 4: Compile command
# Param 5: Object name
################################################################################
define WriteCompileCommandsFragment
$(call LogInfo, Creating compile commands fragment for $(notdir $3))
$(call MakeDir, $(dir $1))
$(call WriteFile,{ \
"directory": "$(strip $2)"$(COMMA) \
"file": "$(strip $3)"$(COMMA) \
"command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\
$(subst $(FIXPATH),,$4))))"$(COMMA) \
"output": "$(strip $5)" \
}$(COMMA), \
$1)
endef
################################################################################ ################################################################################
# Define a native toolchain configuration that can be used by # Define a native toolchain configuration that can be used by
# SetupNativeCompilation calls # SetupNativeCompilation calls
@ -203,6 +226,11 @@ define SetupCompileNativeFileBody
$1_OBJ := $$($$($1_BASE)_OBJECT_DIR)/$$(call replace_with_obj_extension, \ $1_OBJ := $$($$($1_BASE)_OBJECT_DIR)/$$(call replace_with_obj_extension, \
$$($1_FILENAME)) $$($1_FILENAME))
# Generate the corresponding compile_commands.json fragment.
$1_OBJ_JSON = $$(MAKESUPPORT_OUTPUTDIR)/compile-commands/$$(subst /,_,$$(subst \
$$(OUTPUTDIR)/,,$$($1_OBJ))).json
$$($1_BASE)_ALL_OBJS_JSON += $$($1_OBJ_JSON)
# Only continue if this object file hasn't been processed already. This lets # Only continue if this object file hasn't been processed already. This lets
# the first found source file override any other with the same name. # the first found source file override any other with the same name.
ifeq ($$(findstring $$($1_OBJ), $$($$($1_BASE)_OBJS_SO_FAR)), ) ifeq ($$(findstring $$($1_OBJ), $$($$($1_BASE)_OBJS_SO_FAR)), )
@ -297,8 +325,15 @@ define SetupCompileNativeFileBody
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_OBJ).vardeps) $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_OBJ).vardeps)
endif endif
$$($1_OBJ): $$($1_SRC_FILE) $$($$($1_BASE)_COMPILE_VARDEPS_FILE) \ $1_OBJ_DEPS := $$($1_SRC_FILE) $$($$($1_BASE)_COMPILE_VARDEPS_FILE) \
$$($$($1_BASE)_EXTRA_DEPS) $$($1_VARDEPS_FILE) | $$($$($1_BASE)_BUILD_INFO) $$($$($1_BASE)_EXTRA_DEPS) $$($1_VARDEPS_FILE)
$1_COMPILE_OPTIONS := $$($1_FLAGS) $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE)
$$($1_OBJ_JSON): $$($1_OBJ_DEPS)
$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$($1_SRC_FILE), \
$$($1_COMPILER) $$($1_COMPILE_OPTIONS), $$($1_OBJ))
$$($1_OBJ): $$($1_OBJ_DEPS) | $$($$($1_BASE)_BUILD_INFO)
$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME))) $$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
$$(call MakeDir, $$(@D)) $$(call MakeDir, $$(@D))
ifneq ($(TOOLCHAIN_TYPE), microsoft) ifneq ($(TOOLCHAIN_TYPE), microsoft)
@ -307,13 +342,11 @@ define SetupCompileNativeFileBody
# object file in the generated deps files. Fixing it with sed. If # object file in the generated deps files. Fixing it with sed. If
# compiling assembly, don't try this. # compiling assembly, don't try this.
$$(call ExecuteWithLog, $$@, \ $$(call ExecuteWithLog, $$@, \
$$($1_COMPILER) $$($1_FLAGS) $$($1_DEP_FLAG) $$($1_DEP).tmp \ $$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEP).tmp $$($1_COMPILE_OPTIONS))
$(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE))
$(SED) 's|^$$(@F):|$$@:|' $$($1_DEP).tmp > $$($1_DEP) $(SED) 's|^$$(@F):|$$@:|' $$($1_DEP).tmp > $$($1_DEP)
else else
$$(call ExecuteWithLog, $$@, \ $$(call ExecuteWithLog, $$@, \
$$($1_COMPILER) $$($1_FLAGS) $$($1_DEP_FLAG) $$($1_DEP) \ $$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEP) $$($1_COMPILE_OPTIONS))
$(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE))
endif endif
# Create a dependency target file from the dependency file. # Create a dependency target file from the dependency file.
# Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ # Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
@ -329,8 +362,7 @@ define SetupCompileNativeFileBody
# on Windows. No need to save exit code from compilation since # on Windows. No need to save exit code from compilation since
# pipefail is always active on Windows. # pipefail is always active on Windows.
$$(call ExecuteWithLog, $$@, \ $$(call ExecuteWithLog, $$@, \
$$($1_COMPILER) $$($1_FLAGS) -showIncludes \ $$($1_COMPILER) -showIncludes $$($1_COMPILE_OPTIONS)) \
$(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE)) \
| $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \ | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \
-e "^$$($1_FILENAME)$$$$" || test "$$$$?" = "1" ; \ -e "^$$($1_FILENAME)$$$$" || test "$$$$?" = "1" ; \
$(ECHO) $$@: \\ > $$($1_DEP) ; \ $(ECHO) $$@: \\ > $$($1_DEP) ; \
@ -694,17 +726,25 @@ define SetupNativeCompilationBody
-include $$($1_PCH_DEP) -include $$($1_PCH_DEP)
-include $$($1_PCH_DEP_TARGETS) -include $$($1_PCH_DEP_TARGETS)
$1_PCH_COMMAND := $$($1_CC) $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \
$$($1_OPT_CFLAGS) -x c++-header -c $(C_FLAG_DEPS) $$($1_PCH_DEP)
$$($1_PCH_FILE): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE) $$($1_PCH_FILE): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE)
$$(call LogInfo, Generating precompiled header) $$(call LogInfo, Generating precompiled header)
$$(call MakeDir, $$(@D)) $$(call MakeDir, $$(@D))
$$(call ExecuteWithLog, $$@, \ $$(call ExecuteWithLog, $$@, $$($1_PCH_COMMAND) $$< -o $$@)
$$($1_CC) $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \
$$($1_OPT_CFLAGS) \
-x c++-header -c $(C_FLAG_DEPS) $$($1_PCH_DEP) $$< -o $$@)
$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_PCH_DEP) > $$($1_PCH_DEP_TARGETS) $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_PCH_DEP) > $$($1_PCH_DEP_TARGETS)
$$($1_ALL_OBJS): $$($1_PCH_FILE) $$($1_ALL_OBJS): $$($1_PCH_FILE)
# Generate the corresponding compile_commands.json fragment.
$1_PCH_FILE_JSON := $$(MAKESUPPORT_OUTPUTDIR)/compile-commands/$$(subst /,_,$$(subst \
$$(OUTPUTDIR)/,,$$($1_PCH_FILE))).json
$1_ALL_OBJS_JSON += $$($1_PCH_FILE_JSON)
$$($1_PCH_FILE_JSON): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE)
$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$<, \
$$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE), $$($1_PCH_FILE))
endif endif
endif endif
endif endif
@ -1025,6 +1065,10 @@ define SetupNativeCompilationBody
endif endif
endif endif
endif endif
ifeq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
$1 := $$($1_ALL_OBJS_JSON)
endif
endef endef
endif # _NATIVE_COMPILATION_GMK endif # _NATIVE_COMPILATION_GMK

View file

@ -124,8 +124,8 @@ define SetupZipArchiveBody
# If zip has nothing to do, it returns 12 and would fail the build. Check for 12 # If zip has nothing to do, it returns 12 and would fail the build. Check for 12
# and only fail if it's not. # and only fail if it's not.
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS) $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
$(MKDIR) -p $$(@D) $$(call LogWarn, Updating $$($1_NAME))
$(ECHO) Updating $$($1_NAME) $$(call MakeTargetDir)
$$(foreach s,$$($1_SRC),(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \ $$(foreach s,$$($1_SRC),(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \
$$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \ $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \
$$($1_ZIP_EXCLUDES_$$s) \ $$($1_ZIP_EXCLUDES_$$s) \

View file

@ -522,7 +522,7 @@ var getJibProfilesProfiles = function (input, common, data) {
.forEach(function (name) { .forEach(function (name) {
var maketestName = name + "-testmake"; var maketestName = name + "-testmake";
profiles[maketestName] = concatObjects(profiles[name], testmakeBase); profiles[maketestName] = concatObjects(profiles[name], testmakeBase);
profiles[maketestName].default_make_targets = [ "test-make" ]; profiles[maketestName].default_make_targets = [ "test-make", "test-compile-commands" ];
}); });
// Profiles for building the zero jvm variant. These are used for verification. // Profiles for building the zero jvm variant. These are used for verification.
@ -755,16 +755,15 @@ var getJibProfilesProfiles = function (input, common, data) {
"run-test-prebuilt": { "run-test-prebuilt": {
target_os: input.build_os, target_os: input.build_os,
target_cpu: input.build_cpu, target_cpu: input.build_cpu,
src: "src.conf",
dependencies: [ "jtreg", "gnumake", "boot_jdk", "jib", testedProfile + ".jdk", dependencies: [ "jtreg", "gnumake", "boot_jdk", "jib", testedProfile + ".jdk",
testedProfile + ".test", "src.full" testedProfile + ".test"
], ],
work_dir: input.get("src.full", "install_path") + "/test", src: "src.conf",
make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true" ],
environment: { environment: {
"JT_JAVA": common.boot_jdk_home, "BOOT_JDK": common.boot_jdk_home,
"PRODUCT_HOME": input.get(testedProfile + ".jdk", "home_path"), "JDK_IMAGE_DIR": input.get(testedProfile + ".jdk", "home_path"),
"TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path"), "TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path")
"TEST_OUTPUT_DIR": input.src_top_dir
}, },
labels: "test" labels: "test"
} }
@ -802,13 +801,34 @@ var getJibProfilesProfiles = function (input, common, data) {
windowsRunTestPrebuiltExtra = { windowsRunTestPrebuiltExtra = {
dependencies: [ testedProfile + ".jdk_symbols" ], dependencies: [ testedProfile + ".jdk_symbols" ],
environment: { environment: {
"PRODUCT_SYMBOLS_HOME": input.get(testedProfile + ".jdk_symbols", "home_path"), "SYMBOLS_IMAGE_DIR": input.get(testedProfile + ".jdk_symbols", "home_path"),
} }
}; };
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"], profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
windowsRunTestPrebuiltExtra); windowsRunTestPrebuiltExtra);
} }
// The profile run-test-prebuilt defines src.conf as the src bundle. When
// running in Mach 5, this reduces the time it takes to populate the
// considerably. But with just src.conf, we cannot actually run any tests,
// so if running from a workspace with just src.conf in it, we need to also
// get src.full as a dependency, and define the work_dir (where make gets
// run) to be in the src.full install path. By running in the install path,
// the same cached installation of the full src can be reused for multiple
// test tasks. Care must however be taken not to polute that work dir by
// setting the appropriate make variables to control output directories.
//
// Use the existance of the top level README as indication of if this is
// the full source or just src.conf.
if (!new java.io.File(__DIR__, "../../README").exists()) {
var runTestPrebuiltSrcFullExtra = {
dependencies: "src.full",
work_dir: input.get("src.full", "install_path"),
}
profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"],
runTestPrebuiltSrcFullExtra);
}
// Generate the missing platform attributes // Generate the missing platform attributes
profiles = generatePlatformAttributes(profiles); profiles = generatePlatformAttributes(profiles);
profiles = generateDefaultMakeTargetsConfigureArg(common, profiles); profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
@ -835,7 +855,7 @@ var getJibProfilesDependencies = function (input, common) {
: "gcc7.3.0-Fedora27+1.0"), : "gcc7.3.0-Fedora27+1.0"),
linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0 linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0
? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0" ? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0"
: (input.profile.indexOf("arm32") >= 0 : (input.profile != null && input.profile.indexOf("arm32") >= 0
? "gcc7.3.0-Fedora27+1.0" ? "gcc7.3.0-Fedora27+1.0"
: "arm-linaro-4.7+1.0" : "arm-linaro-4.7+1.0"
) )

View file

@ -128,7 +128,7 @@ POLICY_DST := $(CONF_DST_DIR)/security/java.policy
POLICY_SRC_LIST := $(POLICY_SRC) POLICY_SRC_LIST := $(POLICY_SRC)
$(POLICY_DST): $(POLICY_SRC_LIST) $(POLICY_DST): $(POLICY_SRC_LIST)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $@.tmp $(RM) $@ $@.tmp
$(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;) $(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
$(MV) $@.tmp $@ $(MV) $@.tmp $@
@ -153,7 +153,7 @@ ifneq ($(IMPORT_MODULES_CONF), )
endif endif
$(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST) $(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $@.tmp $(RM) $@ $@.tmp
$(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;) $(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
$(MV) $@.tmp $@ $(MV) $@.tmp $@

View file

@ -2185,7 +2185,7 @@ JDWP "Java(tm) Debug Wire Protocol"
"in this thread group. Threads and thread groups in child " "in this thread group. Threads and thread groups in child "
"thread groups are not included. " "thread groups are not included. "
"A thread is alive if it has been started and has not yet been stopped. " "A thread is alive if it has been started and has not yet been stopped. "
"See <a href=../../../api/java/lang/ThreadGroup.html>java.lang.ThreadGroup </a> "See <a href=../../api/java.base/java/lang/ThreadGroup.html>java.lang.ThreadGroup </a>
"for information about active ThreadGroups. "for information about active ThreadGroups.
(Out (Out
(threadGroupObject group "The thread group object ID. ") (threadGroupObject group "The thread group object ID. ")

View file

@ -11729,6 +11729,7 @@
32FC;CIRCLED KATAKANA WI;So;0;L;<circle> 30F0;;;;N;;;;; 32FC;CIRCLED KATAKANA WI;So;0;L;<circle> 30F0;;;;N;;;;;
32FD;CIRCLED KATAKANA WE;So;0;L;<circle> 30F1;;;;N;;;;; 32FD;CIRCLED KATAKANA WE;So;0;L;<circle> 30F1;;;;N;;;;;
32FE;CIRCLED KATAKANA WO;So;0;L;<circle> 30F2;;;;N;;;;; 32FE;CIRCLED KATAKANA WO;So;0;L;<circle> 30F2;;;;N;;;;;
32FF;SQUARE ERA NAME NEWERA;So;0;L;<square> 5143 53F7;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME NEWERA;;;;
3300;SQUARE APAATO;So;0;L;<square> 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;; 3300;SQUARE APAATO;So;0;L;<square> 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;;
3301;SQUARE ARUHUA;So;0;L;<square> 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;; 3301;SQUARE ARUHUA;So;0;L;<square> 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;;
3302;SQUARE ANPEA;So;0;L;<square> 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;; 3302;SQUARE ANPEA;So;0;L;<square> 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;;

View file

@ -38,7 +38,7 @@ $(GENDATA_FONT_CONFIG_DST)/%.src: \
$(GENDATA_FONT_CONFIG_DST)/%.bfc: \ $(GENDATA_FONT_CONFIG_DST)/%.bfc: \
$(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties \ $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties \
$(BUILD_TOOLS_JDK) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $(RM) $@
$(TOOL_COMPILEFONTCONFIG) $< $@ $(TOOL_COMPILEFONTCONFIG) $< $@
$(CHMOD) 444 $@ $(CHMOD) 444 $@

View file

@ -28,7 +28,7 @@ GENDATA_HTML32DTD :=
HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd
$(HTML32DTD): $(BUILD_TOOLS_JDK) $(HTML32DTD): $(BUILD_TOOLS_JDK)
$(call LogInfo, Generating HTML DTD file) $(call LogInfo, Generating HTML DTD file)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $(RM) $@
($(TOOL_DTDBUILDER) html32 > $@) || exit 1 ($(TOOL_DTDBUILDER) html32 > $@) || exit 1

View file

@ -35,8 +35,8 @@ TZDATA_TZFILES := $(addprefix $(TZDATA_DIR)/,$(TZDATA_TZFILE))
GENDATA_TZDB_DAT := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/tzdb.dat GENDATA_TZDB_DAT := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/tzdb.dat
$(GENDATA_TZDB_DAT): $(TZDATA_TZFILES) $(GENDATA_TZDB_DAT): $(TZDATA_TZFILES)
$(call MakeTargetDir)
$(RM) $(GENDATA_TZDB_DAT) $(RM) $(GENDATA_TZDB_DAT)
$(MKDIR) -p $(@D)
$(TOOL_TZDB) -srcdir $(TZDATA_DIR) -dstfile $(GENDATA_TZDB_DAT) $(TZDATA_TZFILE) $(TOOL_TZDB) -srcdir $(TZDATA_DIR) -dstfile $(GENDATA_TZDB_DAT) $(TZDATA_TZFILE)
TARGETS += $(GENDATA_TZDB_DAT) TARGETS += $(GENDATA_TZDB_DAT)

View file

@ -50,7 +50,7 @@ $(CLDR_BASEMETAINFO_FILE): $(wildcard $(CLDRSRCDIR)/dtd/*.dtd) \
$(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \ $(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \
$(ZONENAME_TEMPLATE) \ $(ZONENAME_TEMPLATE) \
$(BUILD_TOOLS_JDK) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(GENSRC_BASEDIR) $(call MakeDir, $(GENSRC_BASEDIR))
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \ $(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \
-baselocales $(CLDR_BASE_LOCALES) \ -baselocales $(CLDR_BASE_LOCALES) \
-o $(GENSRC_BASEDIR) \ -o $(GENSRC_BASEDIR) \
@ -62,7 +62,7 @@ $(CLDR_METAINFO_FILE): $(wildcard $(CLDRSRCDIR)/dtd/*.dtd) \
$(wildcard $(CLDRSRCDIR)/main/*.xml) \ $(wildcard $(CLDRSRCDIR)/main/*.xml) \
$(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \ $(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \
$(BUILD_TOOLS_JDK) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(GENSRC_DIR) $(call MakeDir, $(GENSRC_DIR))
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \ $(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \
-baselocales $(CLDR_BASE_LOCALES) \ -baselocales $(CLDR_BASE_LOCALES) \
-o $(GENSRC_DIR) -o $(GENSRC_DIR)

View file

@ -34,8 +34,8 @@ GENSRC_CHARSETCODER_TEMPLATE := $(GENSRC_CHARSETCODER_SRC)/charset/Charset-X-Cod
################################################################################ ################################################################################
$(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE) $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
-$(RM) $@.tmp $(RM) $@.tmp
$(TOOL_SPP) < $< >$@.tmp \ $(TOOL_SPP) < $< >$@.tmp \
-Kdecoder \ -Kdecoder \
-DA='A' \ -DA='A' \
@ -69,8 +69,8 @@ GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java
################################################################################ ################################################################################
$(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE) $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
-$(RM) $@.tmp $(RM) $@.tmp
$(TOOL_SPP) < $< >$@.tmp \ $(TOOL_SPP) < $< >$@.tmp \
-Kencoder \ -Kencoder \
-DA='An' \ -DA='An' \

View file

@ -49,7 +49,7 @@ TOOL_PARSEPROPS_CMD := $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/langtools_tools
# root. # root.
define SetupVersionProperties define SetupVersionProperties
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2): $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2):
$(MKDIR) -p $$(@D) $$(call MakeTargetDir)
$(PRINTF) "jdk=$(VERSION_NUMBER)\nfull=$(VERSION_STRING)\nrelease=$(VERSION_SHORT)\n" \ $(PRINTF) "jdk=$(VERSION_NUMBER)\nfull=$(VERSION_STRING)\nrelease=$(VERSION_SHORT)\n" \
> $$@ > $$@
@ -92,7 +92,7 @@ define SetupCompileProperties
# Now setup the rule for the generation of the resource bundles. # Now setup the rule for the generation of the resource bundles.
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES) $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES)
$(MKDIR) -p $$(@D) $$(PROPDIRS) $$(call MakeDir, $$(@D) $$(PROPDIRS))
$(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE) $(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE)
$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE) $(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE)
$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE) $(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)
@ -122,7 +122,7 @@ define SetupParseProperties
# Now setup the rule for the generation of the resource bundles. # Now setup the rule for the generation of the resource bundles.
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $$(PARSEPROPSOURCES) $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $$(PARSEPROPSOURCES)
$(MKDIR) -p $$(@D) $$(PARSEPROPDIRS) $$(call MakeDir, $$(@D) $$(PARSEPROPDIRS))
$(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE) $(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE)
$(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE) $(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE)
$(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE) $(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE)

View file

@ -131,7 +131,7 @@ SED_NONBASEARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_NON
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java: \ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java: \
$(TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template $(TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
$(call LogInfo, Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources) $(call LogInfo, Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \ $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
> $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources > $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources
$(SED) $(SED_BASEARGS) $< > $@ $(SED) $(SED_BASEARGS) $< > $@
@ -139,7 +139,7 @@ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMet
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java: \ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java: \
$(TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template $(TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
$(call LogInfo, Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources) $(call LogInfo, Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \ $(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
> $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources > $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources
$(SED) $(SED_NONBASEARGS) $< > $@ $(SED) $(SED_NONBASEARGS) $< > $@

View file

@ -46,7 +46,7 @@ VARDEPS_FILE := $(call DependOnVariable, VARDEPS_VALUE)
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/module/ModuleLoaderMap.java: \ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/module/ModuleLoaderMap.java: \
$(TOPDIR)/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java \ $(TOPDIR)/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java \
$(VARDEPS_FILE) $(BUILD_TOOLS_JDK) $(VARDEPS_FILE) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $@.tmp $(RM) $@ $@.tmp
$(TOOL_GENCLASSLOADERMAP) -boot $(BOOT_MODULES_LIST) \ $(TOOL_GENCLASSLOADERMAP) -boot $(BOOT_MODULES_LIST) \
-platform $(PLATFORM_MODULES_LIST) -o $@.tmp $< -platform $(PLATFORM_MODULES_LIST) -o $@.tmp $<

View file

@ -34,7 +34,7 @@ define SetupOneCopy-zh_HK
$$(subst _zh_TW,_zh_HK, $2)) $$(subst _zh_TW,_zh_HK, $2))
$$($1_$2_TARGET): $2 $$($1_$2_TARGET): $2
$(MKDIR) -p $$(@D) $$(call MakeTargetDir)
$(CAT) $$< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $$@ $(CAT) $$< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $$@
$1 += $$($1_$2_TARGET) $1 += $$($1_$2_TARGET)
@ -105,8 +105,8 @@ define SetupCompilePropertiesBody
# Now setup the rule for the generation of the resource bundles. # Now setup the rule for the generation of the resource bundles.
$$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK) $$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
$(MKDIR) -p $$(@D) $$($1_DIRS) $$(call LogWarn, Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE))
$(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE) $$(call MakeDir, $$(@D) $$($1_DIRS))
$$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE))) $$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE)))
$(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE) $(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
$(TOUCH) $$@ $(TOUCH) $$@

View file

@ -32,7 +32,7 @@ NIMBUS_SKIN_FILE = $(TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nim
$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK) $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
$(call LogInfo, Generating Nimbus source files) $(call LogInfo, Generating Nimbus source files)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(TOOL_GENERATENIMBUS) $(LOG_DEBUG) \ $(TOOL_GENERATENIMBUS) $(LOG_DEBUG) \
-skinFile $(NIMBUS_SKIN_FILE) -buildDir $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop \ -skinFile $(NIMBUS_SKIN_FILE) -buildDir $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop \
-packagePrefix $(NIMBUS_PACKAGE).nimbus -lafName Nimbus -packagePrefix $(NIMBUS_PACKAGE).nimbus -lafName Nimbus

View file

@ -92,7 +92,7 @@ ifeq ($(call check-jvm-feature, zero), true)
DISABLED_WARNINGS_gcc += return-type switch DISABLED_WARNINGS_gcc += return-type switch
endif endif
DISABLED_WARNINGS_clang := tautological-compare deprecated-declarations \ DISABLED_WARNINGS_clang := tautological-compare \
undefined-var-template sometimes-uninitialized unknown-pragmas \ undefined-var-template sometimes-uninitialized unknown-pragmas \
delete-non-virtual-dtor missing-braces char-subscripts \ delete-non-virtual-dtor missing-braces char-subscripts \
ignored-qualifiers missing-field-initializers mismatched-tags ignored-qualifiers missing-field-initializers mismatched-tags
@ -214,15 +214,17 @@ VM_VERSION_OBJ := $(JVM_OUTPUTDIR)/objs/vm_version$(OBJ_SUFFIX)
$(VM_VERSION_OBJ): $(filter-out $(VM_VERSION_OBJ) $(JVM_MAPFILE), \ $(VM_VERSION_OBJ): $(filter-out $(VM_VERSION_OBJ) $(JVM_MAPFILE), \
$(BUILD_LIBJVM_TARGET_DEPS)) $(BUILD_LIBJVM_TARGET_DEPS))
ifeq ($(OPENJDK_TARGET_OS), windows) ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
# It doesn't matter which jvm.lib file gets exported, but we need ifeq ($(OPENJDK_TARGET_OS), windows)
# to pick just one. # It doesn't matter which jvm.lib file gets exported, but we need
ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN)) # to pick just one.
$(eval $(call SetupCopyFiles, COPY_JVM_LIB, \ ifeq ($(JVM_VARIANT), $(JVM_VARIANT_MAIN))
DEST := $(LIB_OUTPUTDIR), \ $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \
FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \ DEST := $(LIB_OUTPUTDIR), \
)) FILES :=$(BUILD_LIBJVM_IMPORT_LIBRARY), \
TARGETS += $(COPY_JVM_LIB) ))
TARGETS += $(COPY_JVM_LIB)
endif
endif endif
endif endif
@ -261,44 +263,46 @@ TARGETS += $(BUILD_LIBJVM)
# Search the output for the operator(s) of interest, to see where they are # Search the output for the operator(s) of interest, to see where they are
# referenced. # referenced.
ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang solstudio), ) ifneq ($(GENERATE_COMPILE_COMMANDS_ONLY), true)
ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang solstudio), )
DEMANGLED_REGEXP := [^:]operator (new|delete) DEMANGLED_REGEXP := [^:]operator (new|delete)
# Running c++filt to find offending symbols in all files is too expensive, # Running c++filt to find offending symbols in all files is too expensive,
# especially on Solaris, so use mangled names when looking for symbols. # especially on Solaris, so use mangled names when looking for symbols.
# Save the demangling for when something is actually found. # Save the demangling for when something is actually found.
ifeq ($(TOOLCHAIN_TYPE), solstudio) ifeq ($(TOOLCHAIN_TYPE), solstudio)
MANGLED_SYMS := \ MANGLED_SYMS := \
__1c2n6FL_pv_ \ __1c2n6FL_pv_ \
__1c2N6FL_pv_ \ __1c2N6FL_pv_ \
__1c2k6Fpv_v_ \ __1c2k6Fpv_v_ \
__1c2K6Fpv_v_ \ __1c2K6Fpv_v_ \
# #
UNDEF_PATTERN := UNDEF UNDEF_PATTERN := UNDEF
else else
MANGLED_SYMS := \ MANGLED_SYMS := \
_ZdaPv \ _ZdaPv \
_ZdlPv \ _ZdlPv \
_Znam \ _Znam \
_Znwm \ _Znwm \
# #
UNDEF_PATTERN := ' U ' UNDEF_PATTERN := ' U '
endif
define SetupOperatorNewDeleteCheck
$1.op_check: $1
if [ -n "`$(NM) $$< | $(GREP) $(addprefix -e , $(MANGLED_SYMS)) \
| $(GREP) $(UNDEF_PATTERN)`" ]; then \
$(ECHO) "$$<: Error: Use of global operators new and delete is not allowed in Hotspot:"; \
$(NM) $$< | $(CXXFILT) | $(EGREP) '$(DEMANGLED_REGEXP)' | $(GREP) $(UNDEF_PATTERN); \
$(ECHO) "See: $(TOPDIR)/make/hotspot/lib/CompileJvm.gmk"; \
exit 1; \
fi
$(TOUCH) $$@
TARGETS += $1.op_check
endef
$(foreach o, $(BUILD_LIBJVM_ALL_OBJS), $(eval $(call SetupOperatorNewDeleteCheck,$o)))
endif endif
define SetupOperatorNewDeleteCheck
$1.op_check: $1
if [ -n "`$(NM) $$< | $(GREP) $(addprefix -e , $(MANGLED_SYMS)) \
| $(GREP) $(UNDEF_PATTERN)`" ]; then \
$(ECHO) "$$<: Error: Use of global operators new and delete is not allowed in Hotspot:"; \
$(NM) $$< | $(CXXFILT) | $(EGREP) '$(DEMANGLED_REGEXP)' | $(GREP) $(UNDEF_PATTERN); \
$(ECHO) "See: $(TOPDIR)/make/hotspot/lib/CompileJvm.gmk"; \
exit 1; \
fi
$(TOUCH) $$@
TARGETS += $1.op_check
endef
$(foreach o, $(BUILD_LIBJVM_ALL_OBJS), $(eval $(call SetupOperatorNewDeleteCheck,$o)))
endif endif

View file

@ -45,7 +45,7 @@ $(eval $(call SetupBuildLauncher, java, \
)) ))
$(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java) $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
$(MKDIR) -p $(@D) $(call MakeTargetDir)
$(RM) $@ $(RM) $@
$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs/java$(EXE_SUFFIX) $@ $(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs/java$(EXE_SUFFIX) $@

View file

@ -91,21 +91,15 @@ $(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
CFLAGS_solaris := -KPIC, \ CFLAGS_solaris := -KPIC, \
CFLAGS_macosx := -fPIC, \ CFLAGS_macosx := -fPIC, \
DISABLED_WARNINGS_clang := format-nonliteral, \ DISABLED_WARNINGS_clang := format-nonliteral, \
LDFLAGS := $(UNPACKEXE_ZIPOBJS) \ LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \ $(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \ LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \
MANIFEST := $(TOPDIR)/src/jdk.pack/windows/native/unpack200/unpack200_proto.exe.manifest, \ MANIFEST := $(TOPDIR)/src/jdk.pack/windows/native/unpack200/unpack200_proto.exe.manifest, \
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \ MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
EXTRA_OBJECT_FILES := $(UNPACKEXE_ZIPOBJS) \
)) ))
ifneq ($(USE_EXTERNAL_LIBZ), true)
$(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
endif
TARGETS += $(BUILD_UNPACKEXE) TARGETS += $(BUILD_UNPACKEXE)
################################################################################ ################################################################################

View file

@ -135,7 +135,7 @@ define SetupBuildLauncherBody
$1_LIBS += -lz $1_LIBS += -lz
endif endif
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib $1_WINDOWS_JLI_LIB := $(call FindStaticLib, java.base, jli, /libjli)
$$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \ $$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \
NAME := $1, \ NAME := $1, \
@ -181,11 +181,11 @@ define SetupBuildLauncherBody
TARGETS += $$($1) TARGETS += $$($1)
ifeq ($(OPENJDK_TARGET_OS), aix) ifeq ($(OPENJDK_TARGET_OS), aix)
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, jli_static)
endif endif
ifeq ($(OPENJDK_TARGET_OS), windows) ifeq ($(OPENJDK_TARGET_OS), windows)
$$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \ $$(BUILD_LAUNCHER_$1): $(call FindStaticLib, java.base, java, /libjava) \
$$($1_WINDOWS_JLI_LIB) $$($1_WINDOWS_JLI_LIB)
endif endif
endef endef

View file

@ -739,11 +739,11 @@ else # OPENJDK_TARGET_OS not windows
ifeq ($(ENABLE_HEADLESS_ONLY), false) ifeq ($(ENABLE_HEADLESS_ONLY), false)
$(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT) $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
else else
$(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX) $(BUILD_LIBJAWT): $(call FindLib, $(MODULE), awt_headless)
endif endif
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
$(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX) $(BUILD_LIBJAWT): $(call FindLib, $(MODULE), awt_lwawt)
endif endif
endif # OPENJDK_TARGET_OS endif # OPENJDK_TARGET_OS

View file

@ -55,7 +55,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \ VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
) )
$$(BUILD_JAVAACCESSBRIDGE$1): $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib $$(BUILD_JAVAACCESSBRIDGE$1): $(call FindStaticLib, java.desktop, jawt, /libjawt)
TARGETS += $$(BUILD_JAVAACCESSBRIDGE$1) TARGETS += $$(BUILD_JAVAACCESSBRIDGE$1)
endef endef

View file

@ -44,7 +44,12 @@ else ifeq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(OPENJDK_TARGET_CPU), x86_64) ifeq ($(OPENJDK_TARGET_CPU), x86_64)
SA_CXXFLAGS := -DWIN64 SA_CXXFLAGS := -DWIN64
else else
SA_CXXFLAGS := -RTC1 # Only add /RTC1 flag for debug builds as it's
# incompatible with release type builds. See
# https://msdn.microsoft.com/en-us/library/8wtf2dfz.aspx
ifeq ($(DEBUG_LEVEL),slowdebug)
SA_CXXFLAGS := -RTC1
endif
endif endif
endif endif

View file

@ -61,24 +61,6 @@ else ifeq ($(TOOLCHAIN_TYPE), xlc)
endif endif
endif endif
################################################################################
# Find a library
# Param 1 - module name
# Param 2 - library name
# Param 3 - optional subdir for library
FindLib = \
$(call FindLibDirForModule, \
$(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
################################################################################
# Find a static library
# Param 1 - module name
# Param 2 - library name
# Param 3 - optional subdir for library
FindStaticLib = \
$(addprefix $(SUPPORT_OUTPUTDIR)/native/, \
$(strip $1)$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(STATIC_LIBRARY_SUFFIX))
# Put the libraries here. # Put the libraries here.
INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE)) INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE))

View file

@ -51,7 +51,7 @@ $(RMIC_GENSRC_DIR)/_classes.moved: $(RMI_GEN)
$(foreach src, $(classfiles), \ $(foreach src, $(classfiles), \
$(eval target := $(patsubst $(RMIC_GENSRC_DIR)/%, \ $(eval target := $(patsubst $(RMIC_GENSRC_DIR)/%, \
$(STUB_CLASSES_DIR)/%, $(src))) \ $(STUB_CLASSES_DIR)/%, $(src))) \
$(MKDIR) -p $(dir $(target)) ; \ $(call MakeDir, $(dir $(target))) \
$(MV) $(src) $(target) $(NEWLINE)) $(MV) $(src) $(target) $(NEWLINE))
$(TOUCH) $@ $(TOUCH) $@

View file

@ -385,6 +385,7 @@ compare_general_files() {
! -name "JavaUpdater" ! -name "JavaWSApplicationStub" \ ! -name "JavaUpdater" ! -name "JavaWSApplicationStub" \
! -name "jspawnhelper" ! -name "JavawsLauncher" ! -name "*.a" \ ! -name "jspawnhelper" ! -name "JavawsLauncher" ! -name "*.a" \
! -name "finish_installation" ! -name "Sparkle" ! -name "*.tar.gz" \ ! -name "finish_installation" ! -name "Sparkle" ! -name "*.tar.gz" \
! -name "classes.jsa" \
| $GREP -v "./bin/" | $SORT | $FILTER) | $GREP -v "./bin/" | $SORT | $FILTER)
echo Other files with binary differences... echo Other files with binary differences...

View file

@ -62,7 +62,7 @@ define_pd_global(bool, OptoPeephole, false);
define_pd_global(bool, UseCISCSpill, false); define_pd_global(bool, UseCISCSpill, false);
define_pd_global(bool, OptoBundling, false); define_pd_global(bool, OptoBundling, false);
define_pd_global(bool, OptoRegScheduling, false); define_pd_global(bool, OptoRegScheduling, false);
define_pd_global(bool, SuperWordLoopUnrollAnalysis, false); define_pd_global(bool, SuperWordLoopUnrollAnalysis, true);
// GL: // GL:
// Detected a problem with unscaled compressed oops and // Detected a problem with unscaled compressed oops and
// narrow_oop_use_complex_address() == false. // narrow_oop_use_complex_address() == false.

View file

@ -53,14 +53,135 @@ void RegisterMap::check_location_valid() {
bool frame::safe_for_sender(JavaThread *thread) { bool frame::safe_for_sender(JavaThread *thread) {
bool safe = false; bool safe = false;
address cursp = (address)sp(); address sp = (address)_sp;
address curfp = (address)fp(); address fp = (address)_fp;
if ((cursp != NULL && curfp != NULL && address unextended_sp = (address)_unextended_sp;
(cursp <= thread->stack_base() && cursp >= thread->stack_base() - thread->stack_size())) &&
(curfp <= thread->stack_base() && curfp >= thread->stack_base() - thread->stack_size())) { // Consider stack guards when trying to determine "safe" stack pointers
safe = true; static size_t stack_guard_size = os::uses_stack_guard_pages() ?
JavaThread::stack_red_zone_size() + JavaThread::stack_yellow_reserved_zone_size() : 0;
size_t usable_stack_size = thread->stack_size() - stack_guard_size;
// sp must be within the usable part of the stack (not in guards)
bool sp_safe = (sp < thread->stack_base()) &&
(sp >= thread->stack_base() - usable_stack_size);
if (!sp_safe) {
return false;
} }
return safe;
// Unextended sp must be within the stack
bool unextended_sp_safe = (unextended_sp < thread->stack_base());
if (!unextended_sp_safe) {
return false;
}
// An fp must be within the stack and above (but not equal) sp.
bool fp_safe = (fp <= thread->stack_base()) && (fp > sp);
// An interpreter fp must be within the stack and above (but not equal) sp.
// Moreover, it must be at least the size of the z_ijava_state structure.
bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) &&
((fp - sp) >= z_ijava_state_size);
// We know sp/unextended_sp are safe, only fp is questionable here
// If the current frame is known to the code cache then we can attempt to
// to construct the sender and do some validation of it. This goes a long way
// toward eliminating issues when we get in frame construction code
if (_cb != NULL ) {
// Entry frame checks
if (is_entry_frame()) {
// An entry frame must have a valid fp.
return fp_safe && is_entry_frame_valid(thread);
}
// Now check if the frame is complete and the test is
// reliable. Unfortunately we can only check frame completeness for
// runtime stubs. Other generic buffer blobs are more
// problematic so we just assume they are OK. Adapter blobs never have a
// complete frame and are never OK. nmethods should be OK on s390.
if (!_cb->is_frame_complete_at(_pc)) {
if (_cb->is_adapter_blob() || _cb->is_runtime_stub()) {
return false;
}
}
// Could just be some random pointer within the codeBlob.
if (!_cb->code_contains(_pc)) {
return false;
}
if (is_interpreted_frame() && !fp_interp_safe) {
return false;
}
z_abi_160* sender_abi = (z_abi_160*) fp;
intptr_t* sender_sp = (intptr_t*) sender_abi->callers_sp;
address sender_pc = (address) sender_abi->return_pc;
// We must always be able to find a recognizable pc.
CodeBlob* sender_blob = CodeCache::find_blob_unsafe(sender_pc);
if (sender_blob == NULL) {
return false;
}
// Could be a zombie method
if (sender_blob->is_zombie() || sender_blob->is_unloaded()) {
return false;
}
// It should be safe to construct the sender though it might not be valid.
frame sender(sender_sp, sender_pc);
// Do we have a valid fp?
address sender_fp = (address) sender.fp();
// sender_fp must be within the stack and above (but not
// equal) current frame's fp.
if (sender_fp > thread->stack_base() || sender_fp <= fp) {
return false;
}
// If the potential sender is the interpreter then we can do some more checking.
if (Interpreter::contains(sender_pc)) {
return sender.is_interpreted_frame_valid(thread);
}
// Could just be some random pointer within the codeBlob.
if (!sender.cb()->code_contains(sender_pc)) {
return false;
}
// We should never be able to see an adapter if the current frame is something from code cache.
if (sender_blob->is_adapter_blob()) {
return false;
}
if (sender.is_entry_frame()) {
return sender.is_entry_frame_valid(thread);
}
// Frame size is always greater than zero. If the sender frame size is zero or less,
// something is really weird and we better give up.
if (sender_blob->frame_size() <= 0) {
return false;
}
return true;
}
// Must be native-compiled frame. Since sender will try and use fp to find
// linkages it must be safe
if (!fp_safe) {
return false;
}
return true;
} }
bool frame::is_interpreted_frame() const { bool frame::is_interpreted_frame() const {

View file

@ -491,9 +491,12 @@
static int interpreter_frame_interpreterstate_size_in_bytes(); static int interpreter_frame_interpreterstate_size_in_bytes();
static int interpreter_frame_monitor_size_in_bytes(); static int interpreter_frame_monitor_size_in_bytes();
private:
// template interpreter state // template interpreter state
inline z_ijava_state* ijava_state_unchecked() const;
private:
inline z_ijava_state* ijava_state() const; inline z_ijava_state* ijava_state() const;
// Where z_ijava_state.monitors is saved. // Where z_ijava_state.monitors is saved.

View file

@ -77,8 +77,13 @@ inline frame::frame(void* sp, void* pc, void* unextended_sp) :
#endif #endif
// template interpreter state // template interpreter state
inline frame::z_ijava_state* frame::ijava_state() const { inline frame::z_ijava_state* frame::ijava_state_unchecked() const {
z_ijava_state* state = (z_ijava_state*) ((uintptr_t)fp() - z_ijava_state_size); z_ijava_state* state = (z_ijava_state*) ((uintptr_t)fp() - z_ijava_state_size);
return state;
}
inline frame::z_ijava_state* frame::ijava_state() const {
z_ijava_state* state = ijava_state_unchecked();
assert(state->magic == (intptr_t) frame::z_istate_magic_number, assert(state->magic == (intptr_t) frame::z_istate_magic_number,
"wrong z_ijava_state in interpreter frame (no magic found)"); "wrong z_ijava_state in interpreter frame (no magic found)");
return state; return state;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -205,9 +205,9 @@ void NativeCall::test() {
uint idx; uint idx;
int offsets[] = { int offsets[] = {
0x0, 0x0,
0xfffffff0, (int)0xfffffff0,
0x7ffffff0, (int)0x7ffffff0,
0x80000000, (int)0x80000000,
0x20, 0x20,
0x4000, 0x4000,
}; };
@ -361,9 +361,9 @@ void NativeMovConstReg::test() {
uint idx; uint idx;
int offsets[] = { int offsets[] = {
0x0, 0x0,
0x7fffffff, (int)0x7fffffff,
0x80000000, (int)0x80000000,
0xffffffff, (int)0xffffffff,
0x20, 0x20,
4096, 4096,
4097, 4097,
@ -534,9 +534,9 @@ void NativeMovConstRegPatching::test() {
uint idx; uint idx;
int offsets[] = { int offsets[] = {
0x0, 0x0,
0x7fffffff, (int)0x7fffffff,
0x80000000, (int)0x80000000,
0xffffffff, (int)0xffffffff,
0x20, 0x20,
4096, 4096,
4097, 4097,
@ -630,9 +630,9 @@ void NativeMovRegMem::test() {
uint idx1; uint idx1;
int offsets[] = { int offsets[] = {
0x0, 0x0,
0xffffffff, (int)0xffffffff,
0x7fffffff, (int)0x7fffffff,
0x80000000, (int)0x80000000,
4096, 4096,
4097, 4097,
0x20, 0x20,
@ -751,9 +751,9 @@ void NativeJump::test() {
uint idx; uint idx;
int offsets[] = { int offsets[] = {
0x0, 0x0,
0xffffffff, (int)0xffffffff,
0x7fffffff, (int)0x7fffffff,
0x80000000, (int)0x80000000,
4096, 4096,
4097, 4097,
0x20, 0x20,

View file

@ -688,7 +688,7 @@ LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_
} }
LIR_Opr result = new_register(T_INT); LIR_Opr result = new_register(T_INT);
__ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
result, type); result, T_INT);
return result; return result;
} }

View file

@ -35,9 +35,6 @@
#define BUFFER_SIZE 30*wordSize #define BUFFER_SIZE 30*wordSize
// Instead of issuing lfence for LoadLoad barrier, we create data dependency
// between loads, which is more efficient than lfence.
// Common register usage: // Common register usage:
// rax/xmm0: result // rax/xmm0: result
// c_rarg0: jni env // c_rarg0: jni env
@ -77,12 +74,6 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
__ mov (robj, c_rarg1); __ mov (robj, c_rarg1);
__ testb (rcounter, 1); __ testb (rcounter, 1);
__ jcc (Assembler::notZero, slow); __ jcc (Assembler::notZero, slow);
__ xorptr(robj, rcounter);
__ xorptr(robj, rcounter); // obj, since
// robj ^ rcounter ^ rcounter == robj
// robj is data dependent on rcounter.
__ mov (roffset, c_rarg2); __ mov (roffset, c_rarg2);
__ shrptr(roffset, 2); // offset __ shrptr(roffset, 2); // offset
@ -103,12 +94,7 @@ address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
default: ShouldNotReachHere(); default: ShouldNotReachHere();
} }
// create data dependency on rax __ cmp32 (rcounter, counter);
__ lea(rcounter_addr, counter);
__ xorptr(rcounter_addr, rax);
__ xorptr(rcounter_addr, rax);
__ cmpl (rcounter, Address(rcounter_addr, 0));
__ jcc (Assembler::notEqual, slow); __ jcc (Assembler::notEqual, slow);
__ ret (0); __ ret (0);
@ -178,11 +164,6 @@ address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
__ testb (rcounter, 1); __ testb (rcounter, 1);
__ jcc (Assembler::notZero, slow); __ jcc (Assembler::notZero, slow);
__ xorptr(robj, rcounter);
__ xorptr(robj, rcounter); // obj, since
// robj ^ rcounter ^ rcounter == robj
// robj is data dependent on rcounter.
// Both robj and rtmp are clobbered by try_resolve_jobject_in_native. // Both robj and rtmp are clobbered by try_resolve_jobject_in_native.
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->try_resolve_jobject_in_native(masm, /* jni_env */ c_rarg0, robj, rtmp, slow); bs->try_resolve_jobject_in_native(masm, /* jni_env */ c_rarg0, robj, rtmp, slow);
@ -198,13 +179,7 @@ address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break; case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break;
default: ShouldNotReachHere(); default: ShouldNotReachHere();
} }
__ cmp32 (rcounter, counter);
__ lea(rcounter_addr, counter);
__ movdq (rax, xmm0);
// counter address is data dependent on xmm0.
__ xorptr(rcounter_addr, rax);
__ xorptr(rcounter_addr, rax);
__ cmpl (rcounter, Address(rcounter_addr, 0));
__ jcc (Assembler::notEqual, slow); __ jcc (Assembler::notEqual, slow);
__ ret (0); __ ret (0);

View file

@ -33,7 +33,7 @@ static bool returns_to_call_stub(address return_pc) { return return_pc == _call_
enum platform_dependent_constants { enum platform_dependent_constants {
code_size1 = 20000 LP64_ONLY(+10000), // simply increase if too small (assembler will crash if too small) code_size1 = 20000 LP64_ONLY(+10000), // simply increase if too small (assembler will crash if too small)
code_size2 = 33800 LP64_ONLY(+10000) // simply increase if too small (assembler will crash if too small) code_size2 = 35300 LP64_ONLY(+10000) // simply increase if too small (assembler will crash if too small)
}; };
class x86 { class x86 {

View file

@ -4259,7 +4259,7 @@ extern char** environ;
// or -1 on failure (e.g. can't fork a new process). // or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It // Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al. // doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd) { int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
char * argv[4] = {"sh", "-c", cmd, NULL}; char * argv[4] = {"sh", "-c", cmd, NULL};
pid_t pid = fork(); pid_t pid = fork();

View file

@ -3238,16 +3238,6 @@ void os::init(void) {
Bsd::clock_init(); Bsd::clock_init();
initial_time_count = javaTimeNanos(); initial_time_count = javaTimeNanos();
#ifdef __APPLE__
// XXXDARWIN
// Work around the unaligned VM callbacks in hotspot's
// sharedRuntime. The callbacks don't use SSE2 instructions, and work on
// Linux, Solaris, and FreeBSD. On Mac OS X, dyld (rightly so) enforces
// alignment when doing symbol lookup. To work around this, we force early
// binding of all symbols now, thus binding when alignment is known-good.
_dyld_bind_fully_image_containing_address((const void *) &os::init);
#endif
os::Posix::init(); os::Posix::init();
} }
@ -3795,7 +3785,7 @@ extern char** environ;
// or -1 on failure (e.g. can't fork a new process). // or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It // Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al. // doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd) { int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
const char * argv[4] = {"sh", "-c", cmd, NULL}; const char * argv[4] = {"sh", "-c", cmd, NULL};
// fork() in BsdThreads/NPTL is not async-safe. It needs to run // fork() in BsdThreads/NPTL is not async-safe. It needs to run

View file

@ -5676,10 +5676,16 @@ extern char** environ;
// or -1 on failure (e.g. can't fork a new process). // or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It // Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al. // doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd) { int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
const char * argv[4] = {"sh", "-c", cmd, NULL}; const char * argv[4] = {"sh", "-c", cmd, NULL};
pid_t pid = fork(); pid_t pid ;
if (use_vfork_if_available) {
pid = vfork();
} else {
pid = fork();
}
if (pid < 0) { if (pid < 0) {
// fork failed // fork failed

View file

@ -1567,11 +1567,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
} }
typedef struct { typedef struct {
Elf32_Half code; // Actual value as defined in elf.h Elf32_Half code; // Actual value as defined in elf.h
Elf32_Half compat_class; // Compatibility of archs at VM's sense Elf32_Half compat_class; // Compatibility of archs at VM's sense
char elf_class; // 32 or 64 bit unsigned char elf_class; // 32 or 64 bit
char endianess; // MSB or LSB unsigned char endianess; // MSB or LSB
char* name; // String representation char* name; // String representation
} arch_t; } arch_t;
static const arch_t arch_array[]={ static const arch_t arch_array[]={
@ -5252,7 +5252,7 @@ extern char** environ;
// or -1 on failure (e.g. can't fork a new process). // or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It // Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al. // doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd) { int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
char * argv[4]; char * argv[4];
argv[0] = (char *)"sh"; argv[0] = (char *)"sh";
argv[1] = (char *)"-c"; argv[1] = (char *)"-c";

View file

@ -5254,7 +5254,7 @@ void Parker::unpark() {
// Run the specified command in a separate process. Return its exit value, // Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't create a new process). // or -1 on failure (e.g. can't create a new process).
int os::fork_and_exec(char* cmd) { int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
STARTUPINFO si; STARTUPINFO si;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
DWORD exit_code; DWORD exit_code;

View file

@ -42,10 +42,51 @@ frame JavaThread::pd_last_frame() {
} }
bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) { bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) {
ucontext_t* uc = (ucontext_t*) ucontext; assert(this->is_Java_thread(), "must be JavaThread");
*fr_addr = frame((intptr_t*)uc->uc_mcontext.gregs[15/*REG_SP*/],
// If we have a last_Java_frame, then we should use it even if
// isInJava == true. It should be more reliable than ucontext info.
if (has_last_Java_frame() && frame_anchor()->walkable()) {
*fr_addr = pd_last_frame();
return true;
}
if (isInJava) {
ucontext_t* uc = (ucontext_t*) ucontext;
frame ret_frame((intptr_t*)uc->uc_mcontext.gregs[15/*Z_SP*/],
(address)uc->uc_mcontext.psw.addr); (address)uc->uc_mcontext.psw.addr);
return true;
if (ret_frame.pc() == NULL) {
// ucontext wasn't useful
return false;
}
if (ret_frame.is_interpreted_frame()) {
frame::z_ijava_state* istate = ret_frame.ijava_state_unchecked();
if (!((Method*)(istate->method))->is_metaspace_object()) {
return false;
}
uint64_t reg_bcp = uc->uc_mcontext.gregs[13/*Z_BCP*/];
uint64_t istate_bcp = istate->bcp;
uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
if (istate_bcp >= code_start && istate_bcp < code_end) {
// we have a valid bcp, don't touch it, do nothing
} else if (reg_bcp >= code_start && reg_bcp < code_end) {
istate->bcp = reg_bcp;
} else {
return false;
}
}
if (!ret_frame.safe_for_sender(this)) {
// nothing else to try if the frame isn't good
return false;
}
*fr_addr = ret_frame;
return true;
}
// nothing else to try
return false;
} }
// Forte Analyzer AsyncGetCallTrace profiling support is not implemented on Linux/S390x. // Forte Analyzer AsyncGetCallTrace profiling support is not implemented on Linux/S390x.

View file

@ -54,6 +54,16 @@
"std %0, %1\n" "std %0, %1\n"
: "=&f"(tmp), "=Q"(*(volatile double*)dst) : "=&f"(tmp), "=Q"(*(volatile double*)dst)
: "Q"(*(volatile double*)src)); : "Q"(*(volatile double*)src));
#elif defined(__ARM_ARCH_7A__)
// Note that a ldrexd + clrex combination is only needed for
// correctness on the OS level (context-switches). In this
// case, clrex *may* be beneficial for performance. For now
// don't bother with clrex as this is Zero.
jlong tmp;
asm volatile ("ldrexd %0, [%1]\n"
: "=r"(tmp)
: "r"(src), "m"(src));
*(jlong *) dst = tmp;
#else #else
*(jlong *) dst = *(const jlong *) src; *(jlong *) dst = *(const jlong *) src;
#endif #endif

View file

@ -436,14 +436,19 @@ void AOTCodeHeap::link_graal_runtime_symbols() {
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_instance", address, JVMCIRuntime::new_instance); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_instance", address, JVMCIRuntime::new_instance);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_array", address, JVMCIRuntime::new_array); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_array", address, JVMCIRuntime::new_array);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_multi_array", address, JVMCIRuntime::new_multi_array); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_multi_array", address, JVMCIRuntime::new_multi_array);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_instance", address, JVMCIRuntime::dynamic_new_instance);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_array", address, JVMCIRuntime::dynamic_new_array); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_array", address, JVMCIRuntime::dynamic_new_array);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_instance_or_null", address, JVMCIRuntime::new_instance_or_null);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_array_or_null", address, JVMCIRuntime::new_array_or_null);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_multi_array_or_null", address, JVMCIRuntime::new_multi_array_or_null);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_instance_or_null", address, JVMCIRuntime::dynamic_new_instance_or_null);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_array_or_null", address, JVMCIRuntime::dynamic_new_array_or_null);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_validate_object", address, JVMCIRuntime::validate_object); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_validate_object", address, JVMCIRuntime::validate_object);
#if INCLUDE_G1GC #if INCLUDE_G1GC
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_write_barrier_pre", address, JVMCIRuntime::write_barrier_pre); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_write_barrier_pre", address, JVMCIRuntime::write_barrier_pre);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_write_barrier_post", address, JVMCIRuntime::write_barrier_post); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_write_barrier_post", address, JVMCIRuntime::write_barrier_post);
#endif #endif
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_identity_hash_code", address, JVMCIRuntime::identity_hash_code); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_identity_hash_code", address, JVMCIRuntime::identity_hash_code);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_instance", address, JVMCIRuntime::dynamic_new_instance);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_thread_is_interrupted", address, JVMCIRuntime::thread_is_interrupted); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_thread_is_interrupted", address, JVMCIRuntime::thread_is_interrupted);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_exception_handler_for_pc", address, JVMCIRuntime::exception_handler_for_pc); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_exception_handler_for_pc", address, JVMCIRuntime::exception_handler_for_pc);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_test_deoptimize_call_int", address, JVMCIRuntime::test_deoptimize_call_int); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_test_deoptimize_call_int", address, JVMCIRuntime::test_deoptimize_call_int);
@ -735,6 +740,14 @@ bool AOTCodeHeap::load_klass_data(InstanceKlass* ik, Thread* thread) {
NOT_PRODUCT( klasses_seen++; ) NOT_PRODUCT( klasses_seen++; )
// AOT does not support custom class loaders.
ClassLoaderData* cld = ik->class_loader_data();
if (!cld->is_builtin_class_loader_data()) {
log_trace(aot, class, load)("skip class %s for custom classloader %s (%p) tid=" INTPTR_FORMAT,
ik->internal_name(), cld->loader_name(), cld, p2i(thread));
return false;
}
AOTKlassData* klass_data = find_klass(ik); AOTKlassData* klass_data = find_klass(ik);
if (klass_data == NULL) { if (klass_data == NULL) {
return false; return false;
@ -759,9 +772,10 @@ bool AOTCodeHeap::load_klass_data(InstanceKlass* ik, Thread* thread) {
assert(klass_data->_class_id < _class_count, "invalid class id"); assert(klass_data->_class_id < _class_count, "invalid class id");
AOTClass* aot_class = &_classes[klass_data->_class_id]; AOTClass* aot_class = &_classes[klass_data->_class_id];
if (aot_class->_classloader != NULL && aot_class->_classloader != ik->class_loader_data()) { ClassLoaderData* aot_cld = aot_class->_classloader;
log_trace(aot, class, load)("class %s in %s already loaded for classloader %p vs %p tid=" INTPTR_FORMAT, if (aot_cld != NULL && aot_cld != cld) {
ik->internal_name(), _lib->name(), aot_class->_classloader, ik->class_loader_data(), p2i(thread)); log_trace(aot, class, load)("class %s in %s already loaded for classloader %s (%p) vs %s (%p) tid=" INTPTR_FORMAT,
ik->internal_name(), _lib->name(), aot_cld->loader_name(), aot_cld, cld->loader_name(), cld, p2i(thread));
NOT_PRODUCT( aot_klasses_cl_miss++; ) NOT_PRODUCT( aot_klasses_cl_miss++; )
return false; return false;
} }
@ -774,9 +788,9 @@ bool AOTCodeHeap::load_klass_data(InstanceKlass* ik, Thread* thread) {
NOT_PRODUCT( aot_klasses_found++; ) NOT_PRODUCT( aot_klasses_found++; )
log_trace(aot, class, load)("found %s in %s for classloader %p tid=" INTPTR_FORMAT, ik->internal_name(), _lib->name(), ik->class_loader_data(), p2i(thread)); log_trace(aot, class, load)("found %s in %s for classloader %s (%p) tid=" INTPTR_FORMAT, ik->internal_name(), _lib->name(), cld->loader_name(), cld, p2i(thread));
aot_class->_classloader = ik->class_loader_data(); aot_class->_classloader = cld;
// Set klass's Resolve (second) got cell. // Set klass's Resolve (second) got cell.
_klasses_got[klass_data->_got_index] = ik; _klasses_got[klass_data->_got_index] = ik;
if (ik->is_initialized()) { if (ik->is_initialized()) {

View file

@ -135,7 +135,6 @@ PerfCounter* ClassLoader::_sync_JVMFindLoadedClassLockFreeCounter = NULL;
PerfCounter* ClassLoader::_sync_JVMDefineClassLockFreeCounter = NULL; PerfCounter* ClassLoader::_sync_JVMDefineClassLockFreeCounter = NULL;
PerfCounter* ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL; PerfCounter* ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL;
PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = NULL; PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = NULL;
PerfCounter* ClassLoader::_load_instance_class_failCounter = NULL;
GrowableArray<ModuleClassPathList*>* ClassLoader::_patch_mod_entries = NULL; GrowableArray<ModuleClassPathList*>* ClassLoader::_patch_mod_entries = NULL;
GrowableArray<ModuleClassPathList*>* ClassLoader::_exploded_entries = NULL; GrowableArray<ModuleClassPathList*>* ClassLoader::_exploded_entries = NULL;
@ -1604,9 +1603,6 @@ void ClassLoader::initialize() {
NEWPERFEVENTCOUNTER(_unsafe_defineClassCallCounter, SUN_CLS, NEWPERFEVENTCOUNTER(_unsafe_defineClassCallCounter, SUN_CLS,
"unsafeDefineClassCalls"); "unsafeDefineClassCalls");
NEWPERFEVENTCOUNTER(_load_instance_class_failCounter, SUN_CLS,
"loadInstanceClassFailRate");
} }
// lookup zip library entry points // lookup zip library entry points

View file

@ -192,7 +192,6 @@ class ClassLoader: AllStatic {
static PerfCounter* _sync_JNIDefineClassLockFreeCounter; static PerfCounter* _sync_JNIDefineClassLockFreeCounter;
static PerfCounter* _unsafe_defineClassCallCounter; static PerfCounter* _unsafe_defineClassCallCounter;
static PerfCounter* _load_instance_class_failCounter;
// The boot class path consists of 3 ordered pieces: // The boot class path consists of 3 ordered pieces:
// 1. the module/path pairs specified to --patch-module // 1. the module/path pairs specified to --patch-module
@ -340,12 +339,6 @@ class ClassLoader: AllStatic {
return _unsafe_defineClassCallCounter; return _unsafe_defineClassCallCounter;
} }
// Record how many times SystemDictionary::load_instance_class call
// fails with linkageError when Unsyncloadclass flag is set.
static PerfCounter* load_instance_class_failCounter() {
return _load_instance_class_failCounter;
}
// Modular java runtime image is present vs. a build with exploded modules // Modular java runtime image is present vs. a build with exploded modules
static bool has_jrt_entry() { return (_jrt_entry != NULL); } static bool has_jrt_entry() { return (_jrt_entry != NULL); }
static ClassPathEntry* get_jrt_entry() { return _jrt_entry; } static ClassPathEntry* get_jrt_entry() { return _jrt_entry; }

View file

@ -487,6 +487,21 @@ bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
} }
#endif // PRODUCT #endif // PRODUCT
bool ClassLoaderDataGraph::is_valid(ClassLoaderData* loader_data) {
DEBUG_ONLY( if (!VMError::is_error_reported()) { assert_locked_or_safepoint(ClassLoaderDataGraph_lock); } )
if (loader_data != NULL) {
if (loader_data == ClassLoaderData::the_null_class_loader_data()) {
return true;
}
for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
if (loader_data == data) {
return true;
}
}
}
return false;
}
// Move class loader data from main list to the unloaded list for unloading // Move class loader data from main list to the unloaded list for unloading
// and deallocation later. // and deallocation later.
bool ClassLoaderDataGraph::do_unloading(bool do_cleaning) { bool ClassLoaderDataGraph::do_unloading(bool do_cleaning) {

View file

@ -146,6 +146,10 @@ class ClassLoaderDataGraph : public AllStatic {
#ifndef PRODUCT #ifndef PRODUCT
static bool contains_loader_data(ClassLoaderData* loader_data); static bool contains_loader_data(ClassLoaderData* loader_data);
#endif #endif
// Check if ClassLoaderData is part of the ClassLoaderDataGraph (not unloaded)
// Usage without lock only allowed during error reporting.
static bool is_valid(ClassLoaderData* loader_data);
}; };
class LockedClassesDo : public KlassClosure { class LockedClassesDo : public KlassClosure {

View file

@ -174,7 +174,7 @@ void CompactHashtableWriter::dump(SimpleCompactHashtable *cht, const char* table
// The CompactHashtable implementation // The CompactHashtable implementation
// //
void SimpleCompactHashtable::serialize(SerializeClosure* soc) { void SimpleCompactHashtable::serialize_header(SerializeClosure* soc) {
soc->do_ptr((void**)&_base_address); soc->do_ptr((void**)&_base_address);
soc->do_u4(&_entry_count); soc->do_u4(&_entry_count);
soc->do_u4(&_bucket_count); soc->do_u4(&_bucket_count);

View file

@ -123,6 +123,15 @@ private:
public: public:
void dump(SimpleCompactHashtable *cht, const char* table_name); void dump(SimpleCompactHashtable *cht, const char* table_name);
static int default_num_buckets(size_t num_entries) {
return default_num_buckets((int)num_entries);
}
static int default_num_buckets(int num_entries) {
int num_buckets = num_entries / SharedSymbolTableBucketSize;
// calculation of num_buckets can result in zero buckets, we need at least one
return (num_buckets < 1) ? 1 : num_buckets;
}
}; };
#endif // INCLUDE_CDS #endif // INCLUDE_CDS
@ -213,8 +222,8 @@ public:
_entries = entries; _entries = entries;
} }
// For reading from/writing to the CDS archive // Read/Write the table's header from/to the CDS archive
void serialize(SerializeClosure* soc) NOT_CDS_RETURN; void serialize_header(SerializeClosure* soc) NOT_CDS_RETURN;
inline bool empty() { inline bool empty() {
return (_entry_count == 0); return (_entry_count == 0);

View file

@ -36,8 +36,9 @@
#include "interpreter/linkResolver.hpp" #include "interpreter/linkResolver.hpp"
#include "logging/log.hpp" #include "logging/log.hpp"
#include "logging/logStream.hpp" #include "logging/logStream.hpp"
#include "memory/heapShared.inline.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/oopFactory.hpp" #include "memory/oopFactory.hpp"
#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "memory/universe.hpp" #include "memory/universe.hpp"
#include "oops/fieldStreams.hpp" #include "oops/fieldStreams.hpp"
@ -750,7 +751,7 @@ static void initialize_static_field(fieldDescriptor* fd, Handle mirror, TRAPS) {
{ {
assert(fd->signature() == vmSymbols::string_signature(), assert(fd->signature() == vmSymbols::string_signature(),
"just checking"); "just checking");
if (DumpSharedSpaces && MetaspaceShared::is_archive_object(mirror())) { if (DumpSharedSpaces && HeapShared::is_archived_object(mirror())) {
// Archive the String field and update the pointer. // Archive the String field and update the pointer.
oop s = mirror()->obj_field(fd->offset()); oop s = mirror()->obj_field(fd->offset());
oop archived_s = StringTable::create_archived_string(s, CHECK); oop archived_s = StringTable::create_archived_string(s, CHECK);
@ -788,7 +789,7 @@ void java_lang_Class::fixup_mirror(Klass* k, TRAPS) {
} }
if (k->is_shared() && k->has_raw_archived_mirror()) { if (k->is_shared() && k->has_raw_archived_mirror()) {
if (MetaspaceShared::open_archive_heap_region_mapped()) { if (HeapShared::open_archive_heap_region_mapped()) {
bool present = restore_archived_mirror(k, Handle(), Handle(), Handle(), CHECK); bool present = restore_archived_mirror(k, Handle(), Handle(), Handle(), CHECK);
assert(present, "Missing archived mirror for %s", k->external_name()); assert(present, "Missing archived mirror for %s", k->external_name());
return; return;
@ -1011,14 +1012,14 @@ class ResetMirrorField: public FieldClosure {
}; };
void java_lang_Class::archive_basic_type_mirrors(TRAPS) { void java_lang_Class::archive_basic_type_mirrors(TRAPS) {
assert(MetaspaceShared::is_heap_object_archiving_allowed(), assert(HeapShared::is_heap_object_archiving_allowed(),
"MetaspaceShared::is_heap_object_archiving_allowed() must be true"); "HeapShared::is_heap_object_archiving_allowed() must be true");
for (int t = 0; t <= T_VOID; t++) { for (int t = 0; t <= T_VOID; t++) {
oop m = Universe::_mirrors[t]; oop m = Universe::_mirrors[t];
if (m != NULL) { if (m != NULL) {
// Update the field at _array_klass_offset to point to the relocated array klass. // Update the field at _array_klass_offset to point to the relocated array klass.
oop archived_m = MetaspaceShared::archive_heap_object(m, THREAD); oop archived_m = HeapShared::archive_heap_object(m, THREAD);
assert(archived_m != NULL, "sanity"); assert(archived_m != NULL, "sanity");
Klass *ak = (Klass*)(archived_m->metadata_field(_array_klass_offset)); Klass *ak = (Klass*)(archived_m->metadata_field(_array_klass_offset));
assert(ak != NULL || t == T_VOID, "should not be NULL"); assert(ak != NULL || t == T_VOID, "should not be NULL");
@ -1071,8 +1072,8 @@ void java_lang_Class::archive_basic_type_mirrors(TRAPS) {
// be used at runtime, new mirror object is created for the shared // be used at runtime, new mirror object is created for the shared
// class. The _has_archived_raw_mirror is cleared also during the process. // class. The _has_archived_raw_mirror is cleared also during the process.
oop java_lang_Class::archive_mirror(Klass* k, TRAPS) { oop java_lang_Class::archive_mirror(Klass* k, TRAPS) {
assert(MetaspaceShared::is_heap_object_archiving_allowed(), assert(HeapShared::is_heap_object_archiving_allowed(),
"MetaspaceShared::is_heap_object_archiving_allowed() must be true"); "HeapShared::is_heap_object_archiving_allowed() must be true");
// Mirror is already archived // Mirror is already archived
if (k->has_raw_archived_mirror()) { if (k->has_raw_archived_mirror()) {
@ -1101,7 +1102,7 @@ oop java_lang_Class::archive_mirror(Klass* k, TRAPS) {
} }
// Now start archiving the mirror object // Now start archiving the mirror object
oop archived_mirror = MetaspaceShared::archive_heap_object(mirror, THREAD); oop archived_mirror = HeapShared::archive_heap_object(mirror, THREAD);
if (archived_mirror == NULL) { if (archived_mirror == NULL) {
return NULL; return NULL;
} }
@ -1139,7 +1140,7 @@ oop java_lang_Class::process_archived_mirror(Klass* k, oop mirror,
if (k->is_typeArray_klass()) { if (k->is_typeArray_klass()) {
// The primitive type mirrors are already archived. Get the archived mirror. // The primitive type mirrors are already archived. Get the archived mirror.
oop comp_mirror = java_lang_Class::component_mirror(mirror); oop comp_mirror = java_lang_Class::component_mirror(mirror);
archived_comp_mirror = MetaspaceShared::find_archived_heap_object(comp_mirror); archived_comp_mirror = HeapShared::find_archived_heap_object(comp_mirror);
assert(archived_comp_mirror != NULL, "Must be"); assert(archived_comp_mirror != NULL, "Must be");
} else { } else {
assert(k->is_objArray_klass(), "Must be"); assert(k->is_objArray_klass(), "Must be");
@ -1202,7 +1203,7 @@ bool java_lang_Class::restore_archived_mirror(Klass *k,
return true; return true;
} }
oop m = MetaspaceShared::materialize_archived_object(k->archived_java_mirror_raw_narrow()); oop m = HeapShared::materialize_archived_object(k->archived_java_mirror_raw_narrow());
if (m == NULL) { if (m == NULL) {
return false; return false;
@ -1211,7 +1212,7 @@ bool java_lang_Class::restore_archived_mirror(Klass *k,
log_debug(cds, mirror)("Archived mirror is: " PTR_FORMAT, p2i(m)); log_debug(cds, mirror)("Archived mirror is: " PTR_FORMAT, p2i(m));
// mirror is archived, restore // mirror is archived, restore
assert(MetaspaceShared::is_archive_object(m), "must be archived mirror object"); assert(HeapShared::is_archived_object(m), "must be archived mirror object");
Handle mirror(THREAD, m); Handle mirror(THREAD, m);
if (!k->is_array_klass()) { if (!k->is_array_klass()) {

View file

@ -36,7 +36,6 @@
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "memory/filemap.hpp" #include "memory/filemap.hpp"
#include "memory/heapShared.inline.hpp" #include "memory/heapShared.inline.hpp"
#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "memory/universe.hpp" #include "memory/universe.hpp"
#include "oops/access.inline.hpp" #include "oops/access.inline.hpp"
@ -798,18 +797,17 @@ oop StringTable::lookup_shared(const jchar* name, int len, unsigned int hash) {
oop StringTable::create_archived_string(oop s, Thread* THREAD) { oop StringTable::create_archived_string(oop s, Thread* THREAD) {
assert(DumpSharedSpaces, "this function is only used with -Xshare:dump"); assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
if (MetaspaceShared::is_archive_object(s)) { if (HeapShared::is_archived_object(s)) {
return s; return s;
} }
oop new_s = NULL; oop new_s = NULL;
typeArrayOop v = java_lang_String::value_no_keepalive(s); typeArrayOop v = java_lang_String::value_no_keepalive(s);
typeArrayOop new_v = typeArrayOop new_v = (typeArrayOop)HeapShared::archive_heap_object(v, THREAD);
(typeArrayOop)MetaspaceShared::archive_heap_object(v, THREAD);
if (new_v == NULL) { if (new_v == NULL) {
return NULL; return NULL;
} }
new_s = MetaspaceShared::archive_heap_object(s, THREAD); new_s = HeapShared::archive_heap_object(s, THREAD);
if (new_s == NULL) { if (new_s == NULL) {
return NULL; return NULL;
} }
@ -819,18 +817,9 @@ oop StringTable::create_archived_string(oop s, Thread* THREAD) {
return new_s; return new_s;
} }
class CompactStringTableWriter: public CompactHashtableWriter {
public:
CompactStringTableWriter(int num_entries, CompactHashtableStats* stats) :
CompactHashtableWriter(num_entries, stats) {}
void add(unsigned int hash, oop string) {
CompactHashtableWriter::add(hash, CompressedOops::encode(string));
}
};
struct CopyToArchive : StackObj { struct CopyToArchive : StackObj {
CompactStringTableWriter* _writer; CompactHashtableWriter* _writer;
CopyToArchive(CompactStringTableWriter* writer) : _writer(writer) {} CopyToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
bool operator()(WeakHandle<vm_string_table_data>* val) { bool operator()(WeakHandle<vm_string_table_data>* val) {
oop s = val->peek(); oop s = val->peek();
if (s == NULL) { if (s == NULL) {
@ -838,6 +827,7 @@ struct CopyToArchive : StackObj {
} }
unsigned int hash = java_lang_String::hash_code(s); unsigned int hash = java_lang_String::hash_code(s);
if (hash == 0) { if (hash == 0) {
// We do not archive Strings with a 0 hashcode because ......
return true; return true;
} }
@ -849,34 +839,34 @@ struct CopyToArchive : StackObj {
val->replace(new_s); val->replace(new_s);
// add to the compact table // add to the compact table
_writer->add(hash, new_s); _writer->add(hash, CompressedOops::encode(new_s));
return true; return true;
} }
}; };
void StringTable::copy_shared_string_table(CompactStringTableWriter* writer) { void StringTable::copy_shared_string_table(CompactHashtableWriter* writer) {
assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be"); assert(HeapShared::is_heap_object_archiving_allowed(), "must be");
CopyToArchive copy(writer); CopyToArchive copy(writer);
StringTable::the_table()->_local_table->do_scan(Thread::current(), copy); StringTable::the_table()->_local_table->do_scan(Thread::current(), copy);
} }
void StringTable::write_to_archive() { void StringTable::write_to_archive() {
assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be"); assert(HeapShared::is_heap_object_archiving_allowed(), "must be");
_shared_table.reset(); _shared_table.reset();
int num_buckets = the_table()->_items_count / SharedSymbolTableBucketSize; int num_buckets = CompactHashtableWriter::default_num_buckets(
// calculation of num_buckets can result in zero buckets, we need at least one StringTable::the_table()->_items_count);
CompactStringTableWriter writer(num_buckets > 1 ? num_buckets : 1, CompactHashtableWriter writer(num_buckets,
&MetaspaceShared::stats()->string); &MetaspaceShared::stats()->string);
// Copy the interned strings into the "string space" within the java heap // Copy the interned strings into the "string space" within the java heap
copy_shared_string_table(&writer); copy_shared_string_table(&writer);
writer.dump(&_shared_table, "string"); writer.dump(&_shared_table, "string");
} }
void StringTable::serialize(SerializeClosure* soc) { void StringTable::serialize_shared_table_header(SerializeClosure* soc) {
_shared_table.serialize(soc); _shared_table.serialize_header(soc);
if (soc->writing()) { if (soc->writing()) {
// Sanity. Make sure we don't use the shared table at dump time // Sanity. Make sure we don't use the shared table at dump time

View file

@ -33,7 +33,7 @@
#include "oops/weakHandle.hpp" #include "oops/weakHandle.hpp"
#include "utilities/concurrentHashTable.hpp" #include "utilities/concurrentHashTable.hpp"
class CompactStringTableWriter; class CompactHashtableWriter;
class SerializeClosure; class SerializeClosure;
class StringTable; class StringTable;
@ -163,14 +163,14 @@ private:
// Sharing // Sharing
private: private:
oop lookup_shared(const jchar* name, int len, unsigned int hash) NOT_CDS_JAVA_HEAP_RETURN_(NULL); oop lookup_shared(const jchar* name, int len, unsigned int hash) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
static void copy_shared_string_table(CompactStringTableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN; static void copy_shared_string_table(CompactHashtableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN;
public: public:
static oop create_archived_string(oop s, Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN_(NULL); static oop create_archived_string(oop s, Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
static void set_shared_string_mapped() { _shared_string_mapped = true; } static void set_shared_string_mapped() { _shared_string_mapped = true; }
static bool shared_string_mapped() { return _shared_string_mapped; } static bool shared_string_mapped() { return _shared_string_mapped; }
static void shared_oops_do(OopClosure* f) NOT_CDS_JAVA_HEAP_RETURN; static void shared_oops_do(OopClosure* f) NOT_CDS_JAVA_HEAP_RETURN;
static void write_to_archive() NOT_CDS_JAVA_HEAP_RETURN; static void write_to_archive() NOT_CDS_JAVA_HEAP_RETURN;
static void serialize(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN; static void serialize_shared_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
// Jcmd // Jcmd
static void dump(outputStream* st, bool verbose=false); static void dump(outputStream* st, bool verbose=false);

View file

@ -627,43 +627,31 @@ void SymbolTable::dump(outputStream* st, bool verbose) {
} }
#if INCLUDE_CDS #if INCLUDE_CDS
class CompactSymbolTableWriter: public CompactHashtableWriter { struct CopyToArchive : StackObj {
public: CompactHashtableWriter* _writer;
CompactSymbolTableWriter(int num_buckets, CompactHashtableStats* stats) : CopyToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
CompactHashtableWriter(num_buckets, stats) {} bool operator()(Symbol** value) {
void add(unsigned int hash, Symbol *symbol) { assert(value != NULL, "expected valid value");
uintx deltax = MetaspaceShared::object_delta(symbol); assert(*value != NULL, "value should point to a symbol");
Symbol* sym = *value;
unsigned int fixed_hash = hash_shared_symbol((const char*)sym->bytes(), sym->utf8_length());
assert(fixed_hash == hash_symbol((const char*)sym->bytes(), sym->utf8_length(), false),
"must not rehash during dumping");
uintx deltax = MetaspaceShared::object_delta(sym);
// When the symbols are stored into the archive, we already check that // When the symbols are stored into the archive, we already check that
// they won't be more than MAX_SHARED_DELTA from the base address, or // they won't be more than MAX_SHARED_DELTA from the base address, or
// else the dumping would have been aborted. // else the dumping would have been aborted.
assert(deltax <= MAX_SHARED_DELTA, "must not be"); assert(deltax <= MAX_SHARED_DELTA, "must not be");
u4 delta = u4(deltax); u4 delta = u4(deltax);
CompactHashtableWriter::add(hash, delta);
}
};
struct CopyToArchive : StackObj {
CompactSymbolTableWriter* _writer;
CopyToArchive(CompactSymbolTableWriter* writer) : _writer(writer) {}
bool operator()(Symbol** value) {
assert(value != NULL, "expected valid value");
assert(*value != NULL, "value should point to a symbol");
Symbol* sym = *value;
unsigned int fixed_hash = hash_shared_symbol((const char*)sym->bytes(), sym->utf8_length());
if (fixed_hash == 0) {
return true;
}
assert(fixed_hash == hash_symbol((const char*)sym->bytes(), sym->utf8_length(), false),
"must not rehash during dumping");
// add to the compact table // add to the compact table
_writer->add(fixed_hash, sym); _writer->add(fixed_hash, delta);
return true; return true;
} }
}; };
void SymbolTable::copy_shared_symbol_table(CompactSymbolTableWriter* writer) { void SymbolTable::copy_shared_symbol_table(CompactHashtableWriter* writer) {
CopyToArchive copy(writer); CopyToArchive copy(writer);
SymbolTable::the_table()->_local_table->do_scan(Thread::current(), copy); SymbolTable::the_table()->_local_table->do_scan(Thread::current(), copy);
} }
@ -671,10 +659,10 @@ void SymbolTable::copy_shared_symbol_table(CompactSymbolTableWriter* writer) {
void SymbolTable::write_to_archive() { void SymbolTable::write_to_archive() {
_shared_table.reset(); _shared_table.reset();
int num_buckets = (int)(SymbolTable::the_table()->_items_count / SharedSymbolTableBucketSize); int num_buckets = CompactHashtableWriter::default_num_buckets(
// calculation of num_buckets can result in zero buckets, we need at least one SymbolTable::the_table()->_items_count);
CompactSymbolTableWriter writer(num_buckets > 1 ? num_buckets : 1, CompactHashtableWriter writer(num_buckets,
&MetaspaceShared::stats()->symbol); &MetaspaceShared::stats()->symbol);
copy_shared_symbol_table(&writer); copy_shared_symbol_table(&writer);
writer.dump(&_shared_table, "symbol"); writer.dump(&_shared_table, "symbol");
@ -686,8 +674,8 @@ void SymbolTable::write_to_archive() {
assert(sym == _shared_table.lookup(name, hash, len), "sanity"); assert(sym == _shared_table.lookup(name, hash, len), "sanity");
} }
void SymbolTable::serialize(SerializeClosure* soc) { void SymbolTable::serialize_shared_table_header(SerializeClosure* soc) {
_shared_table.serialize(soc); _shared_table.serialize_header(soc);
if (soc->writing()) { if (soc->writing()) {
// Sanity. Make sure we don't use the shared table at dump time // Sanity. Make sure we don't use the shared table at dump time

View file

@ -84,7 +84,7 @@ public:
operator Symbol*() { return _temp; } operator Symbol*() { return _temp; }
}; };
class CompactSymbolTableWriter; class CompactHashtableWriter;
class SerializeClosure; class SerializeClosure;
class SymbolTableConfig; class SymbolTableConfig;
@ -240,10 +240,10 @@ public:
// Sharing // Sharing
private: private:
static void copy_shared_symbol_table(CompactSymbolTableWriter* ch_table); static void copy_shared_symbol_table(CompactHashtableWriter* ch_table);
public: public:
static void write_to_archive() NOT_CDS_RETURN; static void write_to_archive() NOT_CDS_RETURN;
static void serialize(SerializeClosure* soc) NOT_CDS_RETURN; static void serialize_shared_table_header(SerializeClosure* soc) NOT_CDS_RETURN;
static void metaspace_pointers_do(MetaspaceClosure* it); static void metaspace_pointers_do(MetaspaceClosure* it);
// Jcmd // Jcmd

View file

@ -52,6 +52,7 @@
#include "logging/log.hpp" #include "logging/log.hpp"
#include "logging/logStream.hpp" #include "logging/logStream.hpp"
#include "memory/filemap.hpp" #include "memory/filemap.hpp"
#include "memory/heapShared.hpp"
#include "memory/metaspaceClosure.hpp" #include "memory/metaspaceClosure.hpp"
#include "memory/oopFactory.hpp" #include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
@ -2037,13 +2038,13 @@ void SystemDictionary::resolve_preloaded_classes(TRAPS) {
// ConstantPool::restore_unshareable_info (restores the archived // ConstantPool::restore_unshareable_info (restores the archived
// resolved_references array object). // resolved_references array object).
// //
// MetaspaceShared::fixup_mapped_heap_regions() fills the empty // HeapShared::fixup_mapped_heap_regions() fills the empty
// spaces in the archived heap regions and may use // spaces in the archived heap regions and may use
// SystemDictionary::Object_klass(), so we can do this only after // SystemDictionary::Object_klass(), so we can do this only after
// Object_klass is resolved. See the above resolve_wk_klasses_through() // Object_klass is resolved. See the above resolve_wk_klasses_through()
// call. No mirror objects are accessed/restored in the above call. // call. No mirror objects are accessed/restored in the above call.
// Mirrors are restored after java.lang.Class is loaded. // Mirrors are restored after java.lang.Class is loaded.
MetaspaceShared::fixup_mapped_heap_regions(); HeapShared::fixup_mapped_heap_regions();
// Initialize the constant pool for the Object_class // Initialize the constant pool for the Object_class
Object_klass()->constants()->restore_unshareable_info(CHECK); Object_klass()->constants()->restore_unshareable_info(CHECK);

View file

@ -111,7 +111,7 @@ bool VerificationType::is_reference_assignable_from(
VerificationType comp_from = from.get_component(context, CHECK_false); VerificationType comp_from = from.get_component(context, CHECK_false);
if (!comp_this.is_bogus() && !comp_from.is_bogus()) { if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
return comp_this.is_component_assignable_from(comp_from, context, return comp_this.is_component_assignable_from(comp_from, context,
from_field_is_protected, CHECK_false); from_field_is_protected, THREAD);
} }
} }
return false; return false;

View file

@ -312,7 +312,7 @@ class VerificationType {
case Short: case Short:
return false; return false;
default: default:
return is_assignable_from(from, context, from_field_is_protected, CHECK_false); return is_assignable_from(from, context, from_field_is_protected, THREAD);
} }
} }
} }

View file

@ -26,7 +26,9 @@
#include "jvm.h" #include "jvm.h"
#include "code/codeBlob.hpp" #include "code/codeBlob.hpp"
#include "code/codeCache.hpp" #include "code/codeCache.hpp"
#include "code/icBuffer.hpp"
#include "code/relocInfo.hpp" #include "code/relocInfo.hpp"
#include "code/vtableStubs.hpp"
#include "compiler/disassembler.hpp" #include "compiler/disassembler.hpp"
#include "interpreter/bytecode.hpp" #include "interpreter/bytecode.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
@ -559,6 +561,67 @@ void CodeBlob::print_value_on(outputStream* st) const {
st->print_cr("[CodeBlob]"); st->print_cr("[CodeBlob]");
} }
void CodeBlob::dump_for_addr(address addr, outputStream* st, bool verbose) const {
if (is_buffer_blob()) {
// the interpreter is generated into a buffer blob
InterpreterCodelet* i = Interpreter::codelet_containing(addr);
if (i != NULL) {
st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", p2i(addr), (int)(addr - i->code_begin()));
i->print_on(st);
return;
}
if (Interpreter::contains(addr)) {
st->print_cr(INTPTR_FORMAT " is pointing into interpreter code"
" (not bytecode specific)", p2i(addr));
return;
}
//
if (AdapterHandlerLibrary::contains(this)) {
st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an AdapterHandler", p2i(addr), (int)(addr - code_begin()));
AdapterHandlerLibrary::print_handler_on(st, this);
}
// the stubroutines are generated into a buffer blob
StubCodeDesc* d = StubCodeDesc::desc_for(addr);
if (d != NULL) {
st->print_cr(INTPTR_FORMAT " is at begin+%d in a stub", p2i(addr), (int)(addr - d->begin()));
d->print_on(st);
st->cr();
return;
}
if (StubRoutines::contains(addr)) {
st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) stub routine", p2i(addr));
return;
}
// the InlineCacheBuffer is using stubs generated into a buffer blob
if (InlineCacheBuffer::contains(addr)) {
st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", p2i(addr));
return;
}
VtableStub* v = VtableStubs::stub_containing(addr);
if (v != NULL) {
st->print_cr(INTPTR_FORMAT " is at entry_point+%d in a vtable stub", p2i(addr), (int)(addr - v->entry_point()));
v->print_on(st);
st->cr();
return;
}
}
if (is_nmethod()) {
nmethod* nm = (nmethod*)this;
ResourceMark rm;
st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT,
p2i(addr), (int)(addr - nm->entry_point()), p2i(nm));
if (verbose) {
st->print(" for ");
nm->method()->print_value_on(st);
}
st->cr();
nm->print_nmethod(verbose);
return;
}
st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", p2i(addr), (int)(addr - code_begin()));
print_on(st);
}
void RuntimeBlob::verify() { void RuntimeBlob::verify() {
ShouldNotReachHere(); ShouldNotReachHere();
} }

View file

@ -221,6 +221,7 @@ public:
virtual void print() const { print_on(tty); }; virtual void print() const { print_on(tty); };
virtual void print_on(outputStream* st) const; virtual void print_on(outputStream* st) const;
virtual void print_value_on(outputStream* st) const; virtual void print_value_on(outputStream* st) const;
void dump_for_addr(address addr, outputStream* st, bool verbose) const;
void print_code(); void print_code();
// Print the comment associated with offset on stream, if there is one // Print the comment associated with offset on stream, if there is one

View file

@ -2340,7 +2340,7 @@ void nmethod::print_recorded_oops() {
for (int i = 0; i < oops_count(); i++) { for (int i = 0; i < oops_count(); i++) {
oop o = oop_at(i); oop o = oop_at(i);
tty->print("#%3d: " INTPTR_FORMAT " ", i, p2i(o)); tty->print("#%3d: " INTPTR_FORMAT " ", i, p2i(o));
if (o == (oop)Universe::non_oop_word()) { if (o == Universe::non_oop_word()) {
tty->print("non-oop word"); tty->print("non-oop word");
} else { } else {
if (o != NULL) { if (o != NULL) {

View file

@ -574,7 +574,7 @@ oop* oop_Relocation::oop_addr() {
oop oop_Relocation::oop_value() { oop oop_Relocation::oop_value() {
oop v = *oop_addr(); oop v = *oop_addr();
// clean inline caches store a special pseudo-null // clean inline caches store a special pseudo-null
if (v == (oop)Universe::non_oop_word()) v = NULL; if (v == Universe::non_oop_word()) v = NULL;
return v; return v;
} }

View file

@ -1781,30 +1781,31 @@ void CompileBroker::compiler_thread_loop() {
return; // Stop this thread. return; // Stop this thread.
} }
} }
continue; } else {
} // Assign the task to the current thread. Mark this compilation
// thread as active for the profiler.
// CompileTaskWrapper also keeps the Method* from being deallocated if redefinition
// occurs after fetching the compile task off the queue.
CompileTaskWrapper ctw(task);
nmethodLocker result_handle; // (handle for the nmethod produced by this task)
task->set_code_handle(&result_handle);
methodHandle method(thread, task->method());
if (UseDynamicNumberOfCompilerThreads) { // Never compile a method if breakpoints are present in it
possibly_add_compiler_threads(); if (method()->number_of_breakpoints() == 0) {
} // Compile the method.
if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
invoke_compiler_on_method(task);
thread->start_idle_timer();
} else {
// After compilation is disabled, remove remaining methods from queue
method->clear_queued_for_compilation();
task->set_failure_reason("compilation is disabled");
}
}
// Assign the task to the current thread. Mark this compilation if (UseDynamicNumberOfCompilerThreads) {
// thread as active for the profiler. possibly_add_compiler_threads();
CompileTaskWrapper ctw(task);
nmethodLocker result_handle; // (handle for the nmethod produced by this task)
task->set_code_handle(&result_handle);
methodHandle method(thread, task->method());
// Never compile a method if breakpoints are present in it
if (method()->number_of_breakpoints() == 0) {
// Compile the method.
if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
invoke_compiler_on_method(task);
thread->start_idle_timer();
} else {
// After compilation is disabled, remove remaining methods from queue
method->clear_queued_for_compilation();
task->set_failure_reason("compilation is disabled");
} }
} }
} }

View file

@ -350,7 +350,7 @@ void OopMapSet::all_do(const frame *fr, const RegisterMap *reg_map,
// implicit null check is used in compiled code. // implicit null check is used in compiled code.
// The narrow_oop_base could be NULL or be the address // The narrow_oop_base could be NULL or be the address
// of the page below heap depending on compressed oops mode. // of the page below heap depending on compressed oops mode.
if (base_loc != NULL && *base_loc != (oop)NULL && !Universe::is_narrow_oop_base(*base_loc)) { if (base_loc != NULL && *base_loc != NULL && !Universe::is_narrow_oop_base(*base_loc)) {
derived_oop_fn(base_loc, derived_loc); derived_oop_fn(base_loc, derived_loc);
} }
oms.next(); oms.next();
@ -371,7 +371,7 @@ void OopMapSet::all_do(const frame *fr, const RegisterMap *reg_map,
guarantee(loc != NULL, "missing saved register"); guarantee(loc != NULL, "missing saved register");
if ( omv.type() == OopMapValue::oop_value ) { if ( omv.type() == OopMapValue::oop_value ) {
oop val = *loc; oop val = *loc;
if (val == (oop)NULL || Universe::is_narrow_oop_base(val)) { if (val == NULL || Universe::is_narrow_oop_base(val)) {
// Ignore NULL oops and decoded NULL narrow oops which // Ignore NULL oops and decoded NULL narrow oops which
// equal to Universe::narrow_oop_base when a narrow oop // equal to Universe::narrow_oop_base when a narrow oop
// implicit null check is used in compiled code. // implicit null check is used in compiled code.
@ -769,7 +769,7 @@ void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop"); assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop");
assert(derived_loc != base_loc, "Base and derived in same location"); assert(derived_loc != base_loc, "Base and derived in same location");
if (_active) { if (_active) {
assert(*derived_loc != (oop)base_loc, "location already added"); assert(*derived_loc != (void*)base_loc, "location already added");
assert(_list != NULL, "list must exist"); assert(_list != NULL, "list must exist");
intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc); intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc);
// This assert is invalid because derived pointers can be // This assert is invalid because derived pointers can be

View file

@ -118,6 +118,8 @@ EpsilonHeap* EpsilonHeap::heap() {
} }
HeapWord* EpsilonHeap::allocate_work(size_t size) { HeapWord* EpsilonHeap::allocate_work(size_t size) {
assert(is_object_aligned(size), "Allocation size should be aligned: " SIZE_FORMAT, size);
HeapWord* res = _space->par_allocate(size); HeapWord* res = _space->par_allocate(size);
while (res == NULL) { while (res == NULL) {
@ -168,6 +170,7 @@ HeapWord* EpsilonHeap::allocate_work(size_t size) {
} }
} }
assert(is_object_aligned(res), "Object should be aligned: " PTR_FORMAT, p2i(res));
return res; return res;
} }
@ -211,6 +214,9 @@ HeapWord* EpsilonHeap::allocate_new_tlab(size_t min_size,
// Always honor boundaries // Always honor boundaries
size = MAX2(min_size, MIN2(_max_tlab_size, size)); size = MAX2(min_size, MIN2(_max_tlab_size, size));
// Always honor alignment
size = align_up(size, MinObjAlignment);
if (log_is_enabled(Trace, gc)) { if (log_is_enabled(Trace, gc)) {
ResourceMark rm; ResourceMark rm;
log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT

View file

@ -270,7 +270,7 @@ public:
// Check if the object is in open archive // Check if the object is in open archive
static inline bool is_open_archive_object(oop object); static inline bool is_open_archive_object(oop object);
// Check if the object is either in closed archive or open archive // Check if the object is either in closed archive or open archive
static inline bool is_archive_object(oop object); static inline bool is_archived_object(oop object);
private: private:
static bool _archive_check_enabled; static bool _archive_check_enabled;

View file

@ -141,7 +141,7 @@ inline bool G1ArchiveAllocator::is_open_archive_object(oop object) {
return (archive_check_enabled() && in_open_archive_range(object)); return (archive_check_enabled() && in_open_archive_range(object));
} }
inline bool G1ArchiveAllocator::is_archive_object(oop object) { inline bool G1ArchiveAllocator::is_archived_object(oop object) {
return (archive_check_enabled() && (in_closed_archive_range(object) || return (archive_check_enabled() && (in_closed_archive_range(object) ||
in_open_archive_range(object))); in_open_archive_range(object)));
} }

View file

@ -80,7 +80,6 @@
#include "logging/log.hpp" #include "logging/log.hpp"
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
#include "memory/iterator.hpp" #include "memory/iterator.hpp"
#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp" #include "oops/access.inline.hpp"
#include "oops/compressedOops.inline.hpp" #include "oops/compressedOops.inline.hpp"
@ -827,7 +826,7 @@ void G1CollectedHeap::dealloc_archive_regions(MemRegion* ranges, size_t count) {
oop G1CollectedHeap::materialize_archived_object(oop obj) { oop G1CollectedHeap::materialize_archived_object(oop obj) {
assert(obj != NULL, "archived obj is NULL"); assert(obj != NULL, "archived obj is NULL");
assert(MetaspaceShared::is_archive_object(obj), "must be archived object"); assert(G1ArchiveAllocator::is_archived_object(obj), "must be archived object");
// Loading an archived object makes it strongly reachable. If it is // Loading an archived object makes it strongly reachable. If it is
// loaded during concurrent marking, it must be enqueued to the SATB // loaded during concurrent marking, it must be enqueued to the SATB

View file

@ -68,7 +68,7 @@ template <class T> inline void G1AdjustClosure::adjust_pointer(T* p) {
oop obj = CompressedOops::decode_not_null(heap_oop); oop obj = CompressedOops::decode_not_null(heap_oop);
assert(Universe::heap()->is_in(obj), "should be in heap"); assert(Universe::heap()->is_in(obj), "should be in heap");
if (G1ArchiveAllocator::is_archive_object(obj)) { if (G1ArchiveAllocator::is_archived_object(obj)) {
// We never forward archive objects. // We never forward archive objects.
return; return;
} }

View file

@ -248,7 +248,7 @@ public:
oop obj = RawAccess<>::oop_load(p); oop obj = RawAccess<>::oop_load(p);
if (_hr->is_open_archive()) { if (_hr->is_open_archive()) {
guarantee(obj == NULL || G1ArchiveAllocator::is_archive_object(obj), guarantee(obj == NULL || G1ArchiveAllocator::is_archived_object(obj),
"Archive object at " PTR_FORMAT " references a non-archive object at " PTR_FORMAT, "Archive object at " PTR_FORMAT " references a non-archive object at " PTR_FORMAT,
p2i(p), p2i(obj)); p2i(p), p2i(obj));
} else { } else {

View file

@ -35,6 +35,7 @@
#include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTimer.hpp"
#include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/gcTraceTime.inline.hpp"
#include "logging/log.hpp" #include "logging/log.hpp"
#include "memory/iterator.inline.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "memory/universe.hpp" #include "memory/universe.hpp"
#include "oops/objArrayKlass.inline.hpp" #include "oops/objArrayKlass.inline.hpp"
@ -58,7 +59,7 @@ void ThreadRootsMarkingTask::do_it(GCTaskManager* manager, uint which) {
ParCompactionManager* cm = ParCompactionManager* cm =
ParCompactionManager::gc_thread_compaction_manager(which); ParCompactionManager::gc_thread_compaction_manager(which);
ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm); PCMarkAndPushClosure mark_and_push_closure(cm);
MarkingCodeBlobClosure mark_and_push_in_blobs(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations); MarkingCodeBlobClosure mark_and_push_in_blobs(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations);
_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs); _thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs);
@ -73,7 +74,7 @@ void MarkFromRootsTask::do_it(GCTaskManager* manager, uint which) {
ParCompactionManager* cm = ParCompactionManager* cm =
ParCompactionManager::gc_thread_compaction_manager(which); ParCompactionManager::gc_thread_compaction_manager(which);
ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm); PCMarkAndPushClosure mark_and_push_closure(cm);
switch (_root_type) { switch (_root_type) {
case universe: case universe:
@ -139,7 +140,7 @@ void RefProcTaskProxy::do_it(GCTaskManager* manager, uint which)
ParCompactionManager* cm = ParCompactionManager* cm =
ParCompactionManager::gc_thread_compaction_manager(which); ParCompactionManager::gc_thread_compaction_manager(which);
ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm); PCMarkAndPushClosure mark_and_push_closure(cm);
ParCompactionManager::FollowStackClosure follow_stack_closure(cm); ParCompactionManager::FollowStackClosure follow_stack_closure(cm);
_rp_task.work(_work_id, *PSParallelCompact::is_alive_closure(), _rp_task.work(_work_id, *PSParallelCompact::is_alive_closure(),
mark_and_push_closure, follow_stack_closure); mark_and_push_closure, follow_stack_closure);
@ -182,13 +183,12 @@ void StealMarkingTask::do_it(GCTaskManager* manager, uint which) {
ParCompactionManager* cm = ParCompactionManager* cm =
ParCompactionManager::gc_thread_compaction_manager(which); ParCompactionManager::gc_thread_compaction_manager(which);
ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm);
oop obj = NULL; oop obj = NULL;
ObjArrayTask task; ObjArrayTask task;
do { do {
while (ParCompactionManager::steal_objarray(which, task)) { while (ParCompactionManager::steal_objarray(which, task)) {
cm->follow_contents((objArrayOop)task.obj(), task.index()); cm->follow_array((objArrayOop)task.obj(), task.index());
cm->follow_marking_stacks(); cm->follow_marking_stacks();
} }
while (ParCompactionManager::steal(which, obj)) { while (ParCompactionManager::steal(which, obj)) {

View file

@ -28,7 +28,7 @@
#include "gc/parallel/parallelScavengeHeap.inline.hpp" #include "gc/parallel/parallelScavengeHeap.inline.hpp"
#include "gc/parallel/psCardTable.hpp" #include "gc/parallel/psCardTable.hpp"
#include "gc/parallel/psPromotionManager.inline.hpp" #include "gc/parallel/psPromotionManager.inline.hpp"
#include "gc/parallel/psScavenge.hpp" #include "gc/parallel/psScavenge.inline.hpp"
#include "gc/parallel/psTasks.hpp" #include "gc/parallel/psTasks.hpp"
#include "gc/parallel/psYoungGen.hpp" #include "gc/parallel/psYoungGen.hpp"
#include "memory/iterator.inline.hpp" #include "memory/iterator.inline.hpp"

View file

@ -0,0 +1,121 @@
/*
* Copyright (c) 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
* 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.
*
*/
#ifndef SHARE_VM_GC_PARALLEL_PSCLOSURE_INLINE_HPP
#define SHARE_VM_GC_PARALLEL_PSCLOSURE_INLINE_HPP
#include "gc/parallel/psPromotionManager.inline.hpp"
#include "gc/parallel/psScavenge.inline.hpp"
#include "memory/iterator.hpp"
#include "oops/access.inline.hpp"
#include "oops/oop.inline.hpp"
#include "utilities/globalDefinitions.hpp"
template <bool promote_immediately>
class PSRootsClosure: public OopClosure {
private:
PSPromotionManager* _promotion_manager;
template <class T> void do_oop_work(T *p) {
if (PSScavenge::should_scavenge(p)) {
// We never card mark roots, maybe call a func without test?
_promotion_manager->copy_and_push_safe_barrier<T, promote_immediately>(p);
}
}
public:
PSRootsClosure(PSPromotionManager* pm) : _promotion_manager(pm) { }
void do_oop(oop* p) { PSRootsClosure::do_oop_work(p); }
void do_oop(narrowOop* p) { PSRootsClosure::do_oop_work(p); }
};
typedef PSRootsClosure</*promote_immediately=*/false> PSScavengeRootsClosure;
typedef PSRootsClosure</*promote_immediately=*/true> PSPromoteRootsClosure;
// Scavenges a single oop in a ClassLoaderData.
class PSScavengeFromCLDClosure: public OopClosure {
private:
PSPromotionManager* _pm;
// Used to redirty a scanned cld if it has oops
// pointing to the young generation after being scanned.
ClassLoaderData* _scanned_cld;
public:
PSScavengeFromCLDClosure(PSPromotionManager* pm) : _pm(pm), _scanned_cld(NULL) { }
void do_oop(narrowOop* p) { ShouldNotReachHere(); }
void do_oop(oop* p) {
ParallelScavengeHeap* psh = ParallelScavengeHeap::heap();
assert(!psh->is_in_reserved(p), "GC barrier needed");
if (PSScavenge::should_scavenge(p)) {
assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
oop o = *p;
oop new_obj;
if (o->is_forwarded()) {
new_obj = o->forwardee();
} else {
new_obj = _pm->copy_to_survivor_space</*promote_immediately=*/false>(o);
}
RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
if (PSScavenge::is_obj_in_young(new_obj)) {
do_cld_barrier();
}
}
}
void set_scanned_cld(ClassLoaderData* cld) {
assert(_scanned_cld == NULL || cld == NULL, "Should always only handling one cld at a time");
_scanned_cld = cld;
}
private:
void do_cld_barrier() {
assert(_scanned_cld != NULL, "Should not be called without having a scanned cld");
_scanned_cld->record_modified_oops();
}
};
// Scavenges the oop in a ClassLoaderData.
class PSScavengeCLDClosure: public CLDClosure {
private:
PSScavengeFromCLDClosure _oop_closure;
public:
PSScavengeCLDClosure(PSPromotionManager* pm) : _oop_closure(pm) { }
void do_cld(ClassLoaderData* cld) {
// If the cld has not been dirtied we know that there's
// no references into the young gen and we can skip it.
if (cld->has_modified_oops()) {
// Setup the promotion manager to redirty this cld
// if references are left in the young gen.
_oop_closure.set_scanned_cld(cld);
// Clean the cld since we're going to scavenge all the metadata.
cld->oops_do(&_oop_closure, false, /*clear_modified_oops*/true);
_oop_closure.set_scanned_cld(NULL);
}
}
};
#endif

View file

@ -132,113 +132,6 @@ ParCompactionManager::gc_thread_compaction_manager(uint index) {
return _manager_array[index]; return _manager_array[index];
} }
void InstanceKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
assert(obj != NULL, "can't follow the content of NULL object");
cm->follow_klass(this);
// Only mark the header and let the scan of the meta-data mark
// everything else.
ParCompactionManager::MarkAndPushClosure cl(cm);
if (UseCompressedOops) {
InstanceKlass::oop_oop_iterate_oop_maps<narrowOop>(obj, &cl);
} else {
InstanceKlass::oop_oop_iterate_oop_maps<oop>(obj, &cl);
}
}
void InstanceMirrorKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
InstanceKlass::oop_pc_follow_contents(obj, cm);
// Follow the klass field in the mirror.
Klass* klass = java_lang_Class::as_Klass(obj);
if (klass != NULL) {
// An unsafe anonymous class doesn't have its own class loader,
// so the call to follow_klass will mark and push its java mirror instead of the
// class loader. When handling the java mirror for an unsafe anonymous
// class we need to make sure its class loader data is claimed, this is done
// by calling follow_class_loader explicitly. For non-anonymous classes the
// call to follow_class_loader is made when the class loader itself is handled.
if (klass->is_instance_klass() &&
InstanceKlass::cast(klass)->is_unsafe_anonymous()) {
cm->follow_class_loader(klass->class_loader_data());
} else {
cm->follow_klass(klass);
}
} else {
// If klass is NULL then this a mirror for a primitive type.
// We don't have to follow them, since they are handled as strong
// roots in Universe::oops_do.
assert(java_lang_Class::is_primitive(obj), "Sanity check");
}
ParCompactionManager::MarkAndPushClosure cl(cm);
if (UseCompressedOops) {
oop_oop_iterate_statics<narrowOop>(obj, &cl);
} else {
oop_oop_iterate_statics<oop>(obj, &cl);
}
}
void InstanceClassLoaderKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
InstanceKlass::oop_pc_follow_contents(obj, cm);
ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data_acquire(obj);
if (loader_data != NULL) {
cm->follow_class_loader(loader_data);
}
}
template <class T>
static void oop_pc_follow_contents_specialized(InstanceRefKlass* klass, oop obj, ParCompactionManager* cm) {
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr_raw(obj);
T heap_oop = RawAccess<>::oop_load(referent_addr);
log_develop_trace(gc, ref)("InstanceRefKlass::oop_pc_follow_contents " PTR_FORMAT, p2i(obj));
if (!CompressedOops::is_null(heap_oop)) {
oop referent = CompressedOops::decode_not_null(heap_oop);
if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) &&
PSParallelCompact::ref_processor()->discover_reference(obj, klass->reference_type())) {
// reference already enqueued, referent will be traversed later
klass->InstanceKlass::oop_pc_follow_contents(obj, cm);
log_develop_trace(gc, ref)(" Non NULL enqueued " PTR_FORMAT, p2i(obj));
return;
} else {
// treat referent as normal oop
log_develop_trace(gc, ref)(" Non NULL normal " PTR_FORMAT, p2i(obj));
cm->mark_and_push(referent_addr);
}
}
// Treat discovered as normal oop.
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
cm->mark_and_push(discovered_addr);
klass->InstanceKlass::oop_pc_follow_contents(obj, cm);
}
void InstanceRefKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
if (UseCompressedOops) {
oop_pc_follow_contents_specialized<narrowOop>(this, obj, cm);
} else {
oop_pc_follow_contents_specialized<oop>(this, obj, cm);
}
}
void ObjArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
cm->follow_klass(this);
if (UseCompressedOops) {
oop_pc_follow_contents_specialized<narrowOop>(objArrayOop(obj), 0, cm);
} else {
oop_pc_follow_contents_specialized<oop>(objArrayOop(obj), 0, cm);
}
}
void TypeArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
assert(obj->is_typeArray(),"must be a type array");
// Performance tweak: We skip iterating over the klass pointer since we
// know that Universe::TypeArrayKlass never moves.
}
void ParCompactionManager::follow_marking_stacks() { void ParCompactionManager::follow_marking_stacks() {
do { do {
// Drain the overflow stack first, to allow stealing from the marking stack. // Drain the overflow stack first, to allow stealing from the marking stack.
@ -253,7 +146,7 @@ void ParCompactionManager::follow_marking_stacks() {
// Process ObjArrays one at a time to avoid marking stack bloat. // Process ObjArrays one at a time to avoid marking stack bloat.
ObjArrayTask task; ObjArrayTask task;
if (_objarray_stack.pop_overflow(task) || _objarray_stack.pop_local(task)) { if (_objarray_stack.pop_overflow(task) || _objarray_stack.pop_local(task)) {
follow_contents((objArrayOop)task.obj(), task.index()); follow_array((objArrayOop)task.obj(), task.index());
} }
} while (!marking_stacks_empty()); } while (!marking_stacks_empty());

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -171,24 +171,10 @@ private:
void drain_region_stacks(); void drain_region_stacks();
void follow_contents(oop obj); void follow_contents(oop obj);
void follow_contents(objArrayOop array, int index); void follow_array(objArrayOop array, int index);
void update_contents(oop obj); void update_contents(oop obj);
class MarkAndPushClosure: public BasicOopIterateClosure {
private:
ParCompactionManager* _compaction_manager;
public:
MarkAndPushClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
template <typename T> void do_oop_work(T* p);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
// This closure provides its own oop verification code.
debug_only(virtual bool should_verify_oops() { return false; })
};
class FollowStackClosure: public VoidClosure { class FollowStackClosure: public VoidClosure {
private: private:
ParCompactionManager* _compaction_manager; ParCompactionManager* _compaction_manager;

View file

@ -25,6 +25,7 @@
#ifndef SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP #ifndef SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP
#define SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP #define SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP
#include "classfile/javaClasses.inline.hpp"
#include "gc/parallel/parMarkBitMap.hpp" #include "gc/parallel/parMarkBitMap.hpp"
#include "gc/parallel/psCompactionManager.hpp" #include "gc/parallel/psCompactionManager.hpp"
#include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/parallel/psParallelCompact.inline.hpp"
@ -37,6 +38,37 @@
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
class PCMarkAndPushClosure: public OopClosure {
private:
ParCompactionManager* _compaction_manager;
public:
PCMarkAndPushClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
template <typename T> void do_oop_nv(T* p) { _compaction_manager->mark_and_push(p); }
virtual void do_oop(oop* p) { do_oop_nv(p); }
virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
// This closure provides its own oop verification code.
debug_only(virtual bool should_verify_oops() { return false; })
};
class PCIterateMarkAndPushClosure: public MetadataVisitingOopIterateClosure {
private:
ParCompactionManager* _compaction_manager;
public:
PCIterateMarkAndPushClosure(ParCompactionManager* cm, ReferenceProcessor* rp) : MetadataVisitingOopIterateClosure(rp), _compaction_manager(cm) { }
template <typename T> void do_oop_nv(T* p) { _compaction_manager->mark_and_push(p); }
virtual void do_oop(oop* p) { do_oop_nv(p); }
virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
void do_klass_nv(Klass* k) { _compaction_manager->follow_klass(k); }
void do_cld_nv(ClassLoaderData* cld) { _compaction_manager->follow_class_loader(cld); }
// This closure provides its own oop verification code.
debug_only(virtual bool should_verify_oops() { return false; })
};
inline bool ParCompactionManager::steal(int queue_num, oop& t) { inline bool ParCompactionManager::steal(int queue_num, oop& t) {
return stack_array()->steal(queue_num, t); return stack_array()->steal(queue_num, t);
} }
@ -84,14 +116,6 @@ inline void ParCompactionManager::mark_and_push(T* p) {
} }
} }
template <typename T>
inline void ParCompactionManager::MarkAndPushClosure::do_oop_work(T* p) {
_compaction_manager->mark_and_push(p);
}
inline void ParCompactionManager::MarkAndPushClosure::do_oop(oop* p) { do_oop_work(p); }
inline void ParCompactionManager::MarkAndPushClosure::do_oop(narrowOop* p) { do_oop_work(p); }
inline void ParCompactionManager::follow_klass(Klass* klass) { inline void ParCompactionManager::follow_klass(Klass* klass) {
oop holder = klass->klass_holder(); oop holder = klass->klass_holder();
mark_and_push(&holder); mark_and_push(&holder);
@ -101,19 +125,8 @@ inline void ParCompactionManager::FollowStackClosure::do_void() {
_compaction_manager->follow_marking_stacks(); _compaction_manager->follow_marking_stacks();
} }
inline void ParCompactionManager::follow_class_loader(ClassLoaderData* cld) { template <typename T>
MarkAndPushClosure mark_and_push_closure(this); inline void follow_array_specialized(objArrayOop obj, int index, ParCompactionManager* cm) {
cld->oops_do(&mark_and_push_closure, true);
}
inline void ParCompactionManager::follow_contents(oop obj) {
assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked");
obj->pc_follow_contents(this);
}
template <class T>
inline void oop_pc_follow_contents_specialized(objArrayOop obj, int index, ParCompactionManager* cm) {
const size_t len = size_t(obj->length()); const size_t len = size_t(obj->length());
const size_t beg_index = size_t(index); const size_t beg_index = size_t(index);
assert(beg_index < len || len == 0, "index too large"); assert(beg_index < len || len == 0, "index too large");
@ -134,16 +147,34 @@ inline void oop_pc_follow_contents_specialized(objArrayOop obj, int index, ParCo
} }
} }
inline void ParCompactionManager::follow_contents(objArrayOop obj, int index) { inline void ParCompactionManager::follow_array(objArrayOop obj, int index) {
if (UseCompressedOops) { if (UseCompressedOops) {
oop_pc_follow_contents_specialized<narrowOop>(obj, index, this); follow_array_specialized<narrowOop>(obj, index, this);
} else { } else {
oop_pc_follow_contents_specialized<oop>(obj, index, this); follow_array_specialized<oop>(obj, index, this);
} }
} }
inline void ParCompactionManager::update_contents(oop obj) { inline void ParCompactionManager::update_contents(oop obj) {
obj->pc_update_contents(this); if (!obj->klass()->is_typeArray_klass()) {
PCAdjustPointerClosure apc(this);
obj->oop_iterate(&apc);
}
}
inline void ParCompactionManager::follow_class_loader(ClassLoaderData* cld) {
PCMarkAndPushClosure mark_and_push_closure(this);
cld->oops_do(&mark_and_push_closure, true);
}
inline void ParCompactionManager::follow_contents(oop obj) {
assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked");
if (obj->is_objArray()) {
follow_array(objArrayOop(obj), 0);
} else {
PCIterateMarkAndPushClosure cl(this, PSParallelCompact::ref_processor());
obj->oop_iterate(&cl);
}
} }
#endif // SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP #endif // SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP

Some files were not shown because too many files have changed in this diff Show more