This commit is contained in:
Daniel D. Daugherty 2013-05-17 17:52:07 -07:00
commit 4410135e9e
1286 changed files with 78913 additions and 32874 deletions

View File

@ -211,3 +211,4 @@ da9a4c9312816451884aa6db6f18be51a07bff13 jdk8-b86
5ebf6c63714de2c9dcf831074086d31daec819df jdk8-b87 5ebf6c63714de2c9dcf831074086d31daec819df jdk8-b87
e517701a4d0e25ae9c7945bca6e1762a8c5d8aa6 jdk8-b88 e517701a4d0e25ae9c7945bca6e1762a8c5d8aa6 jdk8-b88
4dec41b3c5e3bb616f0c6f15830d940905aa5d16 jdk8-b89 4dec41b3c5e3bb616f0c6f15830d940905aa5d16 jdk8-b89
f09ab0c416185e3cba371e81bcb6a16060c90f44 jdk8-b90

View File

@ -211,3 +211,4 @@ df9b5240f0a76c91cfe1a5b39da4d08df56e05be jdk8-b86
b9415faa7066a4d3b16d466556d5428446918d95 jdk8-b87 b9415faa7066a4d3b16d466556d5428446918d95 jdk8-b87
e1a929afcfc492470d50be0b6b0e8dc77d3760b9 jdk8-b88 e1a929afcfc492470d50be0b6b0e8dc77d3760b9 jdk8-b88
892a0196d10c67f3a12f0eefb0bb536e423d8868 jdk8-b89 892a0196d10c67f3a12f0eefb0bb536e423d8868 jdk8-b89
69b773a221b956a3386933ecdbfeccee0edeac47 jdk8-b90

View File

@ -73,7 +73,7 @@ else
grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
$(all_phony_targets): $(all_phony_targets):
@$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true @$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true
endif endif
endif endif

View File

@ -54,9 +54,9 @@ MAKE_ARGS="SPEC=$(SPEC)"
MAKE:=@MAKE@ MAKE:=@MAKE@
# Pass along the verbosity setting. # Pass along the verbosity and log level settings.
ifeq (,$(findstring VERBOSE=,$(MAKE))) ifeq (,$(findstring VERBOSE=,$(MAKE)))
MAKE:=$(MAKE) $(VERBOSE) VERBOSE="$(VERBOSE)" MAKE:=$(MAKE) $(VERBOSE) VERBOSE="$(VERBOSE)" LOG_LEVEL="$(LOG_LEVEL)"
endif endif
# No implicit variables or rules! # No implicit variables or rules!

View File

@ -240,10 +240,10 @@ clean-docs:
clean-test: clean-test:
$(call CleanComponent,testoutput) $(call CleanComponent,testoutput)
.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install .PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs
.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only test-only docs-only
.PHONY: all test clean dist-clean bootcycle-images start-make .PHONY: all clean dist-clean bootcycle-images start-make
.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build .PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-docs clean-test clean-overlay-images clean-bootcycle-build
.PHONY: profiles profiles-only profiles-oscheck .PHONY: profiles profiles-only profiles-oscheck
FRC: # Force target FRC: # Force target

View File

@ -321,11 +321,17 @@ define SetupNativeCompilation
ifneq (,$$($1_DEBUG_SYMBOLS)) ifneq (,$$($1_DEBUG_SYMBOLS))
ifeq ($(ENABLE_DEBUG_SYMBOLS), true) ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
# Programs don't get the debug symbols added in the old build. It's not clear if ifdef OPENJDK
# this is intentional. # Always add debug symbols
ifeq ($$($1_PROGRAM),)
$1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS) $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
$1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS) $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
else
# Programs don't get the debug symbols added in the old build. It's not clear if
# this is intentional.
ifeq ($$($1_PROGRAM),)
$1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
$1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
endif
endif endif
endif endif
endif endif

View File

@ -211,3 +211,4 @@ a45bb25a67c7517b45f00c9682e317f46fecbba9 jdk8-b83
f1709874d55a06bc3d5dfa02dbcdfbc59f4cba34 jdk8-b87 f1709874d55a06bc3d5dfa02dbcdfbc59f4cba34 jdk8-b87
4e3a881ebb1ee96ce0872508b0066d74f310dbfa jdk8-b88 4e3a881ebb1ee96ce0872508b0066d74f310dbfa jdk8-b88
fe4150590ee597f4e125fea950aa3b352622cc2d jdk8-b89 fe4150590ee597f4e125fea950aa3b352622cc2d jdk8-b89
c8286839d0df04aba819ec4bef12b86babccf30e jdk8-b90

View File

@ -341,3 +341,5 @@ c4af77d2045476c56fbf3f914b336bb1b7cd18af hs25-b30
4ec91349972255650f97bedfd07e6423e02428cf hs25-b31 4ec91349972255650f97bedfd07e6423e02428cf hs25-b31
9c1fe0b419b40a9ecdd1653cc9af1b6d67a12c46 jdk8-b89 9c1fe0b419b40a9ecdd1653cc9af1b6d67a12c46 jdk8-b89
69494caf57908ba2c8efa9eaaa472b4d1875588a hs25-b32 69494caf57908ba2c8efa9eaaa472b4d1875588a hs25-b32
1ae0472ff3a0117b5b019d380ad59fface2fde14 jdk8-b90
b19517cecc2e91636d7c16ba2f35e3d3dc628099 hs25-b33

View File

@ -151,32 +151,43 @@ else
$(MAKE_ARGS) BUILD_FLAVOR=product docs $(MAKE_ARGS) BUILD_FLAVOR=product docs
endif endif
# Output directories
C1_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_compiler1
C2_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2
MINIMAL1_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_minimal1
ZERO_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_zero
SHARK_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_shark
# Build variation of hotspot # Build variation of hotspot
$(C1_VM_TARGETS): $(C1_VM_TARGETS):
$(CD) $(GAMMADIR)/make; \ $(CD) $(GAMMADIR)/make; \
$(MAKE) BUILD_FLAVOR=$(@:%1=%) VM_TARGET=$@ generic_build1 $(ALT_OUT) $(MAKE) BUILD_DIR=$(C1_DIR) BUILD_FLAVOR=$(@:%1=%) VM_TARGET=$@ generic_build1 $(ALT_OUT)
$(C2_VM_TARGETS): $(C2_VM_TARGETS):
$(CD) $(GAMMADIR)/make; \ $(CD) $(GAMMADIR)/make; \
$(MAKE) BUILD_FLAVOR=$@ VM_TARGET=$@ generic_build2 $(ALT_OUT) $(MAKE) BUILD_DIR=$(C2_DIR) BUILD_FLAVOR=$@ VM_TARGET=$@ generic_build2 $(ALT_OUT)
$(ZERO_VM_TARGETS): $(ZERO_VM_TARGETS):
$(CD) $(GAMMADIR)/make; \ $(CD) $(GAMMADIR)/make; \
$(MAKE) BUILD_FLAVOR=$(@:%zero=%) VM_TARGET=$@ \ $(MAKE) BUILD_DIR=$(ZERO_DIR) BUILD_FLAVOR=$(@:%zero=%) VM_TARGET=$@ generic_buildzero $(ALT_OUT)
generic_buildzero $(ALT_OUT)
$(SHARK_VM_TARGETS): $(SHARK_VM_TARGETS):
$(CD) $(GAMMADIR)/make; \ $(CD) $(GAMMADIR)/make; \
$(MAKE) BUILD_FLAVOR=$(@:%shark=%) VM_TARGET=$@ \ $(MAKE) BUILD_DIR=$(SHARK_DIR) BUILD_FLAVOR=$(@:%shark=%) VM_TARGET=$@ generic_buildshark $(ALT_OUT)
generic_buildshark $(ALT_OUT)
$(MINIMAL1_VM_TARGETS): $(MINIMAL1_VM_TARGETS):
$(CD) $(GAMMADIR)/make; \ $(CD) $(GAMMADIR)/make; \
$(MAKE) BUILD_FLAVOR=$(@:%minimal1=%) VM_TARGET=$@ \ $(MAKE) BUILD_DIR=$(MINIMAL1_DIR) BUILD_FLAVOR=$(@:%minimal1=%) VM_TARGET=$@ generic_buildminimal1 $(ALT_OUT)
generic_buildminimal1 $(ALT_OUT)
# Install hotspot script in build directory
HOTSPOT_SCRIPT=$(BUILD_DIR)/$(BUILD_FLAVOR)/hotspot
$(HOTSPOT_SCRIPT): $(GAMMADIR)/make/hotspot.script
$(QUIETLY) $(MKDIR) -p $(BUILD_DIR)/$(BUILD_FLAVOR)
$(QUIETLY) cat $< | sed -e 's|@@LIBARCH@@|$(LIBARCH)|g' | sed -e 's|@@JDK_IMPORT_PATH@@|$(JDK_IMPORT_PATH)|g' > $@
$(QUIETLY) chmod +x $@
# Build compiler1 (client) rule, different for platforms # Build compiler1 (client) rule, different for platforms
generic_build1: generic_build1: $(HOTSPOT_SCRIPT)
$(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)
ifeq ($(OSNAME),windows) ifeq ($(OSNAME),windows)
ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(ARCH_DATA_MODEL), 32)
@ -201,7 +212,7 @@ else
endif endif
# Build compiler2 (server) rule, different for platforms # Build compiler2 (server) rule, different for platforms
generic_build2: generic_build2: $(HOTSPOT_SCRIPT)
$(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)
ifeq ($(OSNAME),windows) ifeq ($(OSNAME),windows)
$(CD) $(OUTPUTDIR); \ $(CD) $(OUTPUTDIR); \
@ -217,19 +228,19 @@ else
$(MAKE_ARGS) $(VM_TARGET) $(MAKE_ARGS) $(VM_TARGET)
endif endif
generic_buildzero: generic_buildzero: $(HOTSPOT_SCRIPT)
$(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)
$(CD) $(OUTPUTDIR); \ $(CD) $(OUTPUTDIR); \
$(MAKE) -f $(ABS_OS_MAKEFILE) \ $(MAKE) -f $(ABS_OS_MAKEFILE) \
$(MAKE_ARGS) $(VM_TARGET) $(MAKE_ARGS) $(VM_TARGET)
generic_buildshark: generic_buildshark: $(HOTSPOT_SCRIPT)
$(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)
$(CD) $(OUTPUTDIR); \ $(CD) $(OUTPUTDIR); \
$(MAKE) -f $(ABS_OS_MAKEFILE) \ $(MAKE) -f $(ABS_OS_MAKEFILE) \
$(MAKE_ARGS) $(VM_TARGET) $(MAKE_ARGS) $(VM_TARGET)
generic_buildminimal1: generic_buildminimal1: $(HOTSPOT_SCRIPT)
ifeq ($(JVM_VARIANT_MINIMAL1),true) ifeq ($(JVM_VARIANT_MINIMAL1),true)
$(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)
ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(ARCH_DATA_MODEL), 32)
@ -252,224 +263,210 @@ endif
# Export file rule # Export file rule
generic_export: $(EXPORT_LIST) generic_export: $(EXPORT_LIST)
export_product: export_product:
$(MAKE) BUILD_FLAVOR=$(@:export_%=%) VM_SUBDIR=$(@:export_%=%) \ $(MAKE) BUILD_FLAVOR=$(@:export_%=%) generic_export
generic_export
export_fastdebug: export_fastdebug:
$(MAKE) BUILD_FLAVOR=$(@:export_%=%) VM_SUBDIR=$(@:export_%=%) \ $(MAKE) BUILD_FLAVOR=$(@:export_%=%) EXPORT_SUBDIR=/$(@:export_%=%) generic_export
EXPORT_SUBDIR=/$(@:export_%=%) \
generic_export
export_debug: export_debug:
$(MAKE) BUILD_FLAVOR=$(@:export_%=%) VM_SUBDIR=$(@:export_%=%) \ $(MAKE) BUILD_FLAVOR=$(@:export_%=%) EXPORT_SUBDIR=/$(@:export_%=%) generic_export
EXPORT_SUBDIR=/$(@:export_%=%) \
generic_export
export_optimized: export_optimized:
$(MAKE) BUILD_FLAVOR=$(@:export_%=%) VM_SUBDIR=$(@:export_%=%) \ $(MAKE) BUILD_FLAVOR=$(@:export_%=%) EXPORT_SUBDIR=/$(@:export_%=%) generic_export
EXPORT_SUBDIR=/$(@:export_%=%) \
generic_export
export_product_jdk:: export_product_jdk::
$(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) \ $(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR) generic_export
VM_SUBDIR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR) \
generic_export
export_optimized_jdk:: export_optimized_jdk::
$(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) \ $(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR) generic_export
VM_SUBDIR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR) \
generic_export
export_fastdebug_jdk:: export_fastdebug_jdk::
$(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) \ $(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/$(@:export_%_jdk=%) generic_export
VM_SUBDIR=$(@:export_%_jdk=%) \
ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/$(@:export_%_jdk=%) \
generic_export
export_debug_jdk:: export_debug_jdk::
$(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) VM_SUBDIR=$(@:export_%_jdk=%) \ $(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/$(@:export_%_jdk=%) generic_export
ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/$(@:export_%_jdk=%) \
generic_export
# Export file copy rules # Export file copy rules
XUSAGE=$(HS_SRC_DIR)/share/vm/Xusage.txt XUSAGE=$(HS_SRC_DIR)/share/vm/Xusage.txt
DOCS_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_docs DOCS_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_docs
C1_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_compiler1/$(VM_SUBDIR) C1_BUILD_DIR =$(C1_DIR)/$(BUILD_FLAVOR)
C2_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2/$(VM_SUBDIR) C2_BUILD_DIR =$(C2_DIR)/$(BUILD_FLAVOR)
MINIMAL1_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_minimal1/$(VM_SUBDIR) MINIMAL1_BUILD_DIR=$(MINIMAL1_DIR)/$(BUILD_FLAVOR)
ZERO_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_zero/$(VM_SUBDIR) ZERO_BUILD_DIR =$(ZERO_DIR)/$(BUILD_FLAVOR)
SHARK_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_shark/$(VM_SUBDIR) SHARK_BUILD_DIR =$(SHARK_DIR)/$(BUILD_FLAVOR)
# Server (C2) # Server (C2)
ifeq ($(JVM_VARIANT_SERVER), true) ifeq ($(JVM_VARIANT_SERVER), true)
# Common # Common
$(EXPORT_SERVER_DIR)/%.diz: $(C2_DIR)/%.diz $(EXPORT_SERVER_DIR)/%.diz: $(C2_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_LIB_DIR)/%.jar: $(C2_DIR)/../generated/%.jar $(EXPORT_LIB_DIR)/%.jar: $(C2_BUILD_DIR)/../generated/%.jar
$(install-file) $(install-file)
$(EXPORT_INCLUDE_DIR)/%: $(C2_DIR)/../generated/jvmtifiles/% $(EXPORT_INCLUDE_DIR)/%: $(C2_BUILD_DIR)/../generated/jvmtifiles/%
$(install-file) $(install-file)
# Windows # Windows
$(EXPORT_SERVER_DIR)/%.dll: $(C2_DIR)/%.dll $(EXPORT_SERVER_DIR)/%.dll: $(C2_BUILD_DIR)/%.dll
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.pdb: $(C2_DIR)/%.pdb $(EXPORT_SERVER_DIR)/%.pdb: $(C2_BUILD_DIR)/%.pdb
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.map: $(C2_DIR)/%.map $(EXPORT_SERVER_DIR)/%.map: $(C2_BUILD_DIR)/%.map
$(install-file) $(install-file)
$(EXPORT_LIB_DIR)/%.lib: $(C2_DIR)/%.lib $(EXPORT_LIB_DIR)/%.lib: $(C2_BUILD_DIR)/%.lib
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.diz: $(C2_DIR)/%.diz $(EXPORT_JRE_BIN_DIR)/%.diz: $(C2_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.dll: $(C2_DIR)/%.dll $(EXPORT_JRE_BIN_DIR)/%.dll: $(C2_BUILD_DIR)/%.dll
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.pdb: $(C2_DIR)/%.pdb $(EXPORT_JRE_BIN_DIR)/%.pdb: $(C2_BUILD_DIR)/%.pdb
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.map: $(C2_DIR)/%.map $(EXPORT_JRE_BIN_DIR)/%.map: $(C2_BUILD_DIR)/%.map
$(install-file) $(install-file)
# Unix # Unix
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C2_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(C2_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX): $(C2_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(C2_DIR)/%.debuginfo $(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(C2_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.debuginfo: $(C2_DIR)/%.debuginfo $(EXPORT_SERVER_DIR)/%.debuginfo: $(C2_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/64/%.debuginfo: $(C2_DIR)/%.debuginfo $(EXPORT_SERVER_DIR)/64/%.debuginfo: $(C2_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(C2_DIR)/%.diz $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(C2_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/64/%.diz: $(C2_DIR)/%.diz $(EXPORT_SERVER_DIR)/64/%.diz: $(C2_BUILD_DIR)/%.diz
$(install-file) $(install-file)
endif endif
# Client (C1) # Client (C1)
ifeq ($(JVM_VARIANT_CLIENT), true) ifeq ($(JVM_VARIANT_CLIENT), true)
# Common # Common
$(EXPORT_CLIENT_DIR)/%.diz: $(C1_DIR)/%.diz $(EXPORT_CLIENT_DIR)/%.diz: $(C1_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_LIB_DIR)/%.jar: $(C1_DIR)/../generated/%.jar $(EXPORT_LIB_DIR)/%.jar: $(C1_BUILD_DIR)/../generated/%.jar
$(install-file) $(install-file)
$(EXPORT_INCLUDE_DIR)/%: $(C1_DIR)/../generated/jvmtifiles/% $(EXPORT_INCLUDE_DIR)/%: $(C1_BUILD_DIR)/../generated/jvmtifiles/%
$(install-file) $(install-file)
# Windows # Windows
$(EXPORT_CLIENT_DIR)/%.dll: $(C1_DIR)/%.dll $(EXPORT_CLIENT_DIR)/%.dll: $(C1_BUILD_DIR)/%.dll
$(install-file) $(install-file)
$(EXPORT_CLIENT_DIR)/%.pdb: $(C1_DIR)/%.pdb $(EXPORT_CLIENT_DIR)/%.pdb: $(C1_BUILD_DIR)/%.pdb
$(install-file) $(install-file)
$(EXPORT_CLIENT_DIR)/%.map: $(C1_DIR)/%.map $(EXPORT_CLIENT_DIR)/%.map: $(C1_BUILD_DIR)/%.map
$(install-file) $(install-file)
$(EXPORT_LIB_DIR)/%.lib: $(C1_DIR)/%.lib $(EXPORT_LIB_DIR)/%.lib: $(C1_BUILD_DIR)/%.lib
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.diz: $(C1_DIR)/%.diz $(EXPORT_JRE_BIN_DIR)/%.diz: $(C1_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.dll: $(C1_DIR)/%.dll $(EXPORT_JRE_BIN_DIR)/%.dll: $(C1_BUILD_DIR)/%.dll
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.pdb: $(C1_DIR)/%.pdb $(EXPORT_JRE_BIN_DIR)/%.pdb: $(C1_BUILD_DIR)/%.pdb
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.map: $(C1_DIR)/%.map $(EXPORT_JRE_BIN_DIR)/%.map: $(C1_BUILD_DIR)/%.map
$(install-file) $(install-file)
# Unix # Unix
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C1_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_CLIENT_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_CLIENT_DIR)/%.$(LIBRARY_SUFFIX): $(C1_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_CLIENT_DIR)/64/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_CLIENT_DIR)/64/%.$(LIBRARY_SUFFIX): $(C1_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(C1_DIR)/%.debuginfo $(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(C1_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_CLIENT_DIR)/%.debuginfo: $(C1_DIR)/%.debuginfo $(EXPORT_CLIENT_DIR)/%.debuginfo: $(C1_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_CLIENT_DIR)/64/%.debuginfo: $(C1_DIR)/%.debuginfo $(EXPORT_CLIENT_DIR)/64/%.debuginfo: $(C1_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(C1_DIR)/%.diz $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(C1_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_CLIENT_DIR)/64/%.diz: $(C1_DIR)/%.diz $(EXPORT_CLIENT_DIR)/64/%.diz: $(C1_BUILD_DIR)/%.diz
$(install-file) $(install-file)
endif endif
# Minimal1 # Minimal1
ifeq ($(JVM_VARIANT_MINIMAL1), true) ifeq ($(JVM_VARIANT_MINIMAL1), true)
# Common # Common
$(EXPORT_MINIMAL_DIR)/%.diz: $(MINIMAL1_DIR)/%.diz $(EXPORT_MINIMAL_DIR)/%.diz: $(MINIMAL1_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_LIB_DIR)/%.jar: $(MINIMAL1_DIR)/../generated/%.jar $(EXPORT_LIB_DIR)/%.jar: $(MINIMAL1_BUILD_DIR)/../generated/%.jar
$(install-file) $(install-file)
$(EXPORT_INCLUDE_DIR)/%: $(MINIMAL1_DIR)/../generated/jvmtifiles/% $(EXPORT_INCLUDE_DIR)/%: $(MINIMAL1_BUILD_DIR)/../generated/jvmtifiles/%
$(install-file) $(install-file)
# Windows # Windows
$(EXPORT_MINIMAL_DIR)/%.dll: $(MINIMAL1_DIR)/%.dll $(EXPORT_MINIMAL_DIR)/%.dll: $(MINIMAL1_BUILD_DIR)/%.dll
$(install-file) $(install-file)
$(EXPORT_MINIMAL_DIR)/%.pdb: $(MINIMAL1_DIR)/%.pdb $(EXPORT_MINIMAL_DIR)/%.pdb: $(MINIMAL1_BUILD_DIR)/%.pdb
$(install-file) $(install-file)
$(EXPORT_MINIMAL_DIR)/%.map: $(MINIMAL1_DIR)/%.map $(EXPORT_MINIMAL_DIR)/%.map: $(MINIMAL1_BUILD_DIR)/%.map
$(install-file) $(install-file)
$(EXPORT_LIB_DIR)/%.lib: $(MINIMAL1_DIR)/%.lib $(EXPORT_LIB_DIR)/%.lib: $(MINIMAL1_BUILD_DIR)/%.lib
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.diz: $(MINIMAL1_DIR)/%.diz $(EXPORT_JRE_BIN_DIR)/%.diz: $(MINIMAL1_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.dll: $(MINIMAL1_DIR)/%.dll $(EXPORT_JRE_BIN_DIR)/%.dll: $(MINIMAL1_BUILD_DIR)/%.dll
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.pdb: $(MINIMAL1_DIR)/%.pdb $(EXPORT_JRE_BIN_DIR)/%.pdb: $(MINIMAL1_BUILD_DIR)/%.pdb
$(install-file) $(install-file)
$(EXPORT_JRE_BIN_DIR)/%.map: $(MINIMAL1_DIR)/%.map $(EXPORT_JRE_BIN_DIR)/%.map: $(MINIMAL1_BUILD_DIR)/%.map
$(install-file) $(install-file)
# Unix # Unix
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(MINIMAL1_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(MINIMAL1_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_MINIMAL_DIR)/%.$(LIBRARY_SUFFIX): $(MINIMAL1_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_MINIMAL_DIR)/%.$(LIBRARY_SUFFIX): $(MINIMAL1_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_MINIMAL_DIR)/64/%.$(LIBRARY_SUFFIX): $(MINIMAL1_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_MINIMAL_DIR)/64/%.$(LIBRARY_SUFFIX): $(MINIMAL1_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(MINIMAL1_DIR)/%.debuginfo $(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(MINIMAL1_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_MINIMAL_DIR)/%.debuginfo: $(MINIMAL1_DIR)/%.debuginfo $(EXPORT_MINIMAL_DIR)/%.debuginfo: $(MINIMAL1_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_MINIMAL_DIR)/64/%.debuginfo: $(MINIMAL1_DIR)/%.debuginfo $(EXPORT_MINIMAL_DIR)/64/%.debuginfo: $(MINIMAL1_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(MINIMAL1_DIR)/%.diz $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(MINIMAL1_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_MINIMAL_DIR)/64/%.diz: $(MINIMAL1_DIR)/%.diz $(EXPORT_MINIMAL_DIR)/64/%.diz: $(MINIMAL1_BUILD_DIR)/%.diz
$(install-file) $(install-file)
endif endif
# Zero # Zero
ifeq ($(JVM_VARIANT_ZERO), true) ifeq ($(JVM_VARIANT_ZERO), true)
# Common # Common
$(EXPORT_LIB_DIR)/%.jar: $(ZERO_DIR)/../generated/%.jar $(EXPORT_LIB_DIR)/%.jar: $(ZERO_BUILD_DIR)/../generated/%.jar
$(install-file) $(install-file)
$(EXPORT_INCLUDE_DIR)/%: $(ZERO_DIR)/../generated/jvmtifiles/% $(EXPORT_INCLUDE_DIR)/%: $(ZERO_BUILD_DIR)/../generated/jvmtifiles/%
$(install-file) $(install-file)
# Unix # Unix
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(ZERO_DIR)/%.debuginfo $(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: $(ZERO_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(ZERO_DIR)/%.diz $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(ZERO_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.debuginfo: $(ZERO_DIR)/%.debuginfo $(EXPORT_SERVER_DIR)/%.debuginfo: $(ZERO_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.diz: $(ZERO_DIR)/%.diz $(EXPORT_SERVER_DIR)/%.diz: $(ZERO_BUILD_DIR)/%.diz
$(install-file) $(install-file)
endif endif
# Shark # Shark
ifeq ($(JVM_VARIANT_ZEROSHARK), true) ifeq ($(JVM_VARIANT_ZEROSHARK), true)
# Common # Common
$(EXPORT_LIB_DIR)/%.jar: $(SHARK_DIR)/../generated/%.jar $(EXPORT_LIB_DIR)/%.jar: $(SHARK_BUILD_DIR)/../generated/%.jar
$(install-file) $(install-file)
$(EXPORT_INCLUDE_DIR)/%: $(SHARK_DIR)/../generated/jvmtifiles/% $(EXPORT_INCLUDE_DIR)/%: $(SHARK_BUILD_DIR)/../generated/jvmtifiles/%
$(install-file) $(install-file)
# Unix # Unix
$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo): $(SHARK_DIR)/%.debuginfo $(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo): $(SHARK_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(SHARK_DIR)/%.diz $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_DIR)/%.$(LIBRARY_SUFFIX) $(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.debuginfo: $(SHARK_DIR)/%.debuginfo $(EXPORT_SERVER_DIR)/%.debuginfo: $(SHARK_BUILD_DIR)/%.debuginfo
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/%.diz: $(SHARK_DIR)/%.diz $(EXPORT_SERVER_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz
$(install-file) $(install-file)
endif endif

View File

@ -49,7 +49,6 @@
# adlc.make - # adlc.make -
# jvmti.make - generate JVMTI bindings from the spec (JSR-163) # jvmti.make - generate JVMTI bindings from the spec (JSR-163)
# sa.make - generate SA jar file and natives # sa.make - generate SA jar file and natives
# env.[ck]sh - environment settings
# #
# The makefiles are split this way so that "make foo" will run faster by not # The makefiles are split this way so that "make foo" will run faster by not
# having to read the dependency files for the vm. # having to read the dependency files for the vm.
@ -129,9 +128,7 @@ SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS))
BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make
# dtrace.make is used on BSD versions that implement Dtrace (like MacOS X) # dtrace.make is used on BSD versions that implement Dtrace (like MacOS X)
BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make \ BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make sa.make dtrace.make
jvmti.make sa.make dtrace.make \
env.sh env.csh jdkpath.sh
BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
@ -354,33 +351,6 @@ dtrace.make: $(BUILDTREE_MAKE)
echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
) > $@ ) > $@
env.sh: $(BUILDTREE_MAKE)
@echo Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
{ echo "JAVA_HOME=$(JDK_IMPORT_PATH)"; }; \
{ \
echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
} | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \
echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \
echo "export JAVA_HOME CLASSPATH HOTSPOT_BUILD_USER"; \
) > $@
env.csh: env.sh
@echo Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
{ echo "setenv JAVA_HOME \"$(JDK_IMPORT_PATH)\""; }; \
sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=/setenv \1 /p' $?; \
) > $@
jdkpath.sh: $(BUILDTREE_MAKE)
@echo Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo "JDK=${JAVA_HOME}"; \
) > $@
FORCE: FORCE:
.PHONY: all FORCE .PHONY: all FORCE

View File

@ -1,115 +0,0 @@
#
# Copyright (c) 2005, 2012, 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.
#
#
# Rules to build gamma launcher, used by vm.make
LAUNCHER_SCRIPT = hotspot
LAUNCHER = gamma
LAUNCHERDIR := $(GAMMADIR)/src/os/posix/launcher
LAUNCHERDIR_SHARE := $(GAMMADIR)/src/share/tools/launcher
LAUNCHERFLAGS := $(ARCHFLAG) \
-I$(LAUNCHERDIR) -I$(GAMMADIR)/src/share/vm/prims \
-I$(LAUNCHERDIR_SHARE) \
-DFULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
-DJDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
-DJDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
-DARCH=\"$(LIBARCH)\" \
-DGAMMA \
-DLAUNCHER_TYPE=\"gamma\" \
-DLINK_INTO_$(LINK_INTO) \
$(TARGET_DEFINES)
# Give the launcher task_for_pid() privileges so that it can be used to run JStack, JInfo, et al.
LFLAGS_LAUNCHER += -sectcreate __TEXT __info_plist $(GAMMADIR)/src/os/bsd/launcher/Info-privileged.plist
ifeq ($(LINK_INTO),AOUT)
LAUNCHER.o = launcher.o $(JVM_OBJ_FILES)
LAUNCHER_MAPFILE = mapfile_reorder
LFLAGS_LAUNCHER$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LAUNCHER_MAPFILE))
LFLAGS_LAUNCHER += $(SONAMEFLAG:SONAME=$(LIBJVM)) $(STATIC_LIBGCC)
LIBS_LAUNCHER += $(STATIC_STDCXX) $(LIBS)
else
LAUNCHER.o = launcher.o
LFLAGS_LAUNCHER += -L`pwd`
# The gamma launcher runs the JDK from $JAVA_HOME, overriding the JVM with a
# freshly built JVM at ./libjvm.{so|dylib}. This is accomplished by setting
# the library searchpath using ({DY}LD_LIBRARY_PATH) to find the local JVM
# first. Gamma dlopen()s libjava from $JAVA_HOME/jre/lib{/$arch}, which is
# statically linked with CoreFoundation framework libs. Unfortunately, gamma's
# unique searchpath results in some unresolved symbols in the framework
# libraries, because JDK libraries are inadvertently discovered first on the
# searchpath, e.g. libjpeg. On Mac OS X, filenames are case *insensitive*.
# So, the actual filename collision is libjpeg.dylib and libJPEG.dylib.
# To resolve this, gamma needs to also statically link with the CoreFoundation
# framework libraries.
ifeq ($(OS_VENDOR),Darwin)
LFLAGS_LAUNCHER += -framework CoreFoundation
endif
LIBS_LAUNCHER += -l$(JVM) $(LIBS)
endif
LINK_LAUNCHER = $(LINK.CC)
LINK_LAUNCHER/PRE_HOOK = $(LINK_LIB.CXX/PRE_HOOK)
LINK_LAUNCHER/POST_HOOK = $(LINK_LIB.CXX/POST_HOOK)
LAUNCHER_OUT = launcher
SUFFIXES += .d
SOURCES := $(shell find $(LAUNCHERDIR) -name "*.c")
SOURCES_SHARE := $(shell find $(LAUNCHERDIR_SHARE) -name "*.c")
OBJS := $(patsubst $(LAUNCHERDIR)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES)) $(patsubst $(LAUNCHERDIR_SHARE)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES_SHARE))
DEPFILES := $(patsubst %.o,%.d,$(OBJS))
-include $(DEPFILES)
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR_SHARE)/%.c
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR)/%.c
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
$(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE)
$(QUIETLY) echo Linking launcher...
$(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK)
$(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LIBS_LAUNCHER)
$(QUIETLY) $(LINK_LAUNCHER/POST_HOOK)
# Sign the launcher with the development certificate (if present) so that it can be used
# to run JStack, JInfo, et al.
$(QUIETLY) -codesign -s openjdk_codesign $@
$(LAUNCHER): $(LAUNCHER_SCRIPT)
$(LAUNCHER_SCRIPT): $(LAUNCHERDIR)/launcher.script
$(QUIETLY) sed -e 's/@@LIBARCH@@/$(LIBARCH)/g' $< > $@
$(QUIETLY) chmod +x $@

View File

@ -331,9 +331,6 @@ install_jvm: $(LIBJVM)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Other files # Other files
# Gamma launcher
include $(MAKEFILES_DIR)/launcher.make
# Signal interposition library # Signal interposition library
include $(MAKEFILES_DIR)/jsig.make include $(MAKEFILES_DIR)/jsig.make

View File

@ -72,6 +72,7 @@ EMACS=emacs
REL_MYDIR=`dirname $0` REL_MYDIR=`dirname $0`
MYDIR=`cd $REL_MYDIR && pwd` MYDIR=`cd $REL_MYDIR && pwd`
#
# Look whether the user wants to run inside gdb # Look whether the user wants to run inside gdb
case "$1" in case "$1" in
-gdb) -gdb)
@ -95,16 +96,14 @@ case "$1" in
;; ;;
esac esac
JDK= if [ "${ALT_JAVA_HOME}" != "" ]; then
if [ "${ALT_JAVA_HOME}" = "" ]; then JDK=${ALT_JAVA_HOME%%/jre}
. ${MYDIR}/jdkpath.sh
else else
JDK=${ALT_JAVA_HOME%%/jre}; JDK=@@JDK_IMPORT_PATH@@
fi fi
if [ "${JDK}" = "" ]; then if [ "${JDK}" = "" ]; then
echo Failed to find JDK. ALT_JAVA_HOME is not set or ./jdkpath.sh is empty or not found. echo "Failed to find JDK. Either ALT_JAVA_HOME is not set or JDK_IMPORT_PATH is empty."
exit 1
fi fi
# We will set the LD_LIBRARY_PATH as follows: # We will set the LD_LIBRARY_PATH as follows:
@ -142,12 +141,12 @@ else
export LD_LIBRARY_PATH export LD_LIBRARY_PATH
fi fi
JPARMS="$@ $JAVA_ARGS"; JPARMS="-Dsun.java.launcher=gamma -XXaltjvm=$MYDIR $@ $JAVA_ARGS";
# Locate the gamma development launcher # Locate the java launcher
LAUNCHER=${MYDIR}/gamma LAUNCHER=$JDK/bin/java
if [ ! -x $LAUNCHER ] ; then if [ ! -x $LAUNCHER ] ; then
echo Error: Cannot find the gamma development launcher \"$LAUNCHER\" echo Error: Cannot find the java launcher \"$LAUNCHER\"
exit 1 exit 1
fi fi
@ -166,9 +165,10 @@ set args $JPARMS
file $LAUNCHER file $LAUNCHER
directory $GDBSRCDIR directory $GDBSRCDIR
# Get us to a point where we can set breakpoints in libjvm.so # Get us to a point where we can set breakpoints in libjvm.so
break InitializeJVM set breakpoint pending on
break JNI_CreateJavaVM
run run
# Stop in InitializeJVM # Stop in JNI_CreateJavaVM
delete 1 delete 1
# We can now set breakpoints wherever we like # We can now set breakpoints wherever we like
EOF EOF
@ -199,7 +199,7 @@ case "$MODE" in
rm -f $GDBSCR rm -f $GDBSCR
;; ;;
dbx) dbx)
$DBX -s $HOME/.dbxrc $LAUNCHER $JPARMS $DBX -s $HOME/.dbxrc -c "loadobject -load libjvm.so; stop in JNI_CreateJavaVM; run $JPARMS; delete all" $LAUNCHER
;; ;;
valgrind) valgrind)
echo Warning: Defaulting to 16Mb heap to make Valgrind run faster, use -Xmx for larger heap echo Warning: Defaulting to 16Mb heap to make Valgrind run faster, use -Xmx for larger heap

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013
HS_MAJOR_VER=25 HS_MAJOR_VER=25
HS_MINOR_VER=0 HS_MINOR_VER=0
HS_BUILD_NUMBER=33 HS_BUILD_NUMBER=34
JDK_MAJOR_VER=1 JDK_MAJOR_VER=1
JDK_MINOR_VER=8 JDK_MINOR_VER=8

View File

@ -134,14 +134,14 @@ jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}}
jprt.build.targets.standard= \ jprt.build.targets.standard= \
${jprt.my.solaris.sparc}-{product|fastdebug}, \ ${jprt.my.solaris.sparc}-{product|fastdebug}, \
${jprt.my.solaris.sparcv9}-{product|fastdebug}, \ ${jprt.my.solaris.sparcv9}-{product|fastdebug|optimized}, \
${jprt.my.solaris.i586}-{product|fastdebug}, \ ${jprt.my.solaris.i586}-{product|fastdebug}, \
${jprt.my.solaris.x64}-{product|fastdebug}, \ ${jprt.my.solaris.x64}-{product|fastdebug}, \
${jprt.my.linux.i586}-{product|fastdebug}, \ ${jprt.my.linux.i586}-{product|fastdebug}, \
${jprt.my.linux.x64}-{product|fastdebug}, \ ${jprt.my.linux.x64}-{product|fastdebug|optimized}, \
${jprt.my.macosx.x64}-{product|fastdebug}, \ ${jprt.my.macosx.x64}-{product|fastdebug}, \
${jprt.my.windows.i586}-{product|fastdebug}, \ ${jprt.my.windows.i586}-{product|fastdebug}, \
${jprt.my.windows.x64}-{product|fastdebug}, \ ${jprt.my.windows.x64}-{product|fastdebug|optimized}, \
${jprt.my.linux.armvh}-{product|fastdebug} ${jprt.my.linux.armvh}-{product|fastdebug}
jprt.build.targets.open= \ jprt.build.targets.open= \

View File

@ -49,7 +49,6 @@
# adlc.make - # adlc.make -
# jvmti.make - generate JVMTI bindings from the spec (JSR-163) # jvmti.make - generate JVMTI bindings from the spec (JSR-163)
# sa.make - generate SA jar file and natives # sa.make - generate SA jar file and natives
# env.[ck]sh - environment settings
# #
# The makefiles are split this way so that "make foo" will run faster by not # The makefiles are split this way so that "make foo" will run faster by not
# having to read the dependency files for the vm. # having to read the dependency files for the vm.
@ -123,8 +122,7 @@ SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS))
# For dependencies and recursive makes. # For dependencies and recursive makes.
BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make
BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make sa.make \ BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make sa.make
env.sh env.csh jdkpath.sh
BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
@ -349,33 +347,6 @@ sa.make: $(BUILDTREE_MAKE)
echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
) > $@ ) > $@
env.sh: $(BUILDTREE_MAKE)
@echo Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
{ echo "JAVA_HOME=$(JDK_IMPORT_PATH)"; }; \
{ \
echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
} | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \
echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \
echo "export JAVA_HOME CLASSPATH HOTSPOT_BUILD_USER"; \
) > $@
env.csh: env.sh
@echo Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
{ echo "setenv JAVA_HOME \"$(JDK_IMPORT_PATH)\""; }; \
sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=/setenv \1 /p' $?; \
) > $@
jdkpath.sh: $(BUILDTREE_MAKE)
@echo Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo "JDK=${JAVA_HOME}"; \
) > $@
FORCE: FORCE:
.PHONY: all FORCE .PHONY: all FORCE

