--- a/make/BuildStatic.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/BuildStatic.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -42,7 +42,7 @@
$(GLOBAL_SYMBOLS_FILE): $(MODULES_SYMBOLS_FILES)
$(call LogInfo, Generating global exported.symbols file)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(CAT) $^ > $@
TARGETS += $(GLOBAL_SYMBOLS_FILE)
--- a/make/Bundles.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/Bundles.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -70,6 +70,7 @@
$$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
$(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
+ $$(call MakeTargetDir)
# 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
# switch it back.
@@ -79,7 +80,6 @@
$$(CAT) $$($1_$$d_LIST_FILE) | $$(TR) '?' ' ' > $$($1_$$d_LIST_FILE).tmp \
&& $(MV) $$($1_$$d_LIST_FILE).tmp $$($1_$$d_LIST_FILE) $$(NEWLINE) \
)
- $$(call MakeDir, $$(@D))
ifneq ($$($1_SPECIAL_INCLUDES), )
$$(foreach i, $$($1_SPECIAL_INCLUDES), \
$$(foreach d, $$($1_BASE_DIRS), \
--- a/make/CopyInterimCLDRConverter.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/CopyInterimCLDRConverter.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -33,7 +33,7 @@
### CLDRConverter needs the JRE time zone names from the java.base source.
define cldrconverter_copytznames
- $(MKDIR) -p '$(@D)'
+ $(call MakeTargetDir)
$(RM) '$@'
$(SED) -e "s/package sun.util.resources/package build.tools.cldrconverter/" \
-e "s/extends TimeZoneNamesBundle//" \
@@ -46,7 +46,7 @@
DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes/build/tools/cldrconverter, \
FILES := TimeZoneNames.java, \
MACRO := cldrconverter_copytznames))
-
+
##########################################################################################
all: $(COPY_INTERIM_CLDRCONVERTER)
--- a/make/CreateBuildJdkCopy.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/CreateBuildJdkCopy.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -41,7 +41,7 @@
$(COPY_CLASSES_TARGET): $(call CacheFind, $(wildcard \
$(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
$(MKDIR) -p $(BUILDJDK_OUTPUTDIR)/jdk/modules
$(foreach m, $(MODULES_TO_COPY), \
--- a/make/GenerateModuleSummary.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/GenerateModuleSummary.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -35,18 +35,18 @@
TOOLS_MODULE_SRCDIR := $(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw
$(GENGRAPHS_DIR)/jdk.dot: $(BUILD_JIGSAW_TOOLS)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(TOOL_GENGRAPHS) --output $(GENGRAPHS_DIR)
$(SPEC_DOTFILES_DIR)/java.se.dot: $(BUILD_JIGSAW_TOOLS)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(TOOL_GENGRAPHS) --spec --output $(SPEC_DOTFILES_DIR)
$(GENGRAPHS_DIR)/technology-summary.html: $(TOOLS_MODULE_SRCDIR)/technology-summary.html
$(install-file)
$(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
all: $(GENGRAPHS_DIR)/jdk.dot $(GENGRAPHS_DIR)/module-summary.html $(SPEC_DOTFILES_DIR)/java.se.dot
--- a/make/GensrcModuleInfo.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/GensrcModuleInfo.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -79,7 +79,7 @@
$(BUILD_TOOLS_JDK) \
$(MOD_FILES) \
$(call DependOnVariable, ALL_MODULES)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@ $@.tmp
$(TOOL_GENMODULEINFOSOURCE) -o $@.tmp \
--source-file $< \
--- a/make/MacBundles.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/MacBundles.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -63,13 +63,13 @@
$(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
$(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(LN) -s ../Home/lib/libjli.dylib $@
$(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
$(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(LN) -s ../Home/lib/libjli.dylib $@
--- a/make/autoconf/basics.m4 Tue Oct 09 18:29:53 2018 -0400
+++ b/make/autoconf/basics.m4 Tue Oct 09 18:33:25 2018 -0400
@@ -569,7 +569,8 @@
BASIC_REQUIRE_PROGS(GZIP, pigz gzip)
BASIC_REQUIRE_PROGS(LN, ln)
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(MV, mv)
BASIC_REQUIRE_PROGS(NAWK, [nawk gawk awk])
--- a/make/common/JarArchive.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/common/JarArchive.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -235,7 +235,7 @@
# Here is the rule that creates/updates the jar file.
$$($1_JAR) : $$($1_DEPENDENCIES) $$($1_MANIFEST) $$($1_VARDEPS_FILE)
- $(MKDIR) -p $$($1_BIN)
+ $$(call MakeTargetDir)
$$($1_GREP_INCLUDE_OUTPUT)
$$($1_GREP_EXCLUDE_OUTPUT)
# If the vardeps file is part of the newer prereq list, it means that
--- a/make/common/JavaCompilation.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/common/JavaCompilation.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -423,7 +423,7 @@
$1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp
$$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
- $(MKDIR) -p $$(@D)
+ $$(call MakeTargetDir)
if [ -d "$$($1_HEADERS).$1.tmp" ]; then \
for f in `$(CD) $$($1_HEADERS).$1.tmp && $(FIND) . -type f`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] \
--- a/make/common/Modules.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/common/Modules.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -333,7 +333,7 @@
$(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
$(call DependOnVariable, MODULE_INFOS, $(MAKESUPPORT_OUTPUTDIR)/MODULE_INFOS.vardeps)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(foreach m, $(MODULE_INFOS), \
( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
--- a/make/common/ZipArchive.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/common/ZipArchive.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -124,8 +124,8 @@
# If zip has nothing to do, it returns 12 and would fail the build. Check for 12
# and only fail if it's not.
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
- $(MKDIR) -p $$(@D)
- $(ECHO) Updating $$($1_NAME)
+ $$(call LogWarn, Updating $$($1_NAME))
+ $$(call MakeTargetDir)
$$(foreach s,$$($1_SRC),(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \
$$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \
$$($1_ZIP_EXCLUDES_$$s) \
--- a/make/copy/Copy-java.base.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/copy/Copy-java.base.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -128,7 +128,7 @@
POLICY_SRC_LIST := $(POLICY_SRC)
$(POLICY_DST): $(POLICY_SRC_LIST)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@ $@.tmp
$(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
$(MV) $@.tmp $@
@@ -153,7 +153,7 @@
endif
$(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@ $@.tmp
$(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
$(MV) $@.tmp $@
--- a/make/data/jdwp/jdwp.spec Tue Oct 09 18:29:53 2018 -0400
+++ b/make/data/jdwp/jdwp.spec Tue Oct 09 18:33:25 2018 -0400
@@ -2185,7 +2185,7 @@
"in this thread group. Threads and thread groups in child "
"thread groups are not included. "
"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.
(Out
(threadGroupObject group "The thread group object ID. ")
--- a/make/gendata/GendataFontConfig.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gendata/GendataFontConfig.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -38,7 +38,7 @@
$(GENDATA_FONT_CONFIG_DST)/%.bfc: \
$(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(TOOL_COMPILEFONTCONFIG) $< $@
$(CHMOD) 444 $@
--- a/make/gendata/GendataHtml32dtd.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gendata/GendataHtml32dtd.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -28,7 +28,7 @@
HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd
$(HTML32DTD): $(BUILD_TOOLS_JDK)
$(call LogInfo, Generating HTML DTD file)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
($(TOOL_DTDBUILDER) html32 > $@) || exit 1
--- a/make/gendata/GendataTZDB.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gendata/GendataTZDB.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -35,8 +35,8 @@
GENDATA_TZDB_DAT := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/tzdb.dat
$(GENDATA_TZDB_DAT): $(TZDATA_TZFILES)
+ $(call MakeTargetDir)
$(RM) $(GENDATA_TZDB_DAT)
- $(MKDIR) -p $(@D)
$(TOOL_TZDB) -srcdir $(TZDATA_DIR) -dstfile $(GENDATA_TZDB_DAT) $(TZDATA_TZFILE)
TARGETS += $(GENDATA_TZDB_DAT)
--- a/make/gensrc/GensrcCLDR.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gensrc/GensrcCLDR.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -50,7 +50,7 @@
$(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \
$(ZONENAME_TEMPLATE) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(GENSRC_BASEDIR)
+ $(call MakeDir, $(GENSRC_BASEDIR))
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \
-baselocales $(CLDR_BASE_LOCALES) \
-o $(GENSRC_BASEDIR) \
@@ -62,7 +62,7 @@
$(wildcard $(CLDRSRCDIR)/main/*.xml) \
$(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(GENSRC_DIR)
+ $(call MakeDir, $(GENSRC_DIR))
$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \
-baselocales $(CLDR_BASE_LOCALES) \
-o $(GENSRC_DIR)
--- a/make/gensrc/GensrcCharsetCoder.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gensrc/GensrcCharsetCoder.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -34,8 +34,8 @@
################################################################################
$(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
- $(MKDIR) -p $(@D)
- -$(RM) $@.tmp
+ $(call MakeTargetDir)
+ $(RM) $@.tmp
$(TOOL_SPP) < $< >$@.tmp \
-Kdecoder \
-DA='A' \
@@ -69,8 +69,8 @@
################################################################################
$(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
- $(MKDIR) -p $(@D)
- -$(RM) $@.tmp
+ $(call MakeTargetDir)
+ $(RM) $@.tmp
$(TOOL_SPP) < $< >$@.tmp \
-Kencoder \
-DA='An' \
--- a/make/gensrc/GensrcCommonLangtools.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gensrc/GensrcCommonLangtools.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -49,7 +49,7 @@
# root.
define SetupVersionProperties
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2):
- $(MKDIR) -p $$(@D)
+ $$(call MakeTargetDir)
$(PRINTF) "jdk=$(VERSION_NUMBER)\nfull=$(VERSION_STRING)\nrelease=$(VERSION_SHORT)\n" \
> $$@
@@ -92,7 +92,7 @@
# Now setup the rule for the generation of the resource bundles.
$(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)
$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE)
$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)
@@ -122,7 +122,7 @@
# Now setup the rule for the generation of the resource bundles.
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $$(PARSEPROPSOURCES)
- $(MKDIR) -p $$(@D) $$(PARSEPROPDIRS)
+ $$(call MakeDir, $$(@D) $$(PARSEPROPDIRS))
$(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE)
$(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE)
$(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE)
--- a/make/gensrc/GensrcLocaleData.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gensrc/GensrcLocaleData.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -131,7 +131,7 @@
$(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
$(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)" \
> $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources
$(SED) $(SED_BASEARGS) $< > $@
@@ -139,7 +139,7 @@
$(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
$(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)" \
> $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources
$(SED) $(SED_NONBASEARGS) $< > $@
--- a/make/gensrc/GensrcModuleLoaderMap.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gensrc/GensrcModuleLoaderMap.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -46,7 +46,7 @@
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/module/ModuleLoaderMap.java: \
$(TOPDIR)/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java \
$(VARDEPS_FILE) $(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@ $@.tmp
$(TOOL_GENCLASSLOADERMAP) -boot $(BOOT_MODULES_LIST) \
-platform $(PLATFORM_MODULES_LIST) -o $@.tmp $<
--- a/make/gensrc/GensrcProperties.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gensrc/GensrcProperties.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -34,7 +34,7 @@
$$(subst _zh_TW,_zh_HK, $2))
$$($1_$2_TARGET): $2
- $(MKDIR) -p $$(@D)
+ $$(call MakeTargetDir)
$(CAT) $$< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $$@
$1 += $$($1_$2_TARGET)
@@ -105,8 +105,8 @@
# Now setup the rule for the generation of the resource bundles.
$$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
- $(MKDIR) -p $$(@D) $$($1_DIRS)
- $(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE)
+ $$(call LogWarn, Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE))
+ $$(call MakeDir, $$(@D) $$($1_DIRS))
$$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE)))
$(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
$(TOUCH) $$@
--- a/make/gensrc/GensrcSwing.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/gensrc/GensrcSwing.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -32,7 +32,7 @@
$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
$(call LogInfo, Generating Nimbus source files)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(TOOL_GENERATENIMBUS) $(LOG_DEBUG) \
-skinFile $(NIMBUS_SKIN_FILE) -buildDir $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop \
-packagePrefix $(NIMBUS_PACKAGE).nimbus -lafName Nimbus
--- a/make/launcher/Launcher-java.base.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/launcher/Launcher-java.base.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -45,7 +45,7 @@
))
$(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
- $(MKDIR) -p $(@D)
+ $(call MakeTargetDir)
$(RM) $@
$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs/java$(EXE_SUFFIX) $@
--- a/make/rmic/Rmic-java.management.rmi.gmk Tue Oct 09 18:29:53 2018 -0400
+++ b/make/rmic/Rmic-java.management.rmi.gmk Tue Oct 09 18:33:25 2018 -0400
@@ -51,7 +51,7 @@
$(foreach src, $(classfiles), \
$(eval target := $(patsubst $(RMIC_GENSRC_DIR)/%, \
$(STUB_CLASSES_DIR)/%, $(src))) \
- $(MKDIR) -p $(dir $(target)) ; \
+ $(call MakeDir, $(dir $(target))) \
$(MV) $(src) $(target) $(NEWLINE))
$(TOUCH) $@
--- a/src/hotspot/cpu/s390/frame_s390.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/cpu/s390/frame_s390.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -53,14 +53,135 @@
bool frame::safe_for_sender(JavaThread *thread) {
bool safe = false;
- address cursp = (address)sp();
- address curfp = (address)fp();
- if ((cursp != NULL && curfp != NULL &&
- (cursp <= thread->stack_base() && cursp >= thread->stack_base() - thread->stack_size())) &&
- (curfp <= thread->stack_base() && curfp >= thread->stack_base() - thread->stack_size())) {
- safe = true;
+ address sp = (address)_sp;
+ address fp = (address)_fp;
+ address unextended_sp = (address)_unextended_sp;
+
+ // Consider stack guards when trying to determine "safe" stack pointers
+ 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;
+ }
+
+ // Unextended sp must be within the stack
+ bool unextended_sp_safe = (unextended_sp < thread->stack_base());
+
+ if (!unextended_sp_safe) {
+ return false;
}
- return safe;
+
+ // 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 {
--- a/src/hotspot/cpu/s390/frame_s390.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/cpu/s390/frame_s390.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -491,9 +491,12 @@
static int interpreter_frame_interpreterstate_size_in_bytes();
static int interpreter_frame_monitor_size_in_bytes();
+
+ // template interpreter state
+ inline z_ijava_state* ijava_state_unchecked() const;
+
private:
- // template interpreter state
inline z_ijava_state* ijava_state() const;
// Where z_ijava_state.monitors is saved.
--- a/src/hotspot/cpu/s390/frame_s390.inline.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/cpu/s390/frame_s390.inline.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -77,8 +77,13 @@
#endif
// template interpreter state
+inline frame::z_ijava_state* frame::ijava_state_unchecked() const {
+ 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 = (z_ijava_state*) ((uintptr_t)fp() - z_ijava_state_size);
+ z_ijava_state* state = ijava_state_unchecked();
assert(state->magic == (intptr_t) frame::z_istate_magic_number,
"wrong z_ijava_state in interpreter frame (no magic found)");
return state;
--- a/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -42,10 +42,51 @@
}
bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) {
- ucontext_t* uc = (ucontext_t*) ucontext;
- *fr_addr = frame((intptr_t*)uc->uc_mcontext.gregs[15/*REG_SP*/],
+ assert(this->is_Java_thread(), "must be JavaThread");
+
+ // 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);
- 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.
--- a/src/hotspot/share/classfile/javaClasses.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/classfile/javaClasses.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -36,8 +36,9 @@
#include "interpreter/linkResolver.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
+#include "memory/heapShared.inline.hpp"
+#include "memory/metaspaceShared.hpp"
#include "memory/oopFactory.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/fieldStreams.hpp"
@@ -750,7 +751,7 @@
{
assert(fd->signature() == vmSymbols::string_signature(),
"just checking");
- if (DumpSharedSpaces && MetaspaceShared::is_archive_object(mirror())) {
+ if (DumpSharedSpaces && HeapShared::is_archived_object(mirror())) {
// Archive the String field and update the pointer.
oop s = mirror()->obj_field(fd->offset());
oop archived_s = StringTable::create_archived_string(s, CHECK);
@@ -788,7 +789,7 @@
}
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);
assert(present, "Missing archived mirror for %s", k->external_name());
return;
@@ -1011,14 +1012,14 @@
};
void java_lang_Class::archive_basic_type_mirrors(TRAPS) {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(),
- "MetaspaceShared::is_heap_object_archiving_allowed() must be true");
+ assert(HeapShared::is_heap_object_archiving_allowed(),
+ "HeapShared::is_heap_object_archiving_allowed() must be true");
for (int t = 0; t <= T_VOID; t++) {
oop m = Universe::_mirrors[t];
if (m != NULL) {
// 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");
Klass *ak = (Klass*)(archived_m->metadata_field(_array_klass_offset));
assert(ak != NULL || t == T_VOID, "should not be NULL");
@@ -1071,8 +1072,8 @@
// be used at runtime, new mirror object is created for the shared
// class. The _has_archived_raw_mirror is cleared also during the process.
oop java_lang_Class::archive_mirror(Klass* k, TRAPS) {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(),
- "MetaspaceShared::is_heap_object_archiving_allowed() must be true");
+ assert(HeapShared::is_heap_object_archiving_allowed(),
+ "HeapShared::is_heap_object_archiving_allowed() must be true");
// Mirror is already archived
if (k->has_raw_archived_mirror()) {
@@ -1101,7 +1102,7 @@
}
// 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) {
return NULL;
}
@@ -1139,7 +1140,7 @@
if (k->is_typeArray_klass()) {
// The primitive type mirrors are already archived. Get the archived 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");
} else {
assert(k->is_objArray_klass(), "Must be");
@@ -1202,7 +1203,7 @@
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) {
return false;
@@ -1211,7 +1212,7 @@
log_debug(cds, mirror)("Archived mirror is: " PTR_FORMAT, p2i(m));
// 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);
if (!k->is_array_klass()) {
--- a/src/hotspot/share/classfile/stringTable.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/classfile/stringTable.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -36,7 +36,6 @@
#include "memory/allocation.inline.hpp"
#include "memory/filemap.hpp"
#include "memory/heapShared.inline.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/access.inline.hpp"
@@ -798,18 +797,17 @@
oop StringTable::create_archived_string(oop s, Thread* THREAD) {
assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
- if (MetaspaceShared::is_archive_object(s)) {
+ if (HeapShared::is_archived_object(s)) {
return s;
}
oop new_s = NULL;
typeArrayOop v = java_lang_String::value_no_keepalive(s);
- typeArrayOop new_v =
- (typeArrayOop)MetaspaceShared::archive_heap_object(v, THREAD);
+ typeArrayOop new_v = (typeArrayOop)HeapShared::archive_heap_object(v, THREAD);
if (new_v == NULL) {
return NULL;
}
- new_s = MetaspaceShared::archive_heap_object(s, THREAD);
+ new_s = HeapShared::archive_heap_object(s, THREAD);
if (new_s == NULL) {
return NULL;
}
@@ -847,14 +845,14 @@
};
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);
StringTable::the_table()->_local_table->do_scan(Thread::current(), copy);
}
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();
int num_buckets = CompactHashtableWriter::default_num_buckets(
--- a/src/hotspot/share/classfile/systemDictionary.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/classfile/systemDictionary.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -52,6 +52,7 @@
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/filemap.hpp"
+#include "memory/heapShared.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
@@ -2037,13 +2038,13 @@
// ConstantPool::restore_unshareable_info (restores the archived
// 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
// SystemDictionary::Object_klass(), so we can do this only after
// Object_klass is resolved. See the above resolve_wk_klasses_through()
// call. No mirror objects are accessed/restored in the above call.
// 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
Object_klass()->constants()->restore_unshareable_info(CHECK);
--- a/src/hotspot/share/gc/g1/g1Allocator.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1Allocator.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -270,7 +270,7 @@
// Check if the object is in open archive
static inline bool is_open_archive_object(oop object);
// 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:
static bool _archive_check_enabled;
--- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -141,7 +141,7 @@
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) ||
in_open_archive_range(object)));
}
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -80,7 +80,6 @@
#include "logging/log.hpp"
#include "memory/allocation.hpp"
#include "memory/iterator.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp"
#include "oops/compressedOops.inline.hpp"
@@ -827,7 +826,7 @@
oop G1CollectedHeap::materialize_archived_object(oop obj) {
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
// loaded during concurrent marking, it must be enqueued to the SATB
--- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -68,7 +68,7 @@
oop obj = CompressedOops::decode_not_null(heap_oop);
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.
return;
}
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -248,7 +248,7 @@
oop obj = RawAccess<>::oop_load(p);
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,
p2i(p), p2i(obj));
} else {
--- a/src/hotspot/share/interpreter/templateTable.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/interpreter/templateTable.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -36,6 +36,7 @@
// and the snippet generator, a template is assigned to each bytecode which can be
// used to generate the bytecode's implementation if needed.
+class BarrierSet;
class InterpreterMacroAssembler;
// A Template describes the properties of a code template for a given bytecode
--- a/src/hotspot/share/memory/filemap.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/memory/filemap.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -191,7 +191,7 @@
_shared_path_table_size = mapinfo->_shared_path_table_size;
_shared_path_table = mapinfo->_shared_path_table;
_shared_path_entry_size = mapinfo->_shared_path_entry_size;
- if (MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (HeapShared::is_heap_object_archiving_allowed()) {
_heap_reserved = Universe::heap()->reserved_region();
}
@@ -908,7 +908,7 @@
// regions may be added. GC may mark and update references in the mapped
// open archive objects.
void FileMapInfo::map_heap_regions_impl() {
- if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (!HeapShared::is_heap_object_archiving_allowed()) {
log_info(cds)("CDS heap data is being ignored. UseG1GC, "
"UseCompressedOops and UseCompressedClassPointers are required.");
return;
@@ -1000,7 +1000,7 @@
MetaspaceShared::max_open_archive_heap_region,
&num_open_archive_heap_ranges,
true /* open */)) {
- MetaspaceShared::set_open_archive_heap_region_mapped();
+ HeapShared::set_open_archive_heap_region_mapped();
}
}
}
@@ -1014,7 +1014,7 @@
assert(string_ranges == NULL && num_string_ranges == 0, "sanity");
}
- if (!MetaspaceShared::open_archive_heap_region_mapped()) {
+ if (!HeapShared::open_archive_heap_region_mapped()) {
assert(open_archive_heap_ranges == NULL && num_open_archive_heap_ranges == 0, "sanity");
}
}
@@ -1160,7 +1160,7 @@
if ((MetaspaceShared::is_string_region(i) &&
!StringTable::shared_string_mapped()) ||
(MetaspaceShared::is_open_archive_heap_region(i) &&
- !MetaspaceShared::open_archive_heap_region_mapped())) {
+ !HeapShared::open_archive_heap_region_mapped())) {
return true; // archived heap data is not mapped
}
const char* buf = region_addr(i);
--- a/src/hotspot/share/memory/heapShared.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/memory/heapShared.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -24,25 +24,200 @@
#include "precompiled.hpp"
#include "classfile/javaClasses.inline.hpp"
+#include "classfile/stringTable.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/vmSymbols.hpp"
#include "logging/log.hpp"
#include "logging/logMessage.hpp"
#include "logging/logStream.hpp"
+#include "memory/filemap.hpp"
#include "memory/heapShared.inline.hpp"
#include "memory/iterator.inline.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/compressedOops.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
+#include "runtime/safepointVerifiers.hpp"
#include "utilities/bitMap.inline.hpp"
+#if INCLUDE_G1GC
+#include "gc/g1/g1CollectedHeap.hpp"
+#endif
#if INCLUDE_CDS_JAVA_HEAP
+
+bool HeapShared::_open_archive_heap_region_mapped = false;
+bool HeapShared::_archive_heap_region_fixed = false;
+
address HeapShared::_narrow_oop_base;
int HeapShared::_narrow_oop_shift;
+
+////////////////////////////////////////////////////////////////
+//
+// Java heap object archiving support
+//
+////////////////////////////////////////////////////////////////
+void HeapShared::fixup_mapped_heap_regions() {
+ FileMapInfo *mapinfo = FileMapInfo::current_info();
+ mapinfo->fixup_mapped_heap_regions();
+ set_archive_heap_region_fixed();
+}
+
+unsigned HeapShared::oop_hash(oop const& p) {
+ assert(!p->mark()->has_bias_pattern(),
+ "this object should never have been locked"); // so identity_hash won't safepoin
+ unsigned hash = (unsigned)p->identity_hash();
+ return hash;
+}
+
+HeapShared::ArchivedObjectCache* HeapShared::_archived_object_cache = NULL;
+oop HeapShared::find_archived_heap_object(oop obj) {
+ assert(DumpSharedSpaces, "dump-time only");
+ ArchivedObjectCache* cache = archived_object_cache();
+ oop* p = cache->get(obj);
+ if (p != NULL) {
+ return *p;
+ } else {
+ return NULL;
+ }
+}
+
+oop HeapShared::archive_heap_object(oop obj, Thread* THREAD) {
+ assert(DumpSharedSpaces, "dump-time only");
+
+ oop ao = find_archived_heap_object(obj);
+ if (ao != NULL) {
+ // already archived
+ return ao;
+ }
+
+ int len = obj->size();
+ if (G1CollectedHeap::heap()->is_archive_alloc_too_large(len)) {
+ log_debug(cds, heap)("Cannot archive, object (" PTR_FORMAT ") is too large: " SIZE_FORMAT,
+ p2i(obj), (size_t)obj->size());
+ return NULL;
+ }
+
+ // Pre-compute object identity hash at CDS dump time.
+ obj->identity_hash();
+
+ oop archived_oop = (oop)G1CollectedHeap::heap()->archive_mem_allocate(len);
+ if (archived_oop != NULL) {
+ Copy::aligned_disjoint_words((HeapWord*)obj, (HeapWord*)archived_oop, len);
+ MetaspaceShared::relocate_klass_ptr(archived_oop);
+ ArchivedObjectCache* cache = archived_object_cache();
+ cache->put(obj, archived_oop);
+ log_debug(cds, heap)("Archived heap object " PTR_FORMAT " ==> " PTR_FORMAT,
+ p2i(obj), p2i(archived_oop));
+ } else {
+ log_error(cds, heap)(
+ "Cannot allocate space for object " PTR_FORMAT " in archived heap region",
+ p2i(obj));
+ vm_exit(1);
+ }
+ return archived_oop;
+}
+
+oop HeapShared::materialize_archived_object(narrowOop v) {
+ assert(archive_heap_region_fixed(),
+ "must be called after archive heap regions are fixed");
+ if (!CompressedOops::is_null(v)) {
+ oop obj = HeapShared::decode_from_archive(v);
+ return G1CollectedHeap::heap()->materialize_archived_object(obj);
+ }
+ return NULL;
+}
+
+void HeapShared::archive_klass_objects(Thread* THREAD) {
+ GrowableArray<Klass*>* klasses = MetaspaceShared::collected_klasses();
+ assert(klasses != NULL, "sanity");
+ for (int i = 0; i < klasses->length(); i++) {
+ Klass* k = klasses->at(i);
+
+ // archive mirror object
+ java_lang_Class::archive_mirror(k, CHECK);
+
+ // archive the resolved_referenes array
+ if (k->is_instance_klass()) {
+ InstanceKlass* ik = InstanceKlass::cast(k);
+ ik->constants()->archive_resolved_references(THREAD);
+ }
+ }
+}
+
+void HeapShared::archive_java_heap_objects(GrowableArray<MemRegion> *closed,
+ GrowableArray<MemRegion> *open) {
+ if (!is_heap_object_archiving_allowed()) {
+ if (log_is_enabled(Info, cds)) {
+ log_info(cds)(
+ "Archived java heap is not supported as UseG1GC, "
+ "UseCompressedOops and UseCompressedClassPointers are required."
+ "Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.",
+ BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedOops),
+ BOOL_TO_STR(UseCompressedClassPointers));
+ }
+ return;
+ }
+
+ {
+ NoSafepointVerifier nsv;
+
+ // Cache for recording where the archived objects are copied to
+ create_archived_object_cache();
+
+ tty->print_cr("Dumping objects to closed archive heap region ...");
+ NOT_PRODUCT(StringTable::verify());
+ copy_closed_archive_heap_objects(closed);
+
+ tty->print_cr("Dumping objects to open archive heap region ...");
+ copy_open_archive_heap_objects(open);
+
+ destroy_archived_object_cache();
+ }
+
+ G1HeapVerifier::verify_archive_regions();
+}
+
+void HeapShared::copy_closed_archive_heap_objects(
+ GrowableArray<MemRegion> * closed_archive) {
+ assert(is_heap_object_archiving_allowed(), "Cannot archive java heap objects");
+
+ Thread* THREAD = Thread::current();
+ G1CollectedHeap::heap()->begin_archive_alloc_range();
+
+ // Archive interned string objects
+ StringTable::write_to_archive();
+
+ G1CollectedHeap::heap()->end_archive_alloc_range(closed_archive,
+ os::vm_allocation_granularity());
+}
+
+void HeapShared::copy_open_archive_heap_objects(
+ GrowableArray<MemRegion> * open_archive) {
+ assert(is_heap_object_archiving_allowed(), "Cannot archive java heap objects");
+
+ Thread* THREAD = Thread::current();
+ G1CollectedHeap::heap()->begin_archive_alloc_range(true /* open */);
+
+ java_lang_Class::archive_basic_type_mirrors(THREAD);
+
+ archive_klass_objects(THREAD);
+
+ archive_object_subgraphs(THREAD);
+
+ G1CollectedHeap::heap()->end_archive_alloc_range(open_archive,
+ os::vm_allocation_granularity());
+}
+
+void HeapShared::init_narrow_oop_decoding(address base, int shift) {
+ _narrow_oop_base = base;
+ _narrow_oop_shift = shift;
+}
+
+//
+// Subgraph archiving support
+//
HeapShared::DumpTimeKlassSubGraphInfoTable* HeapShared::_dump_time_subgraph_info_table = NULL;
HeapShared::RunTimeKlassSubGraphInfoTable HeapShared::_run_time_subgraph_info_table;
@@ -214,7 +389,7 @@
}
void HeapShared::initialize_from_archived_subgraph(Klass* k) {
- if (!MetaspaceShared::open_archive_heap_region_mapped()) {
+ if (!open_archive_heap_region_mapped()) {
return; // nothing to do
}
assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
@@ -274,8 +449,7 @@
// The object refereced by the field becomes 'known' by GC from this
// point. All objects in the subgraph reachable from the object are
// also 'known' by GC.
- oop v = MetaspaceShared::materialize_archived_object(
- entry_field_records->at(i+1));
+ oop v = materialize_archived_object(entry_field_records->at(i+1));
m->obj_field_put(field_offset, v);
i += 2;
@@ -310,7 +484,7 @@
template <class T> void do_oop_work(T *p) {
oop obj = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(obj)) {
- assert(!MetaspaceShared::is_archive_object(obj),
+ assert(!HeapShared::is_archived_object(obj),
"original objects must not point to archived objects");
size_t field_delta = pointer_delta(p, _orig_referencing_obj, sizeof(char));
@@ -329,7 +503,7 @@
oop archived = HeapShared::archive_reachable_objects_from(_level + 1, _subgraph_info, obj, THREAD);
assert(archived != NULL, "VM should have exited with unarchivable objects for _level > 1");
- assert(MetaspaceShared::is_archive_object(archived), "must be");
+ assert(HeapShared::is_archived_object(archived), "must be");
if (!_record_klasses_only) {
// Update the reference in the archived copy of the referencing object.
@@ -347,7 +521,7 @@
// (3) Record the klasses of all orig_obj and all reachable objects.
oop HeapShared::archive_reachable_objects_from(int level, KlassSubGraphInfo* subgraph_info, oop orig_obj, TRAPS) {
assert(orig_obj != NULL, "must be");
- assert(!MetaspaceShared::is_archive_object(orig_obj), "sanity");
+ assert(!is_archived_object(orig_obj), "sanity");
// java.lang.Class instances cannot be included in an archived
// object sub-graph.
@@ -356,7 +530,7 @@
vm_exit(1);
}
- oop archived_obj = MetaspaceShared::find_archived_heap_object(orig_obj);
+ oop archived_obj = find_archived_heap_object(orig_obj);
if (java_lang_String::is_instance(orig_obj) && archived_obj != NULL) {
// To save time, don't walk strings that are already archived. They just contain
// pointers to a type array, whose klass doesn't need to be recorded.
@@ -373,7 +547,7 @@
bool record_klasses_only = (archived_obj != NULL);
if (archived_obj == NULL) {
++_num_new_archived_objs;
- archived_obj = MetaspaceShared::archive_heap_object(orig_obj, THREAD);
+ archived_obj = archive_heap_object(orig_obj, THREAD);
if (archived_obj == NULL) {
// Skip archiving the sub-graph referenced from the current entry field.
ResourceMark rm;
@@ -447,7 +621,7 @@
assert(k->is_shared_boot_class(), "must be boot class");
oop m = k->java_mirror();
- oop archived_m = MetaspaceShared::find_archived_heap_object(m);
+ oop archived_m = find_archived_heap_object(m);
if (CompressedOops::is_null(archived_m)) {
return;
}
@@ -508,7 +682,7 @@
assert(k->is_shared_boot_class(), "must be boot class");
oop m = k->java_mirror();
- oop archived_m = MetaspaceShared::find_archived_heap_object(m);
+ oop archived_m = find_archived_heap_object(m);
if (CompressedOops::is_null(archived_m)) {
return;
}
@@ -519,7 +693,7 @@
}
void HeapShared::verify_subgraph_from(oop orig_obj) {
- oop archived_obj = MetaspaceShared::find_archived_heap_object(orig_obj);
+ oop archived_obj = find_archived_heap_object(orig_obj);
if (archived_obj == NULL) {
// It's OK for the root of a subgraph to be not archived. See comments in
// archive_reachable_objects_from().
@@ -546,11 +720,11 @@
set_has_been_seen_during_subgraph_recording(obj);
if (is_archived) {
- assert(MetaspaceShared::is_archive_object(obj), "must be");
- assert(MetaspaceShared::find_archived_heap_object(obj) == NULL, "must be");
+ assert(is_archived_object(obj), "must be");
+ assert(find_archived_heap_object(obj) == NULL, "must be");
} else {
- assert(!MetaspaceShared::is_archive_object(obj), "must be");
- assert(MetaspaceShared::find_archived_heap_object(obj) != NULL, "must be");
+ assert(!is_archived_object(obj), "must be");
+ assert(find_archived_heap_object(obj) != NULL, "must be");
}
VerifySharedOopClosure walker(is_archived);
@@ -670,7 +844,7 @@
}
}
-void HeapShared::archive_static_fields(Thread* THREAD) {
+void HeapShared::archive_object_subgraphs(Thread* THREAD) {
// For each class X that has one or more archived fields:
// [1] Dump the subgraph of each archived field
// [2] Create a list of all the class of the objects that can be reached
@@ -767,11 +941,6 @@
return oopmap;
}
-void HeapShared::init_narrow_oop_decoding(address base, int shift) {
- _narrow_oop_base = base;
- _narrow_oop_shift = shift;
-}
-
// Patch all the embedded oop pointers inside an archived heap region,
// to be consistent with the runtime oop encoding.
class PatchEmbeddedPointers: public BitMapClosure {
--- a/src/hotspot/share/memory/heapShared.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/memory/heapShared.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -107,7 +107,22 @@
class HeapShared: AllStatic {
friend class VerifySharedOopClosure;
private:
+
#if INCLUDE_CDS_JAVA_HEAP
+ static bool _open_archive_heap_region_mapped;
+ static bool _archive_heap_region_fixed;
+
+ static bool oop_equals(oop const& p1, oop const& p2) {
+ return oopDesc::equals(p1, p2);
+ }
+ static unsigned oop_hash(oop const& p);
+
+ typedef ResourceHashtable<oop, oop,
+ HeapShared::oop_hash,
+ HeapShared::oop_equals,
+ 15889, // prime number
+ ResourceObj::C_HEAP> ArchivedObjectCache;
+ static ArchivedObjectCache* _archived_object_cache;
static bool klass_equals(Klass* const& p1, Klass* const& p2) {
return primitive_equals<Klass*>(p1, p2);
@@ -164,14 +179,6 @@
static address _narrow_oop_base;
static int _narrow_oop_shift;
- static bool oop_equals(oop const& p1, oop const& p2) {
- return primitive_equals<oop>(p1, p2);
- }
-
- static unsigned oop_hash(oop const& p) {
- return primitive_hash<address>((address)p);
- }
-
typedef ResourceHashtable<oop, bool,
HeapShared::oop_hash,
HeapShared::oop_equals,
@@ -207,8 +214,60 @@
static bool has_been_seen_during_subgraph_recording(oop obj);
static void set_has_been_seen_during_subgraph_recording(oop obj);
+
+ public:
+ static void create_archived_object_cache() {
+ _archived_object_cache =
+ new (ResourceObj::C_HEAP, mtClass)ArchivedObjectCache();
+ }
+ static void destroy_archived_object_cache() {
+ delete _archived_object_cache;
+ _archived_object_cache = NULL;
+ }
+ static ArchivedObjectCache* archived_object_cache() {
+ return _archived_object_cache;
+ }
+
+ static oop find_archived_heap_object(oop obj);
+ static oop archive_heap_object(oop obj, Thread* THREAD);
+ static oop materialize_archived_object(narrowOop v);
+
+ static void archive_klass_objects(Thread* THREAD);
+
+ static void set_archive_heap_region_fixed() {
+ _archive_heap_region_fixed = true;
+ }
+ static bool archive_heap_region_fixed() {
+ return _archive_heap_region_fixed;
+ }
+
+ static void archive_java_heap_objects(GrowableArray<MemRegion> *closed,
+ GrowableArray<MemRegion> *open);
+ static void copy_closed_archive_heap_objects(GrowableArray<MemRegion> * closed_archive);
+ static void copy_open_archive_heap_objects(GrowableArray<MemRegion> * open_archive);
#endif // INCLUDE_CDS_JAVA_HEAP
+
public:
+ static bool is_heap_object_archiving_allowed() {
+ CDS_JAVA_HEAP_ONLY(return (UseG1GC && UseCompressedOops && UseCompressedClassPointers);)
+ NOT_CDS_JAVA_HEAP(return false;)
+ }
+
+ static void set_open_archive_heap_region_mapped() {
+ CDS_JAVA_HEAP_ONLY(_open_archive_heap_region_mapped = true);
+ NOT_CDS_JAVA_HEAP_RETURN;
+ }
+ static bool open_archive_heap_region_mapped() {
+ CDS_JAVA_HEAP_ONLY(return _open_archive_heap_region_mapped);
+ NOT_CDS_JAVA_HEAP_RETURN_(false);
+ }
+
+ static void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
+
+ inline static bool is_archived_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
+
+ static void archive_java_heap_objects() NOT_CDS_JAVA_HEAP_RETURN;
+
static char* read_archived_subgraph_infos(char* buffer) NOT_CDS_JAVA_HEAP_RETURN_(buffer);
static void write_archived_subgraph_infos() NOT_CDS_JAVA_HEAP_RETURN;
static void initialize_from_archived_subgraph(Klass* k) NOT_CDS_JAVA_HEAP_RETURN;
@@ -225,7 +284,7 @@
size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN;
static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
- static void archive_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
+ static void archive_object_subgraphs(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
static void write_subgraph_info_table() NOT_CDS_JAVA_HEAP_RETURN;
static void serialize_subgraph_info_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
--- a/src/hotspot/share/memory/heapShared.inline.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/memory/heapShared.inline.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -27,9 +27,16 @@
#include "oops/compressedOops.inline.hpp"
#include "memory/heapShared.hpp"
+#if INCLUDE_G1GC
+#include "gc/g1/g1Allocator.inline.hpp"
+#endif
#if INCLUDE_CDS_JAVA_HEAP
+bool HeapShared::is_archived_object(oop p) {
+ return (p == NULL) ? false : G1ArchiveAllocator::is_archived_object(p);
+}
+
inline oop HeapShared::decode_from_archive(narrowOop v) {
assert(!CompressedOops::is_null(v), "narrow oop value can never be zero");
oop result = (oop)(void*)((uintptr_t)_narrow_oop_base + ((uintptr_t)v << _narrow_oop_shift));
--- a/src/hotspot/share/memory/metaspaceShared.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/memory/metaspaceShared.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -75,8 +75,6 @@
bool MetaspaceShared::_has_error_classes;
bool MetaspaceShared::_archive_loading_failed = false;
bool MetaspaceShared::_remapped_readwrite = false;
-bool MetaspaceShared::_open_archive_heap_region_mapped = false;
-bool MetaspaceShared::_archive_heap_region_fixed = false;
address MetaspaceShared::_cds_i2i_entry_code_buffers = NULL;
size_t MetaspaceShared::_cds_i2i_entry_code_buffers_size = 0;
size_t MetaspaceShared::_core_spaces_size = 0;
@@ -108,7 +106,7 @@
// [5] C++ vtables are copied into the md region.
// [6] Original class files are copied into the od region.
//
-// The s0/s1 and oa0/oa1 regions are populated inside MetaspaceShared::dump_java_heap_objects.
+// The s0/s1 and oa0/oa1 regions are populated inside HeapShared::archive_java_heap_objects.
// Their layout is independent of the other 5 regions.
class DumpRegion {
@@ -454,6 +452,10 @@
// is run at a safepoint just before exit, this is the entire set of classes.
static GrowableArray<Klass*>* _global_klass_objects;
+GrowableArray<Klass*>* MetaspaceShared::collected_klasses() {
+ return _global_klass_objects;
+}
+
static void collect_array_classes(Klass* k) {
_global_klass_objects->append_if_missing(k);
if (k->is_array_klass()) {
@@ -512,7 +514,7 @@
}
static void clear_basic_type_mirrors() {
- assert(!MetaspaceShared::is_heap_object_archiving_allowed(), "Sanity");
+ assert(!HeapShared::is_heap_object_archiving_allowed(), "Sanity");
Universe::set_int_mirror(NULL);
Universe::set_float_mirror(NULL);
Universe::set_double_mirror(NULL);
@@ -850,7 +852,7 @@
if (*o == NULL) {
_dump_region->append_intptr_t(0);
} else {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(),
+ assert(HeapShared::is_heap_object_archiving_allowed(),
"Archiving heap object is not allowed");
_dump_region->append_intptr_t(
(intptr_t)CompressedOops::encode_not_null(*o));
@@ -1329,7 +1331,7 @@
SystemDictionary::reorder_dictionary_for_sharing();
tty->print("Removing java_mirror ... ");
- if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (!HeapShared::is_heap_object_archiving_allowed()) {
clear_basic_type_mirrors();
}
remove_java_mirror_in_classes();
@@ -1798,47 +1800,18 @@
#if INCLUDE_CDS_JAVA_HEAP
void VM_PopulateDumpSharedSpace::dump_java_heap_objects() {
- if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
- if (log_is_enabled(Info, cds)) {
- log_info(cds)(
- "Archived java heap is not supported as UseG1GC, "
- "UseCompressedOops and UseCompressedClassPointers are required."
- "Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.",
- BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedOops),
- BOOL_TO_STR(UseCompressedClassPointers));
- }
- return;
- }
-
- {
- NoSafepointVerifier nsv;
-
- // Cache for recording where the archived objects are copied to
- MetaspaceShared::create_archive_object_cache();
-
- tty->print_cr("Dumping objects to closed archive heap region ...");
- NOT_PRODUCT(StringTable::verify());
- // The closed space has maximum two regions. See FileMapInfo::write_archive_heap_regions() for details.
- _closed_archive_heap_regions = new GrowableArray<MemRegion>(2);
- MetaspaceShared::dump_closed_archive_heap_objects(_closed_archive_heap_regions);
-
- tty->print_cr("Dumping objects to open archive heap region ...");
- _open_archive_heap_regions = new GrowableArray<MemRegion>(2);
- MetaspaceShared::dump_open_archive_heap_objects(_open_archive_heap_regions);
-
- MetaspaceShared::destroy_archive_object_cache();
- }
-
- G1HeapVerifier::verify_archive_regions();
-
- {
- ArchiveCompactor::OtherROAllocMark mark;
- HeapShared::write_subgraph_info_table();
- }
+ // The closed and open archive heap space has maximum two regions.
+ // See FileMapInfo::write_archive_heap_regions() for details.
+ _closed_archive_heap_regions = new GrowableArray<MemRegion>(2);
+ _open_archive_heap_regions = new GrowableArray<MemRegion>(2);
+ HeapShared::archive_java_heap_objects(_closed_archive_heap_regions,
+ _open_archive_heap_regions);
+ ArchiveCompactor::OtherROAllocMark mark;
+ HeapShared::write_subgraph_info_table();
}
void VM_PopulateDumpSharedSpace::dump_archive_heap_oopmaps() {
- if (MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (HeapShared::is_heap_object_archiving_allowed()) {
_closed_archive_heap_oopmaps = new GrowableArray<ArchiveHeapOopmapInfo>(2);
dump_archive_heap_oopmaps(_closed_archive_heap_regions, _closed_archive_heap_oopmaps);
@@ -1866,124 +1839,6 @@
oopmaps->append(info);
}
}
-
-void MetaspaceShared::dump_closed_archive_heap_objects(
- GrowableArray<MemRegion> * closed_archive) {
- assert(is_heap_object_archiving_allowed(), "Cannot dump java heap objects");
-
- Thread* THREAD = Thread::current();
- G1CollectedHeap::heap()->begin_archive_alloc_range();
-
- // Archive interned string objects
- StringTable::write_to_archive();
-
- G1CollectedHeap::heap()->end_archive_alloc_range(closed_archive,
- os::vm_allocation_granularity());
-}
-
-void MetaspaceShared::dump_open_archive_heap_objects(
- GrowableArray<MemRegion> * open_archive) {
- assert(UseG1GC, "Only support G1 GC");
- assert(UseCompressedOops && UseCompressedClassPointers,
- "Only support UseCompressedOops and UseCompressedClassPointers enabled");
-
- Thread* THREAD = Thread::current();
- G1CollectedHeap::heap()->begin_archive_alloc_range(true /* open */);
-
- java_lang_Class::archive_basic_type_mirrors(THREAD);
-
- MetaspaceShared::archive_klass_objects(THREAD);
-
- HeapShared::archive_static_fields(THREAD);
-
- G1CollectedHeap::heap()->end_archive_alloc_range(open_archive,
- os::vm_allocation_granularity());
-}
-
-unsigned MetaspaceShared::obj_hash(oop const& p) {
- assert(!p->mark()->has_bias_pattern(),
- "this object should never have been locked"); // so identity_hash won't safepoint
- unsigned hash = (unsigned)p->identity_hash();
- return hash;
-}
-
-MetaspaceShared::ArchivedObjectCache* MetaspaceShared::_archive_object_cache = NULL;
-oop MetaspaceShared::find_archived_heap_object(oop obj) {
- assert(DumpSharedSpaces, "dump-time only");
- ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache();
- oop* p = cache->get(obj);
- if (p != NULL) {
- return *p;
- } else {
- return NULL;
- }
-}
-
-oop MetaspaceShared::archive_heap_object(oop obj, Thread* THREAD) {
- assert(DumpSharedSpaces, "dump-time only");
-
- oop ao = find_archived_heap_object(obj);
- if (ao != NULL) {
- // already archived
- return ao;
- }
-
- int len = obj->size();
- if (G1CollectedHeap::heap()->is_archive_alloc_too_large(len)) {
- log_debug(cds, heap)("Cannot archive, object (" PTR_FORMAT ") is too large: " SIZE_FORMAT,
- p2i(obj), (size_t)obj->size());
- return NULL;
- }
-
- int hash = obj->identity_hash();
- oop archived_oop = (oop)G1CollectedHeap::heap()->archive_mem_allocate(len);
- if (archived_oop != NULL) {
- Copy::aligned_disjoint_words((HeapWord*)obj, (HeapWord*)archived_oop, len);
- relocate_klass_ptr(archived_oop);
- ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache();
- cache->put(obj, archived_oop);
- log_debug(cds, heap)("Archived heap object " PTR_FORMAT " ==> " PTR_FORMAT,
- p2i(obj), p2i(archived_oop));
- } else {
- log_error(cds, heap)(
- "Cannot allocate space for object " PTR_FORMAT " in archived heap region",
- p2i(obj));
- vm_exit(1);
- }
- return archived_oop;
-}
-
-oop MetaspaceShared::materialize_archived_object(narrowOop v) {
- assert(archive_heap_region_fixed(),
- "must be called after archive heap regions are fixed");
- if (!CompressedOops::is_null(v)) {
- oop obj = HeapShared::decode_from_archive(v);
- return G1CollectedHeap::heap()->materialize_archived_object(obj);
- }
- return NULL;
-}
-
-void MetaspaceShared::archive_klass_objects(Thread* THREAD) {
- int i;
- for (i = 0; i < _global_klass_objects->length(); i++) {
- Klass* k = _global_klass_objects->at(i);
-
- // archive mirror object
- java_lang_Class::archive_mirror(k, CHECK);
-
- // archive the resolved_referenes array
- if (k->is_instance_klass()) {
- InstanceKlass* ik = InstanceKlass::cast(k);
- ik->constants()->archive_resolved_references(THREAD);
- }
- }
-}
-
-void MetaspaceShared::fixup_mapped_heap_regions() {
- FileMapInfo *mapinfo = FileMapInfo::current_info();
- mapinfo->fixup_mapped_heap_regions();
- set_archive_heap_region_fixed();
-}
#endif // INCLUDE_CDS_JAVA_HEAP
// Closure for serializing initialization data in from a data area
@@ -2023,12 +1878,12 @@
void do_oop(oop *p) {
narrowOop o = (narrowOop)nextPtr();
- if (o == 0 || !MetaspaceShared::open_archive_heap_region_mapped()) {
+ if (o == 0 || !HeapShared::open_archive_heap_region_mapped()) {
p = NULL;
} else {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(),
+ assert(HeapShared::is_heap_object_archiving_allowed(),
"Archived heap object is not allowed");
- assert(MetaspaceShared::open_archive_heap_region_mapped(),
+ assert(HeapShared::open_archive_heap_region_mapped(),
"Open archive heap region is not mapped");
*p = HeapShared::decode_from_archive(o);
}
--- a/src/hotspot/share/memory/metaspaceShared.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/memory/metaspaceShared.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -58,8 +58,6 @@
static bool _has_error_classes;
static bool _archive_loading_failed;
static bool _remapped_readwrite;
- static bool _open_archive_heap_region_mapped;
- static bool _archive_heap_region_fixed;
static address _cds_i2i_entry_code_buffers;
static size_t _cds_i2i_entry_code_buffers_size;
static size_t _core_spaces_size;
@@ -93,63 +91,7 @@
static int preload_classes(const char * class_list_path,
TRAPS) NOT_CDS_RETURN_(0);
-#if INCLUDE_CDS_JAVA_HEAP
- private:
- static bool obj_equals(oop const& p1, oop const& p2) {
- return p1 == p2;
- }
- static unsigned obj_hash(oop const& p);
-
- typedef ResourceHashtable<oop, oop,
- MetaspaceShared::obj_hash,
- MetaspaceShared::obj_equals,
- 15889, // prime number
- ResourceObj::C_HEAP> ArchivedObjectCache;
- static ArchivedObjectCache* _archive_object_cache;
-
- public:
- static ArchivedObjectCache* archive_object_cache() {
- return _archive_object_cache;
- }
- static oop find_archived_heap_object(oop obj);
- static oop archive_heap_object(oop obj, Thread* THREAD);
- static oop materialize_archived_object(narrowOop v);
- static void archive_klass_objects(Thread* THREAD);
-
- static void set_archive_heap_region_fixed() {
- _archive_heap_region_fixed = true;
- }
-
- static bool archive_heap_region_fixed() {
- return _archive_heap_region_fixed;
- }
-#endif
-
- inline static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
-
- static bool is_heap_object_archiving_allowed() {
- CDS_JAVA_HEAP_ONLY(return (UseG1GC && UseCompressedOops && UseCompressedClassPointers);)
- NOT_CDS_JAVA_HEAP(return false;)
- }
- static void create_archive_object_cache() {
- CDS_JAVA_HEAP_ONLY(_archive_object_cache = new (ResourceObj::C_HEAP, mtClass)ArchivedObjectCache(););
- }
- static void destroy_archive_object_cache() {
- CDS_JAVA_HEAP_ONLY(delete _archive_object_cache; _archive_object_cache = NULL;);
- }
- static void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
-
- static void dump_closed_archive_heap_objects(GrowableArray<MemRegion> * closed_archive) NOT_CDS_JAVA_HEAP_RETURN;
-
- static void dump_open_archive_heap_objects(GrowableArray<MemRegion> * open_archive) NOT_CDS_JAVA_HEAP_RETURN;
- static void set_open_archive_heap_region_mapped() {
- CDS_JAVA_HEAP_ONLY(_open_archive_heap_region_mapped = true);
- NOT_CDS_JAVA_HEAP_RETURN;
- }
- static bool open_archive_heap_region_mapped() {
- CDS_JAVA_HEAP_ONLY(return _open_archive_heap_region_mapped);
- NOT_CDS_JAVA_HEAP_RETURN_(false);
- }
+ static GrowableArray<Klass*>* collected_klasses();
static ReservedSpace* shared_rs() {
CDS_ONLY(return &_shared_rs);
--- a/src/hotspot/share/memory/universe.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/memory/universe.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -39,6 +39,7 @@
#include "interpreter/interpreter.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
+#include "memory/heapShared.hpp"
#include "memory/filemap.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
@@ -242,8 +243,15 @@
f->do_ptr((void**)&_objectArrayKlassObj);
#if INCLUDE_CDS_JAVA_HEAP
- // The mirrors are NULL if MetaspaceShared::is_heap_object_archiving_allowed
- // is false.
+#ifdef ASSERT
+ if (DumpSharedSpaces && !HeapShared::is_heap_object_archiving_allowed()) {
+ assert(_int_mirror == NULL && _float_mirror == NULL &&
+ _double_mirror == NULL && _byte_mirror == NULL &&
+ _bool_mirror == NULL && _char_mirror == NULL &&
+ _long_mirror == NULL && _short_mirror == NULL &&
+ _void_mirror == NULL, "mirrors should be NULL");
+ }
+#endif
f->do_oop(&_int_mirror);
f->do_oop(&_float_mirror);
f->do_oop(&_double_mirror);
@@ -422,9 +430,9 @@
void Universe::initialize_basic_type_mirrors(TRAPS) {
#if INCLUDE_CDS_JAVA_HEAP
if (UseSharedSpaces &&
- MetaspaceShared::open_archive_heap_region_mapped() &&
+ HeapShared::open_archive_heap_region_mapped() &&
_int_mirror != NULL) {
- assert(MetaspaceShared::is_heap_object_archiving_allowed(), "Sanity");
+ assert(HeapShared::is_heap_object_archiving_allowed(), "Sanity");
assert(_float_mirror != NULL && _double_mirror != NULL &&
_byte_mirror != NULL && _byte_mirror != NULL &&
_bool_mirror != NULL && _char_mirror != NULL &&
--- a/src/hotspot/share/oops/constantPool.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/oops/constantPool.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -33,6 +33,7 @@
#include "interpreter/linkResolver.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/heapInspection.hpp"
+#include "memory/heapShared.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/metaspaceShared.hpp"
@@ -295,7 +296,7 @@
}
}
- oop archived = MetaspaceShared::archive_heap_object(rr, THREAD);
+ oop archived = HeapShared::archive_heap_object(rr, THREAD);
// If the resolved references array is not archived (too large),
// the 'archived' object is NULL. No need to explicitly check
// the return value of archive_heap_object here. At runtime, the
@@ -340,7 +341,7 @@
if (SystemDictionary::Object_klass_loaded()) {
ClassLoaderData* loader_data = pool_holder()->class_loader_data();
#if INCLUDE_CDS_JAVA_HEAP
- if (MetaspaceShared::open_archive_heap_region_mapped() &&
+ if (HeapShared::open_archive_heap_region_mapped() &&
_cache->archived_references() != NULL) {
oop archived = _cache->archived_references();
// Create handle for the archived resolved reference array object
@@ -373,7 +374,7 @@
// If archiving heap objects is not allowed, clear the resolved references.
// Otherwise, it is cleared after the resolved references array is cached
// (see archive_resolved_references()).
- if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
+ if (!HeapShared::is_heap_object_archiving_allowed()) {
set_resolved_references(NULL);
}
--- a/src/hotspot/share/oops/cpCache.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/oops/cpCache.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -30,6 +30,7 @@
#include "interpreter/linkResolver.hpp"
#include "interpreter/rewriter.hpp"
#include "logging/log.hpp"
+#include "memory/heapShared.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/metaspaceShared.hpp"
@@ -777,7 +778,7 @@
if (CompressedOops::is_null(_archived_references)) {
return NULL;
}
- return MetaspaceShared::materialize_archived_object(_archived_references);
+ return HeapShared::materialize_archived_object(_archived_references);
}
void ConstantPoolCache::set_archived_references(oop o) {
--- a/src/hotspot/share/oops/klass.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/oops/klass.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -32,6 +32,7 @@
#include "gc/shared/collectedHeap.inline.hpp"
#include "logging/log.hpp"
#include "memory/heapInspection.hpp"
+#include "memory/heapShared.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceClosure.hpp"
#include "memory/metaspaceShared.hpp"
@@ -542,7 +543,7 @@
if (this->has_raw_archived_mirror()) {
ResourceMark rm;
log_debug(cds, mirror)("%s has raw archived mirror", external_name());
- if (MetaspaceShared::open_archive_heap_region_mapped()) {
+ if (HeapShared::open_archive_heap_region_mapped()) {
bool present = java_lang_Class::restore_archived_mirror(this, loader, module_handle,
protection_domain,
CHECK);
--- a/src/hotspot/share/oops/oop.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/oops/oop.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -25,7 +25,7 @@
#include "precompiled.hpp"
#include "classfile/altHashing.hpp"
#include "classfile/javaClasses.inline.hpp"
-#include "memory/metaspaceShared.inline.hpp"
+#include "memory/heapShared.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp"
#include "oops/oop.inline.hpp"
@@ -144,8 +144,8 @@
}
#if INCLUDE_CDS_JAVA_HEAP
-bool oopDesc::is_archive_object(oop p) {
- return MetaspaceShared::is_archive_object(p);
+bool oopDesc::is_archived_object(oop p) {
+ return HeapShared::is_archived_object(p);
}
#endif
#endif // PRODUCT
--- a/src/hotspot/share/oops/oop.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/oops/oop.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -46,7 +46,6 @@
class ScanClosure;
class FastScanClosure;
class FilteringClosure;
-class BarrierSet;
class CMSIsAliveClosure;
class PSPromotionManager;
@@ -256,7 +255,7 @@
static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
#ifndef PRODUCT
inline bool is_unlocked_oop() const;
- static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
+ static bool is_archived_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
#endif
// garbage collection
--- a/src/hotspot/share/oops/oop.inline.hpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/oops/oop.inline.hpp Tue Oct 09 18:33:25 2018 -0400
@@ -351,8 +351,8 @@
"forwarding to something not aligned");
assert(Universe::heap()->is_in_reserved(p),
"forwarding to something not in heap");
- assert(!is_archive_object(oop(this)) &&
- !is_archive_object(p),
+ assert(!is_archived_object(oop(this)) &&
+ !is_archived_object(p),
"forwarding archive object");
markOop m = markOopDesc::encode_pointer_as_mark(p);
assert(m->decode_pointer() == p, "encoding must be reversable");
--- a/src/hotspot/share/prims/whitebox.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/src/hotspot/share/prims/whitebox.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -36,8 +36,9 @@
#include "gc/shared/gcConfig.hpp"
#include "gc/shared/genCollectedHeap.hpp"
#include "jvmtifiles/jvmtiEnv.hpp"
+#include "memory/heapShared.inline.hpp"
+#include "memory/metaspaceShared.hpp"
#include "memory/metadataFactory.hpp"
-#include "memory/metaspaceShared.inline.hpp"
#include "memory/iterator.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
@@ -1765,7 +1766,7 @@
WB_ENTRY(jboolean, WB_IsShared(JNIEnv* env, jobject wb, jobject obj))
oop obj_oop = JNIHandles::resolve(obj);
- return MetaspaceShared::is_archive_object(obj_oop);
+ return HeapShared::is_archived_object(obj_oop);
WB_END
WB_ENTRY(jboolean, WB_IsSharedClass(JNIEnv* env, jobject wb, jclass clazz))
@@ -1789,7 +1790,7 @@
WB_END
WB_ENTRY(jboolean, WB_AreOpenArchiveHeapObjectsMapped(JNIEnv* env))
- return MetaspaceShared::open_archive_heap_region_mapped();
+ return HeapShared::open_archive_heap_region_mapped();
WB_END
WB_ENTRY(jboolean, WB_IsCDSIncludedInVmBuild(JNIEnv* env))
@@ -1807,7 +1808,7 @@
WB_END
WB_ENTRY(jboolean, WB_IsJavaHeapArchiveSupported(JNIEnv* env))
- return MetaspaceShared::is_heap_object_archiving_allowed();
+ return HeapShared::is_heap_object_archiving_allowed();
WB_END
--- a/src/java.base/share/classes/java/util/jar/Attributes.java Tue Oct 09 18:29:53 2018 -0400
+++ b/src/java.base/share/classes/java/util/jar/Attributes.java Tue Oct 09 18:33:25 2018 -0400
@@ -550,7 +550,7 @@
* {@code Name} object for {@code Manifest-Version}
* manifest attribute. This attribute indicates the version number
* of the manifest standard to which a JAR file's manifest conforms.
- * @see <a href="{@docRoot}/../specs/jar/jar.html#JAR_Manifest">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#jar-manifest">
* Manifest and Signature Specification</a>
*/
public static final Name MANIFEST_VERSION = new Name("Manifest-Version");
@@ -558,7 +558,7 @@
/**
* {@code Name} object for {@code Signature-Version}
* manifest attribute used when signing JAR files.
- * @see <a href="{@docRoot}/../specs/jar/jar.html#JAR_Manifest">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#jar-manifest">
* Manifest and Signature Specification</a>
*/
public static final Name SIGNATURE_VERSION = new Name("Signature-Version");
@@ -572,7 +572,7 @@
/**
* {@code Name} object for {@code Class-Path}
* manifest attribute.
- * @see <a href="{@docRoot}/../specs/jar/jar.html#classpath">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#class-path-attribute">
* JAR file specification</a>
*/
public static final Name CLASS_PATH = new Name("Class-Path");
--- a/test/hotspot/jtreg/ProblemList.txt Tue Oct 09 18:29:53 2018 -0400
+++ b/test/hotspot/jtreg/ProblemList.txt Tue Oct 09 18:33:25 2018 -0400
@@ -59,6 +59,8 @@
compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all
+compiler/runtime/Test8168712.java 8211769,8211771 generic-ppc64,generic-ppc64le,linux-s390x
+
#############################################################################
# :hotspot_gc
@@ -91,50 +93,50 @@
serviceability/sa/ClhsdbAttach.java 8193639 solaris-all
serviceability/sa/ClhsdbCDSCore.java 8193639 solaris-all
-serviceability/sa/ClhsdbCDSJstackPrintAll.java 8193639 solaris-all
+serviceability/sa/ClhsdbCDSJstackPrintAll.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/CDSJMapClstats.java 8193639 solaris-all
serviceability/sa/ClhsdbField.java 8193639 solaris-all
-serviceability/sa/ClhsdbFindPC.java 8193639 solaris-all
+serviceability/sa/ClhsdbFindPC.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbFlags.java 8193639 solaris-all
-serviceability/sa/ClhsdbInspect.java 8193639 solaris-all
-serviceability/sa/ClhsdbJdis.java 8193639 solaris-all
-serviceability/sa/ClhsdbJhisto.java 8193639 solaris-all
-serviceability/sa/ClhsdbJstack.java 8193639 solaris-all
+serviceability/sa/ClhsdbInspect.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/ClhsdbJdis.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/ClhsdbJhisto.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/ClhsdbJstack.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbLongConstant.java 8193639 solaris-all
-serviceability/sa/ClhsdbPmap.java 8193639 solaris-all
+serviceability/sa/ClhsdbPmap.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbPrintAll.java 8193639 solaris-all
-serviceability/sa/ClhsdbPrintAs.java 8193639 solaris-all
+serviceability/sa/ClhsdbPrintAs.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbPrintStatics.java 8193639 solaris-all
-serviceability/sa/ClhsdbPstack.java 8193639 solaris-all
+serviceability/sa/ClhsdbPstack.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8193639 solaris-all
-serviceability/sa/ClhsdbScanOops.java 8193639 solaris-all
-serviceability/sa/ClhsdbSource.java 8193639 solaris-all
+serviceability/sa/ClhsdbScanOops.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/ClhsdbSource.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbSymbol.java 8193639 solaris-all
serviceability/sa/ClhsdbSymbolTable.java 8193639 solaris-all
-serviceability/sa/ClhsdbThread.java 8193639 solaris-all
+serviceability/sa/ClhsdbThread.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/ClhsdbVmStructsDump.java 8193639 solaris-all
-serviceability/sa/ClhsdbWhere.java 8193639 solaris-all
-serviceability/sa/DeadlockDetectionTest.java 8193639 solaris-all
-serviceability/sa/JhsdbThreadInfoTest.java 8193639 solaris-all
+serviceability/sa/ClhsdbWhere.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/DeadlockDetectionTest.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/JhsdbThreadInfoTest.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java 8193639 solaris-all
serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
serviceability/sa/TestClassDump.java 8193639 solaris-all
-serviceability/sa/TestClhsdbJstackLock.java 8193639 solaris-all
-serviceability/sa/TestCpoolForInvokeDynamic.java 8193639 solaris-all
+serviceability/sa/TestClhsdbJstackLock.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/TestCpoolForInvokeDynamic.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/TestDefaultMethods.java 8193639 solaris-all
serviceability/sa/TestG1HeapRegion.java 8193639 solaris-all
serviceability/sa/TestHeapDumpForInvokeDynamic.java 8193639 solaris-all
serviceability/sa/TestHeapDumpForLargeArray.java 8193639 solaris-all
serviceability/sa/TestInstanceKlassSize.java 8193639 solaris-all
serviceability/sa/TestInstanceKlassSizeForInterface.java 8193639 solaris-all
-serviceability/sa/TestIntConstant.java 8193639 solaris-all
-serviceability/sa/TestJhsdbJstackLock.java 8193639 solaris-all
+serviceability/sa/TestIntConstant.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
+serviceability/sa/TestJhsdbJstackLock.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
serviceability/sa/TestJmapCore.java 8193639 solaris-all
serviceability/sa/TestJmapCoreMetaspace.java 8193639 solaris-all
serviceability/sa/TestPrintMdo.java 8193639 solaris-all
serviceability/sa/TestRevPtrsForInvokeDynamic.java 8191270 generic-all
serviceability/sa/TestType.java 8193639 solaris-all
-serviceability/sa/TestUniverse.java#id0 8193639 solaris-all
+serviceability/sa/TestUniverse.java#id0 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
#############################################################################
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001.java Tue Oct 09 18:29:53 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001.java Tue Oct 09 18:33:25 2018 -0400
@@ -71,7 +71,7 @@
thread.waitingBarrier1.unlock();
try {
- Thread.sleep(100);
+ Thread.sleep(1000); // Wait for contended "synchronized (M)"
thread.M.wait(timeout);
} catch (InterruptedException e) {
throw new Failure(e);
@@ -79,7 +79,7 @@
thread.waitingBarrier2.unlock();
try {
- Thread.sleep(100);
+ Thread.sleep(1000); // Wait for contended "synchronized (M)"
thread.M.wait(timeout);
} catch (InterruptedException e) {
throw new Failure(e);
@@ -87,7 +87,7 @@
thread.waitingBarrier3.unlock();
try {
- Thread.sleep(100);
+ Thread.sleep(1000); // Wait for contended "synchronized (M)"
thread.M.wait(timeout);
} catch (InterruptedException e) {
throw new Failure(e);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp Tue Oct 09 18:29:53 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp Tue Oct 09 18:33:25 2018 -0400
@@ -73,8 +73,7 @@
return;
}
- jclassName = (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, klass,
- methodID);
+ jclassName = (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, klass, methodID);
className = NSK_CPP_STUB3(GetStringUTFChars, jni_env, jclassName, 0);
--- a/test/jdk/ProblemList.txt Tue Oct 09 18:29:53 2018 -0400
+++ b/test/jdk/ProblemList.txt Tue Oct 09 18:33:25 2018 -0400
@@ -508,6 +508,8 @@
# jdk_lang
java/lang/StringCoding/CheckEncodings.sh 7008363 generic-all
+java/lang/ProcessBuilder/PipelineTest.java 8211844 aix-ppc64
+java/lang/ProcessHandle/InfoTest.java 8211847 aix-ppc64
############################################################################
@@ -556,6 +558,8 @@
java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all
+java/net/ServerSocket/AcceptInheritHandle.java 8211854 aix-ppc64
+
############################################################################
# jdk_nio
@@ -564,6 +568,8 @@
java/nio/channels/DatagramChannel/ChangingAddress.java 7141822 macosx-all
+java/nio/channels/AsynchronousSocketChannel/StressLoopback.java 8211851 aix-ppc64
+
java/nio/channels/Selector/Wakeup.java 6963118 windows-all
java/nio/file/WatchService/Basic.java 7158947 solaris-all Solaris 11
@@ -571,6 +577,8 @@
java/nio/file/WatchService/LotsOfCancels.java 8188039 solaris-all Solaris 11
java/nio/file/WatchService/LotsOfEvents.java 7158947 solaris-all Solaris 11
+sun/nio/cs/OLD/TestIBMDB.java 8211841 aix-ppc64
+
############################################################################
# jdk_rmi
@@ -852,7 +860,7 @@
# svc_tools
sun/tools/jstat/jstatClassloadOutput1.sh 8173942 generic-all
-sun/tools/jhsdb/BasicLauncherTest.java 8193639 solaris-all
+sun/tools/jhsdb/BasicLauncherTest.java 8193639,8211767 solaris-all,linux-ppc64,linux-ppc64le
sun/tools/jhsdb/HeapDumpTest.java 8193639 solaris-all
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/DeferredStepTest.java Tue Oct 09 18:33:25 2018 -0400
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2002, 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.
+ */
+
+/*
+ * @test
+ * @bug 4629548
+ * @summary Deferred StepRequests are lost in multithreaded debuggee
+ * @comment converted from test/jdk/com/sun/jdi/DeferredStepTest.sh
+ *
+ * @library /test/lib
+ * @build DeferredStepTest
+ * @run main/othervm DeferredStepTest
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+class DeferredStepTestTarg {
+ static class jj1 implements Runnable {
+ public void run() {
+ int count = 0;
+
+ for ( int ii = 0; ii < 10; ii++) {
+ int intInPotato04 = 666;
+ ++count; // @1 breakpoint
+ System.out.println("Thread: " + Thread.currentThread().getName());
+ }
+ }
+ }
+
+ static class jj2 implements Runnable {
+ public void run() {
+ int count2 = 0;
+
+ for (int ii = 0; ii < 10; ii++) {
+ String StringInPotato05 = "I am";
+ ++count2; // @2 breakpoint
+ System.out.println("Thread: " + Thread.currentThread().getName());
+ }
+ }
+ }
+
+ public static void main(String argv[]) {
+ System.out.println("Version = " + System.getProperty("java.version"));
+
+ jj1 obj1 = new jj1();
+ jj2 obj2 = new jj2();
+ new Thread(obj1, "jj1").start();
+ new Thread(obj2, "jj2").start();
+ }
+}
+
+public class DeferredStepTest extends JdbTest {
+ public static void main(String argv[]) {
+ new DeferredStepTest().run();
+ }
+
+ private DeferredStepTest() {
+ super(DeferredStepTestTarg.class.getName());
+ }
+
+ private static class ThreadData {
+ int lastLine = -1; // line of the last stop
+ int minLine = -1; // min line (-1 means "not known yet")
+ int maxLine = -1; // max line (-1 means "not known yet")
+ }
+
+ private Map<String, ThreadData> threadData = new HashMap<>();
+
+ private Pattern threadRegexp = Pattern.compile("^(.+)\\[\\d+\\].*");
+ private Pattern lineRegexp = Pattern.compile("^(\\d+)\\b.*", Pattern.MULTILINE);
+
+ // returns the 1st group of the pattern.
+ private String parse(Pattern p, String input) {
+ Matcher m = p.matcher(input);
+ if (!m.find()) {
+ throw new RuntimeException("Input '" + input + "' does not matches '" + p.pattern() + "'");
+ }
+ return m.group(1);
+ }
+
+ private void next() {
+ List<String> reply = jdb.command(JdbCommand.next());
+ /*
+ * Each "next" produces something like ("Breakpoint hit" line only if the line has BP)
+ * Step completed:
+ * Breakpoint hit: "thread=jj2", DeferredStepTestTarg$jj2.run(), line=74 bci=12
+ * 74 ++count2; // @2 breakpoint
+ * <empty line>
+ * jj2[1]
+ */
+ // detect thread from the last line
+ String lastLine = reply.get(reply.size() - 1);
+ String threadName = parse(threadRegexp, lastLine);
+ String wholeReply = reply.stream().collect(Collectors.joining(Utils.NEW_LINE));
+ int lineNum = Integer.parseInt(parse(lineRegexp, wholeReply));
+
+ System.out.println("got: thread=" + threadName + ", line=" + lineNum);
+
+ ThreadData data = threadData.get(threadName);
+ if (data == null) {
+ data = new ThreadData();
+ threadData.put(threadName, data);
+ }
+ processThreadData(threadName, lineNum, data);
+ }
+
+ private void processThreadData(String threadName, int lineNum, ThreadData data) {
+ int lastLine = data.lastLine;
+ data.lastLine = lineNum;
+ if (lastLine < 0) {
+ // the 1st stop in the thread
+ return;
+ }
+ if (lineNum == lastLine + 1) {
+ // expected.
+ return;
+ }
+ if (lineNum < lastLine) {
+ // looks like step to the beginning of the cycle
+ if (data.minLine > 0) {
+ // minLine and maxLine are not set - verify
+ Asserts.assertEquals(lineNum, data.minLine, threadName + " - minLine");
+ Asserts.assertEquals(lastLine, data.maxLine, threadName + " - maxLine");
+ } else {
+ // set minLine/maxLine
+ data.minLine = lineNum;
+ data.maxLine = lastLine;
+ }
+ return;
+ }
+ throw new RuntimeException(threadName + " (line " + lineNum + ") - unexpected."
+ + " lastLine=" + lastLine + ", minLine=" + data.minLine + ", maxLine=" + data.maxLine);
+ }
+
+ @Override
+ protected void runCases() {
+ setBreakpoints(jdb, DeferredStepTestTarg.jj1.class.getName(),
+ getTestSourcePath("DeferredStepTest.java"), 1);
+ setBreakpoints(jdb, DeferredStepTestTarg.jj2.class.getName(),
+ getTestSourcePath("DeferredStepTest.java"), 2);
+
+ // Run to breakpoint #1
+ jdb.command(JdbCommand.run());
+
+ // 2 cycles with 4 lines each - maximum 80 stops
+ for (int i=0; i<50; i++) {
+ next();
+ }
+ }
+}
--- a/test/jdk/com/sun/jdi/DeferredStepTest.sh Tue Oct 09 18:29:53 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2014, 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.
-#
-
-# @ test
-# This is a manual test. The script isn't smart enough
-# to detect the correct ordering of the output since it
-# is produced by multiple threads and can be interleaved
-# in many different ways.
-#
-# @bug 4629548
-# @summary Deferred StepRequests are lost in multithreaded debuggee
-# @author Jim Holmlund
-#
-# @run shell/manual DeferredStepTest.sh
-
-# Run this script to see the bug. See comments at the end
-# of the .java file for info on what the bug looks like.
-
-# These are variables that can be set to control execution
-
-#pkg=untitled7
-classname=DeferredStepTest
-#compileOptions=-g
-#java=java_g
-#mode=-Xcomp
-
-createJavaFile()
-{
- cat <<EOF > $classname.java.1
-public class $classname {
- static class jj1 implements Runnable {
- public void run() {
- int count = 0;
-
- for ( int ii = 0; ii < 10; ii++) { // line 6
- int intInPotato04 = 666; // line 7
- ++count; // line 8; @1 breakpoint
- System.out.println("Thread: " + Thread.currentThread().getName()); // line 9
- }
- }
- }
-
- static class jj2 implements Runnable {
- public void run() {
- int count2 = 0;
-
- for (int ii = 0; ii < 10; ii++) { // line 18
- String StringInPotato05 = "I am"; // line 19
- ++count2; // line 20; @1 breakpoint
- System.out.println("Thread: " + Thread.currentThread().getName()); // line 21
- }
- }
- }
-
- public static void main(String argv[]) {
- System.out.println("Version = " + System.getProperty("java.version"));
-
- jj1 aRP = new jj1();
- jj2 asRP = new jj2();
- new Thread(aRP, "jj1 *").start();
- new Thread(asRP, "jj2 **").start();
-// new Thread(aRP, "jj3 ***").start();
-// new Thread(asRP, "jj4 ****").start();
- }
-}
-
-/****************************
-To see this bug, do this
-
- jdb DeferredStep
- stop at DeferredStepTest$jj1:8
- stop at DeferredStepTest$jj2:20
- run
- next
- next
- :
-
-********/
-
-EOF
-}
-
-#sleepcmd="sleep 2"
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
- #set -x
- # We can't use setBkpts because it can only set bkpts in one class :-(
- #setBkpts @1
- cmd stop at $classname'$jj1:8'
- cmd stop at $classname'$jj2:20'
- #cmd run; $sleepcmd
- runToBkpt @1
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
- cmd next; $sleepcmd
-}
-
-mysetup()
-{
- if [ -z "$TESTSRC" ] ; then
- TESTSRC=.
- fi
-
- for ii in . $TESTSRC $TESTSRC/.. ; do
- if [ -r "$ii/ShellScaffold.sh" ] ; then
- . $ii/ShellScaffold.sh
- break
- fi
- done
-}
-
-
-# You could replace this next line with the contents
-# of ShellScaffold.sh and this script will run just the same.
-mysetup
-
-cat <<EOF
-****************************************************************
-This test should be run and checked manually.
-
-If this works right, you should see StepEvents/Breakpoint events for lines
- 8, 9, 6, 7, 8, 9, 6, .... for thread jj11
-and
- 20, 21, 18, 19, 20, 21, 18, ... for thread jj2
-
-Since both threads are running at the same time, these
-events can be intermixed.
-
-The bug is that you will frequently see step events missing.
-EG, you will see
- 8, 9, 8
-or
- 20, 21, 20, 21
-etc
-
-============================================================
-At some point you might get the msg 'Nothing suspended'
-This is bug:
- 4619349 Step Over fails in a multi threaded debuggee
-
-Kill the test and rerun it if this happens.
-****************************************************************
-
-EOF
-runit
-#jdbFailIfPresent "Nothing suspended"
-#pass
--- a/test/jdk/com/sun/jdi/ShellScaffold.sh Tue Oct 09 18:29:53 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1221 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2017, 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.
-#
-
-#
-#
-# jtreg runs this in a scratch dir.
-# It (and runregress -no) sets these env vars:
-# TESTSRC: The dir that contains this file
-# TESTCLASSES: Where .class files are compiled to
-# TESTJAVA: The jdk to run
-#
-# This is a 'library' script that is included by
-# shell script test cases that want to run a .java file as the debuggee
-# and use jdb as the debugger. This file contains
-# several functions that support such a test.
-
-# The caller script can also set these shell vars before
-# including this file:
-# pkg=<package name> To use a package, define it here and put
-# package $pkg
-# in your java file
-# classname=<classnam> Omit this to use the default class name, 'shtest'.
-
-# compileOptions=<string> compile options for at least the first compile,
-# eg, compileOptions=-g
-# compileOptions2=<string> Options for the 2nd, ..., compile. compileOptions1
-# is used if this is not set. To use no compile
-# options for the 2nd ... compiles, do
-# compileOptions2=none
-#
-# mode=-Xcomp or mode=-Xint to run in these modes. These should not
-# really be used since the tests are normally
-# run in both modes.
-# javacCmd=path-to-javac to use a non-standard javac for compiling
-# compileOptions=<string> Options to pass to javac
-#
-# See RedefineException.sh as an example of a caller script.
-#
-# To do RedefineClasses operations, embed @1 tags in the .java
-# file to tell this script how to modify it to produce the 2nd
-# version of the .class file to be used in the redefine operation.
-# Here are examples of each editting tag and what change
-# it causes in the new file. Note that blanks are not preserved
-# in these editing operations.
-#
-# @1 uncomment
-# orig: // @1 uncomment gus = 89;
-# new: gus = 89;
-#
-# @1 commentout
-# orig: gus = 89 // @1 commentout
-# new: // gus = 89 // @1 commentout
-#
-# @1 delete
-# orig: gus = 89 // @1 delete
-# new: entire line deleted
-#
-# @1 newline
-# orig: gus = 89; // @1 newline gus++;
-# new: gus = 89; //
-# gus++;
-#
-# @1 replace
-# orig: gus = 89; // @1 replace gus = 90;
-# new: gus = 90;
-#
-# The only other tag supported is @1 breakpoint. The setbkpts function
-# sets bkpts at all lines that contain this string.
-#
-# Currently, all these tags are start with @1. It is envisioned that this script
-# could be ehanced to allow multiple cycles of redefines by allowing
-# @2, @3, ... tags. IE, processing the @i tags in the ith version of
-# the file will produce the i+1th version of the file.
-#
-# There are problem with jtreg leaving behind orphan java and jdb processes
-# when this script is run. Sometimes, on some platforms, it just doesn't
-# get them all killed properly.
-# The solution is to put a magic word in the cmd lines of background java
-# and jdb processes this script launches. We can then do the right kind
-# of ps cmds to find all these processes and kill them. We do this by
-# trapping the completion of this script.
-#
-# An associated problem is that our trap handler (cleanup) doesn't
-# always get called when jtreg terminates a test. This can leave tests
-# hanging but following tests should run ok because each test uses
-# unique names for the port and temp files (based on the PID returned
-# by $$).
-#
-# mks 6.2a on win 98 presents two problems:
-# $! returns the PID as a negative number whereas ps returns
-# it in the form 0xFFF.... This means our trick of
-# of using $! to get the PIDs of the jdb and debuggee processes
-# doesn't work. This will cause some error cases to fail
-# with a jtreg timeout instead of failing more gracefully.
-#
-# There is no form of the ps command that will show the whole
-# cmd line. Thus, the magic keyword trick doesn't work. We
-# resort to just killing java.exe and jdb.exes
-#
-# pid usage:
-# debuggeepid: used in jdb process to detect if debuggee has died.
-# - waitForDebuggeeMsg: fail if debuggee is gone
-#
-# jdbpid: dofail: used to detect if in main process or jdb process
-# waitforfinish: quit if the jdb process is gone
-
-#killcmd=/bin/kill
-killcmd=kill
-
-# This can be increased if timing seems to be an issue.
-sleep_seconds=1
-timeout_factor=1
-if [ -n "$TESTTIMEOUTFACTOR" ] ; then
- # convert float value to int
- timeout_factor=$(echo $TESTTIMEOUTFACTOR | awk '{printf "%d\n", int($1)}')
-fi
-
-echo "ShellScaffold.sh: Running with timeout_factor = $timeout_factor" >& 2
-topPid=$$
-
-# Be careful to echo to >& in these general functions.
-# If they are called from the functions that are sending
-# cmds to jdb, then stdout is redirected to jdb.
-cleanup()
-{
- if [ -r "$failFile" ] ; then
- ls -l "$failFile" >&2
- echo "<cleanup:_begin_failFile_contents>" >&2
- cat "$failFile" >&2
- echo "<cleanup:_end_failFile_contents>" >&2
- fi
-
- # Kill all processes that have our special
- # keyword in their cmd line.
- killOrphans cleanup $jdbKeyword
- killOrphans cleanup $debuggeeKeyword
-}
-
-# Kill all processes with $2 in their cmd lines
-# Print a msg about this using $1 as the prefix
-killOrphans()
-{
- str=$2
-
- if [ -z "$isCygwin" ] ; then
- toBeKilled=`$psCmd | $grep -v grep | $grep -i $str | awk '{print $1}' | tr '\n\r' ' '`
- else
- # The cygwin ps command doesn't show the options passed to a cmd.
- # We will use jps to get the win PID of the command, and
- # then use ps to find the cygwin pid to be killed.
- # The form of a ps output line is
- # ^ ddddd dddd dddd dddd.*
- # where the 4th digits are the win pid and the first
- # are the cygwin pid.
- if [ -r "$jdk/bin/$jstack" ] ; then
- winPid=`$jdk/bin/jps -v | $grep -i $str | sed -e 's@ .*@@'`
- if [ ! -z "$winPid" ] ; then
- # Here is a way to kill using a win cmd and the win PID.
- #echo "$1: taskkill /F $winPid" >& 2
- #taskkill /F /PID $winPid
-
- toBeKilled=`$psCmd | $grep -v grep | \
- $grep '^ +[0-9]+ +[0-9]+ +[0-9]+ +'"$winPid" |\
- awk '{print $1}' | tr '\n\r' ' '`
- fi
- else
- # Well, too bad - we can't find what to kill.
- toBeKilled=
- fi
- fi
-
- if [ ! -z "$toBeKilled" ] ; then
- echo "$1: kill -9 $toBeKilled" >& 2
- kill -9 $toBeKilled
- fi
-}
-
-# Returns 0 if $1 is the pid of a running process
-findPid()
-{
- if [ -z "$1" ] ; then
- return 1
- fi
-
- case "$osname" in
- SunOS | AIX)
- $psCmd | $grep '^ *'"$1 " > $devnull 2>&1
- res=$?
- ;;
- Windows* | CYGWIN*)
- # Don't use ps on cygwin since it sometimes misses
- # some processes (!).
- tasklist /NH | $grep " $1 " > $devnull 2>&1
- res=$?
- ;;
- *)
- # Never use plain 'ps', which requires a "controlling terminal"
- # and will fail with a "ps: no controlling terminal" error.
- # Running under 'rsh' will cause this ps error.
- $psCmd -e | $grep '^ *'"$1 " > $devnull 2>&1
- res=$?
- ;;
- esac
- return $res
-}
-
-setup()
-{
- failed=
- # This is used to tag each java and jdb cmd we issue so
- # we can kill them at the end of the run.
-
- orphanKeyword=HANGINGJAVA-$$
- debuggeeKeyword=${orphanKeyword}_DEB
- jdbKeyword=${orphanKeyword}_JDB
- baseArgs=-D${debuggeeKeyword}
- if [ -z "$TESTCLASSES" ] ; then
- echo "--Warning: TESTCLASSES is not defined; using TESTCLASSES=."
- echo " You should run: "
- echo " runregress $0 -no"
- echo " or"
- echo " (setenv TESTCLASSES .; $0 $*)"
- TESTCLASSES=.
- fi
- if [ ! -z "$TESTJAVA" ] ; then
- jdk="$TESTJAVA"
- else
- echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
- exit 1
- fi
-
- ulimitCmd=
- osname=`uname -s`
- isCygwin=
- case "$osname" in
- Windows* | CYGWIN*)
- devnull=NUL
- case "$osname" in
- CYGWIN*)
- isCygwin=1
- devnull=/dev/null
- ;;
- esac
-
- if [ -r $jdk/bin/dt_shmem.dll ] ; then
- transport=dt_shmem
- address=kkkk.$$
- else
- transport=dt_socket
- address=
- fi
- baseArgs="$baseArgs -XX:-ShowMessageBoxOnError"
- # jtreg puts \\s in TESTCLASSES and some uses, eg. echo
- # treat them as control chars on mks (eg \t is tab)
- # Oops; windows mks really seems to want this cat line
- # to start in column 1
- if [ -w "$Temp" ] ; then
- tmpFile=$Temp/tmp.$$
- elif [ -w "$TEMP" ] ; then
- tmpFile=$TEMP/tmp.$$
- else
- tmpFile=tmp.$$
- fi
-cat <<EOF >$tmpFile
-$TESTCLASSES
-EOF
- TESTCLASSES=`cat $tmpFile | sed -e 's@\\\\@/@g'`
- rm -f $tmpFile
- # on mks
- grep=egrep
- psCmd=ps
- jstack=jstack.exe
- ;;
- SunOS | Linux | Darwin | AIX)
- transport=dt_socket
- address=
- devnull=/dev/null
- grep=egrep
- jstack=jstack
- # On linux, core files take a long time, and can leave
- # zombie processes
- if [ "$osname" = SunOS ] ; then
- # Experiments show Solaris '/usr/ucb/ps -axwww' and
- # '/usr/bin/pgrep -f -l' provide the same small amount of the
- # argv string (PRARGSZ=80 in /usr/include/sys/procfs.h)
- # 1) This seems to have been working OK in ShellScaffold.
- # 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep
- # instead
- # The alternative would be to use /usr/bin/pargs [pid] to get
- # all the args for a process, splice them back into one
- # long string, then grep.
- UU=`/usr/xpg4/bin/id -u -n`
- psCmd="pgrep -f -l -U $UU"
- else
- ulimit -c 0
- # See bug 6238593.
- psCmd="ps axwww"
- fi
- ;;
- *)
- echo "--Error: Unknown result from 'uname -s': $osname"
- exit 1
- ;;
- esac
-
-
- tmpFileDir=$TESTCLASSES/aa$$
- TESTCLASSES=$tmpFileDir
-
- mkdir -p $tmpFileDir
-
- # This must not contain 'jdb' or it shows up
- # in grep of ps output for some platforms
- jdbOutFile=$tmpFileDir/jxdbOutput.txt
- rm -f $jdbOutFile
- touch $jdbOutFile
-
- debuggeeOutFile=$tmpFileDir/debuggeeOutput.txt
- failFile=$tmpFileDir/testFailed
- debuggeepidFile=$tmpFileDir/debuggeepid
- rm -f $failFile $debuggeepidFile
- if [ -f "$failFile" ]; then
- echo "ERROR: unable to delete existing failFile:" >&2
- ls -l "$failFile" >&2
- fi
-
- if [ -z "$pkg" ] ; then
- pkgSlash=
- pkgDot=
- redefineSubdir=.
- else
- pkgSlash=$pkg/
- pkgDot=$pkg.
- redefineSubdir=$pkgSlash
- fi
- if [ -z "$classname" ] ; then
- classname=shtest
- fi
-
- if [ -z "$java" ] ; then
- java=java
- fi
-
- if [ -z "$jdb" ] ; then
- jdb=$jdk/bin/jdb
- fi
-
-####################################################3
-####################################################3
-####################################################3
-####################################################3
-# sol: this gets all processes killed but
-# no jstack
-# linux same as above
-# win mks: No dice; processes still running
- trap "cleanup" 0 1 2 3 4 6 9 10 15
-
- jdbOptions="$jdbOptions -J-D${jdbKeyword}"
-}
-
-docompile()
-{
- if [ "$compile" = 0 ] ; then
- return
- fi
- saveDir=`pwd`
- cd $tmpFileDir
- rm -f *.java
- createJavaFile $classname
-
- # Compile two versions of the file, the original and with the
- # indicated lines modified.
- cp $classname.java.1 $classname.java
- echo "--Compiling first version of `pwd`/$classname.java with options: $compileOptions"
- # Result is in $pkgSlash$classname.class
-
- if [ -z "$javacCmd" ] ; then
- javacCmd=$jdk/bin/javac
- fi
-
- echo "compiling " `ls *.java`
- $javacCmd $compileOptions -d . *.java
- if [ $? != 0 ] ; then
- dofail "First compile failed"
- fi
- if [ -r vers1 ] ; then
- rm -rf vers1
- fi
- mkdir -p vers1
- mv *.class vers1
- if [ ! -z "$compileOptions2" ] ; then
- if [ "$compileOptions2" = none ] ; then
- compileOptions=
- else
- compileOptions=$compileOptions2
- fi
- fi
-
- while [ 1 = 1 ] ; do
- # Not really a loop; just a way to avoid goto
- # by using breaks
- sed -e '/@1 *delete/ d' \
- -e 's! *// *@1 *uncomment! !' \
- -e 's!\(.*@1 *commentout\)!//\1!' \
- -e 's/@1 *newline/\
- /' \
- -e 's/.*@1 *replace//' \
- $classname.java.1 >$classname.java
-
- cmp -s $classname.java.1 $classname.java
- if [ $? = 0 ] ; then
- break
- fi
- echo
- echo "--Compiling second version of `pwd`/$classname.java with $compileOptions"
- $javacCmd $compileOptions -d . $classname.java
- if [ $? != 0 ] ; then
- dofail "Second compile failed"
- fi
- if [ -r vers2 ] ; then
- rm -rf vers2
- fi
- mkdir -p vers2
- mv *.class vers2
- mv $classname.java $classname.java.2
- cp $classname.java.1 $classname.java
-
- ###### Do the same for @2, and @3 allowing 3 redefines to occur.
- ###### If I had more time to write sed cmds, I would do
- ###### this in a loop. But, I don't think we will ever need
- ###### more than 3 redefines.
- sed -e '/@2 *delete/ d' \
- -e 's! *// *@2 *uncomment! !' \
- -e 's!\(.*@2 *commentout\)!//\1!' \
- -e 's/@2 *newline/\
- /' \
- -e 's/.*@2 *replace//' \
- $classname.java.2 >$classname.java
- cmp -s $classname.java.2 $classname.java
- if [ $? = 0 ] ; then
- break
- fi
- echo
- echo "--Compiling third version of `pwd`/$classname.java with $compileOptions"
- $javacCmd $compileOptions -d . $classname.java
- if [ $? != 0 ] ; then
- dofail "Third compile failed"
- fi
- if [ -r vers3 ] ; then
- rm -rf vers3
- fi
- mkdir -p vers3
- mv *.class vers3
- mv $classname.java $classname.java.3
- cp $classname.java.1 $classname.java
-
- ########
- sed -e '/@3 *delete/ d' \
- -e 's! *// *@3 *uncomment! !' \
- -e 's!\(.*@3 *commentout\)!//\1!' \
- -e 's/@3 *newline/\
- /' \
- -e 's/.*@3 *replace//' \
- $classname.java.3 >$classname.java
- cmp -s $classname.java.3 $classname.java
- if [ $? = 0 ] ; then
- break
- fi
- echo
- echo "--Compiling fourth version of `pwd`/$classname.java with $compileOptions"
- $javacCmd $compileOptions -d . $classname.java
- if [ $? != 0 ] ; then
- dofail "fourth compile failed"
- fi
- if [ -r vers4 ] ; then
- rm -rf vers4
- fi
- mkdir -p vers4
- mv *.class vers4
- mv $classname.java $classname.java.4
- cp $classname.java.1 $classname.java
- break
- fgrep @4 $classname.java
- if [ $? = 0 ] ; then
- echo "--Error: @4 and above are not yet allowed"
- exit 1
- fi
- done
-
- cp vers1/* $redefineSubdir
- cd $saveDir
-}
-
-# Send a cmd to jdb and wait for the jdb prompt to appear.
-# We don't want to allow > as a prompt because if the debuggee
-# runs for awhile after a command, jdb will show this prompt
-# but is not really ready to accept another command for the
-# debuggee - ie, a cont in this state will be ignored.
-# If it ever becomes necessary to send a jdb command before
-# a main[10] form of prompt appears, then this
-# code will have to be modified.
-#
-# Specify $1 = allowExit to show that the command given
-# allows JDB to exit
-cmd()
-{
- allowExit=
- case "$1" in
- allowExit)
- allowExit="allowExit"
- shift
- ;;
- exitJdb)
- # Quit JDB only with this cmd() invocation
- echo "--Sending cmd: quit" >& 2
- echo quit
- echo "--Quit cmd was sent" >& 2
- # See 6562090. Maybe there is a way that the exit
- # can cause jdb to not get the quit.
- sleep 5
-
- # The exit code value here doesn't matter since this function
- # is called as part of a pipeline and it is not the last command
- # in the pipeline.
- exit 1
- ;;
- esac
- command=$*
-
- if [ -z "$command" ] ; then
- dofail "Command can't be a null string. Test failure"
- fi
- if [ "$command" = "quit" -o "$command" = "exit" ] ; then
- # We don't want the test to manually quit jdb,
- # we will do it in the end automatically
- dofail "It's not allowed to send quit or exit commands from the test"
- fi
- if [ -r "$failFile" ] ; then
- # failFile exists, it's better to finish execution
- dofinish "quit"
- fi
-
- # $jdbOutFile always exists here and is non empty
- # because after starting jdb, we waited
- # for the prompt.
- fileSize=`wc -c $jdbOutFile | awk '{ print $1 }'`
- echo "--Sending cmd: " $command >&2
-
- # jjh: We have a few intermittent failures here.
- # It is as if every so often, jdb doesn't
- # get the first cmd that is sent to it here.
- # (actually, I have seen it get the first cmd ok,
- # but then not get some subsequent cmd).
- # It seems like jdb really doesn't get the cmd; jdb's response
- # does not appear in the jxdboutput file. It contains:
- # main[1]
- # The application has been disconnected
-
- # Is it possible
- # that jdb got the cmd ok, but its response didn't make
- # it to the jxdboutput file? If so, why did 'The application
- # has been disconnected' make it?
-
- # This causes the following loop to timeout and the test to fail.
- # The above echo works because the cmd (stop at ...)
- # is in the System.err shown in the .jtr file.
- # Also, the cmd is shown in the 'jdb never responded ...'
- # msg output below after the timeout.
- # And, we know jdb is started because the main[1] output is in the .jtr
- # file. And, we wouldn't have gotten here if mydojdbcmds hadn't
- # seen the ].
- echo $command
-
- # Now we have to wait for the next jdb prompt. We wait for a pattern
- # to appear in the last line of jdb output. Normally, the prompt is
- #
- # 1) ^main[89] @
- #
- # where ^ means start of line, and @ means end of file with no end of line
- # and 89 is the current command counter. But we have complications e.g.,
- # the following jdb output can appear:
- #
- # 2) a[89] = 10
- #
- # The above form is an array assignment and not a prompt.
- #
- # 3) ^main[89] main[89] ...
- #
- # This occurs if the next cmd is one that causes no jdb output, e.g.,
- # 'trace methods'.
- #
- # 4) ^main[89] [main[89]] .... > @
- #
- # jdb prints a > as a prompt after something like a cont.
- # Thus, even though the above is the last 'line' in the file, it
- # isn't the next prompt we are waiting for after the cont completes.
- # HOWEVER, sometimes we see this for a cont command:
- #
- # ^main[89] $
- # <lines output for hitting a bkpt>
- #
- # 5) ^main[89] > @
- #
- # i.e., the > prompt comes out AFTER the prompt we we need to wait for.
- #
- # So, how do we know when the next prompt has appeared??
- # 1. Search for
- # main[89] $
- # This will handle cases 1, 2, 3
- # 2. This leaves cases 4 and 5.
- #
- # What if we wait for 4 more chars to appear and then search for
- #
- # main[89] [>]$
- #
- # on the last line?
- #
- # a. if we are currently at
- #
- # ^main[89] main[89] @
- #
- # and a 'trace methods comes in, we will wait until at least
- #
- # ^main[89] main[89] main@
- #
- # and then the search will find the new prompt when it completes.
- #
- # b. if we are currently at
- #
- # ^main[89] main[89] @
- #
- # and the first form of cont comes in, then we will see
- #
- # ^main[89] main[89] > $
- # ^x@
- #
- # where x is the first char of the msg output when the bkpt is hit
- # and we will start our search, which will find the prompt
- # when it comes out after the bkpt output, with or without the
- # trailing >
- #
-
- # wait for 4 new chars to appear in the jdb output
- count=0
- desiredFileSize=`expr $fileSize + 4`
- msg1=`echo At start: cmd/size/waiting : $command / $fileSize / \`date\``
- timeLimit=`expr 60 * $timeout_factor`
- while [ 1 = 1 ] ; do
- newFileSize=`wc -c $jdbOutFile | awk '{ print $1 } '`
- #echo jj: desired = $desiredFileSize, new = $newFileSize >& 2
-
- done=`expr $newFileSize \>= $desiredFileSize`
- if [ $done = 1 ] ; then
- break
- fi
- sleep ${sleep_seconds}
- count=`expr $count + ${sleep_seconds}`
- if [ $count -gt $timeLimit ] ; then
- # record some debug info.
- echo "--DEBUG: jdb $$ didn't respond to command in $count secs: $command" >& 2
- echo "--DEBUG:" $msg1 >& 2
- echo "--DEBUG: "done size/waiting : / $newFileSize / `date` >& 2
- echo "-- $jdbOutFile follows-------------------------------" >& 2
- cat $jdbOutFile >& 2
- echo "------------------------------------------" >& 2
- dojstack
- dofail "jdb never responded to command: $command"
- fi
- done
- # Note that this assumes just these chars in thread names.
- waitForJdbMsg '[a-zA-Z0-9_-][a-zA-Z0-9_-]*\[[1-9][0-9]*\] [ >]*$' 1 $allowExit
-}
-
-setBkpts()
-{
- # Can set multiple bkpts, but only in one class.
- # $1 is the bkpt name, eg, @1
- allLines=`$grep -n "$1 *breakpoint" $tmpFileDir/$classname.java.1 | sed -e 's@^\([0-9]*\).*@\1@g'`
- for ii in $allLines ; do
- cmd "stop at $pkgDot$classname:$ii"
- done
-}
-
-runToBkpt()
-{
- # Don't pass allowExit here as we don't want JDB to unexpectedly exit
- cmd run
- # Don't need to do this - the above waits for the next prompt which comes out
- # AFTER the Breakpoint hit message.
- # Wait for jdb to hit the bkpt
- #waitForJdbMsg "Breakpoint hit" 5
-}
-
-contToBkpt()
-{
- # Don't pass allowExit here as we don't want JDB to unexpectedly exit
- cmd cont
- # Don't need to do this - the above waits for the next prompt which comes out
- # AFTER the Breakpoint hit message.
- # Wait for jdb to hit the bkpt
- #waitForJdbMsg "Breakpoint hit" 5
-}
-
-
-# Wait until string $1 appears in the output file, within the last $2 lines
-# If $3 is allowExit, then don't fail if jdb exits before
-# the desired string appears.
-waitForJdbMsg()
-{
- # This can be called from the jdb thread which doesn't
- # have access to $debuggeepid, so we have to read it from the file.
- nlines=$2
- allowExit="$3"
- myCount=0
- timeLimit=`expr 40 * $timeout_factor` # wait a max of this many secs for a response from a jdb command
-
- while [ 1 = 1 ] ; do
- if [ -r $jdbOutFile ] ; then
- # Something here causes jdb to complain about Unrecognized cmd on x86.
- tail -$nlines $jdbOutFile | $grep -s "$1" > $devnull 2>&1
- if [ $? = 0 ] ; then
- # Found desired string
- break
- fi
- fi
- tail -2 $jdbOutFile | $grep -s "The application exited" > $devnull 2>&1
- if [ $? = 0 ] ; then
- # Found 'The application exited'
- echo "--JDB finished: The application exited" >&2
- if [ ! -z "$allowExit" ] ; then
- # Exit is allowed
- dofinish
- fi
- # Otherwise, it is an error if we don't find $1
- if [ -r $jdbOutFile ] ; then
- tail -$nlines $jdbOutFile | $grep -s "$1" > $devnull 2>&1
- if [ $? = 0 ] ; then
- break
- fi
- fi
- dofail "JDB unexpectedly finished: Waited for jdb msg $1, but it never appeared"
- fi
-
- sleep ${sleep_seconds}
- findPid $topPid
- if [ $? != 0 ] ; then
- echo "--Top process ($topPid) is dead. We better die too" >&2
- dojstack
- exit 1
- fi
-
- myCount=`expr $myCount + ${sleep_seconds}`
- if [ $myCount -gt $timeLimit ] ; then
- echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds, looking for /$1/, in $nlines lines; exiting" >> $failFile
- echo "vv jdbOutFile vvvvvvvvvvvvvvvvvvvvvvvvvvvv" >& 2
- cat $jdbOutFile >& 2
- echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >& 2
- dojstack
- exit 1
- fi
- done
-
-}
-
-# Finishes JDB execution
-# Specify command to finish if it's needed
-dofinish()
-{
- if [ ! -z "$*" ] ; then
- echo "--Finish execution with sending \"$*\" command to JDB" >&2
- cmd "exitJdb" "$*"
- else
- echo "--Finish without sending \"quit\" command to JDB" >&2
- fi
- exit 0
-}
-
-# $1 is the string to print. If $2 exists,
-# it is the name of a file to print, ie, the name
-# of the file that contains the $1 string.
-dofail()
-{
- if [ ! -z "$jdbpid" ] ; then
- # we are in the main process instead of the jdb process
- echo " " >> $failFile
- echo "--Fail: main: $*" >> $failFile
- else
- # Kill the debuggee ; it could be hung so
- # we want to get rid of it as soon as possible.
- killOrphans "killing debuggee" $debuggeeKeyword
- # Kill debugger, it could be hung
- killOrphans "killing debugger" $jdbKeyword
-
- echo " " >>$failFile
- echo "--Fail: $*" >> $failFile
- fi
- if [ ! -z "$2" ] ; then
- echo "---- contents of $2 follows -------" >> $failFile
- cat "$2" >> $failFile
- echo "---------------" >>$failFile
- fi
- exit 1
-}
-
-
-redefineClass()
-{
- if [ -z "$1" ] ; then
- vers=2
- else
- vers=`echo $1 | sed -e 's/@//'`
- vers=`expr $vers + 1`
- fi
-
- cmd "redefine $pkgDot$classname $tmpFileDir/vers$vers/$classname.class"
-
- cp $tmpFileDir/$classname.java.$vers \
- $tmpFileDir/$classname.java
-}
-
-mydojdbCmds()
-{
- # Wait for jdb to start before we start sending cmds
- waitForJdbMsg ']' 1
- # Send commands from the test
- dojdbCmds
- # Finish jdb with quit command
- dofinish "quit"
-}
-
-startJdb()
-{
- if [ ! -r "$jdb" -a ! -r "$jdb.exe" ] ; then
- dofail "$jdb does not exist"
- fi
- echo
- echo "--Starting jdb, address=$address"
- if [ -z "$address" ] ; then
- # Let jdb choose the port and write it to stdout
- mydojdbCmds | $jdb $jdbOptions -listenany | tee $jdbOutFile &
-
- while [ 1 ] ; do
- lastLine=`$grep 'Listening at address' $jdbOutFile`
- if [ ! -z "$lastLine" ] ; then
- break
- fi
- sleep 1
- done
- # jjh: we got the address ok, and seemed to start the debuggee
- address=`echo $lastLine | sed -e 's@.*: *@@'`
- else
- mydojdbCmds | $jdb $jdbOptions -listen $address | tee $jdbOutFile &
- fi
- #echo address = $address
-
-
- # this gets the pid of tee, at least it does on solaris
- jdbpid=$!
-
- # This fails on linux because there is an entry for each thread in jdb
- # so we get a list of numbers in jdbpid
- # jdbpid=`$psCmd | $grep -v grep | $grep ${orphanKeyword}_JDB | awk '{print $1}' | tr '\n\r' ' '`
-}
-
-startDebuggee()
-{
- args="$TESTVMOPTS $TESTJAVAOPTS"
-
- if [ ! -z "$args" ] ; then
- echo "--Starting debuggee with args from TESTVMOPTS and/or TESTJAVAOPTS: $args"
- else
- echo "--Starting debuggee"
- fi
-
- debuggeepid=
- waitForJdbMsg Listening 4
-
- beOption="-agentlib:jdwp=transport=$transport,address=$address,server=n,suspend=y"
-# beOption="-Xdebug -Xrunjdwp:transport=$transport,address=$address,server=n,suspend=y"
-
- thecmd="$jdk/bin/$java $mode -classpath $tmpFileDir $baseArgs $args \
- -Djtreg.classDir=$TESTCLASSES \
- -showversion \
- $beOption \
- $pkgDot$classname"
- echo "Cmd: $thecmd"
-
- sh -c "$thecmd | tee $debuggeeOutFile" &
-
- # Note that the java cmd and the tee cmd will be children of
- # the sh process. We can use that to find them to kill them.
- debuggeepid=$!
-
- # Save this in a place where the jdb process can find it.
- # Note that it is possible for the java cmd to abort during startup
- # due to a bad classpath or whatever.
- echo $debuggeepid > $debuggeepidFile
-}
-
-dojstack()
-{
- if [ -r "$jdk/bin/$jstack" ] ; then
- # If jstack exists, so will jps
- # Show stack traces of jdb and debuggee as a possible debugging aid.
- jdbCmd=`$jdk/bin/jps -v | $grep $jdbKeyword`
- realJdbPid=`echo "$jdbCmd" | sed -e 's@ .*@@'`
- if [ ! -z "$realJdbPid" ] ; then
- echo "-- jdb process info ----------------------" >&2
- echo " $jdbCmd" >&2
- echo "-- jdb threads: jstack $realJdbPid" >&2
- $jdk/bin/$jstack $realJdbPid >&2
- echo "------------------------------------------" >&2
- echo >&2
- fi
- debuggeeCmd=`$jdk/bin/jps -v | $grep $debuggeeKeyword`
- realDebuggeePid=`echo "$debuggeeCmd" | sed -e 's@ .*@@'`
- if [ ! -z "$realDebuggeePid" ] ; then
- echo "-- debuggee process info ----------------------" >&2
- echo " $debuggeeCmd" >&2
- echo "-- debuggee threads: jstack $moption $realDebuggeePid" >&2
- $jdk/bin/$jstack $realDebuggeePid >&2
- echo "=============================================" >&2
- echo >&2
- fi
- fi
-}
-
-waitForFinish()
-{
- # This is the main process
- # Wait for the jdb process to finish, or some error to occur
-
- while [ 1 = 1 ] ; do
- findPid $jdbpid
- if [ $? != 0 ] ; then
- break
- fi
-
- # (Don't use jdbFailIfPresent here since it is not safe
- # to call from different processes)
- $grep -s 'Input stream closed' $jdbOutFile > $devnull 2>&1
- if [ $? = 0 ] ; then
- dofail "jdb input stream closed prematurely"
- fi
-
- # If a failure has occured, quit
- if [ -r "$failFile" ] ; then
- break
- fi
-
- sleep ${sleep_seconds}
- done
-
- # jdb exited because its input stream closed prematurely
- # (Don't use jdbFailIfPresent here since it is not safe
- # to call from different processes)
- $grep -s 'Input stream closed' $jdbOutFile > $devnull 2>&1
- if [ $? = 0 ] ; then
- dofail "jdb input stream closed prematurely"
- fi
-
- # It is necessary here to avoid the situation when JDB exited but
- # mydojdbCmds() didn't finish because it waits for JDB message
- # in waitForJdbMsg(), at the same time main process will finish
- # the execution with no errors.
- # To avoid that, wait for spawned processes to finish
- case "$osname" in
- SunOS)
- # `wait` function doesn't work in Solaris shell as in bash,
- # so create replacement that finds mydojdbCmds() shell process
- # and waits for its finish
- cmdsPid=
- # get list of processes except main process with $topPid
- processes=`$psCmd | $grep -v "$grep" | $grep -v $topPid | awk '{print $1}'`
- for pid in $processes; do
- # for each process grep its full args string for test name $0
- # $0 contains full test name with path
- pargs -l $pid 2>$devnull | $grep "$0" >$devnull 2>&1
- if [ $? = 0 ] ; then
- cmdsPid=$pid
- break
- fi
- done
- echo "--waitForFinish: Waiting for mydojdbCmds() to finish" >&2
- while [ 1 = 1 ] ; do
- findPid $cmdsPid
- if [ $? != 0 ] ; then
- break
- fi
- sleep ${sleep_seconds}
- done
- ;;
- *)
- echo "--waitForFinish: Waiting for all processes to finish" >&2
- wait
- ;;
- esac
-
- if [ -r "$failFile" ] ; then
- ls -l "$failFile" >&2
- echo "<waitForFinish:_begin_failFile_contents>" >&2
- cat "$failFile" >&2
- echo "<waitForFinish:_end_failFile_contents>" >&2
- exit 1
- fi
-}
-
-# $1 is the filename, $2 is the string to look for,
-# $3 is the number of lines to search (from the end)
-grepForString()
-{
- if [ -z "$3" ] ; then
- theCmd=cat
- else
- theCmd="tail -$3"
- fi
-
- case "$2" in
- *\>*)
- # Target string contains a '>' so we better not ignore it
- $theCmd $1 | $grep -s "$2" > $devnull 2>&1
- stat="$?"
- ;;
- *)
- # Target string does not contain a '>'.
- # NOTE: if $1 does not end with a new line, piping it to sed
- # doesn't include the chars on the last line. Detect this
- # case, and add a new line.
- theFile="$1"
- if [ `tail -1 "$theFile" | wc -l | sed -e 's@ @@g'` = 0 ] ; then
- # The target file doesn't end with a new line so we have
- # add one to a copy of the target file so the sed command
- # below can filter that last line.
- cp "$theFile" "$theFile.tmp"
- theFile="$theFile.tmp"
- echo >> "$theFile"
- fi
-
- # See bug 6220903. Sometimes the jdb prompt chars ('> ') can
- # get interleaved in the target file which can keep us from
- # matching the target string.
- $theCmd "$theFile" | sed -e 's@> @@g' -e 's@>@@g' \
- | $grep -s "$2" > $devnull 2>&1
- stat=$?
- if [ "$theFile" != "$1" ]; then
- # remove the copy of the target file
- rm -f "$theFile"
- fi
- unset theFile
- esac
-
- return $stat
-}
-
-# $1 is the filename, $2 is the regexp to match and return,
-# $3 is the number of lines to search (from the end)
-matchRegexp()
-{
- if [ -z "$3" ] ; then
- theCmd=cat
- else
- theCmd="tail -$3"
- fi
-
- case "$2" in
- *\>*)
- # Target string contains a '>' so we better not ignore it
- res=`$theCmd $1 | sed -e "$2"`
- ;;
- *)
- # Target string does not contain a '>'.
- # NOTE: if $1 does not end with a new line, piping it to sed
- # doesn't include the chars on the last line. Detect this
- # case, and add a new line.
- theFile="$1"
- if [ `tail -1 "$theFile" | wc -l | sed -e 's@ @@g'` = 0 ] ; then
- # The target file doesn't end with a new line so we have
- # add one to a copy of the target file so the sed command
- # below can filter that last line.
- cp "$theFile" "$theFile.tmp"
- theFile="$theFile.tmp"
- echo >> "$theFile"
- fi
-
- # See bug 6220903. Sometimes the jdb prompt chars ('> ') can
- # get interleaved in the target file which can keep us from
- # matching the target string.
- res=`$theCmd "$theFile" | sed -e 's@> @@g' -e 's@>@@g' \
- | sed -e "$2"`
- if [ "$theFile" != "$1" ]; then
- # remove the copy of the target file
- rm -f "$theFile"
- fi
- unset theFile
- esac
- return $res
-}
-
-# $1 is the filename, $2 is the string to look for,
-# $3 is the number of lines to search (from the end)
-failIfPresent()
-{
- if [ -r "$1" ] ; then
- grepForString "$1" "$2" "$3"
- if [ $? = 0 ] ; then
- dofail "Error output found: \"$2\" in $1" $1
- fi
- fi
-}
-
-# $1 is the filename, $2 is the string to look for
-# $3 is the number of lines to search (from the end)
-failIfNotPresent()
-{
- if [ ! -r "$1" ] ; then
- dofail "Required output \"$2\" not found in $1"
- fi
- grepForString "$1" "$2" "$3"
- if [ $? != 0 ] ; then
- dofail "Required output \"$2\" not found in $1" $1
- fi
-
-}
-
-# fail if $1 is not in the jdb output
-# $2 is the number of lines to search (from the end)
-jdbFailIfNotPresent()
-{
- failIfNotPresent $jdbOutFile "$1" $2
-}
-
-# fail if $1 is not in the debuggee output
-# $2 is the number of lines to search (from the end)
-debuggeeFailIfNotPresent()
-{
- failIfNotPresent $debuggeeOutFile "$1" $2
-}
-
-# fail if $1 is in the jdb output
-# $2 is the number of lines to search (from the end)
-jdbFailIfPresent()
-{
- failIfPresent $jdbOutFile "$1" $2
-}
-
-# fail if $1 is in the debuggee output
-# $2 is the number of lines to search (from the end)
-debuggeeFailIfPresent()
-{
- failIfPresent $debuggeeOutFile "$1" $2
-}
-
-# match and return the output from the regexp $1 in the debuggee output
-# $2 is the number of lines to search (from the end)
-debuggeeMatchRegexp()
-{
- matchRegexp $debuggeeOutFile "$1" $2
-}
-
-
-# This should really be named 'done' instead of pass.
-pass()
-{
- if [ ! -r "$failFile" ] ; then
- echo
- echo "--Done: test passed"
- exit 0
- else
- ls -l "$failFile" >&2
- echo "<pass:_begin_failFile_contents>" >&2
- cat "$failFile" >&2
- echo "<pass:_end_failFile_contents>" >&2
- fi
-}
-
-runit()
-{
- setup
- docompile
- startJdb
- startDebuggee
- waitForFinish
-
- # in hs_err file from 1.3.1
- debuggeeFailIfPresent "Virtual Machine Error"
-
- # in hs_err file from 1.4.2, 1.5: An unexpected error
- debuggeeFailIfPresent "An unexpected error"
-
- # in hs_err file from 1.4.2, 1.5: Internal error
- debuggeeFailIfPresent "Internal error"
-
-
- # Don't know how this arises
- debuggeeFailIfPresent "An unexpected exception"
-
- # Don't know how this arises
- debuggeeFailIfPresent "Internal exception"
-}
--- a/test/jdk/com/sun/jdi/ZZZcleanup.sh Tue Oct 09 18:29:53 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 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.
-#
-
-# @test
-# @bug 1234567
-# @summary no bug
-# @author Jim Holmlund
-#
-# @run shell ZZZcleanup.sh
-
-# This is run by jtreg after all other tests in
-# this dir have run. It kills any orphan
-# processes that have been left.
-# If you can figure out a better way, let me know
-
-mysetup()
-{
- if [ -z "$TESTSRC" ] ; then
- TESTSRC=.
- fi
-
- for ii in . $TESTSRC $TESTSRC/.. ; do
- if [ -r "$ii/ShellScaffold.sh" ] ; then
- . $ii/ShellScaffold.sh
- break
- fi
- done
-}
-
-# You could replace this next line with the contents
-# of ShellScaffold.sh and this script will run just the same.
-mysetup
-setup
-pass
--- a/test/jdk/java/net/BindException/Test.java Tue Oct 09 18:29:53 2018 -0400
+++ b/test/jdk/java/net/BindException/Test.java Tue Oct 09 18:33:25 2018 -0400
@@ -26,9 +26,15 @@
* @bug 4417734
* @key intermittent
* @summary Test that we get a BindException in all expected combinations
+ * @library /test/lib
+ * @build jdk.test.lib.NetworkConfiguration
+ * jdk.test.lib.Platform
+ * @run main Test -d
*/
+
import java.net.*;
import java.util.Enumeration;
+import jdk.test.lib.NetworkConfiguration;
public class Test {
@@ -106,6 +112,7 @@
} catch (BindException be) {
gotBindException = true;
+ failed_exc = be;
} catch (Exception e) {
failed = true;
failed_exc = e;
@@ -152,6 +159,7 @@
if (!failed) {
if (gotBindException) {
System.out.println("Got expected BindException - test passed!");
+ failed_exc.printStackTrace(System.out);
} else {
System.out.println("No BindException as expected - test passed!");
}
@@ -160,6 +168,7 @@
}
if (gotBindException) {
System.out.println("BindException unexpected - test failed!!!");
+ failed_exc.printStackTrace(System.out);
} else {
System.out.println("No bind failure as expected - test failed!!!");
}
@@ -206,6 +215,11 @@
*/
InetAddress addrs[] = { ia4_this, ia6_this };
+ if (!silent) {
+ System.out.println("Using ia4_this:" + ia4_this);
+ System.out.println("Using ia6_this:" + ia6_this);
+ }
+
Object tests[][] = getTestCombinations();
for (int i=0; i<tests.length; i++) {
@@ -227,6 +241,9 @@
System.out.println(count + " test(s) executed. " + failures + " failure(s).");
if (failures > 0) {
+ System.err.println("********************************");
+ NetworkConfiguration.printSystemConfiguration(System.err);
+ System.out.println("********************************");
throw new Exception(failures + " tests(s) failed - see log");
}
}