View File

@ -1,93 +0,0 @@
#
# Copyright (c) 2005, 2012, 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.
#
#
# Rules to build gamma launcher, used by vm.make
LAUNCHER_SCRIPT = hotspot
LAUNCHER = gamma
LAUNCHERDIR := $(GAMMADIR)/src/os/posix/launcher
LAUNCHERDIR_SHARE := $(GAMMADIR)/src/share/tools/launcher
LAUNCHERFLAGS := $(ARCHFLAG) \
-I$(LAUNCHERDIR) -I$(GAMMADIR)/src/share/vm/prims \
-I$(LAUNCHERDIR_SHARE) \
-DFULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
-DJDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
-DJDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
-DARCH=\"$(LIBARCH)\" \
-DGAMMA \
-DLAUNCHER_TYPE=\"gamma\" \
-DLINK_INTO_$(LINK_INTO) \
$(TARGET_DEFINES)
ifeq ($(LINK_INTO),AOUT)
LAUNCHER.o = launcher.o $(JVM_OBJ_FILES)
LAUNCHER_MAPFILE = mapfile_reorder
LFLAGS_LAUNCHER$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LAUNCHER_MAPFILE))
LFLAGS_LAUNCHER += $(SONAMEFLAG:SONAME=$(LIBJVM)) $(STATIC_LIBGCC)
LIBS_LAUNCHER += $(STATIC_STDCXX) $(LIBS)
else
LAUNCHER.o = launcher.o
LFLAGS_LAUNCHER += -L `pwd`
LIBS_LAUNCHER += -l$(JVM) $(LIBS)
endif
LINK_LAUNCHER = $(LINK.CC)
LINK_LAUNCHER/PRE_HOOK = $(LINK_LIB.CXX/PRE_HOOK)
LINK_LAUNCHER/POST_HOOK = $(LINK_LIB.CXX/POST_HOOK)
LAUNCHER_OUT = launcher
SUFFIXES += .d
SOURCES := $(shell find $(LAUNCHERDIR) -name "*.c")
SOURCES_SHARE := $(shell find $(LAUNCHERDIR_SHARE) -name "*.c")
OBJS := $(patsubst $(LAUNCHERDIR)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES)) $(patsubst $(LAUNCHERDIR_SHARE)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES_SHARE))
DEPFILES := $(patsubst %.o,%.d,$(OBJS))
-include $(DEPFILES)
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR_SHARE)/%.c
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR)/%.c
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
$(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE)
$(QUIETLY) echo Linking launcher...
$(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK)
$(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LIBS_LAUNCHER)
$(QUIETLY) $(LINK_LAUNCHER/POST_HOOK)
$(LAUNCHER): $(LAUNCHER_SCRIPT)
$(LAUNCHER_SCRIPT): $(LAUNCHERDIR)/launcher.script
$(QUIETLY) sed -e 's/@@LIBARCH@@/$(LIBARCH)/g' $< > $@
$(QUIETLY) chmod +x $@

View File

@ -372,9 +372,6 @@ install_jvm: $(LIBJVM)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Other files # Other files
# Gamma launcher
include $(MAKEFILES_DIR)/launcher.make
# Signal interposition library # Signal interposition library
include $(MAKEFILES_DIR)/jsig.make include $(MAKEFILES_DIR)/jsig.make

View File

@ -49,7 +49,6 @@
# adlc.make - # adlc.make -
# jvmti.make - generate JVMTI bindings from the spec (JSR-163) # jvmti.make - generate JVMTI bindings from the spec (JSR-163)
# sa.make - generate SA jar file and natives # sa.make - generate SA jar file and natives
# env.[ck]sh - environment settings
# #
# The makefiles are split this way so that "make foo" will run faster by not # The makefiles are split this way so that "make foo" will run faster by not
# having to read the dependency files for the vm. # having to read the dependency files for the vm.
@ -116,8 +115,7 @@ SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS))
# For dependencies and recursive makes. # For dependencies and recursive makes.
BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make
BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make sa.make \ BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make sa.make
env.sh env.csh jdkpath.sh
BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
@ -339,33 +337,6 @@ sa.make: $(BUILDTREE_MAKE)
echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
) > $@ ) > $@
env.sh: $(BUILDTREE_MAKE)
@echo Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
{ echo "JAVA_HOME=$(JDK_IMPORT_PATH)"; }; \
{ \
echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
} | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \
echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \
echo "export JAVA_HOME LD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \
) > $@
env.csh: env.sh
@echo Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
{ echo "setenv JAVA_HOME \"$(JDK_IMPORT_PATH)\""; }; \
sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=/setenv \1 /p' $?; \
) > $@
jdkpath.sh: $(BUILDTREE_MAKE)
@echo Creating $@ ...
$(QUIETLY) ( \
$(BUILDTREE_COMMENT); \
echo "JDK=${JAVA_HOME}"; \
) > $@
FORCE: FORCE:
.PHONY: all FORCE .PHONY: all FORCE

View File

@ -1,108 +0,0 @@
#
# Copyright (c) 2005, 2012, 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.
#
#
# Rules to build gamma launcher, used by vm.make
LAUNCHER_SCRIPT = hotspot
LAUNCHER = gamma
LAUNCHERDIR = $(GAMMADIR)/src/os/posix/launcher
LAUNCHERDIR_SHARE := $(GAMMADIR)/src/share/tools/launcher
LAUNCHERFLAGS = $(ARCHFLAG) \
-I$(LAUNCHERDIR) -I$(GAMMADIR)/src/share/vm/prims \
-I$(LAUNCHERDIR_SHARE) \
-DFULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
-DJDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
-DJDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
-DARCH=\"$(LIBARCH)\" \
-DGAMMA \
-DLAUNCHER_TYPE=\"gamma\" \
-DLINK_INTO_$(LINK_INTO) \
$(TARGET_DEFINES)
ifeq ($(LINK_INTO),AOUT)
LAUNCHER.o = launcher.o $(JVM_OBJ_FILES)
LAUNCHER_MAPFILE = mapfile_extended
LFLAGS_LAUNCHER$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LAUNCHER_MAPFILE))
LIBS_LAUNCHER += $(LIBS)
else
LAUNCHER.o = launcher.o
LFLAGS_LAUNCHER += -L `pwd`
LIBS_LAUNCHER += -l$(JVM) $(LIBS)
endif
LINK_LAUNCHER = $(LINK.CXX)
LINK_LAUNCHER/PRE_HOOK = $(LINK_LIB.CXX/PRE_HOOK)
LINK_LAUNCHER/POST_HOOK = $(LINK_LIB.CXX/POST_HOOK)
ifeq ("${Platform_compiler}", "sparcWorks")
# Enable the following LAUNCHERFLAGS addition if you need to compare the
# built ELF objects.
#
# The -g option makes static data global and the "-W0,-noglobal"
# option tells the compiler to not globalize static data using a unique
# globalization prefix. Instead force the use of a static globalization
# prefix based on the source filepath so the objects from two identical
# compilations are the same.
#
# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
# seem to work. I got "-W0,-noglobal" from Kelly and that works.
#LAUNCHERFLAGS += -W0,-noglobal
endif # Platform_compiler == sparcWorks
LAUNCHER_OUT = launcher
SUFFIXES += .d
SOURCES := $(shell find $(LAUNCHERDIR) -name "*.c")
SOURCES_SHARE := $(shell find $(LAUNCHERDIR_SHARE) -name "*.c")
OBJS := $(patsubst $(LAUNCHERDIR)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES)) $(patsubst $(LAUNCHERDIR_SHARE)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES_SHARE))
DEPFILES := $(patsubst %.o,%.d,$(OBJS))
-include $(DEPFILES)
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR_SHARE)/%.c
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR)/%.c
$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
$(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE)
ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
$(QUIETLY) echo Linking launcher...
$(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK)
$(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LIBS_LAUNCHER)
$(QUIETLY) $(LINK_LAUNCHER/POST_HOOK)
endif # filter -sbfast -xsbfast
$(LAUNCHER): $(LAUNCHER_SCRIPT)
$(LAUNCHER_SCRIPT): $(LAUNCHERDIR)/launcher.script
$(QUIETLY) sed -e 's/@@LIBARCH@@/$(LIBARCH)/g' $< > $@
$(QUIETLY) chmod +x $@

View File

@ -338,9 +338,6 @@ install_jvm: $(LIBJVM)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Other files # Other files
# Gamma launcher
include $(MAKEFILES_DIR)/launcher.make
# Signal interposition library # Signal interposition library
include $(MAKEFILES_DIR)/jsig.make include $(MAKEFILES_DIR)/jsig.make

View File

@ -33,7 +33,7 @@ GENERATED=../generated
BUILD_PCH_FILE=_build_pch_file.obj BUILD_PCH_FILE=_build_pch_file.obj
!endif !endif
default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
!include ../local.make !include ../local.make
!include compile.make !include compile.make
@ -71,4 +71,3 @@ $(AOUT): $(Res_Files) $(Obj_Files) vm.def
!include $(WorkSpace)/make/windows/makefiles/shared.make !include $(WorkSpace)/make/windows/makefiles/shared.make
!include $(WorkSpace)/make/windows/makefiles/sa.make !include $(WorkSpace)/make/windows/makefiles/sa.make
!include $(WorkSpace)/make/windows/makefiles/launcher.make

View File

@ -33,7 +33,7 @@ GENERATED=../generated
BUILD_PCH_FILE=_build_pch_file.obj BUILD_PCH_FILE=_build_pch_file.obj
!endif !endif
default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
!include ../local.make !include ../local.make
!include compile.make !include compile.make
@ -70,4 +70,3 @@ $(AOUT): $(Res_Files) $(Obj_Files) vm.def
!include $(WorkSpace)/make/windows/makefiles/shared.make !include $(WorkSpace)/make/windows/makefiles/shared.make
!include $(WorkSpace)/make/windows/makefiles/sa.make !include $(WorkSpace)/make/windows/makefiles/sa.make
!include $(WorkSpace)/make/windows/makefiles/launcher.make

View File

@ -1,73 +0,0 @@
#
# Copyright (c) 2010, 2012, 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.
#
#
LAUNCHER_FLAGS=$(CXX_FLAGS) $(ARCHFLAG) \
/D FULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
/D JDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
/D JDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
/D GAMMA \
/D LAUNCHER_TYPE=\"gamma\" \
/D _CRT_SECURE_NO_WARNINGS \
/D _CRT_SECURE_NO_DEPRECATE \
/D LINK_INTO_LIBJVM \
/I $(WorkSpace)\src\os\windows\launcher \
/I $(WorkSpace)\src\share\tools\launcher \
/I $(WorkSpace)\src\share\vm\prims \
/I $(WorkSpace)\src\share\vm \
/I $(WorkSpace)\src\cpu\$(Platform_arch)\vm \
/I $(WorkSpace)\src\os\windows\vm
LD_FLAGS=/manifest $(HS_INTERNAL_NAME).lib kernel32.lib user32.lib /nologo /machine:$(MACHINE) /map /debug /subsystem:console
!if "$(COMPILER_NAME)" == "VS2005"
# This VS2005 compiler has /GS as a default and requires bufferoverflowU.lib
# on the link command line, otherwise we get missing __security_check_cookie
# externals at link time. Even with /GS-, you need bufferoverflowU.lib.
BUFFEROVERFLOWLIB = bufferoverflowU.lib
LD_FLAGS = $(LD_FLAGS) $(BUFFEROVERFLOWLIB)
!endif
!if "$(COMPILER_NAME)" == "VS2010" && "$(BUILDARCH)" == "i486"
LD_FLAGS = /SAFESEH $(LD_FLAGS)
!endif
LAUNCHERDIR = $(WorkSpace)/src/os/windows/launcher
LAUNCHERDIR_SHARE = $(WorkSpace)/src/share/tools/launcher
OUTDIR = launcher
{$(LAUNCHERDIR)}.c{$(OUTDIR)}.obj:
-mkdir $(OUTDIR) 2>NUL >NUL
$(CXX) $(LAUNCHER_FLAGS) /c /Fo$@ $<
{$(LAUNCHERDIR_SHARE)}.c{$(OUTDIR)}.obj:
-mkdir $(OUTDIR) 2>NUL >NUL
$(CXX) $(LAUNCHER_FLAGS) /c /Fo$@ $<
$(OUTDIR)\*.obj: $(LAUNCHERDIR)\*.c $(LAUNCHERDIR)\*.h $(LAUNCHERDIR_SHARE)\*.c $(LAUNCHERDIR_SHARE)\*.h
launcher: $(OUTDIR)\java.obj $(OUTDIR)\java_md.obj $(OUTDIR)\jli_util.obj
echo $(JAVA_HOME) > jdkpath.txt
$(LD) $(LD_FLAGS) /out:hotspot.exe $**

View File

@ -32,7 +32,7 @@ GENERATED=../generated
BUILD_PCH_FILE=_build_pch_file.obj BUILD_PCH_FILE=_build_pch_file.obj
!endif !endif
default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA default:: $(BUILD_PCH_FILE) $(AOUT) checkAndBuildSA
!include ../local.make !include ../local.make
!include compile.make !include compile.make
@ -73,4 +73,3 @@ $(AOUT): $(Res_Files) $(Obj_Files) vm.def
!include $(WorkSpace)/make/windows/makefiles/shared.make !include $(WorkSpace)/make/windows/makefiles/shared.make
!include $(WorkSpace)/make/windows/makefiles/sa.make !include $(WorkSpace)/make/windows/makefiles/sa.make
!include $(WorkSpace)/make/windows/makefiles/launcher.make

View File

@ -59,7 +59,6 @@ ProjectCreatorIncludesPRIVATE=\
-relativeSrcInclude src \ -relativeSrcInclude src \
-absoluteSrcInclude $(HOTSPOTBUILDSPACE) \ -absoluteSrcInclude $(HOTSPOTBUILDSPACE) \
-ignorePath $(HOTSPOTBUILDSPACE) \ -ignorePath $(HOTSPOTBUILDSPACE) \
-ignorePath launcher \
-ignorePath share\vm\adlc \ -ignorePath share\vm\adlc \
-ignorePath share\vm\shark \ -ignorePath share\vm\shark \
-ignorePath share\tools \ -ignorePath share\tools \
@ -105,7 +104,6 @@ ProjectCreatorIDEOptions=\
-define ALIGN_STACK_FRAMES \ -define ALIGN_STACK_FRAMES \
-define VM_LITTLE_ENDIAN \ -define VM_LITTLE_ENDIAN \
-prelink "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME) set JAVA_HOME=$(HOTSPOTJDKDIST) $(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(LD_VER)" \ -prelink "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME) set JAVA_HOME=$(HOTSPOTJDKDIST) $(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(LD_VER)" \
-postbuild "" "Building hotspot.exe..." "cd $(HOTSPOTBUILDSPACE)\%f\%b set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME) nmake -f $(HOTSPOTWORKSPACE)\make\windows\projectfiles\common\Makefile LOCAL_MAKE=$(HOTSPOTBUILDSPACE)\%f\local.make JAVA_HOME=$(HOTSPOTJDKDIST) launcher" \
-ignoreFile jsig.c \ -ignoreFile jsig.c \
-ignoreFile jvmtiEnvRecommended.cpp \ -ignoreFile jvmtiEnvRecommended.cpp \
-ignoreFile jvmtiEnvStub.cpp \ -ignoreFile jvmtiEnvStub.cpp \

View File

@ -65,7 +65,6 @@ JvmtiOutDir=$(HOTSPOTBUILDSPACE)\$(Variant)\generated\jvmtifiles
!endif !endif
HS_INTERNAL_NAME=jvm HS_INTERNAL_NAME=jvm
!include $(HOTSPOTWORKSPACE)/make/windows/makefiles/launcher.make
default:: $(AdditionalTargets) $(JvmtiGeneratedFiles) default:: $(AdditionalTargets) $(JvmtiGeneratedFiles)

View File

@ -74,7 +74,7 @@ define_pd_global(bool, RewriteFrequentPairs, true);
define_pd_global(bool, UseMembar, false); define_pd_global(bool, UseMembar, false);
// GC Ergo Flags // GC Ergo Flags
define_pd_global(intx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread
#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) \ #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) \
\ \

View File

@ -77,7 +77,7 @@ define_pd_global(bool, UseMembar, false);
#endif #endif
// GC Ergo Flags // GC Ergo Flags
define_pd_global(intx, CMSYoungGenPerWorker, 64*M); // default max size of CMS young gen, per GC worker thread define_pd_global(uintx, CMSYoungGenPerWorker, 64*M); // default max size of CMS young gen, per GC worker thread
#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) \ #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) \
\ \

View File

@ -55,7 +55,7 @@ define_pd_global(bool, RewriteFrequentPairs, true);
define_pd_global(bool, UseMembar, true); define_pd_global(bool, UseMembar, true);
// GC Ergo Flags // GC Ergo Flags
define_pd_global(intx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread
#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct)

File diff suppressed because it is too large Load Diff

View File

@ -1,82 +0,0 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef JAVA_MD_H
#define JAVA_MD_H
#include <limits.h>
#include <unistd.h>
#include <sys/param.h>
#ifndef GAMMA
#include "manifest_info.h"
#endif
#include "jli_util.h"
#define PATH_SEPARATOR ':'
#define FILESEP "/"
#define FILE_SEPARATOR '/'
#define IS_FILE_SEPARATOR(c) ((c) == '/')
#ifndef MAXNAMELEN
#define MAXNAMELEN PATH_MAX
#endif
#ifdef JAVA_ARGS
/*
* ApplicationHome is prepended to each of these entries; the resulting
* strings are concatenated (separated by PATH_SEPARATOR) and used as the
* value of -cp option to the launcher.
*/
#ifndef APP_CLASSPATH
#define APP_CLASSPATH { "/lib/tools.jar", "/classes" }
#endif
#endif
#ifdef HAVE_GETHRTIME
/*
* Support for doing cheap, accurate interval timing.
*/
#include <sys/time.h>
#define CounterGet() (gethrtime()/1000)
#define Counter2Micros(counts) (counts)
#else
#define CounterGet() (0)
#define Counter2Micros(counts) (1)
#endif /* HAVE_GETHRTIME */
#ifdef _LP64
#define JLONG_FORMAT "%ld"
#else
#define JLONG_FORMAT "%lld"
#endif
/*
* Function prototypes.
*/
#ifndef GAMMA
char *LocateJRE(manifest_info *info);
void ExecJRE(char *jre, char **argv);
#endif
int UnsetEnv(char *name);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,83 +0,0 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef JAVA_MD_H
#define JAVA_MD_H
#include <jni.h>
#include <windows.h>
#include <io.h>
#ifndef GAMMA
#include "manifest_info.h"
#endif
#include "jli_util.h"
#ifdef GAMMA
#define stricmp _stricmp
#define strnicmp _strnicmp
#define snprintf _snprintf
#define strdup _strdup
#endif
#define PATH_SEPARATOR ';'
#define FILESEP "\\"
#define FILE_SEPARATOR '\\'
#define IS_FILE_SEPARATOR(c) ((c) == '\\' || (c) == '/')
#define MAXPATHLEN MAX_PATH
#define MAXNAMELEN MAX_PATH
#ifdef JAVA_ARGS
/*
* ApplicationHome is prepended to each of these entries; the resulting
* strings are concatenated (separated by PATH_SEPARATOR) and used as the
* value of -cp option to the launcher.
*/
#ifndef APP_CLASSPATH
#define APP_CLASSPATH { "\\lib\\tools.jar", "\\classes" }
#endif
#endif
/*
* Support for doing cheap, accurate interval timing.
*/
extern jlong CounterGet(void);
extern jlong Counter2Micros(jlong counts);
#ifdef JAVAW
#define main _main
extern int _main(int argc, char **argv);
#endif
#define JLONG_FORMAT "%I64d"
/*
* Function prototypes.
*/
#ifndef GAMMA
char *LocateJRE(manifest_info *info);
void ExecJRE(char *jre, char **argv);
#endif
int UnsetEnv(char *name);
#endif

View File

@ -65,6 +65,7 @@ class BuildConfig {
String sourceBase = getFieldString(null, "SourceBase"); String sourceBase = getFieldString(null, "SourceBase");
String buildSpace = getFieldString(null, "BuildSpace"); String buildSpace = getFieldString(null, "BuildSpace");
String outDir = buildBase; String outDir = buildBase;
String jdkTargetRoot = getFieldString(null, "JdkTargetRoot");
put("Id", flavourBuild); put("Id", flavourBuild);
put("OutputDir", outDir); put("OutputDir", outDir);
@ -72,6 +73,7 @@ class BuildConfig {
put("BuildBase", buildBase); put("BuildBase", buildBase);
put("BuildSpace", buildSpace); put("BuildSpace", buildSpace);
put("OutputDll", outDir + Util.sep + outDll); put("OutputDll", outDir + Util.sep + outDll);
put("JdkTargetRoot", jdkTargetRoot);
context = new String [] {flavourBuild, flavour, build, null}; context = new String [] {flavourBuild, flavour, build, null};
} }

View File

@ -98,11 +98,6 @@ public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 {
tagV(cfg.getV("LinkerFlags")); tagV(cfg.getV("LinkerFlags"));
endTag(); endTag();
startTag("PostBuildEvent");
tagData("Message", BuildConfig.getFieldString(null, "PostbuildDescription"));
tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PostbuildCommand").replace("\t", "\r\n")));
endTag();
startTag("PreLinkEvent"); startTag("PreLinkEvent");
tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription")); tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription"));
tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace("\t", "\r\n"))); tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace("\t", "\r\n")));
@ -141,7 +136,9 @@ public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 {
for (BuildConfig cfg : allConfigs) { for (BuildConfig cfg : allConfigs) {
startTag(cfg, "PropertyGroup"); startTag(cfg, "PropertyGroup");
tagData("LocalDebuggerCommand", "$(TargetDir)/hotspot.exe"); tagData("LocalDebuggerCommand", cfg.get("JdkTargetRoot") + "\\bin\\java.exe");
tagData("LocalDebuggerCommandArguments", "-XXaltjvm=$(TargetDir) -Dsun.java.launcher=gamma");
tagData("LocalDebuggerEnvironment", "JAVA_HOME=" + cfg.get("JdkTargetRoot"));
endTag(); endTag();
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,110 +0,0 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef _JAVA_H_
#define _JAVA_H_
/*
* Get system specific defines.
*/
#include "jni.h"
#include "java_md.h"
#include "jli_util.h"
/*
* Pointers to the needed JNI invocation API, initialized by LoadJavaVM.
*/
typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args);
typedef jint (JNICALL *GetDefaultJavaVMInitArgs_t)(void *args);
typedef struct {
CreateJavaVM_t CreateJavaVM;
GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs;
} InvocationFunctions;
/*
* Prototypes for launcher functions in the system specific java_md.c.
*/
jboolean
LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn);
void
GetXUsagePath(char *buf, jint bufsize);
jboolean
GetApplicationHome(char *buf, jint bufsize);
const char *
GetArch();
void CreateExecutionEnvironment(int *_argc,
char ***_argv,
char jrepath[],
jint so_jrepath,
char jvmpath[],
jint so_jvmpath,
char **original_argv);
/*
* Report an error message to stderr or a window as appropriate. The
* flag always is set to JNI_TRUE if message is to be reported to both
* strerr and windows and set to JNI_FALSE if the message should only
* be sent to a window.
*/
void ReportErrorMessage(char * message, jboolean always);
void ReportErrorMessage2(char * format, char * string, jboolean always);
/*
* Report an exception which terminates the vm to stderr or a window
* as appropriate.
*/
void ReportExceptionDescription(JNIEnv * env);
jboolean RemovableMachineDependentOption(char * option);
void PrintMachineDependentOptions();
/*
* Block current thread and continue execution in new thread
*/
int ContinueInNewThread(int (JNICALL *continuation)(void *),
jlong stack_size, void * args);
/* sun.java.launcher.* platform properties. */
void SetJavaLauncherPlatformProps(void);
/*
* Functions defined in java.c and used in java_md.c.
*/
jint ReadKnownVMs(const char *jrepath, char * arch, jboolean speculative);
char *CheckJvmType(int *argc, char ***argv, jboolean speculative);
void AddOption(char *str, void *info);
/*
* Make launcher spit debug output.
*/
extern jboolean _launcher_debug;
#endif /* _JAVA_H_ */

View File

@ -1,89 +0,0 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include <stdio.h>
#include <string.h>
#include "jli_util.h"
#ifdef GAMMA
#ifdef TARGET_OS_FAMILY_windows
#define strdup _strdup
#endif
#endif
/*
* Returns a pointer to a block of at least 'size' bytes of memory.
* Prints error message and exits if the memory could not be allocated.
*/
void *
JLI_MemAlloc(size_t size)
{
void *p = malloc(size);
if (p == 0) {
perror("malloc");
exit(1);
}
return p;
}
/*
* Equivalent to realloc(size).
* Prints error message and exits if the memory could not be reallocated.
*/
void *
JLI_MemRealloc(void *ptr, size_t size)
{
void *p = realloc(ptr, size);
if (p == 0) {
perror("realloc");
exit(1);
}
return p;
}
/*
* Wrapper over strdup(3C) which prints an error message and exits if memory
* could not be allocated.
*/
char *
JLI_StringDup(const char *s1)
{
char *s = strdup(s1);
if (s == NULL) {
perror("strdup");
exit(1);
}
return s;
}
/*
* Very equivalent to free(ptr).
* Here to maintain pairing with the above routines.
*/
void
JLI_MemFree(void *ptr)
{
free(ptr);
}

View File

@ -1,496 +0,0 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/*
* Class-Path Wildcards
*
* The syntax for wildcards is a single asterisk. The class path
* foo/"*", e.g., loads all jar files in the directory named foo.
* (This requires careful quotation when used in shell scripts.)
*
* Only files whose names end in .jar or .JAR are matched.
* Files whose names end in .zip, or which have a particular
* magic number, regardless of filename extension, are not
* matched.
*
* Files are considered regardless of whether or not they are
* "hidden" in the UNIX sense, i.e., have names beginning with '.'.
*
* A wildcard only matches jar files, not class files in the same
* directory. If you want to load both class files and jar files from
* a single directory foo then you can say foo:foo/"*", or foo/"*":foo
* if you want the jar files to take precedence.
*
* Subdirectories are not searched recursively, i.e., foo/"*" only
* looks for jar files in foo, not in foo/bar, foo/baz, etc.
*
* Expansion of wildcards is done early, prior to the invocation of a
* program's main method, rather than late, during the class-loading
* process itself. Each element of the input class path containing a
* wildcard is replaced by the (possibly empty) sequence of elements
* generated by enumerating the jar files in the named directory. If
* the directory foo contains a.jar, b.jar, and c.jar,
* e.g., then the class path foo/"*" is expanded into
* foo/a.jar:foo/b.jar:foo/c.jar, and that string would be the value
* of the system property java.class.path.
*
* The order in which the jar files in a directory are enumerated in
* the expanded class path is not specified and may vary from platform
* to platform and even from moment to moment on the same machine. A
* well-constructed application should not depend upon any particular
* order. If a specific order is required then the jar files can be
* enumerated explicitly in the class path.
*
* The CLASSPATH environment variable is not treated any differently
* from the -classpath (equiv. -cp) command-line option,
* i.e. wildcards are honored in all these cases.
*
* Class-path wildcards are not honored in the Class-Path jar-manifest
* header.
*
* Class-path wildcards are honored not only by the Java launcher but
* also by most other command-line tools that accept class paths, and
* in particular by javac and javadoc.
*
* Class-path wildcards are not honored in any other kind of path, and
* especially not in the bootstrap class path, which is a mere
* artifact of our implementation and not something that developers
* should use.
*
* Classpath wildcards are only expanded in the Java launcher code,
* supporting the use of wildcards on the command line and in the
* CLASSPATH environment variable. We do not support the use of
* wildcards by applications that embed the JVM.
*/
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "java.h" /* Strictly for PATH_SEPARATOR/FILE_SEPARATOR */
#include "jli_util.h"
#ifdef _WIN32
#include <windows.h>
#else /* Unix */
#include <unistd.h>
#include <dirent.h>
#endif /* Unix */
static int
exists(const char* filename)
{
#ifdef _WIN32
return _access(filename, 0) == 0;
#else
return access(filename, F_OK) == 0;
#endif
}
#define NEW_(TYPE) ((TYPE) JLI_MemAlloc(sizeof(struct TYPE##_)))
/*
* Wildcard directory iteration.
* WildcardIterator_for(wildcard) returns an iterator.
* Each call to that iterator's next() method returns the basename
* of an entry in the wildcard's directory. The basename's memory
* belongs to the iterator. The caller is responsible for prepending
* the directory name and file separator, if necessary.
* When done with the iterator, call the close method to clean up.
*/
typedef struct WildcardIterator_* WildcardIterator;
#ifdef _WIN32
struct WildcardIterator_
{
HANDLE handle;
char *firstFile; /* Stupid FindFirstFile...FindNextFile */
};
static WildcardIterator
WildcardIterator_for(const char *wildcard)
{
WIN32_FIND_DATA find_data;
WildcardIterator it = NEW_(WildcardIterator);
HANDLE handle = FindFirstFile(wildcard, &find_data);
if (handle == INVALID_HANDLE_VALUE)
return NULL;
it->handle = handle;
it->firstFile = find_data.cFileName;
return it;
}
static char *
WildcardIterator_next(WildcardIterator it)
{
WIN32_FIND_DATA find_data;
if (it->firstFile != NULL) {
char *firstFile = it->firstFile;
it->firstFile = NULL;
return firstFile;
}
return FindNextFile(it->handle, &find_data)
? find_data.cFileName : NULL;
}
static void
WildcardIterator_close(WildcardIterator it)
{
if (it) {
FindClose(it->handle);
JLI_MemFree(it->firstFile);
JLI_MemFree(it);
}
}
#else /* Unix */
struct WildcardIterator_
{
DIR *dir;
};
static WildcardIterator
WildcardIterator_for(const char *wildcard)
{
DIR *dir;
int wildlen = strlen(wildcard);
if (wildlen < 2) {
dir = opendir(".");
} else {
char *dirname = JLI_StringDup(wildcard);
dirname[wildlen - 1] = '\0';
dir = opendir(dirname);
JLI_MemFree(dirname);
}
if (dir == NULL)
return NULL;
else {
WildcardIterator it = NEW_(WildcardIterator);
it->dir = dir;
return it;
}
}
static char *
WildcardIterator_next(WildcardIterator it)
{
struct dirent* dirp = readdir(it->dir);
return dirp ? dirp->d_name : NULL;
}
static void
WildcardIterator_close(WildcardIterator it)
{
if (it) {
closedir(it->dir);
JLI_MemFree(it);
}
}
#endif /* Unix */
static int
equal(const char *s1, const char *s2)
{
return strcmp(s1, s2) == 0;
}
/*
* FileList ADT - a dynamic list of C filenames
*/
struct FileList_
{
char **files;
int size;
int capacity;
};
typedef struct FileList_ *FileList;
static FileList
FileList_new(int capacity)
{
FileList fl = NEW_(FileList);
fl->capacity = capacity;
fl->files = (char **) JLI_MemAlloc(capacity * sizeof(fl->files[0]));
fl->size = 0;
return fl;
}
#ifdef DEBUG_WILDCARD
static void
FileList_print(FileList fl)
{
int i;
putchar('[');
for (i = 0; i < fl->size; i++) {
if (i > 0) printf(", ");
printf("\"%s\"",fl->files[i]);
}
putchar(']');
}
#endif
static void
FileList_free(FileList fl)
{
if (fl) {
if (fl->files) {
int i;
for (i = 0; i < fl->size; i++)
JLI_MemFree(fl->files[i]);
JLI_MemFree(fl->files);
}
JLI_MemFree(fl);
}
}
static void
FileList_ensureCapacity(FileList fl, int capacity)
{
if (fl->capacity < capacity) {
while (fl->capacity < capacity)
fl->capacity *= 2;
fl->files = JLI_MemRealloc(fl->files,
fl->capacity * sizeof(fl->files[0]));
}
}
static void
FileList_add(FileList fl, char *file)
{
FileList_ensureCapacity(fl, fl->size+1);
fl->files[fl->size++] = file;
}
static void
FileList_addSubstring(FileList fl, const char *beg, int len)
{
char *filename = (char *) JLI_MemAlloc(len+1);
memcpy(filename, beg, len);
filename[len] = '\0';
FileList_ensureCapacity(fl, fl->size+1);
fl->files[fl->size++] = filename;
}
static char *
FileList_join(FileList fl, char sep)
{
int i;
int size;
char *path;
char *p;
for (i = 0, size = 1; i < fl->size; i++)
size += strlen(fl->files[i]) + 1;
path = JLI_MemAlloc(size);
for (i = 0, p = path; i < fl->size; i++) {
int len = strlen(fl->files[i]);
if (i > 0) *p++ = sep;
memcpy(p, fl->files[i], len);
p += len;
}
*p = '\0';
return path;
}
static FileList
FileList_split(const char *path, char sep)
{
const char *p, *q;
int len = strlen(path);
int count;
FileList fl;
for (count = 1, p = path; p < path + len; p++)
count += (*p == sep);
fl = FileList_new(count);
for (p = path;;) {
for (q = p; q <= path + len; q++) {
if (*q == sep || *q == '\0') {
FileList_addSubstring(fl, p, q - p);
if (*q == '\0')
return fl;
p = q + 1;
}
}
}
}
static int
isJarFileName(const char *filename)
{
int len = strlen(filename);
return (len >= 4) &&
(filename[len - 4] == '.') &&
(equal(filename + len - 3, "jar") ||
equal(filename + len - 3, "JAR")) &&
/* Paranoia: Maybe filename is "DIR:foo.jar" */
(strchr(filename, PATH_SEPARATOR) == NULL);
}
static char *
wildcardConcat(const char *wildcard, const char *basename)
{
int wildlen = strlen(wildcard);
int baselen = strlen(basename);
char *filename = (char *) JLI_MemAlloc(wildlen + baselen);
/* Replace the trailing '*' with basename */
memcpy(filename, wildcard, wildlen-1);
memcpy(filename+wildlen-1, basename, baselen+1);
return filename;
}
static FileList
wildcardFileList(const char *wildcard)
{
const char *basename;
FileList fl = FileList_new(16);
WildcardIterator it = WildcardIterator_for(wildcard);
if (it == NULL) {
FileList_free(fl);
return NULL;
}
while ((basename = WildcardIterator_next(it)) != NULL)
if (isJarFileName(basename))
FileList_add(fl, wildcardConcat(wildcard, basename));
WildcardIterator_close(it);
return fl;
}
static int
isWildcard(const char *filename)
{
int len = strlen(filename);
return (len > 0) &&
(filename[len - 1] == '*') &&
(len == 1 || IS_FILE_SEPARATOR(filename[len - 2])) &&
(! exists(filename));
}
static void
FileList_expandWildcards(FileList fl)
{
int i, j;
for (i = 0; i < fl->size; i++) {
if (isWildcard(fl->files[i])) {
FileList expanded = wildcardFileList(fl->files[i]);
if (expanded != NULL && expanded->size > 0) {
JLI_MemFree(fl->files[i]);
FileList_ensureCapacity(fl, fl->size + expanded->size);
for (j = fl->size - 1; j >= i+1; j--)
fl->files[j+expanded->size-1] = fl->files[j];
for (j = 0; j < expanded->size; j++)
fl->files[i+j] = expanded->files[j];
i += expanded->size - 1;
fl->size += expanded->size - 1;
/* fl expropriates expanded's elements. */
expanded->size = 0;
}
FileList_free(expanded);
}
}
}
const char *
JLI_WildcardExpandClasspath(const char *classpath)
{
char *expanded;
FileList fl;
if (strchr(classpath, '*') == NULL)
return classpath;
fl = FileList_split(classpath, PATH_SEPARATOR);
FileList_expandWildcards(fl);
expanded = FileList_join(fl, PATH_SEPARATOR);
FileList_free(fl);
if (getenv("_JAVA_LAUNCHER_DEBUG") != 0)
printf("Expanded wildcards:\n"
" before: \"%s\"\n"
" after : \"%s\"\n",
classpath, expanded);
return expanded;
}
#ifdef DEBUG_WILDCARD
static void
wildcardExpandArgv(const char ***argv)
{
int i;
for (i = 0; (*argv)[i]; i++) {
if (equal((*argv)[i], "-cp") ||
equal((*argv)[i], "-classpath")) {
i++;
(*argv)[i] = wildcardExpandClasspath((*argv)[i]);
}
}
}
static void
debugPrintArgv(char *argv[])
{
int i;
putchar('[');
for (i = 0; argv[i]; i++) {
if (i > 0) printf(", ");
printf("\"%s\"", argv[i]);
}
printf("]\n");
}
int
main(int argc, char *argv[])
{
argv[0] = "java";
wildcardExpandArgv((const char***)&argv);
debugPrintArgv(argv);
/* execvp("java", argv); */
return 0;
}
#endif /* DEBUG_WILDCARD */
/* Cute little perl prototype implementation....
my $sep = ($^O =~ /^(Windows|cygwin)/) ? ";" : ":";
sub expand($) {
opendir DIR, $_[0] or return $_[0];
join $sep, map {"$_[0]/$_"} grep {/\.(jar|JAR)$/} readdir DIR;
}
sub munge($) {
join $sep,
map {(! -r $_ and s/[\/\\]+\*$//) ? expand $_ : $_} split $sep, $_[0];
}
for (my $i = 0; $i < @ARGV - 1; $i++) {
$ARGV[$i+1] = munge $ARGV[$i+1] if $ARGV[$i] =~ /^-c(p|lasspath)$/;
}
$ENV{CLASSPATH} = munge $ENV{CLASSPATH} if exists $ENV{CLASSPATH};
@ARGV = ("java", @ARGV);
print "@ARGV\n";
exec @ARGV;
*/

View File

@ -211,12 +211,41 @@ bool ciInstanceKlass::is_java_lang_Object() const {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// ciInstanceKlass::uses_default_loader // ciInstanceKlass::uses_default_loader
bool ciInstanceKlass::uses_default_loader() { bool ciInstanceKlass::uses_default_loader() const {
// Note: We do not need to resolve the handle or enter the VM // Note: We do not need to resolve the handle or enter the VM
// in order to test null-ness. // in order to test null-ness.
return _loader == NULL; return _loader == NULL;
} }
// ------------------------------------------------------------------
/**
* Return basic type of boxed value for box klass or T_OBJECT if not.
*/
BasicType ciInstanceKlass::box_klass_type() const {
if (uses_default_loader() && is_loaded()) {
return SystemDictionary::box_klass_type(get_Klass());
} else {
return T_OBJECT;
}
}
/**
* Is this boxing klass?
*/
bool ciInstanceKlass::is_box_klass() const {
return is_java_primitive(box_klass_type());
}
/**
* Is this boxed value offset?
*/
bool ciInstanceKlass::is_boxed_value_offset(int offset) const {
BasicType bt = box_klass_type();
return is_java_primitive(bt) &&
(offset == java_lang_boxing_object::value_offset_in_bytes(bt));
}
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// ciInstanceKlass::is_in_package // ciInstanceKlass::is_in_package
// //

View File

@ -217,10 +217,14 @@ public:
ciInstanceKlass* implementor(); ciInstanceKlass* implementor();
// Is the defining class loader of this class the default loader? // Is the defining class loader of this class the default loader?
bool uses_default_loader(); bool uses_default_loader() const;
bool is_java_lang_Object() const; bool is_java_lang_Object() const;
BasicType box_klass_type() const;
bool is_box_klass() const;
bool is_boxed_value_offset(int offset) const;
// Is this klass in the given package? // Is this klass in the given package?
bool is_in_package(const char* packagename) { bool is_in_package(const char* packagename) {
return is_in_package(packagename, (int) strlen(packagename)); return is_in_package(packagename, (int) strlen(packagename));

View File

@ -1179,6 +1179,44 @@ bool ciMethod::has_jsrs () const { FETCH_FLAG_FROM_VM(has_jsrs);
bool ciMethod::is_accessor () const { FETCH_FLAG_FROM_VM(is_accessor); } bool ciMethod::is_accessor () const { FETCH_FLAG_FROM_VM(is_accessor); }
bool ciMethod::is_initializer () const { FETCH_FLAG_FROM_VM(is_initializer); } bool ciMethod::is_initializer () const { FETCH_FLAG_FROM_VM(is_initializer); }
bool ciMethod::is_boxing_method() const {
if (holder()->is_box_klass()) {
switch (intrinsic_id()) {
case vmIntrinsics::_Boolean_valueOf:
case vmIntrinsics::_Byte_valueOf:
case vmIntrinsics::_Character_valueOf:
case vmIntrinsics::_Short_valueOf:
case vmIntrinsics::_Integer_valueOf:
case vmIntrinsics::_Long_valueOf:
case vmIntrinsics::_Float_valueOf:
case vmIntrinsics::_Double_valueOf:
return true;
default:
return false;
}
}
return false;
}
bool ciMethod::is_unboxing_method() const {
if (holder()->is_box_klass()) {
switch (intrinsic_id()) {
case vmIntrinsics::_booleanValue:
case vmIntrinsics::_byteValue:
case vmIntrinsics::_charValue:
case vmIntrinsics::_shortValue:
case vmIntrinsics::_intValue:
case vmIntrinsics::_longValue:
case vmIntrinsics::_floatValue:
case vmIntrinsics::_doubleValue:
return true;
default:
return false;
}
}
return false;
}
BCEscapeAnalyzer *ciMethod::get_bcea() { BCEscapeAnalyzer *ciMethod::get_bcea() {
#ifdef COMPILER2 #ifdef COMPILER2
if (_bcea == NULL) { if (_bcea == NULL) {

View File

@ -298,6 +298,8 @@ class ciMethod : public ciMetadata {
bool is_initializer () const; bool is_initializer () const;
bool can_be_statically_bound() const { return _can_be_statically_bound; } bool can_be_statically_bound() const { return _can_be_statically_bound; }
void dump_replay_data(outputStream* st); void dump_replay_data(outputStream* st);
bool is_boxing_method() const;
bool is_unboxing_method() const;
// Print the bytecodes of this method. // Print the bytecodes of this method.
void print_codes_on(outputStream* st); void print_codes_on(outputStream* st);

View File

@ -3041,7 +3041,7 @@ AnnotationArray* ClassFileParser::assemble_annotations(u1* runtime_visible_annot
} }
#ifndef PRODUCT #ifdef ASSERT
static void parseAndPrintGenericSignatures( static void parseAndPrintGenericSignatures(
instanceKlassHandle this_klass, TRAPS) { instanceKlassHandle this_klass, TRAPS) {
assert(ParseAllGenericSignatures == true, "Shouldn't call otherwise"); assert(ParseAllGenericSignatures == true, "Shouldn't call otherwise");
@ -3066,7 +3066,7 @@ static void parseAndPrintGenericSignatures(
} }
} }
} }
#endif // ndef PRODUCT #endif // def ASSERT
instanceKlassHandle ClassFileParser::parse_super_class(int super_class_index, instanceKlassHandle ClassFileParser::parse_super_class(int super_class_index,

View File

@ -49,7 +49,7 @@ extern "C" {
} }
} }
#ifndef PRODUCT #ifdef ASSERT
#define VM_SYMBOL_ENUM_NAME_BODY(name, string) #name "\0" #define VM_SYMBOL_ENUM_NAME_BODY(name, string) #name "\0"
static const char* vm_symbol_enum_names = static const char* vm_symbol_enum_names =
VM_SYMBOLS_DO(VM_SYMBOL_ENUM_NAME_BODY, VM_ALIAS_IGNORE) VM_SYMBOLS_DO(VM_SYMBOL_ENUM_NAME_BODY, VM_ALIAS_IGNORE)
@ -64,7 +64,7 @@ static const char* vm_symbol_enum_name(vmSymbols::SID sid) {
} }
return string; return string;
} }
#endif //PRODUCT #endif //ASSERT
// Put all the VM symbol strings in one place. // Put all the VM symbol strings in one place.
// Makes for a more compact libjvm. // Makes for a more compact libjvm.

View File

@ -68,7 +68,7 @@
template(java_lang_Float, "java/lang/Float") \ template(java_lang_Float, "java/lang/Float") \
template(java_lang_Double, "java/lang/Double") \ template(java_lang_Double, "java/lang/Double") \
template(java_lang_Byte, "java/lang/Byte") \ template(java_lang_Byte, "java/lang/Byte") \
template(java_lang_Byte_Cache, "java/lang/Byte$ByteCache") \ template(java_lang_Byte_ByteCache, "java/lang/Byte$ByteCache") \
template(java_lang_Short, "java/lang/Short") \ template(java_lang_Short, "java/lang/Short") \
template(java_lang_Short_ShortCache, "java/lang/Short$ShortCache") \ template(java_lang_Short_ShortCache, "java/lang/Short$ShortCache") \
template(java_lang_Integer, "java/lang/Integer") \ template(java_lang_Integer, "java/lang/Integer") \

View File

@ -1854,8 +1854,10 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
tty->print("%7d ", (int) tty->time_stamp().milliseconds()); // print timestamp tty->print("%7d ", (int) tty->time_stamp().milliseconds()); // print timestamp
tty->print("%4d ", compile_id); // print compilation number tty->print("%4d ", compile_id); // print compilation number
tty->print("%s ", (is_osr ? "%" : " ")); tty->print("%s ", (is_osr ? "%" : " "));
int code_size = (task->code() == NULL) ? 0 : task->code()->total_size(); if (task->code() != NULL) {
tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes()); tty->print("size: %d(%d) ", task->code()->total_size(), task->code()->insts_size());
}
tty->print_cr("time: %d inlined: %d bytes", (int)time.milliseconds(), task->num_inlined_bytecodes());
} }
if (PrintCodeCacheOnCompilation) if (PrintCodeCacheOnCompilation)

View File

@ -692,8 +692,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
_cmsGen ->init_initiating_occupancy(CMSInitiatingOccupancyFraction, CMSTriggerRatio); _cmsGen ->init_initiating_occupancy(CMSInitiatingOccupancyFraction, CMSTriggerRatio);
// Clip CMSBootstrapOccupancy between 0 and 100. // Clip CMSBootstrapOccupancy between 0 and 100.
_bootstrap_occupancy = ((double)MIN2((uintx)100, MAX2((uintx)0, CMSBootstrapOccupancy))) _bootstrap_occupancy = ((double)CMSBootstrapOccupancy)/(double)100;
/(double)100;
_full_gcs_since_conc_gc = 0; _full_gcs_since_conc_gc = 0;

View File

@ -4515,7 +4515,8 @@ G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name)
_total_used_bytes(0), _total_capacity_bytes(0), _total_used_bytes(0), _total_capacity_bytes(0),
_total_prev_live_bytes(0), _total_next_live_bytes(0), _total_prev_live_bytes(0), _total_next_live_bytes(0),
_hum_used_bytes(0), _hum_capacity_bytes(0), _hum_used_bytes(0), _hum_capacity_bytes(0),
_hum_prev_live_bytes(0), _hum_next_live_bytes(0) { _hum_prev_live_bytes(0), _hum_next_live_bytes(0),
_total_remset_bytes(0) {
G1CollectedHeap* g1h = G1CollectedHeap::heap(); G1CollectedHeap* g1h = G1CollectedHeap::heap();
MemRegion g1_committed = g1h->g1_committed(); MemRegion g1_committed = g1h->g1_committed();
MemRegion g1_reserved = g1h->g1_reserved(); MemRegion g1_reserved = g1h->g1_reserved();
@ -4533,23 +4534,25 @@ G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name)
HeapRegion::GrainBytes); HeapRegion::GrainBytes);
_out->print_cr(G1PPRL_LINE_PREFIX); _out->print_cr(G1PPRL_LINE_PREFIX);
_out->print_cr(G1PPRL_LINE_PREFIX _out->print_cr(G1PPRL_LINE_PREFIX
G1PPRL_TYPE_H_FORMAT G1PPRL_TYPE_H_FORMAT
G1PPRL_ADDR_BASE_H_FORMAT G1PPRL_ADDR_BASE_H_FORMAT
G1PPRL_BYTE_H_FORMAT G1PPRL_BYTE_H_FORMAT
G1PPRL_BYTE_H_FORMAT G1PPRL_BYTE_H_FORMAT
G1PPRL_BYTE_H_FORMAT G1PPRL_BYTE_H_FORMAT
G1PPRL_DOUBLE_H_FORMAT, G1PPRL_DOUBLE_H_FORMAT
"type", "address-range", G1PPRL_BYTE_H_FORMAT,
"used", "prev-live", "next-live", "gc-eff"); "type", "address-range",
"used", "prev-live", "next-live", "gc-eff", "remset");
_out->print_cr(G1PPRL_LINE_PREFIX _out->print_cr(G1PPRL_LINE_PREFIX
G1PPRL_TYPE_H_FORMAT G1PPRL_TYPE_H_FORMAT
G1PPRL_ADDR_BASE_H_FORMAT G1PPRL_ADDR_BASE_H_FORMAT
G1PPRL_BYTE_H_FORMAT G1PPRL_BYTE_H_FORMAT
G1PPRL_BYTE_H_FORMAT G1PPRL_BYTE_H_FORMAT
G1PPRL_BYTE_H_FORMAT G1PPRL_BYTE_H_FORMAT
G1PPRL_DOUBLE_H_FORMAT, G1PPRL_DOUBLE_H_FORMAT
"", "", G1PPRL_BYTE_H_FORMAT,
"(bytes)", "(bytes)", "(bytes)", "(bytes/ms)"); "", "",
"(bytes)", "(bytes)", "(bytes)", "(bytes/ms)", "(bytes)");
} }
// It takes as a parameter a reference to one of the _hum_* fields, it // It takes as a parameter a reference to one of the _hum_* fields, it
@ -4591,6 +4594,7 @@ bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
size_t prev_live_bytes = r->live_bytes(); size_t prev_live_bytes = r->live_bytes();
size_t next_live_bytes = r->next_live_bytes(); size_t next_live_bytes = r->next_live_bytes();
double gc_eff = r->gc_efficiency(); double gc_eff = r->gc_efficiency();
size_t remset_bytes = r->rem_set()->mem_size();
if (r->used() == 0) { if (r->used() == 0) {
type = "FREE"; type = "FREE";
} else if (r->is_survivor()) { } else if (r->is_survivor()) {
@ -4624,6 +4628,7 @@ bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
_total_capacity_bytes += capacity_bytes; _total_capacity_bytes += capacity_bytes;
_total_prev_live_bytes += prev_live_bytes; _total_prev_live_bytes += prev_live_bytes;
_total_next_live_bytes += next_live_bytes; _total_next_live_bytes += next_live_bytes;
_total_remset_bytes += remset_bytes;
// Print a line for this particular region. // Print a line for this particular region.
_out->print_cr(G1PPRL_LINE_PREFIX _out->print_cr(G1PPRL_LINE_PREFIX
@ -4632,14 +4637,17 @@ bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
G1PPRL_BYTE_FORMAT G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT G1PPRL_BYTE_FORMAT
G1PPRL_DOUBLE_FORMAT, G1PPRL_DOUBLE_FORMAT
G1PPRL_BYTE_FORMAT,
type, bottom, end, type, bottom, end,
used_bytes, prev_live_bytes, next_live_bytes, gc_eff); used_bytes, prev_live_bytes, next_live_bytes, gc_eff , remset_bytes);
return false; return false;
} }
G1PrintRegionLivenessInfoClosure::~G1PrintRegionLivenessInfoClosure() { G1PrintRegionLivenessInfoClosure::~G1PrintRegionLivenessInfoClosure() {
// add static memory usages to remembered set sizes
_total_remset_bytes += HeapRegionRemSet::fl_mem_size() + HeapRegionRemSet::static_mem_size();
// Print the footer of the output. // Print the footer of the output.
_out->print_cr(G1PPRL_LINE_PREFIX); _out->print_cr(G1PPRL_LINE_PREFIX);
_out->print_cr(G1PPRL_LINE_PREFIX _out->print_cr(G1PPRL_LINE_PREFIX
@ -4647,13 +4655,15 @@ G1PrintRegionLivenessInfoClosure::~G1PrintRegionLivenessInfoClosure() {
G1PPRL_SUM_MB_FORMAT("capacity") G1PPRL_SUM_MB_FORMAT("capacity")
G1PPRL_SUM_MB_PERC_FORMAT("used") G1PPRL_SUM_MB_PERC_FORMAT("used")
G1PPRL_SUM_MB_PERC_FORMAT("prev-live") G1PPRL_SUM_MB_PERC_FORMAT("prev-live")
G1PPRL_SUM_MB_PERC_FORMAT("next-live"), G1PPRL_SUM_MB_PERC_FORMAT("next-live")
G1PPRL_SUM_MB_FORMAT("remset"),
bytes_to_mb(_total_capacity_bytes), bytes_to_mb(_total_capacity_bytes),
bytes_to_mb(_total_used_bytes), bytes_to_mb(_total_used_bytes),
perc(_total_used_bytes, _total_capacity_bytes), perc(_total_used_bytes, _total_capacity_bytes),
bytes_to_mb(_total_prev_live_bytes), bytes_to_mb(_total_prev_live_bytes),
perc(_total_prev_live_bytes, _total_capacity_bytes), perc(_total_prev_live_bytes, _total_capacity_bytes),
bytes_to_mb(_total_next_live_bytes), bytes_to_mb(_total_next_live_bytes),
perc(_total_next_live_bytes, _total_capacity_bytes)); perc(_total_next_live_bytes, _total_capacity_bytes),
bytes_to_mb(_total_remset_bytes));
_out->cr(); _out->cr();
} }

View File

@ -1257,6 +1257,9 @@ private:
size_t _hum_prev_live_bytes; size_t _hum_prev_live_bytes;
size_t _hum_next_live_bytes; size_t _hum_next_live_bytes;
// Accumulator for the remembered set size
size_t _total_remset_bytes;
static double perc(size_t val, size_t total) { static double perc(size_t val, size_t total) {
if (total == 0) { if (total == 0) {
return 0.0; return 0.0;

View File

@ -101,20 +101,23 @@ void G1CardCounts::resize(size_t heap_capacity) {
ReservedSpace::allocation_align_size_up(_committed_size), ReservedSpace::allocation_align_size_up(_committed_size),
err_msg("Unaligned? committed_size: " SIZE_FORMAT, _committed_size)); err_msg("Unaligned? committed_size: " SIZE_FORMAT, _committed_size));
// Verify that the committed space for the card counts // Verify that the committed space for the card counts matches our
// matches our committed max card num. // committed max card num. Note for some allocation alignments, the
// amount of space actually committed for the counts table will be able
// to span more cards than the number spanned by the maximum heap.
size_t prev_committed_size = _committed_size; size_t prev_committed_size = _committed_size;
size_t prev_committed_card_num = prev_committed_size / sizeof(jbyte); size_t prev_committed_card_num = committed_to_card_num(prev_committed_size);
assert(prev_committed_card_num == _committed_max_card_num, assert(prev_committed_card_num == _committed_max_card_num,
err_msg("Card mismatch: " err_msg("Card mismatch: "
"prev: " SIZE_FORMAT ", " "prev: " SIZE_FORMAT ", "
"committed: "SIZE_FORMAT, "committed: "SIZE_FORMAT", "
prev_committed_card_num, _committed_max_card_num)); "reserved: "SIZE_FORMAT,
prev_committed_card_num, _committed_max_card_num, _reserved_max_card_num));
size_t new_size = (heap_capacity >> CardTableModRefBS::card_shift) * sizeof(jbyte); size_t new_size = (heap_capacity >> CardTableModRefBS::card_shift) * sizeof(jbyte);
size_t new_committed_size = ReservedSpace::allocation_align_size_up(new_size); size_t new_committed_size = ReservedSpace::allocation_align_size_up(new_size);
size_t new_committed_card_num = size_t new_committed_card_num = committed_to_card_num(new_committed_size);
MIN2(_reserved_max_card_num, new_committed_size / sizeof(jbyte));
if (_committed_max_card_num < new_committed_card_num) { if (_committed_max_card_num < new_committed_card_num) {
// we need to expand the backing store for the card counts // we need to expand the backing store for the card counts

View File

@ -94,6 +94,14 @@ class G1CardCounts: public CHeapObj<mtGC> {
return (jbyte*) (_ct_bot + card_num); return (jbyte*) (_ct_bot + card_num);
} }
// Helper routine.
// Returns the number of cards that can be counted by the given committed
// table size, with a maximum of the number of cards spanned by the max
// capacity of the heap.
size_t committed_to_card_num(size_t committed_size) {
return MIN2(_reserved_max_card_num, committed_size / sizeof(jbyte));
}
// Clear the counts table for the given (exclusive) index range. // Clear the counts table for the given (exclusive) index range.
void clear_range(size_t from_card_num, size_t to_card_num); void clear_range(size_t from_card_num, size_t to_card_num);

View File

@ -1549,7 +1549,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
} }
if (G1Log::finer()) { if (G1Log::finer()) {
g1_policy()->print_detailed_heap_transition(); g1_policy()->print_detailed_heap_transition(true /* full */);
} }
print_heap_after_gc(); print_heap_after_gc();

View File

@ -124,9 +124,12 @@ G1CollectorPolicy::G1CollectorPolicy() :
_last_young_gc(false), _last_young_gc(false),
_last_gc_was_young(false), _last_gc_was_young(false),
_eden_bytes_before_gc(0), _eden_used_bytes_before_gc(0),
_survivor_bytes_before_gc(0), _survivor_used_bytes_before_gc(0),
_capacity_before_gc(0), _heap_used_bytes_before_gc(0),
_metaspace_used_bytes_before_gc(0),
_eden_capacity_bytes_before_gc(0),
_heap_capacity_bytes_before_gc(0),
_eden_cset_region_length(0), _eden_cset_region_length(0),
_survivor_cset_region_length(0), _survivor_cset_region_length(0),
@ -746,7 +749,7 @@ G1CollectorPolicy::verify_young_ages(HeapRegion* head,
void G1CollectorPolicy::record_full_collection_start() { void G1CollectorPolicy::record_full_collection_start() {
_full_collection_start_sec = os::elapsedTime(); _full_collection_start_sec = os::elapsedTime();
record_heap_size_info_at_start(); record_heap_size_info_at_start(true /* full */);
// Release the future to-space so that it is available for compaction into. // Release the future to-space so that it is available for compaction into.
_g1->set_full_collection(); _g1->set_full_collection();
} }
@ -803,7 +806,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
_trace_gen0_time_data.record_start_collection(s_w_t_ms); _trace_gen0_time_data.record_start_collection(s_w_t_ms);
_stop_world_start = 0.0; _stop_world_start = 0.0;
record_heap_size_info_at_start(); record_heap_size_info_at_start(false /* full */);
phase_times()->record_cur_collection_start_sec(start_time_sec); phase_times()->record_cur_collection_start_sec(start_time_sec);
_pending_cards = _g1->pending_card_num(); _pending_cards = _g1->pending_card_num();
@ -938,14 +941,6 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms) {
_mmu_tracker->add_pause(end_time_sec - pause_time_ms/1000.0, _mmu_tracker->add_pause(end_time_sec - pause_time_ms/1000.0,
end_time_sec, false); end_time_sec, false);
size_t freed_bytes =
_cur_collection_pause_used_at_start_bytes - cur_used_bytes;
size_t surviving_bytes = _collection_set_bytes_used_before - freed_bytes;
double survival_fraction =
(double)surviving_bytes/
(double)_collection_set_bytes_used_before;
if (update_stats) { if (update_stats) {
_trace_gen0_time_data.record_end_collection(pause_time_ms, phase_times()); _trace_gen0_time_data.record_end_collection(pause_time_ms, phase_times());
// this is where we update the allocation rate of the application // this is where we update the allocation rate of the application
@ -998,6 +993,7 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms) {
} }
} }
} }
bool new_in_marking_window = _in_marking_window; bool new_in_marking_window = _in_marking_window;
bool new_in_marking_window_im = false; bool new_in_marking_window_im = false;
if (during_initial_mark_pause()) { if (during_initial_mark_pause()) {
@ -1083,8 +1079,10 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms) {
} }
_rs_length_diff_seq->add((double) rs_length_diff); _rs_length_diff_seq->add((double) rs_length_diff);
size_t copied_bytes = surviving_bytes; size_t freed_bytes = _heap_used_bytes_before_gc - cur_used_bytes;
size_t copied_bytes = _collection_set_bytes_used_before - freed_bytes;
double cost_per_byte_ms = 0.0; double cost_per_byte_ms = 0.0;
if (copied_bytes > 0) { if (copied_bytes > 0) {
cost_per_byte_ms = phase_times()->average_last_obj_copy_time() / (double) copied_bytes; cost_per_byte_ms = phase_times()->average_last_obj_copy_time() / (double) copied_bytes;
if (_in_marking_window) { if (_in_marking_window) {
@ -1148,51 +1146,61 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms) {
byte_size_in_proper_unit((double)(bytes)), \ byte_size_in_proper_unit((double)(bytes)), \
proper_unit_for_byte_size((bytes)) proper_unit_for_byte_size((bytes))
void G1CollectorPolicy::record_heap_size_info_at_start() { void G1CollectorPolicy::record_heap_size_info_at_start(bool full) {
YoungList* young_list = _g1->young_list(); YoungList* young_list = _g1->young_list();
_eden_bytes_before_gc = young_list->eden_used_bytes(); _eden_used_bytes_before_gc = young_list->eden_used_bytes();
_survivor_bytes_before_gc = young_list->survivor_used_bytes(); _survivor_used_bytes_before_gc = young_list->survivor_used_bytes();
_capacity_before_gc = _g1->capacity(); _heap_capacity_bytes_before_gc = _g1->capacity();
_heap_used_bytes_before_gc = _g1->used();
_cur_collection_pause_used_at_start_bytes = _g1->used();
_cur_collection_pause_used_regions_at_start = _g1->used_regions(); _cur_collection_pause_used_regions_at_start = _g1->used_regions();
size_t eden_capacity_before_gc = _eden_capacity_bytes_before_gc =
(_young_list_target_length * HeapRegion::GrainBytes) - _survivor_bytes_before_gc; (_young_list_target_length * HeapRegion::GrainBytes) - _survivor_used_bytes_before_gc;
_prev_eden_capacity = eden_capacity_before_gc; if (full) {
_metaspace_used_bytes_before_gc = MetaspaceAux::allocated_used_bytes();
}
} }
void G1CollectorPolicy::print_heap_transition() { void G1CollectorPolicy::print_heap_transition() {
_g1->print_size_transition(gclog_or_tty, _g1->print_size_transition(gclog_or_tty,
_cur_collection_pause_used_at_start_bytes, _g1->used(), _g1->capacity()); _heap_used_bytes_before_gc,
_g1->used(),
_g1->capacity());
} }
void G1CollectorPolicy::print_detailed_heap_transition() { void G1CollectorPolicy::print_detailed_heap_transition(bool full) {
YoungList* young_list = _g1->young_list(); YoungList* young_list = _g1->young_list();
size_t eden_bytes = young_list->eden_used_bytes();
size_t survivor_bytes = young_list->survivor_used_bytes();
size_t used_before_gc = _cur_collection_pause_used_at_start_bytes;
size_t used = _g1->used();
size_t capacity = _g1->capacity();
size_t eden_capacity =
(_young_list_target_length * HeapRegion::GrainBytes) - survivor_bytes;
gclog_or_tty->print_cr( size_t eden_used_bytes_after_gc = young_list->eden_used_bytes();
" [Eden: "EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")->"EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT") " size_t survivor_used_bytes_after_gc = young_list->survivor_used_bytes();
"Survivors: "EXT_SIZE_FORMAT"->"EXT_SIZE_FORMAT" " size_t heap_used_bytes_after_gc = _g1->used();
"Heap: "EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")->"
EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")]", size_t heap_capacity_bytes_after_gc = _g1->capacity();
EXT_SIZE_PARAMS(_eden_bytes_before_gc), size_t eden_capacity_bytes_after_gc =
EXT_SIZE_PARAMS(_prev_eden_capacity), (_young_list_target_length * HeapRegion::GrainBytes) - survivor_used_bytes_after_gc;
EXT_SIZE_PARAMS(eden_bytes),
EXT_SIZE_PARAMS(eden_capacity), gclog_or_tty->print(
EXT_SIZE_PARAMS(_survivor_bytes_before_gc), " [Eden: "EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")->"EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT") "
EXT_SIZE_PARAMS(survivor_bytes), "Survivors: "EXT_SIZE_FORMAT"->"EXT_SIZE_FORMAT" "
EXT_SIZE_PARAMS(used_before_gc), "Heap: "EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")->"
EXT_SIZE_PARAMS(_capacity_before_gc), EXT_SIZE_FORMAT"("EXT_SIZE_FORMAT")]",
EXT_SIZE_PARAMS(used), EXT_SIZE_PARAMS(_eden_used_bytes_before_gc),
EXT_SIZE_PARAMS(capacity)); EXT_SIZE_PARAMS(_eden_capacity_bytes_before_gc),
EXT_SIZE_PARAMS(eden_used_bytes_after_gc),
EXT_SIZE_PARAMS(eden_capacity_bytes_after_gc),
EXT_SIZE_PARAMS(_survivor_used_bytes_before_gc),
EXT_SIZE_PARAMS(survivor_used_bytes_after_gc),
EXT_SIZE_PARAMS(_heap_used_bytes_before_gc),
EXT_SIZE_PARAMS(_heap_capacity_bytes_before_gc),
EXT_SIZE_PARAMS(heap_used_bytes_after_gc),
EXT_SIZE_PARAMS(heap_capacity_bytes_after_gc));
if (full) {
MetaspaceAux::print_metaspace_change(_metaspace_used_bytes_before_gc);
}
gclog_or_tty->cr();
} }
void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time, void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time,

View File

@ -175,7 +175,6 @@ private:
CollectionSetChooser* _collectionSetChooser; CollectionSetChooser* _collectionSetChooser;
double _full_collection_start_sec; double _full_collection_start_sec;
size_t _cur_collection_pause_used_at_start_bytes;
uint _cur_collection_pause_used_regions_at_start; uint _cur_collection_pause_used_regions_at_start;
// These exclude marking times. // These exclude marking times.
@ -194,7 +193,6 @@ private:
uint _young_list_target_length; uint _young_list_target_length;
uint _young_list_fixed_length; uint _young_list_fixed_length;
size_t _prev_eden_capacity; // used for logging
// The max number of regions we can extend the eden by while the GC // The max number of regions we can extend the eden by while the GC
// locker is active. This should be >= _young_list_target_length; // locker is active. This should be >= _young_list_target_length;
@ -693,11 +691,11 @@ public:
// Records the information about the heap size for reporting in // Records the information about the heap size for reporting in
// print_detailed_heap_transition // print_detailed_heap_transition
void record_heap_size_info_at_start(); void record_heap_size_info_at_start(bool full);
// Print heap sizing transition (with less and more detail). // Print heap sizing transition (with less and more detail).
void print_heap_transition(); void print_heap_transition();
void print_detailed_heap_transition(); void print_detailed_heap_transition(bool full = false);
void record_stop_world_start(); void record_stop_world_start();
void record_concurrent_pause(); void record_concurrent_pause();
@ -861,9 +859,16 @@ private:
uint _max_survivor_regions; uint _max_survivor_regions;
// For reporting purposes. // For reporting purposes.
size_t _eden_bytes_before_gc; // The value of _heap_bytes_before_gc is also used to calculate
size_t _survivor_bytes_before_gc; // the cost of copying.
size_t _capacity_before_gc;
size_t _eden_used_bytes_before_gc; // Eden occupancy before GC
size_t _survivor_used_bytes_before_gc; // Survivor occupancy before GC
size_t _heap_used_bytes_before_gc; // Heap occupancy before GC
size_t _metaspace_used_bytes_before_gc; // Metaspace occupancy before GC
size_t _eden_capacity_bytes_before_gc; // Eden capacity before GC
size_t _heap_capacity_bytes_before_gc; // Heap capacity before GC
// The amount of survivor regions after a collection. // The amount of survivor regions after a collection.
uint _recorded_survivor_regions; uint _recorded_survivor_regions;

View File

@ -707,10 +707,11 @@ size_t OtherRegionsTable::mem_size() const {
// Cast away const in this case. // Cast away const in this case.
MutexLockerEx x((Mutex*)&_m, Mutex::_no_safepoint_check_flag); MutexLockerEx x((Mutex*)&_m, Mutex::_no_safepoint_check_flag);
size_t sum = 0; size_t sum = 0;
PerRegionTable * cur = _first_all_fine_prts; // all PRTs are of the same size so it is sufficient to query only one of them.
while (cur != NULL) { if (_first_all_fine_prts != NULL) {
sum += cur->mem_size(); assert(_last_all_fine_prts != NULL &&
cur = cur->next(); _first_all_fine_prts->mem_size() == _last_all_fine_prts->mem_size(), "check that mem_size() is constant");
sum += _first_all_fine_prts->mem_size() * _n_fine_entries;
} }
sum += (sizeof(PerRegionTable*) * _max_fine_entries); sum += (sizeof(PerRegionTable*) * _max_fine_entries);
sum += (_coarse_map.size_in_words() * HeapWordSize); sum += (_coarse_map.size_in_words() * HeapWordSize);

View File

@ -24,7 +24,6 @@
#include "precompiled.hpp" #include "precompiled.hpp"
#include "gc_implementation/parallelScavenge/parMarkBitMap.hpp" #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp"
#include "gc_implementation/parallelScavenge/parMarkBitMap.inline.hpp"
#include "gc_implementation/parallelScavenge/psParallelCompact.hpp" #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
@ -108,31 +107,6 @@ ParMarkBitMap::mark_obj(HeapWord* addr, size_t size)
return false; return false;
} }
size_t
ParMarkBitMap::live_words_in_range(HeapWord* beg_addr, HeapWord* end_addr) const
{
assert(beg_addr <= end_addr, "bad range");
idx_t live_bits = 0;
// The bitmap routines require the right boundary to be word-aligned.
const idx_t end_bit = addr_to_bit(end_addr);
const idx_t range_end = BitMap::word_align_up(end_bit);
idx_t beg_bit = find_obj_beg(addr_to_bit(beg_addr), range_end);
while (beg_bit < end_bit) {
idx_t tmp_end = find_obj_end(beg_bit, range_end);
if (tmp_end < end_bit) {
live_bits += tmp_end - beg_bit + 1;
beg_bit = find_obj_beg(tmp_end + 1, range_end);
} else {
live_bits += end_bit - beg_bit; // No + 1 here; end_bit is not counted.
return bits_to_words(live_bits);
}
}
return bits_to_words(live_bits);
}
size_t ParMarkBitMap::live_words_in_range(HeapWord* beg_addr, oop end_obj) const size_t ParMarkBitMap::live_words_in_range(HeapWord* beg_addr, oop end_obj) const
{ {
assert(beg_addr <= (HeapWord*)end_obj, "bad range"); assert(beg_addr <= (HeapWord*)end_obj, "bad range");
@ -244,13 +218,6 @@ ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure,
return complete; return complete;
} }
#ifndef PRODUCT
void ParMarkBitMap::reset_counters()
{
_cas_tries = _cas_retries = _cas_by_another = 0;
}
#endif // #ifndef PRODUCT
#ifdef ASSERT #ifdef ASSERT
void ParMarkBitMap::verify_clear() const void ParMarkBitMap::verify_clear() const
{ {

View File

@ -26,11 +26,11 @@
#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP
#include "memory/memRegion.hpp" #include "memory/memRegion.hpp"
#include "gc_implementation/parallelScavenge/psVirtualspace.hpp" #include "oops/oop.hpp"
#include "utilities/bitMap.inline.hpp" #include "utilities/bitMap.hpp"
class oopDesc;
class ParMarkBitMapClosure; class ParMarkBitMapClosure;
class PSVirtualSpace;
class ParMarkBitMap: public CHeapObj<mtGC> class ParMarkBitMap: public CHeapObj<mtGC>
{ {
@ -41,13 +41,11 @@ public:
enum IterationStatus { incomplete, complete, full, would_overflow }; enum IterationStatus { incomplete, complete, full, would_overflow };
inline ParMarkBitMap(); inline ParMarkBitMap();
inline ParMarkBitMap(MemRegion covered_region);
bool initialize(MemRegion covered_region); bool initialize(MemRegion covered_region);
// Atomically mark an object as live. // Atomically mark an object as live.
bool mark_obj(HeapWord* addr, size_t size); bool mark_obj(HeapWord* addr, size_t size);
inline bool mark_obj(oop obj, int size); inline bool mark_obj(oop obj, int size);
inline bool mark_obj(oop obj);
// Return whether the specified begin or end bit is set. // Return whether the specified begin or end bit is set.
inline bool is_obj_beg(idx_t bit) const; inline bool is_obj_beg(idx_t bit) const;
@ -77,11 +75,6 @@ public:
// Return the size in words of the object (a search is done for the end bit). // Return the size in words of the object (a search is done for the end bit).
inline size_t obj_size(idx_t beg_bit) const; inline size_t obj_size(idx_t beg_bit) const;
inline size_t obj_size(HeapWord* addr) const; inline size_t obj_size(HeapWord* addr) const;
inline size_t obj_size(oop obj) const;
// Synonyms for the above.
size_t obj_size_in_words(oop obj) const { return obj_size((HeapWord*)obj); }
size_t obj_size_in_words(HeapWord* addr) const { return obj_size(addr); }
// Apply live_closure to each live object that lies completely within the // Apply live_closure to each live object that lies completely within the
// range [live_range_beg, live_range_end). This is used to iterate over the // range [live_range_beg, live_range_end). This is used to iterate over the
@ -124,15 +117,12 @@ public:
HeapWord* range_end, HeapWord* range_end,
HeapWord* dead_range_end) const; HeapWord* dead_range_end) const;
// Return the number of live words in the range [beg_addr, end_addr) due to // Return the number of live words in the range [beg_addr, end_obj) due to
// objects that start in the range. If a live object extends onto the range, // objects that start in the range. If a live object extends onto the range,
// the caller must detect and account for any live words due to that object. // the caller must detect and account for any live words due to that object.
// If a live object extends beyond the end of the range, only the words within // If a live object extends beyond the end of the range, only the words within
// the range are included in the result. // the range are included in the result. The end of the range must be a live object,
size_t live_words_in_range(HeapWord* beg_addr, HeapWord* end_addr) const; // which is the case when updating pointers. This allows a branch to be removed
// Same as the above, except the end of the range must be a live object, which
// is the case when updating pointers. This allows a branch to be removed
// from inside the loop. // from inside the loop.
size_t live_words_in_range(HeapWord* beg_addr, oop end_obj) const; size_t live_words_in_range(HeapWord* beg_addr, oop end_obj) const;
@ -156,22 +146,11 @@ public:
// Clear a range of bits or the entire bitmap (both begin and end bits are // Clear a range of bits or the entire bitmap (both begin and end bits are
// cleared). // cleared).
inline void clear_range(idx_t beg, idx_t end); inline void clear_range(idx_t beg, idx_t end);
inline void clear() { clear_range(0, size()); }
// Return the number of bits required to represent the specified number of // Return the number of bits required to represent the specified number of
// HeapWords, or the specified region. // HeapWords, or the specified region.
static inline idx_t bits_required(size_t words); static inline idx_t bits_required(size_t words);
static inline idx_t bits_required(MemRegion covered_region); static inline idx_t bits_required(MemRegion covered_region);
static inline idx_t words_required(MemRegion covered_region);
#ifndef PRODUCT
// CAS statistics.
size_t cas_tries() { return _cas_tries; }
size_t cas_retries() { return _cas_retries; }
size_t cas_by_another() { return _cas_by_another; }
void reset_counters();
#endif // #ifndef PRODUCT
void print_on_error(outputStream* st) const { void print_on_error(outputStream* st) const {
st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, this); st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, this);
@ -197,28 +176,11 @@ private:
BitMap _beg_bits; BitMap _beg_bits;
BitMap _end_bits; BitMap _end_bits;
PSVirtualSpace* _virtual_space; PSVirtualSpace* _virtual_space;
#ifndef PRODUCT
size_t _cas_tries;
size_t _cas_retries;
size_t _cas_by_another;
#endif // #ifndef PRODUCT
}; };
inline ParMarkBitMap::ParMarkBitMap(): inline ParMarkBitMap::ParMarkBitMap():
_beg_bits(), _beg_bits(), _end_bits(), _region_start(NULL), _region_size(0), _virtual_space(NULL)
_end_bits() { }
{
_region_start = 0;
_virtual_space = 0;
}
inline ParMarkBitMap::ParMarkBitMap(MemRegion covered_region):
_beg_bits(),
_end_bits()
{
initialize(covered_region);
}
inline void ParMarkBitMap::clear_range(idx_t beg, idx_t end) inline void ParMarkBitMap::clear_range(idx_t beg, idx_t end)
{ {
@ -240,12 +202,6 @@ ParMarkBitMap::bits_required(MemRegion covered_region)
return bits_required(covered_region.word_size()); return bits_required(covered_region.word_size());
} }
inline ParMarkBitMap::idx_t
ParMarkBitMap::words_required(MemRegion covered_region)
{
return bits_required(covered_region) / BitsPerWord;
}
inline HeapWord* inline HeapWord*
ParMarkBitMap::region_start() const ParMarkBitMap::region_start() const
{ {
@ -350,11 +306,6 @@ inline size_t ParMarkBitMap::obj_size(HeapWord* addr) const
return obj_size(addr_to_bit(addr)); return obj_size(addr_to_bit(addr));
} }
inline size_t ParMarkBitMap::obj_size(oop obj) const
{
return obj_size((HeapWord*)obj);
}
inline ParMarkBitMap::IterationStatus inline ParMarkBitMap::IterationStatus
ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure, ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure,
HeapWord* range_beg, HeapWord* range_beg,
@ -435,8 +386,10 @@ inline void ParMarkBitMap::verify_bit(idx_t bit) const {
inline void ParMarkBitMap::verify_addr(HeapWord* addr) const { inline void ParMarkBitMap::verify_addr(HeapWord* addr) const {
// Allow one past the last valid address; useful for loop bounds. // Allow one past the last valid address; useful for loop bounds.
assert(addr >= region_start(), "addr too small"); assert(addr >= region_start(),
assert(addr <= region_start() + region_size(), "addr too big"); err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, addr, region_start()));
assert(addr <= region_end(),
err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, addr, region_end()));
} }
#endif // #ifdef ASSERT #endif // #ifdef ASSERT

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -201,15 +201,232 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
size_t cur_eden, size_t cur_eden,
size_t max_old_gen_size, size_t max_old_gen_size,
size_t max_eden_size, size_t max_eden_size,
bool is_full_gc, bool is_full_gc) {
GCCause::Cause gc_cause, compute_eden_space_size(young_live,
CollectorPolicy* collector_policy) { eden_live,
cur_eden,
max_eden_size,
is_full_gc);
compute_old_gen_free_space(old_live,
cur_eden,
max_old_gen_size,
is_full_gc);
}
void PSAdaptiveSizePolicy::compute_eden_space_size(
size_t young_live,
size_t eden_live,
size_t cur_eden,
size_t max_eden_size,
bool is_full_gc) {
// Update statistics // Update statistics
// Time statistics are updated as we go, update footprint stats here // Time statistics are updated as we go, update footprint stats here
_avg_base_footprint->sample(BaseFootPrintEstimate); _avg_base_footprint->sample(BaseFootPrintEstimate);
avg_young_live()->sample(young_live); avg_young_live()->sample(young_live);
avg_eden_live()->sample(eden_live); avg_eden_live()->sample(eden_live);
// This code used to return if the policy was not ready , i.e.,
// policy_is_ready() returning false. The intent was that
// decisions below needed major collection times and so could
// not be made before two major collections. A consequence was
// adjustments to the young generation were not done until after
// two major collections even if the minor collections times
// exceeded the requested goals. Now let the young generation
// adjust for the minor collection times. Major collection times
// will be zero for the first collection and will naturally be
// ignored. Tenured generation adjustments are only made at the
// full collections so until the second major collection has
// been reached, no tenured generation adjustments will be made.
// Until we know better, desired promotion size uses the last calculation
size_t desired_promo_size = _promo_size;
// Start eden at the current value. The desired value that is stored
// in _eden_size is not bounded by constraints of the heap and can
// run away.
//
// As expected setting desired_eden_size to the current
// value of desired_eden_size as a starting point
// caused desired_eden_size to grow way too large and caused
// an overflow down stream. It may have improved performance in
// some case but is dangerous.
size_t desired_eden_size = cur_eden;
// Cache some values. There's a bit of work getting these, so
// we might save a little time.
const double major_cost = major_gc_cost();
const double minor_cost = minor_gc_cost();
// This method sets the desired eden size. That plus the
// desired survivor space sizes sets the desired young generation
// size. This methods does not know what the desired survivor
// size is but expects that other policy will attempt to make
// the survivor sizes compatible with the live data in the
// young generation. This limit is an estimate of the space left
// in the young generation after the survivor spaces have been
// subtracted out.
size_t eden_limit = max_eden_size;
const double gc_cost_limit = GCTimeLimit/100.0;
// Which way should we go?
// if pause requirement is not met
// adjust size of any generation with average paus exceeding
// the pause limit. Adjust one pause at a time (the larger)
// and only make adjustments for the major pause at full collections.
// else if throughput requirement not met
// adjust the size of the generation with larger gc time. Only
// adjust one generation at a time.
// else
// adjust down the total heap size. Adjust down the larger of the
// generations.
// Add some checks for a threshold for a change. For example,
// a change less than the necessary alignment is probably not worth
// attempting.
if ((_avg_minor_pause->padded_average() > gc_pause_goal_sec()) ||
(_avg_major_pause->padded_average() > gc_pause_goal_sec())) {
//
// Check pauses
//
// Make changes only to affect one of the pauses (the larger)
// at a time.
adjust_eden_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
} else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) {
// Adjust only for the minor pause time goal
adjust_eden_for_minor_pause_time(is_full_gc, &desired_eden_size);
} else if(adjusted_mutator_cost() < _throughput_goal) {
// This branch used to require that (mutator_cost() > 0.0 in 1.4.2.
// This sometimes resulted in skipping to the minimize footprint
// code. Change this to try and reduce GC time if mutator time is
// negative for whatever reason. Or for future consideration,
// bail out of the code if mutator time is negative.
//
// Throughput
//
assert(major_cost >= 0.0, "major cost is < 0.0");
assert(minor_cost >= 0.0, "minor cost is < 0.0");
// Try to reduce the GC times.
adjust_eden_for_throughput(is_full_gc, &desired_eden_size);
} else {
// Be conservative about reducing the footprint.
// Do a minimum number of major collections first.
// Have reasonable averages for major and minor collections costs.
if (UseAdaptiveSizePolicyFootprintGoal &&
young_gen_policy_is_ready() &&
avg_major_gc_cost()->average() >= 0.0 &&
avg_minor_gc_cost()->average() >= 0.0) {
size_t desired_sum = desired_eden_size + desired_promo_size;
desired_eden_size = adjust_eden_for_footprint(desired_eden_size, desired_sum);
}
}
// Note we make the same tests as in the code block below; the code
// seems a little easier to read with the printing in another block.
if (PrintAdaptiveSizePolicy) {
if (desired_eden_size > eden_limit) {
gclog_or_tty->print_cr(
"PSAdaptiveSizePolicy::compute_eden_space_size limits:"
" desired_eden_size: " SIZE_FORMAT
" old_eden_size: " SIZE_FORMAT
" eden_limit: " SIZE_FORMAT
" cur_eden: " SIZE_FORMAT
" max_eden_size: " SIZE_FORMAT
" avg_young_live: " SIZE_FORMAT,
desired_eden_size, _eden_size, eden_limit, cur_eden,
max_eden_size, (size_t)avg_young_live()->average());
}
if (gc_cost() > gc_cost_limit) {
gclog_or_tty->print_cr(
"PSAdaptiveSizePolicy::compute_eden_space_size: gc time limit"
" gc_cost: %f "
" GCTimeLimit: %d",
gc_cost(), GCTimeLimit);
}
}
// Align everything and make a final limit check
const size_t alignment = _intra_generation_alignment;
desired_eden_size = align_size_up(desired_eden_size, alignment);
desired_eden_size = MAX2(desired_eden_size, alignment);
eden_limit = align_size_down(eden_limit, alignment);
// And one last limit check, now that we've aligned things.
if (desired_eden_size > eden_limit) {
// If the policy says to get a larger eden but
// is hitting the limit, don't decrease eden.
// This can lead to a general drifting down of the
// eden size. Let the tenuring calculation push more
// into the old gen.
desired_eden_size = MAX2(eden_limit, cur_eden);
}
if (PrintAdaptiveSizePolicy) {
// Timing stats
gclog_or_tty->print(
"PSAdaptiveSizePolicy::compute_eden_space_size: costs"
" minor_time: %f"
" major_cost: %f"
" mutator_cost: %f"
" throughput_goal: %f",
minor_gc_cost(), major_gc_cost(), mutator_cost(),
_throughput_goal);
// We give more details if Verbose is set
if (Verbose) {
gclog_or_tty->print( " minor_pause: %f"
" major_pause: %f"
" minor_interval: %f"
" major_interval: %f"
" pause_goal: %f",
_avg_minor_pause->padded_average(),
_avg_major_pause->padded_average(),
_avg_minor_interval->average(),
_avg_major_interval->average(),
gc_pause_goal_sec());
}
// Footprint stats
gclog_or_tty->print( " live_space: " SIZE_FORMAT
" free_space: " SIZE_FORMAT,
live_space(), free_space());
// More detail
if (Verbose) {
gclog_or_tty->print( " base_footprint: " SIZE_FORMAT
" avg_young_live: " SIZE_FORMAT
" avg_old_live: " SIZE_FORMAT,
(size_t)_avg_base_footprint->average(),
(size_t)avg_young_live()->average(),
(size_t)avg_old_live()->average());
}
// And finally, our old and new sizes.
gclog_or_tty->print(" old_eden_size: " SIZE_FORMAT
" desired_eden_size: " SIZE_FORMAT,
_eden_size, desired_eden_size);
gclog_or_tty->cr();
}
set_eden_size(desired_eden_size);
}
void PSAdaptiveSizePolicy::compute_old_gen_free_space(
size_t old_live,
size_t cur_eden,
size_t max_old_gen_size,
bool is_full_gc) {
// Update statistics
// Time statistics are updated as we go, update footprint stats here
if (is_full_gc) { if (is_full_gc) {
// old_live is only accurate after a full gc // old_live is only accurate after a full gc
avg_old_live()->sample(old_live); avg_old_live()->sample(old_live);
@ -242,32 +459,14 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
// some case but is dangerous. // some case but is dangerous.
size_t desired_eden_size = cur_eden; size_t desired_eden_size = cur_eden;
#ifdef ASSERT
size_t original_promo_size = desired_promo_size;
size_t original_eden_size = desired_eden_size;
#endif
// Cache some values. There's a bit of work getting these, so // Cache some values. There's a bit of work getting these, so
// we might save a little time. // we might save a little time.
const double major_cost = major_gc_cost(); const double major_cost = major_gc_cost();
const double minor_cost = minor_gc_cost(); const double minor_cost = minor_gc_cost();
// Used for diagnostics
clear_generation_free_space_flags();
// Limits on our growth // Limits on our growth
size_t promo_limit = (size_t)(max_old_gen_size - avg_old_live()->average()); size_t promo_limit = (size_t)(max_old_gen_size - avg_old_live()->average());
// This method sets the desired eden size. That plus the
// desired survivor space sizes sets the desired young generation
// size. This methods does not know what the desired survivor
// size is but expects that other policy will attempt to make
// the survivor sizes compatible with the live data in the
// young generation. This limit is an estimate of the space left
// in the young generation after the survivor spaces have been
// subtracted out.
size_t eden_limit = max_eden_size;
// But don't force a promo size below the current promo size. Otherwise, // But don't force a promo size below the current promo size. Otherwise,
// the promo size will shrink for no good reason. // the promo size will shrink for no good reason.
promo_limit = MAX2(promo_limit, _promo_size); promo_limit = MAX2(promo_limit, _promo_size);
@ -290,7 +489,6 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
// a change less than the necessary alignment is probably not worth // a change less than the necessary alignment is probably not worth
// attempting. // attempting.
if ((_avg_minor_pause->padded_average() > gc_pause_goal_sec()) || if ((_avg_minor_pause->padded_average() > gc_pause_goal_sec()) ||
(_avg_major_pause->padded_average() > gc_pause_goal_sec())) { (_avg_major_pause->padded_average() > gc_pause_goal_sec())) {
// //
@ -298,12 +496,13 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
// //
// Make changes only to affect one of the pauses (the larger) // Make changes only to affect one of the pauses (the larger)
// at a time. // at a time.
adjust_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size); if (is_full_gc) {
set_decide_at_full_gc(decide_at_full_gc_true);
adjust_promo_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
}
} else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) { } else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) {
// Adjust only for the minor pause time goal // Adjust only for the minor pause time goal
adjust_for_minor_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size); adjust_promo_for_minor_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
} else if(adjusted_mutator_cost() < _throughput_goal) { } else if(adjusted_mutator_cost() < _throughput_goal) {
// This branch used to require that (mutator_cost() > 0.0 in 1.4.2. // This branch used to require that (mutator_cost() > 0.0 in 1.4.2.
// This sometimes resulted in skipping to the minimize footprint // This sometimes resulted in skipping to the minimize footprint
@ -316,8 +515,10 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
assert(major_cost >= 0.0, "major cost is < 0.0"); assert(major_cost >= 0.0, "major cost is < 0.0");
assert(minor_cost >= 0.0, "minor cost is < 0.0"); assert(minor_cost >= 0.0, "minor cost is < 0.0");
// Try to reduce the GC times. // Try to reduce the GC times.
adjust_for_throughput(is_full_gc, &desired_promo_size, &desired_eden_size); if (is_full_gc) {
set_decide_at_full_gc(decide_at_full_gc_true);
adjust_promo_for_throughput(is_full_gc, &desired_promo_size);
}
} else { } else {
// Be conservative about reducing the footprint. // Be conservative about reducing the footprint.
@ -327,13 +528,10 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
young_gen_policy_is_ready() && young_gen_policy_is_ready() &&
avg_major_gc_cost()->average() >= 0.0 && avg_major_gc_cost()->average() >= 0.0 &&
avg_minor_gc_cost()->average() >= 0.0) { avg_minor_gc_cost()->average() >= 0.0) {
size_t desired_sum = desired_eden_size + desired_promo_size;
desired_eden_size = adjust_eden_for_footprint(desired_eden_size,
desired_sum);
if (is_full_gc) { if (is_full_gc) {
set_decide_at_full_gc(decide_at_full_gc_true); set_decide_at_full_gc(decide_at_full_gc_true);
desired_promo_size = adjust_promo_for_footprint(desired_promo_size, size_t desired_sum = desired_eden_size + desired_promo_size;
desired_sum); desired_promo_size = adjust_promo_for_footprint(desired_promo_size, desired_sum);
} }
} }
} }
@ -345,7 +543,7 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
// "free_in_old_gen" was the original value for used for promo_limit // "free_in_old_gen" was the original value for used for promo_limit
size_t free_in_old_gen = (size_t)(max_old_gen_size - avg_old_live()->average()); size_t free_in_old_gen = (size_t)(max_old_gen_size - avg_old_live()->average());
gclog_or_tty->print_cr( gclog_or_tty->print_cr(
"PSAdaptiveSizePolicy::compute_generation_free_space limits:" "PSAdaptiveSizePolicy::compute_old_gen_free_space limits:"
" desired_promo_size: " SIZE_FORMAT " desired_promo_size: " SIZE_FORMAT
" promo_limit: " SIZE_FORMAT " promo_limit: " SIZE_FORMAT
" free_in_old_gen: " SIZE_FORMAT " free_in_old_gen: " SIZE_FORMAT
@ -354,21 +552,9 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
desired_promo_size, promo_limit, free_in_old_gen, desired_promo_size, promo_limit, free_in_old_gen,
max_old_gen_size, (size_t) avg_old_live()->average()); max_old_gen_size, (size_t) avg_old_live()->average());
} }
if (desired_eden_size > eden_limit) {
gclog_or_tty->print_cr(
"AdaptiveSizePolicy::compute_generation_free_space limits:"
" desired_eden_size: " SIZE_FORMAT
" old_eden_size: " SIZE_FORMAT
" eden_limit: " SIZE_FORMAT
" cur_eden: " SIZE_FORMAT
" max_eden_size: " SIZE_FORMAT
" avg_young_live: " SIZE_FORMAT,
desired_eden_size, _eden_size, eden_limit, cur_eden,
max_eden_size, (size_t)avg_young_live()->average());
}
if (gc_cost() > gc_cost_limit) { if (gc_cost() > gc_cost_limit) {
gclog_or_tty->print_cr( gclog_or_tty->print_cr(
"AdaptiveSizePolicy::compute_generation_free_space: gc time limit" "PSAdaptiveSizePolicy::compute_old_gen_free_space: gc time limit"
" gc_cost: %f " " gc_cost: %f "
" GCTimeLimit: %d", " GCTimeLimit: %d",
gc_cost(), GCTimeLimit); gc_cost(), GCTimeLimit);
@ -377,46 +563,18 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
// Align everything and make a final limit check // Align everything and make a final limit check
const size_t alignment = _intra_generation_alignment; const size_t alignment = _intra_generation_alignment;
desired_eden_size = align_size_up(desired_eden_size, alignment);
desired_eden_size = MAX2(desired_eden_size, alignment);
desired_promo_size = align_size_up(desired_promo_size, alignment); desired_promo_size = align_size_up(desired_promo_size, alignment);
desired_promo_size = MAX2(desired_promo_size, alignment); desired_promo_size = MAX2(desired_promo_size, alignment);
eden_limit = align_size_down(eden_limit, alignment);
promo_limit = align_size_down(promo_limit, alignment); promo_limit = align_size_down(promo_limit, alignment);
// Is too much time being spent in GC?
// Is the heap trying to grow beyond it's limits?
const size_t free_in_old_gen =
(size_t)(max_old_gen_size - avg_old_live()->average());
if (desired_promo_size > free_in_old_gen && desired_eden_size > eden_limit) {
check_gc_overhead_limit(young_live,
eden_live,
max_old_gen_size,
max_eden_size,
is_full_gc,
gc_cause,
collector_policy);
}
// And one last limit check, now that we've aligned things. // And one last limit check, now that we've aligned things.
if (desired_eden_size > eden_limit) {
// If the policy says to get a larger eden but
// is hitting the limit, don't decrease eden.
// This can lead to a general drifting down of the
// eden size. Let the tenuring calculation push more
// into the old gen.
desired_eden_size = MAX2(eden_limit, cur_eden);
}
desired_promo_size = MIN2(desired_promo_size, promo_limit); desired_promo_size = MIN2(desired_promo_size, promo_limit);
if (PrintAdaptiveSizePolicy) { if (PrintAdaptiveSizePolicy) {
// Timing stats // Timing stats
gclog_or_tty->print( gclog_or_tty->print(
"PSAdaptiveSizePolicy::compute_generation_free_space: costs" "PSAdaptiveSizePolicy::compute_old_gen_free_space: costs"
" minor_time: %f" " minor_time: %f"
" major_cost: %f" " major_cost: %f"
" mutator_cost: %f" " mutator_cost: %f"
@ -454,19 +612,13 @@ void PSAdaptiveSizePolicy::compute_generation_free_space(
// And finally, our old and new sizes. // And finally, our old and new sizes.
gclog_or_tty->print(" old_promo_size: " SIZE_FORMAT gclog_or_tty->print(" old_promo_size: " SIZE_FORMAT
" old_eden_size: " SIZE_FORMAT " desired_promo_size: " SIZE_FORMAT,
" desired_promo_size: " SIZE_FORMAT _promo_size, desired_promo_size);
" desired_eden_size: " SIZE_FORMAT,
_promo_size, _eden_size,
desired_promo_size, desired_eden_size);
gclog_or_tty->cr(); gclog_or_tty->cr();
} }
decay_supplemental_growth(is_full_gc);
set_promo_size(desired_promo_size); set_promo_size(desired_promo_size);
set_eden_size(desired_eden_size); }
};
void PSAdaptiveSizePolicy::decay_supplemental_growth(bool is_full_gc) { void PSAdaptiveSizePolicy::decay_supplemental_growth(bool is_full_gc) {
// Decay the supplemental increment? Decay the supplement growth // Decay the supplemental increment? Decay the supplement growth
@ -490,9 +642,39 @@ void PSAdaptiveSizePolicy::decay_supplemental_growth(bool is_full_gc) {
} }
} }
void PSAdaptiveSizePolicy::adjust_for_minor_pause_time(bool is_full_gc, void PSAdaptiveSizePolicy::adjust_promo_for_minor_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr, size_t* desired_eden_size_ptr) { size_t* desired_promo_size_ptr, size_t* desired_eden_size_ptr) {
if (PSAdjustTenuredGenForMinorPause) {
if (is_full_gc) {
set_decide_at_full_gc(decide_at_full_gc_true);
}
// If the desired eden size is as small as it will get,
// try to adjust the old gen size.
if (*desired_eden_size_ptr <= _intra_generation_alignment) {
// Vary the old gen size to reduce the young gen pause. This
// may not be a good idea. This is just a test.
if (minor_pause_old_estimator()->decrement_will_decrease()) {
set_change_old_gen_for_min_pauses(decrease_old_gen_for_min_pauses_true);
*desired_promo_size_ptr =
_promo_size - promo_decrement_aligned_down(*desired_promo_size_ptr);
} else {
set_change_old_gen_for_min_pauses(increase_old_gen_for_min_pauses_true);
size_t promo_heap_delta =
promo_increment_with_supplement_aligned_up(*desired_promo_size_ptr);
if ((*desired_promo_size_ptr + promo_heap_delta) >
*desired_promo_size_ptr) {
*desired_promo_size_ptr =
_promo_size + promo_heap_delta;
}
}
}
}
}
void PSAdaptiveSizePolicy::adjust_eden_for_minor_pause_time(bool is_full_gc,
size_t* desired_eden_size_ptr) {
// Adjust the young generation size to reduce pause time of // Adjust the young generation size to reduce pause time of
// of collections. // of collections.
// //
@ -512,49 +694,19 @@ void PSAdaptiveSizePolicy::adjust_for_minor_pause_time(bool is_full_gc,
set_change_young_gen_for_min_pauses( set_change_young_gen_for_min_pauses(
increase_young_gen_for_min_pauses_true); increase_young_gen_for_min_pauses_true);
} }
if (PSAdjustTenuredGenForMinorPause) {
// If the desired eden size is as small as it will get,
// try to adjust the old gen size.
if (*desired_eden_size_ptr <= _intra_generation_alignment) {
// Vary the old gen size to reduce the young gen pause. This
// may not be a good idea. This is just a test.
if (minor_pause_old_estimator()->decrement_will_decrease()) {
set_change_old_gen_for_min_pauses(
decrease_old_gen_for_min_pauses_true);
*desired_promo_size_ptr =
_promo_size - promo_decrement_aligned_down(*desired_promo_size_ptr);
} else {
set_change_old_gen_for_min_pauses(
increase_old_gen_for_min_pauses_true);
size_t promo_heap_delta =
promo_increment_with_supplement_aligned_up(*desired_promo_size_ptr);
if ((*desired_promo_size_ptr + promo_heap_delta) >
*desired_promo_size_ptr) {
*desired_promo_size_ptr =
_promo_size + promo_heap_delta;
}
}
}
}
} }
void PSAdaptiveSizePolicy::adjust_for_pause_time(bool is_full_gc, void PSAdaptiveSizePolicy::adjust_promo_for_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr, size_t* desired_promo_size_ptr,
size_t* desired_eden_size_ptr) { size_t* desired_eden_size_ptr) {
size_t promo_heap_delta = 0; size_t promo_heap_delta = 0;
size_t eden_heap_delta = 0; // Add some checks for a threshold for a change. For example,
// Add some checks for a threshhold for a change. For example,
// a change less than the required alignment is probably not worth // a change less than the required alignment is probably not worth
// attempting. // attempting.
if (is_full_gc) {
set_decide_at_full_gc(decide_at_full_gc_true);
}
if (_avg_minor_pause->padded_average() > _avg_major_pause->padded_average()) { if (_avg_minor_pause->padded_average() > _avg_major_pause->padded_average()) {
adjust_for_minor_pause_time(is_full_gc, adjust_promo_for_minor_pause_time(is_full_gc, desired_promo_size_ptr, desired_eden_size_ptr);
desired_promo_size_ptr,
desired_eden_size_ptr);
// major pause adjustments // major pause adjustments
} else if (is_full_gc) { } else if (is_full_gc) {
// Adjust for the major pause time only at full gc's because the // Adjust for the major pause time only at full gc's because the
@ -573,6 +725,33 @@ void PSAdaptiveSizePolicy::adjust_for_pause_time(bool is_full_gc,
// promo_increment_aligned_up(*desired_promo_size_ptr); // promo_increment_aligned_up(*desired_promo_size_ptr);
set_change_old_gen_for_maj_pauses(increase_old_gen_for_maj_pauses_true); set_change_old_gen_for_maj_pauses(increase_old_gen_for_maj_pauses_true);
} }
}
if (PrintAdaptiveSizePolicy && Verbose) {
gclog_or_tty->print_cr(
"PSAdaptiveSizePolicy::compute_old_gen_free_space "
"adjusting gen sizes for major pause (avg %f goal %f). "
"desired_promo_size " SIZE_FORMAT " promo delta " SIZE_FORMAT,
_avg_major_pause->average(), gc_pause_goal_sec(),
*desired_promo_size_ptr, promo_heap_delta);
}
}
void PSAdaptiveSizePolicy::adjust_eden_for_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr,
size_t* desired_eden_size_ptr) {
size_t eden_heap_delta = 0;
// Add some checks for a threshold for a change. For example,
// a change less than the required alignment is probably not worth
// attempting.
if (_avg_minor_pause->padded_average() > _avg_major_pause->padded_average()) {
adjust_eden_for_minor_pause_time(is_full_gc,
desired_eden_size_ptr);
// major pause adjustments
} else if (is_full_gc) {
// Adjust for the major pause time only at full gc's because the
// affects of a change can only be seen at full gc's.
if (PSAdjustYoungGenForMajorPause) { if (PSAdjustYoungGenForMajorPause) {
// If the promo size is at the minimum (i.e., the old gen // If the promo size is at the minimum (i.e., the old gen
// size will not actually decrease), consider changing the // size will not actually decrease), consider changing the
@ -607,43 +786,35 @@ void PSAdaptiveSizePolicy::adjust_for_pause_time(bool is_full_gc,
if (PrintAdaptiveSizePolicy && Verbose) { if (PrintAdaptiveSizePolicy && Verbose) {
gclog_or_tty->print_cr( gclog_or_tty->print_cr(
"AdaptiveSizePolicy::compute_generation_free_space " "PSAdaptiveSizePolicy::compute_eden_space_size "
"adjusting gen sizes for major pause (avg %f goal %f). " "adjusting gen sizes for major pause (avg %f goal %f). "
"desired_promo_size " SIZE_FORMAT "desired_eden_size " "desired_eden_size " SIZE_FORMAT " eden delta " SIZE_FORMAT,
SIZE_FORMAT
" promo delta " SIZE_FORMAT " eden delta " SIZE_FORMAT,
_avg_major_pause->average(), gc_pause_goal_sec(), _avg_major_pause->average(), gc_pause_goal_sec(),
*desired_promo_size_ptr, *desired_eden_size_ptr, *desired_eden_size_ptr, eden_heap_delta);
promo_heap_delta, eden_heap_delta);
} }
} }
void PSAdaptiveSizePolicy::adjust_for_throughput(bool is_full_gc, void PSAdaptiveSizePolicy::adjust_promo_for_throughput(bool is_full_gc,
size_t* desired_promo_size_ptr, size_t* desired_promo_size_ptr) {
size_t* desired_eden_size_ptr) {
// Add some checks for a threshhold for a change. For example, // Add some checks for a threshold for a change. For example,
// a change less than the required alignment is probably not worth // a change less than the required alignment is probably not worth
// attempting. // attempting.
if (is_full_gc) {
set_decide_at_full_gc(decide_at_full_gc_true);
}
if ((gc_cost() + mutator_cost()) == 0.0) { if ((gc_cost() + mutator_cost()) == 0.0) {
return; return;
} }
if (PrintAdaptiveSizePolicy && Verbose) { if (PrintAdaptiveSizePolicy && Verbose) {
gclog_or_tty->print("\nPSAdaptiveSizePolicy::adjust_for_throughput(" gclog_or_tty->print("\nPSAdaptiveSizePolicy::adjust_promo_for_throughput("
"is_full: %d, promo: " SIZE_FORMAT ", cur_eden: " SIZE_FORMAT "): ", "is_full: %d, promo: " SIZE_FORMAT "): ",
is_full_gc, *desired_promo_size_ptr, *desired_eden_size_ptr); is_full_gc, *desired_promo_size_ptr);
gclog_or_tty->print_cr("mutator_cost %f major_gc_cost %f " gclog_or_tty->print_cr("mutator_cost %f major_gc_cost %f "
"minor_gc_cost %f", mutator_cost(), major_gc_cost(), minor_gc_cost()); "minor_gc_cost %f", mutator_cost(), major_gc_cost(), minor_gc_cost());
} }
// Tenured generation // Tenured generation
if (is_full_gc) { if (is_full_gc) {
// Calculate the change to use for the tenured gen. // Calculate the change to use for the tenured gen.
size_t scaled_promo_heap_delta = 0; size_t scaled_promo_heap_delta = 0;
// Can the increment to the generation be scaled? // Can the increment to the generation be scaled?
@ -720,6 +891,26 @@ void PSAdaptiveSizePolicy::adjust_for_throughput(bool is_full_gc,
*desired_promo_size_ptr, scaled_promo_heap_delta); *desired_promo_size_ptr, scaled_promo_heap_delta);
} }
} }
}
void PSAdaptiveSizePolicy::adjust_eden_for_throughput(bool is_full_gc,
size_t* desired_eden_size_ptr) {
// Add some checks for a threshold for a change. For example,
// a change less than the required alignment is probably not worth
// attempting.
if ((gc_cost() + mutator_cost()) == 0.0) {
return;
}
if (PrintAdaptiveSizePolicy && Verbose) {
gclog_or_tty->print("\nPSAdaptiveSizePolicy::adjust_eden_for_throughput("
"is_full: %d, cur_eden: " SIZE_FORMAT "): ",
is_full_gc, *desired_eden_size_ptr);
gclog_or_tty->print_cr("mutator_cost %f major_gc_cost %f "
"minor_gc_cost %f", mutator_cost(), major_gc_cost(), minor_gc_cost());
}
// Young generation // Young generation
size_t scaled_eden_heap_delta = 0; size_t scaled_eden_heap_delta = 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -136,18 +136,24 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
double gc_minor_pause_goal_sec() const { return _gc_minor_pause_goal_sec; } double gc_minor_pause_goal_sec() const { return _gc_minor_pause_goal_sec; }
// Change the young generation size to achieve a minor GC pause time goal // Change the young generation size to achieve a minor GC pause time goal
void adjust_for_minor_pause_time(bool is_full_gc, void adjust_promo_for_minor_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr, size_t* desired_promo_size_ptr,
size_t* desired_eden_size_ptr); size_t* desired_eden_size_ptr);
void adjust_eden_for_minor_pause_time(bool is_full_gc,
size_t* desired_eden_size_ptr);
// Change the generation sizes to achieve a GC pause time goal // Change the generation sizes to achieve a GC pause time goal
// Returned sizes are not necessarily aligned. // Returned sizes are not necessarily aligned.
void adjust_for_pause_time(bool is_full_gc, void adjust_promo_for_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr,
size_t* desired_eden_size_ptr);
void adjust_eden_for_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr, size_t* desired_promo_size_ptr,
size_t* desired_eden_size_ptr); size_t* desired_eden_size_ptr);
// Change the generation sizes to achieve an application throughput goal // Change the generation sizes to achieve an application throughput goal
// Returned sizes are not necessarily aligned. // Returned sizes are not necessarily aligned.
void adjust_for_throughput(bool is_full_gc, void adjust_promo_for_throughput(bool is_full_gc,
size_t* desired_promo_size_ptr, size_t* desired_promo_size_ptr);
void adjust_eden_for_throughput(bool is_full_gc,
size_t* desired_eden_size_ptr); size_t* desired_eden_size_ptr);
// Change the generation sizes to achieve minimum footprint // Change the generation sizes to achieve minimum footprint
// Returned sizes are not aligned. // Returned sizes are not aligned.
@ -168,9 +174,6 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
size_t promo_decrement_aligned_down(size_t cur_promo); size_t promo_decrement_aligned_down(size_t cur_promo);
size_t promo_increment_with_supplement_aligned_up(size_t cur_promo); size_t promo_increment_with_supplement_aligned_up(size_t cur_promo);
// Decay the supplemental growth additive.
void decay_supplemental_growth(bool is_full_gc);
// Returns a change that has been scaled down. Result // Returns a change that has been scaled down. Result
// is not aligned. (If useful, move to some shared // is not aligned. (If useful, move to some shared
// location.) // location.)
@ -336,7 +339,7 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
// perform a Full GC? // perform a Full GC?
bool should_full_GC(size_t live_in_old_gen); bool should_full_GC(size_t live_in_old_gen);
// Calculates optimial free space sizes for both the old and young // Calculates optimal (free) space sizes for both the young and old
// generations. Stores results in _eden_size and _promo_size. // generations. Stores results in _eden_size and _promo_size.
// Takes current used space in all generations as input, as well // Takes current used space in all generations as input, as well
// as an indication if a full gc has just been performed, for use // as an indication if a full gc has just been performed, for use
@ -347,9 +350,18 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
size_t cur_eden, // current eden in bytes size_t cur_eden, // current eden in bytes
size_t max_old_gen_size, size_t max_old_gen_size,
size_t max_eden_size, size_t max_eden_size,
bool is_full_gc, bool is_full_gc);
GCCause::Cause gc_cause,
CollectorPolicy* collector_policy); void compute_eden_space_size(size_t young_live,
size_t eden_live,
size_t cur_eden, // current eden in bytes
size_t max_eden_size,
bool is_full_gc);
void compute_old_gen_free_space(size_t old_live,
size_t cur_eden, // current eden in bytes
size_t max_old_gen_size,
bool is_full_gc);
// Calculates new survivor space size; returns a new tenuring threshold // Calculates new survivor space size; returns a new tenuring threshold
// value. Stores new survivor size in _survivor_size. // value. Stores new survivor size in _survivor_size.
@ -390,6 +402,9 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
// Printing support // Printing support
virtual bool print_adaptive_size_policy_on(outputStream* st) const; virtual bool print_adaptive_size_policy_on(outputStream* st) const;
// Decay the supplemental growth additive.
void decay_supplemental_growth(bool is_full_gc);
}; };
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSADAPTIVESIZEPOLICY_HPP #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSADAPTIVESIZEPOLICY_HPP

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -92,8 +92,8 @@ void PSMarkSweep::invoke(bool maximum_heap_compaction) {
const bool clear_all_soft_refs = const bool clear_all_soft_refs =
heap->collector_policy()->should_clear_all_soft_refs(); heap->collector_policy()->should_clear_all_soft_refs();
int count = (maximum_heap_compaction)?1:MarkSweepAlwaysCompactCount; uint count = maximum_heap_compaction ? 1 : MarkSweepAlwaysCompactCount;
IntFlagSetting flag_setting(MarkSweepAlwaysCompactCount, count); UIntFlagSetting flag_setting(MarkSweepAlwaysCompactCount, count);
PSMarkSweep::invoke_no_policy(clear_all_soft_refs || maximum_heap_compaction); PSMarkSweep::invoke_no_policy(clear_all_soft_refs || maximum_heap_compaction);
} }
@ -277,18 +277,36 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
young_gen->from_space()->capacity_in_bytes() + young_gen->from_space()->capacity_in_bytes() +
young_gen->to_space()->capacity_in_bytes(), young_gen->to_space()->capacity_in_bytes(),
"Sizes of space in young gen are out-of-bounds"); "Sizes of space in young gen are out-of-bounds");
size_t young_live = young_gen->used_in_bytes();
size_t eden_live = young_gen->eden_space()->used_in_bytes();
size_t old_live = old_gen->used_in_bytes();
size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
size_t max_old_gen_size = old_gen->max_gen_size();
size_t max_eden_size = young_gen->max_size() - size_t max_eden_size = young_gen->max_size() -
young_gen->from_space()->capacity_in_bytes() - young_gen->from_space()->capacity_in_bytes() -
young_gen->to_space()->capacity_in_bytes(); young_gen->to_space()->capacity_in_bytes();
size_policy->compute_generation_free_space(young_gen->used_in_bytes(),
young_gen->eden_space()->used_in_bytes(), // Used for diagnostics
old_gen->used_in_bytes(), size_policy->clear_generation_free_space_flags();
young_gen->eden_space()->capacity_in_bytes(),
old_gen->max_gen_size(), size_policy->compute_generation_free_space(young_live,
max_eden_size, eden_live,
true /* full gc*/, old_live,
gc_cause, cur_eden,
heap->collector_policy()); max_old_gen_size,
max_eden_size,
true /* full gc*/);
size_policy->check_gc_overhead_limit(young_live,
eden_live,
max_old_gen_size,
max_eden_size,
true /* full gc*/,
gc_cause,
heap->collector_policy());
size_policy->decay_supplemental_growth(true /* full gc*/);
heap->resize_old_gen(size_policy->calculated_old_free_size_in_bytes()); heap->resize_old_gen(size_policy->calculated_old_free_size_in_bytes());

View File

@ -88,8 +88,7 @@ void PSMarkSweepDecorator::precompact() {
* by the MarkSweepAlwaysCompactCount parameter. This is a significant * by the MarkSweepAlwaysCompactCount parameter. This is a significant
* performance improvement! * performance improvement!
*/ */
bool skip_dead = (MarkSweepAlwaysCompactCount < 1) bool skip_dead = ((PSMarkSweep::total_invocations() % MarkSweepAlwaysCompactCount) != 0);
|| ((PSMarkSweep::total_invocations() % MarkSweepAlwaysCompactCount) != 0);
size_t allowed_deadspace = 0; size_t allowed_deadspace = 0;
if (skip_dead) { if (skip_dead) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -948,7 +948,6 @@ void PSParallelCompact::pre_compact(PreGCValues* pre_gc_values)
pre_gc_values->fill(heap); pre_gc_values->fill(heap);
NOT_PRODUCT(_mark_bitmap.reset_counters());
DEBUG_ONLY(add_obj_count = add_obj_size = 0;) DEBUG_ONLY(add_obj_count = add_obj_size = 0;)
DEBUG_ONLY(mark_bitmap_count = mark_bitmap_size = 0;) DEBUG_ONLY(mark_bitmap_count = mark_bitmap_size = 0;)
@ -2042,15 +2041,6 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
marking_start.update(); marking_start.update();
marking_phase(vmthread_cm, maximum_heap_compaction); marking_phase(vmthread_cm, maximum_heap_compaction);
#ifndef PRODUCT
if (TraceParallelOldGCMarkingPhase) {
gclog_or_tty->print_cr("marking_phase: cas_tries %d cas_retries %d "
"cas_by_another %d",
mark_bitmap()->cas_tries(), mark_bitmap()->cas_retries(),
mark_bitmap()->cas_by_another());
}
#endif // #ifndef PRODUCT
bool max_on_system_gc = UseMaximumCompactionOnSystemGC bool max_on_system_gc = UseMaximumCompactionOnSystemGC
&& gc_cause == GCCause::_java_lang_system_gc; && gc_cause == GCCause::_java_lang_system_gc;
summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc); summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc);
@ -2094,19 +2084,36 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
young_gen->from_space()->capacity_in_bytes() + young_gen->from_space()->capacity_in_bytes() +
young_gen->to_space()->capacity_in_bytes(), young_gen->to_space()->capacity_in_bytes(),
"Sizes of space in young gen are out-of-bounds"); "Sizes of space in young gen are out-of-bounds");
size_t young_live = young_gen->used_in_bytes();
size_t eden_live = young_gen->eden_space()->used_in_bytes();
size_t old_live = old_gen->used_in_bytes();
size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
size_t max_old_gen_size = old_gen->max_gen_size();
size_t max_eden_size = young_gen->max_size() - size_t max_eden_size = young_gen->max_size() -
young_gen->from_space()->capacity_in_bytes() - young_gen->from_space()->capacity_in_bytes() -
young_gen->to_space()->capacity_in_bytes(); young_gen->to_space()->capacity_in_bytes();
size_policy->compute_generation_free_space(
young_gen->used_in_bytes(), // Used for diagnostics
young_gen->eden_space()->used_in_bytes(), size_policy->clear_generation_free_space_flags();
old_gen->used_in_bytes(),
young_gen->eden_space()->capacity_in_bytes(), size_policy->compute_generation_free_space(young_live,
old_gen->max_gen_size(), eden_live,
max_eden_size, old_live,
true /* full gc*/, cur_eden,
gc_cause, max_old_gen_size,
heap->collector_policy()); max_eden_size,
true /* full gc*/);
size_policy->check_gc_overhead_limit(young_live,
eden_live,
max_old_gen_size,
max_eden_size,
true /* full gc*/,
gc_cause,
heap->collector_policy());
size_policy->decay_supplemental_growth(true /* full gc*/);
heap->resize_old_gen( heap->resize_old_gen(
size_policy->calculated_old_free_size_in_bytes()); size_policy->calculated_old_free_size_in_bytes());

View File

@ -552,19 +552,33 @@ bool PSScavenge::invoke_no_policy() {
young_gen->from_space()->capacity_in_bytes() + young_gen->from_space()->capacity_in_bytes() +
young_gen->to_space()->capacity_in_bytes(), young_gen->to_space()->capacity_in_bytes(),
"Sizes of space in young gen are out-of-bounds"); "Sizes of space in young gen are out-of-bounds");
size_t young_live = young_gen->used_in_bytes();
size_t eden_live = young_gen->eden_space()->used_in_bytes();
size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
size_t max_old_gen_size = old_gen->max_gen_size();
size_t max_eden_size = young_gen->max_size() - size_t max_eden_size = young_gen->max_size() -
young_gen->from_space()->capacity_in_bytes() - young_gen->from_space()->capacity_in_bytes() -
young_gen->to_space()->capacity_in_bytes(); young_gen->to_space()->capacity_in_bytes();
size_policy->compute_generation_free_space(young_gen->used_in_bytes(),
young_gen->eden_space()->used_in_bytes(),
old_gen->used_in_bytes(),
young_gen->eden_space()->capacity_in_bytes(),
old_gen->max_gen_size(),
max_eden_size,
false /* full gc*/,
gc_cause,
heap->collector_policy());
// Used for diagnostics
size_policy->clear_generation_free_space_flags();
size_policy->compute_eden_space_size(young_live,
eden_live,
cur_eden,
max_eden_size,
false /* not full gc*/);
size_policy->check_gc_overhead_limit(young_live,
eden_live,
max_old_gen_size,
max_eden_size,
false /* not full gc*/,
gc_cause,
heap->collector_policy());
size_policy->decay_supplemental_growth(false /* not full gc*/);
} }
// Resize the young generation at every collection // Resize the young generation at every collection
// even if new sizes have not been calculated. This is // even if new sizes have not been calculated. This is

View File

@ -30,7 +30,7 @@
#include "oops/objArrayKlass.inline.hpp" #include "oops/objArrayKlass.inline.hpp"
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
unsigned int MarkSweep::_total_invocations = 0; uint MarkSweep::_total_invocations = 0;
Stack<oop, mtGC> MarkSweep::_marking_stack; Stack<oop, mtGC> MarkSweep::_marking_stack;
Stack<ObjArrayTask, mtGC> MarkSweep::_objarray_stack; Stack<ObjArrayTask, mtGC> MarkSweep::_objarray_stack;

View File

@ -113,7 +113,7 @@ class MarkSweep : AllStatic {
// //
protected: protected:
// Total invocations of a MarkSweep collection // Total invocations of a MarkSweep collection
static unsigned int _total_invocations; static uint _total_invocations;
// Traversal stacks used during phase1 // Traversal stacks used during phase1
static Stack<oop, mtGC> _marking_stack; static Stack<oop, mtGC> _marking_stack;
@ -147,7 +147,7 @@ class MarkSweep : AllStatic {
static AdjustKlassClosure adjust_klass_closure; static AdjustKlassClosure adjust_klass_closure;
// Accessors // Accessors
static unsigned int total_invocations() { return _total_invocations; } static uint total_invocations() { return _total_invocations; }
// Reference Processing // Reference Processing
static ReferenceProcessor* const ref_processor() { return _ref_processor; } static ReferenceProcessor* const ref_processor() { return _ref_processor; }

View File

@ -264,6 +264,27 @@ void TwoGenerationCollectorPolicy::initialize_flags() {
// need to do this again // need to do this again
MaxHeapSize = align_size_up(MaxHeapSize, max_alignment()); MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());
// adjust max heap size if necessary
if (NewSize + OldSize > MaxHeapSize) {
if (FLAG_IS_CMDLINE(MaxHeapSize)) {
// somebody set a maximum heap size with the intention that we should not
// exceed it. Adjust New/OldSize as necessary.
uintx calculated_size = NewSize + OldSize;
double shrink_factor = (double) MaxHeapSize / calculated_size;
// align
NewSize = align_size_down((uintx) (NewSize * shrink_factor), min_alignment());
// OldSize is already aligned because above we aligned MaxHeapSize to
// max_alignment(), and we just made sure that NewSize is aligned to
// min_alignment(). In initialize_flags() we verified that max_alignment()
// is a multiple of min_alignment().
OldSize = MaxHeapSize - NewSize;
} else {
MaxHeapSize = NewSize + OldSize;
}
}
// need to do this again
MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());
always_do_update_barrier = UseConcMarkSweepGC; always_do_update_barrier = UseConcMarkSweepGC;
// Check validity of heap flags // Check validity of heap flags
@ -731,7 +752,7 @@ HeapWord* GenCollectorPolicy::satisfy_failed_allocation(size_t size,
// free memory should be here, especially if they are expensive. If this // free memory should be here, especially if they are expensive. If this
// attempt fails, an OOM exception will be thrown. // attempt fails, an OOM exception will be thrown.
{ {
IntFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted UIntFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted
gch->do_collection(true /* full */, gch->do_collection(true /* full */,
true /* clear_all_soft_refs */, true /* clear_all_soft_refs */,

View File

@ -537,9 +537,8 @@ protected:
* Occasionally, we want to ensure a full compaction, which is determined \ * Occasionally, we want to ensure a full compaction, which is determined \
* by the MarkSweepAlwaysCompactCount parameter. \ * by the MarkSweepAlwaysCompactCount parameter. \
*/ \ */ \
int invocations = MarkSweep::total_invocations(); \ uint invocations = MarkSweep::total_invocations(); \
bool skip_dead = (MarkSweepAlwaysCompactCount < 1) \ bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0); \
||((invocations % MarkSweepAlwaysCompactCount) != 0); \
\ \
size_t allowed_deadspace = 0; \ size_t allowed_deadspace = 0; \
if (skip_dead) { \ if (skip_dead) { \

View File

@ -832,7 +832,9 @@ void Method::link_method(methodHandle h_method, TRAPS) {
assert(entry != NULL, "interpreter entry must be non-null"); assert(entry != NULL, "interpreter entry must be non-null");
// Sets both _i2i_entry and _from_interpreted_entry // Sets both _i2i_entry and _from_interpreted_entry
set_interpreter_entry(entry); set_interpreter_entry(entry);
if (is_native() && !is_method_handle_intrinsic()) {
// Don't overwrite already registered native entries.
if (is_native() && !has_native_function()) {
set_native_function( set_native_function(
SharedRuntime::native_method_throw_unsatisfied_link_error_entry(), SharedRuntime::native_method_throw_unsatisfied_link_error_entry(),
!native_bind_event_is_interesting); !native_bind_event_is_interesting);

View File

@ -85,16 +85,35 @@ InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvm
assert(!UseOldInlining, "do not use for old stuff"); assert(!UseOldInlining, "do not use for old stuff");
} }
/**
* Return true when EA is ON and a java constructor is called or
* a super constructor is called from an inlined java constructor.
* Also return true for boxing methods.
*/
static bool is_init_with_ea(ciMethod* callee_method, static bool is_init_with_ea(ciMethod* callee_method,
ciMethod* caller_method, Compile* C) { ciMethod* caller_method, Compile* C) {
// True when EA is ON and a java constructor is called or if (!C->do_escape_analysis() || !EliminateAllocations) {
// a super constructor is called from an inlined java constructor. return false; // EA is off
return C->do_escape_analysis() && EliminateAllocations && }
( callee_method->is_initializer() || if (callee_method->is_initializer()) {
(caller_method->is_initializer() && return true; // constuctor
caller_method != C->method() && }
caller_method->holder()->is_subclass_of(callee_method->holder())) if (caller_method->is_initializer() &&
); caller_method != C->method() &&
caller_method->holder()->is_subclass_of(callee_method->holder())) {
return true; // super constructor is called from inlined constructor
}
if (C->eliminate_boxing() && callee_method->is_boxing_method()) {
return true;
}
return false;
}
/**
* Force inlining unboxing accessor.
*/
static bool is_unboxing_method(ciMethod* callee_method, Compile* C) {
return C->eliminate_boxing() && callee_method->is_unboxing_method();
} }
// positive filter: should callee be inlined? // positive filter: should callee be inlined?
@ -144,6 +163,7 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
// bump the max size if the call is frequent // bump the max size if the call is frequent
if ((freq >= InlineFrequencyRatio) || if ((freq >= InlineFrequencyRatio) ||
(call_site_count >= InlineFrequencyCount) || (call_site_count >= InlineFrequencyCount) ||
is_unboxing_method(callee_method, C) ||
is_init_with_ea(callee_method, caller_method, C)) { is_init_with_ea(callee_method, caller_method, C)) {
max_inline_size = C->freq_inline_size(); max_inline_size = C->freq_inline_size();
@ -237,8 +257,25 @@ bool InlineTree::should_not_inline(ciMethod *callee_method,
return false; return false;
} }
if (callee_method->should_not_inline()) {
set_msg("disallowed by CompilerOracle");
return true;
}
#ifndef PRODUCT
if (ciReplay::should_not_inline(callee_method)) {
set_msg("disallowed by ciReplay");
return true;
}
#endif
// Now perform checks which are heuristic // Now perform checks which are heuristic
if (is_unboxing_method(callee_method, C)) {
// Inline unboxing methods.
return false;
}
if (!callee_method->force_inline()) { if (!callee_method->force_inline()) {
if (callee_method->has_compiled_code() && if (callee_method->has_compiled_code() &&
callee_method->instructions_size() > InlineSmallCode) { callee_method->instructions_size() > InlineSmallCode) {
@ -260,18 +297,6 @@ bool InlineTree::should_not_inline(ciMethod *callee_method,
} }
} }
if (callee_method->should_not_inline()) {
set_msg("disallowed by CompilerOracle");
return true;
}
#ifndef PRODUCT
if (ciReplay::should_not_inline(callee_method)) {
set_msg("disallowed by ciReplay");
return true;
}
#endif
if (UseStringCache) { if (UseStringCache) {
// Do not inline StringCache::profile() method used only at the beginning. // Do not inline StringCache::profile() method used only at the beginning.
if (callee_method->name() == ciSymbol::profile_name() && if (callee_method->name() == ciSymbol::profile_name() &&
@ -296,9 +321,8 @@ bool InlineTree::should_not_inline(ciMethod *callee_method,
} }
if (is_init_with_ea(callee_method, caller_method, C)) { if (is_init_with_ea(callee_method, caller_method, C)) {
// Escape Analysis: inline all executed constructors // Escape Analysis: inline all executed constructors
return false;
} else if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold, } else if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold,
CompileThreshold >> 1))) { CompileThreshold >> 1))) {
set_msg("executed < MinInliningThreshold times"); set_msg("executed < MinInliningThreshold times");

View File

@ -442,12 +442,15 @@
notproduct(bool, PrintEliminateLocks, false, \ notproduct(bool, PrintEliminateLocks, false, \
"Print out when locks are eliminated") \ "Print out when locks are eliminated") \
\ \
diagnostic(bool, EliminateAutoBox, false, \ product(bool, EliminateAutoBox, true, \
"Private flag to control optimizations for autobox elimination") \ "Control optimizations for autobox elimination") \
\ \
product(intx, AutoBoxCacheMax, 128, \ product(intx, AutoBoxCacheMax, 128, \
"Sets max value cached by the java.lang.Integer autobox cache") \ "Sets max value cached by the java.lang.Integer autobox cache") \
\ \
experimental(bool, AggressiveUnboxing, false, \
"Control optimizations for aggressive boxing elimination") \
\
product(bool, DoEscapeAnalysis, true, \ product(bool, DoEscapeAnalysis, true, \
"Perform escape analysis") \ "Perform escape analysis") \
\ \

View File

@ -125,9 +125,10 @@ void C2Compiler::compile_method(ciEnv* env,
bool subsume_loads = SubsumeLoads; bool subsume_loads = SubsumeLoads;
bool do_escape_analysis = DoEscapeAnalysis && bool do_escape_analysis = DoEscapeAnalysis &&
!env->jvmti_can_access_local_variables(); !env->jvmti_can_access_local_variables();
bool eliminate_boxing = EliminateAutoBox;
while (!env->failing()) { while (!env->failing()) {
// Attempt to compile while subsuming loads into machine instructions. // Attempt to compile while subsuming loads into machine instructions.
Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis); Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing);
// Check result and retry if appropriate. // Check result and retry if appropriate.
@ -142,6 +143,12 @@ void C2Compiler::compile_method(ciEnv* env,
do_escape_analysis = false; do_escape_analysis = false;
continue; // retry continue; // retry
} }
if (C.has_boxed_value()) {
// Recompile without boxing elimination regardless failure reason.
assert(eliminate_boxing, "must make progress");
eliminate_boxing = false;
continue; // retry
}
// Pass any other failure reason up to the ciEnv. // Pass any other failure reason up to the ciEnv.
// Note that serious, irreversible failures are already logged // Note that serious, irreversible failures are already logged
// on the ciEnv via env->record_method_not_compilable(). // on the ciEnv via env->record_method_not_compilable().

View File

@ -134,7 +134,7 @@ JVMState* DirectCallGenerator::generate(JVMState* jvms) {
kit.C->log()->elem("direct_call bci='%d'", jvms->bci()); kit.C->log()->elem("direct_call bci='%d'", jvms->bci());
} }
CallStaticJavaNode *call = new (kit.C) CallStaticJavaNode(tf(), target, method(), kit.bci()); CallStaticJavaNode *call = new (kit.C) CallStaticJavaNode(kit.C, tf(), target, method(), kit.bci());
_call_node = call; // Save the call node in case we need it later _call_node = call; // Save the call node in case we need it later
if (!is_static) { if (!is_static) {
// Make an explicit receiver null_check as part of this call. // Make an explicit receiver null_check as part of this call.
@ -304,29 +304,34 @@ class LateInlineCallGenerator : public DirectCallGenerator {
void LateInlineCallGenerator::do_late_inline() { void LateInlineCallGenerator::do_late_inline() {
// Can't inline it // Can't inline it
if (call_node() == NULL || call_node()->outcnt() == 0 || CallStaticJavaNode* call = call_node();
call_node()->in(0) == NULL || call_node()->in(0)->is_top()) { if (call == NULL || call->outcnt() == 0 ||
call->in(0) == NULL || call->in(0)->is_top()) {
return; return;
} }
const TypeTuple *r = call_node()->tf()->domain(); const TypeTuple *r = call->tf()->domain();
for (int i1 = 0; i1 < method()->arg_size(); i1++) { for (int i1 = 0; i1 < method()->arg_size(); i1++) {
if (call_node()->in(TypeFunc::Parms + i1)->is_top() && r->field_at(TypeFunc::Parms + i1) != Type::HALF) { if (call->in(TypeFunc::Parms + i1)->is_top() && r->field_at(TypeFunc::Parms + i1) != Type::HALF) {
assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing"); assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
return; return;
} }
} }
if (call_node()->in(TypeFunc::Memory)->is_top()) { if (call->in(TypeFunc::Memory)->is_top()) {
assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing"); assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
return; return;
} }
CallStaticJavaNode* call = call_node(); Compile* C = Compile::current();
// Remove inlined methods from Compiler's lists.
if (call->is_macro()) {
C->remove_macro_node(call);
}
// Make a clone of the JVMState that appropriate to use for driving a parse // Make a clone of the JVMState that appropriate to use for driving a parse
Compile* C = Compile::current(); JVMState* old_jvms = call->jvms();
JVMState* jvms = call->jvms()->clone_shallow(C); JVMState* jvms = old_jvms->clone_shallow(C);
uint size = call->req(); uint size = call->req();
SafePointNode* map = new (C) SafePointNode(size, jvms); SafePointNode* map = new (C) SafePointNode(size, jvms);
for (uint i1 = 0; i1 < size; i1++) { for (uint i1 = 0; i1 < size; i1++) {
@ -340,16 +345,23 @@ void LateInlineCallGenerator::do_late_inline() {
map->set_req(TypeFunc::Memory, mem); map->set_req(TypeFunc::Memory, mem);
} }
// Make enough space for the expression stack and transfer the incoming arguments uint nargs = method()->arg_size();
int nargs = method()->arg_size(); // blow away old call arguments
Node* top = C->top();
for (uint i1 = 0; i1 < nargs; i1++) {
map->set_req(TypeFunc::Parms + i1, top);
}
jvms->set_map(map); jvms->set_map(map);
// Make enough space in the expression stack to transfer
// the incoming arguments and return value.
map->ensure_stack(jvms, jvms->method()->max_stack()); map->ensure_stack(jvms, jvms->method()->max_stack());
if (nargs > 0) { for (uint i1 = 0; i1 < nargs; i1++) {
for (int i1 = 0; i1 < nargs; i1++) { map->set_argument(jvms, i1, call->in(TypeFunc::Parms + i1));
map->set_req(i1 + jvms->argoff(), call->in(TypeFunc::Parms + i1));
}
} }
// This check is done here because for_method_handle_inline() method
// needs jvms for inlined state.
if (!do_late_inline_check(jvms)) { if (!do_late_inline_check(jvms)) {
map->disconnect_inputs(NULL, C); map->disconnect_inputs(NULL, C);
return; return;
@ -480,6 +492,26 @@ CallGenerator* CallGenerator::for_string_late_inline(ciMethod* method, CallGener
return new LateInlineStringCallGenerator(method, inline_cg); return new LateInlineStringCallGenerator(method, inline_cg);
} }
class LateInlineBoxingCallGenerator : public LateInlineCallGenerator {
public:
LateInlineBoxingCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
LateInlineCallGenerator(method, inline_cg) {}
virtual JVMState* generate(JVMState* jvms) {
Compile *C = Compile::current();
C->print_inlining_skip(this);
C->add_boxing_late_inline(this);
JVMState* new_jvms = DirectCallGenerator::generate(jvms);
return new_jvms;
}
};
CallGenerator* CallGenerator::for_boxing_late_inline(ciMethod* method, CallGenerator* inline_cg) {
return new LateInlineBoxingCallGenerator(method, inline_cg);
}
//---------------------------WarmCallGenerator-------------------------------- //---------------------------WarmCallGenerator--------------------------------
// Internal class which handles initial deferral of inlining decisions. // Internal class which handles initial deferral of inlining decisions.

View File

@ -125,6 +125,7 @@ class CallGenerator : public ResourceObj {
static CallGenerator* for_late_inline(ciMethod* m, CallGenerator* inline_cg); static CallGenerator* for_late_inline(ciMethod* m, CallGenerator* inline_cg);
static CallGenerator* for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const); static CallGenerator* for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const);
static CallGenerator* for_string_late_inline(ciMethod* m, CallGenerator* inline_cg); static CallGenerator* for_string_late_inline(ciMethod* m, CallGenerator* inline_cg);
static CallGenerator* for_boxing_late_inline(ciMethod* m, CallGenerator* inline_cg);
// How to make a call but defer the decision whether to inline or not. // How to make a call but defer the decision whether to inline or not.
static CallGenerator* for_warm_call(WarmCallInfo* ci, static CallGenerator* for_warm_call(WarmCallInfo* ci,

View File

@ -523,7 +523,9 @@ void JVMState::dump_spec(outputStream *st) const {
void JVMState::dump_on(outputStream* st) const { void JVMState::dump_on(outputStream* st) const {
if (_map && !((uintptr_t)_map & 1)) { bool print_map = _map && !((uintptr_t)_map & 1) &&
((caller() == NULL) || (caller()->map() != _map));
if (print_map) {
if (_map->len() > _map->req()) { // _map->has_exceptions() if (_map->len() > _map->req()) { // _map->has_exceptions()
Node* ex = _map->in(_map->req()); // _map->next_exception() Node* ex = _map->in(_map->req()); // _map->next_exception()
// skip the first one; it's already being printed // skip the first one; it's already being printed
@ -532,7 +534,10 @@ void JVMState::dump_on(outputStream* st) const {
ex->dump(1); ex->dump(1);
} }
} }
_map->dump(2); _map->dump(Verbose ? 2 : 1);
}
if (caller() != NULL) {
caller()->dump_on(st);
} }
st->print("JVMS depth=%d loc=%d stk=%d arg=%d mon=%d scalar=%d end=%d mondepth=%d sp=%d bci=%d reexecute=%s method=", st->print("JVMS depth=%d loc=%d stk=%d arg=%d mon=%d scalar=%d end=%d mondepth=%d sp=%d bci=%d reexecute=%s method=",
depth(), locoff(), stkoff(), argoff(), monoff(), scloff(), endoff(), monitor_depth(), sp(), bci(), should_reexecute()?"true":"false"); depth(), locoff(), stkoff(), argoff(), monoff(), scloff(), endoff(), monitor_depth(), sp(), bci(), should_reexecute()?"true":"false");
@ -546,9 +551,6 @@ void JVMState::dump_on(outputStream* st) const {
_method->print_codes_on(bci(), bci()+1, st); _method->print_codes_on(bci(), bci()+1, st);
} }
} }
if (caller() != NULL) {
caller()->dump_on(st);
}
} }
// Extra way to dump a jvms from the debugger, // Extra way to dump a jvms from the debugger,
@ -584,6 +586,15 @@ JVMState* JVMState::clone_deep(Compile* C) const {
return n; return n;
} }
/**
* Reset map for all callers
*/
void JVMState::set_map_deep(SafePointNode* map) {
for (JVMState* p = this; p->_caller != NULL; p = p->_caller) {
p->set_map(map);
}
}
//============================================================================= //=============================================================================
uint CallNode::cmp( const Node &n ) const uint CallNode::cmp( const Node &n ) const
{ return _tf == ((CallNode&)n)._tf && _jvms == ((CallNode&)n)._jvms; } { return _tf == ((CallNode&)n)._tf && _jvms == ((CallNode&)n)._jvms; }
@ -663,17 +674,49 @@ uint CallNode::match_edge(uint idx) const {
// Determine whether the call could modify the field of the specified // Determine whether the call could modify the field of the specified
// instance at the specified offset. // instance at the specified offset.
// //
bool CallNode::may_modify(const TypePtr *addr_t, PhaseTransform *phase) { bool CallNode::may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase) {
const TypeOopPtr *adrInst_t = addr_t->isa_oopptr(); assert((t_oop != NULL), "sanity");
if (t_oop->is_known_instance()) {
// If not an OopPtr or not an instance type, assume the worst. // The instance_id is set only for scalar-replaceable allocations which
// Note: currently this method is called only for instance types. // are not passed as arguments according to Escape Analysis.
if (adrInst_t == NULL || !adrInst_t->is_known_instance()) { return false;
return true;
} }
// The instance_id is set only for scalar-replaceable allocations which if (t_oop->is_ptr_to_boxed_value()) {
// are not passed as arguments according to Escape Analysis. ciKlass* boxing_klass = t_oop->klass();
return false; if (is_CallStaticJava() && as_CallStaticJava()->is_boxing_method()) {
// Skip unrelated boxing methods.
Node* proj = proj_out(TypeFunc::Parms);
if ((proj == NULL) || (phase->type(proj)->is_instptr()->klass() != boxing_klass)) {
return false;
}
}
if (is_CallJava() && as_CallJava()->method() != NULL) {
ciMethod* meth = as_CallJava()->method();
if (meth->is_accessor()) {
return false;
}
// May modify (by reflection) if an boxing object is passed
// as argument or returned.
if (returns_pointer() && (proj_out(TypeFunc::Parms) != NULL)) {
Node* proj = proj_out(TypeFunc::Parms);
const TypeInstPtr* inst_t = phase->type(proj)->isa_instptr();
if ((inst_t != NULL) && (!inst_t->klass_is_exact() ||
(inst_t->klass() == boxing_klass))) {
return true;
}
}
const TypeTuple* d = tf()->domain();
for (uint i = TypeFunc::Parms; i < d->cnt(); i++) {
const TypeInstPtr* inst_t = d->field_at(i)->isa_instptr();
if ((inst_t != NULL) && (!inst_t->klass_is_exact() ||
(inst_t->klass() == boxing_klass))) {
return true;
}
}
return false;
}
}
return true;
} }
// Does this call have a direct reference to n other than debug information? // Does this call have a direct reference to n other than debug information?
@ -1020,6 +1063,7 @@ void SafePointNode::grow_stack(JVMState* jvms, uint grow_by) {
int scloff = jvms->scloff(); int scloff = jvms->scloff();
int endoff = jvms->endoff(); int endoff = jvms->endoff();
assert(endoff == (int)req(), "no other states or debug info after me"); assert(endoff == (int)req(), "no other states or debug info after me");
assert(jvms->scl_size() == 0, "parsed code should not have scalar objects");
Node* top = Compile::current()->top(); Node* top = Compile::current()->top();
for (uint i = 0; i < grow_by; i++) { for (uint i = 0; i < grow_by; i++) {
ins_req(monoff, top); ins_req(monoff, top);
@ -1035,6 +1079,7 @@ void SafePointNode::push_monitor(const FastLockNode *lock) {
const int MonitorEdges = 2; const int MonitorEdges = 2;
assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges"); assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges");
assert(req() == jvms()->endoff(), "correct sizing"); assert(req() == jvms()->endoff(), "correct sizing");
assert((jvms()->scl_size() == 0), "parsed code should not have scalar objects");
int nextmon = jvms()->scloff(); int nextmon = jvms()->scloff();
if (GenerateSynchronizationCode) { if (GenerateSynchronizationCode) {
add_req(lock->box_node()); add_req(lock->box_node());
@ -1050,6 +1095,7 @@ void SafePointNode::push_monitor(const FastLockNode *lock) {
void SafePointNode::pop_monitor() { void SafePointNode::pop_monitor() {
// Delete last monitor from debug info // Delete last monitor from debug info
assert((jvms()->scl_size() == 0), "parsed code should not have scalar objects");
debug_only(int num_before_pop = jvms()->nof_monitors()); debug_only(int num_before_pop = jvms()->nof_monitors());
const int MonitorEdges = (1<<JVMState::logMonitorEdges); const int MonitorEdges = (1<<JVMState::logMonitorEdges);
int scloff = jvms()->scloff(); int scloff = jvms()->scloff();
@ -1154,6 +1200,7 @@ AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype,
init_class_id(Class_Allocate); init_class_id(Class_Allocate);
init_flags(Flag_is_macro); init_flags(Flag_is_macro);
_is_scalar_replaceable = false; _is_scalar_replaceable = false;
_is_non_escaping = false;
Node *topnode = C->top(); Node *topnode = C->top();
init_req( TypeFunc::Control , ctrl ); init_req( TypeFunc::Control , ctrl );
@ -1169,8 +1216,6 @@ AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype,
} }
//============================================================================= //=============================================================================
uint AllocateArrayNode::size_of() const { return sizeof(*this); }
Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if (remove_dead_region(phase, can_reshape)) return this; if (remove_dead_region(phase, can_reshape)) return this;
// Don't bother trying to transform a dead node // Don't bother trying to transform a dead node
@ -1235,6 +1280,8 @@ Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseTran
// - the narrow_length is 0 // - the narrow_length is 0
// - the narrow_length is not wider than length // - the narrow_length is not wider than length
assert(narrow_length_type == TypeInt::ZERO || assert(narrow_length_type == TypeInt::ZERO ||
length_type->is_con() && narrow_length_type->is_con() &&
(narrow_length_type->_hi <= length_type->_lo) ||
(narrow_length_type->_hi <= length_type->_hi && (narrow_length_type->_hi <= length_type->_hi &&
narrow_length_type->_lo >= length_type->_lo), narrow_length_type->_lo >= length_type->_lo),
"narrow type must be narrower than length type"); "narrow type must be narrower than length type");

View File

@ -49,6 +49,7 @@ class CallLeafNode;
class CallLeafNoFPNode; class CallLeafNoFPNode;
class AllocateNode; class AllocateNode;
class AllocateArrayNode; class AllocateArrayNode;
class BoxLockNode;
class LockNode; class LockNode;
class UnlockNode; class UnlockNode;
class JVMState; class JVMState;
@ -235,7 +236,6 @@ public:
int loc_size() const { return stkoff() - locoff(); } int loc_size() const { return stkoff() - locoff(); }
int stk_size() const { return monoff() - stkoff(); } int stk_size() const { return monoff() - stkoff(); }
int arg_size() const { return monoff() - argoff(); }
int mon_size() const { return scloff() - monoff(); } int mon_size() const { return scloff() - monoff(); }
int scl_size() const { return endoff() - scloff(); } int scl_size() const { return endoff() - scloff(); }
@ -298,6 +298,7 @@ public:
// Miscellaneous utility functions // Miscellaneous utility functions
JVMState* clone_deep(Compile* C) const; // recursively clones caller chain JVMState* clone_deep(Compile* C) const; // recursively clones caller chain
JVMState* clone_shallow(Compile* C) const; // retains uncloned caller JVMState* clone_shallow(Compile* C) const; // retains uncloned caller
void set_map_deep(SafePointNode *map);// reset map for all callers
#ifndef PRODUCT #ifndef PRODUCT
void format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) const; void format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) const;
@ -439,7 +440,7 @@ public:
static bool needs_polling_address_input(); static bool needs_polling_address_input();
#ifndef PRODUCT #ifndef PRODUCT
virtual void dump_spec(outputStream *st) const; virtual void dump_spec(outputStream *st) const;
#endif #endif
}; };
@ -554,10 +555,10 @@ public:
virtual bool guaranteed_safepoint() { return true; } virtual bool guaranteed_safepoint() { return true; }
// For macro nodes, the JVMState gets modified during expansion, so when cloning // For macro nodes, the JVMState gets modified during expansion, so when cloning
// the node the JVMState must be cloned. // the node the JVMState must be cloned.
virtual void clone_jvms() { } // default is not to clone virtual void clone_jvms(Compile* C) { } // default is not to clone
// Returns true if the call may modify n // Returns true if the call may modify n
virtual bool may_modify(const TypePtr *addr_t, PhaseTransform *phase); virtual bool may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase);
// Does this node have a use of n other than in debug information? // Does this node have a use of n other than in debug information?
bool has_non_debug_use(Node *n); bool has_non_debug_use(Node *n);
// Returns the unique CheckCastPP of a call // Returns the unique CheckCastPP of a call
@ -630,9 +631,15 @@ class CallStaticJavaNode : public CallJavaNode {
virtual uint cmp( const Node &n ) const; virtual uint cmp( const Node &n ) const;
virtual uint size_of() const; // Size is bigger virtual uint size_of() const; // Size is bigger
public: public:
CallStaticJavaNode(const TypeFunc* tf, address addr, ciMethod* method, int bci) CallStaticJavaNode(Compile* C, const TypeFunc* tf, address addr, ciMethod* method, int bci)
: CallJavaNode(tf, addr, method, bci), _name(NULL) { : CallJavaNode(tf, addr, method, bci), _name(NULL) {
init_class_id(Class_CallStaticJava); init_class_id(Class_CallStaticJava);
if (C->eliminate_boxing() && (method != NULL) && method->is_boxing_method()) {
init_flags(Flag_is_macro);
C->add_macro_node(this);
}
_is_scalar_replaceable = false;
_is_non_escaping = false;
} }
CallStaticJavaNode(const TypeFunc* tf, address addr, const char* name, int bci, CallStaticJavaNode(const TypeFunc* tf, address addr, const char* name, int bci,
const TypePtr* adr_type) const TypePtr* adr_type)
@ -640,13 +647,31 @@ public:
init_class_id(Class_CallStaticJava); init_class_id(Class_CallStaticJava);
// This node calls a runtime stub, which often has narrow memory effects. // This node calls a runtime stub, which often has narrow memory effects.
_adr_type = adr_type; _adr_type = adr_type;
_is_scalar_replaceable = false;
_is_non_escaping = false;
} }
const char *_name; // Runtime wrapper name const char *_name; // Runtime wrapper name
// Result of Escape Analysis
bool _is_scalar_replaceable;
bool _is_non_escaping;
// If this is an uncommon trap, return the request code, else zero. // If this is an uncommon trap, return the request code, else zero.
int uncommon_trap_request() const; int uncommon_trap_request() const;
static int extract_uncommon_trap_request(const Node* call); static int extract_uncommon_trap_request(const Node* call);
bool is_boxing_method() const {
return is_macro() && (method() != NULL) && method()->is_boxing_method();
}
// Later inlining modifies the JVMState, so we need to clone it
// when the call node is cloned (because it is macro node).
virtual void clone_jvms(Compile* C) {
if ((jvms() != NULL) && is_boxing_method()) {
set_jvms(jvms()->clone_deep(C));
jvms()->set_map_deep(this);
}
}
virtual int Opcode() const; virtual int Opcode() const;
#ifndef PRODUCT #ifndef PRODUCT
virtual void dump_spec(outputStream *st) const; virtual void dump_spec(outputStream *st) const;
@ -748,12 +773,12 @@ public:
ParmLimit ParmLimit
}; };
static const TypeFunc* alloc_type() { static const TypeFunc* alloc_type(const Type* t) {
const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms); const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms);
fields[AllocSize] = TypeInt::POS; fields[AllocSize] = TypeInt::POS;
fields[KlassNode] = TypeInstPtr::NOTNULL; fields[KlassNode] = TypeInstPtr::NOTNULL;
fields[InitialTest] = TypeInt::BOOL; fields[InitialTest] = TypeInt::BOOL;
fields[ALength] = TypeInt::INT; // length (can be a bad length) fields[ALength] = t; // length (can be a bad length)
const TypeTuple *domain = TypeTuple::make(ParmLimit, fields); const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
@ -766,21 +791,26 @@ public:
return TypeFunc::make(domain, range); return TypeFunc::make(domain, range);
} }
bool _is_scalar_replaceable; // Result of Escape Analysis // Result of Escape Analysis
bool _is_scalar_replaceable;
bool _is_non_escaping;
virtual uint size_of() const; // Size is bigger virtual uint size_of() const; // Size is bigger
AllocateNode(Compile* C, const TypeFunc *atype, Node *ctrl, Node *mem, Node *abio, AllocateNode(Compile* C, const TypeFunc *atype, Node *ctrl, Node *mem, Node *abio,
Node *size, Node *klass_node, Node *initial_test); Node *size, Node *klass_node, Node *initial_test);
// Expansion modifies the JVMState, so we need to clone it // Expansion modifies the JVMState, so we need to clone it
virtual void clone_jvms() { virtual void clone_jvms(Compile* C) {
set_jvms(jvms()->clone_deep(Compile::current())); if (jvms() != NULL) {
set_jvms(jvms()->clone_deep(C));
jvms()->set_map_deep(this);
}
} }
virtual int Opcode() const; virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegP; } virtual uint ideal_reg() const { return Op_RegP; }
virtual bool guaranteed_safepoint() { return false; } virtual bool guaranteed_safepoint() { return false; }
// allocations do not modify their arguments // allocations do not modify their arguments
virtual bool may_modify(const TypePtr *addr_t, PhaseTransform *phase) { return false;} virtual bool may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase) { return false;}
// Pattern-match a possible usage of AllocateNode. // Pattern-match a possible usage of AllocateNode.
// Return null if no allocation is recognized. // Return null if no allocation is recognized.
@ -815,10 +845,6 @@ public:
// are defined in graphKit.cpp, which sets up the bidirectional relation.) // are defined in graphKit.cpp, which sets up the bidirectional relation.)
InitializeNode* initialization(); InitializeNode* initialization();
// Return the corresponding storestore barrier (or null if none).
// Walks out edges to find it...
MemBarStoreStoreNode* storestore();
// Convenience for initialization->maybe_set_complete(phase) // Convenience for initialization->maybe_set_complete(phase)
bool maybe_set_complete(PhaseGVN* phase); bool maybe_set_complete(PhaseGVN* phase);
}; };
@ -840,7 +866,6 @@ public:
set_req(AllocateNode::ALength, count_val); set_req(AllocateNode::ALength, count_val);
} }
virtual int Opcode() const; virtual int Opcode() const;
virtual uint size_of() const; // Size is bigger
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
// Dig the length operand out of a array allocation site. // Dig the length operand out of a array allocation site.
@ -918,7 +943,7 @@ public:
void set_nested() { _kind = Nested; set_eliminated_lock_counter(); } void set_nested() { _kind = Nested; set_eliminated_lock_counter(); }
// locking does not modify its arguments // locking does not modify its arguments
virtual bool may_modify(const TypePtr *addr_t, PhaseTransform *phase){ return false;} virtual bool may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase){ return false;}
#ifndef PRODUCT #ifndef PRODUCT
void create_lock_counter(JVMState* s); void create_lock_counter(JVMState* s);
@ -965,8 +990,11 @@ public:
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
// Expansion modifies the JVMState, so we need to clone it // Expansion modifies the JVMState, so we need to clone it
virtual void clone_jvms() { virtual void clone_jvms(Compile* C) {
set_jvms(jvms()->clone_deep(Compile::current())); if (jvms() != NULL) {
set_jvms(jvms()->clone_deep(C));
jvms()->set_map_deep(this);
}
} }
bool is_nested_lock_region(); // Is this Lock nested? bool is_nested_lock_region(); // Is this Lock nested?

View File

@ -806,7 +806,7 @@ PhiNode* PhiNode::split_out_instance(const TypePtr* at, PhaseIterGVN *igvn) cons
Node *in = ophi->in(i); Node *in = ophi->in(i);
if (in == NULL || igvn->type(in) == Type::TOP) if (in == NULL || igvn->type(in) == Type::TOP)
continue; continue;
Node *opt = MemNode::optimize_simple_memory_chain(in, at, igvn); Node *opt = MemNode::optimize_simple_memory_chain(in, t_oop, NULL, igvn);
PhiNode *optphi = opt->is_Phi() ? opt->as_Phi() : NULL; PhiNode *optphi = opt->is_Phi() ? opt->as_Phi() : NULL;
if (optphi != NULL && optphi->adr_type() == TypePtr::BOTTOM) { if (optphi != NULL && optphi->adr_type() == TypePtr::BOTTOM) {
opt = node_map[optphi->_idx]; opt = node_map[optphi->_idx];
@ -1921,7 +1921,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
const TypePtr* at = adr_type(); const TypePtr* at = adr_type();
for( uint i=1; i<req(); ++i ) {// For all paths in for( uint i=1; i<req(); ++i ) {// For all paths in
Node *ii = in(i); Node *ii = in(i);
Node *new_in = MemNode::optimize_memory_chain(ii, at, phase); Node *new_in = MemNode::optimize_memory_chain(ii, at, NULL, phase);
if (ii != new_in ) { if (ii != new_in ) {
set_req(i, new_in); set_req(i, new_in);
progress = this; progress = this;

View File

@ -418,6 +418,7 @@ void Compile::remove_useless_nodes(Unique_Node_List &useful) {
} }
// clean up the late inline lists // clean up the late inline lists
remove_useless_late_inlines(&_string_late_inlines, useful); remove_useless_late_inlines(&_string_late_inlines, useful);
remove_useless_late_inlines(&_boxing_late_inlines, useful);
remove_useless_late_inlines(&_late_inlines, useful); remove_useless_late_inlines(&_late_inlines, useful);
debug_only(verify_graph_edges(true/*check for no_dead_code*/);) debug_only(verify_graph_edges(true/*check for no_dead_code*/);)
} }
@ -485,6 +486,12 @@ void Compile::print_compile_messages() {
tty->print_cr("** Bailout: Recompile without escape analysis **"); tty->print_cr("** Bailout: Recompile without escape analysis **");
tty->print_cr("*********************************************************"); tty->print_cr("*********************************************************");
} }
if (_eliminate_boxing != EliminateAutoBox && PrintOpto) {
// Recompiling without boxing elimination
tty->print_cr("*********************************************************");
tty->print_cr("** Bailout: Recompile without boxing elimination **");
tty->print_cr("*********************************************************");
}
if (env()->break_at_compile()) { if (env()->break_at_compile()) {
// Open the debugger when compiling this method. // Open the debugger when compiling this method.
tty->print("### Breaking when compiling: "); tty->print("### Breaking when compiling: ");
@ -601,7 +608,8 @@ debug_only( int Compile::_debug_idx = 100000; )
// the continuation bci for on stack replacement. // the continuation bci for on stack replacement.
Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr_bci, bool subsume_loads, bool do_escape_analysis ) Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr_bci,
bool subsume_loads, bool do_escape_analysis, bool eliminate_boxing )
: Phase(Compiler), : Phase(Compiler),
_env(ci_env), _env(ci_env),
_log(ci_env->log()), _log(ci_env->log()),
@ -617,6 +625,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
_warm_calls(NULL), _warm_calls(NULL),
_subsume_loads(subsume_loads), _subsume_loads(subsume_loads),
_do_escape_analysis(do_escape_analysis), _do_escape_analysis(do_escape_analysis),
_eliminate_boxing(eliminate_boxing),
_failure_reason(NULL), _failure_reason(NULL),
_code_buffer("Compile::Fill_buffer"), _code_buffer("Compile::Fill_buffer"),
_orig_pc_slot(0), _orig_pc_slot(0),
@ -638,6 +647,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
_congraph(NULL), _congraph(NULL),
_late_inlines(comp_arena(), 2, 0, NULL), _late_inlines(comp_arena(), 2, 0, NULL),
_string_late_inlines(comp_arena(), 2, 0, NULL), _string_late_inlines(comp_arena(), 2, 0, NULL),
_boxing_late_inlines(comp_arena(), 2, 0, NULL),
_late_inlines_pos(0), _late_inlines_pos(0),
_number_of_mh_late_inlines(0), _number_of_mh_late_inlines(0),
_inlining_progress(false), _inlining_progress(false),
@ -906,6 +916,7 @@ Compile::Compile( ciEnv* ci_env,
_orig_pc_slot_offset_in_bytes(0), _orig_pc_slot_offset_in_bytes(0),
_subsume_loads(true), _subsume_loads(true),
_do_escape_analysis(false), _do_escape_analysis(false),
_eliminate_boxing(false),
_failure_reason(NULL), _failure_reason(NULL),
_code_buffer("Compile::Fill_buffer"), _code_buffer("Compile::Fill_buffer"),
_has_method_handle_invokes(false), _has_method_handle_invokes(false),
@ -1016,6 +1027,7 @@ void Compile::Init(int aliaslevel) {
set_has_split_ifs(false); set_has_split_ifs(false);
set_has_loops(has_method() && method()->has_loops()); // first approximation set_has_loops(has_method() && method()->has_loops()); // first approximation
set_has_stringbuilder(false); set_has_stringbuilder(false);
set_has_boxed_value(false);
_trap_can_recompile = false; // no traps emitted yet _trap_can_recompile = false; // no traps emitted yet
_major_progress = true; // start out assuming good things will happen _major_progress = true; // start out assuming good things will happen
set_has_unsafe_access(false); set_has_unsafe_access(false);
@ -1807,6 +1819,38 @@ void Compile::inline_string_calls(bool parse_time) {
_string_late_inlines.trunc_to(0); _string_late_inlines.trunc_to(0);
} }
// Late inlining of boxing methods
void Compile::inline_boxing_calls(PhaseIterGVN& igvn) {
if (_boxing_late_inlines.length() > 0) {
assert(has_boxed_value(), "inconsistent");
PhaseGVN* gvn = initial_gvn();
set_inlining_incrementally(true);
assert( igvn._worklist.size() == 0, "should be done with igvn" );
for_igvn()->clear();
gvn->replace_with(&igvn);
while (_boxing_late_inlines.length() > 0) {
CallGenerator* cg = _boxing_late_inlines.pop();
cg->do_late_inline();
if (failing()) return;
}
_boxing_late_inlines.trunc_to(0);
{
ResourceMark rm;
PhaseRemoveUseless pru(gvn, for_igvn());
}
igvn = PhaseIterGVN(gvn);
igvn.optimize();
set_inlining_progress(false);
set_inlining_incrementally(false);
}
}
void Compile::inline_incrementally_one(PhaseIterGVN& igvn) { void Compile::inline_incrementally_one(PhaseIterGVN& igvn) {
assert(IncrementalInline, "incremental inlining should be on"); assert(IncrementalInline, "incremental inlining should be on");
PhaseGVN* gvn = initial_gvn(); PhaseGVN* gvn = initial_gvn();
@ -1831,7 +1875,7 @@ void Compile::inline_incrementally_one(PhaseIterGVN& igvn) {
{ {
ResourceMark rm; ResourceMark rm;
PhaseRemoveUseless pru(C->initial_gvn(), C->for_igvn()); PhaseRemoveUseless pru(gvn, for_igvn());
} }
igvn = PhaseIterGVN(gvn); igvn = PhaseIterGVN(gvn);
@ -1929,12 +1973,25 @@ void Compile::Optimize() {
if (failing()) return; if (failing()) return;
inline_incrementally(igvn); {
NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
inline_incrementally(igvn);
}
print_method("Incremental Inline", 2); print_method("Incremental Inline", 2);
if (failing()) return; if (failing()) return;
if (eliminate_boxing()) {
NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
// Inline valueOf() methods now.
inline_boxing_calls(igvn);
print_method("Incremental Boxing Inline", 2);
if (failing()) return;
}
// No more new expensive nodes will be added to the list from here // No more new expensive nodes will be added to the list from here
// so keep only the actual candidates for optimizations. // so keep only the actual candidates for optimizations.
cleanup_expensive_nodes(igvn); cleanup_expensive_nodes(igvn);
@ -2896,6 +2953,7 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
} }
break; break;
case Op_MemBarStoreStore: case Op_MemBarStoreStore:
case Op_MemBarRelease:
// Break the link with AllocateNode: it is no longer useful and // Break the link with AllocateNode: it is no longer useful and
// confuses register allocation. // confuses register allocation.
if (n->req() > MemBarNode::Precedent) { if (n->req() > MemBarNode::Precedent) {

View File

@ -262,6 +262,7 @@ class Compile : public Phase {
const bool _save_argument_registers; // save/restore arg regs for trampolines const bool _save_argument_registers; // save/restore arg regs for trampolines
const bool _subsume_loads; // Load can be matched as part of a larger op. const bool _subsume_loads; // Load can be matched as part of a larger op.
const bool _do_escape_analysis; // Do escape analysis. const bool _do_escape_analysis; // Do escape analysis.
const bool _eliminate_boxing; // Do boxing elimination.
ciMethod* _method; // The method being compiled. ciMethod* _method; // The method being compiled.
int _entry_bci; // entry bci for osr methods. int _entry_bci; // entry bci for osr methods.
const TypeFunc* _tf; // My kind of signature const TypeFunc* _tf; // My kind of signature
@ -287,6 +288,7 @@ class Compile : public Phase {
bool _has_split_ifs; // True if the method _may_ have some split-if bool _has_split_ifs; // True if the method _may_ have some split-if
bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores. bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores.
bool _has_stringbuilder; // True StringBuffers or StringBuilders are allocated bool _has_stringbuilder; // True StringBuffers or StringBuilders are allocated
bool _has_boxed_value; // True if a boxed object is allocated
int _max_vector_size; // Maximum size of generated vectors int _max_vector_size; // Maximum size of generated vectors
uint _trap_hist[trapHistLength]; // Cumulative traps uint _trap_hist[trapHistLength]; // Cumulative traps
bool _trap_can_recompile; // Have we emitted a recompiling trap? bool _trap_can_recompile; // Have we emitted a recompiling trap?
@ -375,6 +377,8 @@ class Compile : public Phase {
// main parsing has finished. // main parsing has finished.
GrowableArray<CallGenerator*> _string_late_inlines; // same but for string operations GrowableArray<CallGenerator*> _string_late_inlines; // same but for string operations
GrowableArray<CallGenerator*> _boxing_late_inlines; // same but for boxing operations
int _late_inlines_pos; // Where in the queue should the next late inlining candidate go (emulate depth first inlining) int _late_inlines_pos; // Where in the queue should the next late inlining candidate go (emulate depth first inlining)
uint _number_of_mh_late_inlines; // number of method handle late inlining still pending uint _number_of_mh_late_inlines; // number of method handle late inlining still pending
@ -486,8 +490,12 @@ class Compile : public Phase {
// instructions that subsume a load may result in an unschedulable // instructions that subsume a load may result in an unschedulable
// instruction sequence. // instruction sequence.
bool subsume_loads() const { return _subsume_loads; } bool subsume_loads() const { return _subsume_loads; }
// Do escape analysis. /** Do escape analysis. */
bool do_escape_analysis() const { return _do_escape_analysis; } bool do_escape_analysis() const { return _do_escape_analysis; }
/** Do boxing elimination. */
bool eliminate_boxing() const { return _eliminate_boxing; }
/** Do aggressive boxing elimination. */
bool aggressive_unboxing() const { return _eliminate_boxing && AggressiveUnboxing; }
bool save_argument_registers() const { return _save_argument_registers; } bool save_argument_registers() const { return _save_argument_registers; }
@ -527,6 +535,8 @@ class Compile : public Phase {
void set_has_unsafe_access(bool z) { _has_unsafe_access = z; } void set_has_unsafe_access(bool z) { _has_unsafe_access = z; }
bool has_stringbuilder() const { return _has_stringbuilder; } bool has_stringbuilder() const { return _has_stringbuilder; }
void set_has_stringbuilder(bool z) { _has_stringbuilder = z; } void set_has_stringbuilder(bool z) { _has_stringbuilder = z; }
bool has_boxed_value() const { return _has_boxed_value; }
void set_has_boxed_value(bool z) { _has_boxed_value = z; }
int max_vector_size() const { return _max_vector_size; } int max_vector_size() const { return _max_vector_size; }
void set_max_vector_size(int s) { _max_vector_size = s; } void set_max_vector_size(int s) { _max_vector_size = s; }
void set_trap_count(uint r, uint c) { assert(r < trapHistLength, "oob"); _trap_hist[r] = c; } void set_trap_count(uint r, uint c) { assert(r < trapHistLength, "oob"); _trap_hist[r] = c; }
@ -579,12 +589,12 @@ class Compile : public Phase {
#endif #endif
} }
int macro_count() { return _macro_nodes->length(); } int macro_count() const { return _macro_nodes->length(); }
int predicate_count() { return _predicate_opaqs->length();} int predicate_count() const { return _predicate_opaqs->length();}
int expensive_count() { return _expensive_nodes->length(); } int expensive_count() const { return _expensive_nodes->length(); }
Node* macro_node(int idx) { return _macro_nodes->at(idx); } Node* macro_node(int idx) const { return _macro_nodes->at(idx); }
Node* predicate_opaque1_node(int idx) { return _predicate_opaqs->at(idx);} Node* predicate_opaque1_node(int idx) const { return _predicate_opaqs->at(idx);}
Node* expensive_node(int idx) { return _expensive_nodes->at(idx); } Node* expensive_node(int idx) const { return _expensive_nodes->at(idx); }
ConnectionGraph* congraph() { return _congraph;} ConnectionGraph* congraph() { return _congraph;}
void set_congraph(ConnectionGraph* congraph) { _congraph = congraph;} void set_congraph(ConnectionGraph* congraph) { _congraph = congraph;}
void add_macro_node(Node * n) { void add_macro_node(Node * n) {
@ -766,7 +776,12 @@ class Compile : public Phase {
// Decide how to build a call. // Decide how to build a call.
// The profile factor is a discount to apply to this site's interp. profile. // The profile factor is a discount to apply to this site's interp. profile.
CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true, bool delayed_forbidden = false); CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true, bool delayed_forbidden = false);
bool should_delay_inlining(ciMethod* call_method, JVMState* jvms); bool should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
return should_delay_string_inlining(call_method, jvms) ||
should_delay_boxing_inlining(call_method, jvms);
}
bool should_delay_string_inlining(ciMethod* call_method, JVMState* jvms);
bool should_delay_boxing_inlining(ciMethod* call_method, JVMState* jvms);
// Helper functions to identify inlining potential at call-site // Helper functions to identify inlining potential at call-site
ciMethod* optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass, ciMethod* optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass,
@ -822,6 +837,10 @@ class Compile : public Phase {
_string_late_inlines.push(cg); _string_late_inlines.push(cg);
} }
void add_boxing_late_inline(CallGenerator* cg) {
_boxing_late_inlines.push(cg);
}
void remove_useless_late_inlines(GrowableArray<CallGenerator*>* inlines, Unique_Node_List &useful); void remove_useless_late_inlines(GrowableArray<CallGenerator*>* inlines, Unique_Node_List &useful);
void dump_inlining(); void dump_inlining();
@ -841,6 +860,7 @@ class Compile : public Phase {
void inline_incrementally_one(PhaseIterGVN& igvn); void inline_incrementally_one(PhaseIterGVN& igvn);
void inline_incrementally(PhaseIterGVN& igvn); void inline_incrementally(PhaseIterGVN& igvn);
void inline_string_calls(bool parse_time); void inline_string_calls(bool parse_time);
void inline_boxing_calls(PhaseIterGVN& igvn);
// Matching, CFG layout, allocation, code generation // Matching, CFG layout, allocation, code generation
PhaseCFG* cfg() { return _cfg; } PhaseCFG* cfg() { return _cfg; }
@ -913,7 +933,8 @@ class Compile : public Phase {
// replacement, entry_bci indicates the bytecode for which to compile a // replacement, entry_bci indicates the bytecode for which to compile a
// continuation. // continuation.
Compile(ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, Compile(ciEnv* ci_env, C2Compiler* compiler, ciMethod* target,
int entry_bci, bool subsume_loads, bool do_escape_analysis); int entry_bci, bool subsume_loads, bool do_escape_analysis,
bool eliminate_boxing);
// Second major entry point. From the TypeFunc signature, generate code // Second major entry point. From the TypeFunc signature, generate code
// to pass arguments from the Java calling convention to the C calling // to pass arguments from the Java calling convention to the C calling

View File

@ -176,9 +176,12 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
// Delay the inlining of this method to give us the // Delay the inlining of this method to give us the
// opportunity to perform some high level optimizations // opportunity to perform some high level optimizations
// first. // first.
if (should_delay_inlining(callee, jvms)) { if (should_delay_string_inlining(callee, jvms)) {
assert(!delayed_forbidden, "strange"); assert(!delayed_forbidden, "strange");
return CallGenerator::for_string_late_inline(callee, cg); return CallGenerator::for_string_late_inline(callee, cg);
} else if (should_delay_boxing_inlining(callee, jvms)) {
assert(!delayed_forbidden, "strange");
return CallGenerator::for_boxing_late_inline(callee, cg);
} else if ((should_delay || AlwaysIncrementalInline) && !delayed_forbidden) { } else if ((should_delay || AlwaysIncrementalInline) && !delayed_forbidden) {
return CallGenerator::for_late_inline(callee, cg); return CallGenerator::for_late_inline(callee, cg);
} }
@ -276,7 +279,7 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
// Return true for methods that shouldn't be inlined early so that // Return true for methods that shouldn't be inlined early so that
// they are easier to analyze and optimize as intrinsics. // they are easier to analyze and optimize as intrinsics.
bool Compile::should_delay_inlining(ciMethod* call_method, JVMState* jvms) { bool Compile::should_delay_string_inlining(ciMethod* call_method, JVMState* jvms) {
if (has_stringbuilder()) { if (has_stringbuilder()) {
if ((call_method->holder() == C->env()->StringBuilder_klass() || if ((call_method->holder() == C->env()->StringBuilder_klass() ||
@ -327,6 +330,13 @@ bool Compile::should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
return false; return false;
} }
bool Compile::should_delay_boxing_inlining(ciMethod* call_method, JVMState* jvms) {
if (eliminate_boxing() && call_method->is_boxing_method()) {
set_has_boxed_value(true);
return true;
}
return false;
}
// uncommon-trap call-sites where callee is unloaded, uninitialized or will not link // uncommon-trap call-sites where callee is unloaded, uninitialized or will not link
bool Parse::can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass* klass) { bool Parse::can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass* klass) {

View File

@ -63,15 +63,19 @@ bool ConnectionGraph::has_candidates(Compile *C) {
// EA brings benefits only when the code has allocations and/or locks which // EA brings benefits only when the code has allocations and/or locks which
// are represented by ideal Macro nodes. // are represented by ideal Macro nodes.
int cnt = C->macro_count(); int cnt = C->macro_count();
for( int i=0; i < cnt; i++ ) { for (int i = 0; i < cnt; i++) {
Node *n = C->macro_node(i); Node *n = C->macro_node(i);
if ( n->is_Allocate() ) if (n->is_Allocate())
return true; return true;
if( n->is_Lock() ) { if (n->is_Lock()) {
Node* obj = n->as_Lock()->obj_node()->uncast(); Node* obj = n->as_Lock()->obj_node()->uncast();
if( !(obj->is_Parm() || obj->is_Con()) ) if (!(obj->is_Parm() || obj->is_Con()))
return true; return true;
} }
if (n->is_CallStaticJava() &&
n->as_CallStaticJava()->is_boxing_method()) {
return true;
}
} }
return false; return false;
} }
@ -115,7 +119,7 @@ bool ConnectionGraph::compute_escape() {
{ Compile::TracePhase t3("connectionGraph", &Phase::_t_connectionGraph, true); { Compile::TracePhase t3("connectionGraph", &Phase::_t_connectionGraph, true);
// 1. Populate Connection Graph (CG) with PointsTo nodes. // 1. Populate Connection Graph (CG) with PointsTo nodes.
ideal_nodes.map(C->unique(), NULL); // preallocate space ideal_nodes.map(C->live_nodes(), NULL); // preallocate space
// Initialize worklist // Initialize worklist
if (C->root() != NULL) { if (C->root() != NULL) {
ideal_nodes.push(C->root()); ideal_nodes.push(C->root());
@ -152,8 +156,11 @@ bool ConnectionGraph::compute_escape() {
// escape status of the associated Allocate node some of them // escape status of the associated Allocate node some of them
// may be eliminated. // may be eliminated.
storestore_worklist.append(n); storestore_worklist.append(n);
} else if (n->is_MemBar() && (n->Opcode() == Op_MemBarRelease) &&
(n->req() > MemBarNode::Precedent)) {
record_for_optimizer(n);
#ifdef ASSERT #ifdef ASSERT
} else if(n->is_AddP()) { } else if (n->is_AddP()) {
// Collect address nodes for graph verification. // Collect address nodes for graph verification.
addp_worklist.append(n); addp_worklist.append(n);
#endif #endif
@ -206,8 +213,15 @@ bool ConnectionGraph::compute_escape() {
int non_escaped_length = non_escaped_worklist.length(); int non_escaped_length = non_escaped_worklist.length();
for (int next = 0; next < non_escaped_length; next++) { for (int next = 0; next < non_escaped_length; next++) {
JavaObjectNode* ptn = non_escaped_worklist.at(next); JavaObjectNode* ptn = non_escaped_worklist.at(next);
if (ptn->escape_state() == PointsToNode::NoEscape && bool noescape = (ptn->escape_state() == PointsToNode::NoEscape);
ptn->scalar_replaceable()) { Node* n = ptn->ideal_node();
if (n->is_Allocate()) {
n->as_Allocate()->_is_non_escaping = noescape;
}
if (n->is_CallStaticJava()) {
n->as_CallStaticJava()->_is_non_escaping = noescape;
}
if (noescape && ptn->scalar_replaceable()) {
adjust_scalar_replaceable_state(ptn); adjust_scalar_replaceable_state(ptn);
if (ptn->scalar_replaceable()) { if (ptn->scalar_replaceable()) {
alloc_worklist.append(ptn->ideal_node()); alloc_worklist.append(ptn->ideal_node());
@ -330,8 +344,10 @@ void ConnectionGraph::add_node_to_connection_graph(Node *n, Unique_Node_List *de
// Don't mark as processed since call's arguments have to be processed. // Don't mark as processed since call's arguments have to be processed.
delayed_worklist->push(n); delayed_worklist->push(n);
// Check if a call returns an object. // Check if a call returns an object.
if (n->as_Call()->returns_pointer() && if ((n->as_Call()->returns_pointer() &&
n->as_Call()->proj_out(TypeFunc::Parms) != NULL) { n->as_Call()->proj_out(TypeFunc::Parms) != NULL) ||
(n->is_CallStaticJava() &&
n->as_CallStaticJava()->is_boxing_method())) {
add_call_node(n->as_Call()); add_call_node(n->as_Call());
} }
} }
@ -387,8 +403,8 @@ void ConnectionGraph::add_node_to_connection_graph(Node *n, Unique_Node_List *de
case Op_ConNKlass: { case Op_ConNKlass: {
// assume all oop constants globally escape except for null // assume all oop constants globally escape except for null
PointsToNode::EscapeState es; PointsToNode::EscapeState es;
if (igvn->type(n) == TypePtr::NULL_PTR || const Type* t = igvn->type(n);
igvn->type(n) == TypeNarrowOop::NULL_PTR) { if (t == TypePtr::NULL_PTR || t == TypeNarrowOop::NULL_PTR) {
es = PointsToNode::NoEscape; es = PointsToNode::NoEscape;
} else { } else {
es = PointsToNode::GlobalEscape; es = PointsToNode::GlobalEscape;
@ -468,6 +484,9 @@ void ConnectionGraph::add_node_to_connection_graph(Node *n, Unique_Node_List *de
Node* adr = n->in(MemNode::Address); Node* adr = n->in(MemNode::Address);
const Type *adr_type = igvn->type(adr); const Type *adr_type = igvn->type(adr);
adr_type = adr_type->make_ptr(); adr_type = adr_type->make_ptr();
if (adr_type == NULL) {
break; // skip dead nodes
}
if (adr_type->isa_oopptr() || if (adr_type->isa_oopptr() ||
(opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) && (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) &&
(adr_type == TypeRawPtr::NOTNULL && (adr_type == TypeRawPtr::NOTNULL &&
@ -660,14 +679,18 @@ void ConnectionGraph::add_final_edges(Node *n) {
case Op_GetAndSetP: case Op_GetAndSetP:
case Op_GetAndSetN: { case Op_GetAndSetN: {
Node* adr = n->in(MemNode::Address); Node* adr = n->in(MemNode::Address);
if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN) {
const Type* t = _igvn->type(n);
if (t->make_ptr() != NULL) {
add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL);
}
}
const Type *adr_type = _igvn->type(adr); const Type *adr_type = _igvn->type(adr);
adr_type = adr_type->make_ptr(); adr_type = adr_type->make_ptr();
#ifdef ASSERT
if (adr_type == NULL) {
n->dump(1);
assert(adr_type != NULL, "dead node should not be on list");
break;
}
#endif
if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN) {
add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL);
}
if (adr_type->isa_oopptr() || if (adr_type->isa_oopptr() ||
(opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) && (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) &&
(adr_type == TypeRawPtr::NOTNULL && (adr_type == TypeRawPtr::NOTNULL &&
@ -797,6 +820,18 @@ void ConnectionGraph::add_call_node(CallNode* call) {
// Returns a newly allocated unescaped object. // Returns a newly allocated unescaped object.
add_java_object(call, PointsToNode::NoEscape); add_java_object(call, PointsToNode::NoEscape);
ptnode_adr(call_idx)->set_scalar_replaceable(false); ptnode_adr(call_idx)->set_scalar_replaceable(false);
} else if (meth->is_boxing_method()) {
// Returns boxing object
PointsToNode::EscapeState es;
vmIntrinsics::ID intr = meth->intrinsic_id();
if (intr == vmIntrinsics::_floatValue || intr == vmIntrinsics::_doubleValue) {
// It does not escape if object is always allocated.
es = PointsToNode::NoEscape;
} else {
// It escapes globally if object could be loaded from cache.
es = PointsToNode::GlobalEscape;
}
add_java_object(call, es);
} else { } else {
BCEscapeAnalyzer* call_analyzer = meth->get_bcea(); BCEscapeAnalyzer* call_analyzer = meth->get_bcea();
call_analyzer->copy_dependencies(_compile->dependencies()); call_analyzer->copy_dependencies(_compile->dependencies());
@ -943,6 +978,9 @@ void ConnectionGraph::process_call_arguments(CallNode *call) {
assert((name == NULL || strcmp(name, "uncommon_trap") != 0), "normal calls only"); assert((name == NULL || strcmp(name, "uncommon_trap") != 0), "normal calls only");
#endif #endif
ciMethod* meth = call->as_CallJava()->method(); ciMethod* meth = call->as_CallJava()->method();
if ((meth != NULL) && meth->is_boxing_method()) {
break; // Boxing methods do not modify any oops.
}
BCEscapeAnalyzer* call_analyzer = (meth !=NULL) ? meth->get_bcea() : NULL; BCEscapeAnalyzer* call_analyzer = (meth !=NULL) ? meth->get_bcea() : NULL;
// fall-through if not a Java method or no analyzer information // fall-through if not a Java method or no analyzer information
if (call_analyzer != NULL) { if (call_analyzer != NULL) {
@ -1791,9 +1829,8 @@ Node* ConnectionGraph::optimize_ptr_compare(Node* n) {
jobj2->ideal_node()->is_Con()) { jobj2->ideal_node()->is_Con()) {
// Klass or String constants compare. Need to be careful with // Klass or String constants compare. Need to be careful with
// compressed pointers - compare types of ConN and ConP instead of nodes. // compressed pointers - compare types of ConN and ConP instead of nodes.
const Type* t1 = jobj1->ideal_node()->bottom_type()->make_ptr(); const Type* t1 = jobj1->ideal_node()->get_ptr_type();
const Type* t2 = jobj2->ideal_node()->bottom_type()->make_ptr(); const Type* t2 = jobj2->ideal_node()->get_ptr_type();
assert(t1 != NULL && t2 != NULL, "sanity");
if (t1->make_ptr() == t2->make_ptr()) { if (t1->make_ptr() == t2->make_ptr()) {
return _pcmp_eq; return _pcmp_eq;
} else { } else {
@ -2744,6 +2781,11 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist)
// so it could be eliminated if it has no uses. // so it could be eliminated if it has no uses.
alloc->as_Allocate()->_is_scalar_replaceable = true; alloc->as_Allocate()->_is_scalar_replaceable = true;
} }
if (alloc->is_CallStaticJava()) {
// Set the scalar_replaceable flag for boxing method
// so it could be eliminated if it has no uses.
alloc->as_CallStaticJava()->_is_scalar_replaceable = true;
}
continue; continue;
} }
if (!n->is_CheckCastPP()) { // not unique CheckCastPP. if (!n->is_CheckCastPP()) { // not unique CheckCastPP.
@ -2782,6 +2824,11 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist)
// so it could be eliminated. // so it could be eliminated.
alloc->as_Allocate()->_is_scalar_replaceable = true; alloc->as_Allocate()->_is_scalar_replaceable = true;
} }
if (alloc->is_CallStaticJava()) {
// Set the scalar_replaceable flag for boxing method
// so it could be eliminated.
alloc->as_CallStaticJava()->_is_scalar_replaceable = true;
}
set_escape_state(ptnode_adr(n->_idx), es); // CheckCastPP escape state set_escape_state(ptnode_adr(n->_idx), es); // CheckCastPP escape state
// in order for an object to be scalar-replaceable, it must be: // in order for an object to be scalar-replaceable, it must be:
// - a direct allocation (not a call returning an object) // - a direct allocation (not a call returning an object)
@ -2911,7 +2958,9 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist)
// Load/store to instance's field // Load/store to instance's field
memnode_worklist.append_if_missing(use); memnode_worklist.append_if_missing(use);
} else if (use->is_MemBar()) { } else if (use->is_MemBar()) {
memnode_worklist.append_if_missing(use); if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge
memnode_worklist.append_if_missing(use);
}
} else if (use->is_AddP() && use->outcnt() > 0) { // No dead nodes } else if (use->is_AddP() && use->outcnt() > 0) { // No dead nodes
Node* addp2 = find_second_addp(use, n); Node* addp2 = find_second_addp(use, n);
if (addp2 != NULL) { if (addp2 != NULL) {
@ -3028,7 +3077,9 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist)
continue; continue;
memnode_worklist.append_if_missing(use); memnode_worklist.append_if_missing(use);
} else if (use->is_MemBar()) { } else if (use->is_MemBar()) {
memnode_worklist.append_if_missing(use); if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge
memnode_worklist.append_if_missing(use);
}
#ifdef ASSERT #ifdef ASSERT
} else if(use->is_Mem()) { } else if(use->is_Mem()) {
assert(use->in(MemNode::Memory) != n, "EA: missing memory path"); assert(use->in(MemNode::Memory) != n, "EA: missing memory path");
@ -3264,7 +3315,12 @@ void ConnectionGraph::dump(GrowableArray<PointsToNode*>& ptnodes_worklist) {
if (ptn == NULL || !ptn->is_JavaObject()) if (ptn == NULL || !ptn->is_JavaObject())
continue; continue;
PointsToNode::EscapeState es = ptn->escape_state(); PointsToNode::EscapeState es = ptn->escape_state();
if (ptn->ideal_node()->is_Allocate() && (es == PointsToNode::NoEscape || Verbose)) { if ((es != PointsToNode::NoEscape) && !Verbose) {
continue;
}
Node* n = ptn->ideal_node();
if (n->is_Allocate() || (n->is_CallStaticJava() &&
n->as_CallStaticJava()->is_boxing_method())) {
if (first) { if (first) {
tty->cr(); tty->cr();
tty->print("======== Connection graph for "); tty->print("======== Connection graph for ");

View File

@ -333,6 +333,7 @@ void GraphKit::combine_exception_states(SafePointNode* ex_map, SafePointNode* ph
assert(ex_jvms->stkoff() == phi_map->_jvms->stkoff(), "matching locals"); assert(ex_jvms->stkoff() == phi_map->_jvms->stkoff(), "matching locals");
assert(ex_jvms->sp() == phi_map->_jvms->sp(), "matching stack sizes"); assert(ex_jvms->sp() == phi_map->_jvms->sp(), "matching stack sizes");
assert(ex_jvms->monoff() == phi_map->_jvms->monoff(), "matching JVMS"); assert(ex_jvms->monoff() == phi_map->_jvms->monoff(), "matching JVMS");
assert(ex_jvms->scloff() == phi_map->_jvms->scloff(), "matching scalar replaced objects");
assert(ex_map->req() == phi_map->req(), "matching maps"); assert(ex_map->req() == phi_map->req(), "matching maps");
uint tos = ex_jvms->stkoff() + ex_jvms->sp(); uint tos = ex_jvms->stkoff() + ex_jvms->sp();
Node* hidden_merge_mark = root(); Node* hidden_merge_mark = root();
@ -409,7 +410,7 @@ void GraphKit::combine_exception_states(SafePointNode* ex_map, SafePointNode* ph
while (dst->req() > orig_width) dst->del_req(dst->req()-1); while (dst->req() > orig_width) dst->del_req(dst->req()-1);
} else { } else {
assert(dst->is_Phi(), "nobody else uses a hidden region"); assert(dst->is_Phi(), "nobody else uses a hidden region");
phi = (PhiNode*)dst; phi = dst->as_Phi();
} }
if (add_multiple && src->in(0) == ex_control) { if (add_multiple && src->in(0) == ex_control) {
// Both are phis. // Both are phis.
@ -1438,7 +1439,12 @@ Node* GraphKit::make_load(Node* ctl, Node* adr, const Type* t, BasicType bt,
} else { } else {
ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt); ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt);
} }
return _gvn.transform(ld); ld = _gvn.transform(ld);
if ((bt == T_OBJECT) && C->do_escape_analysis() || C->eliminate_boxing()) {
// Improve graph before escape analysis and boxing elimination.
record_for_igvn(ld);
}
return ld;
} }
Node* GraphKit::store_to_memory(Node* ctl, Node* adr, Node *val, BasicType bt, Node* GraphKit::store_to_memory(Node* ctl, Node* adr, Node *val, BasicType bt,
@ -3144,7 +3150,7 @@ Node* GraphKit::new_instance(Node* klass_node,
set_all_memory(mem); // Create new memory state set_all_memory(mem); // Create new memory state
AllocateNode* alloc AllocateNode* alloc
= new (C) AllocateNode(C, AllocateNode::alloc_type(), = new (C) AllocateNode(C, AllocateNode::alloc_type(Type::TOP),
control(), mem, i_o(), control(), mem, i_o(),
size, klass_node, size, klass_node,
initial_slow_test); initial_slow_test);
@ -3285,7 +3291,7 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
// Create the AllocateArrayNode and its result projections // Create the AllocateArrayNode and its result projections
AllocateArrayNode* alloc AllocateArrayNode* alloc
= new (C) AllocateArrayNode(C, AllocateArrayNode::alloc_type(), = new (C) AllocateArrayNode(C, AllocateArrayNode::alloc_type(TypeInt::INT),
control(), mem, i_o(), control(), mem, i_o(),
size, klass_node, size, klass_node,
initial_slow_test, initial_slow_test,
@ -3326,10 +3332,9 @@ AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) {
if (ptr == NULL) { // reduce dumb test in callers if (ptr == NULL) { // reduce dumb test in callers
return NULL; return NULL;
} }
if (ptr->is_CheckCastPP()) { // strip a raw-to-oop cast ptr = ptr->uncast(); // strip a raw-to-oop cast
ptr = ptr->in(1); if (ptr == NULL) return NULL;
if (ptr == NULL) return NULL;
}
if (ptr->is_Proj()) { if (ptr->is_Proj()) {
Node* allo = ptr->in(0); Node* allo = ptr->in(0);
if (allo != NULL && allo->is_Allocate()) { if (allo != NULL && allo->is_Allocate()) {
@ -3374,19 +3379,6 @@ InitializeNode* AllocateNode::initialization() {
return NULL; return NULL;
} }
// Trace Allocate -> Proj[Parm] -> MemBarStoreStore
MemBarStoreStoreNode* AllocateNode::storestore() {
ProjNode* rawoop = proj_out(AllocateNode::RawAddress);
if (rawoop == NULL) return NULL;
for (DUIterator_Fast imax, i = rawoop->fast_outs(imax); i < imax; i++) {
Node* storestore = rawoop->fast_out(i);
if (storestore->is_MemBarStoreStore()) {
return storestore->as_MemBarStoreStore();
}
}
return NULL;
}
//----------------------------- loop predicates --------------------------- //----------------------------- loop predicates ---------------------------
//------------------------------add_predicate_impl---------------------------- //------------------------------add_predicate_impl----------------------------

View File

@ -673,7 +673,7 @@ const TypeInt* IfNode::filtered_int_type(PhaseGVN* gvn, Node *val, Node* if_proj
// / Region // / Region
// //
Node* IfNode::fold_compares(PhaseGVN* phase) { Node* IfNode::fold_compares(PhaseGVN* phase) {
if (!EliminateAutoBox || Opcode() != Op_If) return NULL; if (!phase->C->eliminate_boxing() || Opcode() != Op_If) return NULL;
Node* this_cmp = in(1)->in(1); Node* this_cmp = in(1)->in(1);
if (this_cmp != NULL && this_cmp->Opcode() == Op_CmpI && if (this_cmp != NULL && this_cmp->Opcode() == Op_CmpI &&

View File

@ -219,9 +219,10 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe
// cannot reason about it; is probably not implicit null exception // cannot reason about it; is probably not implicit null exception
} else { } else {
const TypePtr* tptr; const TypePtr* tptr;
if (UseCompressedOops && Universe::narrow_oop_shift() == 0) { if (UseCompressedOops && (Universe::narrow_oop_shift() == 0 ||
Universe::narrow_klass_shift() == 0)) {
// 32-bits narrow oop can be the base of address expressions // 32-bits narrow oop can be the base of address expressions
tptr = base->bottom_type()->make_ptr(); tptr = base->get_ptr_type();
} else { } else {
// only regular oops are expected here // only regular oops are expected here
tptr = base->bottom_type()->is_ptr(); tptr = base->bottom_type()->is_ptr();

View File

@ -2783,7 +2783,7 @@ bool LibraryCallKit::inline_unsafe_load_store(BasicType type, LoadStoreKind kind
#ifdef _LP64 #ifdef _LP64
if (type == T_OBJECT && adr->bottom_type()->is_ptr_to_narrowoop() && kind == LS_xchg) { if (type == T_OBJECT && adr->bottom_type()->is_ptr_to_narrowoop() && kind == LS_xchg) {
load_store = _gvn.transform(new (C) DecodeNNode(load_store, load_store->bottom_type()->make_ptr())); load_store = _gvn.transform(new (C) DecodeNNode(load_store, load_store->get_ptr_type()));
} }
#endif #endif
@ -3703,7 +3703,7 @@ LibraryCallKit::generate_method_call(vmIntrinsics::ID method_id, bool is_virtual
CallJavaNode* slow_call; CallJavaNode* slow_call;
if (is_static) { if (is_static) {
assert(!is_virtual, ""); assert(!is_virtual, "");
slow_call = new(C) CallStaticJavaNode(tf, slow_call = new(C) CallStaticJavaNode(C, tf,
SharedRuntime::get_resolve_static_call_stub(), SharedRuntime::get_resolve_static_call_stub(),
method, bci()); method, bci());
} else if (is_virtual) { } else if (is_virtual) {
@ -3722,7 +3722,7 @@ LibraryCallKit::generate_method_call(vmIntrinsics::ID method_id, bool is_virtual
method, vtable_index, bci()); method, vtable_index, bci());
} else { // neither virtual nor static: opt_virtual } else { // neither virtual nor static: opt_virtual
null_check_receiver(); null_check_receiver();
slow_call = new(C) CallStaticJavaNode(tf, slow_call = new(C) CallStaticJavaNode(C, tf,
SharedRuntime::get_resolve_opt_virtual_call_stub(), SharedRuntime::get_resolve_opt_virtual_call_stub(),
method, bci()); method, bci());
slow_call->set_optimized_virtual(true); slow_call->set_optimized_virtual(true);

View File

@ -821,8 +821,8 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) {
loop->dump_head(); loop->dump_head();
} }
#endif #endif
} else if (cl != NULL && loop->is_range_check_if(iff, this, invar)) { } else if ((cl != NULL) && (proj->_con == predicate_proj->_con) &&
assert(proj->_con == predicate_proj->_con, "must match"); loop->is_range_check_if(iff, this, invar)) {
// Range check for counted loops // Range check for counted loops
const Node* cmp = bol->in(1)->as_Cmp(); const Node* cmp = bol->in(1)->as_Cmp();

View File

@ -349,11 +349,11 @@ const class TypePtr *MachNode::adr_type() const {
if (base == NodeSentinel) return TypePtr::BOTTOM; if (base == NodeSentinel) return TypePtr::BOTTOM;
const Type* t = base->bottom_type(); const Type* t = base->bottom_type();
if (UseCompressedOops && Universe::narrow_oop_shift() == 0) { if (t->isa_narrowoop() && Universe::narrow_oop_shift() == 0) {
// 32-bit unscaled narrow oop can be the base of any address expression // 32-bit unscaled narrow oop can be the base of any address expression
t = t->make_ptr(); t = t->make_ptr();
} }
if (UseCompressedKlassPointers && Universe::narrow_klass_shift() == 0) { if (t->isa_narrowklass() && Universe::narrow_klass_shift() == 0) {
// 32-bit unscaled narrow oop can be the base of any address expression // 32-bit unscaled narrow oop can be the base of any address expression
t = t->make_ptr(); t = t->make_ptr();
} }

View File

@ -666,7 +666,7 @@ bool PhaseMacroExpand::can_eliminate_allocation(AllocateNode *alloc, GrowableArr
alloc->dump(); alloc->dump();
else else
res->dump(); res->dump();
} else { } else if (alloc->_is_scalar_replaceable) {
tty->print("NotScalar (%s)", fail_eliminate); tty->print("NotScalar (%s)", fail_eliminate);
if (res == NULL) if (res == NULL)
alloc->dump(); alloc->dump();
@ -834,7 +834,7 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray <Sa
if (field_val->is_EncodeP()) { if (field_val->is_EncodeP()) {
field_val = field_val->in(1); field_val = field_val->in(1);
} else { } else {
field_val = transform_later(new (C) DecodeNNode(field_val, field_val->bottom_type()->make_ptr())); field_val = transform_later(new (C) DecodeNNode(field_val, field_val->get_ptr_type()));
} }
} }
sfpt->add_req(field_val); sfpt->add_req(field_val);
@ -845,18 +845,14 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray <Sa
// to the allocated object with "sobj" // to the allocated object with "sobj"
int start = jvms->debug_start(); int start = jvms->debug_start();
int end = jvms->debug_end(); int end = jvms->debug_end();
for (int i = start; i < end; i++) { sfpt->replace_edges_in_range(res, sobj, start, end);
if (sfpt->in(i) == res) {
sfpt->set_req(i, sobj);
}
}
safepoints_done.append_if_missing(sfpt); // keep it for rollback safepoints_done.append_if_missing(sfpt); // keep it for rollback
} }
return true; return true;
} }
// Process users of eliminated allocation. // Process users of eliminated allocation.
void PhaseMacroExpand::process_users_of_allocation(AllocateNode *alloc) { void PhaseMacroExpand::process_users_of_allocation(CallNode *alloc) {
Node* res = alloc->result_cast(); Node* res = alloc->result_cast();
if (res != NULL) { if (res != NULL) {
for (DUIterator_Last jmin, j = res->last_outs(jmin); j >= jmin; ) { for (DUIterator_Last jmin, j = res->last_outs(jmin); j >= jmin; ) {
@ -899,6 +895,17 @@ void PhaseMacroExpand::process_users_of_allocation(AllocateNode *alloc) {
// Process other users of allocation's projections // Process other users of allocation's projections
// //
if (_resproj != NULL && _resproj->outcnt() != 0) { if (_resproj != NULL && _resproj->outcnt() != 0) {
// First disconnect stores captured by Initialize node.
// If Initialize node is eliminated first in the following code,
// it will kill such stores and DUIterator_Last will assert.
for (DUIterator_Fast jmax, j = _resproj->fast_outs(jmax); j < jmax; j++) {
Node *use = _resproj->fast_out(j);
if (use->is_AddP()) {
// raw memory addresses used only by the initialization
_igvn.replace_node(use, C->top());
--j; --jmax;
}
}
for (DUIterator_Last jmin, j = _resproj->last_outs(jmin); j >= jmin; ) { for (DUIterator_Last jmin, j = _resproj->last_outs(jmin); j >= jmin; ) {
Node *use = _resproj->last_out(j); Node *use = _resproj->last_out(j);
uint oc1 = _resproj->outcnt(); uint oc1 = _resproj->outcnt();
@ -923,9 +930,6 @@ void PhaseMacroExpand::process_users_of_allocation(AllocateNode *alloc) {
#endif #endif
_igvn.replace_node(mem_proj, mem); _igvn.replace_node(mem_proj, mem);
} }
} else if (use->is_AddP()) {
// raw memory addresses used only by the initialization
_igvn.replace_node(use, C->top());
} else { } else {
assert(false, "only Initialize or AddP expected"); assert(false, "only Initialize or AddP expected");
} }
@ -953,8 +957,18 @@ void PhaseMacroExpand::process_users_of_allocation(AllocateNode *alloc) {
} }
bool PhaseMacroExpand::eliminate_allocate_node(AllocateNode *alloc) { bool PhaseMacroExpand::eliminate_allocate_node(AllocateNode *alloc) {
if (!EliminateAllocations || !alloc->_is_non_escaping) {
if (!EliminateAllocations || !alloc->_is_scalar_replaceable) { return false;
}
Node* klass = alloc->in(AllocateNode::KlassNode);
const TypeKlassPtr* tklass = _igvn.type(klass)->is_klassptr();
Node* res = alloc->result_cast();
// Eliminate boxing allocations which are not used
// regardless scalar replacable status.
bool boxing_alloc = C->eliminate_boxing() &&
tklass->klass()->is_instance_klass() &&
tklass->klass()->as_instance_klass()->is_box_klass();
if (!alloc->_is_scalar_replaceable && (!boxing_alloc || (res != NULL))) {
return false; return false;
} }
@ -965,14 +979,22 @@ bool PhaseMacroExpand::eliminate_allocate_node(AllocateNode *alloc) {
return false; return false;
} }
if (!alloc->_is_scalar_replaceable) {
assert(res == NULL, "sanity");
// We can only eliminate allocation if all debug info references
// are already replaced with SafePointScalarObject because
// we can't search for a fields value without instance_id.
if (safepoints.length() > 0) {
return false;
}
}
if (!scalar_replacement(alloc, safepoints)) { if (!scalar_replacement(alloc, safepoints)) {
return false; return false;
} }
CompileLog* log = C->log(); CompileLog* log = C->log();
if (log != NULL) { if (log != NULL) {
Node* klass = alloc->in(AllocateNode::KlassNode);
const TypeKlassPtr* tklass = _igvn.type(klass)->is_klassptr();
log->head("eliminate_allocation type='%d'", log->head("eliminate_allocation type='%d'",
log->identify(tklass->klass())); log->identify(tklass->klass()));
JVMState* p = alloc->jvms(); JVMState* p = alloc->jvms();
@ -997,6 +1019,43 @@ bool PhaseMacroExpand::eliminate_allocate_node(AllocateNode *alloc) {
return true; return true;
} }
bool PhaseMacroExpand::eliminate_boxing_node(CallStaticJavaNode *boxing) {
// EA should remove all uses of non-escaping boxing node.
if (!C->eliminate_boxing() || boxing->proj_out(TypeFunc::Parms) != NULL) {
return false;
}
extract_call_projections(boxing);
const TypeTuple* r = boxing->tf()->range();
assert(r->cnt() > TypeFunc::Parms, "sanity");
const TypeInstPtr* t = r->field_at(TypeFunc::Parms)->isa_instptr();
assert(t != NULL, "sanity");
CompileLog* log = C->log();
if (log != NULL) {
log->head("eliminate_boxing type='%d'",
log->identify(t->klass()));
JVMState* p = boxing->jvms();
while (p != NULL) {
log->elem("jvms bci='%d' method='%d'", p->bci(), log->identify(p->method()));
p = p->caller();
}
log->tail("eliminate_boxing");
}
process_users_of_allocation(boxing);
#ifndef PRODUCT
if (PrintEliminateAllocations) {
tty->print("++++ Eliminated: %d ", boxing->_idx);
boxing->method()->print_short_name(tty);
tty->cr();
}
#endif
return true;
}
//---------------------------set_eden_pointers------------------------- //---------------------------set_eden_pointers-------------------------
void PhaseMacroExpand::set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr) { void PhaseMacroExpand::set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr) {
@ -2384,6 +2443,9 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
case Node::Class_AllocateArray: case Node::Class_AllocateArray:
success = eliminate_allocate_node(n->as_Allocate()); success = eliminate_allocate_node(n->as_Allocate());
break; break;
case Node::Class_CallStaticJava:
success = eliminate_boxing_node(n->as_CallStaticJava());
break;
case Node::Class_Lock: case Node::Class_Lock:
case Node::Class_Unlock: case Node::Class_Unlock:
assert(!n->as_AbstractLock()->is_eliminated(), "sanity"); assert(!n->as_AbstractLock()->is_eliminated(), "sanity");
@ -2424,6 +2486,11 @@ bool PhaseMacroExpand::expand_macro_nodes() {
C->remove_macro_node(n); C->remove_macro_node(n);
_igvn._worklist.push(n); _igvn._worklist.push(n);
success = true; success = true;
} else if (n->Opcode() == Op_CallStaticJava) {
// Remove it from macro list and put on IGVN worklist to optimize.
C->remove_macro_node(n);
_igvn._worklist.push(n);
success = true;
} else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) { } else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) {
_igvn.replace_node(n, n->in(1)); _igvn.replace_node(n, n->in(1));
success = true; success = true;

View File

@ -86,10 +86,11 @@ private:
Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc); Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc);
Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, Node_Stack *value_phis, int level); Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, Node_Stack *value_phis, int level);
bool eliminate_boxing_node(CallStaticJavaNode *boxing);
bool eliminate_allocate_node(AllocateNode *alloc); bool eliminate_allocate_node(AllocateNode *alloc);
bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints); bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done); bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
void process_users_of_allocation(AllocateNode *alloc); void process_users_of_allocation(CallNode *alloc);
void eliminate_card_mark(Node *cm); void eliminate_card_mark(Node *cm);
void mark_eliminated_box(Node* box, Node* obj); void mark_eliminated_box(Node* box, Node* obj);

View File

@ -103,11 +103,15 @@ extern void print_alias_types();
#endif #endif
Node *MemNode::optimize_simple_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase) { Node *MemNode::optimize_simple_memory_chain(Node *mchain, const TypeOopPtr *t_oop, Node *load, PhaseGVN *phase) {
const TypeOopPtr *tinst = t_adr->isa_oopptr(); assert((t_oop != NULL), "sanity");
if (tinst == NULL || !tinst->is_known_instance_field()) bool is_instance = t_oop->is_known_instance_field();
bool is_boxed_value_load = t_oop->is_ptr_to_boxed_value() &&
(load != NULL) && load->is_Load() &&
(phase->is_IterGVN() != NULL);
if (!(is_instance || is_boxed_value_load))
return mchain; // don't try to optimize non-instance types return mchain; // don't try to optimize non-instance types
uint instance_id = tinst->instance_id(); uint instance_id = t_oop->instance_id();
Node *start_mem = phase->C->start()->proj_out(TypeFunc::Memory); Node *start_mem = phase->C->start()->proj_out(TypeFunc::Memory);
Node *prev = NULL; Node *prev = NULL;
Node *result = mchain; Node *result = mchain;
@ -122,15 +126,24 @@ Node *MemNode::optimize_simple_memory_chain(Node *mchain, const TypePtr *t_adr,
break; // hit one of our sentinels break; // hit one of our sentinels
} else if (proj_in->is_Call()) { } else if (proj_in->is_Call()) {
CallNode *call = proj_in->as_Call(); CallNode *call = proj_in->as_Call();
if (!call->may_modify(t_adr, phase)) { if (!call->may_modify(t_oop, phase)) { // returns false for instances
result = call->in(TypeFunc::Memory); result = call->in(TypeFunc::Memory);
} }
} else if (proj_in->is_Initialize()) { } else if (proj_in->is_Initialize()) {
AllocateNode* alloc = proj_in->as_Initialize()->allocation(); AllocateNode* alloc = proj_in->as_Initialize()->allocation();
// Stop if this is the initialization for the object instance which // Stop if this is the initialization for the object instance which
// which contains this memory slice, otherwise skip over it. // which contains this memory slice, otherwise skip over it.
if (alloc != NULL && alloc->_idx != instance_id) { if ((alloc == NULL) || (alloc->_idx == instance_id)) {
break;
}
if (is_instance) {
result = proj_in->in(TypeFunc::Memory); result = proj_in->in(TypeFunc::Memory);
} else if (is_boxed_value_load) {
Node* klass = alloc->in(AllocateNode::KlassNode);
const TypeKlassPtr* tklass = phase->type(klass)->is_klassptr();
if (tklass->klass_is_exact() && !tklass->klass()->equals(t_oop->klass())) {
result = proj_in->in(TypeFunc::Memory); // not related allocation
}
} }
} else if (proj_in->is_MemBar()) { } else if (proj_in->is_MemBar()) {
result = proj_in->in(TypeFunc::Memory); result = proj_in->in(TypeFunc::Memory);
@ -138,25 +151,26 @@ Node *MemNode::optimize_simple_memory_chain(Node *mchain, const TypePtr *t_adr,
assert(false, "unexpected projection"); assert(false, "unexpected projection");
} }
} else if (result->is_ClearArray()) { } else if (result->is_ClearArray()) {
if (!ClearArrayNode::step_through(&result, instance_id, phase)) { if (!is_instance || !ClearArrayNode::step_through(&result, instance_id, phase)) {
// Can not bypass initialization of the instance // Can not bypass initialization of the instance
// we are looking for. // we are looking for.
break; break;
} }
// Otherwise skip it (the call updated 'result' value). // Otherwise skip it (the call updated 'result' value).
} else if (result->is_MergeMem()) { } else if (result->is_MergeMem()) {
result = step_through_mergemem(phase, result->as_MergeMem(), t_adr, NULL, tty); result = step_through_mergemem(phase, result->as_MergeMem(), t_oop, NULL, tty);
} }
} }
return result; return result;
} }
Node *MemNode::optimize_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase) { Node *MemNode::optimize_memory_chain(Node *mchain, const TypePtr *t_adr, Node *load, PhaseGVN *phase) {
const TypeOopPtr *t_oop = t_adr->isa_oopptr(); const TypeOopPtr* t_oop = t_adr->isa_oopptr();
bool is_instance = (t_oop != NULL) && t_oop->is_known_instance_field(); if (t_oop == NULL)
return mchain; // don't try to optimize non-oop types
Node* result = optimize_simple_memory_chain(mchain, t_oop, load, phase);
bool is_instance = t_oop->is_known_instance_field();
PhaseIterGVN *igvn = phase->is_IterGVN(); PhaseIterGVN *igvn = phase->is_IterGVN();
Node *result = mchain;
result = optimize_simple_memory_chain(result, t_adr, phase);
if (is_instance && igvn != NULL && result->is_Phi()) { if (is_instance && igvn != NULL && result->is_Phi()) {
PhiNode *mphi = result->as_Phi(); PhiNode *mphi = result->as_Phi();
assert(mphi->bottom_type() == Type::MEMORY, "memory phi required"); assert(mphi->bottom_type() == Type::MEMORY, "memory phi required");
@ -383,7 +397,7 @@ bool MemNode::all_controls_dominate(Node* dom, Node* sub) {
// Or Region for the check in LoadNode::Ideal(); // Or Region for the check in LoadNode::Ideal();
// 'sub' should have sub->in(0) != NULL. // 'sub' should have sub->in(0) != NULL.
assert(sub->is_Allocate() || sub->is_Initialize() || sub->is_Start() || assert(sub->is_Allocate() || sub->is_Initialize() || sub->is_Start() ||
sub->is_Region(), "expecting only these nodes"); sub->is_Region() || sub->is_Call(), "expecting only these nodes");
// Get control edge of 'sub'. // Get control edge of 'sub'.
Node* orig_sub = sub; Node* orig_sub = sub;
@ -957,11 +971,14 @@ uint LoadNode::hash() const {
// of aliasing. // of aliasing.
Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const { Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
Node* ld_adr = in(MemNode::Address); Node* ld_adr = in(MemNode::Address);
intptr_t ld_off = 0;
AllocateNode* ld_alloc = AllocateNode::Ideal_allocation(ld_adr, phase, ld_off);
const TypeInstPtr* tp = phase->type(ld_adr)->isa_instptr(); const TypeInstPtr* tp = phase->type(ld_adr)->isa_instptr();
Compile::AliasType* atp = tp != NULL ? phase->C->alias_type(tp) : NULL; Compile::AliasType* atp = (tp != NULL) ? phase->C->alias_type(tp) : NULL;
if (EliminateAutoBox && atp != NULL && atp->index() >= Compile::AliasIdxRaw && // This is more general than load from boxing objects.
atp->field() != NULL && !atp->field()->is_volatile()) { if (phase->C->eliminate_boxing() && (atp != NULL) &&
(atp->index() >= Compile::AliasIdxRaw) &&
(atp->field() != NULL) && !atp->field()->is_volatile()) {
uint alias_idx = atp->index(); uint alias_idx = atp->index();
bool final = atp->field()->is_final(); bool final = atp->field()->is_final();
Node* result = NULL; Node* result = NULL;
@ -983,7 +1000,7 @@ Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
Node* new_st = merge->memory_at(alias_idx); Node* new_st = merge->memory_at(alias_idx);
if (new_st == merge->base_memory()) { if (new_st == merge->base_memory()) {
// Keep searching // Keep searching
current = merge->base_memory(); current = new_st;
continue; continue;
} }
// Save the new memory state for the slice and fall through // Save the new memory state for the slice and fall through
@ -1010,9 +1027,7 @@ Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
intptr_t st_off = 0; intptr_t st_off = 0;
AllocateNode* alloc = AllocateNode::Ideal_allocation(st_adr, phase, st_off); AllocateNode* alloc = AllocateNode::Ideal_allocation(st_adr, phase, st_off);
if (alloc == NULL) return NULL; if (alloc == NULL) return NULL;
intptr_t ld_off = 0; if (alloc != ld_alloc) return NULL;
AllocateNode* allo2 = AllocateNode::Ideal_allocation(ld_adr, phase, ld_off);
if (alloc != allo2) return NULL;
if (ld_off != st_off) return NULL; if (ld_off != st_off) return NULL;
// At this point we have proven something like this setup: // At this point we have proven something like this setup:
// A = Allocate(...) // A = Allocate(...)
@ -1029,14 +1044,12 @@ Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
return st->in(MemNode::ValueIn); return st->in(MemNode::ValueIn);
} }
intptr_t offset = 0; // scratch
// A load from a freshly-created object always returns zero. // A load from a freshly-created object always returns zero.
// (This can happen after LoadNode::Ideal resets the load's memory input // (This can happen after LoadNode::Ideal resets the load's memory input
// to find_captured_store, which returned InitializeNode::zero_memory.) // to find_captured_store, which returned InitializeNode::zero_memory.)
if (st->is_Proj() && st->in(0)->is_Allocate() && if (st->is_Proj() && st->in(0)->is_Allocate() &&
st->in(0) == AllocateNode::Ideal_allocation(ld_adr, phase, offset) && (st->in(0) == ld_alloc) &&
offset >= st->in(0)->as_Allocate()->minimum_header_size()) { (ld_off >= st->in(0)->as_Allocate()->minimum_header_size())) {
// return a zero value for the load's basic type // return a zero value for the load's basic type
// (This is one of the few places where a generic PhaseTransform // (This is one of the few places where a generic PhaseTransform
// can create new nodes. Think of it as lazily manifesting // can create new nodes. Think of it as lazily manifesting
@ -1048,15 +1061,27 @@ Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
if (st->is_Proj() && st->in(0)->is_Initialize()) { if (st->is_Proj() && st->in(0)->is_Initialize()) {
InitializeNode* init = st->in(0)->as_Initialize(); InitializeNode* init = st->in(0)->as_Initialize();
AllocateNode* alloc = init->allocation(); AllocateNode* alloc = init->allocation();
if (alloc != NULL && if ((alloc != NULL) && (alloc == ld_alloc)) {
alloc == AllocateNode::Ideal_allocation(ld_adr, phase, offset)) {
// examine a captured store value // examine a captured store value
st = init->find_captured_store(offset, memory_size(), phase); st = init->find_captured_store(ld_off, memory_size(), phase);
if (st != NULL) if (st != NULL)
continue; // take one more trip around continue; // take one more trip around
} }
} }
// Load boxed value from result of valueOf() call is input parameter.
if (this->is_Load() && ld_adr->is_AddP() &&
(tp != NULL) && tp->is_ptr_to_boxed_value()) {
intptr_t ignore = 0;
Node* base = AddPNode::Ideal_base_and_offset(ld_adr, phase, ignore);
if (base != NULL && base->is_Proj() &&
base->as_Proj()->_con == TypeFunc::Parms &&
base->in(0)->is_CallStaticJava() &&
base->in(0)->as_CallStaticJava()->is_boxing_method()) {
return base->in(0)->in(TypeFunc::Parms);
}
}
break; break;
} }
@ -1065,11 +1090,13 @@ Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
//----------------------is_instance_field_load_with_local_phi------------------ //----------------------is_instance_field_load_with_local_phi------------------
bool LoadNode::is_instance_field_load_with_local_phi(Node* ctrl) { bool LoadNode::is_instance_field_load_with_local_phi(Node* ctrl) {
if( in(MemNode::Memory)->is_Phi() && in(MemNode::Memory)->in(0) == ctrl && if( in(Memory)->is_Phi() && in(Memory)->in(0) == ctrl &&
in(MemNode::Address)->is_AddP() ) { in(Address)->is_AddP() ) {
const TypeOopPtr* t_oop = in(MemNode::Address)->bottom_type()->isa_oopptr(); const TypeOopPtr* t_oop = in(Address)->bottom_type()->isa_oopptr();
// Only instances. // Only instances and boxed values.
if( t_oop != NULL && t_oop->is_known_instance_field() && if( t_oop != NULL &&
(t_oop->is_ptr_to_boxed_value() ||
t_oop->is_known_instance_field()) &&
t_oop->offset() != Type::OffsetBot && t_oop->offset() != Type::OffsetBot &&
t_oop->offset() != Type::OffsetTop) { t_oop->offset() != Type::OffsetTop) {
return true; return true;
@ -1083,7 +1110,7 @@ bool LoadNode::is_instance_field_load_with_local_phi(Node* ctrl) {
Node *LoadNode::Identity( PhaseTransform *phase ) { Node *LoadNode::Identity( PhaseTransform *phase ) {
// If the previous store-maker is the right kind of Store, and the store is // If the previous store-maker is the right kind of Store, and the store is
// to the same address, then we are equal to the value stored. // to the same address, then we are equal to the value stored.
Node* mem = in(MemNode::Memory); Node* mem = in(Memory);
Node* value = can_see_stored_value(mem, phase); Node* value = can_see_stored_value(mem, phase);
if( value ) { if( value ) {
// byte, short & char stores truncate naturally. // byte, short & char stores truncate naturally.
@ -1105,15 +1132,22 @@ Node *LoadNode::Identity( PhaseTransform *phase ) {
// instance's field to avoid infinite generation of phis in a loop. // instance's field to avoid infinite generation of phis in a loop.
Node *region = mem->in(0); Node *region = mem->in(0);
if (is_instance_field_load_with_local_phi(region)) { if (is_instance_field_load_with_local_phi(region)) {
const TypePtr *addr_t = in(MemNode::Address)->bottom_type()->isa_ptr(); const TypeOopPtr *addr_t = in(Address)->bottom_type()->isa_oopptr();
int this_index = phase->C->get_alias_index(addr_t); int this_index = phase->C->get_alias_index(addr_t);
int this_offset = addr_t->offset(); int this_offset = addr_t->offset();
int this_id = addr_t->is_oopptr()->instance_id(); int this_iid = addr_t->instance_id();
if (!addr_t->is_known_instance() &&
addr_t->is_ptr_to_boxed_value()) {
// Use _idx of address base (could be Phi node) for boxed values.
intptr_t ignore = 0;
Node* base = AddPNode::Ideal_base_and_offset(in(Address), phase, ignore);
this_iid = base->_idx;
}
const Type* this_type = bottom_type(); const Type* this_type = bottom_type();
for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) { for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
Node* phi = region->fast_out(i); Node* phi = region->fast_out(i);
if (phi->is_Phi() && phi != mem && if (phi->is_Phi() && phi != mem &&
phi->as_Phi()->is_same_inst_field(this_type, this_id, this_index, this_offset)) { phi->as_Phi()->is_same_inst_field(this_type, this_iid, this_index, this_offset)) {
return phi; return phi;
} }
} }
@ -1122,170 +1156,106 @@ Node *LoadNode::Identity( PhaseTransform *phase ) {
return this; return this;
} }
// Returns true if the AliasType refers to the field that holds the
// cached box array. Currently only handles the IntegerCache case.
static bool is_autobox_cache(Compile::AliasType* atp) {
if (atp != NULL && atp->field() != NULL) {
ciField* field = atp->field();
ciSymbol* klass = field->holder()->name();
if (field->name() == ciSymbol::cache_field_name() &&
field->holder()->uses_default_loader() &&
klass == ciSymbol::java_lang_Integer_IntegerCache()) {
return true;
}
}
return false;
}
// Fetch the base value in the autobox array
static bool fetch_autobox_base(Compile::AliasType* atp, int& cache_offset) {
if (atp != NULL && atp->field() != NULL) {
ciField* field = atp->field();
ciSymbol* klass = field->holder()->name();
if (field->name() == ciSymbol::cache_field_name() &&
field->holder()->uses_default_loader() &&
klass == ciSymbol::java_lang_Integer_IntegerCache()) {
assert(field->is_constant(), "what?");
ciObjArray* array = field->constant_value().as_object()->as_obj_array();
// Fetch the box object at the base of the array and get its value
ciInstance* box = array->obj_at(0)->as_instance();
ciInstanceKlass* ik = box->klass()->as_instance_klass();
if (ik->nof_nonstatic_fields() == 1) {
// This should be true nonstatic_field_at requires calling
// nof_nonstatic_fields so check it anyway
ciConstant c = box->field_value(ik->nonstatic_field_at(0));
cache_offset = c.as_int();
}
return true;
}
}
return false;
}
// Returns true if the AliasType refers to the value field of an
// autobox object. Currently only handles Integer.
static bool is_autobox_object(Compile::AliasType* atp) {
if (atp != NULL && atp->field() != NULL) {
ciField* field = atp->field();
ciSymbol* klass = field->holder()->name();
if (field->name() == ciSymbol::value_name() &&
field->holder()->uses_default_loader() &&
klass == ciSymbol::java_lang_Integer()) {
return true;
}
}
return false;
}
// We're loading from an object which has autobox behaviour. // We're loading from an object which has autobox behaviour.
// If this object is result of a valueOf call we'll have a phi // If this object is result of a valueOf call we'll have a phi
// merging a newly allocated object and a load from the cache. // merging a newly allocated object and a load from the cache.
// We want to replace this load with the original incoming // We want to replace this load with the original incoming
// argument to the valueOf call. // argument to the valueOf call.
Node* LoadNode::eliminate_autobox(PhaseGVN* phase) { Node* LoadNode::eliminate_autobox(PhaseGVN* phase) {
Node* base = in(Address)->in(AddPNode::Base); assert(phase->C->eliminate_boxing(), "sanity");
if (base->is_Phi() && base->req() == 3) { intptr_t ignore = 0;
AllocateNode* allocation = NULL; Node* base = AddPNode::Ideal_base_and_offset(in(Address), phase, ignore);
int allocation_index = -1; if ((base == NULL) || base->is_Phi()) {
int load_index = -1; // Push the loads from the phi that comes from valueOf up
for (uint i = 1; i < base->req(); i++) { // through it to allow elimination of the loads and the recovery
allocation = AllocateNode::Ideal_allocation(base->in(i), phase); // of the original value. It is done in split_through_phi().
if (allocation != NULL) { return NULL;
allocation_index = i;
load_index = 3 - allocation_index;
break;
}
}
bool has_load = ( allocation != NULL &&
(base->in(load_index)->is_Load() ||
base->in(load_index)->is_DecodeN() &&
base->in(load_index)->in(1)->is_Load()) );
if (has_load && in(Memory)->is_Phi() && in(Memory)->in(0) == base->in(0)) {
// Push the loads from the phi that comes from valueOf up
// through it to allow elimination of the loads and the recovery
// of the original value.
Node* mem_phi = in(Memory);
Node* offset = in(Address)->in(AddPNode::Offset);
Node* region = base->in(0);
Node* in1 = clone();
Node* in1_addr = in1->in(Address)->clone();
in1_addr->set_req(AddPNode::Base, base->in(allocation_index));
in1_addr->set_req(AddPNode::Address, base->in(allocation_index));
in1_addr->set_req(AddPNode::Offset, offset);
in1->set_req(0, region->in(allocation_index));
in1->set_req(Address, in1_addr);
in1->set_req(Memory, mem_phi->in(allocation_index));
Node* in2 = clone();
Node* in2_addr = in2->in(Address)->clone();
in2_addr->set_req(AddPNode::Base, base->in(load_index));
in2_addr->set_req(AddPNode::Address, base->in(load_index));
in2_addr->set_req(AddPNode::Offset, offset);
in2->set_req(0, region->in(load_index));
in2->set_req(Address, in2_addr);
in2->set_req(Memory, mem_phi->in(load_index));
in1_addr = phase->transform(in1_addr);
in1 = phase->transform(in1);
in2_addr = phase->transform(in2_addr);
in2 = phase->transform(in2);
PhiNode* result = PhiNode::make_blank(region, this);
result->set_req(allocation_index, in1);
result->set_req(load_index, in2);
return result;
}
} else if (base->is_Load() || } else if (base->is_Load() ||
base->is_DecodeN() && base->in(1)->is_Load()) { base->is_DecodeN() && base->in(1)->is_Load()) {
if (base->is_DecodeN()) { // Eliminate the load of boxed value for integer types from the cache
// Get LoadN node which loads cached Integer object
base = base->in(1);
}
// Eliminate the load of Integer.value for integers from the cache
// array by deriving the value from the index into the array. // array by deriving the value from the index into the array.
// Capture the offset of the load and then reverse the computation. // Capture the offset of the load and then reverse the computation.
Node* load_base = base->in(Address)->in(AddPNode::Base);
if (load_base->is_DecodeN()) { // Get LoadN node which loads a boxing object from 'cache' array.
// Get LoadN node which loads IntegerCache.cache field if (base->is_DecodeN()) {
load_base = load_base->in(1); base = base->in(1);
} }
if (load_base != NULL) { if (!base->in(Address)->is_AddP()) {
Compile::AliasType* atp = phase->C->alias_type(load_base->adr_type()); return NULL; // Complex address
intptr_t cache_offset; }
int shift = -1; AddPNode* address = base->in(Address)->as_AddP();
Node* cache = NULL; Node* cache_base = address->in(AddPNode::Base);
if (is_autobox_cache(atp)) { if ((cache_base != NULL) && cache_base->is_DecodeN()) {
shift = exact_log2(type2aelembytes(T_OBJECT)); // Get ConP node which is static 'cache' field.
cache = AddPNode::Ideal_base_and_offset(load_base->in(Address), phase, cache_offset); cache_base = cache_base->in(1);
} }
if (cache != NULL && base->in(Address)->is_AddP()) { if ((cache_base != NULL) && cache_base->is_Con()) {
const TypeAryPtr* base_type = cache_base->bottom_type()->isa_aryptr();
if ((base_type != NULL) && base_type->is_autobox_cache()) {
Node* elements[4]; Node* elements[4];
int count = base->in(Address)->as_AddP()->unpack_offsets(elements, ARRAY_SIZE(elements)); int shift = exact_log2(type2aelembytes(T_OBJECT));
int cache_low; int count = address->unpack_offsets(elements, ARRAY_SIZE(elements));
if (count > 0 && fetch_autobox_base(atp, cache_low)) { if ((count > 0) && elements[0]->is_Con() &&
int offset = arrayOopDesc::base_offset_in_bytes(memory_type()) - (cache_low << shift); ((count == 1) ||
// Add up all the offsets making of the address of the load (count == 2) && elements[1]->Opcode() == Op_LShiftX &&
Node* result = elements[0]; elements[1]->in(2) == phase->intcon(shift))) {
for (int i = 1; i < count; i++) { ciObjArray* array = base_type->const_oop()->as_obj_array();
result = phase->transform(new (phase->C) AddXNode(result, elements[i])); // Fetch the box object cache[0] at the base of the array and get its value
} ciInstance* box = array->obj_at(0)->as_instance();
// Remove the constant offset from the address and then ciInstanceKlass* ik = box->klass()->as_instance_klass();
// remove the scaling of the offset to recover the original index. assert(ik->is_box_klass(), "sanity");
result = phase->transform(new (phase->C) AddXNode(result, phase->MakeConX(-offset))); assert(ik->nof_nonstatic_fields() == 1, "change following code");
if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) { if (ik->nof_nonstatic_fields() == 1) {
// Peel the shift off directly but wrap it in a dummy node // This should be true nonstatic_field_at requires calling
// since Ideal can't return existing nodes // nof_nonstatic_fields so check it anyway
result = new (phase->C) RShiftXNode(result->in(1), phase->intcon(0)); ciConstant c = box->field_value(ik->nonstatic_field_at(0));
} else { BasicType bt = c.basic_type();
result = new (phase->C) RShiftXNode(result, phase->intcon(shift)); // Only integer types have boxing cache.
} assert(bt == T_BOOLEAN || bt == T_CHAR ||
bt == T_BYTE || bt == T_SHORT ||
bt == T_INT || bt == T_LONG, err_msg_res("wrong type = %s", type2name(bt)));
jlong cache_low = (bt == T_LONG) ? c.as_long() : c.as_int();
if (cache_low != (int)cache_low) {
return NULL; // should not happen since cache is array indexed by value
}
jlong offset = arrayOopDesc::base_offset_in_bytes(T_OBJECT) - (cache_low << shift);
if (offset != (int)offset) {
return NULL; // should not happen since cache is array indexed by value
}
// Add up all the offsets making of the address of the load
Node* result = elements[0];
for (int i = 1; i < count; i++) {
result = phase->transform(new (phase->C) AddXNode(result, elements[i]));
}
// Remove the constant offset from the address and then
result = phase->transform(new (phase->C) AddXNode(result, phase->MakeConX(-(int)offset)));
// remove the scaling of the offset to recover the original index.
if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) {
// Peel the shift off directly but wrap it in a dummy node
// since Ideal can't return existing nodes
result = new (phase->C) RShiftXNode(result->in(1), phase->intcon(0));
} else if (result->is_Add() && result->in(2)->is_Con() &&
result->in(1)->Opcode() == Op_LShiftX &&
result->in(1)->in(2) == phase->intcon(shift)) {
// We can't do general optimization: ((X<<Z) + Y) >> Z ==> X + (Y>>Z)
// but for boxing cache access we know that X<<Z will not overflow
// (there is range check) so we do this optimizatrion by hand here.
Node* add_con = new (phase->C) RShiftXNode(result->in(2), phase->intcon(shift));
result = new (phase->C) AddXNode(result->in(1)->in(1), phase->transform(add_con));
} else {
result = new (phase->C) RShiftXNode(result, phase->intcon(shift));
}
#ifdef _LP64 #ifdef _LP64
result = new (phase->C) ConvL2INode(phase->transform(result)); if (bt != T_LONG) {
result = new (phase->C) ConvL2INode(phase->transform(result));
}
#else
if (bt == T_LONG) {
result = new (phase->C) ConvI2LNode(phase->transform(result));
}
#endif #endif
return result; return result;
}
} }
} }
} }
@ -1293,65 +1263,131 @@ Node* LoadNode::eliminate_autobox(PhaseGVN* phase) {
return NULL; return NULL;
} }
//------------------------------split_through_phi------------------------------ static bool stable_phi(PhiNode* phi, PhaseGVN *phase) {
// Split instance field load through Phi. Node* region = phi->in(0);
Node *LoadNode::split_through_phi(PhaseGVN *phase) {
Node* mem = in(MemNode::Memory);
Node* address = in(MemNode::Address);
const TypePtr *addr_t = phase->type(address)->isa_ptr();
const TypeOopPtr *t_oop = addr_t->isa_oopptr();
assert(mem->is_Phi() && (t_oop != NULL) &&
t_oop->is_known_instance_field(), "invalide conditions");
Node *region = mem->in(0);
if (region == NULL) { if (region == NULL) {
return NULL; // Wait stable graph return false; // Wait stable graph
} }
uint cnt = mem->req(); uint cnt = phi->req();
for (uint i = 1; i < cnt; i++) { for (uint i = 1; i < cnt; i++) {
Node* rc = region->in(i); Node* rc = region->in(i);
if (rc == NULL || phase->type(rc) == Type::TOP) if (rc == NULL || phase->type(rc) == Type::TOP)
return NULL; // Wait stable graph return false; // Wait stable graph
Node *in = mem->in(i); Node* in = phi->in(i);
if (in == NULL) { if (in == NULL || phase->type(in) == Type::TOP)
return false; // Wait stable graph
}
return true;
}
//------------------------------split_through_phi------------------------------
// Split instance or boxed field load through Phi.
Node *LoadNode::split_through_phi(PhaseGVN *phase) {
Node* mem = in(Memory);
Node* address = in(Address);
const TypeOopPtr *t_oop = phase->type(address)->isa_oopptr();
assert((t_oop != NULL) &&
(t_oop->is_known_instance_field() ||
t_oop->is_ptr_to_boxed_value()), "invalide conditions");
Compile* C = phase->C;
intptr_t ignore = 0;
Node* base = AddPNode::Ideal_base_and_offset(address, phase, ignore);
bool base_is_phi = (base != NULL) && base->is_Phi();
bool load_boxed_values = t_oop->is_ptr_to_boxed_value() && C->aggressive_unboxing() &&
(base != NULL) && (base == address->in(AddPNode::Base)) &&
phase->type(base)->higher_equal(TypePtr::NOTNULL);
if (!((mem->is_Phi() || base_is_phi) &&
(load_boxed_values || t_oop->is_known_instance_field()))) {
return NULL; // memory is not Phi
}
if (mem->is_Phi()) {
if (!stable_phi(mem->as_Phi(), phase)) {
return NULL; // Wait stable graph return NULL; // Wait stable graph
} }
} uint cnt = mem->req();
// Check for loop invariant. // Check for loop invariant memory.
if (cnt == 3) { if (cnt == 3) {
for (uint i = 1; i < cnt; i++) { for (uint i = 1; i < cnt; i++) {
Node *in = mem->in(i); Node* in = mem->in(i);
Node* m = MemNode::optimize_memory_chain(in, addr_t, phase); Node* m = optimize_memory_chain(in, t_oop, this, phase);
if (m == mem) { if (m == mem) {
set_req(MemNode::Memory, mem->in(cnt - i)); // Skip this phi. set_req(Memory, mem->in(cnt - i));
return this; return this; // made change
}
} }
} }
} }
if (base_is_phi) {
if (!stable_phi(base->as_Phi(), phase)) {
return NULL; // Wait stable graph
}
uint cnt = base->req();
// Check for loop invariant memory.
if (cnt == 3) {
for (uint i = 1; i < cnt; i++) {
if (base->in(i) == base) {
return NULL; // Wait stable graph
}
}
}
}
bool load_boxed_phi = load_boxed_values && base_is_phi && (base->in(0) == mem->in(0));
// Split through Phi (see original code in loopopts.cpp). // Split through Phi (see original code in loopopts.cpp).
assert(phase->C->have_alias_type(addr_t), "instance should have alias type"); assert(C->have_alias_type(t_oop), "instance should have alias type");
// Do nothing here if Identity will find a value // Do nothing here if Identity will find a value
// (to avoid infinite chain of value phis generation). // (to avoid infinite chain of value phis generation).
if (!phase->eqv(this, this->Identity(phase))) if (!phase->eqv(this, this->Identity(phase)))
return NULL; return NULL;
// Skip the split if the region dominates some control edge of the address. // Select Region to split through.
if (!MemNode::all_controls_dominate(address, region)) Node* region;
return NULL; if (!base_is_phi) {
assert(mem->is_Phi(), "sanity");
region = mem->in(0);
// Skip if the region dominates some control edge of the address.
if (!MemNode::all_controls_dominate(address, region))
return NULL;
} else if (!mem->is_Phi()) {
assert(base_is_phi, "sanity");
region = base->in(0);
// Skip if the region dominates some control edge of the memory.
if (!MemNode::all_controls_dominate(mem, region))
return NULL;
} else if (base->in(0) != mem->in(0)) {
assert(base_is_phi && mem->is_Phi(), "sanity");
if (MemNode::all_controls_dominate(mem, base->in(0))) {
region = base->in(0);
} else if (MemNode::all_controls_dominate(address, mem->in(0))) {
region = mem->in(0);
} else {
return NULL; // complex graph
}
} else {
assert(base->in(0) == mem->in(0), "sanity");
region = mem->in(0);
}
const Type* this_type = this->bottom_type(); const Type* this_type = this->bottom_type();
int this_index = phase->C->get_alias_index(addr_t); int this_index = C->get_alias_index(t_oop);
int this_offset = addr_t->offset(); int this_offset = t_oop->offset();
int this_iid = addr_t->is_oopptr()->instance_id(); int this_iid = t_oop->instance_id();
PhaseIterGVN *igvn = phase->is_IterGVN(); if (!t_oop->is_known_instance() && load_boxed_values) {
Node *phi = new (igvn->C) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset); // Use _idx of address base for boxed values.
this_iid = base->_idx;
}
PhaseIterGVN* igvn = phase->is_IterGVN();
Node* phi = new (C) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset);
for (uint i = 1; i < region->req(); i++) { for (uint i = 1; i < region->req(); i++) {
Node *x; Node* x;
Node* the_clone = NULL; Node* the_clone = NULL;
if (region->in(i) == phase->C->top()) { if (region->in(i) == C->top()) {
x = phase->C->top(); // Dead path? Use a dead data op x = C->top(); // Dead path? Use a dead data op
} else { } else {
x = this->clone(); // Else clone up the data op x = this->clone(); // Else clone up the data op
the_clone = x; // Remember for possible deletion. the_clone = x; // Remember for possible deletion.
@ -1361,10 +1397,16 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) {
} else { } else {
x->set_req(0, NULL); x->set_req(0, NULL);
} }
for (uint j = 1; j < this->req(); j++) { if (mem->is_Phi() && (mem->in(0) == region)) {
Node *in = this->in(j); x->set_req(Memory, mem->in(i)); // Use pre-Phi input for the clone.
if (in->is_Phi() && in->in(0) == region) }
x->set_req(j, in->in(i)); // Use pre-Phi input for the clone if (address->is_Phi() && address->in(0) == region) {
x->set_req(Address, address->in(i)); // Use pre-Phi input for the clone
}
if (base_is_phi && (base->in(0) == region)) {
Node* base_x = base->in(i); // Clone address for loads from boxed objects.
Node* adr_x = phase->transform(new (C) AddPNode(base_x,base_x,address->in(AddPNode::Offset)));
x->set_req(Address, adr_x);
} }
} }
// Check for a 'win' on some paths // Check for a 'win' on some paths
@ -1394,7 +1436,7 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) {
if (y != x) { if (y != x) {
x = y; x = y;
} else { } else {
y = igvn->hash_find(x); y = igvn->hash_find_insert(x);
if (y) { if (y) {
x = y; x = y;
} else { } else {
@ -1405,8 +1447,9 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) {
} }
} }
} }
if (x != the_clone && the_clone != NULL) if (x != the_clone && the_clone != NULL) {
igvn->remove_dead_node(the_clone); igvn->remove_dead_node(the_clone);
}
phi->set_req(i, x); phi->set_req(i, x);
} }
// Record Phi // Record Phi
@ -1445,31 +1488,23 @@ Node *LoadNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// A method-invariant, non-null address (constant or 'this' argument). // A method-invariant, non-null address (constant or 'this' argument).
set_req(MemNode::Control, NULL); set_req(MemNode::Control, NULL);
} }
if (EliminateAutoBox && can_reshape) {
assert(!phase->type(base)->higher_equal(TypePtr::NULL_PTR), "the autobox pointer should be non-null");
Compile::AliasType* atp = phase->C->alias_type(adr_type());
if (is_autobox_object(atp)) {
Node* result = eliminate_autobox(phase);
if (result != NULL) return result;
}
}
} }
Node* mem = in(MemNode::Memory); Node* mem = in(MemNode::Memory);
const TypePtr *addr_t = phase->type(address)->isa_ptr(); const TypePtr *addr_t = phase->type(address)->isa_ptr();
if (addr_t != NULL) { if (can_reshape && (addr_t != NULL)) {
// try to optimize our memory input // try to optimize our memory input
Node* opt_mem = MemNode::optimize_memory_chain(mem, addr_t, phase); Node* opt_mem = MemNode::optimize_memory_chain(mem, addr_t, this, phase);
if (opt_mem != mem) { if (opt_mem != mem) {
set_req(MemNode::Memory, opt_mem); set_req(MemNode::Memory, opt_mem);
if (phase->type( opt_mem ) == Type::TOP) return NULL; if (phase->type( opt_mem ) == Type::TOP) return NULL;
return this; return this;
} }
const TypeOopPtr *t_oop = addr_t->isa_oopptr(); const TypeOopPtr *t_oop = addr_t->isa_oopptr();
if (can_reshape && opt_mem->is_Phi() && if ((t_oop != NULL) &&
(t_oop != NULL) && t_oop->is_known_instance_field()) { (t_oop->is_known_instance_field() ||
t_oop->is_ptr_to_boxed_value())) {
PhaseIterGVN *igvn = phase->is_IterGVN(); PhaseIterGVN *igvn = phase->is_IterGVN();
if (igvn != NULL && igvn->_worklist.member(opt_mem)) { if (igvn != NULL && igvn->_worklist.member(opt_mem)) {
// Delay this transformation until memory Phi is processed. // Delay this transformation until memory Phi is processed.
@ -1479,6 +1514,11 @@ Node *LoadNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// Split instance field load through Phi. // Split instance field load through Phi.
Node* result = split_through_phi(phase); Node* result = split_through_phi(phase);
if (result != NULL) return result; if (result != NULL) return result;
if (t_oop->is_ptr_to_boxed_value()) {
Node* result = eliminate_autobox(phase);
if (result != NULL) return result;
}
} }
} }
@ -1587,18 +1627,23 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const {
// This can happen if a interface-typed array narrows to a class type. // This can happen if a interface-typed array narrows to a class type.
jt = _type; jt = _type;
} }
#ifdef ASSERT
if (EliminateAutoBox && adr->is_AddP()) { if (phase->C->eliminate_boxing() && adr->is_AddP()) {
// The pointers in the autobox arrays are always non-null // The pointers in the autobox arrays are always non-null
Node* base = adr->in(AddPNode::Base); Node* base = adr->in(AddPNode::Base);
if (base != NULL && if ((base != NULL) && base->is_DecodeN()) {
!phase->type(base)->higher_equal(TypePtr::NULL_PTR)) { // Get LoadN node which loads IntegerCache.cache field
Compile::AliasType* atp = C->alias_type(base->adr_type()); base = base->in(1);
if (is_autobox_cache(atp)) { }
return jt->join(TypePtr::NOTNULL)->is_ptr(); if ((base != NULL) && base->is_Con()) {
const TypeAryPtr* base_type = base->bottom_type()->isa_aryptr();
if ((base_type != NULL) && base_type->is_autobox_cache()) {
// It could be narrow oop
assert(jt->make_ptr()->ptr() == TypePtr::NotNull,"sanity");
} }
} }
} }
#endif
return jt; return jt;
} }
} }
@ -1638,6 +1683,10 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const {
// Optimizations for constant objects // Optimizations for constant objects
ciObject* const_oop = tinst->const_oop(); ciObject* const_oop = tinst->const_oop();
if (const_oop != NULL) { if (const_oop != NULL) {
// For constant Boxed value treat the target field as a compile time constant.
if (tinst->is_ptr_to_boxed_value()) {
return tinst->get_const_boxed_value();
} else
// For constant CallSites treat the target field as a compile time constant. // For constant CallSites treat the target field as a compile time constant.
if (const_oop->is_call_site()) { if (const_oop->is_call_site()) {
ciCallSite* call_site = const_oop->as_call_site(); ciCallSite* call_site = const_oop->as_call_site();
@ -1759,7 +1808,8 @@ const Type *LoadNode::Value( PhaseTransform *phase ) const {
// (Also allow a variable load from a fresh array to produce zero.) // (Also allow a variable load from a fresh array to produce zero.)
const TypeOopPtr *tinst = tp->isa_oopptr(); const TypeOopPtr *tinst = tp->isa_oopptr();
bool is_instance = (tinst != NULL) && tinst->is_known_instance_field(); bool is_instance = (tinst != NULL) && tinst->is_known_instance_field();
if (ReduceFieldZeroing || is_instance) { bool is_boxed_value = (tinst != NULL) && tinst->is_ptr_to_boxed_value();
if (ReduceFieldZeroing || is_instance || is_boxed_value) {
Node* value = can_see_stored_value(mem,phase); Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con()) { if (value != NULL && value->is_Con()) {
assert(value->bottom_type()->higher_equal(_type),"sanity"); assert(value->bottom_type()->higher_equal(_type),"sanity");
@ -2883,24 +2933,38 @@ Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if (in(0) && in(0)->is_top()) return NULL; if (in(0) && in(0)->is_top()) return NULL;
// Eliminate volatile MemBars for scalar replaced objects. // Eliminate volatile MemBars for scalar replaced objects.
if (can_reshape && req() == (Precedent+1) && if (can_reshape && req() == (Precedent+1)) {
(Opcode() == Op_MemBarAcquire || Opcode() == Op_MemBarVolatile)) { bool eliminate = false;
// Volatile field loads and stores. int opc = Opcode();
Node* my_mem = in(MemBarNode::Precedent); if ((opc == Op_MemBarAcquire || opc == Op_MemBarVolatile)) {
if (my_mem != NULL && my_mem->is_Mem()) { // Volatile field loads and stores.
const TypeOopPtr* t_oop = my_mem->in(MemNode::Address)->bottom_type()->isa_oopptr(); Node* my_mem = in(MemBarNode::Precedent);
// Check for scalar replaced object reference. if (my_mem != NULL && my_mem->is_Mem()) {
if( t_oop != NULL && t_oop->is_known_instance_field() && const TypeOopPtr* t_oop = my_mem->in(MemNode::Address)->bottom_type()->isa_oopptr();
t_oop->offset() != Type::OffsetBot && // Check for scalar replaced object reference.
t_oop->offset() != Type::OffsetTop) { if( t_oop != NULL && t_oop->is_known_instance_field() &&
// Replace MemBar projections by its inputs. t_oop->offset() != Type::OffsetBot &&
PhaseIterGVN* igvn = phase->is_IterGVN(); t_oop->offset() != Type::OffsetTop) {
igvn->replace_node(proj_out(TypeFunc::Memory), in(TypeFunc::Memory)); eliminate = true;
igvn->replace_node(proj_out(TypeFunc::Control), in(TypeFunc::Control)); }
// Must return either the original node (now dead) or a new node
// (Do not return a top here, since that would break the uniqueness of top.)
return new (phase->C) ConINode(TypeInt::ZERO);
} }
} else if (opc == Op_MemBarRelease) {
// Final field stores.
Node* alloc = AllocateNode::Ideal_allocation(in(MemBarNode::Precedent), phase);
if ((alloc != NULL) && alloc->is_Allocate() &&
alloc->as_Allocate()->_is_non_escaping) {
// The allocated object does not escape.
eliminate = true;
}
}
if (eliminate) {
// Replace MemBar projections by its inputs.
PhaseIterGVN* igvn = phase->is_IterGVN();
igvn->replace_node(proj_out(TypeFunc::Memory), in(TypeFunc::Memory));
igvn->replace_node(proj_out(TypeFunc::Control), in(TypeFunc::Control));
// Must return either the original node (now dead) or a new node
// (Do not return a top here, since that would break the uniqueness of top.)
return new (phase->C) ConINode(TypeInt::ZERO);
} }
} }
return NULL; return NULL;
@ -3113,9 +3177,7 @@ intptr_t InitializeNode::get_store_offset(Node* st, PhaseTransform* phase) {
// within the initialization without creating a vicious cycle, such as: // within the initialization without creating a vicious cycle, such as:
// { Foo p = new Foo(); p.next = p; } // { Foo p = new Foo(); p.next = p; }
// True for constants and parameters and small combinations thereof. // True for constants and parameters and small combinations thereof.
bool InitializeNode::detect_init_independence(Node* n, bool InitializeNode::detect_init_independence(Node* n, int& count) {
bool st_is_pinned,
int& count) {
if (n == NULL) return true; // (can this really happen?) if (n == NULL) return true; // (can this really happen?)
if (n->is_Proj()) n = n->in(0); if (n->is_Proj()) n = n->in(0);
if (n == this) return false; // found a cycle if (n == this) return false; // found a cycle
@ -3135,7 +3197,6 @@ bool InitializeNode::detect_init_independence(Node* n,
// a store is never pinned *before* the availability of its inputs. // a store is never pinned *before* the availability of its inputs.
if (!MemNode::all_controls_dominate(n, this)) if (!MemNode::all_controls_dominate(n, this))
return false; // failed to prove a good control return false; // failed to prove a good control
} }
// Check data edges for possible dependencies on 'this'. // Check data edges for possible dependencies on 'this'.
@ -3145,7 +3206,7 @@ bool InitializeNode::detect_init_independence(Node* n,
if (m == NULL || m == n || m->is_top()) continue; if (m == NULL || m == n || m->is_top()) continue;
uint first_i = n->find_edge(m); uint first_i = n->find_edge(m);
if (i != first_i) continue; // process duplicate edge just once if (i != first_i) continue; // process duplicate edge just once
if (!detect_init_independence(m, st_is_pinned, count)) { if (!detect_init_independence(m, count)) {
return false; return false;
} }
} }
@ -3176,7 +3237,7 @@ intptr_t InitializeNode::can_capture_store(StoreNode* st, PhaseTransform* phase,
return FAIL; // wrong allocation! (store needs to float up) return FAIL; // wrong allocation! (store needs to float up)
Node* val = st->in(MemNode::ValueIn); Node* val = st->in(MemNode::ValueIn);
int complexity_count = 0; int complexity_count = 0;
if (!detect_init_independence(val, true, complexity_count)) if (!detect_init_independence(val, complexity_count))
return FAIL; // stored value must be 'simple enough' return FAIL; // stored value must be 'simple enough'
// The Store can be captured only if nothing after the allocation // The Store can be captured only if nothing after the allocation

View File

@ -75,8 +75,8 @@ public:
PhaseTransform* phase); PhaseTransform* phase);
static bool adr_phi_is_loop_invariant(Node* adr_phi, Node* cast); static bool adr_phi_is_loop_invariant(Node* adr_phi, Node* cast);
static Node *optimize_simple_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase); static Node *optimize_simple_memory_chain(Node *mchain, const TypeOopPtr *t_oop, Node *load, PhaseGVN *phase);
static Node *optimize_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase); static Node *optimize_memory_chain(Node *mchain, const TypePtr *t_adr, Node *load, PhaseGVN *phase);
// This one should probably be a phase-specific function: // This one should probably be a phase-specific function:
static bool all_controls_dominate(Node* dom, Node* sub); static bool all_controls_dominate(Node* dom, Node* sub);
@ -1099,7 +1099,7 @@ public:
Node* make_raw_address(intptr_t offset, PhaseTransform* phase); Node* make_raw_address(intptr_t offset, PhaseTransform* phase);
bool detect_init_independence(Node* n, bool st_is_pinned, int& count); bool detect_init_independence(Node* n, int& count);
void coalesce_subword_stores(intptr_t header_size, Node* size_in_bytes, void coalesce_subword_stores(intptr_t header_size, Node* size_in_bytes,
PhaseGVN* phase); PhaseGVN* phase);

View File

@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "opto/callnode.hpp"
#include "opto/matcher.hpp" #include "opto/matcher.hpp"
#include "opto/multnode.hpp" #include "opto/multnode.hpp"
#include "opto/opcodes.hpp" #include "opto/opcodes.hpp"
@ -73,13 +74,26 @@ bool ProjNode::is_CFG() const {
return (_con == TypeFunc::Control && def->is_CFG()); return (_con == TypeFunc::Control && def->is_CFG());
} }
const Type* ProjNode::proj_type(const Type* t) const {
if (t == Type::TOP) {
return Type::TOP;
}
if (t == Type::BOTTOM) {
return Type::BOTTOM;
}
t = t->is_tuple()->field_at(_con);
Node* n = in(0);
if ((_con == TypeFunc::Parms) &&
n->is_CallStaticJava() && n->as_CallStaticJava()->is_boxing_method()) {
// The result of autoboxing is always non-null on normal path.
t = t->join(TypePtr::NOTNULL);
}
return t;
}
const Type *ProjNode::bottom_type() const { const Type *ProjNode::bottom_type() const {
if (in(0) == NULL) return Type::TOP; if (in(0) == NULL) return Type::TOP;
const Type *tb = in(0)->bottom_type(); return proj_type(in(0)->bottom_type());
if( tb == Type::TOP ) return Type::TOP;
if( tb == Type::BOTTOM ) return Type::BOTTOM;
const TypeTuple *t = tb->is_tuple();
return t->field_at(_con);
} }
const TypePtr *ProjNode::adr_type() const { const TypePtr *ProjNode::adr_type() const {
@ -115,11 +129,8 @@ void ProjNode::check_con() const {
//------------------------------Value------------------------------------------ //------------------------------Value------------------------------------------
const Type *ProjNode::Value( PhaseTransform *phase ) const { const Type *ProjNode::Value( PhaseTransform *phase ) const {
if( !in(0) ) return Type::TOP; if (in(0) == NULL) return Type::TOP;
const Type *t = phase->type(in(0)); return proj_type(phase->type(in(0)));
if( t == Type::TOP ) return t;
if( t == Type::BOTTOM ) return t;
return t->is_tuple()->field_at(_con);
} }
//------------------------------out_RegMask------------------------------------ //------------------------------out_RegMask------------------------------------

View File

@ -60,6 +60,7 @@ protected:
virtual uint cmp( const Node &n ) const; virtual uint cmp( const Node &n ) const;
virtual uint size_of() const; virtual uint size_of() const;
void check_con() const; // Called from constructor. void check_con() const; // Called from constructor.
const Type* proj_type(const Type* t) const;
public: public:
ProjNode( Node *src, uint con, bool io_use = false ) ProjNode( Node *src, uint con, bool io_use = false )
@ -83,6 +84,7 @@ public:
virtual const Type *Value( PhaseTransform *phase ) const; virtual const Type *Value( PhaseTransform *phase ) const;
virtual uint ideal_reg() const; virtual uint ideal_reg() const;
virtual const RegMask &out_RegMask() const; virtual const RegMask &out_RegMask() const;
#ifndef PRODUCT #ifndef PRODUCT
virtual void dump_spec(outputStream *st) const; virtual void dump_spec(outputStream *st) const;
#endif #endif

View File

@ -67,7 +67,8 @@ void Node::verify_construction() {
} }
Compile::set_debug_idx(new_debug_idx); Compile::set_debug_idx(new_debug_idx);
set_debug_idx( new_debug_idx ); set_debug_idx( new_debug_idx );
assert(Compile::current()->unique() < (UINT_MAX - 1), "Node limit exceeded UINT_MAX"); assert(Compile::current()->unique() < (INT_MAX - 1), "Node limit exceeded INT_MAX");
assert(Compile::current()->live_nodes() < (uint)MaxNodeLimit, "Live Node limit exceeded limit");
if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) { if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) {
tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx); tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx);
BREAKPOINT; BREAKPOINT;
@ -471,9 +472,9 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3,
//------------------------------clone------------------------------------------ //------------------------------clone------------------------------------------
// Clone a Node. // Clone a Node.
Node *Node::clone() const { Node *Node::clone() const {
Compile *compile = Compile::current(); Compile* C = Compile::current();
uint s = size_of(); // Size of inherited Node uint s = size_of(); // Size of inherited Node
Node *n = (Node*)compile->node_arena()->Amalloc_D(size_of() + _max*sizeof(Node*)); Node *n = (Node*)C->node_arena()->Amalloc_D(size_of() + _max*sizeof(Node*));
Copy::conjoint_words_to_lower((HeapWord*)this, (HeapWord*)n, s); Copy::conjoint_words_to_lower((HeapWord*)this, (HeapWord*)n, s);
// Set the new input pointer array // Set the new input pointer array
n->_in = (Node**)(((char*)n)+s); n->_in = (Node**)(((char*)n)+s);
@ -492,18 +493,18 @@ Node *Node::clone() const {
if (x != NULL) x->add_out(n); if (x != NULL) x->add_out(n);
} }
if (is_macro()) if (is_macro())
compile->add_macro_node(n); C->add_macro_node(n);
if (is_expensive()) if (is_expensive())
compile->add_expensive_node(n); C->add_expensive_node(n);
n->set_idx(compile->next_unique()); // Get new unique index as well n->set_idx(C->next_unique()); // Get new unique index as well
debug_only( n->verify_construction() ); debug_only( n->verify_construction() );
NOT_PRODUCT(nodes_created++); NOT_PRODUCT(nodes_created++);
// Do not patch over the debug_idx of a clone, because it makes it // Do not patch over the debug_idx of a clone, because it makes it
// impossible to break on the clone's moment of creation. // impossible to break on the clone's moment of creation.
//debug_only( n->set_debug_idx( debug_idx() ) ); //debug_only( n->set_debug_idx( debug_idx() ) );
compile->copy_node_notes_to(n, (Node*) this); C->copy_node_notes_to(n, (Node*) this);
// MachNode clone // MachNode clone
uint nopnds; uint nopnds;
@ -518,13 +519,12 @@ Node *Node::clone() const {
(const void*)(&mthis->_opnds), 1)); (const void*)(&mthis->_opnds), 1));
mach->_opnds = to; mach->_opnds = to;
for ( uint i = 0; i < nopnds; ++i ) { for ( uint i = 0; i < nopnds; ++i ) {
to[i] = from[i]->clone(compile); to[i] = from[i]->clone(C);
} }
} }
// cloning CallNode may need to clone JVMState // cloning CallNode may need to clone JVMState
if (n->is_Call()) { if (n->is_Call()) {
CallNode *call = n->as_Call(); n->as_Call()->clone_jvms(C);
call->clone_jvms();
} }
return n; // Return the clone return n; // Return the clone
} }
@ -811,6 +811,21 @@ int Node::replace_edge(Node* old, Node* neww) {
return nrep; return nrep;
} }
/**
* Replace input edges in the range pointing to 'old' node.
*/
int Node::replace_edges_in_range(Node* old, Node* neww, int start, int end) {
if (old == neww) return 0; // nothing to do
uint nrep = 0;
for (int i = start; i < end; i++) {
if (in(i) == old) {
set_req(i, neww);
nrep++;
}
}
return nrep;
}
//-------------------------disconnect_inputs----------------------------------- //-------------------------disconnect_inputs-----------------------------------
// NULL out all inputs to eliminate incoming Def-Use edges. // NULL out all inputs to eliminate incoming Def-Use edges.
// Return the number of edges between 'n' and 'this' // Return the number of edges between 'n' and 'this'
@ -1383,6 +1398,21 @@ const TypeLong* Node::find_long_type() const {
return NULL; return NULL;
} }
/**
* Return a ptr type for nodes which should have it.
*/
const TypePtr* Node::get_ptr_type() const {
const TypePtr* tp = this->bottom_type()->make_ptr();
#ifdef ASSERT
if (tp == NULL) {
this->dump(1);
assert((tp != NULL), "unexpected node type");
}
#endif
return tp;
}
// Get a double constant from a ConstNode. // Get a double constant from a ConstNode.
// Returns the constant if it is a double ConstNode // Returns the constant if it is a double ConstNode
jdouble Node::getd() const { jdouble Node::getd() const {

View File

@ -410,6 +410,7 @@ protected:
// Find first occurrence of n among my edges: // Find first occurrence of n among my edges:
int find_edge(Node* n); int find_edge(Node* n);
int replace_edge(Node* old, Node* neww); int replace_edge(Node* old, Node* neww);
int replace_edges_in_range(Node* old, Node* neww, int start, int end);
// NULL out all inputs to eliminate incoming Def-Use edges. // NULL out all inputs to eliminate incoming Def-Use edges.
// Return the number of edges between 'n' and 'this' // Return the number of edges between 'n' and 'this'
int disconnect_inputs(Node *n, Compile *c); int disconnect_inputs(Node *n, Compile *c);
@ -964,6 +965,8 @@ public:
} }
const TypeLong* find_long_type() const; const TypeLong* find_long_type() const;
const TypePtr* get_ptr_type() const;
// These guys are called by code generated by ADLC: // These guys are called by code generated by ADLC:
intptr_t get_ptr() const; intptr_t get_ptr() const;
intptr_t get_narrowcon() const; intptr_t get_narrowcon() const;

View File

@ -929,7 +929,7 @@ void Compile::Process_OopMap_Node(MachNode *mach, int current_offset) {
scval = new_loc_value( _regalloc, obj_reg, Location::oop ); scval = new_loc_value( _regalloc, obj_reg, Location::oop );
} }
} else { } else {
const TypePtr *tp = obj_node->bottom_type()->make_ptr(); const TypePtr *tp = obj_node->get_ptr_type();
scval = new ConstantOopWriteValue(tp->is_oopptr()->const_oop()->constant_encoding()); scval = new ConstantOopWriteValue(tp->is_oopptr()->const_oop()->constant_encoding());
} }

View File

@ -330,6 +330,7 @@ class Parse : public GraphKit {
bool _wrote_final; // Did we write a final field? bool _wrote_final; // Did we write a final field?
bool _count_invocations; // update and test invocation counter bool _count_invocations; // update and test invocation counter
bool _method_data_update; // update method data oop bool _method_data_update; // update method data oop
Node* _alloc_with_final; // An allocation node with final field
// Variables which track Java semantics during bytecode parsing: // Variables which track Java semantics during bytecode parsing:
@ -370,6 +371,11 @@ class Parse : public GraphKit {
void set_wrote_final(bool z) { _wrote_final = z; } void set_wrote_final(bool z) { _wrote_final = z; }
bool count_invocations() const { return _count_invocations; } bool count_invocations() const { return _count_invocations; }
bool method_data_update() const { return _method_data_update; } bool method_data_update() const { return _method_data_update; }
Node* alloc_with_final() const { return _alloc_with_final; }
void set_alloc_with_final(Node* n) {
assert((_alloc_with_final == NULL) || (_alloc_with_final == n), "different init objects?");
_alloc_with_final = n;
}
Block* block() const { return _block; } Block* block() const { return _block; }
ciBytecodeStream& iter() { return _iter; } ciBytecodeStream& iter() { return _iter; }
@ -512,7 +518,7 @@ class Parse : public GraphKit {
// loading from a constant field or the constant pool // loading from a constant field or the constant pool
// returns false if push failed (non-perm field constants only, not ldcs) // returns false if push failed (non-perm field constants only, not ldcs)
bool push_constant(ciConstant con, bool require_constant = false); bool push_constant(ciConstant con, bool require_constant = false, bool is_autobox_cache = false);
// implementation of object creation bytecodes // implementation of object creation bytecodes
void emit_guard_for_new(ciInstanceKlass* klass); void emit_guard_for_new(ciInstanceKlass* klass);

View File

@ -390,6 +390,7 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses)
_expected_uses = expected_uses; _expected_uses = expected_uses;
_depth = 1 + (caller->has_method() ? caller->depth() : 0); _depth = 1 + (caller->has_method() ? caller->depth() : 0);
_wrote_final = false; _wrote_final = false;
_alloc_with_final = NULL;
_entry_bci = InvocationEntryBci; _entry_bci = InvocationEntryBci;
_tf = NULL; _tf = NULL;
_block = NULL; _block = NULL;
@ -723,6 +724,8 @@ void Parse::build_exits() {
// Note: iophi and memphi are not transformed until do_exits. // Note: iophi and memphi are not transformed until do_exits.
Node* iophi = new (C) PhiNode(region, Type::ABIO); Node* iophi = new (C) PhiNode(region, Type::ABIO);
Node* memphi = new (C) PhiNode(region, Type::MEMORY, TypePtr::BOTTOM); Node* memphi = new (C) PhiNode(region, Type::MEMORY, TypePtr::BOTTOM);
gvn().set_type_bottom(iophi);
gvn().set_type_bottom(memphi);
_exits.set_i_o(iophi); _exits.set_i_o(iophi);
_exits.set_all_memory(memphi); _exits.set_all_memory(memphi);
@ -738,6 +741,7 @@ void Parse::build_exits() {
} }
int ret_size = type2size[ret_type->basic_type()]; int ret_size = type2size[ret_type->basic_type()];
Node* ret_phi = new (C) PhiNode(region, ret_type); Node* ret_phi = new (C) PhiNode(region, ret_type);
gvn().set_type_bottom(ret_phi);
_exits.ensure_stack(ret_size); _exits.ensure_stack(ret_size);
assert((int)(tf()->range()->cnt() - TypeFunc::Parms) == ret_size, "good tf range"); assert((int)(tf()->range()->cnt() - TypeFunc::Parms) == ret_size, "good tf range");
assert(method()->return_type()->size() == ret_size, "tf agrees w/ method"); assert(method()->return_type()->size() == ret_size, "tf agrees w/ method");
@ -917,7 +921,7 @@ void Parse::do_exits() {
// such unusual early publications. But no barrier is needed on // such unusual early publications. But no barrier is needed on
// exceptional returns, since they cannot publish normally. // exceptional returns, since they cannot publish normally.
// //
_exits.insert_mem_bar(Op_MemBarRelease); _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
#ifndef PRODUCT #ifndef PRODUCT
if (PrintOpto && (Verbose || WizardMode)) { if (PrintOpto && (Verbose || WizardMode)) {
method()->print_name(); method()->print_name();

View File

@ -987,7 +987,7 @@ void Parse::do_ifnull(BoolTest::mask btest, Node *c) {
uncommon_trap(Deoptimization::Reason_unreached, uncommon_trap(Deoptimization::Reason_unreached,
Deoptimization::Action_reinterpret, Deoptimization::Action_reinterpret,
NULL, "cold"); NULL, "cold");
if (EliminateAutoBox) { if (C->eliminate_boxing()) {
// Mark the successor blocks as parsed // Mark the successor blocks as parsed
branch_block->next_path_num(); branch_block->next_path_num();
next_block->next_path_num(); next_block->next_path_num();
@ -1012,7 +1012,7 @@ void Parse::do_ifnull(BoolTest::mask btest, Node *c) {
if (stopped()) { // Path is dead? if (stopped()) { // Path is dead?
explicit_null_checks_elided++; explicit_null_checks_elided++;
if (EliminateAutoBox) { if (C->eliminate_boxing()) {
// Mark the successor block as parsed // Mark the successor block as parsed
branch_block->next_path_num(); branch_block->next_path_num();
} }
@ -1032,7 +1032,7 @@ void Parse::do_ifnull(BoolTest::mask btest, Node *c) {
if (stopped()) { // Path is dead? if (stopped()) { // Path is dead?
explicit_null_checks_elided++; explicit_null_checks_elided++;
if (EliminateAutoBox) { if (C->eliminate_boxing()) {
// Mark the successor block as parsed // Mark the successor block as parsed
next_block->next_path_num(); next_block->next_path_num();
} }
@ -1069,7 +1069,7 @@ void Parse::do_if(BoolTest::mask btest, Node* c) {
uncommon_trap(Deoptimization::Reason_unreached, uncommon_trap(Deoptimization::Reason_unreached,
Deoptimization::Action_reinterpret, Deoptimization::Action_reinterpret,
NULL, "cold"); NULL, "cold");
if (EliminateAutoBox) { if (C->eliminate_boxing()) {
// Mark the successor blocks as parsed // Mark the successor blocks as parsed
branch_block->next_path_num(); branch_block->next_path_num();
next_block->next_path_num(); next_block->next_path_num();
@ -1135,7 +1135,7 @@ void Parse::do_if(BoolTest::mask btest, Node* c) {
set_control(taken_branch); set_control(taken_branch);
if (stopped()) { if (stopped()) {
if (EliminateAutoBox) { if (C->eliminate_boxing()) {
// Mark the successor block as parsed // Mark the successor block as parsed
branch_block->next_path_num(); branch_block->next_path_num();
} }
@ -1154,7 +1154,7 @@ void Parse::do_if(BoolTest::mask btest, Node* c) {
// Branch not taken. // Branch not taken.
if (stopped()) { if (stopped()) {
if (EliminateAutoBox) { if (C->eliminate_boxing()) {
// Mark the successor block as parsed // Mark the successor block as parsed
next_block->next_path_num(); next_block->next_path_num();
} }

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