This commit is contained in:
Lana Steuck 2014-06-20 10:15:08 -07:00
commit d27d12c32a
148 changed files with 4987 additions and 2813 deletions

View File

@ -24,37 +24,30 @@
# Sets make macros for making debug version of VM # Sets make macros for making debug version of VM
# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make
# They may also specify FASTDEBUG_CFLAGS, but it defaults to DEBUG_CFLAGS.
FASTDEBUG_CFLAGS$(FASTDEBUG_CFLAGS) = $(DEBUG_CFLAGS)
# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make # Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make
OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS)
OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@))
# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) # (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
ifeq ($(BUILDARCH), ia64)
# Bug in GCC, causes hang. -O1 will override the -O3 specified earlier
OPT_CFLAGS/callGenerator.o += -O1
OPT_CFLAGS/ciTypeFlow.o += -O1
OPT_CFLAGS/compile.o += -O1
OPT_CFLAGS/concurrentMarkSweepGeneration.o += -O1
OPT_CFLAGS/doCall.o += -O1
OPT_CFLAGS/generateOopMap.o += -O1
OPT_CFLAGS/generateOptoStub.o += -O1
OPT_CFLAGS/graphKit.o += -O1
OPT_CFLAGS/instanceKlass.o += -O1
OPT_CFLAGS/interpreterRT_ia64.o += -O1
OPT_CFLAGS/output.o += -O1
OPT_CFLAGS/parse1.o += -O1
OPT_CFLAGS/runtime.o += -O1
OPT_CFLAGS/synchronizer.o += -O1
endif
# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings # If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings
CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE)
# Set the environment variable HOTSPARC_GENERIC to "true" # Set the environment variable HOTSPARC_GENERIC to "true"
# to inhibit the effect of the previous line on CFLAGS. # to inhibit the effect of the previous line on CFLAGS.
# The following lines are copied from debug.make, except that we
# consult FASTDEBUG_CFLAGS instead of DEBUG_CFLAGS.
# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make
DEBUG_CFLAGS/DEFAULT= $(FASTDEBUG_CFLAGS)
DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@))
CFLAGS += $(DEBUG_CFLAGS/BYFILE)
# Linker mapfile # Linker mapfile
MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug
ifeq ($(OS_VENDOR), Darwin) ifeq ($(OS_VENDOR), Darwin)

View File

@ -100,7 +100,7 @@ else
endif endif
ifeq ($(USE_CLANG), true) ifeq ($(USE_CLANG), true)
# clang has precompiled headers support by default, but the user can switch # Clang has precompiled headers support by default, but the user can switch
# it off by using 'USE_PRECOMPILED_HEADER=0'. # it off by using 'USE_PRECOMPILED_HEADER=0'.
ifdef LP64 ifdef LP64
ifeq ($(USE_PRECOMPILED_HEADER),) ifeq ($(USE_PRECOMPILED_HEADER),)
@ -278,15 +278,18 @@ ifeq ($(OS_VENDOR), Darwin)
CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations
endif endif
# optimization control flags (Used by fastdebug and release variants)
OPT_CFLAGS/NOOPT=-O0
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
# Allow basic optimizations which don't distrupt debugging. (Principally dead code elimination)
OPT_CFLAGS/DEBUG=-Og
else
# Allow no optimizations.
OPT_CFLAGS/DEBUG=-O0
endif
OPT_CFLAGS/SIZE=-Os OPT_CFLAGS/SIZE=-Os
OPT_CFLAGS/SPEED=-O3 OPT_CFLAGS/SPEED=-O3
# Hotspot uses very unstrict aliasing turn this optimization off
# This option is added to CFLAGS rather than OPT_CFLAGS
# so that OPT_CFLAGS overrides get this option too.
CFLAGS += -fno-strict-aliasing
# The flags to use for an Optimized g++ build
ifeq ($(OS_VENDOR), Darwin) ifeq ($(OS_VENDOR), Darwin)
# use -Os by default, unless -O3 can be proved to be worth the cost, as per policy # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy
# <https://wiki.openjdk.java.net/display/MacOSXPort/Compiler+Errata> # <https://wiki.openjdk.java.net/display/MacOSXPort/Compiler+Errata>
@ -295,6 +298,11 @@ else
OPT_CFLAGS_DEFAULT ?= SPEED OPT_CFLAGS_DEFAULT ?= SPEED
endif endif
# Hotspot uses very unstrict aliasing turn this optimization off
# This option is added to CFLAGS rather than OPT_CFLAGS
# so that OPT_CFLAGS overrides get this option too.
CFLAGS += -fno-strict-aliasing
ifdef OPT_CFLAGS ifdef OPT_CFLAGS
ifneq ("$(origin OPT_CFLAGS)", "command line") ifneq ("$(origin OPT_CFLAGS)", "command line")
$(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
@ -309,8 +317,6 @@ ifeq ($(BUILDARCH), ia64)
OPT_CFLAGS += -fno-expensive-optimizations OPT_CFLAGS += -fno-expensive-optimizations
endif endif
OPT_CFLAGS/NOOPT=-O0
# Work around some compiler bugs. # Work around some compiler bugs.
ifeq ($(USE_CLANG), true) ifeq ($(USE_CLANG), true)
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
@ -371,10 +377,22 @@ endif
ifeq ($(USE_CLANG),) ifeq ($(USE_CLANG),)
# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
ifneq ("${CC_VER_MAJOR}", "2") ifneq ($(CC_VER_MAJOR), 2)
STATIC_LIBGCC += -static-libgcc STATIC_LIBGCC += -static-libgcc
endif endif
ifneq ($(OS_VENDOR), Darwin)
ifneq (, findstring(debug,$(BUILD_FLAVOR)))
# for relocations read-only
LFLAGS += -Xlinker -z -Xlinker relro
ifeq ($(BUILD_FLAVOR), debug)
# disable incremental relocations linking
LFLAGS += -Xlinker -z -Xlinker now
endif
endif
endif
ifeq ($(BUILDARCH), ia64) ifeq ($(BUILDARCH), ia64)
LFLAGS += -Wl,-relax LFLAGS += -Wl,-relax
endif endif
@ -425,6 +443,14 @@ ifeq ($(USE_CLANG), true)
CFLAGS += -flimit-debug-info CFLAGS += -flimit-debug-info
endif endif
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
# Allow basic optimizations which don't distrupt debugging. (Principally dead code elimination)
DEBUG_CFLAGS=-Og
else
# Allow no optimizations.
DEBUG_CFLAGS=-O0
endif
# DEBUG_BINARIES uses full -g debug information for all configs # DEBUG_BINARIES uses full -g debug information for all configs
ifeq ($(DEBUG_BINARIES), true) ifeq ($(DEBUG_BINARIES), true)
CFLAGS += -g CFLAGS += -g
@ -441,8 +467,13 @@ else
DEBUG_CFLAGS/ppc = -g DEBUG_CFLAGS/ppc = -g
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
ifeq ($(USE_CLANG), true)
# Clang doesn't understand -gstabs
DEBUG_CFLAGS += -g
else
DEBUG_CFLAGS += -gstabs DEBUG_CFLAGS += -gstabs
endif endif
endif
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
FASTDEBUG_CFLAGS/ia64 = -g FASTDEBUG_CFLAGS/ia64 = -g
@ -475,6 +506,18 @@ else
endif endif
endif endif
ifeq ($(USE_CLANG),)
# Enable bounds checking.
# _FORTIFY_SOURCE appears in GCC 4.0+
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"
# compile time size bounds checks
FASTDEBUG_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
# and runtime size bounds checks and paranoid stack smashing checks.
DEBUG_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all --param ssp-buffer-size=1
endif
endif
# If we are building HEADLESS, pass on to VM # If we are building HEADLESS, pass on to VM
# so it can set the java.awt.headless property # so it can set the java.awt.headless property
ifdef HEADLESS ifdef HEADLESS

View File

@ -24,6 +24,11 @@
# Sets make macros for making debug version of VM # Sets make macros for making debug version of VM
# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make
# They may also specify FASTDEBUG_CFLAGS, but it defaults to DEBUG_CFLAGS.
FASTDEBUG_CFLAGS$(FASTDEBUG_CFLAGS) = $(DEBUG_CFLAGS)
# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make # Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make
OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS)
OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@))
@ -54,6 +59,12 @@ CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE)
# Set the environment variable HOTSPARC_GENERIC to "true" # Set the environment variable HOTSPARC_GENERIC to "true"
# to inhibit the effect of the previous line on CFLAGS. # to inhibit the effect of the previous line on CFLAGS.
# The following lines are copied from debug.make, except that we
# consult FASTDEBUG_CFLAGS instead of DEBUG_CFLAGS.
# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make
DEBUG_CFLAGS/DEFAULT= $(FASTDEBUG_CFLAGS)
DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@))
CFLAGS += $(DEBUG_CFLAGS/BYFILE)
# Linker mapfile # Linker mapfile
MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug

View File

@ -62,7 +62,6 @@ else
CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
endif endif
ifeq ($(USE_CLANG), true) ifeq ($(USE_CLANG), true)
# Clang has precompiled headers support by default, but the user can switch # Clang has precompiled headers support by default, but the user can switch
# it off by using 'USE_PRECOMPILED_HEADER=0'. # it off by using 'USE_PRECOMPILED_HEADER=0'.
@ -104,7 +103,7 @@ ifeq ($(USE_CLANG), true)
# But Clang doesn't support a precompiled header which was compiled with -O3 # But Clang doesn't support a precompiled header which was compiled with -O3
# to be used in a compilation unit which uses '-O0'. We could also prepare an # to be used in a compilation unit which uses '-O0'. We could also prepare an
# extra '-O0' PCH file for the opt build and use it here, but it's probably # extra '-O0' PCH file for the opt build and use it here, but it's probably
# not worth the effoert as long as only two files need this special handling. # not worth the effort as long as only two files need this special handling.
PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH) PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH)
PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH) PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH) PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
@ -226,20 +225,29 @@ ifeq ($(USE_CLANG),)
endif endif
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
# Special cases # Special cases
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
# The flags to use for an Optimized g++ build # optimization control flags (Used by fastdebug and release variants)
OPT_CFLAGS/NOOPT=-O0
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
# Allow basic optimizations which don't distrupt debugging. (Principally dead code elimination)
OPT_CFLAGS/DEBUG=-Og
else
# Allow no optimizations.
OPT_CFLAGS/DEBUG=-O0
endif
OPT_CFLAGS/SIZE=-Os OPT_CFLAGS/SIZE=-Os
OPT_CFLAGS/SPEED=-O3 OPT_CFLAGS/SPEED=-O3
OPT_CFLAGS_DEFAULT ?= SPEED
# Hotspot uses very unstrict aliasing turn this optimization off # Hotspot uses very unstrict aliasing turn this optimization off
# This option is added to CFLAGS rather than OPT_CFLAGS # This option is added to CFLAGS rather than OPT_CFLAGS
# so that OPT_CFLAGS overrides get this option too. # so that OPT_CFLAGS overrides get this option too.
CFLAGS += -fno-strict-aliasing CFLAGS += -fno-strict-aliasing
OPT_CFLAGS_DEFAULT ?= SPEED
ifdef OPT_CFLAGS ifdef OPT_CFLAGS
ifneq ("$(origin OPT_CFLAGS)", "command line") ifneq ("$(origin OPT_CFLAGS)", "command line")
$(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
@ -254,8 +262,6 @@ ifeq ($(BUILDARCH), ia64)
OPT_CFLAGS += -fno-expensive-optimizations OPT_CFLAGS += -fno-expensive-optimizations
endif endif
OPT_CFLAGS/NOOPT=-O0
# Work around some compiler bugs. # Work around some compiler bugs.
ifeq ($(USE_CLANG), true) ifeq ($(USE_CLANG), true)
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
@ -271,7 +277,7 @@ endif
# Flags for generating make dependency flags. # Flags for generating make dependency flags.
DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
ifeq ($(USE_CLANG),) ifeq ($(USE_CLANG),)
ifneq ("${CC_VER_MAJOR}", "2") ifneq ($(CC_VER_MAJOR), 2)
DEPFLAGS += -fpch-deps DEPFLAGS += -fpch-deps
endif endif
endif endif
@ -282,21 +288,26 @@ endif
# statically link libstdc++.so, work with gcc but ignored by g++ # statically link libstdc++.so, work with gcc but ignored by g++
STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
# Enable linker optimization
LFLAGS += -Xlinker -O1
ifeq ($(USE_CLANG),) ifeq ($(USE_CLANG),)
# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
ifneq ("${CC_VER_MAJOR}", "2")
STATIC_LIBGCC += -static-libgcc STATIC_LIBGCC += -static-libgcc
ifneq (, findstring(debug,$(BUILD_FLAVOR)))
# for relocations read-only
LFLAGS += -Xlinker -z -Xlinker relro
ifeq ($(BUILD_FLAVOR), debug)
# disable incremental relocations linking
LFLAGS += -Xlinker -z -Xlinker now
endif
endif endif
ifeq ($(BUILDARCH), ia64) ifeq ($(BUILDARCH), ia64)
LFLAGS += -Wl,-relax LFLAGS += -Wl,-relax
endif endif
endif
# Enable linker optimization
LFLAGS += -Xlinker -O1
ifeq ($(USE_CLANG),)
# If this is a --hash-style=gnu system, use --hash-style=both # If this is a --hash-style=gnu system, use --hash-style=both
# The gnu .hash section won't work on some Linux systems like SuSE 10. # The gnu .hash section won't work on some Linux systems like SuSE 10.
_HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu') _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu')
@ -333,6 +344,14 @@ ifeq ($(USE_CLANG), true)
CFLAGS += -flimit-debug-info CFLAGS += -flimit-debug-info
endif endif
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
# Allow basic optimizations which don't distrupt debugging. (Principally dead code elimination)
DEBUG_CFLAGS=-Og
else
# Allow no optimizations.
DEBUG_CFLAGS=-O0
endif
# DEBUG_BINARIES uses full -g debug information for all configs # DEBUG_BINARIES uses full -g debug information for all configs
ifeq ($(DEBUG_BINARIES), true) ifeq ($(DEBUG_BINARIES), true)
CFLAGS += -g CFLAGS += -g
@ -355,6 +374,18 @@ else
endif endif
endif endif
ifeq ($(USE_CLANG),)
# Enable bounds checking.
# _FORTIFY_SOURCE appears in GCC 4.0+
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"
# compile time size bounds checks
FASTDEBUG_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
# and runtime size bounds checks and paranoid stack smashing checks.
DEBUG_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all --param ssp-buffer-size=1
endif
endif
# If we are building HEADLESS, pass on to VM # If we are building HEADLESS, pass on to VM
# so it can set the java.awt.headless property # so it can set the java.awt.headless property
ifdef HEADLESS ifdef HEADLESS

View File

@ -117,17 +117,40 @@ endif
# Compiler warnings are treated as errors # Compiler warnings are treated as errors
WARNINGS_ARE_ERRORS = -Werror WARNINGS_ARE_ERRORS = -Werror
# Enable these warnings. See 'info gcc' about details on these options # Enable these warnings. See 'info gcc' about details on these options
WARNING_FLAGS = -Wpointer-arith -Wconversion -Wsign-compare -Wundef -Wformat=2 WARNING_FLAGS = -Wpointer-arith -Wconversion -Wsign-compare -Wundef -Wformat=2
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
# Special cases # Special cases
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
# The flags to use for an Optimized g++ build # optimization control flags (Used by fastdebug and release variants)
OPT_CFLAGS += -O3 OPT_CFLAGS/NOOPT=-O0
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
# Allow basic optimizations which don't distrupt debugging. (Principally dead code elimination)
OPT_CFLAGS/DEBUG=-Og
+else
# Allow no optimizations.
OPT_CFLAGS/DEBUG=-O0
endif
OPT_CFLAGS/SIZE=-Os
OPT_CFLAGS/SPEED=-O3
OPT_CFLAGS_DEFAULT ?= SPEED
# Hotspot uses very unstrict aliasing turn this optimization off # Hotspot uses very unstrict aliasing turn this optimization off
OPT_CFLAGS += -fno-strict-aliasing # This option is added to CFLAGS rather than OPT_CFLAGS
# so that OPT_CFLAGS overrides get this option too.
CFLAGS += -fno-strict-aliasing
ifdef OPT_CFLAGS
ifneq ("$(origin OPT_CFLAGS)", "command line")
$(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
endif
endif
OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
# if we use expensive-optimizations # if we use expensive-optimizations
@ -137,10 +160,20 @@ ifeq ($(BUILDARCH), ia64)
OPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations OPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations
endif endif
OPT_CFLAGS/NOOPT=-O0 # Work around some compiler bugs.
ifeq ($(USE_CLANG), true)
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
endif
else
# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
endif
endif
# Flags for generating make dependency flags. # Flags for generating make dependency flags.
ifneq ("${CC_VER_MAJOR}", "2") ifneq ($(CC_VER_MAJOR), 2)
DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
endif endif
@ -155,21 +188,32 @@ endif
# statically link libstdc++.so, work with gcc but ignored by g++ # statically link libstdc++.so, work with gcc but ignored by g++
STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
ifdef USE_GNULD
# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
ifneq ("${CC_VER_MAJOR}", "2") ifneq ($(CC_VER_MAJOR), 2)
STATIC_LIBGCC += -static-libgcc STATIC_LIBGCC += -static-libgcc
endif endif
# Enable linker optimization
LFLAGS += -Xlinker -O1
ifneq (, findstring(debug,$(BUILD_FLAVOR)))
# for relocations read-only
LFLAGS += -Xlinker -z -Xlinker relro
ifeq ($(BUILD_FLAVOR), debug)
# disable incremental relocations linking
LFLAGS += -Xlinker -z -Xlinker now
endif
endif
ifeq ($(BUILDARCH), ia64) ifeq ($(BUILDARCH), ia64)
# Note: all ia64 setting reflect the ones for linux # Note: all ia64 setting reflect the ones for linux
# No actial testing was performed: there is no Solaris on ia64 presently # No actual testing was performed: there is no Solaris on ia64 presently
LFLAGS += -Wl,-relax LFLAGS += -Wl,-relax
endif endif
ifdef USE_GNULD
# Enable linker optimization
LFLAGS += -Xlinker -O1
# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
MAPFLAG = -Xlinker --version-script=FILENAME MAPFLAG = -Xlinker --version-script=FILENAME
else else
@ -185,6 +229,15 @@ SHARED_FLAG = -shared
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Debug flags # Debug flags
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
# Allow basic optimizations which don't distrupt debugging. (Principally dead code elimination)
DEBUG_CFLAGS=-Og
else
# Allow no optimizations.
DEBUG_CFLAGS=-O0
endif
# Use the stabs format for debugging information (this is the default # Use the stabs format for debugging information (this is the default
# on gcc-2.91). It's good enough, has all the information about line # on gcc-2.91). It's good enough, has all the information about line
# numbers and local variables, and libjvm.so is only about 16M. # numbers and local variables, and libjvm.so is only about 16M.
@ -197,3 +250,13 @@ DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
DEBUG_CFLAGS += -gstabs DEBUG_CFLAGS += -gstabs
endif endif
# Enable bounds checking.
# _FORTIFY_SOURCE appears in GCC 4.0+
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"
# compile time size bounds checks
FASTDEBUG_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
# and runtime size bounds checks and paranoid stack smashing checks.
DEBUG_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all --param ssp-buffer-size=1
endif

View File

@ -1285,9 +1285,9 @@ bool MachConstantBaseNode::requires_postalloc_expand() const { return true; }
void MachConstantBaseNode::postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_) { void MachConstantBaseNode::postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_) {
Compile *C = ra_->C; Compile *C = ra_->C;
iRegPdstOper *op_dst = new (C) iRegPdstOper(); iRegPdstOper *op_dst = new iRegPdstOper();
MachNode *m1 = new (C) loadToc_hiNode(); MachNode *m1 = new loadToc_hiNode();
MachNode *m2 = new (C) loadToc_loNode(); MachNode *m2 = new loadToc_loNode();
m1->add_req(NULL); m1->add_req(NULL);
m2->add_req(NULL, m1); m2->add_req(NULL, m1);
@ -2232,9 +2232,9 @@ const bool Matcher::isSimpleConstant64(jlong value) {
MachTypeNode *Matcher::make_decode_node(Compile *C) { MachTypeNode *Matcher::make_decode_node(Compile *C) {
assert(Universe::narrow_oop_base() == NULL && Universe::narrow_oop_shift() == 0, assert(Universe::narrow_oop_base() == NULL && Universe::narrow_oop_shift() == 0,
"This method is only implemented for unscaled cOops mode so far"); "This method is only implemented for unscaled cOops mode so far");
MachTypeNode *decode = new (C) decodeN_unscaledNode(); MachTypeNode *decode = new decodeN_unscaledNode();
decode->set_opnd_array(0, new (C) iRegPdstOper()); decode->set_opnd_array(0, new iRegPdstOper());
decode->set_opnd_array(1, new (C) iRegNsrcOper()); decode->set_opnd_array(1, new iRegNsrcOper());
return decode; return decode;
} }
*/ */
@ -2600,20 +2600,20 @@ loadConLNodesTuple loadConLNodesTuple_create(Compile *C, PhaseRegAlloc *ra_, Nod
const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000; const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000;
if (large_constant_pool) { if (large_constant_pool) {
// Create new nodes. // Create new nodes.
loadConL_hiNode *m1 = new (C) loadConL_hiNode(); loadConL_hiNode *m1 = new loadConL_hiNode();
loadConL_loNode *m2 = new (C) loadConL_loNode(); loadConL_loNode *m2 = new loadConL_loNode();
// inputs for new nodes // inputs for new nodes
m1->add_req(NULL, toc); m1->add_req(NULL, toc);
m2->add_req(NULL, m1); m2->add_req(NULL, m1);
// operands for new nodes // operands for new nodes
m1->_opnds[0] = new (C) iRegLdstOper(); // dst m1->_opnds[0] = new iRegLdstOper(); // dst
m1->_opnds[1] = immSrc; // src m1->_opnds[1] = immSrc; // src
m1->_opnds[2] = new (C) iRegPdstOper(); // toc m1->_opnds[2] = new iRegPdstOper(); // toc
m2->_opnds[0] = new (C) iRegLdstOper(); // dst m2->_opnds[0] = new iRegLdstOper(); // dst
m2->_opnds[1] = immSrc; // src m2->_opnds[1] = immSrc; // src
m2->_opnds[2] = new (C) iRegLdstOper(); // base m2->_opnds[2] = new iRegLdstOper(); // base
// Initialize ins_attrib TOC fields. // Initialize ins_attrib TOC fields.
m1->_const_toc_offset = -1; m1->_const_toc_offset = -1;
@ -2633,15 +2633,15 @@ loadConLNodesTuple loadConLNodesTuple_create(Compile *C, PhaseRegAlloc *ra_, Nod
nodes._last = nodes._large_lo; nodes._last = nodes._large_lo;
assert(m2->bottom_type()->isa_long(), "must be long"); assert(m2->bottom_type()->isa_long(), "must be long");
} else { } else {
loadConLNode *m2 = new (C) loadConLNode(); loadConLNode *m2 = new loadConLNode();
// inputs for new nodes // inputs for new nodes
m2->add_req(NULL, toc); m2->add_req(NULL, toc);
// operands for new nodes // operands for new nodes
m2->_opnds[0] = new (C) iRegLdstOper(); // dst m2->_opnds[0] = new iRegLdstOper(); // dst
m2->_opnds[1] = immSrc; // src m2->_opnds[1] = immSrc; // src
m2->_opnds[2] = new (C) iRegPdstOper(); // toc m2->_opnds[2] = new iRegPdstOper(); // toc
// Initialize ins_attrib instruction offset. // Initialize ins_attrib instruction offset.
m2->_cbuf_insts_offset = -1; m2->_cbuf_insts_offset = -1;
@ -2750,20 +2750,20 @@ encode %{
const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000; const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000;
if (large_constant_pool) { if (large_constant_pool) {
// Create new nodes. // Create new nodes.
loadConP_hiNode *m1 = new (C) loadConP_hiNode(); loadConP_hiNode *m1 = new loadConP_hiNode();
loadConP_loNode *m2 = new (C) loadConP_loNode(); loadConP_loNode *m2 = new loadConP_loNode();
// inputs for new nodes // inputs for new nodes
m1->add_req(NULL, n_toc); m1->add_req(NULL, n_toc);
m2->add_req(NULL, m1); m2->add_req(NULL, m1);
// operands for new nodes // operands for new nodes
m1->_opnds[0] = new (C) iRegPdstOper(); // dst m1->_opnds[0] = new iRegPdstOper(); // dst
m1->_opnds[1] = op_src; // src m1->_opnds[1] = op_src; // src
m1->_opnds[2] = new (C) iRegPdstOper(); // toc m1->_opnds[2] = new iRegPdstOper(); // toc
m2->_opnds[0] = new (C) iRegPdstOper(); // dst m2->_opnds[0] = new iRegPdstOper(); // dst
m2->_opnds[1] = op_src; // src m2->_opnds[1] = op_src; // src
m2->_opnds[2] = new (C) iRegLdstOper(); // base m2->_opnds[2] = new iRegLdstOper(); // base
// Initialize ins_attrib TOC fields. // Initialize ins_attrib TOC fields.
m1->_const_toc_offset = -1; m1->_const_toc_offset = -1;
@ -2777,15 +2777,15 @@ encode %{
nodes->push(m2); nodes->push(m2);
assert(m2->bottom_type()->isa_ptr(), "must be ptr"); assert(m2->bottom_type()->isa_ptr(), "must be ptr");
} else { } else {
loadConPNode *m2 = new (C) loadConPNode(); loadConPNode *m2 = new loadConPNode();
// inputs for new nodes // inputs for new nodes
m2->add_req(NULL, n_toc); m2->add_req(NULL, n_toc);
// operands for new nodes // operands for new nodes
m2->_opnds[0] = new (C) iRegPdstOper(); // dst m2->_opnds[0] = new iRegPdstOper(); // dst
m2->_opnds[1] = op_src; // src m2->_opnds[1] = op_src; // src
m2->_opnds[2] = new (C) iRegPdstOper(); // toc m2->_opnds[2] = new iRegPdstOper(); // toc
// Register allocation for new nodes. // Register allocation for new nodes.
ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
@ -2802,9 +2802,9 @@ encode %{
MachNode *m2; MachNode *m2;
if (large_constant_pool) { if (large_constant_pool) {
m2 = new (C) loadConFCompNode(); m2 = new loadConFCompNode();
} else { } else {
m2 = new (C) loadConFNode(); m2 = new loadConFNode();
} }
// inputs for new nodes // inputs for new nodes
m2->add_req(NULL, n_toc); m2->add_req(NULL, n_toc);
@ -2812,7 +2812,7 @@ encode %{
// operands for new nodes // operands for new nodes
m2->_opnds[0] = op_dst; m2->_opnds[0] = op_dst;
m2->_opnds[1] = op_src; m2->_opnds[1] = op_src;
m2->_opnds[2] = new (C) iRegPdstOper(); // constanttablebase m2->_opnds[2] = new iRegPdstOper(); // constanttablebase
// register allocation for new nodes // register allocation for new nodes
ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
@ -2826,9 +2826,9 @@ encode %{
MachNode *m2; MachNode *m2;
if (large_constant_pool) { if (large_constant_pool) {
m2 = new (C) loadConDCompNode(); m2 = new loadConDCompNode();
} else { } else {
m2 = new (C) loadConDNode(); m2 = new loadConDNode();
} }
// inputs for new nodes // inputs for new nodes
m2->add_req(NULL, n_toc); m2->add_req(NULL, n_toc);
@ -2836,7 +2836,7 @@ encode %{
// operands for new nodes // operands for new nodes
m2->_opnds[0] = op_dst; m2->_opnds[0] = op_dst;
m2->_opnds[1] = op_src; m2->_opnds[1] = op_src;
m2->_opnds[2] = new (C) iRegPdstOper(); // constanttablebase m2->_opnds[2] = new iRegPdstOper(); // constanttablebase
// register allocation for new nodes // register allocation for new nodes
ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
@ -2918,15 +2918,15 @@ encode %{
if (VM_Version::has_isel()) { if (VM_Version::has_isel()) {
// use isel instruction with Power 7 // use isel instruction with Power 7
cmpP_reg_imm16Node *n_compare = new (C) cmpP_reg_imm16Node(); cmpP_reg_imm16Node *n_compare = new cmpP_reg_imm16Node();
encodeP_subNode *n_sub_base = new (C) encodeP_subNode(); encodeP_subNode *n_sub_base = new encodeP_subNode();
encodeP_shiftNode *n_shift = new (C) encodeP_shiftNode(); encodeP_shiftNode *n_shift = new encodeP_shiftNode();
cond_set_0_oopNode *n_cond_set = new (C) cond_set_0_oopNode(); cond_set_0_oopNode *n_cond_set = new cond_set_0_oopNode();
n_compare->add_req(n_region, n_src); n_compare->add_req(n_region, n_src);
n_compare->_opnds[0] = op_crx; n_compare->_opnds[0] = op_crx;
n_compare->_opnds[1] = op_src; n_compare->_opnds[1] = op_src;
n_compare->_opnds[2] = new (C) immL16Oper(0); n_compare->_opnds[2] = new immL16Oper(0);
n_sub_base->add_req(n_region, n_src); n_sub_base->add_req(n_region, n_src);
n_sub_base->_opnds[0] = op_dst; n_sub_base->_opnds[0] = op_dst;
@ -2956,10 +2956,10 @@ encode %{
} else { } else {
// before Power 7 // before Power 7
moveRegNode *n_move = new (C) moveRegNode(); moveRegNode *n_move = new moveRegNode();
cmpP_reg_imm16Node *n_compare = new (C) cmpP_reg_imm16Node(); cmpP_reg_imm16Node *n_compare = new cmpP_reg_imm16Node();
encodeP_shiftNode *n_shift = new (C) encodeP_shiftNode(); encodeP_shiftNode *n_shift = new encodeP_shiftNode();
cond_sub_baseNode *n_sub_base = new (C) cond_sub_baseNode(); cond_sub_baseNode *n_sub_base = new cond_sub_baseNode();
n_move->add_req(n_region, n_src); n_move->add_req(n_region, n_src);
n_move->_opnds[0] = op_dst; n_move->_opnds[0] = op_dst;
@ -2971,7 +2971,7 @@ encode %{
n_compare->_opnds[0] = op_crx; n_compare->_opnds[0] = op_crx;
n_compare->_opnds[1] = op_src; n_compare->_opnds[1] = op_src;
n_compare->_opnds[2] = new (C) immL16Oper(0); n_compare->_opnds[2] = new immL16Oper(0);
n_sub_base->add_req(n_region, n_compare, n_src); n_sub_base->add_req(n_region, n_compare, n_src);
n_sub_base->_opnds[0] = op_dst; n_sub_base->_opnds[0] = op_dst;
@ -3000,13 +3000,13 @@ encode %{
enc_class postalloc_expand_encode_oop_not_null(iRegNdst dst, iRegPdst src) %{ enc_class postalloc_expand_encode_oop_not_null(iRegNdst dst, iRegPdst src) %{
encodeP_subNode *n1 = new (C) encodeP_subNode(); encodeP_subNode *n1 = new encodeP_subNode();
n1->add_req(n_region, n_src); n1->add_req(n_region, n_src);
n1->_opnds[0] = op_dst; n1->_opnds[0] = op_dst;
n1->_opnds[1] = op_src; n1->_opnds[1] = op_src;
n1->_bottom_type = _bottom_type; n1->_bottom_type = _bottom_type;
encodeP_shiftNode *n2 = new (C) encodeP_shiftNode(); encodeP_shiftNode *n2 = new encodeP_shiftNode();
n2->add_req(n_region, n1); n2->add_req(n_region, n1);
n2->_opnds[0] = op_dst; n2->_opnds[0] = op_dst;
n2->_opnds[1] = op_dst; n2->_opnds[1] = op_dst;
@ -3020,13 +3020,13 @@ encode %{
%} %}
enc_class postalloc_expand_decode_oop(iRegPdst dst, iRegNsrc src, flagsReg crx) %{ enc_class postalloc_expand_decode_oop(iRegPdst dst, iRegNsrc src, flagsReg crx) %{
decodeN_shiftNode *n_shift = new (C) decodeN_shiftNode(); decodeN_shiftNode *n_shift = new decodeN_shiftNode();
cmpN_reg_imm0Node *n_compare = new (C) cmpN_reg_imm0Node(); cmpN_reg_imm0Node *n_compare = new cmpN_reg_imm0Node();
n_compare->add_req(n_region, n_src); n_compare->add_req(n_region, n_src);
n_compare->_opnds[0] = op_crx; n_compare->_opnds[0] = op_crx;
n_compare->_opnds[1] = op_src; n_compare->_opnds[1] = op_src;
n_compare->_opnds[2] = new (C) immN_0Oper(TypeNarrowOop::NULL_PTR); n_compare->_opnds[2] = new immN_0Oper(TypeNarrowOop::NULL_PTR);
n_shift->add_req(n_region, n_src); n_shift->add_req(n_region, n_src);
n_shift->_opnds[0] = op_dst; n_shift->_opnds[0] = op_dst;
@ -3036,13 +3036,13 @@ encode %{
if (VM_Version::has_isel()) { if (VM_Version::has_isel()) {
// use isel instruction with Power 7 // use isel instruction with Power 7
decodeN_addNode *n_add_base = new (C) decodeN_addNode(); decodeN_addNode *n_add_base = new decodeN_addNode();
n_add_base->add_req(n_region, n_shift); n_add_base->add_req(n_region, n_shift);
n_add_base->_opnds[0] = op_dst; n_add_base->_opnds[0] = op_dst;
n_add_base->_opnds[1] = op_dst; n_add_base->_opnds[1] = op_dst;
n_add_base->_bottom_type = _bottom_type; n_add_base->_bottom_type = _bottom_type;
cond_set_0_ptrNode *n_cond_set = new (C) cond_set_0_ptrNode(); cond_set_0_ptrNode *n_cond_set = new cond_set_0_ptrNode();
n_cond_set->add_req(n_region, n_compare, n_add_base); n_cond_set->add_req(n_region, n_compare, n_add_base);
n_cond_set->_opnds[0] = op_dst; n_cond_set->_opnds[0] = op_dst;
n_cond_set->_opnds[1] = op_crx; n_cond_set->_opnds[1] = op_crx;
@ -3064,7 +3064,7 @@ encode %{
} else { } else {
// before Power 7 // before Power 7
cond_add_baseNode *n_add_base = new (C) cond_add_baseNode(); cond_add_baseNode *n_add_base = new cond_add_baseNode();
n_add_base->add_req(n_region, n_compare, n_shift); n_add_base->add_req(n_region, n_compare, n_shift);
n_add_base->_opnds[0] = op_dst; n_add_base->_opnds[0] = op_dst;
@ -3086,13 +3086,13 @@ encode %{
%} %}
enc_class postalloc_expand_decode_oop_not_null(iRegPdst dst, iRegNsrc src) %{ enc_class postalloc_expand_decode_oop_not_null(iRegPdst dst, iRegNsrc src) %{
decodeN_shiftNode *n1 = new (C) decodeN_shiftNode(); decodeN_shiftNode *n1 = new decodeN_shiftNode();
n1->add_req(n_region, n_src); n1->add_req(n_region, n_src);
n1->_opnds[0] = op_dst; n1->_opnds[0] = op_dst;
n1->_opnds[1] = op_src; n1->_opnds[1] = op_src;
n1->_bottom_type = _bottom_type; n1->_bottom_type = _bottom_type;
decodeN_addNode *n2 = new (C) decodeN_addNode(); decodeN_addNode *n2 = new decodeN_addNode();
n2->add_req(n_region, n1); n2->add_req(n_region, n1);
n2->_opnds[0] = op_dst; n2->_opnds[0] = op_dst;
n2->_opnds[1] = op_dst; n2->_opnds[1] = op_dst;
@ -3388,7 +3388,7 @@ encode %{
// Create new nodes. // Create new nodes.
// Make an operand with the bit pattern to load as float. // Make an operand with the bit pattern to load as float.
immLOper *op_repl = new (C) immLOper((jlong)replicate_immF(op_src->constantF())); immLOper *op_repl = new immLOper((jlong)replicate_immF(op_src->constantF()));
loadConLNodesTuple loadConLNodes = loadConLNodesTuple loadConLNodes =
loadConLNodesTuple_create(C, ra_, n_toc, op_repl, loadConLNodesTuple_create(C, ra_, n_toc, op_repl,
@ -3611,11 +3611,11 @@ encode %{
// Create the nodes for loading the IC from the TOC. // Create the nodes for loading the IC from the TOC.
loadConLNodesTuple loadConLNodes_IC = loadConLNodesTuple loadConLNodes_IC =
loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong)Universe::non_oop_word()), loadConLNodesTuple_create(C, ra_, n_toc, new immLOper((jlong)Universe::non_oop_word()),
OptoReg::Name(R19_H_num), OptoReg::Name(R19_num)); OptoReg::Name(R19_H_num), OptoReg::Name(R19_num));
// Create the call node. // Create the call node.
CallDynamicJavaDirectSchedNode *call = new (C) CallDynamicJavaDirectSchedNode(); CallDynamicJavaDirectSchedNode *call = new CallDynamicJavaDirectSchedNode();
call->_method_handle_invoke = _method_handle_invoke; call->_method_handle_invoke = _method_handle_invoke;
call->_vtable_index = _vtable_index; call->_vtable_index = _vtable_index;
call->_method = _method; call->_method = _method;
@ -3765,7 +3765,7 @@ encode %{
#if defined(ABI_ELFv2) #if defined(ABI_ELFv2)
jlong entry_address = (jlong) this->entry_point(); jlong entry_address = (jlong) this->entry_point();
assert(entry_address, "need address here"); assert(entry_address, "need address here");
loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper(entry_address), loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper(entry_address),
OptoReg::Name(R12_H_num), OptoReg::Name(R12_num)); OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
#else #else
// Get the struct that describes the function we are about to call. // Get the struct that describes the function we are about to call.
@ -3777,42 +3777,42 @@ encode %{
loadConLNodesTuple loadConLNodes_Toc; loadConLNodesTuple loadConLNodes_Toc;
// Create nodes and operands for loading the entry point. // Create nodes and operands for loading the entry point.
loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper(entry_address), loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper(entry_address),
OptoReg::Name(R12_H_num), OptoReg::Name(R12_num)); OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
// Create nodes and operands for loading the env pointer. // Create nodes and operands for loading the env pointer.
if (fd->env() != NULL) { if (fd->env() != NULL) {
loadConLNodes_Env = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong) fd->env()), loadConLNodes_Env = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper((jlong) fd->env()),
OptoReg::Name(R11_H_num), OptoReg::Name(R11_num)); OptoReg::Name(R11_H_num), OptoReg::Name(R11_num));
} else { } else {
loadConLNodes_Env._large_hi = NULL; loadConLNodes_Env._large_hi = NULL;
loadConLNodes_Env._large_lo = NULL; loadConLNodes_Env._large_lo = NULL;
loadConLNodes_Env._small = NULL; loadConLNodes_Env._small = NULL;
loadConLNodes_Env._last = new (C) loadConL16Node(); loadConLNodes_Env._last = new loadConL16Node();
loadConLNodes_Env._last->_opnds[0] = new (C) iRegLdstOper(); loadConLNodes_Env._last->_opnds[0] = new iRegLdstOper();
loadConLNodes_Env._last->_opnds[1] = new (C) immL16Oper(0); loadConLNodes_Env._last->_opnds[1] = new immL16Oper(0);
ra_->set_pair(loadConLNodes_Env._last->_idx, OptoReg::Name(R11_H_num), OptoReg::Name(R11_num)); ra_->set_pair(loadConLNodes_Env._last->_idx, OptoReg::Name(R11_H_num), OptoReg::Name(R11_num));
} }
// Create nodes and operands for loading the Toc point. // Create nodes and operands for loading the Toc point.
loadConLNodes_Toc = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong) fd->toc()), loadConLNodes_Toc = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper((jlong) fd->toc()),
OptoReg::Name(R2_H_num), OptoReg::Name(R2_num)); OptoReg::Name(R2_H_num), OptoReg::Name(R2_num));
#endif // ABI_ELFv2 #endif // ABI_ELFv2
// mtctr node // mtctr node
MachNode *mtctr = new (C) CallLeafDirect_mtctrNode(); MachNode *mtctr = new CallLeafDirect_mtctrNode();
assert(loadConLNodes_Entry._last != NULL, "entry must exist"); assert(loadConLNodes_Entry._last != NULL, "entry must exist");
mtctr->add_req(0, loadConLNodes_Entry._last); mtctr->add_req(0, loadConLNodes_Entry._last);
mtctr->_opnds[0] = new (C) iRegLdstOper(); mtctr->_opnds[0] = new iRegLdstOper();
mtctr->_opnds[1] = new (C) iRegLdstOper(); mtctr->_opnds[1] = new iRegLdstOper();
// call node // call node
MachCallLeafNode *call = new (C) CallLeafDirectNode(); MachCallLeafNode *call = new CallLeafDirectNode();
call->_opnds[0] = _opnds[0]; call->_opnds[0] = _opnds[0];
call->_opnds[1] = new (C) methodOper((intptr_t) entry_address); // May get set later. call->_opnds[1] = new methodOper((intptr_t) entry_address); // May get set later.
// Make the new call node look like the old one. // Make the new call node look like the old one.
call->_name = _name; call->_name = _name;
@ -6050,9 +6050,9 @@ instruct loadConN_Ex(iRegNdst dst, immN src) %{
format %{ "LoadN $dst, $src \t// postalloc expanded" %} // mask format %{ "LoadN $dst, $src \t// postalloc expanded" %} // mask
postalloc_expand %{ postalloc_expand %{
MachNode *m1 = new (C) loadConN_hiNode(); MachNode *m1 = new loadConN_hiNode();
MachNode *m2 = new (C) loadConN_loNode(); MachNode *m2 = new loadConN_loNode();
MachNode *m3 = new (C) clearMs32bNode(); MachNode *m3 = new clearMs32bNode();
m1->add_req(NULL); m1->add_req(NULL);
m2->add_req(NULL, m1); m2->add_req(NULL, m1);
m3->add_req(NULL, m2); m3->add_req(NULL, m2);
@ -6117,7 +6117,7 @@ instruct loadConNKlass_Ex(iRegNdst dst, immNKlass src) %{
format %{ "LoadN $dst, $src \t// postalloc expanded" %} // mask format %{ "LoadN $dst, $src \t// postalloc expanded" %} // mask
postalloc_expand %{ postalloc_expand %{
// Load high bits into register. Sign extended. // Load high bits into register. Sign extended.
MachNode *m1 = new (C) loadConNKlass_hiNode(); MachNode *m1 = new loadConNKlass_hiNode();
m1->add_req(NULL); m1->add_req(NULL);
m1->_opnds[0] = op_dst; m1->_opnds[0] = op_dst;
m1->_opnds[1] = op_src; m1->_opnds[1] = op_src;
@ -6127,7 +6127,7 @@ instruct loadConNKlass_Ex(iRegNdst dst, immNKlass src) %{
MachNode *m2 = m1; MachNode *m2 = m1;
if (!Assembler::is_uimm((jlong)Klass::encode_klass((Klass *)op_src->constant()), 31)) { if (!Assembler::is_uimm((jlong)Klass::encode_klass((Klass *)op_src->constant()), 31)) {
// Value might be 1-extended. Mask out these bits. // Value might be 1-extended. Mask out these bits.
m2 = new (C) clearMs32bNode(); m2 = new clearMs32bNode();
m2->add_req(NULL, m1); m2->add_req(NULL, m1);
m2->_opnds[0] = op_dst; m2->_opnds[0] = op_dst;
m2->_opnds[1] = op_dst; m2->_opnds[1] = op_dst;
@ -6135,7 +6135,7 @@ instruct loadConNKlass_Ex(iRegNdst dst, immNKlass src) %{
nodes->push(m2); nodes->push(m2);
} }
MachNode *m3 = new (C) loadConNKlass_loNode(); MachNode *m3 = new loadConNKlass_loNode();
m3->add_req(NULL, m2); m3->add_req(NULL, m2);
m3->_opnds[0] = op_dst; m3->_opnds[0] = op_dst;
m3->_opnds[1] = op_src; m3->_opnds[1] = op_src;
@ -6987,14 +6987,14 @@ instruct encodePKlass_not_null_Ex(iRegNdst dst, iRegLsrc base, iRegPsrc src) %{
format %{ "EncodePKlass $dst, $src\t// $src != Null, postalloc expanded" %} format %{ "EncodePKlass $dst, $src\t// $src != Null, postalloc expanded" %}
postalloc_expand %{ postalloc_expand %{
encodePKlass_sub_baseNode *n1 = new (C) encodePKlass_sub_baseNode(); encodePKlass_sub_baseNode *n1 = new encodePKlass_sub_baseNode();
n1->add_req(n_region, n_base, n_src); n1->add_req(n_region, n_base, n_src);
n1->_opnds[0] = op_dst; n1->_opnds[0] = op_dst;
n1->_opnds[1] = op_base; n1->_opnds[1] = op_base;
n1->_opnds[2] = op_src; n1->_opnds[2] = op_src;
n1->_bottom_type = _bottom_type; n1->_bottom_type = _bottom_type;
encodePKlass_shiftNode *n2 = new (C) encodePKlass_shiftNode(); encodePKlass_shiftNode *n2 = new encodePKlass_shiftNode();
n2->add_req(n_region, n1); n2->add_req(n_region, n1);
n2->_opnds[0] = op_dst; n2->_opnds[0] = op_dst;
n2->_opnds[1] = op_dst; n2->_opnds[1] = op_dst;
@ -7064,14 +7064,14 @@ instruct decodeNKlass_notNull_addBase_Ex(iRegPdst dst, iRegLsrc base, iRegNsrc s
format %{ "DecodeNKlass $dst = $base + ($src << 3) \t// $src != NULL, postalloc expanded" %} format %{ "DecodeNKlass $dst = $base + ($src << 3) \t// $src != NULL, postalloc expanded" %}
postalloc_expand %{ postalloc_expand %{
decodeNKlass_add_baseNode *n1 = new (C) decodeNKlass_add_baseNode(); decodeNKlass_add_baseNode *n1 = new decodeNKlass_add_baseNode();
n1->add_req(n_region, n_base, n_src); n1->add_req(n_region, n_base, n_src);
n1->_opnds[0] = op_dst; n1->_opnds[0] = op_dst;
n1->_opnds[1] = op_base; n1->_opnds[1] = op_base;
n1->_opnds[2] = op_src; n1->_opnds[2] = op_src;
n1->_bottom_type = _bottom_type; n1->_bottom_type = _bottom_type;
decodeNKlass_shiftNode *n2 = new (C) decodeNKlass_shiftNode(); decodeNKlass_shiftNode *n2 = new decodeNKlass_shiftNode();
n2->add_req(n_region, n1); n2->add_req(n_region, n1);
n2->_opnds[0] = op_dst; n2->_opnds[0] = op_dst;
n2->_opnds[1] = op_dst; n2->_opnds[1] = op_dst;
@ -9773,8 +9773,8 @@ instruct cmovI_bso_stackSlotL_conLvalue0_Ex(iRegIdst dst, flagsReg crx, stackSlo
// //
// Create new nodes. // Create new nodes.
MachNode *m1 = new (C) loadConI16Node(); MachNode *m1 = new loadConI16Node();
MachNode *m2 = new (C) cmovI_bso_stackSlotLNode(); MachNode *m2 = new cmovI_bso_stackSlotLNode();
// inputs for new nodes // inputs for new nodes
m1->add_req(n_region); m1->add_req(n_region);
@ -9785,7 +9785,7 @@ instruct cmovI_bso_stackSlotL_conLvalue0_Ex(iRegIdst dst, flagsReg crx, stackSlo
// operands for new nodes // operands for new nodes
m1->_opnds[0] = op_dst; m1->_opnds[0] = op_dst;
m1->_opnds[1] = new (C) immI16Oper(0); m1->_opnds[1] = new immI16Oper(0);
m2->_opnds[0] = op_dst; m2->_opnds[0] = op_dst;
m2->_opnds[1] = op_crx; m2->_opnds[1] = op_crx;
@ -9942,8 +9942,8 @@ instruct cmovL_bso_stackSlotL_conLvalue0_Ex(iRegLdst dst, flagsReg crx, stackSlo
// //
// Create new nodes. // Create new nodes.
MachNode *m1 = new (C) loadConL16Node(); MachNode *m1 = new loadConL16Node();
MachNode *m2 = new (C) cmovL_bso_stackSlotLNode(); MachNode *m2 = new cmovL_bso_stackSlotLNode();
// inputs for new nodes // inputs for new nodes
m1->add_req(n_region); m1->add_req(n_region);
@ -9952,7 +9952,7 @@ instruct cmovL_bso_stackSlotL_conLvalue0_Ex(iRegLdst dst, flagsReg crx, stackSlo
// operands for new nodes // operands for new nodes
m1->_opnds[0] = op_dst; m1->_opnds[0] = op_dst;
m1->_opnds[1] = new (C) immL16Oper(0); m1->_opnds[1] = new immL16Oper(0);
m2->_opnds[0] = op_dst; m2->_opnds[0] = op_dst;
m2->_opnds[1] = op_crx; m2->_opnds[1] = op_crx;
m2->_opnds[2] = op_mem; m2->_opnds[2] = op_mem;
@ -10288,8 +10288,8 @@ instruct cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(iRegIdst dst, flagsReg c
// //
// Create new nodes. // Create new nodes.
MachNode *m1 = new (C) loadConI16Node(); MachNode *m1 = new loadConI16Node();
MachNode *m2 = new (C) cmovI_conIvalueMinus1_conIvalue1Node(); MachNode *m2 = new cmovI_conIvalueMinus1_conIvalue1Node();
// inputs for new nodes // inputs for new nodes
m1->add_req(n_region); m1->add_req(n_region);
@ -10298,7 +10298,7 @@ instruct cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(iRegIdst dst, flagsReg c
// operands for new nodes // operands for new nodes
m1->_opnds[0] = op_dst; m1->_opnds[0] = op_dst;
m1->_opnds[1] = new (C) immI16Oper(0); m1->_opnds[1] = new immI16Oper(0);
m2->_opnds[0] = op_dst; m2->_opnds[0] = op_dst;
m2->_opnds[1] = op_crx; m2->_opnds[1] = op_crx;
@ -10623,8 +10623,8 @@ instruct cmpF_reg_reg_Ex(flagsReg crx, regF src1, regF src2) %{
// //
// Create new nodes. // Create new nodes.
MachNode *m1 = new (C) cmpFUnordered_reg_regNode(); MachNode *m1 = new cmpFUnordered_reg_regNode();
MachNode *m2 = new (C) cmov_bns_lessNode(); MachNode *m2 = new cmov_bns_lessNode();
// inputs for new nodes // inputs for new nodes
m1->add_req(n_region, n_src1, n_src2); m1->add_req(n_region, n_src1, n_src2);
@ -10698,8 +10698,8 @@ instruct cmpD_reg_reg_Ex(flagsReg crx, regD src1, regD src2) %{
// //
// create new nodes // create new nodes
MachNode *m1 = new (C) cmpDUnordered_reg_regNode(); MachNode *m1 = new cmpDUnordered_reg_regNode();
MachNode *m2 = new (C) cmov_bns_lessNode(); MachNode *m2 = new cmov_bns_lessNode();
// inputs for new nodes // inputs for new nodes
m1->add_req(n_region, n_src1, n_src2); m1->add_req(n_region, n_src1, n_src2);

View File

@ -123,6 +123,7 @@ class Assembler : public AbstractAssembler {
fpop2_op3 = 0x35, fpop2_op3 = 0x35,
impdep1_op3 = 0x36, impdep1_op3 = 0x36,
aes3_op3 = 0x36, aes3_op3 = 0x36,
sha_op3 = 0x36,
alignaddr_op3 = 0x36, alignaddr_op3 = 0x36,
faligndata_op3 = 0x36, faligndata_op3 = 0x36,
flog3_op3 = 0x36, flog3_op3 = 0x36,
@ -223,7 +224,11 @@ class Assembler : public AbstractAssembler {
mwtos_opf = 0x119, mwtos_opf = 0x119,
aes_kexpand0_opf = 0x130, aes_kexpand0_opf = 0x130,
aes_kexpand2_opf = 0x131 aes_kexpand2_opf = 0x131,
sha1_opf = 0x141,
sha256_opf = 0x142,
sha512_opf = 0x143
}; };
enum op5s { enum op5s {
@ -595,6 +600,11 @@ class Assembler : public AbstractAssembler {
// AES crypto instructions supported only on certain processors // AES crypto instructions supported only on certain processors
static void aes_only() { assert( VM_Version::has_aes(), "This instruction only works on SPARC with AES instructions support"); } static void aes_only() { assert( VM_Version::has_aes(), "This instruction only works on SPARC with AES instructions support"); }
// SHA crypto instructions supported only on certain processors
static void sha1_only() { assert( VM_Version::has_sha1(), "This instruction only works on SPARC with SHA1"); }
static void sha256_only() { assert( VM_Version::has_sha256(), "This instruction only works on SPARC with SHA256"); }
static void sha512_only() { assert( VM_Version::has_sha512(), "This instruction only works on SPARC with SHA512"); }
// instruction only in VIS1 // instruction only in VIS1
static void vis1_only() { assert( VM_Version::has_vis1(), "This instruction only works on SPARC with VIS1"); } static void vis1_only() { assert( VM_Version::has_vis1(), "This instruction only works on SPARC with VIS1"); }
@ -1179,7 +1189,6 @@ public:
u_field(3, 29, 25) | immed(true) | simm(simm13a, 13)); } u_field(3, 29, 25) | immed(true) | simm(simm13a, 13)); }
inline void wrfprs( Register d) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(6, 29, 25)); } inline void wrfprs( Register d) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(6, 29, 25)); }
// VIS1 instructions // VIS1 instructions
void alignaddr( Register s1, Register s2, Register d ) { vis1_only(); emit_int32( op(arith_op) | rd(d) | op3(alignaddr_op3) | rs1(s1) | opf(alignaddr_opf) | rs2(s2)); } void alignaddr( Register s1, Register s2, Register d ) { vis1_only(); emit_int32( op(arith_op) | rd(d) | op3(alignaddr_op3) | rs1(s1) | opf(alignaddr_opf) | rs2(s2)); }
@ -1203,6 +1212,12 @@ public:
void movwtos( Register s, FloatRegister d ) { vis3_only(); emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(mftoi_op3) | opf(mwtos_opf) | rs2(s)); } void movwtos( Register s, FloatRegister d ) { vis3_only(); emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(mftoi_op3) | opf(mwtos_opf) | rs2(s)); }
void movxtod( Register s, FloatRegister d ) { vis3_only(); emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(mftoi_op3) | opf(mxtod_opf) | rs2(s)); } void movxtod( Register s, FloatRegister d ) { vis3_only(); emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(mftoi_op3) | opf(mxtod_opf) | rs2(s)); }
// Crypto SHA instructions
void sha1() { sha1_only(); emit_int32( op(arith_op) | op3(sha_op3) | opf(sha1_opf)); }
void sha256() { sha256_only(); emit_int32( op(arith_op) | op3(sha_op3) | opf(sha256_opf)); }
void sha512() { sha512_only(); emit_int32( op(arith_op) | op3(sha_op3) | opf(sha512_opf)); }
// Creation // Creation
Assembler(CodeBuffer* code) : AbstractAssembler(code) { Assembler(CodeBuffer* code) : AbstractAssembler(code) {
#ifdef CHECK_DELAY #ifdef CHECK_DELAY

View File

@ -1612,13 +1612,10 @@ int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
__ set((intptr_t)os::get_polling_page(), tmp->as_register()); __ set((intptr_t)os::get_polling_page(), tmp->as_register());
if (info != NULL) { if (info != NULL) {
add_debug_info_for_branch(info); add_debug_info_for_branch(info);
} else {
__ relocate(relocInfo::poll_type);
} }
int offset = __ offset(); int offset = __ offset();
__ relocate(relocInfo::poll_type);
__ ld_ptr(tmp->as_register(), 0, G0); __ ld_ptr(tmp->as_register(), 0, G0);
return offset; return offset;
} }

View File

@ -872,21 +872,19 @@ void LIRGenerator::do_Convert(Convert* x) {
void LIRGenerator::do_NewInstance(NewInstance* x) { void LIRGenerator::do_NewInstance(NewInstance* x) {
print_if_not_loaded(x);
// This instruction can be deoptimized in the slow path : use // This instruction can be deoptimized in the slow path : use
// O0 as result register. // O0 as result register.
const LIR_Opr reg = result_register_for(x->type()); const LIR_Opr reg = result_register_for(x->type());
#ifndef PRODUCT
if (PrintNotLoaded && !x->klass()->is_loaded()) {
tty->print_cr(" ###class not loaded at new bci %d", x->printable_bci());
}
#endif
CodeEmitInfo* info = state_for(x, x->state()); CodeEmitInfo* info = state_for(x, x->state());
LIR_Opr tmp1 = FrameMap::G1_oop_opr; LIR_Opr tmp1 = FrameMap::G1_oop_opr;
LIR_Opr tmp2 = FrameMap::G3_oop_opr; LIR_Opr tmp2 = FrameMap::G3_oop_opr;
LIR_Opr tmp3 = FrameMap::G4_oop_opr; LIR_Opr tmp3 = FrameMap::G4_oop_opr;
LIR_Opr tmp4 = FrameMap::O1_oop_opr; LIR_Opr tmp4 = FrameMap::O1_oop_opr;
LIR_Opr klass_reg = FrameMap::G5_metadata_opr; LIR_Opr klass_reg = FrameMap::G5_metadata_opr;
new_instance(reg, x->klass(), tmp1, tmp2, tmp3, tmp4, klass_reg, info); new_instance(reg, x->klass(), x->is_unresolved(), tmp1, tmp2, tmp3, tmp4, klass_reg, info);
LIR_Opr result = rlock_result(x); LIR_Opr result = rlock_result(x);
__ move(reg, result); __ move(reg, result);
} }

View File

@ -135,7 +135,7 @@ void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry)
if (TraceICs) { if (TraceICs) {
ResourceMark rm; ResourceMark rm;
tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
instruction_address(), p2i(instruction_address()),
callee->name_and_sig_as_C_string()); callee->name_and_sig_as_C_string());
} }

View File

@ -42,18 +42,22 @@ void pd_ps(frame f) {
intptr_t *pc = NULL; intptr_t *pc = NULL;
intptr_t *next_pc = NULL; intptr_t *next_pc = NULL;
int count = 0; int count = 0;
tty->print("register window backtrace from %#x:\n", sp); tty->print_cr("register window backtrace from " INTPTR_FORMAT ":", p2i(sp));
while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) { while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) {
pc = next_pc; pc = next_pc;
next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()]; next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()];
tty->print("[%d] sp=%#x pc=", count, sp); tty->print("[%d] sp=" INTPTR_FORMAT " pc=", count, p2i(sp));
findpc((intptr_t)pc); findpc((intptr_t)pc);
if (WizardMode && Verbose) { if (WizardMode && Verbose) {
// print register window contents also // print register window contents also
tty->print_cr(" L0..L7: {%#x %#x %#x %#x %#x %#x %#x %#x}", tty->print_cr(" L0..L7: {"
INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " "
INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " ",
sp[0+0], sp[0+1], sp[0+2], sp[0+3], sp[0+0], sp[0+1], sp[0+2], sp[0+3],
sp[0+4], sp[0+5], sp[0+6], sp[0+7]); sp[0+4], sp[0+5], sp[0+6], sp[0+7]);
tty->print_cr(" I0..I7: {%#x %#x %#x %#x %#x %#x %#x %#x}", tty->print_cr(" I0..I7: {"
INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " "
INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " ",
sp[8+0], sp[8+1], sp[8+2], sp[8+3], sp[8+0], sp[8+1], sp[8+2], sp[8+3],
sp[8+4], sp[8+5], sp[8+6], sp[8+7]); sp[8+4], sp[8+5], sp[8+6], sp[8+7]);
// (and print stack frame contents too??) // (and print stack frame contents too??)
@ -74,7 +78,7 @@ void pd_ps(frame f) {
count += 1; count += 1;
} }
if (sp != NULL) if (sp != NULL)
tty->print("[%d] sp=%#x [bogus sp!]", count, sp); tty->print("[%d] sp=" INTPTR_FORMAT " [bogus sp!]", count, p2i(sp));
} }
#endif // PRODUCT #endif // PRODUCT

View File

@ -557,7 +557,8 @@ void frame::patch_pc(Thread* thread, address pc) {
// QQQ this assert is invalid (or too strong anyway) sice _pc could // QQQ this assert is invalid (or too strong anyway) sice _pc could
// be original pc and frame could have the deopt pc. // be original pc and frame could have the deopt pc.
// assert(_pc == *O7_addr() + pc_return_offset, "frame has wrong pc"); // assert(_pc == *O7_addr() + pc_return_offset, "frame has wrong pc");
tty->print_cr("patch_pc at address 0x%x [0x%x -> 0x%x] ", O7_addr(), _pc, pc); tty->print_cr("patch_pc at address " INTPTR_FORMAT " [" INTPTR_FORMAT " -> " INTPTR_FORMAT "]",
p2i(O7_addr()), p2i(_pc), p2i(pc));
} }
_cb = CodeCache::find_blob(pc); _cb = CodeCache::find_blob(pc);
*O7_addr() = pc - pc_return_offset; *O7_addr() = pc - pc_return_offset;

View File

@ -1202,7 +1202,7 @@ void RegistersForDebugging::print(outputStream* s) {
if ( j != last ) s->print(" - f%d", last); if ( j != last ) s->print(" - f%d", last);
s->print(" = %f", val); s->print(" = %f", val);
s->fill_to(25); s->fill_to(25);
s->print_cr(" (0x%x)", val); s->print_cr(" (0x%x)", *(int*)&val);
j = last + 1; j = last + 1;
} }
s->cr(); s->cr();

View File

@ -483,7 +483,7 @@ void trace_method_handle_stub(const char* adaptername,
const char* mh_reg_name = has_mh ? "G3_mh" : "G3"; const char* mh_reg_name = has_mh ? "G3_mh" : "G3";
tty->print_cr("MH %s %s="INTPTR_FORMAT " saved_sp=" INTPTR_FORMAT " args=" INTPTR_FORMAT, tty->print_cr("MH %s %s="INTPTR_FORMAT " saved_sp=" INTPTR_FORMAT " args=" INTPTR_FORMAT,
adaptername, mh_reg_name, adaptername, mh_reg_name,
(intptr_t) mh, saved_sp, args); p2i(mh), p2i(saved_sp), p2i(args));
if (Verbose) { if (Verbose) {
// dumping last frame with frame::describe // dumping last frame with frame::describe

View File

@ -78,7 +78,7 @@ void NativeInstruction::verify() {
} }
void NativeInstruction::print() { void NativeInstruction::print() {
tty->print_cr(INTPTR_FORMAT ": 0x%x", addr_at(0), long_at(0)); tty->print_cr(INTPTR_FORMAT ": 0x%x", p2i(addr_at(0)), long_at(0));
} }
void NativeInstruction::set_long_at(int offset, int i) { void NativeInstruction::set_long_at(int offset, int i) {
@ -142,7 +142,7 @@ void NativeCall::verify() {
} }
void NativeCall::print() { void NativeCall::print() {
tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, instruction_address(), destination()); tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, p2i(instruction_address()), p2i(destination()));
} }
@ -271,7 +271,7 @@ bool NativeFarCall::is_call_at(address instr) {
} }
void NativeFarCall::print() { void NativeFarCall::print() {
tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, instruction_address(), destination()); tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, p2i(instruction_address()), p2i(destination()));
} }
bool NativeFarCall::destination_is_compiled_verified_entry_point() { bool NativeFarCall::destination_is_compiled_verified_entry_point() {
@ -324,7 +324,7 @@ void NativeMovConstReg::verify() {
void NativeMovConstReg::print() { void NativeMovConstReg::print() {
tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, instruction_address(), data()); tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, p2i(instruction_address()), data());
} }
@ -446,7 +446,7 @@ void NativeMovConstRegPatching::verify() {
void NativeMovConstRegPatching::print() { void NativeMovConstRegPatching::print() {
tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, instruction_address(), data()); tty->print_cr(INTPTR_FORMAT ": mov reg, 0x%x", p2i(instruction_address()), data());
} }
@ -585,9 +585,10 @@ void NativeMovRegMem::verify() {
void NativeMovRegMem::print() { void NativeMovRegMem::print() {
if (is_immediate()) { if (is_immediate()) {
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %x]", instruction_address(), offset()); // offset is a signed 13-bit immediate, so casting it to int will not lose significant bits
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %d]", p2i(instruction_address()), (int)offset());
} else { } else {
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", instruction_address()); tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", p2i(instruction_address()));
} }
} }
@ -689,149 +690,6 @@ void NativeMovRegMem::test() {
// End code for unit testing implementation of NativeMovRegMem class // End code for unit testing implementation of NativeMovRegMem class
//--------------------------------------------------------------------------------
void NativeMovRegMemPatching::copy_instruction_to(address new_instruction_address) {
Untested("copy_instruction_to");
int instruction_size = next_instruction_address() - instruction_address();
for (int i = 0; i < instruction_size; i += wordSize) {
*(long*)(new_instruction_address + i) = *(long*)(address(this) + i);
}
}
void NativeMovRegMemPatching::verify() {
NativeInstruction::verify();
// make sure code pattern is actually a "ld" or "st" of some sort.
int i0 = long_at(0);
int op3 = inv_op3(i0);
assert((int)nop_offset == (int)NativeMovConstReg::add_offset, "sethi size ok");
if (!(is_op(i0, Assembler::ldst_op) &&
inv_immed(i0) &&
0 != (op3 < op3_ldst_int_limit
? (1 << op3 ) & (op3_mask_ld | op3_mask_st)
: (1 << (op3 - op3_ldst_int_limit)) & (op3_mask_ldf | op3_mask_stf)))) {
int i1 = long_at(ldst_offset);
Register rd = inv_rd(i0);
op3 = inv_op3(i1);
if (!is_op(i1, Assembler::ldst_op) && rd == inv_rs2(i1) &&
0 != (op3 < op3_ldst_int_limit
? (1 << op3 ) & (op3_mask_ld | op3_mask_st)
: (1 << (op3 - op3_ldst_int_limit)) & (op3_mask_ldf | op3_mask_stf))) {
fatal("not a ld* or st* op");
}
}
}
void NativeMovRegMemPatching::print() {
if (is_immediate()) {
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %x]", instruction_address(), offset());
} else {
tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", instruction_address());
}
}
// Code for unit testing implementation of NativeMovRegMemPatching class
void NativeMovRegMemPatching::test() {
#ifdef ASSERT
ResourceMark rm;
CodeBuffer cb("test", 1000, 1000);
MacroAssembler* a = new MacroAssembler(&cb);
NativeMovRegMemPatching* nm;
uint idx = 0;
uint idx1;
int offsets[] = {
0x0,
0xffffffff,
0x7fffffff,
0x80000000,
4096,
4097,
0x20,
0x4000,
};
VM_Version::allow_all();
AddressLiteral al(0xffffffff, relocInfo::external_word_type);
a->ldsw( G5, al.low10(), G4); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->ldsw( G5, I3, G4 ); idx++;
a->ldsb( G5, al.low10(), G4); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->ldsb( G5, I3, G4 ); idx++;
a->ldsh( G5, al.low10(), G4); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->ldsh( G5, I3, G4 ); idx++;
a->lduw( G5, al.low10(), G4); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->lduw( G5, I3, G4 ); idx++;
a->ldub( G5, al.low10(), G4); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->ldub( G5, I3, G4 ); idx++;
a->lduh( G5, al.low10(), G4); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->lduh( G5, I3, G4 ); idx++;
a->ldx( G5, al.low10(), G4); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->ldx( G5, I3, G4 ); idx++;
a->ldd( G5, al.low10(), G4); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->ldd( G5, I3, G4 ); idx++;
a->ldf( FloatRegisterImpl::D, O2, -1, F14 ); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->ldf( FloatRegisterImpl::S, O0, I3, F15 ); idx++;
a->stw( G5, G4, al.low10()); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->stw( G5, G4, I3 ); idx++;
a->stb( G5, G4, al.low10()); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->stb( G5, G4, I3 ); idx++;
a->sth( G5, G4, al.low10()); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->sth( G5, G4, I3 ); idx++;
a->stx( G5, G4, al.low10()); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->stx( G5, G4, I3 ); idx++;
a->std( G5, G4, al.low10()); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->std( G5, G4, I3 ); idx++;
a->stf( FloatRegisterImpl::S, F18, O2, -1 ); idx++;
a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3);
a->stf( FloatRegisterImpl::S, F15, O0, I3 ); idx++;
nm = nativeMovRegMemPatching_at( cb.insts_begin() );
nm->print();
nm->set_offset( low10(0) );
nm->print();
nm->add_offset_in_bytes( low10(0xbb) * wordSize );
nm->print();
while (--idx) {
nm = nativeMovRegMemPatching_at( nm->next_instruction_address() );
nm->print();
for (idx1 = 0; idx1 < ARRAY_SIZE(offsets); idx1++) {
nm->set_offset( nm->is_immediate() ? low10(offsets[idx1]) : offsets[idx1] );
assert(nm->offset() == (nm->is_immediate() ? low10(offsets[idx1]) : offsets[idx1]),
"check unit test");
nm->print();
}
nm->add_offset_in_bytes( low10(0xbb) * wordSize );
nm->print();
}
VM_Version::revert();
#endif // ASSERT
}
// End code for unit testing implementation of NativeMovRegMemPatching class
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
@ -863,7 +721,7 @@ void NativeJump::verify() {
void NativeJump::print() { void NativeJump::print() {
tty->print_cr(INTPTR_FORMAT ": jmpl reg, " INTPTR_FORMAT, instruction_address(), jump_destination()); tty->print_cr(INTPTR_FORMAT ": jmpl reg, " INTPTR_FORMAT, p2i(instruction_address()), p2i(jump_destination()));
} }

View File

@ -38,7 +38,6 @@
// - - NativeMovConstReg // - - NativeMovConstReg
// - - NativeMovConstRegPatching // - - NativeMovConstRegPatching
// - - NativeMovRegMem // - - NativeMovRegMem
// - - NativeMovRegMemPatching
// - - NativeJump // - - NativeJump
// - - NativeGeneralJump // - - NativeGeneralJump
// - - NativeIllegalInstruction // - - NativeIllegalInstruction
@ -710,96 +709,6 @@ class NativeMovRegMem: public NativeInstruction {
}; };
// An interface for accessing/manipulating native memory ops
// ld* [reg + offset], reg
// st* reg, [reg + offset]
// sethi %hi(imm), reg; nop; add reg, %lo(imm), reg; ld* [reg1 + reg], reg2
// sethi %hi(imm), reg; nop; add reg, %lo(imm), reg; st* reg2, [reg1 + reg]
// Ops covered: {lds,ldu,st}{w,b,h}, {ld,st}{d,x}
//
// Note that it is identical to NativeMovRegMem with the exception of a nop between the
// sethi and the add. The nop is required to be in the delay slot of the call instruction
// which overwrites the sethi during patching.
class NativeMovRegMemPatching;
inline NativeMovRegMemPatching* nativeMovRegMemPatching_at (address address);
class NativeMovRegMemPatching: public NativeInstruction {
public:
enum Sparc_specific_constants {
op3_mask_ld = 1 << Assembler::lduw_op3 |
1 << Assembler::ldub_op3 |
1 << Assembler::lduh_op3 |
1 << Assembler::ldd_op3 |
1 << Assembler::ldsw_op3 |
1 << Assembler::ldsb_op3 |
1 << Assembler::ldsh_op3 |
1 << Assembler::ldx_op3,
op3_mask_st = 1 << Assembler::stw_op3 |
1 << Assembler::stb_op3 |
1 << Assembler::sth_op3 |
1 << Assembler::std_op3 |
1 << Assembler::stx_op3,
op3_ldst_int_limit = Assembler::ldf_op3,
op3_mask_ldf = 1 << (Assembler::ldf_op3 - op3_ldst_int_limit) |
1 << (Assembler::lddf_op3 - op3_ldst_int_limit),
op3_mask_stf = 1 << (Assembler::stf_op3 - op3_ldst_int_limit) |
1 << (Assembler::stdf_op3 - op3_ldst_int_limit),
offset_width = 13,
sethi_offset = 0,
#ifdef _LP64
nop_offset = 7 * BytesPerInstWord,
#else
nop_offset = 4,
#endif
add_offset = nop_offset + BytesPerInstWord,
ldst_offset = add_offset + BytesPerInstWord
};
bool is_immediate() const {
// check if instruction is ld* [reg + offset], reg or st* reg, [reg + offset]
int i0 = long_at(0);
return (is_op(i0, Assembler::ldst_op));
}
address instruction_address() const { return addr_at(0); }
address next_instruction_address() const {
return addr_at(is_immediate()? 4 : 16);
}
int offset() const {
return is_immediate()? inv_simm(long_at(0), offset_width) :
nativeMovConstRegPatching_at(addr_at(0))->data();
}
void set_offset(int x) {
if (is_immediate()) {
guarantee(fits_in_simm(x, offset_width), "data block offset overflow");
set_long_at(0, set_simm(long_at(0), x, offset_width));
}
else
nativeMovConstRegPatching_at(addr_at(0))->set_data(x);
}
void add_offset_in_bytes(intptr_t radd_offset) {
set_offset (offset() + radd_offset);
}
void copy_instruction_to(address new_instruction_address);
void verify();
void print ();
// unit test stuff
static void test();
private:
friend inline NativeMovRegMemPatching* nativeMovRegMemPatching_at (address address) {
NativeMovRegMemPatching* test = (NativeMovRegMemPatching*)address;
#ifdef ASSERT
test->verify();
#endif
return test;
}
};
// An interface for accessing/manipulating native jumps // An interface for accessing/manipulating native jumps
// jump_to addr // jump_to addr
// == sethi %hi22(addr), temp ; jumpl reg, %lo10(addr), G0 ; <delay> // == sethi %hi22(addr), temp ; jumpl reg, %lo10(addr), G0 ; <delay>

View File

@ -1206,10 +1206,10 @@ void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
} }
if (Assembler::is_simm13(-framesize)) { if (Assembler::is_simm13(-framesize)) {
st->print ("SAVE R_SP,-%d,R_SP",framesize); st->print ("SAVE R_SP,-" SIZE_FORMAT ",R_SP",framesize);
} else { } else {
st->print_cr("SETHI R_SP,hi%%(-%d),R_G3",framesize); st->print("\t"); st->print_cr("SETHI R_SP,hi%%(-" SIZE_FORMAT "),R_G3",framesize); st->print("\t");
st->print_cr("ADD R_G3,lo%%(-%d),R_G3",framesize); st->print("\t"); st->print_cr("ADD R_G3,lo%%(-" SIZE_FORMAT "),R_G3",framesize); st->print("\t");
st->print ("SAVE R_SP,R_G3,R_SP"); st->print ("SAVE R_SP,R_G3,R_SP");
} }

View File

@ -4575,6 +4575,219 @@ class StubGenerator: public StubCodeGenerator {
return start; return start;
} }
address generate_sha1_implCompress(bool multi_block, const char *name) {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", name);
address start = __ pc();
Label L_sha1_loop, L_sha1_unaligned_input, L_sha1_unaligned_input_loop;
int i;
Register buf = O0; // byte[] source+offset
Register state = O1; // int[] SHA.state
Register ofs = O2; // int offset
Register limit = O3; // int limit
// load state into F0-F4
for (i = 0; i < 5; i++) {
__ ldf(FloatRegisterImpl::S, state, i*4, as_FloatRegister(i));
}
__ andcc(buf, 7, G0);
__ br(Assembler::notZero, false, Assembler::pn, L_sha1_unaligned_input);
__ delayed()->nop();
__ BIND(L_sha1_loop);
// load buf into F8-F22
for (i = 0; i < 8; i++) {
__ ldf(FloatRegisterImpl::D, buf, i*8, as_FloatRegister(i*2 + 8));
}
__ sha1();
if (multi_block) {
__ add(ofs, 64, ofs);
__ add(buf, 64, buf);
__ cmp_and_brx_short(ofs, limit, Assembler::lessEqual, Assembler::pt, L_sha1_loop);
__ mov(ofs, O0); // to be returned
}
// store F0-F4 into state and return
for (i = 0; i < 4; i++) {
__ stf(FloatRegisterImpl::S, as_FloatRegister(i), state, i*4);
}
__ retl();
__ delayed()->stf(FloatRegisterImpl::S, F4, state, 0x10);
__ BIND(L_sha1_unaligned_input);
__ alignaddr(buf, G0, buf);
__ BIND(L_sha1_unaligned_input_loop);
// load buf into F8-F22
for (i = 0; i < 9; i++) {
__ ldf(FloatRegisterImpl::D, buf, i*8, as_FloatRegister(i*2 + 8));
}
for (i = 0; i < 8; i++) {
__ faligndata(as_FloatRegister(i*2 + 8), as_FloatRegister(i*2 + 10), as_FloatRegister(i*2 + 8));
}
__ sha1();
if (multi_block) {
__ add(ofs, 64, ofs);
__ add(buf, 64, buf);
__ cmp_and_brx_short(ofs, limit, Assembler::lessEqual, Assembler::pt, L_sha1_unaligned_input_loop);
__ mov(ofs, O0); // to be returned
}
// store F0-F4 into state and return
for (i = 0; i < 4; i++) {
__ stf(FloatRegisterImpl::S, as_FloatRegister(i), state, i*4);
}
__ retl();
__ delayed()->stf(FloatRegisterImpl::S, F4, state, 0x10);
return start;
}
address generate_sha256_implCompress(bool multi_block, const char *name) {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", name);
address start = __ pc();
Label L_sha256_loop, L_sha256_unaligned_input, L_sha256_unaligned_input_loop;
int i;
Register buf = O0; // byte[] source+offset
Register state = O1; // int[] SHA2.state
Register ofs = O2; // int offset
Register limit = O3; // int limit
// load state into F0-F7
for (i = 0; i < 8; i++) {
__ ldf(FloatRegisterImpl::S, state, i*4, as_FloatRegister(i));
}
__ andcc(buf, 7, G0);
__ br(Assembler::notZero, false, Assembler::pn, L_sha256_unaligned_input);
__ delayed()->nop();
__ BIND(L_sha256_loop);
// load buf into F8-F22
for (i = 0; i < 8; i++) {
__ ldf(FloatRegisterImpl::D, buf, i*8, as_FloatRegister(i*2 + 8));
}
__ sha256();
if (multi_block) {
__ add(ofs, 64, ofs);
__ add(buf, 64, buf);
__ cmp_and_brx_short(ofs, limit, Assembler::lessEqual, Assembler::pt, L_sha256_loop);
__ mov(ofs, O0); // to be returned
}
// store F0-F7 into state and return
for (i = 0; i < 7; i++) {
__ stf(FloatRegisterImpl::S, as_FloatRegister(i), state, i*4);
}
__ retl();
__ delayed()->stf(FloatRegisterImpl::S, F7, state, 0x1c);
__ BIND(L_sha256_unaligned_input);
__ alignaddr(buf, G0, buf);
__ BIND(L_sha256_unaligned_input_loop);
// load buf into F8-F22
for (i = 0; i < 9; i++) {
__ ldf(FloatRegisterImpl::D, buf, i*8, as_FloatRegister(i*2 + 8));
}
for (i = 0; i < 8; i++) {
__ faligndata(as_FloatRegister(i*2 + 8), as_FloatRegister(i*2 + 10), as_FloatRegister(i*2 + 8));
}
__ sha256();
if (multi_block) {
__ add(ofs, 64, ofs);
__ add(buf, 64, buf);
__ cmp_and_brx_short(ofs, limit, Assembler::lessEqual, Assembler::pt, L_sha256_unaligned_input_loop);
__ mov(ofs, O0); // to be returned
}
// store F0-F7 into state and return
for (i = 0; i < 7; i++) {
__ stf(FloatRegisterImpl::S, as_FloatRegister(i), state, i*4);
}
__ retl();
__ delayed()->stf(FloatRegisterImpl::S, F7, state, 0x1c);
return start;
}
address generate_sha512_implCompress(bool multi_block, const char *name) {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", name);
address start = __ pc();
Label L_sha512_loop, L_sha512_unaligned_input, L_sha512_unaligned_input_loop;
int i;
Register buf = O0; // byte[] source+offset
Register state = O1; // long[] SHA5.state
Register ofs = O2; // int offset
Register limit = O3; // int limit
// load state into F0-F14
for (i = 0; i < 8; i++) {
__ ldf(FloatRegisterImpl::D, state, i*8, as_FloatRegister(i*2));
}
__ andcc(buf, 7, G0);
__ br(Assembler::notZero, false, Assembler::pn, L_sha512_unaligned_input);
__ delayed()->nop();
__ BIND(L_sha512_loop);
// load buf into F16-F46
for (i = 0; i < 16; i++) {
__ ldf(FloatRegisterImpl::D, buf, i*8, as_FloatRegister(i*2 + 16));
}
__ sha512();
if (multi_block) {
__ add(ofs, 128, ofs);
__ add(buf, 128, buf);
__ cmp_and_brx_short(ofs, limit, Assembler::lessEqual, Assembler::pt, L_sha512_loop);
__ mov(ofs, O0); // to be returned
}
// store F0-F14 into state and return
for (i = 0; i < 7; i++) {
__ stf(FloatRegisterImpl::D, as_FloatRegister(i*2), state, i*8);
}
__ retl();
__ delayed()->stf(FloatRegisterImpl::D, F14, state, 0x38);
__ BIND(L_sha512_unaligned_input);
__ alignaddr(buf, G0, buf);
__ BIND(L_sha512_unaligned_input_loop);
// load buf into F16-F46
for (i = 0; i < 17; i++) {
__ ldf(FloatRegisterImpl::D, buf, i*8, as_FloatRegister(i*2 + 16));
}
for (i = 0; i < 16; i++) {
__ faligndata(as_FloatRegister(i*2 + 16), as_FloatRegister(i*2 + 18), as_FloatRegister(i*2 + 16));
}
__ sha512();
if (multi_block) {
__ add(ofs, 128, ofs);
__ add(buf, 128, buf);
__ cmp_and_brx_short(ofs, limit, Assembler::lessEqual, Assembler::pt, L_sha512_unaligned_input_loop);
__ mov(ofs, O0); // to be returned
}
// store F0-F14 into state and return
for (i = 0; i < 7; i++) {
__ stf(FloatRegisterImpl::D, as_FloatRegister(i*2), state, i*8);
}
__ retl();
__ delayed()->stf(FloatRegisterImpl::D, F14, state, 0x38);
return start;
}
void generate_initial() { void generate_initial() {
// Generates all stubs and initializes the entry points // Generates all stubs and initializes the entry points
@ -4647,6 +4860,20 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt(); StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel(); StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel();
} }
// generate SHA1/SHA256/SHA512 intrinsics code
if (UseSHA1Intrinsics) {
StubRoutines::_sha1_implCompress = generate_sha1_implCompress(false, "sha1_implCompress");
StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(true, "sha1_implCompressMB");
}
if (UseSHA256Intrinsics) {
StubRoutines::_sha256_implCompress = generate_sha256_implCompress(false, "sha256_implCompress");
StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true, "sha256_implCompressMB");
}
if (UseSHA512Intrinsics) {
StubRoutines::_sha512_implCompress = generate_sha512_implCompress(false, "sha512_implCompress");
StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(true, "sha512_implCompressMB");
}
} }

View File

@ -41,7 +41,7 @@ static bool returns_to_call_stub(address return_pc) {
enum /* platform_dependent_constants */ { enum /* platform_dependent_constants */ {
// %%%%%%%% May be able to shrink this a lot // %%%%%%%% May be able to shrink this a lot
code_size1 = 20000, // simply increase if too small (assembler will crash if too small) code_size1 = 20000, // simply increase if too small (assembler will crash if too small)
code_size2 = 22000 // simply increase if too small (assembler will crash if too small) code_size2 = 23000 // simply increase if too small (assembler will crash if too small)
}; };
class Sparc { class Sparc {

View File

@ -1722,15 +1722,15 @@ void AbstractInterpreter::layout_activation(Method* method,
if (caller->is_interpreted_frame()) { if (caller->is_interpreted_frame()) {
tty->print("interpreted "); tty->print("interpreted ");
} }
tty->print_cr("caller fp=0x%x sp=0x%x", caller->fp(), caller->sp()); tty->print_cr("caller fp=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, p2i(caller->fp()), p2i(caller->sp()));
tty->print_cr("save area = 0x%x, 0x%x", caller->sp(), caller->sp() + 16); tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(caller->sp()), p2i(caller->sp() + 16));
tty->print_cr("save area = 0x%x, 0x%x", caller->fp(), caller->fp() + 16); tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(caller->fp()), p2i(caller->fp() + 16));
tty->print_cr("interpreter fp=0x%x sp=0x%x", interpreter_frame->fp(), interpreter_frame->sp()); tty->print_cr("interpreter fp=" INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->fp()), p2i(interpreter_frame->sp()));
tty->print_cr("save area = 0x%x, 0x%x", interpreter_frame->sp(), interpreter_frame->sp() + 16); tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->sp()), p2i(interpreter_frame->sp() + 16));
tty->print_cr("save area = 0x%x, 0x%x", interpreter_frame->fp(), interpreter_frame->fp() + 16); tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->fp()), p2i(interpreter_frame->fp() + 16));
tty->print_cr("Llocals = 0x%x", locals); tty->print_cr("Llocals = " INTPTR_FORMAT, p2i(locals));
tty->print_cr("Lesp = 0x%x", esp); tty->print_cr("Lesp = " INTPTR_FORMAT, p2i(esp));
tty->print_cr("Lmonitors = 0x%x", monitors); tty->print_cr("Lmonitors = " INTPTR_FORMAT, p2i(monitors));
} }
if (method->max_locals() > 0) { if (method->max_locals() > 0) {

View File

@ -234,7 +234,7 @@ void VM_Version::initialize() {
assert((OptoLoopAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size"); assert((OptoLoopAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
char buf[512]; char buf[512];
jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
(has_v9() ? ", v9" : (has_v8() ? ", v8" : "")), (has_v9() ? ", v9" : (has_v8() ? ", v8" : "")),
(has_hardware_popc() ? ", popc" : ""), (has_hardware_popc() ? ", popc" : ""),
(has_vis1() ? ", vis1" : ""), (has_vis1() ? ", vis1" : ""),
@ -243,6 +243,9 @@ void VM_Version::initialize() {
(has_blk_init() ? ", blk_init" : ""), (has_blk_init() ? ", blk_init" : ""),
(has_cbcond() ? ", cbcond" : ""), (has_cbcond() ? ", cbcond" : ""),
(has_aes() ? ", aes" : ""), (has_aes() ? ", aes" : ""),
(has_sha1() ? ", sha1" : ""),
(has_sha256() ? ", sha256" : ""),
(has_sha512() ? ", sha512" : ""),
(is_ultra3() ? ", ultra3" : ""), (is_ultra3() ? ", ultra3" : ""),
(is_sun4v() ? ", sun4v" : ""), (is_sun4v() ? ", sun4v" : ""),
(is_niagara_plus() ? ", niagara_plus" : (is_niagara() ? ", niagara" : "")), (is_niagara_plus() ? ", niagara_plus" : (is_niagara() ? ", niagara" : "")),
@ -301,6 +304,58 @@ void VM_Version::initialize() {
} }
} }
// SHA1, SHA256, and SHA512 instructions were added to SPARC T-series at different times
if (has_sha1() || has_sha256() || has_sha512()) {
if (UseVIS > 0) { // SHA intrinsics use VIS1 instructions
if (FLAG_IS_DEFAULT(UseSHA)) {
FLAG_SET_DEFAULT(UseSHA, true);
}
} else {
if (UseSHA) {
warning("SPARC SHA intrinsics require VIS1 instruction support. Intrinsics will be disabled.");
FLAG_SET_DEFAULT(UseSHA, false);
}
}
} else if (UseSHA) {
warning("SHA instructions are not available on this CPU");
FLAG_SET_DEFAULT(UseSHA, false);
}
if (!UseSHA) {
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
} else {
if (has_sha1()) {
if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
}
} else if (UseSHA1Intrinsics) {
warning("SHA1 instruction is not available on this CPU.");
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
}
if (has_sha256()) {
if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
}
} else if (UseSHA256Intrinsics) {
warning("SHA256 instruction (for SHA-224 and SHA-256) is not available on this CPU.");
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
}
if (has_sha512()) {
if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
}
} else if (UseSHA512Intrinsics) {
warning("SHA512 instruction (for SHA-384 and SHA-512) is not available on this CPU.");
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
}
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
FLAG_SET_DEFAULT(UseSHA, false);
}
}
if (FLAG_IS_DEFAULT(ContendedPaddingWidth) && if (FLAG_IS_DEFAULT(ContendedPaddingWidth) &&
(cache_line_size > ContendedPaddingWidth)) (cache_line_size > ContendedPaddingWidth))
ContendedPaddingWidth = cache_line_size; ContendedPaddingWidth = cache_line_size;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, 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
@ -50,7 +50,10 @@ protected:
T_family = 16, T_family = 16,
T1_model = 17, T1_model = 17,
sparc5_instructions = 18, sparc5_instructions = 18,
aes_instructions = 19 aes_instructions = 19,
sha1_instruction = 20,
sha256_instruction = 21,
sha512_instruction = 22
}; };
enum Feature_Flag_Set { enum Feature_Flag_Set {
@ -77,6 +80,9 @@ protected:
T1_model_m = 1 << T1_model, T1_model_m = 1 << T1_model,
sparc5_instructions_m = 1 << sparc5_instructions, sparc5_instructions_m = 1 << sparc5_instructions,
aes_instructions_m = 1 << aes_instructions, aes_instructions_m = 1 << aes_instructions,
sha1_instruction_m = 1 << sha1_instruction,
sha256_instruction_m = 1 << sha256_instruction,
sha512_instruction_m = 1 << sha512_instruction,
generic_v8_m = v8_instructions_m | hardware_mul32_m | hardware_div32_m | hardware_fsmuld_m, generic_v8_m = v8_instructions_m | hardware_mul32_m | hardware_div32_m | hardware_fsmuld_m,
generic_v9_m = generic_v8_m | v9_instructions_m, generic_v9_m = generic_v8_m | v9_instructions_m,
@ -129,6 +135,9 @@ public:
static bool has_cbcond() { return (_features & cbcond_instructions_m) != 0; } static bool has_cbcond() { return (_features & cbcond_instructions_m) != 0; }
static bool has_sparc5_instr() { return (_features & sparc5_instructions_m) != 0; } static bool has_sparc5_instr() { return (_features & sparc5_instructions_m) != 0; }
static bool has_aes() { return (_features & aes_instructions_m) != 0; } static bool has_aes() { return (_features & aes_instructions_m) != 0; }
static bool has_sha1() { return (_features & sha1_instruction_m) != 0; }
static bool has_sha256() { return (_features & sha256_instruction_m) != 0; }
static bool has_sha512() { return (_features & sha512_instruction_m) != 0; }
static bool supports_compare_and_exchange() static bool supports_compare_and_exchange()
{ return has_v9(); } { return has_v9(); }

View File

@ -111,7 +111,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
if (PrintMiscellaneous && (WizardMode || Verbose)) { if (PrintMiscellaneous && (WizardMode || Verbose)) {
tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d", tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d",
vtable_index, s->entry_point(), vtable_index, p2i(s->entry_point()),
(int)(s->code_end() - s->entry_point()), (int)(s->code_end() - s->entry_point()),
(int)(s->code_end() - __ pc())); (int)(s->code_end() - __ pc()));
} }
@ -206,7 +206,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
if (PrintMiscellaneous && (WizardMode || Verbose)) { if (PrintMiscellaneous && (WizardMode || Verbose)) {
tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d", tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
itable_index, s->entry_point(), itable_index, p2i(s->entry_point()),
(int)(s->code_end() - s->entry_point()), (int)(s->code_end() - s->entry_point()),
(int)(s->code_end() - __ pc())); (int)(s->code_end() - __ pc()));
} }

View File

@ -1085,14 +1085,11 @@ void LIRGenerator::do_Convert(Convert* x) {
void LIRGenerator::do_NewInstance(NewInstance* x) { void LIRGenerator::do_NewInstance(NewInstance* x) {
#ifndef PRODUCT print_if_not_loaded(x);
if (PrintNotLoaded && !x->klass()->is_loaded()) {
tty->print_cr(" ###class not loaded at new bci %d", x->printable_bci());
}
#endif
CodeEmitInfo* info = state_for(x, x->state()); CodeEmitInfo* info = state_for(x, x->state());
LIR_Opr reg = result_register_for(x->type()); LIR_Opr reg = result_register_for(x->type());
new_instance(reg, x->klass(), new_instance(reg, x->klass(), x->is_unresolved(),
FrameMap::rcx_oop_opr, FrameMap::rcx_oop_opr,
FrameMap::rdi_oop_opr, FrameMap::rdi_oop_opr,
FrameMap::rsi_oop_opr, FrameMap::rsi_oop_opr,

View File

@ -327,18 +327,6 @@ inline NativeMovRegMem* nativeMovRegMem_at (address address) {
return test; return test;
} }
class NativeMovRegMemPatching: public NativeMovRegMem {
private:
friend NativeMovRegMemPatching* nativeMovRegMemPatching_at (address address) {
NativeMovRegMemPatching* test = (NativeMovRegMemPatching*)(address - instruction_offset);
#ifdef ASSERT
test->verify();
#endif
return test;
}
};
// An interface for accessing/manipulating native leal instruction of form: // An interface for accessing/manipulating native leal instruction of form:
// leal reg, [reg + offset] // leal reg, [reg + offset]

View File

@ -590,6 +590,17 @@ void VM_Version::get_processor_features() {
FLAG_SET_DEFAULT(UseAESIntrinsics, false); FLAG_SET_DEFAULT(UseAESIntrinsics, false);
} }
if (UseSHA) {
warning("SHA instructions are not available on this CPU");
FLAG_SET_DEFAULT(UseSHA, false);
}
if (UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics) {
warning("SHA intrinsics are not available on this CPU");
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
}
// Adjust RTM (Restricted Transactional Memory) flags // Adjust RTM (Restricted Transactional Memory) flags
if (!supports_rtm() && UseRTMLocking) { if (!supports_rtm() && UseRTMLocking) {
// Can't continue because UseRTMLocking affects UseBiasedLocking flag // Can't continue because UseRTMLocking affects UseBiasedLocking flag

View File

@ -1401,22 +1401,22 @@ void Matcher::pd_implicit_null_fixup(MachNode *node, uint idx) {
// No transformation necessary. // No transformation necessary.
return; return;
case INDIRECT: case INDIRECT:
new_memory = new (C) indirect_win95_safeOper( ); new_memory = new indirect_win95_safeOper( );
break; break;
case INDOFFSET8: case INDOFFSET8:
new_memory = new (C) indOffset8_win95_safeOper(memory->disp(NULL, NULL, 0)); new_memory = new indOffset8_win95_safeOper(memory->disp(NULL, NULL, 0));
break; break;
case INDOFFSET32: case INDOFFSET32:
new_memory = new (C) indOffset32_win95_safeOper(memory->disp(NULL, NULL, 0)); new_memory = new indOffset32_win95_safeOper(memory->disp(NULL, NULL, 0));
break; break;
case INDINDEXOFFSET: case INDINDEXOFFSET:
new_memory = new (C) indIndexOffset_win95_safeOper(memory->disp(NULL, NULL, 0)); new_memory = new indIndexOffset_win95_safeOper(memory->disp(NULL, NULL, 0));
break; break;
case INDINDEXSCALE: case INDINDEXSCALE:
new_memory = new (C) indIndexScale_win95_safeOper(memory->scale()); new_memory = new indIndexScale_win95_safeOper(memory->scale());
break; break;
case INDINDEXSCALEOFFSET: case INDINDEXSCALEOFFSET:
new_memory = new (C) indIndexScaleOffset_win95_safeOper(memory->scale(), memory->disp(NULL, NULL, 0)); new_memory = new indIndexScaleOffset_win95_safeOper(memory->scale(), memory->disp(NULL, NULL, 0));
break; break;
case LOAD_LONG_INDIRECT: case LOAD_LONG_INDIRECT:
case LOAD_LONG_INDOFFSET32: case LOAD_LONG_INDOFFSET32:

View File

@ -4734,10 +4734,8 @@ int os::PlatformEvent::park(jlong millis) {
// //
// Thread.interrupt and object.notify{All} both call Event::set. // Thread.interrupt and object.notify{All} both call Event::set.
// That is, we treat thread.interrupt as a special case of notification. // That is, we treat thread.interrupt as a special case of notification.
// The underlying Solaris implementation, cond_timedwait, admits // We ignore spurious OS wakeups unless FilterSpuriousWakeups is false.
// spurious/premature wakeups, but the JLS/JVM spec prevents the // We assume all ETIME returns are valid.
// JVM from making those visible to Java code. As such, we must
// filter out spurious wakeups. We assume all ETIME returns are valid.
// //
// TODO: properly differentiate simultaneous notify+interrupt. // TODO: properly differentiate simultaneous notify+interrupt.
// In that case, we should propagate the notify to another waiter. // In that case, we should propagate the notify to another waiter.

View File

@ -4299,10 +4299,8 @@ int os::PlatformEvent::park(jlong millis) {
// //
// Thread.interrupt and object.notify{All} both call Event::set. // Thread.interrupt and object.notify{All} both call Event::set.
// That is, we treat thread.interrupt as a special case of notification. // That is, we treat thread.interrupt as a special case of notification.
// The underlying Solaris implementation, cond_timedwait, admits // We ignore spurious OS wakeups unless FilterSpuriousWakeups is false.
// spurious/premature wakeups, but the JLS/JVM spec prevents the // We assume all ETIME returns are valid.
// JVM from making those visible to Java code. As such, we must
// filter out spurious wakeups. We assume all ETIME returns are valid.
// //
// TODO: properly differentiate simultaneous notify+interrupt. // TODO: properly differentiate simultaneous notify+interrupt.
// In that case, we should propagate the notify to another waiter. // In that case, we should propagate the notify to another waiter.

View File

@ -5538,10 +5538,8 @@ int os::PlatformEvent::park(jlong millis) {
// //
// Thread.interrupt and object.notify{All} both call Event::set. // Thread.interrupt and object.notify{All} both call Event::set.
// That is, we treat thread.interrupt as a special case of notification. // That is, we treat thread.interrupt as a special case of notification.
// The underlying Solaris implementation, cond_timedwait, admits // We ignore spurious OS wakeups unless FilterSpuriousWakeups is false.
// spurious/premature wakeups, but the JLS/JVM spec prevents the // We assume all ETIME returns are valid.
// JVM from making those visible to Java code. As such, we must
// filter out spurious wakeups. We assume all ETIME returns are valid.
// //
// TODO: properly differentiate simultaneous notify+interrupt. // TODO: properly differentiate simultaneous notify+interrupt.
// In that case, we should propagate the notify to another waiter. // In that case, we should propagate the notify to another waiter.

View File

@ -234,7 +234,7 @@ void os::print_context(outputStream *st, void *context) {
SIG_REGS(sc).u_regs[CON_G3], SIG_REGS(sc).u_regs[CON_G3],
SIG_REGS(sc).u_regs[CON_G4]); SIG_REGS(sc).u_regs[CON_G4]);
st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT
" G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT, " G7=" INTPTR_FORMAT " Y=0x%x",
SIG_REGS(sc).u_regs[CON_G5], SIG_REGS(sc).u_regs[CON_G5],
SIG_REGS(sc).u_regs[CON_G6], SIG_REGS(sc).u_regs[CON_G6],
SIG_REGS(sc).u_regs[CON_G7], SIG_REGS(sc).u_regs[CON_G7],
@ -285,7 +285,7 @@ void os::print_context(outputStream *st, void *context) {
st->cr(); st->cr();
st->cr(); st->cr();
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); st->print_cr("Top of Stack: (sp=" INTPTR_FORMAT ")", p2i(sp));
print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
st->cr(); st->cr();
@ -293,7 +293,7 @@ void os::print_context(outputStream *st, void *context) {
// point to garbage if entry point in an nmethod is corrupted. Leave // point to garbage if entry point in an nmethod is corrupted. Leave
// this at the end, and hope for the best. // this at the end, and hope for the best.
address pc = os::Linux::ucontext_get_pc(uc); address pc = os::Linux::ucontext_get_pc(uc);
st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); st->print_cr("Instructions: (pc=" INTPTR_FORMAT ")", p2i(pc));
print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
} }
@ -453,7 +453,7 @@ inline static bool checkVerifyOops(address pc, address fault, address* stub) {
&& pc < MacroAssembler::_verify_oop_implicit_branch[1] ) { && pc < MacroAssembler::_verify_oop_implicit_branch[1] ) {
*stub = MacroAssembler::_verify_oop_implicit_branch[2]; *stub = MacroAssembler::_verify_oop_implicit_branch[2];
warning("fixed up memory fault in +VerifyOops at address " warning("fixed up memory fault in +VerifyOops at address "
INTPTR_FORMAT, fault); INTPTR_FORMAT, p2i(fault));
return true; return true;
} }
return false; return false;

View File

@ -36,7 +36,7 @@ static bool detect_niagara() {
} }
while (!feof(fp)) { while (!feof(fp)) {
if (fscanf(fp, "cpu\t\t: %100[^\n]", &cpu) == 1) { if (fscanf(fp, "cpu\t\t: %100[^\n]", cpu) == 1) {
if (strstr(cpu, "Niagara") != NULL) { if (strstr(cpu, "Niagara") != NULL) {
rv = true; rv = true;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2006, 2014, 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
@ -137,6 +137,21 @@ int VM_Version::platform_features(int features) {
#endif #endif
if (av & AV_SPARC_AES) features |= aes_instructions_m; if (av & AV_SPARC_AES) features |= aes_instructions_m;
#ifndef AV_SPARC_SHA1
#define AV_SPARC_SHA1 0x00400000 /* sha1 instruction supported */
#endif
if (av & AV_SPARC_SHA1) features |= sha1_instruction_m;
#ifndef AV_SPARC_SHA256
#define AV_SPARC_SHA256 0x00800000 /* sha256 instruction supported */
#endif
if (av & AV_SPARC_SHA256) features |= sha256_instruction_m;
#ifndef AV_SPARC_SHA512
#define AV_SPARC_SHA512 0x01000000 /* sha512 instruction supported */
#endif
if (av & AV_SPARC_SHA512) features |= sha512_instruction_m;
} else { } else {
// getisax(2) failed, use the old legacy code. // getisax(2) failed, use the old legacy code.
#ifndef PRODUCT #ifndef PRODUCT

View File

@ -1000,7 +1000,7 @@ void ArchDesc::build_pipe_classes(FILE *fp_cpp) {
fprintf(fp_cpp, "void Bundle::initialize_nops(MachNode * nop_list[%d], Compile *C) {\n", nopcnt); fprintf(fp_cpp, "void Bundle::initialize_nops(MachNode * nop_list[%d], Compile *C) {\n", nopcnt);
int i = 0; int i = 0;
for ( _pipeline->_noplist.reset(); (nop = _pipeline->_noplist.iter()) != NULL; i++ ) { for ( _pipeline->_noplist.reset(); (nop = _pipeline->_noplist.iter()) != NULL; i++ ) {
fprintf(fp_cpp, " nop_list[%d] = (MachNode *) new (C) %sNode();\n", i, nop); fprintf(fp_cpp, " nop_list[%d] = (MachNode *) new %sNode();\n", i, nop);
} }
fprintf(fp_cpp, "};\n\n"); fprintf(fp_cpp, "};\n\n");
fprintf(fp_cpp, "#ifndef PRODUCT\n"); fprintf(fp_cpp, "#ifndef PRODUCT\n");
@ -1328,7 +1328,7 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch
preplace->next_instruction(root_inst); preplace->next_instruction(root_inst);
InstructForm *root_form = globals[root_inst]->is_instruction(); InstructForm *root_form = globals[root_inst]->is_instruction();
assert( root_form != NULL, "Replacement instruction was not previously defined"); assert( root_form != NULL, "Replacement instruction was not previously defined");
fprintf(fp, " %sNode *root = new (C) %sNode();\n", root_inst, root_inst); fprintf(fp, " %sNode *root = new %sNode();\n", root_inst, root_inst);
int inst_num; int inst_num;
const char *op_name; const char *op_name;
@ -1497,11 +1497,11 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
new_oper = frm->is_operand(); new_oper = frm->is_operand();
char *tmp = (char *)node->_exprule->_newopconst[new_id]; char *tmp = (char *)node->_exprule->_newopconst[new_id];
if (tmp == NULL) { if (tmp == NULL) {
fprintf(fp," MachOper *op%d = new (C) %sOper();\n", fprintf(fp," MachOper *op%d = new %sOper();\n",
cnt, new_oper->_ident); cnt, new_oper->_ident);
} }
else { else {
fprintf(fp," MachOper *op%d = new (C) %sOper(%s);\n", fprintf(fp," MachOper *op%d = new %sOper(%s);\n",
cnt, new_oper->_ident, tmp); cnt, new_oper->_ident, tmp);
} }
} }
@ -1566,7 +1566,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
} }
// Build the node for the instruction // Build the node for the instruction
fprintf(fp,"\n %sNode *n%d = new (C) %sNode();\n", new_id, cnt, new_id); fprintf(fp,"\n %sNode *n%d = new %sNode();\n", new_id, cnt, new_id);
// Add control edge for this node // Add control edge for this node
fprintf(fp," n%d->add_req(_in[0]);\n", cnt); fprintf(fp," n%d->add_req(_in[0]);\n", cnt);
// Build the operand for the value this node defines. // Build the operand for the value this node defines.
@ -1729,7 +1729,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
declared_def = true; declared_def = true;
} }
if (op && op->_interface && op->_interface->is_RegInterface()) { if (op && op->_interface && op->_interface->is_RegInterface()) {
fprintf(fp," def = new (C) MachTempNode(state->MachOperGenerator( %s, C ));\n", fprintf(fp," def = new MachTempNode(state->MachOperGenerator( %s, C ));\n",
machOperEnum(op->_ident)); machOperEnum(op->_ident));
fprintf(fp," add_req(def);\n"); fprintf(fp," add_req(def);\n");
// The operand for TEMP is already constructed during // The operand for TEMP is already constructed during
@ -1760,7 +1760,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
} }
fprintf(fp," kill = "); fprintf(fp," kill = ");
fprintf(fp,"new (C) MachProjNode( %s, %d, (%s), Op_%s );\n", fprintf(fp,"new MachProjNode( %s, %d, (%s), Op_%s );\n",
machNode, proj_no++, regmask, ideal_type); machNode, proj_no++, regmask, ideal_type);
fprintf(fp," proj_list.push(kill);\n"); fprintf(fp," proj_list.push(kill);\n");
} }
@ -2840,7 +2840,7 @@ static void defineIn_RegMask(FILE *fp, FormDict &globals, OperandForm &oper) {
// generate code to create a clone for a class derived from MachOper // generate code to create a clone for a class derived from MachOper
// //
// (0) MachOper *MachOperXOper::clone(Compile* C) const { // (0) MachOper *MachOperXOper::clone(Compile* C) const {
// (1) return new (C) MachXOper( _ccode, _c0, _c1, ..., _cn); // (1) return new MachXOper( _ccode, _c0, _c1, ..., _cn);
// (2) } // (2) }
// //
static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) { static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) {
@ -2849,7 +2849,7 @@ static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) {
const int num_consts = oper.num_consts(globalNames); const int num_consts = oper.num_consts(globalNames);
const bool is_ideal_bool = oper.is_ideal_bool(); const bool is_ideal_bool = oper.is_ideal_bool();
if( (num_consts > 0) ) { if( (num_consts > 0) ) {
fprintf(fp," return new (C) %sOper(", oper._ident); fprintf(fp," return new %sOper(", oper._ident);
// generate parameters for constants // generate parameters for constants
int i = 0; int i = 0;
fprintf(fp,"_c%d", i); fprintf(fp,"_c%d", i);
@ -2861,7 +2861,7 @@ static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) {
} }
else { else {
assert( num_consts == 0, "Currently support zero or one constant per operand clone function"); assert( num_consts == 0, "Currently support zero or one constant per operand clone function");
fprintf(fp," return new (C) %sOper();\n", oper._ident); fprintf(fp," return new %sOper();\n", oper._ident);
} }
// finish method // finish method
fprintf(fp,"}\n"); fprintf(fp,"}\n");
@ -3106,7 +3106,7 @@ void ArchDesc::defineClasses(FILE *fp) {
defineIn_RegMask(_CPP_MISC_file._fp, _globalNames, *oper); defineIn_RegMask(_CPP_MISC_file._fp, _globalNames, *oper);
fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper->_ident); fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper->_ident);
fprintf(fp," return new (C) %sOper(_label, _block_num);\n", oper->_ident); fprintf(fp," return new %sOper(_label, _block_num);\n", oper->_ident);
fprintf(fp,"}\n"); fprintf(fp,"}\n");
fprintf(fp,"uint %sOper::opcode() const { return %s; }\n", fprintf(fp,"uint %sOper::opcode() const { return %s; }\n",
@ -3125,7 +3125,7 @@ void ArchDesc::defineClasses(FILE *fp) {
defineIn_RegMask(_CPP_MISC_file._fp, _globalNames, *oper); defineIn_RegMask(_CPP_MISC_file._fp, _globalNames, *oper);
fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper->_ident); fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper->_ident);
fprintf(fp," return new (C) %sOper(_method);\n", oper->_ident); fprintf(fp," return new %sOper(_method);\n", oper->_ident);
fprintf(fp,"}\n"); fprintf(fp,"}\n");
fprintf(fp,"uint %sOper::opcode() const { return %s; }\n", fprintf(fp,"uint %sOper::opcode() const { return %s; }\n",
@ -3815,7 +3815,7 @@ static void genMachOperCase(FILE *fp, FormDict &globalNames, ArchDesc &AD,
// Generate the case statement for this opcode // Generate the case statement for this opcode
fprintf(fp, " case %s:", opEnumName); fprintf(fp, " case %s:", opEnumName);
fprintf(fp, "\n return new (C) %sOper(", opName); fprintf(fp, "\n return new %sOper(", opName);
// Access parameters for constructor from the stat object // Access parameters for constructor from the stat object
// //
// Build access to condition code value // Build access to condition code value
@ -3894,7 +3894,7 @@ void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *inden
const char *opClass = inst->_ident; const char *opClass = inst->_ident;
// Create the MachNode object // Create the MachNode object
fprintf(fp_cpp, "%s %sNode *node = new (C) %sNode();\n",indent, opClass,opClass); fprintf(fp_cpp, "%s %sNode *node = new %sNode();\n",indent, opClass,opClass);
if ( (inst->num_post_match_opnds() != 0) ) { if ( (inst->num_post_match_opnds() != 0) ) {
// Instruction that contains operands which are not in match rule. // Instruction that contains operands which are not in match rule.
@ -3936,7 +3936,7 @@ void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *inden
// Check for multiple constants and then fill them in. // Check for multiple constants and then fill them in.
// Just like MachOperGenerator // Just like MachOperGenerator
const char *opName = inst->_matrule->_rChild->_opType; const char *opName = inst->_matrule->_rChild->_opType;
fprintf(fp_cpp, "new (C) %sOper(", opName); fprintf(fp_cpp, "new %sOper(", opName);
// Grab operand form // Grab operand form
OperandForm *op = (_globalNames[opName])->is_operand(); OperandForm *op = (_globalNames[opName])->is_operand();
// Look up the number of constants // Look up the number of constants
@ -4010,7 +4010,7 @@ bool InstructForm::define_cisc_version(ArchDesc &AD, FILE *fp_cpp) {
fprintf(fp_cpp, "// Build CISC version of this instruction\n"); fprintf(fp_cpp, "// Build CISC version of this instruction\n");
fprintf(fp_cpp, "MachNode *%sNode::cisc_version( int offset, Compile* C ) {\n", this->_ident); fprintf(fp_cpp, "MachNode *%sNode::cisc_version( int offset, Compile* C ) {\n", this->_ident);
// Create the MachNode object // Create the MachNode object
fprintf(fp_cpp, " %sNode *node = new (C) %sNode();\n", name, name); fprintf(fp_cpp, " %sNode *node = new %sNode();\n", name, name);
// Fill in the bottom_type where requested // Fill in the bottom_type where requested
if ( this->captures_bottom_type(AD.globalNames()) ) { if ( this->captures_bottom_type(AD.globalNames()) ) {
fprintf(fp_cpp, " node->_bottom_type = bottom_type();\n"); fprintf(fp_cpp, " node->_bottom_type = bottom_type();\n");
@ -4026,7 +4026,7 @@ bool InstructForm::define_cisc_version(ArchDesc &AD, FILE *fp_cpp) {
fprintf(fp_cpp, " fill_new_machnode(node, C);\n"); fprintf(fp_cpp, " fill_new_machnode(node, C);\n");
// Construct operand to access [stack_pointer + offset] // Construct operand to access [stack_pointer + offset]
fprintf(fp_cpp, " // Construct operand to access [stack_pointer + offset]\n"); fprintf(fp_cpp, " // Construct operand to access [stack_pointer + offset]\n");
fprintf(fp_cpp, " node->set_opnd_array(cisc_operand(), new (C) %sOper(offset));\n", cisc_oper_name); fprintf(fp_cpp, " node->set_opnd_array(cisc_operand(), new %sOper(offset));\n", cisc_oper_name);
fprintf(fp_cpp, "\n"); fprintf(fp_cpp, "\n");
// Return result and exit scope // Return result and exit scope
@ -4057,7 +4057,7 @@ bool InstructForm::define_short_branch_methods(ArchDesc &AD, FILE *fp_cpp) {
fprintf(fp_cpp, "// Build short branch version of this instruction\n"); fprintf(fp_cpp, "// Build short branch version of this instruction\n");
fprintf(fp_cpp, "MachNode *%sNode::short_branch_version(Compile* C) {\n", this->_ident); fprintf(fp_cpp, "MachNode *%sNode::short_branch_version(Compile* C) {\n", this->_ident);
// Create the MachNode object // Create the MachNode object
fprintf(fp_cpp, " %sNode *node = new (C) %sNode();\n", name, name); fprintf(fp_cpp, " %sNode *node = new %sNode();\n", name, name);
if( is_ideal_if() ) { if( is_ideal_if() ) {
fprintf(fp_cpp, " node->_prob = _prob;\n"); fprintf(fp_cpp, " node->_prob = _prob;\n");
fprintf(fp_cpp, " node->_fcnt = _fcnt;\n"); fprintf(fp_cpp, " node->_fcnt = _fcnt;\n");

View File

@ -2054,7 +2054,7 @@ void GraphBuilder::new_instance(int klass_index) {
bool will_link; bool will_link;
ciKlass* klass = stream()->get_klass(will_link); ciKlass* klass = stream()->get_klass(will_link);
assert(klass->is_instance_klass(), "must be an instance klass"); assert(klass->is_instance_klass(), "must be an instance klass");
NewInstance* new_instance = new NewInstance(klass->as_instance_klass(), state_before); NewInstance* new_instance = new NewInstance(klass->as_instance_klass(), state_before, stream()->is_unresolved_klass());
_memory->new_instance(new_instance); _memory->new_instance(new_instance);
apush(append_split(new_instance)); apush(append_split(new_instance));
} }

View File

@ -1291,16 +1291,18 @@ LEAF(Invoke, StateSplit)
LEAF(NewInstance, StateSplit) LEAF(NewInstance, StateSplit)
private: private:
ciInstanceKlass* _klass; ciInstanceKlass* _klass;
bool _is_unresolved;
public: public:
// creation // creation
NewInstance(ciInstanceKlass* klass, ValueStack* state_before) NewInstance(ciInstanceKlass* klass, ValueStack* state_before, bool is_unresolved)
: StateSplit(instanceType, state_before) : StateSplit(instanceType, state_before)
, _klass(klass) , _klass(klass), _is_unresolved(is_unresolved)
{} {}
// accessors // accessors
ciInstanceKlass* klass() const { return _klass; } ciInstanceKlass* klass() const { return _klass; }
bool is_unresolved() const { return _is_unresolved; }
virtual bool needs_exception_state() const { return false; } virtual bool needs_exception_state() const { return false; }

View File

@ -336,7 +336,6 @@ void LIR_Assembler::check_no_unbound_labels() {
void LIR_Assembler::add_debug_info_for_branch(CodeEmitInfo* info) { void LIR_Assembler::add_debug_info_for_branch(CodeEmitInfo* info) {
_masm->code_section()->relocate(pc(), relocInfo::poll_type);
int pc_offset = code_offset(); int pc_offset = code_offset();
flush_debug_info(pc_offset); flush_debug_info(pc_offset);
info->record_debug_info(compilation()->debug_info_recorder(), pc_offset); info->record_debug_info(compilation()->debug_info_recorder(), pc_offset);

View File

@ -466,8 +466,11 @@ CodeEmitInfo* LIRGenerator::state_for(Instruction* x) {
} }
void LIRGenerator::klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info) { void LIRGenerator::klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info, bool need_resolve) {
if (!obj->is_loaded() || PatchALot) { /* C2 relies on constant pool entries being resolved (ciTypeFlow), so if TieredCompilation
* is active and the class hasn't yet been resolved we need to emit a patch that resolves
* the class. */
if ((TieredCompilation && need_resolve) || !obj->is_loaded() || PatchALot) {
assert(info != NULL, "info must be set if class is not loaded"); assert(info != NULL, "info must be set if class is not loaded");
__ klass2reg_patch(NULL, r, info); __ klass2reg_patch(NULL, r, info);
} else { } else {
@ -660,9 +663,18 @@ void LIRGenerator::monitor_exit(LIR_Opr object, LIR_Opr lock, LIR_Opr new_hdr, L
__ unlock_object(hdr, object, lock, scratch, slow_path); __ unlock_object(hdr, object, lock, scratch, slow_path);
} }
#ifndef PRODUCT
void LIRGenerator::print_if_not_loaded(const NewInstance* new_instance) {
if (PrintNotLoaded && !new_instance->klass()->is_loaded()) {
tty->print_cr(" ###class not loaded at new bci %d", new_instance->printable_bci());
} else if (PrintNotLoaded && (TieredCompilation && new_instance->is_unresolved())) {
tty->print_cr(" ###class not resolved at new bci %d", new_instance->printable_bci());
}
}
#endif
void LIRGenerator::new_instance(LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info) { void LIRGenerator::new_instance(LIR_Opr dst, ciInstanceKlass* klass, bool is_unresolved, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info) {
klass2reg_with_patching(klass_reg, klass, info); klass2reg_with_patching(klass_reg, klass, info, is_unresolved);
// If klass is not loaded we do not know if the klass has finalizers: // If klass is not loaded we do not know if the klass has finalizers:
if (UseFastNewInstance && klass->is_loaded() if (UseFastNewInstance && klass->is_loaded()
&& !Klass::layout_helper_needs_slow_path(klass->layout_helper())) { && !Klass::layout_helper_needs_slow_path(klass->layout_helper())) {

View File

@ -169,6 +169,8 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
return this; return this;
} }
void print_if_not_loaded(const NewInstance* new_instance) PRODUCT_RETURN;
#ifdef ASSERT #ifdef ASSERT
LIR_List* lir(const char * file, int line) const { LIR_List* lir(const char * file, int line) const {
_lir->set_file_and_line(file, line); _lir->set_file_and_line(file, line);
@ -307,7 +309,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes); void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes);
void klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info); void klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info, bool need_resolve = false);
// this loads the length and compares against the index // this loads the length and compares against the index
void array_range_check (LIR_Opr array, LIR_Opr index, CodeEmitInfo* null_check_info, CodeEmitInfo* range_check_info); void array_range_check (LIR_Opr array, LIR_Opr index, CodeEmitInfo* null_check_info, CodeEmitInfo* range_check_info);
@ -325,7 +327,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info); void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info);
void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no); void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no);
void new_instance (LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info); void new_instance (LIR_Opr dst, ciInstanceKlass* klass, bool is_unresolved, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info);
// machine dependent // machine dependent
void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info); void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info);

View File

@ -123,24 +123,24 @@ int Runtime1::_throw_incompatible_class_change_error_count = 0;
int Runtime1::_throw_array_store_exception_count = 0; int Runtime1::_throw_array_store_exception_count = 0;
int Runtime1::_throw_count = 0; int Runtime1::_throw_count = 0;
static int _byte_arraycopy_cnt = 0; static int _byte_arraycopy_stub_cnt = 0;
static int _short_arraycopy_cnt = 0; static int _short_arraycopy_stub_cnt = 0;
static int _int_arraycopy_cnt = 0; static int _int_arraycopy_stub_cnt = 0;
static int _long_arraycopy_cnt = 0; static int _long_arraycopy_stub_cnt = 0;
static int _oop_arraycopy_cnt = 0; static int _oop_arraycopy_stub_cnt = 0;
address Runtime1::arraycopy_count_address(BasicType type) { address Runtime1::arraycopy_count_address(BasicType type) {
switch (type) { switch (type) {
case T_BOOLEAN: case T_BOOLEAN:
case T_BYTE: return (address)&_byte_arraycopy_cnt; case T_BYTE: return (address)&_byte_arraycopy_stub_cnt;
case T_CHAR: case T_CHAR:
case T_SHORT: return (address)&_short_arraycopy_cnt; case T_SHORT: return (address)&_short_arraycopy_stub_cnt;
case T_FLOAT: case T_FLOAT:
case T_INT: return (address)&_int_arraycopy_cnt; case T_INT: return (address)&_int_arraycopy_stub_cnt;
case T_DOUBLE: case T_DOUBLE:
case T_LONG: return (address)&_long_arraycopy_cnt; case T_LONG: return (address)&_long_arraycopy_stub_cnt;
case T_ARRAY: case T_ARRAY:
case T_OBJECT: return (address)&_oop_arraycopy_cnt; case T_OBJECT: return (address)&_oop_arraycopy_stub_cnt;
default: default:
ShouldNotReachHere(); ShouldNotReachHere();
return NULL; return NULL;
@ -1479,13 +1479,13 @@ void Runtime1::print_statistics() {
tty->print_cr(" _ic_miss_cnt: %d", SharedRuntime::_ic_miss_ctr); tty->print_cr(" _ic_miss_cnt: %d", SharedRuntime::_ic_miss_ctr);
tty->print_cr(" _generic_arraycopy_cnt: %d", _generic_arraycopy_cnt); tty->print_cr(" _generic_arraycopy_cnt: %d", _generic_arraycopy_cnt);
tty->print_cr(" _generic_arraycopystub_cnt: %d", _generic_arraycopystub_cnt); tty->print_cr(" _generic_arraycopystub_cnt: %d", _generic_arraycopystub_cnt);
tty->print_cr(" _byte_arraycopy_cnt: %d", _byte_arraycopy_cnt); tty->print_cr(" _byte_arraycopy_cnt: %d", _byte_arraycopy_stub_cnt);
tty->print_cr(" _short_arraycopy_cnt: %d", _short_arraycopy_cnt); tty->print_cr(" _short_arraycopy_cnt: %d", _short_arraycopy_stub_cnt);
tty->print_cr(" _int_arraycopy_cnt: %d", _int_arraycopy_cnt); tty->print_cr(" _int_arraycopy_cnt: %d", _int_arraycopy_stub_cnt);
tty->print_cr(" _long_arraycopy_cnt: %d", _long_arraycopy_cnt); tty->print_cr(" _long_arraycopy_cnt: %d", _long_arraycopy_stub_cnt);
tty->print_cr(" _primitive_arraycopy_cnt: %d", _primitive_arraycopy_cnt); tty->print_cr(" _primitive_arraycopy_cnt: %d", _primitive_arraycopy_cnt);
tty->print_cr(" _oop_arraycopy_cnt (C): %d", Runtime1::_oop_arraycopy_cnt); tty->print_cr(" _oop_arraycopy_cnt (C): %d", Runtime1::_oop_arraycopy_cnt);
tty->print_cr(" _oop_arraycopy_cnt (stub): %d", _oop_arraycopy_cnt); tty->print_cr(" _oop_arraycopy_cnt (stub): %d", _oop_arraycopy_stub_cnt);
tty->print_cr(" _arraycopy_slowcase_cnt: %d", _arraycopy_slowcase_cnt); tty->print_cr(" _arraycopy_slowcase_cnt: %d", _arraycopy_slowcase_cnt);
tty->print_cr(" _arraycopy_checkcast_cnt: %d", _arraycopy_checkcast_cnt); tty->print_cr(" _arraycopy_checkcast_cnt: %d", _arraycopy_checkcast_cnt);
tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt); tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt);

View File

@ -790,6 +790,26 @@
do_name( decrypt_name, "decrypt") \ do_name( decrypt_name, "decrypt") \
do_signature(byteArray_int_int_byteArray_int_signature, "([BII[BI)I") \ do_signature(byteArray_int_int_byteArray_int_signature, "([BII[BI)I") \
\ \
/* support for sun.security.provider.SHA */ \
do_class(sun_security_provider_sha, "sun/security/provider/SHA") \
do_intrinsic(_sha_implCompress, sun_security_provider_sha, implCompress_name, implCompress_signature, F_R) \
do_name( implCompress_name, "implCompress") \
do_signature(implCompress_signature, "([BI)V") \
\
/* support for sun.security.provider.SHA2 */ \
do_class(sun_security_provider_sha2, "sun/security/provider/SHA2") \
do_intrinsic(_sha2_implCompress, sun_security_provider_sha2, implCompress_name, implCompress_signature, F_R) \
\
/* support for sun.security.provider.SHA5 */ \
do_class(sun_security_provider_sha5, "sun/security/provider/SHA5") \
do_intrinsic(_sha5_implCompress, sun_security_provider_sha5, implCompress_name, implCompress_signature, F_R) \
\
/* support for sun.security.provider.DigestBase */ \
do_class(sun_security_provider_digestbase, "sun/security/provider/DigestBase") \
do_intrinsic(_digestBase_implCompressMB, sun_security_provider_digestbase, implCompressMB_name, implCompressMB_signature, F_R) \
do_name( implCompressMB_name, "implCompressMultiBlock") \
do_signature(implCompressMB_signature, "([BII)I") \
\
/* support for java.util.zip */ \ /* support for java.util.zip */ \
do_class(java_util_zip_CRC32, "java/util/zip/CRC32") \ do_class(java_util_zip_CRC32, "java/util/zip/CRC32") \
do_intrinsic(_updateCRC32, java_util_zip_CRC32, update_name, int2_int_signature, F_SN) \ do_intrinsic(_updateCRC32, java_util_zip_CRC32, update_name, int2_int_signature, F_SN) \

View File

@ -877,11 +877,7 @@ address external_word_Relocation::target() {
void internal_word_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { void internal_word_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
address target = _target; address target = _target;
if (target == NULL) { if (target == NULL) {
if (addr_in_const()) { target = new_addr_for(this->target(), src, dest);
target = new_addr_for(*(address*)addr(), src, dest);
} else {
target = new_addr_for(pd_get_address_from_code(), src, dest);
}
} }
set_value(target); set_value(target);
} }
@ -890,8 +886,12 @@ void internal_word_Relocation::fix_relocation_after_move(const CodeBuffer* src,
address internal_word_Relocation::target() { address internal_word_Relocation::target() {
address target = _target; address target = _target;
if (target == NULL) { if (target == NULL) {
if (addr_in_const()) {
target = *(address*)addr();
} else {
target = pd_get_address_from_code(); target = pd_get_address_from_code();
} }
}
return target; return target;
} }

View File

@ -1341,13 +1341,14 @@ bool CMSAdaptiveSizePolicy::get_and_clear_first_after_collection() {
bool CMSAdaptiveSizePolicy::print_adaptive_size_policy_on( bool CMSAdaptiveSizePolicy::print_adaptive_size_policy_on(
outputStream* st) const { outputStream* st) const {
if (!UseAdaptiveSizePolicy) return false; if (!UseAdaptiveSizePolicy) {
return false;
}
GenCollectedHeap* gch = GenCollectedHeap::heap(); GenCollectedHeap* gch = GenCollectedHeap::heap();
Generation* gen0 = gch->get_gen(0); Generation* young = gch->get_gen(0);
DefNewGeneration* def_new = gen0->as_DefNewGeneration(); DefNewGeneration* def_new = young->as_DefNewGeneration();
return return AdaptiveSizePolicy::print_adaptive_size_policy_on(
AdaptiveSizePolicy::print_adaptive_size_policy_on(
st, st,
def_new->tenuring_threshold()); def_new->tenuring_threshold());
} }

View File

@ -60,21 +60,21 @@ void ConcurrentMarkSweepPolicy::initialize_generations() {
if (UseParNewGC) { if (UseParNewGC) {
if (UseAdaptiveSizePolicy) { if (UseAdaptiveSizePolicy) {
_generations[0] = new GenerationSpec(Generation::ASParNew, _generations[0] = new GenerationSpec(Generation::ASParNew,
_initial_gen0_size, _max_gen0_size); _initial_young_size, _max_young_size);
} else { } else {
_generations[0] = new GenerationSpec(Generation::ParNew, _generations[0] = new GenerationSpec(Generation::ParNew,
_initial_gen0_size, _max_gen0_size); _initial_young_size, _max_young_size);
} }
} else { } else {
_generations[0] = new GenerationSpec(Generation::DefNew, _generations[0] = new GenerationSpec(Generation::DefNew,
_initial_gen0_size, _max_gen0_size); _initial_young_size, _max_young_size);
} }
if (UseAdaptiveSizePolicy) { if (UseAdaptiveSizePolicy) {
_generations[1] = new GenerationSpec(Generation::ASConcurrentMarkSweep, _generations[1] = new GenerationSpec(Generation::ASConcurrentMarkSweep,
_initial_gen1_size, _max_gen1_size); _initial_old_size, _max_old_size);
} else { } else {
_generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep, _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep,
_initial_gen1_size, _max_gen1_size); _initial_old_size, _max_old_size);
} }
if (_generations[0] == NULL || _generations[1] == NULL) { if (_generations[0] == NULL || _generations[1] == NULL) {

View File

@ -1138,8 +1138,8 @@ static inline size_t percent_of_space(Space* space, HeapWord* addr)
void CMSCollector::icms_update_allocation_limits() void CMSCollector::icms_update_allocation_limits()
{ {
Generation* gen0 = GenCollectedHeap::heap()->get_gen(0); Generation* young = GenCollectedHeap::heap()->get_gen(0);
EdenSpace* eden = gen0->as_DefNewGeneration()->eden(); EdenSpace* eden = young->as_DefNewGeneration()->eden();
const unsigned int duty_cycle = stats().icms_update_duty_cycle(); const unsigned int duty_cycle = stats().icms_update_duty_cycle();
if (CMSTraceIncrementalPacing) { if (CMSTraceIncrementalPacing) {

View File

@ -1193,10 +1193,9 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
// Does a "full" (forced) collection invoked on this generation collect // Does a "full" (forced) collection invoked on this generation collect
// all younger generations as well? Note that the second conjunct is a // all younger generations as well? Note that the second conjunct is a
// hack to allow the collection of the younger gen first if the flag is // hack to allow the collection of the younger gen first if the flag is
// set. This is better than using th policy's should_collect_gen0_first() // set.
// since that causes us to do an extra unnecessary pair of restart-&-stop-world.
virtual bool full_collects_younger_generations() const { virtual bool full_collects_younger_generations() const {
return UseCMSCompactAtFullCollection && !CollectGen0First; return UseCMSCompactAtFullCollection && !ScavengeBeforeFullGC;
} }
void space_iterate(SpaceClosure* blk, bool usedOnly = false); void space_iterate(SpaceClosure* blk, bool usedOnly = false);

View File

@ -3622,7 +3622,7 @@ void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const {
void G1CollectedHeap::print_tracing_info() const { void G1CollectedHeap::print_tracing_info() const {
// We'll overload this to mean "trace GC pause statistics." // We'll overload this to mean "trace GC pause statistics."
if (TraceGen0Time || TraceGen1Time) { if (TraceYoungGenTime || TraceOldGenTime) {
// The "G1CollectorPolicy" is keeping track of these stats, so delegate // The "G1CollectorPolicy" is keeping track of these stats, so delegate
// to that. // to that.
g1_policy()->print_tracing_info(); g1_policy()->print_tracing_info();

View File

@ -809,7 +809,7 @@ void G1CollectorPolicy::record_full_collection_end() {
double full_gc_time_sec = end_sec - _full_collection_start_sec; double full_gc_time_sec = end_sec - _full_collection_start_sec;
double full_gc_time_ms = full_gc_time_sec * 1000.0; double full_gc_time_ms = full_gc_time_sec * 1000.0;
_trace_gen1_time_data.record_full_collection(full_gc_time_ms); _trace_old_gen_time_data.record_full_collection(full_gc_time_ms);
update_recent_gc_times(end_sec, full_gc_time_ms); update_recent_gc_times(end_sec, full_gc_time_ms);
@ -851,7 +851,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
_g1->used(), _g1->recalculate_used())); _g1->used(), _g1->recalculate_used()));
double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0; double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
_trace_gen0_time_data.record_start_collection(s_w_t_ms); _trace_young_gen_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(false /* full */); record_heap_size_info_at_start(false /* full */);
@ -906,7 +906,7 @@ void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() {
void G1CollectorPolicy::record_concurrent_pause() { void G1CollectorPolicy::record_concurrent_pause() {
if (_stop_world_start > 0.0) { if (_stop_world_start > 0.0) {
double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0; double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0;
_trace_gen0_time_data.record_yield_time(yield_ms); _trace_young_gen_time_data.record_yield_time(yield_ms);
} }
} }
@ -993,7 +993,7 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua
evacuation_info.set_bytes_copied(_bytes_copied_during_gc); evacuation_info.set_bytes_copied(_bytes_copied_during_gc);
if (update_stats) { if (update_stats) {
_trace_gen0_time_data.record_end_collection(pause_time_ms, phase_times()); _trace_young_gen_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
double app_time_ms = double app_time_ms =
(phase_times()->cur_collection_start_sec() * 1000.0 - _prev_collection_pause_end_ms); (phase_times()->cur_collection_start_sec() * 1000.0 - _prev_collection_pause_end_ms);
@ -1415,8 +1415,8 @@ size_t G1CollectorPolicy::expansion_amount() {
} }
void G1CollectorPolicy::print_tracing_info() const { void G1CollectorPolicy::print_tracing_info() const {
_trace_gen0_time_data.print(); _trace_young_gen_time_data.print();
_trace_gen1_time_data.print(); _trace_old_gen_time_data.print();
} }
void G1CollectorPolicy::print_yg_surv_rate_info() const { void G1CollectorPolicy::print_yg_surv_rate_info() const {
@ -1973,9 +1973,9 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms, EvacuationInf
_last_gc_was_young = gcs_are_young() ? true : false; _last_gc_was_young = gcs_are_young() ? true : false;
if (_last_gc_was_young) { if (_last_gc_was_young) {
_trace_gen0_time_data.increment_young_collection_count(); _trace_young_gen_time_data.increment_young_collection_count();
} else { } else {
_trace_gen0_time_data.increment_mixed_collection_count(); _trace_young_gen_time_data.increment_mixed_collection_count();
} }
// The young list is laid with the survivor regions from the previous // The young list is laid with the survivor regions from the previous
@ -2156,20 +2156,20 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms, EvacuationInf
evacuation_info.set_collectionset_regions(cset_region_length()); evacuation_info.set_collectionset_regions(cset_region_length());
} }
void TraceGen0TimeData::record_start_collection(double time_to_stop_the_world_ms) { void TraceYoungGenTimeData::record_start_collection(double time_to_stop_the_world_ms) {
if(TraceGen0Time) { if(TraceYoungGenTime) {
_all_stop_world_times_ms.add(time_to_stop_the_world_ms); _all_stop_world_times_ms.add(time_to_stop_the_world_ms);
} }
} }
void TraceGen0TimeData::record_yield_time(double yield_time_ms) { void TraceYoungGenTimeData::record_yield_time(double yield_time_ms) {
if(TraceGen0Time) { if(TraceYoungGenTime) {
_all_yield_times_ms.add(yield_time_ms); _all_yield_times_ms.add(yield_time_ms);
} }
} }
void TraceGen0TimeData::record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times) { void TraceYoungGenTimeData::record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times) {
if(TraceGen0Time) { if(TraceYoungGenTime) {
_total.add(pause_time_ms); _total.add(pause_time_ms);
_other.add(pause_time_ms - phase_times->accounted_time_ms()); _other.add(pause_time_ms - phase_times->accounted_time_ms());
_root_region_scan_wait.add(phase_times->root_region_scan_wait_time_ms()); _root_region_scan_wait.add(phase_times->root_region_scan_wait_time_ms());
@ -2194,34 +2194,34 @@ void TraceGen0TimeData::record_end_collection(double pause_time_ms, G1GCPhaseTim
} }
} }
void TraceGen0TimeData::increment_young_collection_count() { void TraceYoungGenTimeData::increment_young_collection_count() {
if(TraceGen0Time) { if(TraceYoungGenTime) {
++_young_pause_num; ++_young_pause_num;
} }
} }
void TraceGen0TimeData::increment_mixed_collection_count() { void TraceYoungGenTimeData::increment_mixed_collection_count() {
if(TraceGen0Time) { if(TraceYoungGenTime) {
++_mixed_pause_num; ++_mixed_pause_num;
} }
} }
void TraceGen0TimeData::print_summary(const char* str, void TraceYoungGenTimeData::print_summary(const char* str,
const NumberSeq* seq) const { const NumberSeq* seq) const {
double sum = seq->sum(); double sum = seq->sum();
gclog_or_tty->print_cr("%-27s = %8.2lf s (avg = %8.2lf ms)", gclog_or_tty->print_cr("%-27s = %8.2lf s (avg = %8.2lf ms)",
str, sum / 1000.0, seq->avg()); str, sum / 1000.0, seq->avg());
} }
void TraceGen0TimeData::print_summary_sd(const char* str, void TraceYoungGenTimeData::print_summary_sd(const char* str,
const NumberSeq* seq) const { const NumberSeq* seq) const {
print_summary(str, seq); print_summary(str, seq);
gclog_or_tty->print_cr("%+45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", gclog_or_tty->print_cr("%+45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
"(num", seq->num(), seq->sd(), seq->maximum()); "(num", seq->num(), seq->sd(), seq->maximum());
} }
void TraceGen0TimeData::print() const { void TraceYoungGenTimeData::print() const {
if (!TraceGen0Time) { if (!TraceYoungGenTime) {
return; return;
} }
@ -2258,14 +2258,14 @@ void TraceGen0TimeData::print() const {
print_summary_sd(" Yields", &_all_yield_times_ms); print_summary_sd(" Yields", &_all_yield_times_ms);
} }
void TraceGen1TimeData::record_full_collection(double full_gc_time_ms) { void TraceOldGenTimeData::record_full_collection(double full_gc_time_ms) {
if (TraceGen1Time) { if (TraceOldGenTime) {
_all_full_gc_times.add(full_gc_time_ms); _all_full_gc_times.add(full_gc_time_ms);
} }
} }
void TraceGen1TimeData::print() const { void TraceOldGenTimeData::print() const {
if (!TraceGen1Time) { if (!TraceOldGenTime) {
return; return;
} }

View File

@ -38,10 +38,10 @@ class HeapRegion;
class CollectionSetChooser; class CollectionSetChooser;
class G1GCPhaseTimes; class G1GCPhaseTimes;
// TraceGen0Time collects data on _both_ young and mixed evacuation pauses // TraceYoungGenTime collects data on _both_ young and mixed evacuation pauses
// (the latter may contain non-young regions - i.e. regions that are // (the latter may contain non-young regions - i.e. regions that are
// technically in Gen1) while TraceGen1Time collects data about full GCs. // technically in old) while TraceOldGenTime collects data about full GCs.
class TraceGen0TimeData : public CHeapObj<mtGC> { class TraceYoungGenTimeData : public CHeapObj<mtGC> {
private: private:
unsigned _young_pause_num; unsigned _young_pause_num;
unsigned _mixed_pause_num; unsigned _mixed_pause_num;
@ -66,7 +66,7 @@ class TraceGen0TimeData : public CHeapObj<mtGC> {
void print_summary_sd(const char* str, const NumberSeq* seq) const; void print_summary_sd(const char* str, const NumberSeq* seq) const;
public: public:
TraceGen0TimeData() : _young_pause_num(0), _mixed_pause_num(0) {}; TraceYoungGenTimeData() : _young_pause_num(0), _mixed_pause_num(0) {};
void record_start_collection(double time_to_stop_the_world_ms); void record_start_collection(double time_to_stop_the_world_ms);
void record_yield_time(double yield_time_ms); void record_yield_time(double yield_time_ms);
void record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times); void record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times);
@ -75,7 +75,7 @@ public:
void print() const; void print() const;
}; };
class TraceGen1TimeData : public CHeapObj<mtGC> { class TraceOldGenTimeData : public CHeapObj<mtGC> {
private: private:
NumberSeq _all_full_gc_times; NumberSeq _all_full_gc_times;
@ -187,8 +187,8 @@ private:
TruncatedSeq* _concurrent_mark_remark_times_ms; TruncatedSeq* _concurrent_mark_remark_times_ms;
TruncatedSeq* _concurrent_mark_cleanup_times_ms; TruncatedSeq* _concurrent_mark_cleanup_times_ms;
TraceGen0TimeData _trace_gen0_time_data; TraceYoungGenTimeData _trace_young_gen_time_data;
TraceGen1TimeData _trace_gen1_time_data; TraceOldGenTimeData _trace_old_gen_time_data;
double _stop_world_start; double _stop_world_start;

View File

@ -35,14 +35,14 @@
AdjoiningGenerations::AdjoiningGenerations(ReservedSpace old_young_rs, AdjoiningGenerations::AdjoiningGenerations(ReservedSpace old_young_rs,
GenerationSizer* policy, GenerationSizer* policy,
size_t alignment) : size_t alignment) :
_virtual_spaces(old_young_rs, policy->min_gen1_size(), _virtual_spaces(old_young_rs, policy->min_old_size(),
policy->min_gen0_size(), alignment) { policy->min_young_size(), alignment) {
size_t init_low_byte_size = policy->initial_gen1_size(); size_t init_low_byte_size = policy->initial_old_size();
size_t min_low_byte_size = policy->min_gen1_size(); size_t min_low_byte_size = policy->min_old_size();
size_t max_low_byte_size = policy->max_gen1_size(); size_t max_low_byte_size = policy->max_old_size();
size_t init_high_byte_size = policy->initial_gen0_size(); size_t init_high_byte_size = policy->initial_young_size();
size_t min_high_byte_size = policy->min_gen0_size(); size_t min_high_byte_size = policy->min_young_size();
size_t max_high_byte_size = policy->max_gen0_size(); size_t max_high_byte_size = policy->max_young_size();
assert(min_low_byte_size <= init_low_byte_size && assert(min_low_byte_size <= init_low_byte_size &&
init_low_byte_size <= max_low_byte_size, "Parameter check"); init_low_byte_size <= max_low_byte_size, "Parameter check");

View File

@ -32,8 +32,8 @@ void GenerationSizer::trace_gen_sizes(const char* const str) {
SIZE_FORMAT "," SIZE_FORMAT " " SIZE_FORMAT "," SIZE_FORMAT " "
SIZE_FORMAT, SIZE_FORMAT,
str, str,
_min_gen1_size / K, _max_gen1_size / K, _min_old_size / K, _max_old_size / K,
_min_gen0_size / K, _max_gen0_size / K, _min_young_size / K, _max_young_size / K,
_max_heap_byte_size / K); _max_heap_byte_size / K);
} }
} }

View File

@ -623,11 +623,11 @@ void ParallelScavengeHeap::print_gc_threads_on(outputStream* st) const {
} }
void ParallelScavengeHeap::print_tracing_info() const { void ParallelScavengeHeap::print_tracing_info() const {
if (TraceGen0Time) { if (TraceYoungGenTime) {
double time = PSScavenge::accumulated_time()->seconds(); double time = PSScavenge::accumulated_time()->seconds();
tty->print_cr("[Accumulated GC generation 0 time %3.7f secs]", time); tty->print_cr("[Accumulated GC generation 0 time %3.7f secs]", time);
} }
if (TraceGen1Time) { if (TraceOldGenTime) {
double time = UseParallelOldGC ? PSParallelCompact::accumulated_time()->seconds() : PSMarkSweep::accumulated_time()->seconds(); double time = UseParallelOldGC ? PSParallelCompact::accumulated_time()->seconds() : PSMarkSweep::accumulated_time()->seconds();
tty->print_cr("[Accumulated GC generation 1 time %3.7f secs]", time); tty->print_cr("[Accumulated GC generation 1 time %3.7f secs]", time);
} }

View File

@ -174,7 +174,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
TraceCollectorStats tcs(counters()); TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
if (TraceGen1Time) accumulated_time()->start(); if (TraceOldGenTime) accumulated_time()->start();
// Let the size policy know we're starting // Let the size policy know we're starting
size_policy->major_collection_begin(); size_policy->major_collection_begin();
@ -354,7 +354,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
// We collected the heap, recalculate the metaspace capacity // We collected the heap, recalculate the metaspace capacity
MetaspaceGC::compute_new_size(); MetaspaceGC::compute_new_size();
if (TraceGen1Time) accumulated_time()->stop(); if (TraceOldGenTime) accumulated_time()->stop();
if (PrintGC) { if (PrintGC) {
if (PrintGCDetails) { if (PrintGCDetails) {

View File

@ -2061,7 +2061,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
TraceCollectorStats tcs(counters()); TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
if (TraceGen1Time) accumulated_time()->start(); if (TraceOldGenTime) accumulated_time()->start();
// Let the size policy know we're starting // Let the size policy know we're starting
size_policy->major_collection_begin(); size_policy->major_collection_begin();
@ -2188,7 +2188,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
// Resize the metaspace capacity after a collection // Resize the metaspace capacity after a collection
MetaspaceGC::compute_new_size(); MetaspaceGC::compute_new_size();
if (TraceGen1Time) accumulated_time()->stop(); if (TraceOldGenTime) accumulated_time()->stop();
if (PrintGC) { if (PrintGC) {
if (PrintGCDetails) { if (PrintGCDetails) {

View File

@ -336,7 +336,7 @@ bool PSScavenge::invoke_no_policy() {
TraceCollectorStats tcs(counters()); TraceCollectorStats tcs(counters());
TraceMemoryManagerStats tms(false /* not full GC */,gc_cause); TraceMemoryManagerStats tms(false /* not full GC */,gc_cause);
if (TraceGen0Time) accumulated_time()->start(); if (TraceYoungGenTime) accumulated_time()->start();
// Let the size policy know we're starting // Let the size policy know we're starting
size_policy->minor_collection_begin(); size_policy->minor_collection_begin();
@ -660,7 +660,7 @@ bool PSScavenge::invoke_no_policy() {
CardTableExtension::verify_all_young_refs_imprecise(); CardTableExtension::verify_all_young_refs_imprecise();
} }
if (TraceGen0Time) accumulated_time()->stop(); if (TraceYoungGenTime) accumulated_time()->stop();
if (PrintGC) { if (PrintGC) {
if (PrintGCDetails) { if (PrintGCDetails) {

View File

@ -196,13 +196,13 @@ size_t CollectorPolicy::compute_heap_alignment() {
// GenCollectorPolicy methods // GenCollectorPolicy methods
GenCollectorPolicy::GenCollectorPolicy() : GenCollectorPolicy::GenCollectorPolicy() :
_min_gen0_size(0), _min_young_size(0),
_initial_gen0_size(0), _initial_young_size(0),
_max_gen0_size(0), _max_young_size(0),
_gen_alignment(0), _gen_alignment(0),
_min_gen1_size(0), _min_old_size(0),
_initial_gen1_size(0), _initial_old_size(0),
_max_gen1_size(0), _max_old_size(0),
_generations(NULL) _generations(NULL)
{} {}
@ -236,7 +236,7 @@ size_t GenCollectorPolicy::young_gen_size_lower_bound() {
#ifdef ASSERT #ifdef ASSERT
void GenCollectorPolicy::assert_flags() { void GenCollectorPolicy::assert_flags() {
CollectorPolicy::assert_flags(); CollectorPolicy::assert_flags();
assert(NewSize >= _min_gen0_size, "Ergonomics decided on a too small young gen size"); assert(NewSize >= _min_young_size, "Ergonomics decided on a too small young gen size");
assert(NewSize <= MaxNewSize, "Ergonomics decided on incompatible initial and maximum young gen sizes"); assert(NewSize <= MaxNewSize, "Ergonomics decided on incompatible initial and maximum young gen sizes");
assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young gen and heap sizes"); assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young gen and heap sizes");
assert(NewSize % _gen_alignment == 0, "NewSize alignment"); assert(NewSize % _gen_alignment == 0, "NewSize alignment");
@ -249,28 +249,28 @@ void GenCollectorPolicy::assert_size_info() {
CollectorPolicy::assert_size_info(); CollectorPolicy::assert_size_info();
// GenCollectorPolicy::initialize_size_info may update the MaxNewSize // GenCollectorPolicy::initialize_size_info may update the MaxNewSize
assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes"); assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes");
assert(NewSize == _initial_gen0_size, "Discrepancy between NewSize flag and local storage"); assert(NewSize == _initial_young_size, "Discrepancy between NewSize flag and local storage");
assert(MaxNewSize == _max_gen0_size, "Discrepancy between MaxNewSize flag and local storage"); assert(MaxNewSize == _max_young_size, "Discrepancy between MaxNewSize flag and local storage");
assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage"); assert(OldSize == _initial_old_size, "Discrepancy between OldSize flag and local storage");
assert(_min_gen0_size <= _initial_gen0_size, "Ergonomics decided on incompatible minimum and initial young gen sizes"); assert(_min_young_size <= _initial_young_size, "Ergonomics decided on incompatible minimum and initial young gen sizes");
assert(_initial_gen0_size <= _max_gen0_size, "Ergonomics decided on incompatible initial and maximum young gen sizes"); assert(_initial_young_size <= _max_young_size, "Ergonomics decided on incompatible initial and maximum young gen sizes");
assert(_min_gen0_size % _gen_alignment == 0, "_min_gen0_size alignment"); assert(_min_young_size % _gen_alignment == 0, "_min_young_size alignment");
assert(_initial_gen0_size % _gen_alignment == 0, "_initial_gen0_size alignment"); assert(_initial_young_size % _gen_alignment == 0, "_initial_young_size alignment");
assert(_max_gen0_size % _gen_alignment == 0, "_max_gen0_size alignment"); assert(_max_young_size % _gen_alignment == 0, "_max_young_size alignment");
assert(_min_gen0_size <= bound_minus_alignment(_min_gen0_size, _min_heap_byte_size), assert(_min_young_size <= bound_minus_alignment(_min_young_size, _min_heap_byte_size),
"Ergonomics made minimum young generation larger than minimum heap"); "Ergonomics made minimum young generation larger than minimum heap");
assert(_initial_gen0_size <= bound_minus_alignment(_initial_gen0_size, _initial_heap_byte_size), assert(_initial_young_size <= bound_minus_alignment(_initial_young_size, _initial_heap_byte_size),
"Ergonomics made initial young generation larger than initial heap"); "Ergonomics made initial young generation larger than initial heap");
assert(_max_gen0_size <= bound_minus_alignment(_max_gen0_size, _max_heap_byte_size), assert(_max_young_size <= bound_minus_alignment(_max_young_size, _max_heap_byte_size),
"Ergonomics made maximum young generation lager than maximum heap"); "Ergonomics made maximum young generation lager than maximum heap");
assert(_min_gen1_size <= _initial_gen1_size, "Ergonomics decided on incompatible minimum and initial old gen sizes"); assert(_min_old_size <= _initial_old_size, "Ergonomics decided on incompatible minimum and initial old gen sizes");
assert(_initial_gen1_size <= _max_gen1_size, "Ergonomics decided on incompatible initial and maximum old gen sizes"); assert(_initial_old_size <= _max_old_size, "Ergonomics decided on incompatible initial and maximum old gen sizes");
assert(_max_gen1_size % _gen_alignment == 0, "_max_gen1_size alignment"); assert(_max_old_size % _gen_alignment == 0, "_max_old_size alignment");
assert(_initial_gen1_size % _gen_alignment == 0, "_initial_gen1_size alignment"); assert(_initial_old_size % _gen_alignment == 0, "_initial_old_size alignment");
assert(_max_heap_byte_size <= (_max_gen0_size + _max_gen1_size), "Total maximum heap sizes must be sum of generation maximum sizes"); assert(_max_heap_byte_size <= (_max_young_size + _max_old_size), "Total maximum heap sizes must be sum of generation maximum sizes");
assert(_min_gen0_size + _min_gen1_size <= _min_heap_byte_size, "Minimum generation sizes exceed minimum heap size"); assert(_min_young_size + _min_old_size <= _min_heap_byte_size, "Minimum generation sizes exceed minimum heap size");
assert(_initial_gen0_size + _initial_gen1_size == _initial_heap_byte_size, "Initial generation sizes should match initial heap size"); assert(_initial_young_size + _initial_old_size == _initial_heap_byte_size, "Initial generation sizes should match initial heap size");
assert(_max_gen0_size + _max_gen1_size == _max_heap_byte_size, "Maximum generation sizes should match maximum heap size"); assert(_max_young_size + _max_old_size == _max_heap_byte_size, "Maximum generation sizes should match maximum heap size");
} }
#endif // ASSERT #endif // ASSERT
@ -323,8 +323,8 @@ void GenCollectorPolicy::initialize_flags() {
// later when setting the initial and minimum young generation size. // later when setting the initial and minimum young generation size.
NewSize = bounded_new_size; NewSize = bounded_new_size;
} }
_min_gen0_size = smallest_new_size; _min_young_size = smallest_new_size;
_initial_gen0_size = NewSize; _initial_young_size = NewSize;
if (!FLAG_IS_DEFAULT(MaxNewSize)) { if (!FLAG_IS_DEFAULT(MaxNewSize)) {
if (MaxNewSize >= MaxHeapSize) { if (MaxNewSize >= MaxHeapSize) {
@ -338,14 +338,14 @@ void GenCollectorPolicy::initialize_flags() {
FLAG_SET_ERGO(uintx, MaxNewSize, smaller_max_new_size); FLAG_SET_ERGO(uintx, MaxNewSize, smaller_max_new_size);
if (NewSize > MaxNewSize) { if (NewSize > MaxNewSize) {
FLAG_SET_ERGO(uintx, NewSize, MaxNewSize); FLAG_SET_ERGO(uintx, NewSize, MaxNewSize);
_initial_gen0_size = NewSize; _initial_young_size = NewSize;
} }
} else if (MaxNewSize < _initial_gen0_size) { } else if (MaxNewSize < _initial_young_size) {
FLAG_SET_ERGO(uintx, MaxNewSize, _initial_gen0_size); FLAG_SET_ERGO(uintx, MaxNewSize, _initial_young_size);
} else if (!is_size_aligned(MaxNewSize, _gen_alignment)) { } else if (!is_size_aligned(MaxNewSize, _gen_alignment)) {
FLAG_SET_ERGO(uintx, MaxNewSize, align_size_down(MaxNewSize, _gen_alignment)); FLAG_SET_ERGO(uintx, MaxNewSize, align_size_down(MaxNewSize, _gen_alignment));
} }
_max_gen0_size = MaxNewSize; _max_young_size = MaxNewSize;
} }
if (NewSize > MaxNewSize) { if (NewSize > MaxNewSize) {
@ -357,7 +357,7 @@ void GenCollectorPolicy::initialize_flags() {
NewSize/K, MaxNewSize/K, NewSize/K); NewSize/K, MaxNewSize/K, NewSize/K);
} }
FLAG_SET_ERGO(uintx, MaxNewSize, NewSize); FLAG_SET_ERGO(uintx, MaxNewSize, NewSize);
_max_gen0_size = MaxNewSize; _max_young_size = MaxNewSize;
} }
if (SurvivorRatio < 1 || NewRatio < 1) { if (SurvivorRatio < 1 || NewRatio < 1) {
@ -393,7 +393,7 @@ void GenCollectorPolicy::initialize_flags() {
double shrink_factor = (double) MaxHeapSize / calculated_size; double shrink_factor = (double) MaxHeapSize / calculated_size;
uintx smaller_new_size = align_size_down((uintx)(NewSize * shrink_factor), _gen_alignment); uintx smaller_new_size = align_size_down((uintx)(NewSize * shrink_factor), _gen_alignment);
FLAG_SET_ERGO(uintx, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size)); FLAG_SET_ERGO(uintx, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size));
_initial_gen0_size = NewSize; _initial_young_size = NewSize;
// OldSize is already aligned because above we aligned MaxHeapSize to // OldSize is already aligned because above we aligned MaxHeapSize to
// _heap_alignment, and we just made sure that NewSize is aligned to // _heap_alignment, and we just made sure that NewSize is aligned to
@ -406,16 +406,16 @@ void GenCollectorPolicy::initialize_flags() {
} }
} }
// Update NewSize, if possible, to avoid sizing gen0 to small when only // Update NewSize, if possible, to avoid sizing the young gen too small when only
// OldSize is set on the command line. // OldSize is set on the command line.
if (FLAG_IS_CMDLINE(OldSize) && !FLAG_IS_CMDLINE(NewSize)) { if (FLAG_IS_CMDLINE(OldSize) && !FLAG_IS_CMDLINE(NewSize)) {
if (OldSize < _initial_heap_byte_size) { if (OldSize < _initial_heap_byte_size) {
size_t new_size = _initial_heap_byte_size - OldSize; size_t new_size = _initial_heap_byte_size - OldSize;
// Need to compare against the flag value for max since _max_gen0_size // Need to compare against the flag value for max since _max_young_size
// might not have been set yet. // might not have been set yet.
if (new_size >= _min_gen0_size && new_size <= MaxNewSize) { if (new_size >= _min_young_size && new_size <= MaxNewSize) {
FLAG_SET_ERGO(uintx, NewSize, new_size); FLAG_SET_ERGO(uintx, NewSize, new_size);
_initial_gen0_size = NewSize; _initial_young_size = NewSize;
} }
} }
} }
@ -444,97 +444,77 @@ void GenCollectorPolicy::initialize_flags() {
void GenCollectorPolicy::initialize_size_info() { void GenCollectorPolicy::initialize_size_info() {
CollectorPolicy::initialize_size_info(); CollectorPolicy::initialize_size_info();
// _space_alignment is used for alignment within a generation. _initial_young_size = NewSize;
// There is additional alignment done down stream for some _max_young_size = MaxNewSize;
// collectors that sometimes causes unwanted rounding up of _initial_old_size = OldSize;
// generations sizes.
// Determine maximum size of gen0 // Determine maximum size of the young generation.
size_t max_new_size = 0; if (FLAG_IS_DEFAULT(MaxNewSize)) {
if (!FLAG_IS_DEFAULT(MaxNewSize)) { _max_young_size = scale_by_NewRatio_aligned(_max_heap_byte_size);
max_new_size = MaxNewSize;
} else {
max_new_size = scale_by_NewRatio_aligned(_max_heap_byte_size);
// Bound the maximum size by NewSize below (since it historically // Bound the maximum size by NewSize below (since it historically
// would have been NewSize and because the NewRatio calculation could // would have been NewSize and because the NewRatio calculation could
// yield a size that is too small) and bound it by MaxNewSize above. // yield a size that is too small) and bound it by MaxNewSize above.
// Ergonomics plays here by previously calculating the desired // Ergonomics plays here by previously calculating the desired
// NewSize and MaxNewSize. // NewSize and MaxNewSize.
max_new_size = MIN2(MAX2(max_new_size, NewSize), MaxNewSize); _max_young_size = MIN2(MAX2(_max_young_size, _initial_young_size), MaxNewSize);
} }
assert(max_new_size > 0, "All paths should set max_new_size");
// Given the maximum gen0 size, determine the initial and // Given the maximum young size, determine the initial and
// minimum gen0 sizes. // minimum young sizes.
if (_max_heap_byte_size == _initial_heap_byte_size) { if (_max_heap_byte_size == _initial_heap_byte_size) {
// The maxium and initial heap sizes are the same so the generation's // The maximum and initial heap sizes are the same so the generation's
// initial size must be the same as it maximum size. Use NewSize as the // initial size must be the same as it maximum size. Use NewSize as the
// size if set on command line. // size if set on command line.
size_t fixed_young_size = FLAG_IS_CMDLINE(NewSize) ? NewSize : max_new_size; _max_young_size = FLAG_IS_CMDLINE(NewSize) ? NewSize : _max_young_size;
_initial_young_size = _max_young_size;
_initial_gen0_size = fixed_young_size;
_max_gen0_size = fixed_young_size;
// Also update the minimum size if min == initial == max. // Also update the minimum size if min == initial == max.
if (_max_heap_byte_size == _min_heap_byte_size) { if (_max_heap_byte_size == _min_heap_byte_size) {
_min_gen0_size = fixed_young_size; _min_young_size = _max_young_size;
} }
} else { } else {
size_t desired_new_size = 0;
if (FLAG_IS_CMDLINE(NewSize)) { if (FLAG_IS_CMDLINE(NewSize)) {
// If NewSize is set on the command line, we should use it as // If NewSize is set on the command line, we should use it as
// the initial size, but make sure it is within the heap bounds. // the initial size, but make sure it is within the heap bounds.
desired_new_size = _initial_young_size =
MIN2(max_new_size, bound_minus_alignment(NewSize, _initial_heap_byte_size)); MIN2(_max_young_size, bound_minus_alignment(NewSize, _initial_heap_byte_size));
_min_gen0_size = bound_minus_alignment(desired_new_size, _min_heap_byte_size); _min_young_size = bound_minus_alignment(_initial_young_size, _min_heap_byte_size);
} else { } else {
// For the case where NewSize is not set on the command line, use // For the case where NewSize is not set on the command line, use
// NewRatio to size the initial generation size. Use the current // NewRatio to size the initial generation size. Use the current
// NewSize as the floor, because if NewRatio is overly large, the resulting // NewSize as the floor, because if NewRatio is overly large, the resulting
// size can be too small. // size can be too small.
desired_new_size = _initial_young_size =
MIN2(max_new_size, MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize)); MIN2(_max_young_size, MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize));
} }
_initial_gen0_size = desired_new_size;
_max_gen0_size = max_new_size;
}
// Write back to flags if necessary.
if (NewSize != _initial_gen0_size) {
FLAG_SET_ERGO(uintx, NewSize, _initial_gen0_size);
}
if (MaxNewSize != _max_gen0_size) {
FLAG_SET_ERGO(uintx, MaxNewSize, _max_gen0_size);
} }
if (PrintGCDetails && Verbose) { if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("1: Minimum gen0 " SIZE_FORMAT " Initial gen0 " gclog_or_tty->print_cr("1: Minimum young " SIZE_FORMAT " Initial young "
SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT, SIZE_FORMAT " Maximum young " SIZE_FORMAT,
_min_gen0_size, _initial_gen0_size, _max_gen0_size); _min_young_size, _initial_young_size, _max_young_size);
} }
// At this point the minimum, initial and maximum sizes // At this point the minimum, initial and maximum sizes
// of the overall heap and of gen0 have been determined. // of the overall heap and of the young generation have been determined.
// The maximum gen1 size can be determined from the maximum gen0 // The maximum old size can be determined from the maximum young
// and maximum heap size since no explicit flags exist // and maximum heap size since no explicit flags exist
// for setting the gen1 maximum. // for setting the old generation maximum.
_max_gen1_size = MAX2(_max_heap_byte_size - _max_gen0_size, _gen_alignment); _max_old_size = MAX2(_max_heap_byte_size - _max_young_size, _gen_alignment);
// If no explicit command line flag has been set for the // If no explicit command line flag has been set for the
// gen1 size, use what is left for gen1 // old generation size, use what is left.
if (!FLAG_IS_CMDLINE(OldSize)) { if (!FLAG_IS_CMDLINE(OldSize)) {
// The user has not specified any value but the ergonomics // The user has not specified any value but the ergonomics
// may have chosen a value (which may or may not be consistent // may have chosen a value (which may or may not be consistent
// with the overall heap size). In either case make // with the overall heap size). In either case make
// the minimum, maximum and initial sizes consistent // the minimum, maximum and initial sizes consistent
// with the gen0 sizes and the overall heap sizes. // with the young sizes and the overall heap sizes.
_min_gen1_size = _gen_alignment; _min_old_size = _gen_alignment;
_initial_gen1_size = MIN2(_max_gen1_size, MAX2(_initial_heap_byte_size - _initial_gen0_size, _min_gen1_size)); _initial_old_size = MIN2(_max_old_size, MAX2(_initial_heap_byte_size - _initial_young_size, _min_old_size));
// _max_gen1_size has already been made consistent above // _max_old_size has already been made consistent above.
FLAG_SET_ERGO(uintx, OldSize, _initial_gen1_size);
} else { } else {
// OldSize has been explicitly set on the command line. Use it // OldSize has been explicitly set on the command line. Use it
// for the initial size but make sure the minimum allow a young // for the initial size but make sure the minimum allow a young
@ -543,69 +523,68 @@ void GenCollectorPolicy::initialize_size_info() {
// with other command line flags, issue a warning. // with other command line flags, issue a warning.
// The generation minimums and the overall heap minimum should // The generation minimums and the overall heap minimum should
// be within one generation alignment. // be within one generation alignment.
if (OldSize > _max_gen1_size) { if (_initial_old_size > _max_old_size) {
warning("Inconsistency between maximum heap size and maximum " warning("Inconsistency between maximum heap size and maximum "
"generation sizes: using maximum heap = " SIZE_FORMAT "generation sizes: using maximum heap = " SIZE_FORMAT
" -XX:OldSize flag is being ignored", " -XX:OldSize flag is being ignored",
_max_heap_byte_size); _max_heap_byte_size);
FLAG_SET_ERGO(uintx, OldSize, _max_gen1_size); _initial_old_size = _max_old_size;
} }
_min_gen1_size = MIN2(OldSize, _min_heap_byte_size - _min_gen0_size); _min_old_size = MIN2(_initial_old_size, _min_heap_byte_size - _min_young_size);
_initial_gen1_size = OldSize;
} }
// The initial generation sizes should match the initial heap size, // The initial generation sizes should match the initial heap size,
// if not issue a warning and resize the generations. This behavior // if not issue a warning and resize the generations. This behavior
// differs from JDK8 where the generation sizes have higher priority // differs from JDK8 where the generation sizes have higher priority
// than the initial heap size. // than the initial heap size.
if ((_initial_gen1_size + _initial_gen0_size) != _initial_heap_byte_size) { if ((_initial_old_size + _initial_young_size) != _initial_heap_byte_size) {
warning("Inconsistency between generation sizes and heap size, resizing " warning("Inconsistency between generation sizes and heap size, resizing "
"the generations to fit the heap."); "the generations to fit the heap.");
size_t desired_gen0_size = _initial_heap_byte_size - _initial_gen1_size; size_t desired_young_size = _initial_heap_byte_size - _initial_old_size;
if (_initial_heap_byte_size < _initial_gen1_size) { if (_initial_heap_byte_size < _initial_old_size) {
// Old want all memory, use minimum for young and rest for old // Old want all memory, use minimum for young and rest for old
_initial_gen0_size = _min_gen0_size; _initial_young_size = _min_young_size;
_initial_gen1_size = _initial_heap_byte_size - _min_gen0_size; _initial_old_size = _initial_heap_byte_size - _min_young_size;
} else if (desired_gen0_size > _max_gen0_size) { } else if (desired_young_size > _max_young_size) {
// Need to increase both young and old generation // Need to increase both young and old generation
_initial_gen0_size = _max_gen0_size; _initial_young_size = _max_young_size;
_initial_gen1_size = _initial_heap_byte_size - _max_gen0_size; _initial_old_size = _initial_heap_byte_size - _max_young_size;
} else if (desired_gen0_size < _min_gen0_size) { } else if (desired_young_size < _min_young_size) {
// Need to decrease both young and old generation // Need to decrease both young and old generation
_initial_gen0_size = _min_gen0_size; _initial_young_size = _min_young_size;
_initial_gen1_size = _initial_heap_byte_size - _min_gen0_size; _initial_old_size = _initial_heap_byte_size - _min_young_size;
} else { } else {
// The young generation boundaries allow us to only update the // The young generation boundaries allow us to only update the
// young generation. // young generation.
_initial_gen0_size = desired_gen0_size; _initial_young_size = desired_young_size;
} }
if (PrintGCDetails && Verbose) { if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("2: Minimum gen0 " SIZE_FORMAT " Initial gen0 " gclog_or_tty->print_cr("2: Minimum young " SIZE_FORMAT " Initial young "
SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT, SIZE_FORMAT " Maximum young " SIZE_FORMAT,
_min_gen0_size, _initial_gen0_size, _max_gen0_size); _min_young_size, _initial_young_size, _max_young_size);
} }
} }
// Write back to flags if necessary // Write back to flags if necessary.
if (NewSize != _initial_gen0_size) { if (NewSize != _initial_young_size) {
FLAG_SET_ERGO(uintx, NewSize, _initial_gen0_size); FLAG_SET_ERGO(uintx, NewSize, _initial_young_size);
} }
if (MaxNewSize != _max_gen0_size) { if (MaxNewSize != _max_young_size) {
FLAG_SET_ERGO(uintx, MaxNewSize, _max_gen0_size); FLAG_SET_ERGO(uintx, MaxNewSize, _max_young_size);
} }
if (OldSize != _initial_gen1_size) { if (OldSize != _initial_old_size) {
FLAG_SET_ERGO(uintx, OldSize, _initial_gen1_size); FLAG_SET_ERGO(uintx, OldSize, _initial_old_size);
} }
if (PrintGCDetails && Verbose) { if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("Minimum gen1 " SIZE_FORMAT " Initial gen1 " gclog_or_tty->print_cr("Minimum old " SIZE_FORMAT " Initial old "
SIZE_FORMAT " Maximum gen1 " SIZE_FORMAT, SIZE_FORMAT " Maximum old " SIZE_FORMAT,
_min_gen1_size, _initial_gen1_size, _max_gen1_size); _min_old_size, _initial_old_size, _max_old_size);
} }
DEBUG_ONLY(GenCollectorPolicy::assert_size_info();) DEBUG_ONLY(GenCollectorPolicy::assert_size_info();)
@ -631,11 +610,11 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,
HandleMark hm; // Discard any handles allocated in each iteration. HandleMark hm; // Discard any handles allocated in each iteration.
// First allocation attempt is lock-free. // First allocation attempt is lock-free.
Generation *gen0 = gch->get_gen(0); Generation *young = gch->get_gen(0);
assert(gen0->supports_inline_contig_alloc(), assert(young->supports_inline_contig_alloc(),
"Otherwise, must do alloc within heap lock"); "Otherwise, must do alloc within heap lock");
if (gen0->should_allocate(size, is_tlab)) { if (young->should_allocate(size, is_tlab)) {
result = gen0->par_allocate(size, is_tlab); result = young->par_allocate(size, is_tlab);
if (result != NULL) { if (result != NULL) {
assert(gch->is_in_reserved(result), "result not in heap"); assert(gch->is_in_reserved(result), "result not in heap");
return result; return result;
@ -917,8 +896,8 @@ MetaWord* CollectorPolicy::satisfy_failed_metadata_allocation(
bool GenCollectorPolicy::should_try_older_generation_allocation( bool GenCollectorPolicy::should_try_older_generation_allocation(
size_t word_size) const { size_t word_size) const {
GenCollectedHeap* gch = GenCollectedHeap::heap(); GenCollectedHeap* gch = GenCollectedHeap::heap();
size_t gen0_capacity = gch->get_gen(0)->capacity_before_gc(); size_t young_capacity = gch->get_gen(0)->capacity_before_gc();
return (word_size > heap_word_size(gen0_capacity)) return (word_size > heap_word_size(young_capacity))
|| GC_locker::is_active_and_needs_gc() || GC_locker::is_active_and_needs_gc()
|| gch->incremental_collection_failed(); || gch->incremental_collection_failed();
} }
@ -940,11 +919,11 @@ void MarkSweepPolicy::initialize_generations() {
} }
if (UseParNewGC) { if (UseParNewGC) {
_generations[0] = new GenerationSpec(Generation::ParNew, _initial_gen0_size, _max_gen0_size); _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size);
} else { } else {
_generations[0] = new GenerationSpec(Generation::DefNew, _initial_gen0_size, _max_gen0_size); _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size);
} }
_generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_gen1_size, _max_gen1_size); _generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size);
if (_generations[0] == NULL || _generations[1] == NULL) { if (_generations[0] == NULL || _generations[1] == NULL) {
vm_exit_during_initialization("Unable to allocate gen spec"); vm_exit_during_initialization("Unable to allocate gen spec");
@ -978,18 +957,18 @@ public:
flag_value = 20 * M; flag_value = 20 * M;
set_basic_flag_values(); set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, NewSize, flag_value); FLAG_SET_CMDLINE(uintx, NewSize, flag_value);
verify_gen0_min(flag_value); verify_young_min(flag_value);
set_basic_flag_values(); set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, NewSize, flag_value); FLAG_SET_CMDLINE(uintx, NewSize, flag_value);
verify_gen0_initial(flag_value); verify_young_initial(flag_value);
// If NewSize is set on command line, but is larger than the min // If NewSize is set on command line, but is larger than the min
// heap size, it should only be used for initial young size. // heap size, it should only be used for initial young size.
flag_value = 80 * M; flag_value = 80 * M;
set_basic_flag_values(); set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, NewSize, flag_value); FLAG_SET_CMDLINE(uintx, NewSize, flag_value);
verify_gen0_initial(flag_value); verify_young_initial(flag_value);
// If NewSize has been ergonomically set, the collector policy // If NewSize has been ergonomically set, the collector policy
// should use it for min but calculate the initial young size // should use it for min but calculate the initial young size
@ -997,11 +976,11 @@ public:
flag_value = 20 * M; flag_value = 20 * M;
set_basic_flag_values(); set_basic_flag_values();
FLAG_SET_ERGO(uintx, NewSize, flag_value); FLAG_SET_ERGO(uintx, NewSize, flag_value);
verify_gen0_min(flag_value); verify_young_min(flag_value);
set_basic_flag_values(); set_basic_flag_values();
FLAG_SET_ERGO(uintx, NewSize, flag_value); FLAG_SET_ERGO(uintx, NewSize, flag_value);
verify_scaled_gen0_initial(InitialHeapSize); verify_scaled_young_initial(InitialHeapSize);
restore_flags(); restore_flags();
} }
@ -1016,11 +995,11 @@ public:
flag_value = 20 * M; flag_value = 20 * M;
set_basic_flag_values(); set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value); FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
verify_gen1_min(flag_value); verify_old_min(flag_value);
set_basic_flag_values(); set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value); FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
verify_gen1_initial(flag_value); verify_old_initial(flag_value);
// If MaxNewSize is large, the maximum OldSize will be less than // If MaxNewSize is large, the maximum OldSize will be less than
// what's requested on the command line and it should be reset // what's requested on the command line and it should be reset
@ -1031,46 +1010,46 @@ public:
FLAG_SET_CMDLINE(uintx, MaxNewSize, 170*M); FLAG_SET_CMDLINE(uintx, MaxNewSize, 170*M);
// Calculate what we expect the flag to be. // Calculate what we expect the flag to be.
flag_value = MaxHeapSize - MaxNewSize; flag_value = MaxHeapSize - MaxNewSize;
verify_gen1_initial(flag_value); verify_old_initial(flag_value);
} }
static void verify_gen0_min(size_t expected) { static void verify_young_min(size_t expected) {
MarkSweepPolicy msp; MarkSweepPolicy msp;
msp.initialize_all(); msp.initialize_all();
assert(msp.min_gen0_size() <= expected, err_msg("%zu > %zu", msp.min_gen0_size(), expected)); assert(msp.min_young_size() <= expected, err_msg("%zu > %zu", msp.min_young_size(), expected));
} }
static void verify_gen0_initial(size_t expected) { static void verify_young_initial(size_t expected) {
MarkSweepPolicy msp; MarkSweepPolicy msp;
msp.initialize_all(); msp.initialize_all();
assert(msp.initial_gen0_size() == expected, err_msg("%zu != %zu", msp.initial_gen0_size(), expected)); assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected));
} }
static void verify_scaled_gen0_initial(size_t initial_heap_size) { static void verify_scaled_young_initial(size_t initial_heap_size) {
MarkSweepPolicy msp; MarkSweepPolicy msp;
msp.initialize_all(); msp.initialize_all();
size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size); size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size);
assert(msp.initial_gen0_size() == expected, err_msg("%zu != %zu", msp.initial_gen0_size(), expected)); assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected));
assert(FLAG_IS_ERGO(NewSize) && NewSize == expected, assert(FLAG_IS_ERGO(NewSize) && NewSize == expected,
err_msg("NewSize should have been set ergonomically to %zu, but was %zu", expected, NewSize)); err_msg("NewSize should have been set ergonomically to %zu, but was %zu", expected, NewSize));
} }
static void verify_gen1_min(size_t expected) { static void verify_old_min(size_t expected) {
MarkSweepPolicy msp; MarkSweepPolicy msp;
msp.initialize_all(); msp.initialize_all();
assert(msp.min_gen1_size() <= expected, err_msg("%zu > %zu", msp.min_gen1_size(), expected)); assert(msp.min_old_size() <= expected, err_msg("%zu > %zu", msp.min_old_size(), expected));
} }
static void verify_gen1_initial(size_t expected) { static void verify_old_initial(size_t expected) {
MarkSweepPolicy msp; MarkSweepPolicy msp;
msp.initialize_all(); msp.initialize_all();
assert(msp.initial_gen1_size() == expected, err_msg("%zu != %zu", msp.initial_gen1_size(), expected)); assert(msp.initial_old_size() == expected, err_msg("%zu != %zu", msp.initial_old_size(), expected));
} }

View File

@ -219,12 +219,12 @@ class ClearedAllSoftRefs : public StackObj {
class GenCollectorPolicy : public CollectorPolicy { class GenCollectorPolicy : public CollectorPolicy {
friend class TestGenCollectorPolicy; friend class TestGenCollectorPolicy;
protected: protected:
size_t _min_gen0_size; size_t _min_young_size;
size_t _initial_gen0_size; size_t _initial_young_size;
size_t _max_gen0_size; size_t _max_young_size;
size_t _min_gen1_size; size_t _min_old_size;
size_t _initial_gen1_size; size_t _initial_old_size;
size_t _max_gen1_size; size_t _max_old_size;
// _gen_alignment and _space_alignment will have the same value most of the // _gen_alignment and _space_alignment will have the same value most of the
// time. When using large pages they can differ. // time. When using large pages they can differ.
@ -260,13 +260,13 @@ friend class TestGenCollectorPolicy;
GenCollectorPolicy(); GenCollectorPolicy();
// Accessors // Accessors
size_t min_gen0_size() { return _min_gen0_size; } size_t min_young_size() { return _min_young_size; }
size_t initial_gen0_size() { return _initial_gen0_size; } size_t initial_young_size() { return _initial_young_size; }
size_t max_gen0_size() { return _max_gen0_size; } size_t max_young_size() { return _max_young_size; }
size_t gen_alignment() { return _gen_alignment; } size_t gen_alignment() { return _gen_alignment; }
size_t min_gen1_size() { return _min_gen1_size; } size_t min_old_size() { return _min_old_size; }
size_t initial_gen1_size() { return _initial_gen1_size; } size_t initial_old_size() { return _initial_old_size; }
size_t max_gen1_size() { return _max_gen1_size; } size_t max_old_size() { return _max_old_size; }
int number_of_generations() { return 2; } int number_of_generations() { return 2; }
@ -298,7 +298,7 @@ friend class TestGenCollectorPolicy;
size_t init_survivor_size); size_t init_survivor_size);
virtual void post_heap_initialize() { virtual void post_heap_initialize() {
assert(_max_gen0_size == MaxNewSize, "Should be taken care of by initialize_size_info"); assert(_max_young_size == MaxNewSize, "Should be taken care of by initialize_size_info");
} }
BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; } BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; }

View File

@ -1119,10 +1119,10 @@ void GenCollectedHeap::print_on_error(outputStream* st) const {
} }
void GenCollectedHeap::print_tracing_info() const { void GenCollectedHeap::print_tracing_info() const {
if (TraceGen0Time) { if (TraceYoungGenTime) {
get_gen(0)->print_summary_info(); get_gen(0)->print_summary_info();
} }
if (TraceGen1Time) { if (TraceOldGenTime) {
get_gen(1)->print_summary_info(); get_gen(1)->print_summary_info();
} }
} }

View File

@ -67,10 +67,9 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
// Does a "full" (forced) collection invoked on this generation collect // Does a "full" (forced) collection invoked on this generation collect
// all younger generations as well? Note that this is a // all younger generations as well? Note that this is a
// hack to allow the collection of the younger gen first if the flag is // hack to allow the collection of the younger gen first if the flag is
// set. This is better than using th policy's should_collect_gen0_first() // set.
// since that causes us to do an extra unnecessary pair of restart-&-stop-world.
virtual bool full_collects_younger_generations() const { virtual bool full_collects_younger_generations() const {
return !CollectGen0First; return !ScavengeBeforeFullGC;
} }
virtual void gc_prologue(bool full); virtual void gc_prologue(bool full);

View File

@ -407,7 +407,7 @@ Method* ConstantPoolCacheEntry::method_if_resolved(constantPoolHandle cpool) {
oop ConstantPoolCacheEntry::appendix_if_resolved(constantPoolHandle cpool) { oop ConstantPoolCacheEntry::appendix_if_resolved(constantPoolHandle cpool) {
if (is_f1_null() || !has_appendix()) if (!has_appendix())
return NULL; return NULL;
const int ref_index = f2_as_index() + _indy_resolved_references_appendix_offset; const int ref_index = f2_as_index() + _indy_resolved_references_appendix_offset;
objArrayOop resolved_references = cpool->resolved_references(); objArrayOop resolved_references = cpool->resolved_references();
@ -416,7 +416,7 @@ oop ConstantPoolCacheEntry::appendix_if_resolved(constantPoolHandle cpool) {
oop ConstantPoolCacheEntry::method_type_if_resolved(constantPoolHandle cpool) { oop ConstantPoolCacheEntry::method_type_if_resolved(constantPoolHandle cpool) {
if (is_f1_null() || !has_method_type()) if (!has_method_type())
return NULL; return NULL;
const int ref_index = f2_as_index() + _indy_resolved_references_method_type_offset; const int ref_index = f2_as_index() + _indy_resolved_references_method_type_offset;
objArrayOop resolved_references = cpool->resolved_references(); objArrayOop resolved_references = cpool->resolved_references();

View File

@ -348,8 +348,8 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; } bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; }
bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; } bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; }
bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; } bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; }
bool has_appendix() const { return (_flags & (1 << has_appendix_shift)) != 0; } bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; }
bool has_method_type() const { return (_flags & (1 << has_method_type_shift)) != 0; } bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; }
bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; } bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; }
bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; } bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; }
bool is_byte() const { return flag_state() == btos; } bool is_byte() const { return flag_state() == btos; }

View File

@ -2053,7 +2053,7 @@ public:
// Whole-method sticky bits and flags // Whole-method sticky bits and flags
enum { enum {
_trap_hist_limit = 20, // decoupled from Deoptimization::Reason_LIMIT _trap_hist_limit = 21, // decoupled from Deoptimization::Reason_LIMIT
_trap_hist_mask = max_jubyte, _trap_hist_mask = max_jubyte,
_extra_data_count = 4 // extra DataLayout headers, for trap history _extra_data_count = 4 // extra DataLayout headers, for trap history
}; // Public flag values }; // Public flag values

View File

@ -254,47 +254,46 @@ Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) {
const Type *t_sub1 = phase->type( in1->in(1) ); const Type *t_sub1 = phase->type( in1->in(1) );
const Type *t_2 = phase->type( in2 ); const Type *t_2 = phase->type( in2 );
if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP ) if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP )
return new (phase->C) SubINode(phase->makecon( add_ring( t_sub1, t_2 ) ), return new SubINode(phase->makecon( add_ring( t_sub1, t_2 ) ), in1->in(2) );
in1->in(2) );
// Convert "(a-b)+(c-d)" into "(a+c)-(b+d)" // Convert "(a-b)+(c-d)" into "(a+c)-(b+d)"
if( op2 == Op_SubI ) { if( op2 == Op_SubI ) {
// Check for dead cycle: d = (a-b)+(c-d) // Check for dead cycle: d = (a-b)+(c-d)
assert( in1->in(2) != this && in2->in(2) != this, assert( in1->in(2) != this && in2->in(2) != this,
"dead loop in AddINode::Ideal" ); "dead loop in AddINode::Ideal" );
Node *sub = new (phase->C) SubINode(NULL, NULL); Node *sub = new SubINode(NULL, NULL);
sub->init_req(1, phase->transform(new (phase->C) AddINode(in1->in(1), in2->in(1) ) )); sub->init_req(1, phase->transform(new AddINode(in1->in(1), in2->in(1) ) ));
sub->init_req(2, phase->transform(new (phase->C) AddINode(in1->in(2), in2->in(2) ) )); sub->init_req(2, phase->transform(new AddINode(in1->in(2), in2->in(2) ) ));
return sub; return sub;
} }
// Convert "(a-b)+(b+c)" into "(a+c)" // Convert "(a-b)+(b+c)" into "(a+c)"
if( op2 == Op_AddI && in1->in(2) == in2->in(1) ) { if( op2 == Op_AddI && in1->in(2) == in2->in(1) ) {
assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal"); assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal");
return new (phase->C) AddINode(in1->in(1), in2->in(2)); return new AddINode(in1->in(1), in2->in(2));
} }
// Convert "(a-b)+(c+b)" into "(a+c)" // Convert "(a-b)+(c+b)" into "(a+c)"
if( op2 == Op_AddI && in1->in(2) == in2->in(2) ) { if( op2 == Op_AddI && in1->in(2) == in2->in(2) ) {
assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddINode::Ideal"); assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddINode::Ideal");
return new (phase->C) AddINode(in1->in(1), in2->in(1)); return new AddINode(in1->in(1), in2->in(1));
} }
// Convert "(a-b)+(b-c)" into "(a-c)" // Convert "(a-b)+(b-c)" into "(a-c)"
if( op2 == Op_SubI && in1->in(2) == in2->in(1) ) { if( op2 == Op_SubI && in1->in(2) == in2->in(1) ) {
assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal"); assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal");
return new (phase->C) SubINode(in1->in(1), in2->in(2)); return new SubINode(in1->in(1), in2->in(2));
} }
// Convert "(a-b)+(c-a)" into "(c-b)" // Convert "(a-b)+(c-a)" into "(c-b)"
if( op2 == Op_SubI && in1->in(1) == in2->in(2) ) { if( op2 == Op_SubI && in1->in(1) == in2->in(2) ) {
assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddINode::Ideal"); assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddINode::Ideal");
return new (phase->C) SubINode(in2->in(1), in1->in(2)); return new SubINode(in2->in(1), in1->in(2));
} }
} }
// Convert "x+(0-y)" into "(x-y)" // Convert "x+(0-y)" into "(x-y)"
if( op2 == Op_SubI && phase->type(in2->in(1)) == TypeInt::ZERO ) if( op2 == Op_SubI && phase->type(in2->in(1)) == TypeInt::ZERO )
return new (phase->C) SubINode(in1, in2->in(2) ); return new SubINode(in1, in2->in(2) );
// Convert "(0-y)+x" into "(x-y)" // Convert "(0-y)+x" into "(x-y)"
if( op1 == Op_SubI && phase->type(in1->in(1)) == TypeInt::ZERO ) if( op1 == Op_SubI && phase->type(in1->in(1)) == TypeInt::ZERO )
return new (phase->C) SubINode( in2, in1->in(2) ); return new SubINode( in2, in1->in(2) );
// Convert (x>>>z)+y into (x+(y<<z))>>>z for small constant z and y. // Convert (x>>>z)+y into (x+(y<<z))>>>z for small constant z and y.
// Helps with array allocation math constant folding // Helps with array allocation math constant folding
@ -315,8 +314,8 @@ Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) {
if( z < 5 && -5 < y && y < 0 ) { if( z < 5 && -5 < y && y < 0 ) {
const Type *t_in11 = phase->type(in1->in(1)); const Type *t_in11 = phase->type(in1->in(1));
if( t_in11 != Type::TOP && (t_in11->is_int()->_lo >= -(y << z)) ) { if( t_in11 != Type::TOP && (t_in11->is_int()->_lo >= -(y << z)) ) {
Node *a = phase->transform( new (phase->C) AddINode( in1->in(1), phase->intcon(y<<z) ) ); Node *a = phase->transform( new AddINode( in1->in(1), phase->intcon(y<<z) ) );
return new (phase->C) URShiftINode( a, in1->in(2) ); return new URShiftINode( a, in1->in(2) );
} }
} }
} }
@ -387,47 +386,46 @@ Node *AddLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
const Type *t_sub1 = phase->type( in1->in(1) ); const Type *t_sub1 = phase->type( in1->in(1) );
const Type *t_2 = phase->type( in2 ); const Type *t_2 = phase->type( in2 );
if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP ) if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP )
return new (phase->C) SubLNode(phase->makecon( add_ring( t_sub1, t_2 ) ), return new SubLNode(phase->makecon( add_ring( t_sub1, t_2 ) ), in1->in(2) );
in1->in(2) );
// Convert "(a-b)+(c-d)" into "(a+c)-(b+d)" // Convert "(a-b)+(c-d)" into "(a+c)-(b+d)"
if( op2 == Op_SubL ) { if( op2 == Op_SubL ) {
// Check for dead cycle: d = (a-b)+(c-d) // Check for dead cycle: d = (a-b)+(c-d)
assert( in1->in(2) != this && in2->in(2) != this, assert( in1->in(2) != this && in2->in(2) != this,
"dead loop in AddLNode::Ideal" ); "dead loop in AddLNode::Ideal" );
Node *sub = new (phase->C) SubLNode(NULL, NULL); Node *sub = new SubLNode(NULL, NULL);
sub->init_req(1, phase->transform(new (phase->C) AddLNode(in1->in(1), in2->in(1) ) )); sub->init_req(1, phase->transform(new AddLNode(in1->in(1), in2->in(1) ) ));
sub->init_req(2, phase->transform(new (phase->C) AddLNode(in1->in(2), in2->in(2) ) )); sub->init_req(2, phase->transform(new AddLNode(in1->in(2), in2->in(2) ) ));
return sub; return sub;
} }
// Convert "(a-b)+(b+c)" into "(a+c)" // Convert "(a-b)+(b+c)" into "(a+c)"
if( op2 == Op_AddL && in1->in(2) == in2->in(1) ) { if( op2 == Op_AddL && in1->in(2) == in2->in(1) ) {
assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal"); assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal");
return new (phase->C) AddLNode(in1->in(1), in2->in(2)); return new AddLNode(in1->in(1), in2->in(2));
} }
// Convert "(a-b)+(c+b)" into "(a+c)" // Convert "(a-b)+(c+b)" into "(a+c)"
if( op2 == Op_AddL && in1->in(2) == in2->in(2) ) { if( op2 == Op_AddL && in1->in(2) == in2->in(2) ) {
assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal"); assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal");
return new (phase->C) AddLNode(in1->in(1), in2->in(1)); return new AddLNode(in1->in(1), in2->in(1));
} }
// Convert "(a-b)+(b-c)" into "(a-c)" // Convert "(a-b)+(b-c)" into "(a-c)"
if( op2 == Op_SubL && in1->in(2) == in2->in(1) ) { if( op2 == Op_SubL && in1->in(2) == in2->in(1) ) {
assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal"); assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal");
return new (phase->C) SubLNode(in1->in(1), in2->in(2)); return new SubLNode(in1->in(1), in2->in(2));
} }
// Convert "(a-b)+(c-a)" into "(c-b)" // Convert "(a-b)+(c-a)" into "(c-b)"
if( op2 == Op_SubL && in1->in(1) == in1->in(2) ) { if( op2 == Op_SubL && in1->in(1) == in1->in(2) ) {
assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal"); assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal");
return new (phase->C) SubLNode(in2->in(1), in1->in(2)); return new SubLNode(in2->in(1), in1->in(2));
} }
} }
// Convert "x+(0-y)" into "(x-y)" // Convert "x+(0-y)" into "(x-y)"
if( op2 == Op_SubL && phase->type(in2->in(1)) == TypeLong::ZERO ) if( op2 == Op_SubL && phase->type(in2->in(1)) == TypeLong::ZERO )
return new (phase->C) SubLNode( in1, in2->in(2) ); return new SubLNode( in1, in2->in(2) );
// Convert "(0-y)+x" into "(x-y)" // Convert "(0-y)+x" into "(x-y)"
if( op1 == Op_SubL && phase->type(in1->in(1)) == TypeInt::ZERO ) if( op1 == Op_SubL && phase->type(in1->in(1)) == TypeInt::ZERO )
return new (phase->C) SubLNode( in2, in1->in(2) ); return new SubLNode( in2, in1->in(2) );
// Convert "X+X+X+X+X...+X+Y" into "k*X+Y" or really convert "X+(X+Y)" // Convert "X+X+X+X+X...+X+Y" into "k*X+Y" or really convert "X+(X+Y)"
// into "(X<<1)+Y" and let shift-folding happen. // into "(X<<1)+Y" and let shift-folding happen.
@ -435,8 +433,8 @@ Node *AddLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
in2->in(1) == in1 && in2->in(1) == in1 &&
op1 != Op_ConL && op1 != Op_ConL &&
0 ) { 0 ) {
Node *shift = phase->transform(new (phase->C) LShiftLNode(in1,phase->intcon(1))); Node *shift = phase->transform(new LShiftLNode(in1,phase->intcon(1)));
return new (phase->C) AddLNode(shift,in2->in(2)); return new AddLNode(shift,in2->in(2));
} }
return AddNode::Ideal(phase, can_reshape); return AddNode::Ideal(phase, can_reshape);
@ -596,7 +594,7 @@ Node *AddPNode::Ideal(PhaseGVN *phase, bool can_reshape) {
offset = phase->MakeConX(t2->get_con() + t12->get_con()); offset = phase->MakeConX(t2->get_con() + t12->get_con());
} else { } else {
// Else move the constant to the right. ((A+con)+B) into ((A+B)+con) // Else move the constant to the right. ((A+con)+B) into ((A+B)+con)
address = phase->transform(new (phase->C) AddPNode(in(Base),addp->in(Address),in(Offset))); address = phase->transform(new AddPNode(in(Base),addp->in(Address),in(Offset)));
offset = addp->in(Offset); offset = addp->in(Offset);
} }
PhaseIterGVN *igvn = phase->is_IterGVN(); PhaseIterGVN *igvn = phase->is_IterGVN();
@ -616,7 +614,7 @@ Node *AddPNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// If this is a NULL+long form (from unsafe accesses), switch to a rawptr. // If this is a NULL+long form (from unsafe accesses), switch to a rawptr.
if (phase->type(in(Address)) == TypePtr::NULL_PTR) { if (phase->type(in(Address)) == TypePtr::NULL_PTR) {
Node* offset = in(Offset); Node* offset = in(Offset);
return new (phase->C) CastX2PNode(offset); return new CastX2PNode(offset);
} }
} }
@ -628,7 +626,7 @@ Node *AddPNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if( add->Opcode() == Op_AddX && add->in(1) != add ) { if( add->Opcode() == Op_AddX && add->in(1) != add ) {
const Type *t22 = phase->type( add->in(2) ); const Type *t22 = phase->type( add->in(2) );
if( t22->singleton() && (t22 != Type::TOP) ) { // Right input is an add of a constant? if( t22->singleton() && (t22 != Type::TOP) ) { // Right input is an add of a constant?
set_req(Address, phase->transform(new (phase->C) AddPNode(in(Base),in(Address),add->in(1)))); set_req(Address, phase->transform(new AddPNode(in(Base),in(Address),add->in(1))));
set_req(Offset, add->in(2)); set_req(Offset, add->in(2));
PhaseIterGVN *igvn = phase->is_IterGVN(); PhaseIterGVN *igvn = phase->is_IterGVN();
if (add->outcnt() == 0 && igvn) { if (add->outcnt() == 0 && igvn) {
@ -858,7 +856,7 @@ Node *MinINode::Ideal(PhaseGVN *phase, bool can_reshape) {
// to force a right-spline graph for the rest of MinINode::Ideal(). // to force a right-spline graph for the rest of MinINode::Ideal().
if( l->Opcode() == Op_MinI ) { if( l->Opcode() == Op_MinI ) {
assert( l != l->in(1), "dead loop in MinINode::Ideal" ); assert( l != l->in(1), "dead loop in MinINode::Ideal" );
r = phase->transform(new (phase->C) MinINode(l->in(2),r)); r = phase->transform(new MinINode(l->in(2),r));
l = l->in(1); l = l->in(1);
set_req(1, l); set_req(1, l);
set_req(2, r); set_req(2, r);
@ -906,18 +904,18 @@ Node *MinINode::Ideal(PhaseGVN *phase, bool can_reshape) {
} }
if( x->_idx > y->_idx ) if( x->_idx > y->_idx )
return new (phase->C) MinINode(r->in(1),phase->transform(new (phase->C) MinINode(l,r->in(2)))); return new MinINode(r->in(1),phase->transform(new MinINode(l,r->in(2))));
// See if covers: MIN2(x+c0,MIN2(y+c1,z)) // See if covers: MIN2(x+c0,MIN2(y+c1,z))
if( !phase->eqv(x,y) ) return NULL; if( !phase->eqv(x,y) ) return NULL;
// If (y == x) transform MIN2(x+c0, MIN2(x+c1,z)) into // If (y == x) transform MIN2(x+c0, MIN2(x+c1,z)) into
// MIN2(x+c0 or x+c1 which less, z). // MIN2(x+c0 or x+c1 which less, z).
return new (phase->C) MinINode(phase->transform(new (phase->C) AddINode(x,phase->intcon(MIN2(x_off,y_off)))),r->in(2)); return new MinINode(phase->transform(new AddINode(x,phase->intcon(MIN2(x_off,y_off)))),r->in(2));
} else { } else {
// See if covers: MIN2(x+c0,y+c1) // See if covers: MIN2(x+c0,y+c1)
if( !phase->eqv(x,y) ) return NULL; if( !phase->eqv(x,y) ) return NULL;
// If (y == x) transform MIN2(x+c0,x+c1) into x+c0 or x+c1 which less. // If (y == x) transform MIN2(x+c0,x+c1) into x+c0 or x+c1 which less.
return new (phase->C) AddINode(x,phase->intcon(MIN2(x_off,y_off))); return new AddINode(x,phase->intcon(MIN2(x_off,y_off)));
} }
} }

View File

@ -373,7 +373,7 @@ PhaseCFG::PhaseCFG(Arena* arena, RootNode* root, Matcher& matcher)
// I'll need a few machine-specific GotoNodes. Make an Ideal GotoNode, // I'll need a few machine-specific GotoNodes. Make an Ideal GotoNode,
// then Match it into a machine-specific Node. Then clone the machine // then Match it into a machine-specific Node. Then clone the machine
// Node on demand. // Node on demand.
Node *x = new (C) GotoNode(NULL); Node *x = new GotoNode(NULL);
x->init_req(0, x); x->init_req(0, x);
_goto = matcher.match_tree(x); _goto = matcher.match_tree(x);
assert(_goto != NULL, ""); assert(_goto != NULL, "");
@ -426,7 +426,7 @@ uint PhaseCFG::build_cfg() {
!p->is_block_start() ); !p->is_block_start() );
// Make the block begin with one of Region or StartNode. // Make the block begin with one of Region or StartNode.
if( !p->is_block_start() ) { if( !p->is_block_start() ) {
RegionNode *r = new (C) RegionNode( 2 ); RegionNode *r = new RegionNode( 2 );
r->init_req(1, p); // Insert RegionNode in the way r->init_req(1, p); // Insert RegionNode in the way
proj->set_req(0, r); // Insert RegionNode in the way proj->set_req(0, r); // Insert RegionNode in the way
p = r; p = r;
@ -501,7 +501,7 @@ void PhaseCFG::insert_goto_at(uint block_no, uint succ_no) {
// get ProjNode corresponding to the succ_no'th successor of the in block // get ProjNode corresponding to the succ_no'th successor of the in block
ProjNode* proj = in->get_node(in->number_of_nodes() - in->_num_succs + succ_no)->as_Proj(); ProjNode* proj = in->get_node(in->number_of_nodes() - in->_num_succs + succ_no)->as_Proj();
// create region for basic block // create region for basic block
RegionNode* region = new (C) RegionNode(2); RegionNode* region = new RegionNode(2);
region->init_req(1, proj); region->init_req(1, proj);
// setup corresponding basic block // setup corresponding basic block
Block* block = new (_block_arena) Block(_block_arena, region); Block* block = new (_block_arena) Block(_block_arena, region);

View File

@ -361,11 +361,14 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
set_msg("not an accessor"); set_msg("not an accessor");
return false; return false;
} }
if (inline_level() > _max_inline_level) {
if (callee_method->force_inline() && inline_level() > MaxForceInlineLevel) { // Limit inlining depth in case inlining is forced or
// _max_inline_level was increased to compensate for lambda forms.
if (inline_level() > MaxForceInlineLevel) {
set_msg("MaxForceInlineLevel"); set_msg("MaxForceInlineLevel");
return false; return false;
} }
if (inline_level() > _max_inline_level) {
if (!callee_method->force_inline() || !IncrementalInline) { if (!callee_method->force_inline() || !IncrementalInline) {
set_msg("inlining too deep"); set_msg("inlining too deep");
return false; return false;

View File

@ -650,9 +650,6 @@
product(bool, UseMathExactIntrinsics, true, \ product(bool, UseMathExactIntrinsics, true, \
"Enables intrinsification of various java.lang.Math functions") \ "Enables intrinsification of various java.lang.Math functions") \
\ \
experimental(bool, ReplaceInParentMaps, false, \
"Propagate type improvements in callers of inlinee if possible") \
\
product(bool, UseTypeSpeculation, true, \ product(bool, UseTypeSpeculation, true, \
"Speculatively propagate types from profiles") \ "Speculatively propagate types from profiles") \
\ \

View File

@ -63,12 +63,12 @@ public:
} }
virtual bool is_parse() const { return true; } virtual bool is_parse() const { return true; }
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); virtual JVMState* generate(JVMState* jvms);
int is_osr() { return _is_osr; } int is_osr() { return _is_osr; }
}; };
JVMState* ParseGenerator::generate(JVMState* jvms, Parse* parent_parser) { JVMState* ParseGenerator::generate(JVMState* jvms) {
Compile* C = Compile::current(); Compile* C = Compile::current();
C->print_inlining_update(this); C->print_inlining_update(this);
@ -81,7 +81,7 @@ JVMState* ParseGenerator::generate(JVMState* jvms, Parse* parent_parser) {
return NULL; // bailing out of the compile; do not try to parse return NULL; // bailing out of the compile; do not try to parse
} }
Parse parser(jvms, method(), _expected_uses, parent_parser); Parse parser(jvms, method(), _expected_uses);
// Grab signature for matching/allocation // Grab signature for matching/allocation
#ifdef ASSERT #ifdef ASSERT
if (parser.tf() != (parser.depth() == 1 ? C->tf() : tf())) { if (parser.tf() != (parser.depth() == 1 ? C->tf() : tf())) {
@ -120,12 +120,12 @@ class DirectCallGenerator : public CallGenerator {
_separate_io_proj(separate_io_proj) _separate_io_proj(separate_io_proj)
{ {
} }
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); virtual JVMState* generate(JVMState* jvms);
CallStaticJavaNode* call_node() const { return _call_node; } CallStaticJavaNode* call_node() const { return _call_node; }
}; };
JVMState* DirectCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { JVMState* DirectCallGenerator::generate(JVMState* jvms) {
GraphKit kit(jvms); GraphKit kit(jvms);
kit.C->print_inlining_update(this); kit.C->print_inlining_update(this);
bool is_static = method()->is_static(); bool is_static = method()->is_static();
@ -136,7 +136,7 @@ JVMState* DirectCallGenerator::generate(JVMState* jvms, Parse* parent_parser) {
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(kit.C, tf(), target, method(), kit.bci()); CallStaticJavaNode *call = new 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.
@ -173,10 +173,10 @@ public:
vtable_index >= 0, "either invalid or usable"); vtable_index >= 0, "either invalid or usable");
} }
virtual bool is_virtual() const { return true; } virtual bool is_virtual() const { return true; }
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); virtual JVMState* generate(JVMState* jvms);
}; };
JVMState* VirtualCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { JVMState* VirtualCallGenerator::generate(JVMState* jvms) {
GraphKit kit(jvms); GraphKit kit(jvms);
Node* receiver = kit.argument(0); Node* receiver = kit.argument(0);
@ -225,7 +225,7 @@ JVMState* VirtualCallGenerator::generate(JVMState* jvms, Parse* parent_parser) {
"no vtable calls if +UseInlineCaches "); "no vtable calls if +UseInlineCaches ");
address target = SharedRuntime::get_resolve_virtual_call_stub(); address target = SharedRuntime::get_resolve_virtual_call_stub();
// Normal inline cache used for call // Normal inline cache used for call
CallDynamicJavaNode *call = new (kit.C) CallDynamicJavaNode(tf(), target, method(), _vtable_index, kit.bci()); CallDynamicJavaNode *call = new CallDynamicJavaNode(tf(), target, method(), _vtable_index, kit.bci());
kit.set_arguments_for_java_call(call); kit.set_arguments_for_java_call(call);
kit.set_edges_for_java_call(call); kit.set_edges_for_java_call(call);
Node* ret = kit.set_results_for_java_call(call); Node* ret = kit.set_results_for_java_call(call);
@ -283,7 +283,7 @@ class LateInlineCallGenerator : public DirectCallGenerator {
// Convert the CallStaticJava into an inline // Convert the CallStaticJava into an inline
virtual void do_late_inline(); virtual void do_late_inline();
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) { virtual JVMState* generate(JVMState* jvms) {
Compile *C = Compile::current(); Compile *C = Compile::current();
C->log_inline_id(this); C->log_inline_id(this);
@ -298,7 +298,7 @@ class LateInlineCallGenerator : public DirectCallGenerator {
// that the late inlining logic can distinguish between fall // that the late inlining logic can distinguish between fall
// through and exceptional uses of the memory and io projections // through and exceptional uses of the memory and io projections
// as is done for allocations and macro expansion. // as is done for allocations and macro expansion.
return DirectCallGenerator::generate(jvms, parent_parser); return DirectCallGenerator::generate(jvms);
} }
virtual void print_inlining_late(const char* msg) { virtual void print_inlining_late(const char* msg) {
@ -350,7 +350,7 @@ void LateInlineCallGenerator::do_late_inline() {
JVMState* old_jvms = call->jvms(); JVMState* old_jvms = call->jvms();
JVMState* jvms = old_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 SafePointNode(size, jvms);
for (uint i1 = 0; i1 < size; i1++) { for (uint i1 = 0; i1 < size; i1++) {
map->init_req(i1, call->in(i1)); map->init_req(i1, call->in(i1));
} }
@ -399,7 +399,7 @@ void LateInlineCallGenerator::do_late_inline() {
} }
// Now perform the inlining using the synthesized JVMState // Now perform the inlining using the synthesized JVMState
JVMState* new_jvms = _inline_cg->generate(jvms, NULL); JVMState* new_jvms = _inline_cg->generate(jvms);
if (new_jvms == NULL) return; // no change if (new_jvms == NULL) return; // no change
if (C->failing()) return; if (C->failing()) return;
@ -417,7 +417,7 @@ void LateInlineCallGenerator::do_late_inline() {
C->env()->notice_inlined_method(_inline_cg->method()); C->env()->notice_inlined_method(_inline_cg->method());
C->set_inlining_progress(true); C->set_inlining_progress(true);
kit.replace_call(call, result); kit.replace_call(call, result, true);
} }
@ -439,8 +439,8 @@ class LateInlineMHCallGenerator : public LateInlineCallGenerator {
virtual bool is_mh_late_inline() const { return true; } virtual bool is_mh_late_inline() const { return true; }
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) { virtual JVMState* generate(JVMState* jvms) {
JVMState* new_jvms = LateInlineCallGenerator::generate(jvms, parent_parser); JVMState* new_jvms = LateInlineCallGenerator::generate(jvms);
Compile* C = Compile::current(); Compile* C = Compile::current();
if (_input_not_const) { if (_input_not_const) {
@ -486,14 +486,14 @@ class LateInlineStringCallGenerator : public LateInlineCallGenerator {
LateInlineStringCallGenerator(ciMethod* method, CallGenerator* inline_cg) : LateInlineStringCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
LateInlineCallGenerator(method, inline_cg) {} LateInlineCallGenerator(method, inline_cg) {}
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) { virtual JVMState* generate(JVMState* jvms) {
Compile *C = Compile::current(); Compile *C = Compile::current();
C->log_inline_id(this); C->log_inline_id(this);
C->add_string_late_inline(this); C->add_string_late_inline(this);
JVMState* new_jvms = DirectCallGenerator::generate(jvms, parent_parser); JVMState* new_jvms = DirectCallGenerator::generate(jvms);
return new_jvms; return new_jvms;
} }
@ -510,14 +510,14 @@ class LateInlineBoxingCallGenerator : public LateInlineCallGenerator {
LateInlineBoxingCallGenerator(ciMethod* method, CallGenerator* inline_cg) : LateInlineBoxingCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
LateInlineCallGenerator(method, inline_cg) {} LateInlineCallGenerator(method, inline_cg) {}
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) { virtual JVMState* generate(JVMState* jvms) {
Compile *C = Compile::current(); Compile *C = Compile::current();
C->log_inline_id(this); C->log_inline_id(this);
C->add_boxing_late_inline(this); C->add_boxing_late_inline(this);
JVMState* new_jvms = DirectCallGenerator::generate(jvms, parent_parser); JVMState* new_jvms = DirectCallGenerator::generate(jvms);
return new_jvms; return new_jvms;
} }
}; };
@ -553,7 +553,7 @@ public:
virtual bool is_virtual() const { return _is_virtual; } virtual bool is_virtual() const { return _is_virtual; }
virtual bool is_deferred() const { return true; } virtual bool is_deferred() const { return true; }
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); virtual JVMState* generate(JVMState* jvms);
}; };
@ -563,14 +563,14 @@ CallGenerator* CallGenerator::for_warm_call(WarmCallInfo* ci,
return new WarmCallGenerator(ci, if_cold, if_hot); return new WarmCallGenerator(ci, if_cold, if_hot);
} }
JVMState* WarmCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { JVMState* WarmCallGenerator::generate(JVMState* jvms) {
Compile* C = Compile::current(); Compile* C = Compile::current();
C->print_inlining_update(this); C->print_inlining_update(this);
if (C->log() != NULL) { if (C->log() != NULL) {
C->log()->elem("warm_call bci='%d'", jvms->bci()); C->log()->elem("warm_call bci='%d'", jvms->bci());
} }
jvms = _if_cold->generate(jvms, parent_parser); jvms = _if_cold->generate(jvms);
if (jvms != NULL) { if (jvms != NULL) {
Node* m = jvms->map()->control(); Node* m = jvms->map()->control();
if (m->is_CatchProj()) m = m->in(0); else m = C->top(); if (m->is_CatchProj()) m = m->in(0); else m = C->top();
@ -631,7 +631,7 @@ public:
virtual bool is_inline() const { return _if_hit->is_inline(); } virtual bool is_inline() const { return _if_hit->is_inline(); }
virtual bool is_deferred() const { return _if_hit->is_deferred(); } virtual bool is_deferred() const { return _if_hit->is_deferred(); }
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); virtual JVMState* generate(JVMState* jvms);
}; };
@ -643,14 +643,13 @@ CallGenerator* CallGenerator::for_predicted_call(ciKlass* predicted_receiver,
} }
JVMState* PredictedCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { JVMState* PredictedCallGenerator::generate(JVMState* jvms) {
GraphKit kit(jvms); GraphKit kit(jvms);
kit.C->print_inlining_update(this); kit.C->print_inlining_update(this);
PhaseGVN& gvn = kit.gvn(); PhaseGVN& gvn = kit.gvn();
// We need an explicit receiver null_check before checking its type. // We need an explicit receiver null_check before checking its type.
// We share a map with the caller, so his JVMS gets adjusted. // We share a map with the caller, so his JVMS gets adjusted.
Node* receiver = kit.argument(0); Node* receiver = kit.argument(0);
CompileLog* log = kit.C->log(); CompileLog* log = kit.C->log();
if (log != NULL) { if (log != NULL) {
log->elem("predicted_call bci='%d' klass='%d'", log->elem("predicted_call bci='%d' klass='%d'",
@ -662,6 +661,10 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms, Parse* parent_parser)
return kit.transfer_exceptions_into_jvms(); return kit.transfer_exceptions_into_jvms();
} }
// Make a copy of the replaced nodes in case we need to restore them
ReplacedNodes replaced_nodes = kit.map()->replaced_nodes();
replaced_nodes.clone();
Node* exact_receiver = receiver; // will get updated in place... Node* exact_receiver = receiver; // will get updated in place...
Node* slow_ctl = kit.type_check_receiver(receiver, Node* slow_ctl = kit.type_check_receiver(receiver,
_predicted_receiver, _hit_prob, _predicted_receiver, _hit_prob,
@ -672,7 +675,7 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms, Parse* parent_parser)
{ PreserveJVMState pjvms(&kit); { PreserveJVMState pjvms(&kit);
kit.set_control(slow_ctl); kit.set_control(slow_ctl);
if (!kit.stopped()) { if (!kit.stopped()) {
slow_jvms = _if_missed->generate(kit.sync_jvms(), parent_parser); slow_jvms = _if_missed->generate(kit.sync_jvms());
if (kit.failing()) if (kit.failing())
return NULL; // might happen because of NodeCountInliningCutoff return NULL; // might happen because of NodeCountInliningCutoff
assert(slow_jvms != NULL, "must be"); assert(slow_jvms != NULL, "must be");
@ -693,12 +696,12 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms, Parse* parent_parser)
kit.replace_in_map(receiver, exact_receiver); kit.replace_in_map(receiver, exact_receiver);
// Make the hot call: // Make the hot call:
JVMState* new_jvms = _if_hit->generate(kit.sync_jvms(), parent_parser); JVMState* new_jvms = _if_hit->generate(kit.sync_jvms());
if (new_jvms == NULL) { if (new_jvms == NULL) {
// Inline failed, so make a direct call. // Inline failed, so make a direct call.
assert(_if_hit->is_inline(), "must have been a failed inline"); assert(_if_hit->is_inline(), "must have been a failed inline");
CallGenerator* cg = CallGenerator::for_direct_call(_if_hit->method()); CallGenerator* cg = CallGenerator::for_direct_call(_if_hit->method());
new_jvms = cg->generate(kit.sync_jvms(), parent_parser); new_jvms = cg->generate(kit.sync_jvms());
} }
kit.add_exception_states_from(new_jvms); kit.add_exception_states_from(new_jvms);
kit.set_jvms(new_jvms); kit.set_jvms(new_jvms);
@ -715,16 +718,29 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms, Parse* parent_parser)
return kit.transfer_exceptions_into_jvms(); return kit.transfer_exceptions_into_jvms();
} }
// There are 2 branches and the replaced nodes are only valid on
// one: restore the replaced nodes to what they were before the
// branch.
kit.map()->set_replaced_nodes(replaced_nodes);
// Finish the diamond. // Finish the diamond.
kit.C->set_has_split_ifs(true); // Has chance for split-if optimization kit.C->set_has_split_ifs(true); // Has chance for split-if optimization
RegionNode* region = new (kit.C) RegionNode(3); RegionNode* region = new RegionNode(3);
region->init_req(1, kit.control()); region->init_req(1, kit.control());
region->init_req(2, slow_map->control()); region->init_req(2, slow_map->control());
kit.set_control(gvn.transform(region)); kit.set_control(gvn.transform(region));
Node* iophi = PhiNode::make(region, kit.i_o(), Type::ABIO); Node* iophi = PhiNode::make(region, kit.i_o(), Type::ABIO);
iophi->set_req(2, slow_map->i_o()); iophi->set_req(2, slow_map->i_o());
kit.set_i_o(gvn.transform(iophi)); kit.set_i_o(gvn.transform(iophi));
// Merge memory
kit.merge_memory(slow_map->merged_memory(), region, 2); kit.merge_memory(slow_map->merged_memory(), region, 2);
// Transform new memory Phis.
for (MergeMemStream mms(kit.merged_memory()); mms.next_non_empty();) {
Node* phi = mms.memory();
if (phi->is_Phi() && phi->in(0) == region) {
mms.set_memory(gvn.transform(phi));
}
}
uint tos = kit.jvms()->stkoff() + kit.sp(); uint tos = kit.jvms()->stkoff() + kit.sp();
uint limit = slow_map->req(); uint limit = slow_map->req();
for (uint i = TypeFunc::Parms; i < limit; i++) { for (uint i = TypeFunc::Parms; i < limit; i++) {
@ -825,7 +841,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr(); const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr();
const Type* sig_type = TypeOopPtr::make_from_klass(signature->accessing_klass()); const Type* sig_type = TypeOopPtr::make_from_klass(signature->accessing_klass());
if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
Node* cast_obj = gvn.transform(new (C) CheckCastPPNode(kit.control(), arg, sig_type)); Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
kit.set_argument(0, cast_obj); kit.set_argument(0, cast_obj);
} }
} }
@ -837,7 +853,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr(); const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr();
const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass()); const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass());
if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
Node* cast_obj = gvn.transform(new (C) CheckCastPPNode(kit.control(), arg, sig_type)); Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
kit.set_argument(receiver_skip + i, cast_obj); kit.set_argument(receiver_skip + i, cast_obj);
} }
} }
@ -882,14 +898,14 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
} }
//------------------------PredictedIntrinsicGenerator------------------------------ //------------------------PredicatedIntrinsicGenerator------------------------------
// Internal class which handles all predicted Intrinsic calls. // Internal class which handles all predicated Intrinsic calls.
class PredictedIntrinsicGenerator : public CallGenerator { class PredicatedIntrinsicGenerator : public CallGenerator {
CallGenerator* _intrinsic; CallGenerator* _intrinsic;
CallGenerator* _cg; CallGenerator* _cg;
public: public:
PredictedIntrinsicGenerator(CallGenerator* intrinsic, PredicatedIntrinsicGenerator(CallGenerator* intrinsic,
CallGenerator* cg) CallGenerator* cg)
: CallGenerator(cg->method()) : CallGenerator(cg->method())
{ {
@ -901,108 +917,186 @@ public:
virtual bool is_inlined() const { return true; } virtual bool is_inlined() const { return true; }
virtual bool is_intrinsic() const { return true; } virtual bool is_intrinsic() const { return true; }
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); virtual JVMState* generate(JVMState* jvms);
}; };
CallGenerator* CallGenerator::for_predicted_intrinsic(CallGenerator* intrinsic, CallGenerator* CallGenerator::for_predicated_intrinsic(CallGenerator* intrinsic,
CallGenerator* cg) { CallGenerator* cg) {
return new PredictedIntrinsicGenerator(intrinsic, cg); return new PredicatedIntrinsicGenerator(intrinsic, cg);
} }
JVMState* PredictedIntrinsicGenerator::generate(JVMState* jvms, Parse* parent_parser) { JVMState* PredicatedIntrinsicGenerator::generate(JVMState* jvms) {
// The code we want to generate here is:
// if (receiver == NULL)
// uncommon_Trap
// if (predicate(0))
// do_intrinsic(0)
// else
// if (predicate(1))
// do_intrinsic(1)
// ...
// else
// do_java_comp
GraphKit kit(jvms); GraphKit kit(jvms);
PhaseGVN& gvn = kit.gvn(); PhaseGVN& gvn = kit.gvn();
CompileLog* log = kit.C->log(); CompileLog* log = kit.C->log();
if (log != NULL) { if (log != NULL) {
log->elem("predicted_intrinsic bci='%d' method='%d'", log->elem("predicated_intrinsic bci='%d' method='%d'",
jvms->bci(), log->identify(method())); jvms->bci(), log->identify(method()));
} }
Node* slow_ctl = _intrinsic->generate_predicate(kit.sync_jvms()); if (!method()->is_static()) {
if (kit.failing()) // We need an explicit receiver null_check before checking its type in predicate.
return NULL; // might happen because of NodeCountInliningCutoff // We share a map with the caller, so his JVMS gets adjusted.
Node* receiver = kit.null_check_receiver_before_call(method());
kit.C->print_inlining_update(this);
SafePointNode* slow_map = NULL;
JVMState* slow_jvms;
if (slow_ctl != NULL) {
PreserveJVMState pjvms(&kit);
kit.set_control(slow_ctl);
if (!kit.stopped()) {
slow_jvms = _cg->generate(kit.sync_jvms(), parent_parser);
if (kit.failing())
return NULL; // might happen because of NodeCountInliningCutoff
assert(slow_jvms != NULL, "must be");
kit.add_exception_states_from(slow_jvms);
kit.set_map(slow_jvms->map());
if (!kit.stopped())
slow_map = kit.stop();
}
}
if (kit.stopped()) { if (kit.stopped()) {
// Predicate is always false.
kit.set_jvms(slow_jvms);
return kit.transfer_exceptions_into_jvms(); return kit.transfer_exceptions_into_jvms();
} }
}
int n_predicates = _intrinsic->predicates_count();
assert(n_predicates > 0, "sanity");
JVMState** result_jvms = NEW_RESOURCE_ARRAY(JVMState*, (n_predicates+1));
// Region for normal compilation code if intrinsic failed.
Node* slow_region = new RegionNode(1);
int results = 0;
for (int predicate = 0; (predicate < n_predicates) && !kit.stopped(); predicate++) {
#ifdef ASSERT
JVMState* old_jvms = kit.jvms();
SafePointNode* old_map = kit.map();
Node* old_io = old_map->i_o();
Node* old_mem = old_map->memory();
Node* old_exc = old_map->next_exception();
#endif
Node* else_ctrl = _intrinsic->generate_predicate(kit.sync_jvms(), predicate);
#ifdef ASSERT
// Assert(no_new_memory && no_new_io && no_new_exceptions) after generate_predicate.
assert(old_jvms == kit.jvms(), "generate_predicate should not change jvm state");
SafePointNode* new_map = kit.map();
assert(old_io == new_map->i_o(), "generate_predicate should not change i_o");
assert(old_mem == new_map->memory(), "generate_predicate should not change memory");
assert(old_exc == new_map->next_exception(), "generate_predicate should not add exceptions");
#endif
if (!kit.stopped()) {
PreserveJVMState pjvms(&kit);
// Generate intrinsic code: // Generate intrinsic code:
JVMState* new_jvms = _intrinsic->generate(kit.sync_jvms(), parent_parser); JVMState* new_jvms = _intrinsic->generate(kit.sync_jvms());
if (new_jvms == NULL) { if (new_jvms == NULL) {
// Intrinsic failed, so use slow code or make a direct call. // Intrinsic failed, use normal compilation path for this predicate.
if (slow_map == NULL) { slow_region->add_req(kit.control());
CallGenerator* cg = CallGenerator::for_direct_call(method());
new_jvms = cg->generate(kit.sync_jvms(), parent_parser);
} else { } else {
kit.set_jvms(slow_jvms);
return kit.transfer_exceptions_into_jvms();
}
}
kit.add_exception_states_from(new_jvms); kit.add_exception_states_from(new_jvms);
kit.set_jvms(new_jvms); kit.set_jvms(new_jvms);
if (!kit.stopped()) {
result_jvms[results++] = kit.jvms();
}
}
}
if (else_ctrl == NULL) {
else_ctrl = kit.C->top();
}
kit.set_control(else_ctrl);
}
if (!kit.stopped()) {
// Final 'else' after predicates.
slow_region->add_req(kit.control());
}
if (slow_region->req() > 1) {
PreserveJVMState pjvms(&kit);
// Generate normal compilation code:
kit.set_control(gvn.transform(slow_region));
JVMState* new_jvms = _cg->generate(kit.sync_jvms());
if (kit.failing())
return NULL; // might happen because of NodeCountInliningCutoff
assert(new_jvms != NULL, "must be");
kit.add_exception_states_from(new_jvms);
kit.set_jvms(new_jvms);
if (!kit.stopped()) {
result_jvms[results++] = kit.jvms();
}
}
// Need to merge slow and fast? if (results == 0) {
if (slow_map == NULL) { // All paths ended in uncommon traps.
// The fast path is the only path remaining. (void) kit.stop();
return kit.transfer_exceptions_into_jvms(); return kit.transfer_exceptions_into_jvms();
} }
if (kit.stopped()) { if (results == 1) { // Only one path
// Intrinsic method threw an exception, so it's just the slow path after all. kit.set_jvms(result_jvms[0]);
kit.set_jvms(slow_jvms);
return kit.transfer_exceptions_into_jvms(); return kit.transfer_exceptions_into_jvms();
} }
// Finish the diamond. // Merge all paths.
kit.C->set_has_split_ifs(true); // Has chance for split-if optimization kit.C->set_has_split_ifs(true); // Has chance for split-if optimization
RegionNode* region = new (kit.C) RegionNode(3); RegionNode* region = new RegionNode(results + 1);
region->init_req(1, kit.control());
region->init_req(2, slow_map->control());
kit.set_control(gvn.transform(region));
Node* iophi = PhiNode::make(region, kit.i_o(), Type::ABIO); Node* iophi = PhiNode::make(region, kit.i_o(), Type::ABIO);
iophi->set_req(2, slow_map->i_o()); for (int i = 0; i < results; i++) {
JVMState* jvms = result_jvms[i];
int path = i + 1;
SafePointNode* map = jvms->map();
region->init_req(path, map->control());
iophi->set_req(path, map->i_o());
if (i == 0) {
kit.set_jvms(jvms);
} else {
kit.merge_memory(map->merged_memory(), region, path);
}
}
kit.set_control(gvn.transform(region));
kit.set_i_o(gvn.transform(iophi)); kit.set_i_o(gvn.transform(iophi));
kit.merge_memory(slow_map->merged_memory(), region, 2); // Transform new memory Phis.
for (MergeMemStream mms(kit.merged_memory()); mms.next_non_empty();) {
Node* phi = mms.memory();
if (phi->is_Phi() && phi->in(0) == region) {
mms.set_memory(gvn.transform(phi));
}
}
// Merge debug info.
Node** ins = NEW_RESOURCE_ARRAY(Node*, results);
uint tos = kit.jvms()->stkoff() + kit.sp(); uint tos = kit.jvms()->stkoff() + kit.sp();
uint limit = slow_map->req(); Node* map = kit.map();
uint limit = map->req();
for (uint i = TypeFunc::Parms; i < limit; i++) { for (uint i = TypeFunc::Parms; i < limit; i++) {
// Skip unused stack slots; fast forward to monoff(); // Skip unused stack slots; fast forward to monoff();
if (i == tos) { if (i == tos) {
i = kit.jvms()->monoff(); i = kit.jvms()->monoff();
if( i >= limit ) break; if( i >= limit ) break;
} }
Node* m = kit.map()->in(i); Node* n = map->in(i);
Node* n = slow_map->in(i); ins[0] = n;
const Type* t = gvn.type(n);
bool needs_phi = false;
for (int j = 1; j < results; j++) {
JVMState* jvms = result_jvms[j];
Node* jmap = jvms->map();
Node* m = NULL;
if (jmap->req() > i) {
m = jmap->in(i);
if (m != n) { if (m != n) {
const Type* t = gvn.type(m)->meet_speculative(gvn.type(n)); needs_phi = true;
Node* phi = PhiNode::make(region, m, t); t = t->meet_speculative(gvn.type(m));
phi->set_req(2, n);
kit.map()->set_req(i, gvn.transform(phi));
} }
} }
ins[j] = m;
}
if (needs_phi) {
Node* phi = PhiNode::make(region, n, t);
for (int j = 1; j < results; j++) {
phi->set_req(j + 1, ins[j]);
}
map->set_req(i, gvn.transform(phi));
}
}
return kit.transfer_exceptions_into_jvms(); return kit.transfer_exceptions_into_jvms();
} }
@ -1025,7 +1119,7 @@ public:
virtual bool is_virtual() const { ShouldNotReachHere(); return false; } virtual bool is_virtual() const { ShouldNotReachHere(); return false; }
virtual bool is_trap() const { return true; } virtual bool is_trap() const { return true; }
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser); virtual JVMState* generate(JVMState* jvms);
}; };
@ -1037,7 +1131,7 @@ CallGenerator::for_uncommon_trap(ciMethod* m,
} }
JVMState* UncommonTrapCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { JVMState* UncommonTrapCallGenerator::generate(JVMState* jvms) {
GraphKit kit(jvms); GraphKit kit(jvms);
kit.C->print_inlining_update(this); kit.C->print_inlining_update(this);
// Take the trap with arguments pushed on the stack. (Cf. null_check_receiver). // Take the trap with arguments pushed on the stack. (Cf. null_check_receiver).

View File

@ -31,8 +31,6 @@
#include "opto/type.hpp" #include "opto/type.hpp"
#include "runtime/deoptimization.hpp" #include "runtime/deoptimization.hpp"
class Parse;
//---------------------------CallGenerator------------------------------------- //---------------------------CallGenerator-------------------------------------
// The subclasses of this class handle generation of ideal nodes for // The subclasses of this class handle generation of ideal nodes for
// call sites and method entry points. // call sites and method entry points.
@ -63,8 +61,9 @@ class CallGenerator : public ResourceObj {
virtual bool is_virtual() const { return false; } virtual bool is_virtual() const { return false; }
// is_deferred: The decision whether to inline or not is deferred. // is_deferred: The decision whether to inline or not is deferred.
virtual bool is_deferred() const { return false; } virtual bool is_deferred() const { return false; }
// is_predicted: Uses an explicit check against a predicted type. // is_predicated: Uses an explicit check (predicate).
virtual bool is_predicted() const { return false; } virtual bool is_predicated() const { return false; }
virtual int predicates_count() const { return 0; }
// is_trap: Does not return to the caller. (E.g., uncommon trap.) // is_trap: Does not return to the caller. (E.g., uncommon trap.)
virtual bool is_trap() const { return false; } virtual bool is_trap() const { return false; }
// does_virtual_dispatch: Should try inlining as normal method first. // does_virtual_dispatch: Should try inlining as normal method first.
@ -114,7 +113,7 @@ class CallGenerator : public ResourceObj {
// //
// If the result is NULL, it means that this CallGenerator was unable // If the result is NULL, it means that this CallGenerator was unable
// to handle the given call, and another CallGenerator should be consulted. // to handle the given call, and another CallGenerator should be consulted.
virtual JVMState* generate(JVMState* jvms, Parse* parent_parser) = 0; virtual JVMState* generate(JVMState* jvms) = 0;
// How to generate a call site that is inlined: // How to generate a call site that is inlined:
static CallGenerator* for_inline(ciMethod* m, float expected_uses = -1); static CallGenerator* for_inline(ciMethod* m, float expected_uses = -1);
@ -160,9 +159,9 @@ class CallGenerator : public ResourceObj {
// Registry for intrinsics: // Registry for intrinsics:
static CallGenerator* for_intrinsic(ciMethod* m); static CallGenerator* for_intrinsic(ciMethod* m);
static void register_intrinsic(ciMethod* m, CallGenerator* cg); static void register_intrinsic(ciMethod* m, CallGenerator* cg);
static CallGenerator* for_predicted_intrinsic(CallGenerator* intrinsic, static CallGenerator* for_predicated_intrinsic(CallGenerator* intrinsic,
CallGenerator* cg); CallGenerator* cg);
virtual Node* generate_predicate(JVMState* jvms) { return NULL; }; virtual Node* generate_predicate(JVMState* jvms, int predicate) { return NULL; };
virtual void print_inlining_late(const char* msg) { ShouldNotReachHere(); } virtual void print_inlining_late(const char* msg) { ShouldNotReachHere(); }

View File

@ -74,20 +74,20 @@ Node *StartNode::match( const ProjNode *proj, const Matcher *match ) {
case TypeFunc::Control: case TypeFunc::Control:
case TypeFunc::I_O: case TypeFunc::I_O:
case TypeFunc::Memory: case TypeFunc::Memory:
return new (match->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); return new MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
case TypeFunc::FramePtr: case TypeFunc::FramePtr:
return new (match->C) MachProjNode(this,proj->_con,Matcher::c_frame_ptr_mask, Op_RegP); return new MachProjNode(this,proj->_con,Matcher::c_frame_ptr_mask, Op_RegP);
case TypeFunc::ReturnAdr: case TypeFunc::ReturnAdr:
return new (match->C) MachProjNode(this,proj->_con,match->_return_addr_mask,Op_RegP); return new MachProjNode(this,proj->_con,match->_return_addr_mask,Op_RegP);
case TypeFunc::Parms: case TypeFunc::Parms:
default: { default: {
uint parm_num = proj->_con - TypeFunc::Parms; uint parm_num = proj->_con - TypeFunc::Parms;
const Type *t = _domain->field_at(proj->_con); const Type *t = _domain->field_at(proj->_con);
if (t->base() == Type::Half) // 2nd half of Longs and Doubles if (t->base() == Type::Half) // 2nd half of Longs and Doubles
return new (match->C) ConNode(Type::TOP); return new ConNode(Type::TOP);
uint ideal_reg = t->ideal_reg(); uint ideal_reg = t->ideal_reg();
RegMask &rm = match->_calling_convention_mask[parm_num]; RegMask &rm = match->_calling_convention_mask[parm_num];
return new (match->C) MachProjNode(this,proj->_con,rm,ideal_reg); return new MachProjNode(this,proj->_con,rm,ideal_reg);
} }
} }
return NULL; return NULL;
@ -685,12 +685,12 @@ Node *CallNode::match( const ProjNode *proj, const Matcher *match ) {
case TypeFunc::Control: case TypeFunc::Control:
case TypeFunc::I_O: case TypeFunc::I_O:
case TypeFunc::Memory: case TypeFunc::Memory:
return new (match->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); return new MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
case TypeFunc::Parms+1: // For LONG & DOUBLE returns case TypeFunc::Parms+1: // For LONG & DOUBLE returns
assert(tf()->_range->field_at(TypeFunc::Parms+1) == Type::HALF, ""); assert(tf()->_range->field_at(TypeFunc::Parms+1) == Type::HALF, "");
// 2nd half of doubles and longs // 2nd half of doubles and longs
return new (match->C) MachProjNode(this,proj->_con, RegMask::Empty, (uint)OptoReg::Bad); return new MachProjNode(this,proj->_con, RegMask::Empty, (uint)OptoReg::Bad);
case TypeFunc::Parms: { // Normal returns case TypeFunc::Parms: { // Normal returns
uint ideal_reg = tf()->range()->field_at(TypeFunc::Parms)->ideal_reg(); uint ideal_reg = tf()->range()->field_at(TypeFunc::Parms)->ideal_reg();
@ -700,7 +700,7 @@ Node *CallNode::match( const ProjNode *proj, const Matcher *match ) {
RegMask rm = RegMask(regs.first()); RegMask rm = RegMask(regs.first());
if( OptoReg::is_valid(regs.second()) ) if( OptoReg::is_valid(regs.second()) )
rm.Insert( regs.second() ); rm.Insert( regs.second() );
return new (match->C) MachProjNode(this,proj->_con,rm,ideal_reg); return new MachProjNode(this,proj->_con,rm,ideal_reg);
} }
case TypeFunc::ReturnAdr: case TypeFunc::ReturnAdr:
@ -1090,6 +1090,7 @@ const Type *SafePointNode::Value( PhaseTransform *phase ) const {
#ifndef PRODUCT #ifndef PRODUCT
void SafePointNode::dump_spec(outputStream *st) const { void SafePointNode::dump_spec(outputStream *st) const {
st->print(" SafePoint "); st->print(" SafePoint ");
_replaced_nodes.dump(st);
} }
#endif #endif
@ -1288,10 +1289,10 @@ Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* nproj = catchproj->clone(); Node* nproj = catchproj->clone();
igvn->register_new_node_with_optimizer(nproj); igvn->register_new_node_with_optimizer(nproj);
Node *frame = new (phase->C) ParmNode( phase->C->start(), TypeFunc::FramePtr ); Node *frame = new ParmNode( phase->C->start(), TypeFunc::FramePtr );
frame = phase->transform(frame); frame = phase->transform(frame);
// Halt & Catch Fire // Halt & Catch Fire
Node *halt = new (phase->C) HaltNode( nproj, frame ); Node *halt = new HaltNode( nproj, frame );
phase->C->root()->add_req(halt); phase->C->root()->add_req(halt);
phase->transform(halt); phase->transform(halt);
@ -1333,7 +1334,7 @@ Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseTran
if (!allow_new_nodes) return NULL; if (!allow_new_nodes) return NULL;
// Create a cast which is control dependent on the initialization to // Create a cast which is control dependent on the initialization to
// propagate the fact that the array length must be positive. // propagate the fact that the array length must be positive.
length = new (phase->C) CastIINode(length, narrow_length_type); length = new CastIINode(length, narrow_length_type);
length->set_req(0, initialization()->proj_out(0)); length->set_req(0, initialization()->proj_out(0));
} }
} }

View File

@ -30,6 +30,7 @@
#include "opto/multnode.hpp" #include "opto/multnode.hpp"
#include "opto/opcodes.hpp" #include "opto/opcodes.hpp"
#include "opto/phaseX.hpp" #include "opto/phaseX.hpp"
#include "opto/replacednodes.hpp"
#include "opto/type.hpp" #include "opto/type.hpp"
// Portions of code courtesy of Clifford Click // Portions of code courtesy of Clifford Click
@ -335,6 +336,7 @@ public:
OopMap* _oop_map; // Array of OopMap info (8-bit char) for GC OopMap* _oop_map; // Array of OopMap info (8-bit char) for GC
JVMState* const _jvms; // Pointer to list of JVM State objects JVMState* const _jvms; // Pointer to list of JVM State objects
const TypePtr* _adr_type; // What type of memory does this node produce? const TypePtr* _adr_type; // What type of memory does this node produce?
ReplacedNodes _replaced_nodes; // During parsing: list of pair of nodes from calls to GraphKit::replace_in_map()
// Many calls take *all* of memory as input, // Many calls take *all* of memory as input,
// but some produce a limited subset of that memory as output. // but some produce a limited subset of that memory as output.
@ -426,6 +428,37 @@ public:
void set_next_exception(SafePointNode* n); void set_next_exception(SafePointNode* n);
bool has_exceptions() const { return next_exception() != NULL; } bool has_exceptions() const { return next_exception() != NULL; }
// Helper methods to operate on replaced nodes
ReplacedNodes replaced_nodes() const {
return _replaced_nodes;
}
void set_replaced_nodes(ReplacedNodes replaced_nodes) {
_replaced_nodes = replaced_nodes;
}
void clone_replaced_nodes() {
_replaced_nodes.clone();
}
void record_replaced_node(Node* initial, Node* improved) {
_replaced_nodes.record(initial, improved);
}
void transfer_replaced_nodes_from(SafePointNode* sfpt, uint idx = 0) {
_replaced_nodes.transfer_from(sfpt->_replaced_nodes, idx);
}
void delete_replaced_nodes() {
_replaced_nodes.reset();
}
void apply_replaced_nodes() {
_replaced_nodes.apply(this);
}
void merge_replaced_nodes_with(SafePointNode* sfpt) {
_replaced_nodes.merge_with(sfpt->_replaced_nodes);
}
bool has_replaced_nodes() const {
return !_replaced_nodes.is_empty();
}
// Standard Node stuff // Standard Node stuff
virtual int Opcode() const; virtual int Opcode() const;
virtual bool pinned() const { return true; } virtual bool pinned() const { return true; }

View File

@ -228,10 +228,10 @@ static inline Node* addP_of_X2P(PhaseGVN *phase,
Node* dispX, Node* dispX,
bool negate = false) { bool negate = false) {
if (negate) { if (negate) {
dispX = new (phase->C) SubXNode(phase->MakeConX(0), phase->transform(dispX)); dispX = new SubXNode(phase->MakeConX(0), phase->transform(dispX));
} }
return new (phase->C) AddPNode(phase->C->top(), return new AddPNode(phase->C->top(),
phase->transform(new (phase->C) CastX2PNode(base)), phase->transform(new CastX2PNode(base)),
phase->transform(dispX)); phase->transform(dispX));
} }

View File

@ -662,17 +662,17 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) {
convf2i->in(1) == bot_in ) { convf2i->in(1) == bot_in ) {
// Matched pattern, including LShiftI; RShiftI, replace with integer compares // Matched pattern, including LShiftI; RShiftI, replace with integer compares
// max test // max test
Node *cmp = gvn->register_new_node_with_optimizer(new (phase->C) CmpINode( convf2i, min )); Node *cmp = gvn->register_new_node_with_optimizer(new CmpINode( convf2i, min ));
Node *boo = gvn->register_new_node_with_optimizer(new (phase->C) BoolNode( cmp, BoolTest::lt )); Node *boo = gvn->register_new_node_with_optimizer(new BoolNode( cmp, BoolTest::lt ));
IfNode *iff = (IfNode*)gvn->register_new_node_with_optimizer(new (phase->C) IfNode( top_if->in(0), boo, PROB_UNLIKELY_MAG(5), top_if->_fcnt )); IfNode *iff = (IfNode*)gvn->register_new_node_with_optimizer(new IfNode( top_if->in(0), boo, PROB_UNLIKELY_MAG(5), top_if->_fcnt ));
Node *if_min= gvn->register_new_node_with_optimizer(new (phase->C) IfTrueNode (iff)); Node *if_min= gvn->register_new_node_with_optimizer(new IfTrueNode (iff));
Node *ifF = gvn->register_new_node_with_optimizer(new (phase->C) IfFalseNode(iff)); Node *ifF = gvn->register_new_node_with_optimizer(new IfFalseNode(iff));
// min test // min test
cmp = gvn->register_new_node_with_optimizer(new (phase->C) CmpINode( convf2i, max )); cmp = gvn->register_new_node_with_optimizer(new CmpINode( convf2i, max ));
boo = gvn->register_new_node_with_optimizer(new (phase->C) BoolNode( cmp, BoolTest::gt )); boo = gvn->register_new_node_with_optimizer(new BoolNode( cmp, BoolTest::gt ));
iff = (IfNode*)gvn->register_new_node_with_optimizer(new (phase->C) IfNode( ifF, boo, PROB_UNLIKELY_MAG(5), bot_if->_fcnt )); iff = (IfNode*)gvn->register_new_node_with_optimizer(new IfNode( ifF, boo, PROB_UNLIKELY_MAG(5), bot_if->_fcnt ));
Node *if_max= gvn->register_new_node_with_optimizer(new (phase->C) IfTrueNode (iff)); Node *if_max= gvn->register_new_node_with_optimizer(new IfTrueNode (iff));
ifF = gvn->register_new_node_with_optimizer(new (phase->C) IfFalseNode(iff)); ifF = gvn->register_new_node_with_optimizer(new IfFalseNode(iff));
// update input edges to region node // update input edges to region node
set_req_X( min_idx, if_min, gvn ); set_req_X( min_idx, if_min, gvn );
set_req_X( max_idx, if_max, gvn ); set_req_X( max_idx, if_max, gvn );
@ -731,7 +731,7 @@ const TypePtr* flatten_phi_adr_type(const TypePtr* at) {
PhiNode* PhiNode::make(Node* r, Node* x, const Type *t, const TypePtr* at) { PhiNode* PhiNode::make(Node* r, Node* x, const Type *t, const TypePtr* at) {
uint preds = r->req(); // Number of predecessor paths uint preds = r->req(); // Number of predecessor paths
assert(t != Type::MEMORY || at == flatten_phi_adr_type(at), "flatten at"); assert(t != Type::MEMORY || at == flatten_phi_adr_type(at), "flatten at");
PhiNode* p = new (Compile::current()) PhiNode(r, t, at); PhiNode* p = new PhiNode(r, t, at);
for (uint j = 1; j < preds; j++) { for (uint j = 1; j < preds; j++) {
// Fill in all inputs, except those which the region does not yet have // Fill in all inputs, except those which the region does not yet have
if (r->in(j) != NULL) if (r->in(j) != NULL)
@ -749,7 +749,7 @@ PhiNode* PhiNode::make_blank(Node* r, Node* x) {
const Type* t = x->bottom_type(); const Type* t = x->bottom_type();
const TypePtr* at = NULL; const TypePtr* at = NULL;
if (t == Type::MEMORY) at = flatten_phi_adr_type(x->adr_type()); if (t == Type::MEMORY) at = flatten_phi_adr_type(x->adr_type());
return new (Compile::current()) PhiNode(r, t, at); return new PhiNode(r, t, at);
} }
@ -1258,9 +1258,9 @@ static Node *is_x2logic( PhaseGVN *phase, PhiNode *phi, int true_path ) {
} else return NULL; } else return NULL;
// Build int->bool conversion // Build int->bool conversion
Node *n = new (phase->C) Conv2BNode( cmp->in(1) ); Node *n = new Conv2BNode( cmp->in(1) );
if( flipped ) if( flipped )
n = new (phase->C) XorINode( phase->transform(n), phase->intcon(1) ); n = new XorINode( phase->transform(n), phase->intcon(1) );
return n; return n;
} }
@ -1320,9 +1320,9 @@ static Node* is_cond_add(PhaseGVN *phase, PhiNode *phi, int true_path) {
if( q->is_Con() && phase->type(q) != TypeInt::ZERO && y->is_Con() ) if( q->is_Con() && phase->type(q) != TypeInt::ZERO && y->is_Con() )
return NULL; return NULL;
Node *cmplt = phase->transform( new (phase->C) CmpLTMaskNode(p,q) ); Node *cmplt = phase->transform( new CmpLTMaskNode(p,q) );
Node *j_and = phase->transform( new (phase->C) AndINode(cmplt,y) ); Node *j_and = phase->transform( new AndINode(cmplt,y) );
return new (phase->C) AddINode(j_and,x); return new AddINode(j_and,x);
} }
//------------------------------is_absolute------------------------------------ //------------------------------is_absolute------------------------------------
@ -1384,17 +1384,17 @@ static Node* is_absolute( PhaseGVN *phase, PhiNode *phi_root, int true_path) {
if( sub->Opcode() != Op_SubF || if( sub->Opcode() != Op_SubF ||
sub->in(2) != x || sub->in(2) != x ||
phase->type(sub->in(1)) != tzero ) return NULL; phase->type(sub->in(1)) != tzero ) return NULL;
x = new (phase->C) AbsFNode(x); x = new AbsFNode(x);
if (flip) { if (flip) {
x = new (phase->C) SubFNode(sub->in(1), phase->transform(x)); x = new SubFNode(sub->in(1), phase->transform(x));
} }
} else { } else {
if( sub->Opcode() != Op_SubD || if( sub->Opcode() != Op_SubD ||
sub->in(2) != x || sub->in(2) != x ||
phase->type(sub->in(1)) != tzero ) return NULL; phase->type(sub->in(1)) != tzero ) return NULL;
x = new (phase->C) AbsDNode(x); x = new AbsDNode(x);
if (flip) { if (flip) {
x = new (phase->C) SubDNode(sub->in(1), phase->transform(x)); x = new SubDNode(sub->in(1), phase->transform(x));
} }
} }
@ -1469,7 +1469,7 @@ static Node* split_flow_path(PhaseGVN *phase, PhiNode *phi) {
// Now start splitting out the flow paths that merge the same value. // Now start splitting out the flow paths that merge the same value.
// Split first the RegionNode. // Split first the RegionNode.
PhaseIterGVN *igvn = phase->is_IterGVN(); PhaseIterGVN *igvn = phase->is_IterGVN();
RegionNode *newr = new (phase->C) RegionNode(hit+1); RegionNode *newr = new RegionNode(hit+1);
split_once(igvn, phi, val, r, newr); split_once(igvn, phi, val, r, newr);
// Now split all other Phis than this one // Now split all other Phis than this one
@ -1781,13 +1781,13 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
} }
if (doit) { if (doit) {
if (base == NULL) { if (base == NULL) {
base = new (phase->C) PhiNode(in(0), type, NULL); base = new PhiNode(in(0), type, NULL);
for (uint i = 1; i < req(); i++) { for (uint i = 1; i < req(); i++) {
base->init_req(i, in(i)->in(AddPNode::Base)); base->init_req(i, in(i)->in(AddPNode::Base));
} }
phase->is_IterGVN()->register_new_node_with_optimizer(base); phase->is_IterGVN()->register_new_node_with_optimizer(base);
} }
return new (phase->C) AddPNode(base, base, y); return new AddPNode(base, base, y);
} }
} }
} }
@ -1864,7 +1864,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// Phi(...MergeMem(m0, m1:AT1, m2:AT2)...) into // Phi(...MergeMem(m0, m1:AT1, m2:AT2)...) into
// MergeMem(Phi(...m0...), Phi:AT1(...m1...), Phi:AT2(...m2...)) // MergeMem(Phi(...m0...), Phi:AT1(...m1...), Phi:AT2(...m2...))
PhaseIterGVN *igvn = phase->is_IterGVN(); PhaseIterGVN *igvn = phase->is_IterGVN();
Node* hook = new (phase->C) Node(1); Node* hook = new Node(1);
PhiNode* new_base = (PhiNode*) clone(); PhiNode* new_base = (PhiNode*) clone();
// Must eagerly register phis, since they participate in loops. // Must eagerly register phis, since they participate in loops.
if (igvn) { if (igvn) {
@ -1961,7 +1961,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
} else { } else {
narrow_t = TypeNarrowKlass::make(this->bottom_type()->is_ptr()); narrow_t = TypeNarrowKlass::make(this->bottom_type()->is_ptr());
} }
PhiNode* new_phi = new (phase->C) PhiNode(r, narrow_t); PhiNode* new_phi = new PhiNode(r, narrow_t);
uint orig_cnt = req(); uint orig_cnt = req();
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);
@ -1975,9 +1975,9 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
new_ii = new_phi; new_ii = new_phi;
} else { } else {
if (is_decodeN) { if (is_decodeN) {
new_ii = new (phase->C) EncodePNode(ii, narrow_t); new_ii = new EncodePNode(ii, narrow_t);
} else { } else {
new_ii = new (phase->C) EncodePKlassNode(ii, narrow_t); new_ii = new EncodePKlassNode(ii, narrow_t);
} }
igvn->register_new_node_with_optimizer(new_ii); igvn->register_new_node_with_optimizer(new_ii);
} }
@ -1986,9 +1986,9 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
} }
igvn->register_new_node_with_optimizer(new_phi, this); igvn->register_new_node_with_optimizer(new_phi, this);
if (is_decodeN) { if (is_decodeN) {
progress = new (phase->C) DecodeNNode(new_phi, bottom_type()); progress = new DecodeNNode(new_phi, bottom_type());
} else { } else {
progress = new (phase->C) DecodeNKlassNode(new_phi, bottom_type()); progress = new DecodeNKlassNode(new_phi, bottom_type());
} }
} }
} }

View File

@ -1730,7 +1730,7 @@ Node *PhaseChaitin::find_base_for_derived( Node **derived_base_map, Node *derive
// Now we see we need a base-Phi here to merge the bases // Now we see we need a base-Phi here to merge the bases
const Type *t = base->bottom_type(); const Type *t = base->bottom_type();
base = new (C) PhiNode( derived->in(0), t ); base = new PhiNode( derived->in(0), t );
for( i = 1; i < derived->req(); i++ ) { for( i = 1; i < derived->req(); i++ ) {
base->init_req(i, find_base_for_derived(derived_base_map, derived->in(i), maxlrg)); base->init_req(i, find_base_for_derived(derived_base_map, derived->in(i), maxlrg));
t = t->meet(base->in(i)->bottom_type()); t = t->meet(base->in(i)->bottom_type());
@ -1800,7 +1800,7 @@ bool PhaseChaitin::stretch_base_pointer_live_ranges(ResourceArea *a) {
Block *phi_block = _cfg.get_block_for_node(phi); Block *phi_block = _cfg.get_block_for_node(phi);
if (_cfg.get_block_for_node(phi_block->pred(2)) == block) { if (_cfg.get_block_for_node(phi_block->pred(2)) == block) {
const RegMask *mask = C->matcher()->idealreg2spillmask[Op_RegI]; const RegMask *mask = C->matcher()->idealreg2spillmask[Op_RegI];
Node *spill = new (C) MachSpillCopyNode(MachSpillCopyNode::LoopPhiInput, phi, *mask, *mask); Node *spill = new MachSpillCopyNode(MachSpillCopyNode::LoopPhiInput, phi, *mask, *mask);
insert_proj( phi_block, 1, spill, maxlrg++ ); insert_proj( phi_block, 1, spill, maxlrg++ );
n->set_req(1,spill); n->set_req(1,spill);
must_recompute_live = true; must_recompute_live = true;

View File

@ -291,7 +291,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) {
_phc.clone_projs(pred, pred->end_idx(), m, copy, _phc._lrg_map); _phc.clone_projs(pred, pred->end_idx(), m, copy, _phc._lrg_map);
} else { } else {
const RegMask *rm = C->matcher()->idealreg2spillmask[m->ideal_reg()]; const RegMask *rm = C->matcher()->idealreg2spillmask[m->ideal_reg()];
copy = new (C) MachSpillCopyNode(MachSpillCopyNode::PhiInput, m, *rm, *rm); copy = new MachSpillCopyNode(MachSpillCopyNode::PhiInput, m, *rm, *rm);
// Find a good place to insert. Kinda tricky, use a subroutine // Find a good place to insert. Kinda tricky, use a subroutine
insert_copy_with_overlap(pred,copy,phi_name,src_name); insert_copy_with_overlap(pred,copy,phi_name,src_name);
} }
@ -325,7 +325,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) {
l += _phc.clone_projs(b, l, m, copy, _phc._lrg_map); l += _phc.clone_projs(b, l, m, copy, _phc._lrg_map);
} else { } else {
const RegMask *rm = C->matcher()->idealreg2spillmask[m->ideal_reg()]; const RegMask *rm = C->matcher()->idealreg2spillmask[m->ideal_reg()];
copy = new (C) MachSpillCopyNode(MachSpillCopyNode::TwoAddress, m, *rm, *rm); copy = new MachSpillCopyNode(MachSpillCopyNode::TwoAddress, m, *rm, *rm);
// Insert the copy in the basic block, just before us // Insert the copy in the basic block, just before us
b->insert_node(copy, l++); b->insert_node(copy, l++);
} }
@ -372,7 +372,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) {
continue; // Live out; do not pre-split continue; // Live out; do not pre-split
// Split the lrg at this use // Split the lrg at this use
const RegMask *rm = C->matcher()->idealreg2spillmask[inp->ideal_reg()]; const RegMask *rm = C->matcher()->idealreg2spillmask[inp->ideal_reg()];
Node* copy = new (C) MachSpillCopyNode(MachSpillCopyNode::DebugUse, inp, *rm, *rm); Node* copy = new MachSpillCopyNode(MachSpillCopyNode::DebugUse, inp, *rm, *rm);
// Insert the copy in the use-def chain // Insert the copy in the use-def chain
n->set_req(inpidx, copy ); n->set_req(inpidx, copy );
// Insert the copy in the basic block, just before us // Insert the copy in the basic block, just before us

View File

@ -95,7 +95,7 @@
// Constant table base node singleton. // Constant table base node singleton.
MachConstantBaseNode* Compile::mach_constant_base_node() { MachConstantBaseNode* Compile::mach_constant_base_node() {
if (_mach_constant_base_node == NULL) { if (_mach_constant_base_node == NULL) {
_mach_constant_base_node = new (C) MachConstantBaseNode(); _mach_constant_base_node = new MachConstantBaseNode();
_mach_constant_base_node->add_req(C->root()); _mach_constant_base_node->add_req(C->root());
} }
return _mach_constant_base_node; return _mach_constant_base_node;
@ -392,6 +392,11 @@ void Compile::remove_useless_nodes(Unique_Node_List &useful) {
uint next = 0; uint next = 0;
while (next < useful.size()) { while (next < useful.size()) {
Node *n = useful.at(next++); Node *n = useful.at(next++);
if (n->is_SafePoint()) {
// We're done with a parsing phase. Replaced nodes are not valid
// beyond that point.
n->as_SafePoint()->delete_replaced_nodes();
}
// Use raw traversal of out edges since this code removes out edges // Use raw traversal of out edges since this code removes out edges
int max = n->outcnt(); int max = n->outcnt();
for (int j = 0; j < max; ++j) { for (int j = 0; j < max; ++j) {
@ -673,7 +678,6 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
_print_inlining_stream(NULL), _print_inlining_stream(NULL),
_print_inlining_idx(0), _print_inlining_idx(0),
_print_inlining_output(NULL), _print_inlining_output(NULL),
_preserve_jvm_state(0),
_interpreter_frame_size(0) { _interpreter_frame_size(0) {
C = this; C = this;
@ -748,14 +752,14 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
const TypeTuple *domain = StartOSRNode::osr_domain(); const TypeTuple *domain = StartOSRNode::osr_domain();
const TypeTuple *range = TypeTuple::make_range(method()->signature()); const TypeTuple *range = TypeTuple::make_range(method()->signature());
init_tf(TypeFunc::make(domain, range)); init_tf(TypeFunc::make(domain, range));
StartNode* s = new (this) StartOSRNode(root(), domain); StartNode* s = new StartOSRNode(root(), domain);
initial_gvn()->set_type_bottom(s); initial_gvn()->set_type_bottom(s);
init_start(s); init_start(s);
cg = CallGenerator::for_osr(method(), entry_bci()); cg = CallGenerator::for_osr(method(), entry_bci());
} else { } else {
// Normal case. // Normal case.
init_tf(TypeFunc::make(method())); init_tf(TypeFunc::make(method()));
StartNode* s = new (this) StartNode(root(), tf()->domain()); StartNode* s = new StartNode(root(), tf()->domain());
initial_gvn()->set_type_bottom(s); initial_gvn()->set_type_bottom(s);
init_start(s); init_start(s);
if (method()->intrinsic_id() == vmIntrinsics::_Reference_get && UseG1GC) { if (method()->intrinsic_id() == vmIntrinsics::_Reference_get && UseG1GC) {
@ -783,7 +787,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
return; return;
} }
JVMState* jvms = build_start_state(start(), tf()); JVMState* jvms = build_start_state(start(), tf());
if ((jvms = cg->generate(jvms, NULL)) == NULL) { if ((jvms = cg->generate(jvms)) == NULL) {
record_method_not_compilable("method parse failed"); record_method_not_compilable("method parse failed");
return; return;
} }
@ -980,7 +984,6 @@ Compile::Compile( ciEnv* ci_env,
_print_inlining_stream(NULL), _print_inlining_stream(NULL),
_print_inlining_idx(0), _print_inlining_idx(0),
_print_inlining_output(NULL), _print_inlining_output(NULL),
_preserve_jvm_state(0),
_allowed_reasons(0), _allowed_reasons(0),
_interpreter_frame_size(0) { _interpreter_frame_size(0) {
C = this; C = this;
@ -1061,9 +1064,9 @@ void Compile::Init(int aliaslevel) {
// Globally visible Nodes // Globally visible Nodes
// First set TOP to NULL to give safe behavior during creation of RootNode // First set TOP to NULL to give safe behavior during creation of RootNode
set_cached_top_node(NULL); set_cached_top_node(NULL);
set_root(new (this) RootNode()); set_root(new RootNode());
// Now that you have a Root to point to, create the real TOP // Now that you have a Root to point to, create the real TOP
set_cached_top_node( new (this) ConNode(Type::TOP) ); set_cached_top_node( new ConNode(Type::TOP) );
set_recent_alloc(NULL, NULL); set_recent_alloc(NULL, NULL);
// Create Debug Information Recorder to record scopes, oopmaps, etc. // Create Debug Information Recorder to record scopes, oopmaps, etc.
@ -1914,6 +1917,8 @@ void Compile::inline_boxing_calls(PhaseIterGVN& igvn) {
for_igvn()->clear(); for_igvn()->clear();
gvn->replace_with(&igvn); gvn->replace_with(&igvn);
_late_inlines_pos = _late_inlines.length();
while (_boxing_late_inlines.length() > 0) { while (_boxing_late_inlines.length() > 0) {
CallGenerator* cg = _boxing_late_inlines.pop(); CallGenerator* cg = _boxing_late_inlines.pop();
cg->do_late_inline(); cg->do_late_inline();
@ -1977,8 +1982,8 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) {
if (live_nodes() > (uint)LiveNodeCountInliningCutoff) { if (live_nodes() > (uint)LiveNodeCountInliningCutoff) {
if (low_live_nodes < (uint)LiveNodeCountInliningCutoff * 8 / 10) { if (low_live_nodes < (uint)LiveNodeCountInliningCutoff * 8 / 10) {
// PhaseIdealLoop is expensive so we only try it once we are // PhaseIdealLoop is expensive so we only try it once we are
// out of loop and we only try it again if the previous helped // out of live nodes and we only try it again if the previous
// got the number of nodes down significantly // helped got the number of nodes down significantly
PhaseIdealLoop ideal_loop( igvn, false, true ); PhaseIdealLoop ideal_loop( igvn, false, true );
if (failing()) return; if (failing()) return;
low_live_nodes = live_nodes(); low_live_nodes = live_nodes();
@ -2072,6 +2077,10 @@ void Compile::Optimize() {
// Inline valueOf() methods now. // Inline valueOf() methods now.
inline_boxing_calls(igvn); inline_boxing_calls(igvn);
if (AlwaysIncrementalInline) {
inline_incrementally(igvn);
}
print_method(PHASE_INCREMENTAL_BOXING_INLINE, 2); print_method(PHASE_INCREMENTAL_BOXING_INLINE, 2);
if (failing()) return; if (failing()) return;
@ -2757,9 +2766,9 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
// Decode a narrow oop to match address // Decode a narrow oop to match address
// [R12 + narrow_oop_reg<<3 + offset] // [R12 + narrow_oop_reg<<3 + offset]
if (t->isa_oopptr()) { if (t->isa_oopptr()) {
nn = new (this) DecodeNNode(nn, t); nn = new DecodeNNode(nn, t);
} else { } else {
nn = new (this) DecodeNKlassNode(nn, t); nn = new DecodeNKlassNode(nn, t);
} }
n->set_req(AddPNode::Base, nn); n->set_req(AddPNode::Base, nn);
n->set_req(AddPNode::Address, nn); n->set_req(AddPNode::Address, nn);
@ -2880,7 +2889,7 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
} }
} }
if (new_in2 != NULL) { if (new_in2 != NULL) {
Node* cmpN = new (this) CmpNNode(in1->in(1), new_in2); Node* cmpN = new CmpNNode(in1->in(1), new_in2);
n->subsume_by(cmpN, this); n->subsume_by(cmpN, this);
if (in1->outcnt() == 0) { if (in1->outcnt() == 0) {
in1->disconnect_inputs(NULL, this); in1->disconnect_inputs(NULL, this);
@ -2979,8 +2988,8 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
n->subsume_by(divmod->mod_proj(), this); n->subsume_by(divmod->mod_proj(), this);
} else { } else {
// replace a%b with a-((a/b)*b) // replace a%b with a-((a/b)*b)
Node* mult = new (this) MulINode(d, d->in(2)); Node* mult = new MulINode(d, d->in(2));
Node* sub = new (this) SubINode(d->in(1), mult); Node* sub = new SubINode(d->in(1), mult);
n->subsume_by(sub, this); n->subsume_by(sub, this);
} }
} }
@ -2999,8 +3008,8 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
n->subsume_by(divmod->mod_proj(), this); n->subsume_by(divmod->mod_proj(), this);
} else { } else {
// replace a%b with a-((a/b)*b) // replace a%b with a-((a/b)*b)
Node* mult = new (this) MulLNode(d, d->in(2)); Node* mult = new MulLNode(d, d->in(2));
Node* sub = new (this) SubLNode(d->in(1), mult); Node* sub = new SubLNode(d->in(1), mult);
n->subsume_by(sub, this); n->subsume_by(sub, this);
} }
} }
@ -3049,7 +3058,7 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
} }
} else { } else {
if (t == NULL || t->_lo < 0 || t->_hi > (int)mask) { if (t == NULL || t->_lo < 0 || t->_hi > (int)mask) {
Node* shift = new (this) AndINode(in2, ConNode::make(this, TypeInt::make(mask))); Node* shift = new AndINode(in2, ConNode::make(this, TypeInt::make(mask)));
n->set_req(2, shift); n->set_req(2, shift);
} }
} }

View File

@ -431,9 +431,6 @@ class Compile : public Phase {
// Remove the speculative part of types and clean up the graph // Remove the speculative part of types and clean up the graph
void remove_speculative_types(PhaseIterGVN &igvn); void remove_speculative_types(PhaseIterGVN &igvn);
// Are we within a PreserveJVMState block?
int _preserve_jvm_state;
void* _replay_inline_data; // Pointer to data loaded from file void* _replay_inline_data; // Pointer to data loaded from file
void print_inlining_init(); void print_inlining_init();
@ -1198,21 +1195,6 @@ class Compile : public Phase {
// Auxiliary method for randomized fuzzing/stressing // Auxiliary method for randomized fuzzing/stressing
static bool randomized_select(int count); static bool randomized_select(int count);
// enter a PreserveJVMState block
void inc_preserve_jvm_state() {
_preserve_jvm_state++;
}
// exit a PreserveJVMState block
void dec_preserve_jvm_state() {
_preserve_jvm_state--;
assert(_preserve_jvm_state >= 0, "_preserve_jvm_state shouldn't be negative");
}
bool has_preserve_jvm_state() const {
return _preserve_jvm_state > 0;
}
}; };
#endif // SHARE_VM_OPTO_COMPILE_HPP #endif // SHARE_VM_OPTO_COMPILE_HPP

View File

@ -45,17 +45,17 @@ uint ConNode::hash() const {
//------------------------------make------------------------------------------- //------------------------------make-------------------------------------------
ConNode *ConNode::make( Compile* C, const Type *t ) { ConNode *ConNode::make( Compile* C, const Type *t ) {
switch( t->basic_type() ) { switch( t->basic_type() ) {
case T_INT: return new (C) ConINode( t->is_int() ); case T_INT: return new ConINode( t->is_int() );
case T_LONG: return new (C) ConLNode( t->is_long() ); case T_LONG: return new ConLNode( t->is_long() );
case T_FLOAT: return new (C) ConFNode( t->is_float_constant() ); case T_FLOAT: return new ConFNode( t->is_float_constant() );
case T_DOUBLE: return new (C) ConDNode( t->is_double_constant() ); case T_DOUBLE: return new ConDNode( t->is_double_constant() );
case T_VOID: return new (C) ConNode ( Type::TOP ); case T_VOID: return new ConNode ( Type::TOP );
case T_OBJECT: return new (C) ConPNode( t->is_ptr() ); case T_OBJECT: return new ConPNode( t->is_ptr() );
case T_ARRAY: return new (C) ConPNode( t->is_aryptr() ); case T_ARRAY: return new ConPNode( t->is_aryptr() );
case T_ADDRESS: return new (C) ConPNode( t->is_ptr() ); case T_ADDRESS: return new ConPNode( t->is_ptr() );
case T_NARROWOOP: return new (C) ConNNode( t->is_narrowoop() ); case T_NARROWOOP: return new ConNNode( t->is_narrowoop() );
case T_NARROWKLASS: return new (C) ConNKlassNode( t->is_narrowklass() ); case T_NARROWKLASS: return new ConNKlassNode( t->is_narrowklass() );
case T_METADATA: return new (C) ConPNode( t->is_ptr() ); case T_METADATA: return new ConPNode( t->is_ptr() );
// Expected cases: TypePtr::NULL_PTR, any is_rawptr() // Expected cases: TypePtr::NULL_PTR, any is_rawptr()
// Also seen: AnyPtr(TopPTR *+top); from command line: // Also seen: AnyPtr(TopPTR *+top); from command line:
// r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660 // r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660

View File

@ -58,7 +58,7 @@ public:
// Factory method: // Factory method:
static ConINode* make( Compile* C, int con ) { static ConINode* make( Compile* C, int con ) {
return new (C) ConINode( TypeInt::make(con) ); return new ConINode( TypeInt::make(con) );
} }
}; };
@ -73,9 +73,9 @@ public:
// Factory methods: // Factory methods:
static ConPNode* make( Compile *C ,address con ) { static ConPNode* make( Compile *C ,address con ) {
if (con == NULL) if (con == NULL)
return new (C) ConPNode( TypePtr::NULL_PTR ) ; return new ConPNode( TypePtr::NULL_PTR ) ;
else else
return new (C) ConPNode( TypeRawPtr::make(con) ); return new ConPNode( TypeRawPtr::make(con) );
} }
}; };
@ -106,7 +106,7 @@ public:
// Factory method: // Factory method:
static ConLNode* make( Compile *C ,jlong con ) { static ConLNode* make( Compile *C ,jlong con ) {
return new (C) ConLNode( TypeLong::make(con) ); return new ConLNode( TypeLong::make(con) );
} }
}; };
@ -120,7 +120,7 @@ public:
// Factory method: // Factory method:
static ConFNode* make( Compile *C, float con ) { static ConFNode* make( Compile *C, float con ) {
return new (C) ConFNode( TypeF::make(con) ); return new ConFNode( TypeF::make(con) );
} }
}; };
@ -134,7 +134,7 @@ public:
// Factory method: // Factory method:
static ConDNode* make( Compile *C, double con ) { static ConDNode* make( Compile *C, double con ) {
return new (C) ConDNode( TypeD::make(con) ); return new ConDNode( TypeD::make(con) );
} }
}; };

View File

@ -374,11 +374,11 @@ Node *ConvI2LNode::Ideal(PhaseGVN *phase, bool can_reshape) {
ryhi = -rylo0; ryhi = -rylo0;
} }
Node* cx = phase->transform( new (phase->C) ConvI2LNode(x, TypeLong::make(rxlo, rxhi, widen)) ); Node* cx = phase->transform( new ConvI2LNode(x, TypeLong::make(rxlo, rxhi, widen)) );
Node* cy = phase->transform( new (phase->C) ConvI2LNode(y, TypeLong::make(rylo, ryhi, widen)) ); Node* cy = phase->transform( new ConvI2LNode(y, TypeLong::make(rylo, ryhi, widen)) );
switch (op) { switch (op) {
case Op_AddI: return new (phase->C) AddLNode(cx, cy); case Op_AddI: return new AddLNode(cx, cy);
case Op_SubI: return new (phase->C) SubLNode(cx, cy); case Op_SubI: return new SubLNode(cx, cy);
default: ShouldNotReachHere(); default: ShouldNotReachHere();
} }
} }
@ -452,9 +452,9 @@ Node *ConvL2INode::Ideal(PhaseGVN *phase, bool can_reshape) {
assert( x != andl && y != andl, "dead loop in ConvL2INode::Ideal" ); assert( x != andl && y != andl, "dead loop in ConvL2INode::Ideal" );
if (phase->type(x) == Type::TOP) return NULL; if (phase->type(x) == Type::TOP) return NULL;
if (phase->type(y) == Type::TOP) return NULL; if (phase->type(y) == Type::TOP) return NULL;
Node *add1 = phase->transform(new (phase->C) ConvL2INode(x)); Node *add1 = phase->transform(new ConvL2INode(x));
Node *add2 = phase->transform(new (phase->C) ConvL2INode(y)); Node *add2 = phase->transform(new ConvL2INode(y));
return new (phase->C) AddINode(add1,add2); return new AddINode(add1,add2);
} }
// Disable optimization: LoadL->ConvL2I ==> LoadI. // Disable optimization: LoadL->ConvL2I ==> LoadI.

View File

@ -106,7 +106,7 @@ static Node *transform_int_divide( PhaseGVN *phase, Node *dividend, jint divisor
// division by +/- 1 // division by +/- 1
if (!d_pos) { if (!d_pos) {
// Just negate the value // Just negate the value
q = new (phase->C) SubINode(phase->intcon(0), dividend); q = new SubINode(phase->intcon(0), dividend);
} }
} else if ( is_power_of_2(d) ) { } else if ( is_power_of_2(d) ) {
// division by +/- a power of 2 // division by +/- a power of 2
@ -143,18 +143,18 @@ static Node *transform_int_divide( PhaseGVN *phase, Node *dividend, jint divisor
// (-2+3)>>2 becomes 0, etc. // (-2+3)>>2 becomes 0, etc.
// Compute 0 or -1, based on sign bit // Compute 0 or -1, based on sign bit
Node *sign = phase->transform(new (phase->C) RShiftINode(dividend, phase->intcon(N - 1))); Node *sign = phase->transform(new RShiftINode(dividend, phase->intcon(N - 1)));
// Mask sign bit to the low sign bits // Mask sign bit to the low sign bits
Node *round = phase->transform(new (phase->C) URShiftINode(sign, phase->intcon(N - l))); Node *round = phase->transform(new URShiftINode(sign, phase->intcon(N - l)));
// Round up before shifting // Round up before shifting
dividend = phase->transform(new (phase->C) AddINode(dividend, round)); dividend = phase->transform(new AddINode(dividend, round));
} }
// Shift for division // Shift for division
q = new (phase->C) RShiftINode(dividend, phase->intcon(l)); q = new RShiftINode(dividend, phase->intcon(l));
if (!d_pos) { if (!d_pos) {
q = new (phase->C) SubINode(phase->intcon(0), phase->transform(q)); q = new SubINode(phase->intcon(0), phase->transform(q));
} }
} else { } else {
// Attempt the jint constant divide -> multiply transform found in // Attempt the jint constant divide -> multiply transform found in
@ -166,33 +166,33 @@ static Node *transform_int_divide( PhaseGVN *phase, Node *dividend, jint divisor
jint shift_const; jint shift_const;
if (magic_int_divide_constants(d, magic_const, shift_const)) { if (magic_int_divide_constants(d, magic_const, shift_const)) {
Node *magic = phase->longcon(magic_const); Node *magic = phase->longcon(magic_const);
Node *dividend_long = phase->transform(new (phase->C) ConvI2LNode(dividend)); Node *dividend_long = phase->transform(new ConvI2LNode(dividend));
// Compute the high half of the dividend x magic multiplication // Compute the high half of the dividend x magic multiplication
Node *mul_hi = phase->transform(new (phase->C) MulLNode(dividend_long, magic)); Node *mul_hi = phase->transform(new MulLNode(dividend_long, magic));
if (magic_const < 0) { if (magic_const < 0) {
mul_hi = phase->transform(new (phase->C) RShiftLNode(mul_hi, phase->intcon(N))); mul_hi = phase->transform(new RShiftLNode(mul_hi, phase->intcon(N)));
mul_hi = phase->transform(new (phase->C) ConvL2INode(mul_hi)); mul_hi = phase->transform(new ConvL2INode(mul_hi));
// The magic multiplier is too large for a 32 bit constant. We've adjusted // The magic multiplier is too large for a 32 bit constant. We've adjusted
// it down by 2^32, but have to add 1 dividend back in after the multiplication. // it down by 2^32, but have to add 1 dividend back in after the multiplication.
// This handles the "overflow" case described by Granlund and Montgomery. // This handles the "overflow" case described by Granlund and Montgomery.
mul_hi = phase->transform(new (phase->C) AddINode(dividend, mul_hi)); mul_hi = phase->transform(new AddINode(dividend, mul_hi));
// Shift over the (adjusted) mulhi // Shift over the (adjusted) mulhi
if (shift_const != 0) { if (shift_const != 0) {
mul_hi = phase->transform(new (phase->C) RShiftINode(mul_hi, phase->intcon(shift_const))); mul_hi = phase->transform(new RShiftINode(mul_hi, phase->intcon(shift_const)));
} }
} else { } else {
// No add is required, we can merge the shifts together. // No add is required, we can merge the shifts together.
mul_hi = phase->transform(new (phase->C) RShiftLNode(mul_hi, phase->intcon(N + shift_const))); mul_hi = phase->transform(new RShiftLNode(mul_hi, phase->intcon(N + shift_const)));
mul_hi = phase->transform(new (phase->C) ConvL2INode(mul_hi)); mul_hi = phase->transform(new ConvL2INode(mul_hi));
} }
// Get a 0 or -1 from the sign of the dividend. // Get a 0 or -1 from the sign of the dividend.
Node *addend0 = mul_hi; Node *addend0 = mul_hi;
Node *addend1 = phase->transform(new (phase->C) RShiftINode(dividend, phase->intcon(N-1))); Node *addend1 = phase->transform(new RShiftINode(dividend, phase->intcon(N-1)));
// If the divisor is negative, swap the order of the input addends; // If the divisor is negative, swap the order of the input addends;
// this has the effect of negating the quotient. // this has the effect of negating the quotient.
@ -202,7 +202,7 @@ static Node *transform_int_divide( PhaseGVN *phase, Node *dividend, jint divisor
// Adjust the final quotient by subtracting -1 (adding 1) // Adjust the final quotient by subtracting -1 (adding 1)
// from the mul_hi. // from the mul_hi.
q = new (phase->C) SubINode(addend0, addend1); q = new SubINode(addend0, addend1);
} }
} }
@ -261,7 +261,7 @@ static Node* long_by_long_mulhi(PhaseGVN* phase, Node* dividend, jlong magic_con
// no need to synthesize it in ideal nodes. // no need to synthesize it in ideal nodes.
if (Matcher::has_match_rule(Op_MulHiL)) { if (Matcher::has_match_rule(Op_MulHiL)) {
Node* v = phase->longcon(magic_const); Node* v = phase->longcon(magic_const);
return new (phase->C) MulHiLNode(dividend, v); return new MulHiLNode(dividend, v);
} }
// Taken from Hacker's Delight, Fig. 8-2. Multiply high signed. // Taken from Hacker's Delight, Fig. 8-2. Multiply high signed.
@ -287,11 +287,11 @@ static Node* long_by_long_mulhi(PhaseGVN* phase, Node* dividend, jlong magic_con
const int N = 64; const int N = 64;
// Dummy node to keep intermediate nodes alive during construction // Dummy node to keep intermediate nodes alive during construction
Node* hook = new (phase->C) Node(4); Node* hook = new Node(4);
// u0 = u & 0xFFFFFFFF; u1 = u >> 32; // u0 = u & 0xFFFFFFFF; u1 = u >> 32;
Node* u0 = phase->transform(new (phase->C) AndLNode(dividend, phase->longcon(0xFFFFFFFF))); Node* u0 = phase->transform(new AndLNode(dividend, phase->longcon(0xFFFFFFFF)));
Node* u1 = phase->transform(new (phase->C) RShiftLNode(dividend, phase->intcon(N / 2))); Node* u1 = phase->transform(new RShiftLNode(dividend, phase->intcon(N / 2)));
hook->init_req(0, u0); hook->init_req(0, u0);
hook->init_req(1, u1); hook->init_req(1, u1);
@ -300,29 +300,29 @@ static Node* long_by_long_mulhi(PhaseGVN* phase, Node* dividend, jlong magic_con
Node* v1 = phase->longcon(magic_const >> (N / 2)); Node* v1 = phase->longcon(magic_const >> (N / 2));
// w0 = u0*v0; // w0 = u0*v0;
Node* w0 = phase->transform(new (phase->C) MulLNode(u0, v0)); Node* w0 = phase->transform(new MulLNode(u0, v0));
// t = u1*v0 + (w0 >> 32); // t = u1*v0 + (w0 >> 32);
Node* u1v0 = phase->transform(new (phase->C) MulLNode(u1, v0)); Node* u1v0 = phase->transform(new MulLNode(u1, v0));
Node* temp = phase->transform(new (phase->C) URShiftLNode(w0, phase->intcon(N / 2))); Node* temp = phase->transform(new URShiftLNode(w0, phase->intcon(N / 2)));
Node* t = phase->transform(new (phase->C) AddLNode(u1v0, temp)); Node* t = phase->transform(new AddLNode(u1v0, temp));
hook->init_req(2, t); hook->init_req(2, t);
// w1 = t & 0xFFFFFFFF; // w1 = t & 0xFFFFFFFF;
Node* w1 = phase->transform(new (phase->C) AndLNode(t, phase->longcon(0xFFFFFFFF))); Node* w1 = phase->transform(new AndLNode(t, phase->longcon(0xFFFFFFFF)));
hook->init_req(3, w1); hook->init_req(3, w1);
// w2 = t >> 32; // w2 = t >> 32;
Node* w2 = phase->transform(new (phase->C) RShiftLNode(t, phase->intcon(N / 2))); Node* w2 = phase->transform(new RShiftLNode(t, phase->intcon(N / 2)));
// w1 = u0*v1 + w1; // w1 = u0*v1 + w1;
Node* u0v1 = phase->transform(new (phase->C) MulLNode(u0, v1)); Node* u0v1 = phase->transform(new MulLNode(u0, v1));
w1 = phase->transform(new (phase->C) AddLNode(u0v1, w1)); w1 = phase->transform(new AddLNode(u0v1, w1));
// return u1*v1 + w2 + (w1 >> 32); // return u1*v1 + w2 + (w1 >> 32);
Node* u1v1 = phase->transform(new (phase->C) MulLNode(u1, v1)); Node* u1v1 = phase->transform(new MulLNode(u1, v1));
Node* temp1 = phase->transform(new (phase->C) AddLNode(u1v1, w2)); Node* temp1 = phase->transform(new AddLNode(u1v1, w2));
Node* temp2 = phase->transform(new (phase->C) RShiftLNode(w1, phase->intcon(N / 2))); Node* temp2 = phase->transform(new RShiftLNode(w1, phase->intcon(N / 2)));
// Remove the bogus extra edges used to keep things alive // Remove the bogus extra edges used to keep things alive
PhaseIterGVN* igvn = phase->is_IterGVN(); PhaseIterGVN* igvn = phase->is_IterGVN();
@ -334,7 +334,7 @@ static Node* long_by_long_mulhi(PhaseGVN* phase, Node* dividend, jlong magic_con
} }
} }
return new (phase->C) AddLNode(temp1, temp2); return new AddLNode(temp1, temp2);
} }
@ -357,7 +357,7 @@ static Node *transform_long_divide( PhaseGVN *phase, Node *dividend, jlong divis
// division by +/- 1 // division by +/- 1
if (!d_pos) { if (!d_pos) {
// Just negate the value // Just negate the value
q = new (phase->C) SubLNode(phase->longcon(0), dividend); q = new SubLNode(phase->longcon(0), dividend);
} }
} else if ( is_power_of_2_long(d) ) { } else if ( is_power_of_2_long(d) ) {
@ -396,18 +396,18 @@ static Node *transform_long_divide( PhaseGVN *phase, Node *dividend, jlong divis
// (-2+3)>>2 becomes 0, etc. // (-2+3)>>2 becomes 0, etc.
// Compute 0 or -1, based on sign bit // Compute 0 or -1, based on sign bit
Node *sign = phase->transform(new (phase->C) RShiftLNode(dividend, phase->intcon(N - 1))); Node *sign = phase->transform(new RShiftLNode(dividend, phase->intcon(N - 1)));
// Mask sign bit to the low sign bits // Mask sign bit to the low sign bits
Node *round = phase->transform(new (phase->C) URShiftLNode(sign, phase->intcon(N - l))); Node *round = phase->transform(new URShiftLNode(sign, phase->intcon(N - l)));
// Round up before shifting // Round up before shifting
dividend = phase->transform(new (phase->C) AddLNode(dividend, round)); dividend = phase->transform(new AddLNode(dividend, round));
} }
// Shift for division // Shift for division
q = new (phase->C) RShiftLNode(dividend, phase->intcon(l)); q = new RShiftLNode(dividend, phase->intcon(l));
if (!d_pos) { if (!d_pos) {
q = new (phase->C) SubLNode(phase->longcon(0), phase->transform(q)); q = new SubLNode(phase->longcon(0), phase->transform(q));
} }
} else if ( !Matcher::use_asm_for_ldiv_by_con(d) ) { // Use hardware DIV instruction when } else if ( !Matcher::use_asm_for_ldiv_by_con(d) ) { // Use hardware DIV instruction when
// it is faster than code generated below. // it is faster than code generated below.
@ -427,17 +427,17 @@ static Node *transform_long_divide( PhaseGVN *phase, Node *dividend, jlong divis
// The magic multiplier is too large for a 64 bit constant. We've adjusted // The magic multiplier is too large for a 64 bit constant. We've adjusted
// it down by 2^64, but have to add 1 dividend back in after the multiplication. // it down by 2^64, but have to add 1 dividend back in after the multiplication.
// This handles the "overflow" case described by Granlund and Montgomery. // This handles the "overflow" case described by Granlund and Montgomery.
mul_hi = phase->transform(new (phase->C) AddLNode(dividend, mul_hi)); mul_hi = phase->transform(new AddLNode(dividend, mul_hi));
} }
// Shift over the (adjusted) mulhi // Shift over the (adjusted) mulhi
if (shift_const != 0) { if (shift_const != 0) {
mul_hi = phase->transform(new (phase->C) RShiftLNode(mul_hi, phase->intcon(shift_const))); mul_hi = phase->transform(new RShiftLNode(mul_hi, phase->intcon(shift_const)));
} }
// Get a 0 or -1 from the sign of the dividend. // Get a 0 or -1 from the sign of the dividend.
Node *addend0 = mul_hi; Node *addend0 = mul_hi;
Node *addend1 = phase->transform(new (phase->C) RShiftLNode(dividend, phase->intcon(N-1))); Node *addend1 = phase->transform(new RShiftLNode(dividend, phase->intcon(N-1)));
// If the divisor is negative, swap the order of the input addends; // If the divisor is negative, swap the order of the input addends;
// this has the effect of negating the quotient. // this has the effect of negating the quotient.
@ -447,7 +447,7 @@ static Node *transform_long_divide( PhaseGVN *phase, Node *dividend, jlong divis
// Adjust the final quotient by subtracting -1 (adding 1) // Adjust the final quotient by subtracting -1 (adding 1)
// from the mul_hi. // from the mul_hi.
q = new (phase->C) SubLNode(addend0, addend1); q = new SubLNode(addend0, addend1);
} }
} }
@ -737,7 +737,7 @@ Node *DivFNode::Ideal(PhaseGVN *phase, bool can_reshape) {
assert( frexp((double)reciprocal, &exp) == 0.5, "reciprocal should be power of 2" ); assert( frexp((double)reciprocal, &exp) == 0.5, "reciprocal should be power of 2" );
// return multiplication by the reciprocal // return multiplication by the reciprocal
return (new (phase->C) MulFNode(in(1), phase->makecon(TypeF::make(reciprocal)))); return (new MulFNode(in(1), phase->makecon(TypeF::make(reciprocal))));
} }
//============================================================================= //=============================================================================
@ -831,7 +831,7 @@ Node *DivDNode::Ideal(PhaseGVN *phase, bool can_reshape) {
assert( frexp(reciprocal, &exp) == 0.5, "reciprocal should be power of 2" ); assert( frexp(reciprocal, &exp) == 0.5, "reciprocal should be power of 2" );
// return multiplication by the reciprocal // return multiplication by the reciprocal
return (new (phase->C) MulDNode(in(1), phase->makecon(TypeD::make(reciprocal)))); return (new MulDNode(in(1), phase->makecon(TypeD::make(reciprocal))));
} }
//============================================================================= //=============================================================================
@ -858,7 +858,7 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) {
if( !ti->is_con() ) return NULL; if( !ti->is_con() ) return NULL;
jint con = ti->get_con(); jint con = ti->get_con();
Node *hook = new (phase->C) Node(1); Node *hook = new Node(1);
// First, special check for modulo 2^k-1 // First, special check for modulo 2^k-1
if( con >= 0 && con < max_jint && is_power_of_2(con+1) ) { if( con >= 0 && con < max_jint && is_power_of_2(con+1) ) {
@ -878,24 +878,24 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) {
hook->init_req(0, x); // Add a use to x to prevent him from dying hook->init_req(0, x); // Add a use to x to prevent him from dying
// Generate code to reduce X rapidly to nearly 2^k-1. // Generate code to reduce X rapidly to nearly 2^k-1.
for( int i = 0; i < trip_count; i++ ) { for( int i = 0; i < trip_count; i++ ) {
Node *xl = phase->transform( new (phase->C) AndINode(x,divisor) ); Node *xl = phase->transform( new AndINode(x,divisor) );
Node *xh = phase->transform( new (phase->C) RShiftINode(x,phase->intcon(k)) ); // Must be signed Node *xh = phase->transform( new RShiftINode(x,phase->intcon(k)) ); // Must be signed
x = phase->transform( new (phase->C) AddINode(xh,xl) ); x = phase->transform( new AddINode(xh,xl) );
hook->set_req(0, x); hook->set_req(0, x);
} }
// Generate sign-fixup code. Was original value positive? // Generate sign-fixup code. Was original value positive?
// int hack_res = (i >= 0) ? divisor : 1; // int hack_res = (i >= 0) ? divisor : 1;
Node *cmp1 = phase->transform( new (phase->C) CmpINode( in(1), phase->intcon(0) ) ); Node *cmp1 = phase->transform( new CmpINode( in(1), phase->intcon(0) ) );
Node *bol1 = phase->transform( new (phase->C) BoolNode( cmp1, BoolTest::ge ) ); Node *bol1 = phase->transform( new BoolNode( cmp1, BoolTest::ge ) );
Node *cmov1= phase->transform( new (phase->C) CMoveINode(bol1, phase->intcon(1), divisor, TypeInt::POS) ); Node *cmov1= phase->transform( new CMoveINode(bol1, phase->intcon(1), divisor, TypeInt::POS) );
// if( x >= hack_res ) x -= divisor; // if( x >= hack_res ) x -= divisor;
Node *sub = phase->transform( new (phase->C) SubINode( x, divisor ) ); Node *sub = phase->transform( new SubINode( x, divisor ) );
Node *cmp2 = phase->transform( new (phase->C) CmpINode( x, cmov1 ) ); Node *cmp2 = phase->transform( new CmpINode( x, cmov1 ) );
Node *bol2 = phase->transform( new (phase->C) BoolNode( cmp2, BoolTest::ge ) ); Node *bol2 = phase->transform( new BoolNode( cmp2, BoolTest::ge ) );
// Convention is to not transform the return value of an Ideal // Convention is to not transform the return value of an Ideal
// since Ideal is expected to return a modified 'this' or a new node. // since Ideal is expected to return a modified 'this' or a new node.
Node *cmov2= new (phase->C) CMoveINode(bol2, x, sub, TypeInt::INT); Node *cmov2= new CMoveINode(bol2, x, sub, TypeInt::INT);
// cmov2 is now the mod // cmov2 is now the mod
// Now remove the bogus extra edges used to keep things alive // Now remove the bogus extra edges used to keep things alive
@ -918,7 +918,7 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) {
jint pos_con = (con >= 0) ? con : -con; jint pos_con = (con >= 0) ? con : -con;
// integer Mod 1 is always 0 // integer Mod 1 is always 0
if( pos_con == 1 ) return new (phase->C) ConINode(TypeInt::ZERO); if( pos_con == 1 ) return new ConINode(TypeInt::ZERO);
int log2_con = -1; int log2_con = -1;
@ -931,7 +931,7 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) {
// See if this can be masked, if the dividend is non-negative // See if this can be masked, if the dividend is non-negative
if( dti && dti->_lo >= 0 ) if( dti && dti->_lo >= 0 )
return ( new (phase->C) AndINode( in(1), phase->intcon( pos_con-1 ) ) ); return ( new AndINode( in(1), phase->intcon( pos_con-1 ) ) );
} }
// Save in(1) so that it cannot be changed or deleted // Save in(1) so that it cannot be changed or deleted
@ -946,12 +946,12 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node *mult = NULL; Node *mult = NULL;
if( log2_con >= 0 ) if( log2_con >= 0 )
mult = phase->transform( new (phase->C) LShiftINode( divide, phase->intcon( log2_con ) ) ); mult = phase->transform( new LShiftINode( divide, phase->intcon( log2_con ) ) );
else else
mult = phase->transform( new (phase->C) MulINode( divide, phase->intcon( pos_con ) ) ); mult = phase->transform( new MulINode( divide, phase->intcon( pos_con ) ) );
// Finally, subtract the multiplied divided value from the original // Finally, subtract the multiplied divided value from the original
result = new (phase->C) SubINode( in(1), mult ); result = new SubINode( in(1), mult );
} }
// Now remove the bogus extra edges used to keep things alive // Now remove the bogus extra edges used to keep things alive
@ -1029,7 +1029,7 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if( !tl->is_con() ) return NULL; if( !tl->is_con() ) return NULL;
jlong con = tl->get_con(); jlong con = tl->get_con();
Node *hook = new (phase->C) Node(1); Node *hook = new Node(1);
// Expand mod // Expand mod
if( con >= 0 && con < max_jlong && is_power_of_2_long(con+1) ) { if( con >= 0 && con < max_jlong && is_power_of_2_long(con+1) ) {
@ -1051,24 +1051,24 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
hook->init_req(0, x); // Add a use to x to prevent him from dying hook->init_req(0, x); // Add a use to x to prevent him from dying
// Generate code to reduce X rapidly to nearly 2^k-1. // Generate code to reduce X rapidly to nearly 2^k-1.
for( int i = 0; i < trip_count; i++ ) { for( int i = 0; i < trip_count; i++ ) {
Node *xl = phase->transform( new (phase->C) AndLNode(x,divisor) ); Node *xl = phase->transform( new AndLNode(x,divisor) );
Node *xh = phase->transform( new (phase->C) RShiftLNode(x,phase->intcon(k)) ); // Must be signed Node *xh = phase->transform( new RShiftLNode(x,phase->intcon(k)) ); // Must be signed
x = phase->transform( new (phase->C) AddLNode(xh,xl) ); x = phase->transform( new AddLNode(xh,xl) );
hook->set_req(0, x); // Add a use to x to prevent him from dying hook->set_req(0, x); // Add a use to x to prevent him from dying
} }
// Generate sign-fixup code. Was original value positive? // Generate sign-fixup code. Was original value positive?
// long hack_res = (i >= 0) ? divisor : CONST64(1); // long hack_res = (i >= 0) ? divisor : CONST64(1);
Node *cmp1 = phase->transform( new (phase->C) CmpLNode( in(1), phase->longcon(0) ) ); Node *cmp1 = phase->transform( new CmpLNode( in(1), phase->longcon(0) ) );
Node *bol1 = phase->transform( new (phase->C) BoolNode( cmp1, BoolTest::ge ) ); Node *bol1 = phase->transform( new BoolNode( cmp1, BoolTest::ge ) );
Node *cmov1= phase->transform( new (phase->C) CMoveLNode(bol1, phase->longcon(1), divisor, TypeLong::LONG) ); Node *cmov1= phase->transform( new CMoveLNode(bol1, phase->longcon(1), divisor, TypeLong::LONG) );
// if( x >= hack_res ) x -= divisor; // if( x >= hack_res ) x -= divisor;
Node *sub = phase->transform( new (phase->C) SubLNode( x, divisor ) ); Node *sub = phase->transform( new SubLNode( x, divisor ) );
Node *cmp2 = phase->transform( new (phase->C) CmpLNode( x, cmov1 ) ); Node *cmp2 = phase->transform( new CmpLNode( x, cmov1 ) );
Node *bol2 = phase->transform( new (phase->C) BoolNode( cmp2, BoolTest::ge ) ); Node *bol2 = phase->transform( new BoolNode( cmp2, BoolTest::ge ) );
// Convention is to not transform the return value of an Ideal // Convention is to not transform the return value of an Ideal
// since Ideal is expected to return a modified 'this' or a new node. // since Ideal is expected to return a modified 'this' or a new node.
Node *cmov2= new (phase->C) CMoveLNode(bol2, x, sub, TypeLong::LONG); Node *cmov2= new CMoveLNode(bol2, x, sub, TypeLong::LONG);
// cmov2 is now the mod // cmov2 is now the mod
// Now remove the bogus extra edges used to keep things alive // Now remove the bogus extra edges used to keep things alive
@ -1091,7 +1091,7 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
jlong pos_con = (con >= 0) ? con : -con; jlong pos_con = (con >= 0) ? con : -con;
// integer Mod 1 is always 0 // integer Mod 1 is always 0
if( pos_con == 1 ) return new (phase->C) ConLNode(TypeLong::ZERO); if( pos_con == 1 ) return new ConLNode(TypeLong::ZERO);
int log2_con = -1; int log2_con = -1;
@ -1104,7 +1104,7 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// See if this can be masked, if the dividend is non-negative // See if this can be masked, if the dividend is non-negative
if( dtl && dtl->_lo >= 0 ) if( dtl && dtl->_lo >= 0 )
return ( new (phase->C) AndLNode( in(1), phase->longcon( pos_con-1 ) ) ); return ( new AndLNode( in(1), phase->longcon( pos_con-1 ) ) );
} }
// Save in(1) so that it cannot be changed or deleted // Save in(1) so that it cannot be changed or deleted
@ -1119,12 +1119,12 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node *mult = NULL; Node *mult = NULL;
if( log2_con >= 0 ) if( log2_con >= 0 )
mult = phase->transform( new (phase->C) LShiftLNode( divide, phase->intcon( log2_con ) ) ); mult = phase->transform( new LShiftLNode( divide, phase->intcon( log2_con ) ) );
else else
mult = phase->transform( new (phase->C) MulLNode( divide, phase->longcon( pos_con ) ) ); mult = phase->transform( new MulLNode( divide, phase->longcon( pos_con ) ) );
// Finally, subtract the multiplied divided value from the original // Finally, subtract the multiplied divided value from the original
result = new (phase->C) SubLNode( in(1), mult ); result = new SubLNode( in(1), mult );
} }
// Now remove the bogus extra edges used to keep things alive // Now remove the bogus extra edges used to keep things alive
@ -1279,9 +1279,9 @@ DivModINode* DivModINode::make(Compile* C, Node* div_or_mod) {
assert(n->Opcode() == Op_DivI || n->Opcode() == Op_ModI, assert(n->Opcode() == Op_DivI || n->Opcode() == Op_ModI,
"only div or mod input pattern accepted"); "only div or mod input pattern accepted");
DivModINode* divmod = new (C) DivModINode(n->in(0), n->in(1), n->in(2)); DivModINode* divmod = new DivModINode(n->in(0), n->in(1), n->in(2));
Node* dproj = new (C) ProjNode(divmod, DivModNode::div_proj_num); Node* dproj = new ProjNode(divmod, DivModNode::div_proj_num);
Node* mproj = new (C) ProjNode(divmod, DivModNode::mod_proj_num); Node* mproj = new ProjNode(divmod, DivModNode::mod_proj_num);
return divmod; return divmod;
} }
@ -1291,9 +1291,9 @@ DivModLNode* DivModLNode::make(Compile* C, Node* div_or_mod) {
assert(n->Opcode() == Op_DivL || n->Opcode() == Op_ModL, assert(n->Opcode() == Op_DivL || n->Opcode() == Op_ModL,
"only div or mod input pattern accepted"); "only div or mod input pattern accepted");
DivModLNode* divmod = new (C) DivModLNode(n->in(0), n->in(1), n->in(2)); DivModLNode* divmod = new DivModLNode(n->in(0), n->in(1), n->in(2));
Node* dproj = new (C) ProjNode(divmod, DivModNode::div_proj_num); Node* dproj = new ProjNode(divmod, DivModNode::div_proj_num);
Node* mproj = new (C) ProjNode(divmod, DivModNode::mod_proj_num); Node* mproj = new ProjNode(divmod, DivModNode::mod_proj_num);
return divmod; return divmod;
} }
@ -1308,7 +1308,7 @@ Node *DivModINode::match( const ProjNode *proj, const Matcher *match ) {
assert(proj->_con == mod_proj_num, "must be div or mod projection"); assert(proj->_con == mod_proj_num, "must be div or mod projection");
rm = match->modI_proj_mask(); rm = match->modI_proj_mask();
} }
return new (match->C)MachProjNode(this, proj->_con, rm, ideal_reg); return new MachProjNode(this, proj->_con, rm, ideal_reg);
} }
@ -1323,5 +1323,5 @@ Node *DivModLNode::match( const ProjNode *proj, const Matcher *match ) {
assert(proj->_con == mod_proj_num, "must be div or mod projection"); assert(proj->_con == mod_proj_num, "must be div or mod projection");
rm = match->modL_proj_mask(); rm = match->modL_proj_mask();
} }
return new (match->C)MachProjNode(this, proj->_con, rm, ideal_reg); return new MachProjNode(this, proj->_con, rm, ideal_reg);
} }

View File

@ -119,12 +119,12 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
if (allow_inline && allow_intrinsics) { if (allow_inline && allow_intrinsics) {
CallGenerator* cg = find_intrinsic(callee, call_does_dispatch); CallGenerator* cg = find_intrinsic(callee, call_does_dispatch);
if (cg != NULL) { if (cg != NULL) {
if (cg->is_predicted()) { if (cg->is_predicated()) {
// Code without intrinsic but, hopefully, inlined. // Code without intrinsic but, hopefully, inlined.
CallGenerator* inline_cg = this->call_generator(callee, CallGenerator* inline_cg = this->call_generator(callee,
vtable_index, call_does_dispatch, jvms, allow_inline, prof_factor, speculative_receiver_type, false); vtable_index, call_does_dispatch, jvms, allow_inline, prof_factor, speculative_receiver_type, false);
if (inline_cg != NULL) { if (inline_cg != NULL) {
cg = CallGenerator::for_predicted_intrinsic(cg, inline_cg); cg = CallGenerator::for_predicated_intrinsic(cg, inline_cg);
} }
} }
@ -525,7 +525,7 @@ void Parse::do_call() {
// because exceptions don't return to the call site.) // because exceptions don't return to the call site.)
profile_call(receiver); profile_call(receiver);
JVMState* new_jvms = cg->generate(jvms, this); JVMState* new_jvms = cg->generate(jvms);
if (new_jvms == NULL) { if (new_jvms == NULL) {
// When inlining attempt fails (e.g., too many arguments), // When inlining attempt fails (e.g., too many arguments),
// it may contaminate the current compile state, making it // it may contaminate the current compile state, making it
@ -539,7 +539,7 @@ void Parse::do_call() {
// intrinsic was expecting to optimize. Should always be possible to // intrinsic was expecting to optimize. Should always be possible to
// get a normal java call that may inline in that case // get a normal java call that may inline in that case
cg = C->call_generator(cg->method(), vtable_index, call_does_dispatch, jvms, try_inline, prof_factor(), speculative_receiver_type, /* allow_intrinsics= */ false); cg = C->call_generator(cg->method(), vtable_index, call_does_dispatch, jvms, try_inline, prof_factor(), speculative_receiver_type, /* allow_intrinsics= */ false);
new_jvms = cg->generate(jvms, this); new_jvms = cg->generate(jvms);
if (new_jvms == NULL) { if (new_jvms == NULL) {
guarantee(failing(), "call failed to generate: calls should work"); guarantee(failing(), "call failed to generate: calls should work");
return; return;
@ -596,7 +596,7 @@ void Parse::do_call() {
const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass());
if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
Node* retnode = pop(); Node* retnode = pop();
Node* cast_obj = _gvn.transform(new (C) CheckCastPPNode(control(), retnode, sig_type)); Node* cast_obj = _gvn.transform(new CheckCastPPNode(control(), retnode, sig_type));
push(cast_obj); push(cast_obj);
} }
} }
@ -689,7 +689,7 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) {
} }
int len = bcis->length(); int len = bcis->length();
CatchNode *cn = new (C) CatchNode(control(), i_o, len+1); CatchNode *cn = new CatchNode(control(), i_o, len+1);
Node *catch_ = _gvn.transform(cn); Node *catch_ = _gvn.transform(cn);
// now branch with the exception state to each of the (potential) // now branch with the exception state to each of the (potential)
@ -700,14 +700,14 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) {
// Locals are just copied from before the call. // Locals are just copied from before the call.
// Get control from the CatchNode. // Get control from the CatchNode.
int handler_bci = bcis->at(i); int handler_bci = bcis->at(i);
Node* ctrl = _gvn.transform( new (C) CatchProjNode(catch_, i+1,handler_bci)); Node* ctrl = _gvn.transform( new CatchProjNode(catch_, i+1,handler_bci));
// This handler cannot happen? // This handler cannot happen?
if (ctrl == top()) continue; if (ctrl == top()) continue;
set_control(ctrl); set_control(ctrl);
// Create exception oop // Create exception oop
const TypeInstPtr* extype = extypes->at(i)->is_instptr(); const TypeInstPtr* extype = extypes->at(i)->is_instptr();
Node *ex_oop = _gvn.transform(new (C) CreateExNode(extypes->at(i), ctrl, i_o)); Node *ex_oop = _gvn.transform(new CreateExNode(extypes->at(i), ctrl, i_o));
// Handle unloaded exception classes. // Handle unloaded exception classes.
if (saw_unloaded->contains(handler_bci)) { if (saw_unloaded->contains(handler_bci)) {
@ -746,7 +746,7 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) {
// The first CatchProj is for the normal return. // The first CatchProj is for the normal return.
// (Note: If this is a call to rethrow_Java, this node goes dead.) // (Note: If this is a call to rethrow_Java, this node goes dead.)
set_control(_gvn.transform( new (C) CatchProjNode(catch_, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci))); set_control(_gvn.transform( new CatchProjNode(catch_, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci)));
} }
@ -797,7 +797,7 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
// I'm loading the class from, I can replace the LoadKlass with the // I'm loading the class from, I can replace the LoadKlass with the
// klass constant for the exception oop. // klass constant for the exception oop.
if( ex_node->is_Phi() ) { if( ex_node->is_Phi() ) {
ex_klass_node = new (C) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); ex_klass_node = new PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT );
for( uint i = 1; i < ex_node->req(); i++ ) { for( uint i = 1; i < ex_node->req(); i++ ) {
Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() ); Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() );
Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) );
@ -863,7 +863,7 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
PreserveJVMState pjvms(this); PreserveJVMState pjvms(this);
const TypeInstPtr* tinst = TypeOopPtr::make_from_klass_unique(klass)->cast_to_ptr_type(TypePtr::NotNull)->is_instptr(); const TypeInstPtr* tinst = TypeOopPtr::make_from_klass_unique(klass)->cast_to_ptr_type(TypePtr::NotNull)->is_instptr();
assert(klass->has_subklass() || tinst->klass_is_exact(), "lost exactness"); assert(klass->has_subklass() || tinst->klass_is_exact(), "lost exactness");
Node* ex_oop = _gvn.transform(new (C) CheckCastPPNode(control(), ex_node, tinst)); Node* ex_oop = _gvn.transform(new CheckCastPPNode(control(), ex_node, tinst));
push_ex_oop(ex_oop); // Push exception oop for handler push_ex_oop(ex_oop); // Push exception oop for handler
#ifndef PRODUCT #ifndef PRODUCT
if (PrintOpto && WizardMode) { if (PrintOpto && WizardMode) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2014, 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
@ -939,7 +939,13 @@ void ConnectionGraph::process_call_arguments(CallNode *call) {
strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 || strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 || strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||
strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 || strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 ||
strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0) strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 ||
strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 ||
strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 ||
strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 ||
strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 ||
strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 ||
strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0)
))) { ))) {
call->dump(); call->dump();
fatal(err_msg_res("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name)); fatal(err_msg_res("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name));

View File

@ -50,7 +50,7 @@ void GraphKit::gen_stub(address C_function,
const TypeTuple *jrange = C->tf()->range(); const TypeTuple *jrange = C->tf()->range();
// The procedure start // The procedure start
StartNode* start = new (C) StartNode(root(), jdomain); StartNode* start = new StartNode(root(), jdomain);
_gvn.set_type_bottom(start); _gvn.set_type_bottom(start);
// Make a map, with JVM state // Make a map, with JVM state
@ -64,7 +64,7 @@ void GraphKit::gen_stub(address C_function,
jvms->set_scloff(max_map); jvms->set_scloff(max_map);
jvms->set_endoff(max_map); jvms->set_endoff(max_map);
{ {
SafePointNode *map = new (C) SafePointNode( max_map, jvms ); SafePointNode *map = new SafePointNode( max_map, jvms );
jvms->set_map(map); jvms->set_map(map);
set_jvms(jvms); set_jvms(jvms);
assert(map == this->map(), "kit.map is set"); assert(map == this->map(), "kit.map is set");
@ -73,7 +73,7 @@ void GraphKit::gen_stub(address C_function,
// Make up the parameters // Make up the parameters
uint i; uint i;
for( i = 0; i < parm_cnt; i++ ) for( i = 0; i < parm_cnt; i++ )
map()->init_req(i, _gvn.transform(new (C) ParmNode(start, i))); map()->init_req(i, _gvn.transform(new ParmNode(start, i)));
for( ; i<map()->req(); i++ ) for( ; i<map()->req(); i++ )
map()->init_req(i, top()); // For nicer debugging map()->init_req(i, top()); // For nicer debugging
@ -81,7 +81,7 @@ void GraphKit::gen_stub(address C_function,
set_all_memory(map()->memory()); set_all_memory(map()->memory());
// Get base of thread-local storage area // Get base of thread-local storage area
Node* thread = _gvn.transform( new (C) ThreadLocalNode() ); Node* thread = _gvn.transform( new ThreadLocalNode() );
const int NoAlias = Compile::AliasIdxBot; const int NoAlias = Compile::AliasIdxBot;
@ -166,8 +166,7 @@ void GraphKit::gen_stub(address C_function,
//----------------------------- //-----------------------------
// Make the call node // Make the call node
CallRuntimeNode *call = new (C) CallRuntimeNode *call = new CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM);
CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM);
//----------------------------- //-----------------------------
// Fix-up the debug info for the call // Fix-up the debug info for the call
@ -184,7 +183,7 @@ void GraphKit::gen_stub(address C_function,
for (; i < parm_cnt; i++) { // Regular input arguments for (; i < parm_cnt; i++) { // Regular input arguments
// Convert ints to longs if required. // Convert ints to longs if required.
if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(i)->isa_int()) { if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(i)->isa_int()) {
Node* int_as_long = _gvn.transform(new (C) ConvI2LNode(map()->in(i))); Node* int_as_long = _gvn.transform(new ConvI2LNode(map()->in(i)));
call->init_req(cnt++, int_as_long); // long call->init_req(cnt++, int_as_long); // long
call->init_req(cnt++, top()); // half call->init_req(cnt++, top()); // half
} else { } else {
@ -200,23 +199,23 @@ void GraphKit::gen_stub(address C_function,
//----------------------------- //-----------------------------
// Now set up the return results // Now set up the return results
set_control( _gvn.transform( new (C) ProjNode(call,TypeFunc::Control)) ); set_control( _gvn.transform( new ProjNode(call,TypeFunc::Control)) );
set_i_o( _gvn.transform( new (C) ProjNode(call,TypeFunc::I_O )) ); set_i_o( _gvn.transform( new ProjNode(call,TypeFunc::I_O )) );
set_all_memory_call(call); set_all_memory_call(call);
if (range->cnt() > TypeFunc::Parms) { if (range->cnt() > TypeFunc::Parms) {
Node* retnode = _gvn.transform( new (C) ProjNode(call,TypeFunc::Parms) ); Node* retnode = _gvn.transform( new ProjNode(call,TypeFunc::Parms) );
// C-land is allowed to return sub-word values. Convert to integer type. // C-land is allowed to return sub-word values. Convert to integer type.
assert( retval != Type::TOP, "" ); assert( retval != Type::TOP, "" );
if (retval == TypeInt::BOOL) { if (retval == TypeInt::BOOL) {
retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFF)) ); retnode = _gvn.transform( new AndINode(retnode, intcon(0xFF)) );
} else if (retval == TypeInt::CHAR) { } else if (retval == TypeInt::CHAR) {
retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFFFF)) ); retnode = _gvn.transform( new AndINode(retnode, intcon(0xFFFF)) );
} else if (retval == TypeInt::BYTE) { } else if (retval == TypeInt::BYTE) {
retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(24)) ); retnode = _gvn.transform( new LShiftINode(retnode, intcon(24)) );
retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(24)) ); retnode = _gvn.transform( new RShiftINode(retnode, intcon(24)) );
} else if (retval == TypeInt::SHORT) { } else if (retval == TypeInt::SHORT) {
retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(16)) ); retnode = _gvn.transform( new LShiftINode(retnode, intcon(16)) );
retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(16)) ); retnode = _gvn.transform( new RShiftINode(retnode, intcon(16)) );
} }
map()->set_req( TypeFunc::Parms, retnode ); map()->set_req( TypeFunc::Parms, retnode );
} }
@ -253,16 +252,16 @@ void GraphKit::gen_stub(address C_function,
Node* exit_memory = reset_memory(); Node* exit_memory = reset_memory();
Node* cmp = _gvn.transform( new (C) CmpPNode(pending, null()) ); Node* cmp = _gvn.transform( new CmpPNode(pending, null()) );
Node* bo = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ne) ); Node* bo = _gvn.transform( new BoolNode(cmp, BoolTest::ne) );
IfNode *iff = create_and_map_if(control(), bo, PROB_MIN, COUNT_UNKNOWN); IfNode *iff = create_and_map_if(control(), bo, PROB_MIN, COUNT_UNKNOWN);
Node* if_null = _gvn.transform( new (C) IfFalseNode(iff) ); Node* if_null = _gvn.transform( new IfFalseNode(iff) );
Node* if_not_null = _gvn.transform( new (C) IfTrueNode(iff) ); Node* if_not_null = _gvn.transform( new IfTrueNode(iff) );
assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before"); assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before");
Node *exc_target = makecon(TypeRawPtr::make( StubRoutines::forward_exception_entry() )); Node *exc_target = makecon(TypeRawPtr::make( StubRoutines::forward_exception_entry() ));
Node *to_exc = new (C) TailCallNode(if_not_null, Node *to_exc = new TailCallNode(if_not_null,
i_o(), i_o(),
exit_memory, exit_memory,
frameptr(), frameptr(),
@ -277,7 +276,7 @@ void GraphKit::gen_stub(address C_function,
switch( is_fancy_jump ) { switch( is_fancy_jump ) {
case 0: // Make a return instruction case 0: // Make a return instruction
// Return to caller, free any space for return address // Return to caller, free any space for return address
ret = new (C) ReturnNode(TypeFunc::Parms, if_null, ret = new ReturnNode(TypeFunc::Parms, if_null,
i_o(), i_o(),
exit_memory, exit_memory,
frameptr(), frameptr(),
@ -287,7 +286,7 @@ void GraphKit::gen_stub(address C_function,
break; break;
case 1: // This is a fancy tail-call jump. Jump to computed address. case 1: // This is a fancy tail-call jump. Jump to computed address.
// Jump to new callee; leave old return address alone. // Jump to new callee; leave old return address alone.
ret = new (C) TailCallNode(if_null, ret = new TailCallNode(if_null,
i_o(), i_o(),
exit_memory, exit_memory,
frameptr(), frameptr(),
@ -297,7 +296,7 @@ void GraphKit::gen_stub(address C_function,
case 2: // Pop return address & jump case 2: // Pop return address & jump
// Throw away old return address; jump to new computed address // Throw away old return address; jump to new computed address
//assert(C_function == CAST_FROM_FN_PTR(address, OptoRuntime::rethrow_C), "fancy_jump==2 only for rethrow"); //assert(C_function == CAST_FROM_FN_PTR(address, OptoRuntime::rethrow_C), "fancy_jump==2 only for rethrow");
ret = new (C) TailJumpNode(if_null, ret = new TailJumpNode(if_null,
i_o(), i_o(),
exit_memory, exit_memory,
frameptr(), frameptr(),

View File

@ -294,7 +294,7 @@ JVMState* GraphKit::transfer_exceptions_into_jvms() {
JVMState* jvms = new (C) JVMState(_method, NULL); JVMState* jvms = new (C) JVMState(_method, NULL);
jvms->set_bci(_bci); jvms->set_bci(_bci);
jvms->set_sp(_sp); jvms->set_sp(_sp);
jvms->set_map(new (C) SafePointNode(TypeFunc::Parms, jvms)); jvms->set_map(new SafePointNode(TypeFunc::Parms, jvms));
set_jvms(jvms); set_jvms(jvms);
for (uint i = 0; i < map()->req(); i++) map()->init_req(i, top()); for (uint i = 0; i < map()->req(); i++) map()->init_req(i, top());
set_all_memory(top()); set_all_memory(top());
@ -347,7 +347,7 @@ void GraphKit::combine_exception_states(SafePointNode* ex_map, SafePointNode* ph
if (region->in(0) != hidden_merge_mark) { if (region->in(0) != hidden_merge_mark) {
// The control input is not (yet) a specially-marked region in phi_map. // The control input is not (yet) a specially-marked region in phi_map.
// Make it so, and build some phis. // Make it so, and build some phis.
region = new (C) RegionNode(2); region = new RegionNode(2);
_gvn.set_type(region, Type::CONTROL); _gvn.set_type(region, Type::CONTROL);
region->set_req(0, hidden_merge_mark); // marks an internal ex-state region->set_req(0, hidden_merge_mark); // marks an internal ex-state
region->init_req(1, phi_map->control()); region->init_req(1, phi_map->control());
@ -432,6 +432,7 @@ void GraphKit::combine_exception_states(SafePointNode* ex_map, SafePointNode* ph
} }
} }
} }
phi_map->merge_replaced_nodes_with(ex_map);
} }
//--------------------------use_exception_state-------------------------------- //--------------------------use_exception_state--------------------------------
@ -496,13 +497,13 @@ void GraphKit::uncommon_trap_if_should_post_on_exceptions(Deoptimization::DeoptR
// take the uncommon_trap in the BuildCutout below. // take the uncommon_trap in the BuildCutout below.
// first must access the should_post_on_exceptions_flag in this thread's JavaThread // first must access the should_post_on_exceptions_flag in this thread's JavaThread
Node* jthread = _gvn.transform(new (C) ThreadLocalNode()); Node* jthread = _gvn.transform(new ThreadLocalNode());
Node* adr = basic_plus_adr(top(), jthread, in_bytes(JavaThread::should_post_on_exceptions_flag_offset())); Node* adr = basic_plus_adr(top(), jthread, in_bytes(JavaThread::should_post_on_exceptions_flag_offset()));
Node* should_post_flag = make_load(control(), adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw, MemNode::unordered); Node* should_post_flag = make_load(control(), adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw, MemNode::unordered);
// Test the should_post_on_exceptions_flag vs. 0 // Test the should_post_on_exceptions_flag vs. 0
Node* chk = _gvn.transform( new (C) CmpINode(should_post_flag, intcon(0)) ); Node* chk = _gvn.transform( new CmpINode(should_post_flag, intcon(0)) );
Node* tst = _gvn.transform( new (C) BoolNode(chk, BoolTest::eq) ); Node* tst = _gvn.transform( new BoolNode(chk, BoolTest::eq) );
// Branch to slow_path if should_post_on_exceptions_flag was true // Branch to slow_path if should_post_on_exceptions_flag was true
{ BuildCutout unless(this, tst, PROB_MAX); { BuildCutout unless(this, tst, PROB_MAX);
@ -645,7 +646,6 @@ PreserveJVMState::PreserveJVMState(GraphKit* kit, bool clone_map) {
_map = kit->map(); // preserve the map _map = kit->map(); // preserve the map
_sp = kit->sp(); _sp = kit->sp();
kit->set_map(clone_map ? kit->clone_map() : NULL); kit->set_map(clone_map ? kit->clone_map() : NULL);
Compile::current()->inc_preserve_jvm_state();
#ifdef ASSERT #ifdef ASSERT
_bci = kit->bci(); _bci = kit->bci();
Parse* parser = kit->is_Parse(); Parse* parser = kit->is_Parse();
@ -663,7 +663,6 @@ PreserveJVMState::~PreserveJVMState() {
#endif #endif
kit->set_map(_map); kit->set_map(_map);
kit->set_sp(_sp); kit->set_sp(_sp);
Compile::current()->dec_preserve_jvm_state();
} }
@ -675,8 +674,8 @@ BuildCutout::BuildCutout(GraphKit* kit, Node* p, float prob, float cnt)
SafePointNode* outer_map = _map; // preserved map is caller's SafePointNode* outer_map = _map; // preserved map is caller's
SafePointNode* inner_map = kit->map(); SafePointNode* inner_map = kit->map();
IfNode* iff = kit->create_and_map_if(outer_map->control(), p, prob, cnt); IfNode* iff = kit->create_and_map_if(outer_map->control(), p, prob, cnt);
outer_map->set_control(kit->gvn().transform( new (kit->C) IfTrueNode(iff) )); outer_map->set_control(kit->gvn().transform( new IfTrueNode(iff) ));
inner_map->set_control(kit->gvn().transform( new (kit->C) IfFalseNode(iff) )); inner_map->set_control(kit->gvn().transform( new IfFalseNode(iff) ));
} }
BuildCutout::~BuildCutout() { BuildCutout::~BuildCutout() {
GraphKit* kit = _kit; GraphKit* kit = _kit;
@ -1118,7 +1117,7 @@ bool GraphKit::compute_stack_effects(int& inputs, int& depth) {
Node* GraphKit::basic_plus_adr(Node* base, Node* ptr, Node* offset) { Node* GraphKit::basic_plus_adr(Node* base, Node* ptr, Node* offset) {
// short-circuit a common case // short-circuit a common case
if (offset == intcon(0)) return ptr; if (offset == intcon(0)) return ptr;
return _gvn.transform( new (C) AddPNode(base, ptr, offset) ); return _gvn.transform( new AddPNode(base, ptr, offset) );
} }
Node* GraphKit::ConvI2L(Node* offset) { Node* GraphKit::ConvI2L(Node* offset) {
@ -1127,7 +1126,7 @@ Node* GraphKit::ConvI2L(Node* offset) {
if (offset_con != Type::OffsetBot) { if (offset_con != Type::OffsetBot) {
return longcon((jlong) offset_con); return longcon((jlong) offset_con);
} }
return _gvn.transform( new (C) ConvI2LNode(offset)); return _gvn.transform( new ConvI2LNode(offset));
} }
Node* GraphKit::ConvI2UL(Node* offset) { Node* GraphKit::ConvI2UL(Node* offset) {
@ -1135,9 +1134,9 @@ Node* GraphKit::ConvI2UL(Node* offset) {
if (offset_con != (juint) Type::OffsetBot) { if (offset_con != (juint) Type::OffsetBot) {
return longcon((julong) offset_con); return longcon((julong) offset_con);
} }
Node* conv = _gvn.transform( new (C) ConvI2LNode(offset)); Node* conv = _gvn.transform( new ConvI2LNode(offset));
Node* mask = _gvn.transform( ConLNode::make(C, (julong) max_juint) ); Node* mask = _gvn.transform( ConLNode::make(C, (julong) max_juint) );
return _gvn.transform( new (C) AndLNode(conv, mask) ); return _gvn.transform( new AndLNode(conv, mask) );
} }
Node* GraphKit::ConvL2I(Node* offset) { Node* GraphKit::ConvL2I(Node* offset) {
@ -1146,7 +1145,7 @@ Node* GraphKit::ConvL2I(Node* offset) {
if (offset_con != (jlong)Type::OffsetBot) { if (offset_con != (jlong)Type::OffsetBot) {
return intcon((int) offset_con); return intcon((int) offset_con);
} }
return _gvn.transform( new (C) ConvL2INode(offset)); return _gvn.transform( new ConvL2INode(offset));
} }
//-------------------------load_object_klass----------------------------------- //-------------------------load_object_klass-----------------------------------
@ -1165,7 +1164,7 @@ Node* GraphKit::load_array_length(Node* array) {
Node *alen; Node *alen;
if (alloc == NULL) { if (alloc == NULL) {
Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes()); Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes());
alen = _gvn.transform( new (C) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS)); alen = _gvn.transform( new LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS));
} else { } else {
alen = alloc->Ideal_length(); alen = alloc->Ideal_length();
Node* ccast = alloc->make_ideal_length(_gvn.type(array)->is_oopptr(), &_gvn); Node* ccast = alloc->make_ideal_length(_gvn.type(array)->is_oopptr(), &_gvn);
@ -1199,8 +1198,8 @@ Node* GraphKit::null_check_common(Node* value, BasicType type,
// Construct NULL check // Construct NULL check
Node *chk = NULL; Node *chk = NULL;
switch(type) { switch(type) {
case T_LONG : chk = new (C) CmpLNode(value, _gvn.zerocon(T_LONG)); break; case T_LONG : chk = new CmpLNode(value, _gvn.zerocon(T_LONG)); break;
case T_INT : chk = new (C) CmpINode(value, _gvn.intcon(0)); break; case T_INT : chk = new CmpINode(value, _gvn.intcon(0)); break;
case T_ARRAY : // fall through case T_ARRAY : // fall through
type = T_OBJECT; // simplify further tests type = T_OBJECT; // simplify further tests
case T_OBJECT : { case T_OBJECT : {
@ -1247,7 +1246,7 @@ Node* GraphKit::null_check_common(Node* value, BasicType type,
return value; // Elided null check quickly! return value; // Elided null check quickly!
} }
} }
chk = new (C) CmpPNode( value, null() ); chk = new CmpPNode( value, null() );
break; break;
} }
@ -1258,7 +1257,7 @@ Node* GraphKit::null_check_common(Node* value, BasicType type,
chk = _gvn.transform(chk); chk = _gvn.transform(chk);
BoolTest::mask btest = assert_null ? BoolTest::eq : BoolTest::ne; BoolTest::mask btest = assert_null ? BoolTest::eq : BoolTest::ne;
BoolNode *btst = new (C) BoolNode( chk, btest); BoolNode *btst = new BoolNode( chk, btest);
Node *tst = _gvn.transform( btst ); Node *tst = _gvn.transform( btst );
//----------- //-----------
@ -1325,8 +1324,8 @@ Node* GraphKit::null_check_common(Node* value, BasicType type,
if (null_control != NULL) { if (null_control != NULL) {
IfNode* iff = create_and_map_if(control(), tst, ok_prob, COUNT_UNKNOWN); IfNode* iff = create_and_map_if(control(), tst, ok_prob, COUNT_UNKNOWN);
Node* null_true = _gvn.transform( new (C) IfFalseNode(iff)); Node* null_true = _gvn.transform( new IfFalseNode(iff));
set_control( _gvn.transform( new (C) IfTrueNode(iff))); set_control( _gvn.transform( new IfTrueNode(iff)));
if (null_true == top()) if (null_true == top())
explicit_null_checks_elided++; explicit_null_checks_elided++;
(*null_control) = null_true; (*null_control) = null_true;
@ -1378,7 +1377,7 @@ Node* GraphKit::cast_not_null(Node* obj, bool do_replace_in_map) {
// Object is already not-null? // Object is already not-null?
if( t == t_not_null ) return obj; if( t == t_not_null ) return obj;
Node *cast = new (C) CastPPNode(obj,t_not_null); Node *cast = new CastPPNode(obj,t_not_null);
cast->init_req(0, control()); cast->init_req(0, control());
cast = _gvn.transform( cast ); cast = _gvn.transform( cast );
@ -1403,60 +1402,17 @@ void GraphKit::replace_in_map(Node* old, Node* neww) {
// on the map. This includes locals, stack, and monitors // on the map. This includes locals, stack, and monitors
// of the current (innermost) JVM state. // of the current (innermost) JVM state.
if (!ReplaceInParentMaps) { // don't let inconsistent types from profiling escape this
// method
const Type* told = _gvn.type(old);
const Type* tnew = _gvn.type(neww);
if (!tnew->higher_equal(told)) {
return; return;
} }
// PreserveJVMState doesn't do a deep copy so we can't modify map()->record_replaced_node(old, neww);
// parents
if (Compile::current()->has_preserve_jvm_state()) {
return;
}
Parse* parser = is_Parse();
bool progress = true;
Node* ctrl = map()->in(0);
// Follow the chain of parsers and see whether the update can be
// done in the map of callers. We can do the replace for a caller if
// the current control post dominates the control of a caller.
while (parser != NULL && parser->caller() != NULL && progress) {
progress = false;
Node* parent_map = parser->caller()->map();
assert(parser->exits().map()->jvms()->depth() == parser->caller()->depth(), "map mismatch");
Node* parent_ctrl = parent_map->in(0);
while (parent_ctrl->is_Region()) {
Node* n = parent_ctrl->as_Region()->is_copy();
if (n == NULL) {
break;
}
parent_ctrl = n;
}
for (;;) {
if (ctrl == parent_ctrl) {
// update the map of the exits which is the one that will be
// used when compilation resume after inlining
parser->exits().map()->replace_edge(old, neww);
progress = true;
break;
}
if (ctrl->is_Proj() && ctrl->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none)) {
ctrl = ctrl->in(0)->in(0);
} else if (ctrl->is_Region()) {
Node* n = ctrl->as_Region()->is_copy();
if (n == NULL) {
break;
}
ctrl = n;
} else {
break;
}
}
parser = parser->parent_parser();
}
} }
@ -1486,7 +1442,7 @@ void GraphKit::set_all_memory(Node* newmem) {
//------------------------------set_all_memory_call---------------------------- //------------------------------set_all_memory_call----------------------------
void GraphKit::set_all_memory_call(Node* call, bool separate_io_proj) { void GraphKit::set_all_memory_call(Node* call, bool separate_io_proj) {
Node* newmem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory, separate_io_proj) ); Node* newmem = _gvn.transform( new ProjNode(call, TypeFunc::Memory, separate_io_proj) );
set_all_memory(newmem); set_all_memory(newmem);
} }
@ -1721,9 +1677,9 @@ Node* GraphKit::array_element_address(Node* ary, Node* idx, BasicType elembt,
int index_max = max_jint - 1; // array size is max_jint, index is one less int index_max = max_jint - 1; // array size is max_jint, index is one less
if (sizetype != NULL) index_max = sizetype->_hi - 1; if (sizetype != NULL) index_max = sizetype->_hi - 1;
const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax); const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax);
idx = _gvn.transform( new (C) ConvI2LNode(idx, lidxtype) ); idx = _gvn.transform( new ConvI2LNode(idx, lidxtype) );
#endif #endif
Node* scale = _gvn.transform( new (C) LShiftXNode(idx, intcon(shift)) ); Node* scale = _gvn.transform( new LShiftXNode(idx, intcon(shift)) );
return basic_plus_adr(ary, base, scale); return basic_plus_adr(ary, base, scale);
} }
@ -1771,8 +1727,8 @@ void GraphKit::set_edges_for_java_call(CallJavaNode* call, bool must_throw, bool
// Re-use the current map to produce the result. // Re-use the current map to produce the result.
set_control(_gvn.transform(new (C) ProjNode(call, TypeFunc::Control))); set_control(_gvn.transform(new ProjNode(call, TypeFunc::Control)));
set_i_o( _gvn.transform(new (C) ProjNode(call, TypeFunc::I_O , separate_io_proj))); set_i_o( _gvn.transform(new ProjNode(call, TypeFunc::I_O , separate_io_proj)));
set_all_memory_call(xcall, separate_io_proj); set_all_memory_call(xcall, separate_io_proj);
//return xcall; // no need, caller already has it //return xcall; // no need, caller already has it
@ -1786,7 +1742,7 @@ Node* GraphKit::set_results_for_java_call(CallJavaNode* call, bool separate_io_p
if (call->method() == NULL || if (call->method() == NULL ||
call->method()->return_type()->basic_type() == T_VOID) call->method()->return_type()->basic_type() == T_VOID)
ret = top(); ret = top();
else ret = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms)); else ret = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
// Note: Since any out-of-line call can produce an exception, // Note: Since any out-of-line call can produce an exception,
// we always insert an I_O projection from the call into the result. // we always insert an I_O projection from the call into the result.
@ -1797,8 +1753,8 @@ Node* GraphKit::set_results_for_java_call(CallJavaNode* call, bool separate_io_p
// The caller requested separate projections be used by the fall // The caller requested separate projections be used by the fall
// through and exceptional paths, so replace the projections for // through and exceptional paths, so replace the projections for
// the fall through path. // the fall through path.
set_i_o(_gvn.transform( new (C) ProjNode(call, TypeFunc::I_O) )); set_i_o(_gvn.transform( new ProjNode(call, TypeFunc::I_O) ));
set_all_memory(_gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) )); set_all_memory(_gvn.transform( new ProjNode(call, TypeFunc::Memory) ));
} }
return ret; return ret;
} }
@ -1838,13 +1794,13 @@ void GraphKit::set_predefined_output_for_runtime_call(Node* call,
Node* keep_mem, Node* keep_mem,
const TypePtr* hook_mem) { const TypePtr* hook_mem) {
// no i/o // no i/o
set_control(_gvn.transform( new (C) ProjNode(call,TypeFunc::Control) )); set_control(_gvn.transform( new ProjNode(call,TypeFunc::Control) ));
if (keep_mem) { if (keep_mem) {
// First clone the existing memory state // First clone the existing memory state
set_all_memory(keep_mem); set_all_memory(keep_mem);
if (hook_mem != NULL) { if (hook_mem != NULL) {
// Make memory for the call // Make memory for the call
Node* mem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) ); Node* mem = _gvn.transform( new ProjNode(call, TypeFunc::Memory) );
// Set the RawPtr memory state only. This covers all the heap top/GC stuff // Set the RawPtr memory state only. This covers all the heap top/GC stuff
// We also use hook_mem to extract specific effects from arraycopy stubs. // We also use hook_mem to extract specific effects from arraycopy stubs.
set_memory(mem, hook_mem); set_memory(mem, hook_mem);
@ -1864,12 +1820,16 @@ void GraphKit::set_predefined_output_for_runtime_call(Node* call,
// Replace the call with the current state of the kit. // Replace the call with the current state of the kit.
void GraphKit::replace_call(CallNode* call, Node* result) { void GraphKit::replace_call(CallNode* call, Node* result, bool do_replaced_nodes) {
JVMState* ejvms = NULL; JVMState* ejvms = NULL;
if (has_exceptions()) { if (has_exceptions()) {
ejvms = transfer_exceptions_into_jvms(); ejvms = transfer_exceptions_into_jvms();
} }
ReplacedNodes replaced_nodes = map()->replaced_nodes();
ReplacedNodes replaced_nodes_exception;
Node* ex_ctl = top();
SafePointNode* final_state = stop(); SafePointNode* final_state = stop();
// Find all the needed outputs of this call // Find all the needed outputs of this call
@ -1886,6 +1846,10 @@ void GraphKit::replace_call(CallNode* call, Node* result) {
C->gvn_replace_by(callprojs.fallthrough_catchproj, final_ctl); C->gvn_replace_by(callprojs.fallthrough_catchproj, final_ctl);
} }
if (callprojs.fallthrough_memproj != NULL) { if (callprojs.fallthrough_memproj != NULL) {
if (final_mem->is_MergeMem()) {
// Parser's exits MergeMem was not transformed but may be optimized
final_mem = _gvn.transform(final_mem);
}
C->gvn_replace_by(callprojs.fallthrough_memproj, final_mem); C->gvn_replace_by(callprojs.fallthrough_memproj, final_mem);
} }
if (callprojs.fallthrough_ioproj != NULL) { if (callprojs.fallthrough_ioproj != NULL) {
@ -1917,10 +1881,13 @@ void GraphKit::replace_call(CallNode* call, Node* result) {
// Load my combined exception state into the kit, with all phis transformed: // Load my combined exception state into the kit, with all phis transformed:
SafePointNode* ex_map = ekit.combine_and_pop_all_exception_states(); SafePointNode* ex_map = ekit.combine_and_pop_all_exception_states();
replaced_nodes_exception = ex_map->replaced_nodes();
Node* ex_oop = ekit.use_exception_state(ex_map); Node* ex_oop = ekit.use_exception_state(ex_map);
if (callprojs.catchall_catchproj != NULL) { if (callprojs.catchall_catchproj != NULL) {
C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control()); C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control());
ex_ctl = ekit.control();
} }
if (callprojs.catchall_memproj != NULL) { if (callprojs.catchall_memproj != NULL) {
C->gvn_replace_by(callprojs.catchall_memproj, ekit.reset_memory()); C->gvn_replace_by(callprojs.catchall_memproj, ekit.reset_memory());
@ -1953,6 +1920,13 @@ void GraphKit::replace_call(CallNode* call, Node* result) {
_gvn.transform(wl.pop()); _gvn.transform(wl.pop());
} }
} }
if (callprojs.fallthrough_catchproj != NULL && !final_ctl->is_top() && do_replaced_nodes) {
replaced_nodes.apply(C, final_ctl);
}
if (!ex_ctl->is_top() && do_replaced_nodes) {
replaced_nodes_exception.apply(C, ex_ctl);
}
} }
@ -1968,7 +1942,7 @@ void GraphKit::increment_counter(Node* counter_addr) {
int adr_type = Compile::AliasIdxRaw; int adr_type = Compile::AliasIdxRaw;
Node* ctrl = control(); Node* ctrl = control();
Node* cnt = make_load(ctrl, counter_addr, TypeInt::INT, T_INT, adr_type, MemNode::unordered); Node* cnt = make_load(ctrl, counter_addr, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
Node* incr = _gvn.transform(new (C) AddINode(cnt, _gvn.intcon(1))); Node* incr = _gvn.transform(new AddINode(cnt, _gvn.intcon(1)));
store_to_memory(ctrl, counter_addr, incr, T_INT, adr_type, MemNode::unordered); store_to_memory(ctrl, counter_addr, incr, T_INT, adr_type, MemNode::unordered);
} }
@ -2087,7 +2061,7 @@ void GraphKit::uncommon_trap(int trap_request,
// The debug info is the only real input to this call. // The debug info is the only real input to this call.
// Halt-and-catch fire here. The above call should never return! // Halt-and-catch fire here. The above call should never return!
HaltNode* halt = new(C) HaltNode(control(), frameptr()); HaltNode* halt = new HaltNode(control(), frameptr());
_gvn.set_type_bottom(halt); _gvn.set_type_bottom(halt);
root()->add_req(halt); root()->add_req(halt);
@ -2169,7 +2143,7 @@ Node* GraphKit::record_profile_for_speculation(Node* n, ciKlass* exact_kls, bool
// the new type. The new type depends on the control: what // the new type. The new type depends on the control: what
// profiling tells us is only valid from here as far as we can // profiling tells us is only valid from here as far as we can
// tell. // tell.
Node* cast = new(C) CheckCastPPNode(control(), n, current_type->remove_speculative()->join_speculative(spec_type)); Node* cast = new CheckCastPPNode(control(), n, current_type->remove_speculative()->join_speculative(spec_type));
cast = _gvn.transform(cast); cast = _gvn.transform(cast);
replace_in_map(n, cast); replace_in_map(n, cast);
n = cast; n = cast;
@ -2287,7 +2261,7 @@ void GraphKit::round_double_result(ciMethod* dest_method) {
Node* GraphKit::precision_rounding(Node* n) { Node* GraphKit::precision_rounding(Node* n) {
return UseStrictFP && _method->flags().is_strict() return UseStrictFP && _method->flags().is_strict()
&& UseSSE == 0 && Matcher::strict_fp_requires_explicit_rounding && UseSSE == 0 && Matcher::strict_fp_requires_explicit_rounding
? _gvn.transform( new (C) RoundFloatNode(0, n) ) ? _gvn.transform( new RoundFloatNode(0, n) )
: n; : n;
} }
@ -2295,7 +2269,7 @@ Node* GraphKit::precision_rounding(Node* n) {
Node* GraphKit::dprecision_rounding(Node *n) { Node* GraphKit::dprecision_rounding(Node *n) {
return UseStrictFP && _method->flags().is_strict() return UseStrictFP && _method->flags().is_strict()
&& UseSSE <= 1 && Matcher::strict_fp_requires_explicit_rounding && UseSSE <= 1 && Matcher::strict_fp_requires_explicit_rounding
? _gvn.transform( new (C) RoundDoubleNode(0, n) ) ? _gvn.transform( new RoundDoubleNode(0, n) )
: n; : n;
} }
@ -2303,7 +2277,7 @@ Node* GraphKit::dprecision_rounding(Node *n) {
Node* GraphKit::dstore_rounding(Node* n) { Node* GraphKit::dstore_rounding(Node* n) {
return Matcher::strict_fp_requires_explicit_rounding return Matcher::strict_fp_requires_explicit_rounding
&& UseSSE <= 1 && UseSSE <= 1
? _gvn.transform( new (C) RoundDoubleNode(0, n) ) ? _gvn.transform( new RoundDoubleNode(0, n) )
: n; : n;
} }
@ -2382,11 +2356,11 @@ Node* GraphKit::opt_iff(Node* region, Node* iff) {
IfNode *opt_iff = _gvn.transform(iff)->as_If(); IfNode *opt_iff = _gvn.transform(iff)->as_If();
// Fast path taken; set region slot 2 // Fast path taken; set region slot 2
Node *fast_taken = _gvn.transform( new (C) IfFalseNode(opt_iff) ); Node *fast_taken = _gvn.transform( new IfFalseNode(opt_iff) );
region->init_req(2,fast_taken); // Capture fast-control region->init_req(2,fast_taken); // Capture fast-control
// Fast path not-taken, i.e. slow path // Fast path not-taken, i.e. slow path
Node *slow_taken = _gvn.transform( new (C) IfTrueNode(opt_iff) ); Node *slow_taken = _gvn.transform( new IfTrueNode(opt_iff) );
return slow_taken; return slow_taken;
} }
@ -2410,12 +2384,12 @@ Node* GraphKit::make_runtime_call(int flags,
} }
CallNode* call; CallNode* call;
if (!is_leaf) { if (!is_leaf) {
call = new(C) CallStaticJavaNode(call_type, call_addr, call_name, call = new CallStaticJavaNode(call_type, call_addr, call_name,
bci(), adr_type); bci(), adr_type);
} else if (flags & RC_NO_FP) { } else if (flags & RC_NO_FP) {
call = new(C) CallLeafNoFPNode(call_type, call_addr, call_name, adr_type); call = new CallLeafNoFPNode(call_type, call_addr, call_name, adr_type);
} else { } else {
call = new(C) CallLeafNode(call_type, call_addr, call_name, adr_type); call = new CallLeafNode(call_type, call_addr, call_name, adr_type);
} }
// The following is similar to set_edges_for_java_call, // The following is similar to set_edges_for_java_call,
@ -2476,7 +2450,7 @@ Node* GraphKit::make_runtime_call(int flags,
} }
if (has_io) { if (has_io) {
set_i_o(_gvn.transform(new (C) ProjNode(call, TypeFunc::I_O))); set_i_o(_gvn.transform(new ProjNode(call, TypeFunc::I_O)));
} }
return call; return call;
@ -2490,50 +2464,57 @@ void GraphKit::merge_memory(Node* new_mem, Node* region, int new_path) {
Node* new_slice = mms.memory2(); Node* new_slice = mms.memory2();
if (old_slice != new_slice) { if (old_slice != new_slice) {
PhiNode* phi; PhiNode* phi;
if (new_slice->is_Phi() && new_slice->as_Phi()->region() == region) { if (old_slice->is_Phi() && old_slice->as_Phi()->region() == region) {
phi = new_slice->as_Phi(); if (mms.is_empty()) {
#ifdef ASSERT // clone base memory Phi's inputs for this memory slice
if (old_slice->is_Phi() && old_slice->as_Phi()->region() == region) assert(old_slice == mms.base_memory(), "sanity");
old_slice = old_slice->in(new_path); phi = PhiNode::make(region, NULL, Type::MEMORY, mms.adr_type(C));
// Caller is responsible for ensuring that any pre-existing _gvn.set_type(phi, Type::MEMORY);
// phis are already aware of old memory. for (uint i = 1; i < phi->req(); i++) {
int old_path = (new_path > 1) ? 1 : 2; // choose old_path != new_path phi->init_req(i, old_slice->in(i));
assert(phi->in(old_path) == old_slice, "pre-existing phis OK"); }
#endif } else {
mms.set_memory(phi); phi = old_slice->as_Phi(); // Phi was generated already
}
} else { } else {
phi = PhiNode::make(region, old_slice, Type::MEMORY, mms.adr_type(C)); phi = PhiNode::make(region, old_slice, Type::MEMORY, mms.adr_type(C));
_gvn.set_type(phi, Type::MEMORY); _gvn.set_type(phi, Type::MEMORY);
phi->set_req(new_path, new_slice);
mms.set_memory(_gvn.transform(phi)); // assume it is complete
} }
phi->set_req(new_path, new_slice);
mms.set_memory(phi);
} }
} }
} }
//------------------------------make_slow_call_ex------------------------------ //------------------------------make_slow_call_ex------------------------------
// Make the exception handler hookups for the slow call // Make the exception handler hookups for the slow call
void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj) { void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj, bool deoptimize) {
if (stopped()) return; if (stopped()) return;
// Make a catch node with just two handlers: fall-through and catch-all // Make a catch node with just two handlers: fall-through and catch-all
Node* i_o = _gvn.transform( new (C) ProjNode(call, TypeFunc::I_O, separate_io_proj) ); Node* i_o = _gvn.transform( new ProjNode(call, TypeFunc::I_O, separate_io_proj) );
Node* catc = _gvn.transform( new (C) CatchNode(control(), i_o, 2) ); Node* catc = _gvn.transform( new CatchNode(control(), i_o, 2) );
Node* norm = _gvn.transform( new (C) CatchProjNode(catc, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci) ); Node* norm = _gvn.transform( new CatchProjNode(catc, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci) );
Node* excp = _gvn.transform( new (C) CatchProjNode(catc, CatchProjNode::catch_all_index, CatchProjNode::no_handler_bci) ); Node* excp = _gvn.transform( new CatchProjNode(catc, CatchProjNode::catch_all_index, CatchProjNode::no_handler_bci) );
{ PreserveJVMState pjvms(this); { PreserveJVMState pjvms(this);
set_control(excp); set_control(excp);
set_i_o(i_o); set_i_o(i_o);
if (excp != top()) { if (excp != top()) {
if (deoptimize) {
// Deoptimize if an exception is caught. Don't construct exception state in this case.
uncommon_trap(Deoptimization::Reason_unhandled,
Deoptimization::Action_none);
} else {
// Create an exception state also. // Create an exception state also.
// Use an exact type if the caller has specified a specific exception. // Use an exact type if the caller has specified a specific exception.
const Type* ex_type = TypeOopPtr::make_from_klass_unique(ex_klass)->cast_to_ptr_type(TypePtr::NotNull); const Type* ex_type = TypeOopPtr::make_from_klass_unique(ex_klass)->cast_to_ptr_type(TypePtr::NotNull);
Node* ex_oop = new (C) CreateExNode(ex_type, control(), i_o); Node* ex_oop = new CreateExNode(ex_type, control(), i_o);
add_exception_state(make_exception_state(_gvn.transform(ex_oop))); add_exception_state(make_exception_state(_gvn.transform(ex_oop)));
} }
} }
}
// Get the no-exception control from the CatchNode. // Get the no-exception control from the CatchNode.
set_control(norm); set_control(norm);
@ -2580,11 +2561,11 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) {
case SSC_easy_test: case SSC_easy_test:
{ {
// Just do a direct pointer compare and be done. // Just do a direct pointer compare and be done.
Node* cmp = _gvn.transform( new(C) CmpPNode(subklass, superklass) ); Node* cmp = _gvn.transform( new CmpPNode(subklass, superklass) );
Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) ); Node* bol = _gvn.transform( new BoolNode(cmp, BoolTest::eq) );
IfNode* iff = create_and_xform_if(control(), bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN); IfNode* iff = create_and_xform_if(control(), bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
set_control( _gvn.transform( new(C) IfTrueNode (iff) ) ); set_control( _gvn.transform( new IfTrueNode (iff) ) );
return _gvn.transform( new(C) IfFalseNode(iff) ); return _gvn.transform( new IfFalseNode(iff) );
} }
case SSC_full_test: case SSC_full_test:
break; break;
@ -2599,7 +2580,7 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) {
// First load the super-klass's check-offset // First load the super-klass's check-offset
Node *p1 = basic_plus_adr( superklass, superklass, in_bytes(Klass::super_check_offset_offset()) ); Node *p1 = basic_plus_adr( superklass, superklass, in_bytes(Klass::super_check_offset_offset()) );
Node *chk_off = _gvn.transform(new (C) LoadINode(NULL, memory(p1), p1, _gvn.type(p1)->is_ptr(), Node *chk_off = _gvn.transform(new LoadINode(NULL, memory(p1), p1, _gvn.type(p1)->is_ptr(),
TypeInt::INT, MemNode::unordered)); TypeInt::INT, MemNode::unordered));
int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset()); int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset());
bool might_be_cache = (find_int_con(chk_off, cacheoff_con) == cacheoff_con); bool might_be_cache = (find_int_con(chk_off, cacheoff_con) == cacheoff_con);
@ -2611,7 +2592,7 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) {
// Worst-case type is a little odd: NULL is allowed as a result (usually // Worst-case type is a little odd: NULL is allowed as a result (usually
// klass loads can never produce a NULL). // klass loads can never produce a NULL).
Node *chk_off_X = ConvI2X(chk_off); Node *chk_off_X = ConvI2X(chk_off);
Node *p2 = _gvn.transform( new (C) AddPNode(subklass,subklass,chk_off_X) ); Node *p2 = _gvn.transform( new AddPNode(subklass,subklass,chk_off_X) );
// For some types like interfaces the following loadKlass is from a 1-word // For some types like interfaces the following loadKlass is from a 1-word
// cache which is mutable so can't use immutable memory. Other // cache which is mutable so can't use immutable memory. Other
// types load from the super-class display table which is immutable. // types load from the super-class display table which is immutable.
@ -2625,11 +2606,11 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) {
// See if we get an immediate positive hit. Happens roughly 83% of the // See if we get an immediate positive hit. Happens roughly 83% of the
// time. Test to see if the value loaded just previously from the subklass // time. Test to see if the value loaded just previously from the subklass
// is exactly the superklass. // is exactly the superklass.
Node *cmp1 = _gvn.transform( new (C) CmpPNode( superklass, nkls ) ); Node *cmp1 = _gvn.transform( new CmpPNode( superklass, nkls ) );
Node *bol1 = _gvn.transform( new (C) BoolNode( cmp1, BoolTest::eq ) ); Node *bol1 = _gvn.transform( new BoolNode( cmp1, BoolTest::eq ) );
IfNode *iff1 = create_and_xform_if( control(), bol1, PROB_LIKELY(0.83f), COUNT_UNKNOWN ); IfNode *iff1 = create_and_xform_if( control(), bol1, PROB_LIKELY(0.83f), COUNT_UNKNOWN );
Node *iftrue1 = _gvn.transform( new (C) IfTrueNode ( iff1 ) ); Node *iftrue1 = _gvn.transform( new IfTrueNode ( iff1 ) );
set_control( _gvn.transform( new (C) IfFalseNode( iff1 ) ) ); set_control( _gvn.transform( new IfFalseNode( iff1 ) ) );
// Compile speed common case: Check for being deterministic right now. If // Compile speed common case: Check for being deterministic right now. If
// chk_off is a constant and not equal to cacheoff then we are NOT a // chk_off is a constant and not equal to cacheoff then we are NOT a
@ -2642,9 +2623,9 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) {
} }
// Gather the various success & failures here // Gather the various success & failures here
RegionNode *r_ok_subtype = new (C) RegionNode(4); RegionNode *r_ok_subtype = new RegionNode(4);
record_for_igvn(r_ok_subtype); record_for_igvn(r_ok_subtype);
RegionNode *r_not_subtype = new (C) RegionNode(3); RegionNode *r_not_subtype = new RegionNode(3);
record_for_igvn(r_not_subtype); record_for_igvn(r_not_subtype);
r_ok_subtype->init_req(1, iftrue1); r_ok_subtype->init_req(1, iftrue1);
@ -2655,20 +2636,20 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) {
// cache. If it points to the display (and NOT the cache) and the display // cache. If it points to the display (and NOT the cache) and the display
// missed then it's not a subtype. // missed then it's not a subtype.
Node *cacheoff = _gvn.intcon(cacheoff_con); Node *cacheoff = _gvn.intcon(cacheoff_con);
Node *cmp2 = _gvn.transform( new (C) CmpINode( chk_off, cacheoff ) ); Node *cmp2 = _gvn.transform( new CmpINode( chk_off, cacheoff ) );
Node *bol2 = _gvn.transform( new (C) BoolNode( cmp2, BoolTest::ne ) ); Node *bol2 = _gvn.transform( new BoolNode( cmp2, BoolTest::ne ) );
IfNode *iff2 = create_and_xform_if( control(), bol2, PROB_LIKELY(0.63f), COUNT_UNKNOWN ); IfNode *iff2 = create_and_xform_if( control(), bol2, PROB_LIKELY(0.63f), COUNT_UNKNOWN );
r_not_subtype->init_req(1, _gvn.transform( new (C) IfTrueNode (iff2) ) ); r_not_subtype->init_req(1, _gvn.transform( new IfTrueNode (iff2) ) );
set_control( _gvn.transform( new (C) IfFalseNode(iff2) ) ); set_control( _gvn.transform( new IfFalseNode(iff2) ) );
// Check for self. Very rare to get here, but it is taken 1/3 the time. // Check for self. Very rare to get here, but it is taken 1/3 the time.
// No performance impact (too rare) but allows sharing of secondary arrays // No performance impact (too rare) but allows sharing of secondary arrays
// which has some footprint reduction. // which has some footprint reduction.
Node *cmp3 = _gvn.transform( new (C) CmpPNode( subklass, superklass ) ); Node *cmp3 = _gvn.transform( new CmpPNode( subklass, superklass ) );
Node *bol3 = _gvn.transform( new (C) BoolNode( cmp3, BoolTest::eq ) ); Node *bol3 = _gvn.transform( new BoolNode( cmp3, BoolTest::eq ) );
IfNode *iff3 = create_and_xform_if( control(), bol3, PROB_LIKELY(0.36f), COUNT_UNKNOWN ); IfNode *iff3 = create_and_xform_if( control(), bol3, PROB_LIKELY(0.36f), COUNT_UNKNOWN );
r_ok_subtype->init_req(2, _gvn.transform( new (C) IfTrueNode ( iff3 ) ) ); r_ok_subtype->init_req(2, _gvn.transform( new IfTrueNode ( iff3 ) ) );
set_control( _gvn.transform( new (C) IfFalseNode( iff3 ) ) ); set_control( _gvn.transform( new IfFalseNode( iff3 ) ) );
// -- Roads not taken here: -- // -- Roads not taken here: --
// We could also have chosen to perform the self-check at the beginning // We could also have chosen to perform the self-check at the beginning
@ -2692,13 +2673,13 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) {
// The decision to inline or out-of-line this final check is platform // The decision to inline or out-of-line this final check is platform
// dependent, and is found in the AD file definition of PartialSubtypeCheck. // dependent, and is found in the AD file definition of PartialSubtypeCheck.
Node* psc = _gvn.transform( Node* psc = _gvn.transform(
new (C) PartialSubtypeCheckNode(control(), subklass, superklass) ); new PartialSubtypeCheckNode(control(), subklass, superklass) );
Node *cmp4 = _gvn.transform( new (C) CmpPNode( psc, null() ) ); Node *cmp4 = _gvn.transform( new CmpPNode( psc, null() ) );
Node *bol4 = _gvn.transform( new (C) BoolNode( cmp4, BoolTest::ne ) ); Node *bol4 = _gvn.transform( new BoolNode( cmp4, BoolTest::ne ) );
IfNode *iff4 = create_and_xform_if( control(), bol4, PROB_FAIR, COUNT_UNKNOWN ); IfNode *iff4 = create_and_xform_if( control(), bol4, PROB_FAIR, COUNT_UNKNOWN );
r_not_subtype->init_req(2, _gvn.transform( new (C) IfTrueNode (iff4) ) ); r_not_subtype->init_req(2, _gvn.transform( new IfTrueNode (iff4) ) );
r_ok_subtype ->init_req(3, _gvn.transform( new (C) IfFalseNode(iff4) ) ); r_ok_subtype ->init_req(3, _gvn.transform( new IfFalseNode(iff4) ) );
// Return false path; set default control to true path. // Return false path; set default control to true path.
set_control( _gvn.transform(r_ok_subtype) ); set_control( _gvn.transform(r_ok_subtype) );
@ -2762,18 +2743,18 @@ Node* GraphKit::type_check_receiver(Node* receiver, ciKlass* klass,
const TypeKlassPtr* tklass = TypeKlassPtr::make(klass); const TypeKlassPtr* tklass = TypeKlassPtr::make(klass);
Node* recv_klass = load_object_klass(receiver); Node* recv_klass = load_object_klass(receiver);
Node* want_klass = makecon(tklass); Node* want_klass = makecon(tklass);
Node* cmp = _gvn.transform( new(C) CmpPNode(recv_klass, want_klass) ); Node* cmp = _gvn.transform( new CmpPNode(recv_klass, want_klass) );
Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) ); Node* bol = _gvn.transform( new BoolNode(cmp, BoolTest::eq) );
IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN); IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN);
set_control( _gvn.transform( new(C) IfTrueNode (iff) )); set_control( _gvn.transform( new IfTrueNode (iff) ));
Node* fail = _gvn.transform( new(C) IfFalseNode(iff) ); Node* fail = _gvn.transform( new IfFalseNode(iff) );
const TypeOopPtr* recv_xtype = tklass->as_instance_type(); const TypeOopPtr* recv_xtype = tklass->as_instance_type();
assert(recv_xtype->klass_is_exact(), ""); assert(recv_xtype->klass_is_exact(), "");
// Subsume downstream occurrences of receiver with a cast to // Subsume downstream occurrences of receiver with a cast to
// recv_xtype, since now we know what the type will be. // recv_xtype, since now we know what the type will be.
Node* cast = new(C) CheckCastPPNode(control(), receiver, recv_xtype); Node* cast = new CheckCastPPNode(control(), receiver, recv_xtype);
(*casted_receiver) = _gvn.transform(cast); (*casted_receiver) = _gvn.transform(cast);
// (User must make the replace_in_map call.) // (User must make the replace_in_map call.)
@ -2920,8 +2901,8 @@ Node* GraphKit::gen_instanceof(Node* obj, Node* superklass, bool safe_for_replac
// Make the merge point // Make the merge point
enum { _obj_path = 1, _fail_path, _null_path, PATH_LIMIT }; enum { _obj_path = 1, _fail_path, _null_path, PATH_LIMIT };
RegionNode* region = new(C) RegionNode(PATH_LIMIT); RegionNode* region = new RegionNode(PATH_LIMIT);
Node* phi = new(C) PhiNode(region, TypeInt::BOOL); Node* phi = new PhiNode(region, TypeInt::BOOL);
C->set_has_split_ifs(true); // Has chance for split-if optimization C->set_has_split_ifs(true); // Has chance for split-if optimization
ciProfileData* data = NULL; ciProfileData* data = NULL;
@ -3052,8 +3033,8 @@ Node* GraphKit::gen_checkcast(Node *obj, Node* superklass,
// Make the merge point // Make the merge point
enum { _obj_path = 1, _null_path, PATH_LIMIT }; enum { _obj_path = 1, _null_path, PATH_LIMIT };
RegionNode* region = new (C) RegionNode(PATH_LIMIT); RegionNode* region = new RegionNode(PATH_LIMIT);
Node* phi = new (C) PhiNode(region, toop); Node* phi = new PhiNode(region, toop);
C->set_has_split_ifs(true); // Has chance for split-if optimization C->set_has_split_ifs(true); // Has chance for split-if optimization
// Use null-cast information if it is available // Use null-cast information if it is available
@ -3114,8 +3095,7 @@ Node* GraphKit::gen_checkcast(Node *obj, Node* superklass,
Node* not_subtype_ctrl = gen_subtype_check( obj_klass, superklass ); Node* not_subtype_ctrl = gen_subtype_check( obj_klass, superklass );
// Plug in success path into the merge // Plug in success path into the merge
cast_obj = _gvn.transform(new (C) CheckCastPPNode(control(), cast_obj = _gvn.transform(new CheckCastPPNode(control(), not_null_obj, toop));
not_null_obj, toop));
// Failure path ends in uncommon trap (or may be dead - failure impossible) // Failure path ends in uncommon trap (or may be dead - failure impossible)
if (failure_control == NULL) { if (failure_control == NULL) {
if (not_subtype_ctrl != top()) { // If failure is possible if (not_subtype_ctrl != top()) { // If failure is possible
@ -3168,7 +3148,7 @@ Node* GraphKit::insert_mem_bar(int opcode, Node* precedent) {
mb->init_req(TypeFunc::Control, control()); mb->init_req(TypeFunc::Control, control());
mb->init_req(TypeFunc::Memory, reset_memory()); mb->init_req(TypeFunc::Memory, reset_memory());
Node* membar = _gvn.transform(mb); Node* membar = _gvn.transform(mb);
set_control(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Control))); set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control)));
set_all_memory_call(membar); set_all_memory_call(membar);
return membar; return membar;
} }
@ -3197,11 +3177,11 @@ Node* GraphKit::insert_mem_bar_volatile(int opcode, int alias_idx, Node* precede
mb->set_req(TypeFunc::Memory, memory(alias_idx)); mb->set_req(TypeFunc::Memory, memory(alias_idx));
} }
Node* membar = _gvn.transform(mb); Node* membar = _gvn.transform(mb);
set_control(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Control))); set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control)));
if (alias_idx == Compile::AliasIdxBot) { if (alias_idx == Compile::AliasIdxBot) {
merged_memory()->set_base_memory(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Memory))); merged_memory()->set_base_memory(_gvn.transform(new ProjNode(membar, TypeFunc::Memory)));
} else { } else {
set_memory(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Memory)),alias_idx); set_memory(_gvn.transform(new ProjNode(membar, TypeFunc::Memory)),alias_idx);
} }
return membar; return membar;
} }
@ -3221,10 +3201,10 @@ FastLockNode* GraphKit::shared_lock(Node* obj) {
assert(dead_locals_are_killed(), "should kill locals before sync. point"); assert(dead_locals_are_killed(), "should kill locals before sync. point");
// Box the stack location // Box the stack location
Node* box = _gvn.transform(new (C) BoxLockNode(next_monitor())); Node* box = _gvn.transform(new BoxLockNode(next_monitor()));
Node* mem = reset_memory(); Node* mem = reset_memory();
FastLockNode * flock = _gvn.transform(new (C) FastLockNode(0, obj, box) )->as_FastLock(); FastLockNode * flock = _gvn.transform(new FastLockNode(0, obj, box) )->as_FastLock();
if (UseBiasedLocking && PrintPreciseBiasedLockingStatistics) { if (UseBiasedLocking && PrintPreciseBiasedLockingStatistics) {
// Create the counters for this fast lock. // Create the counters for this fast lock.
flock->create_lock_counter(sync_jvms()); // sync_jvms used to get current bci flock->create_lock_counter(sync_jvms()); // sync_jvms used to get current bci
@ -3238,7 +3218,7 @@ FastLockNode* GraphKit::shared_lock(Node* obj) {
map()->push_monitor( flock ); map()->push_monitor( flock );
const TypeFunc *tf = LockNode::lock_type(); const TypeFunc *tf = LockNode::lock_type();
LockNode *lock = new (C) LockNode(C, tf); LockNode *lock = new LockNode(C, tf);
lock->init_req( TypeFunc::Control, control() ); lock->init_req( TypeFunc::Control, control() );
lock->init_req( TypeFunc::Memory , mem ); lock->init_req( TypeFunc::Memory , mem );
@ -3292,7 +3272,7 @@ void GraphKit::shared_unlock(Node* box, Node* obj) {
insert_mem_bar(Op_MemBarReleaseLock); insert_mem_bar(Op_MemBarReleaseLock);
const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type(); const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type();
UnlockNode *unlock = new (C) UnlockNode(C, tf); UnlockNode *unlock = new UnlockNode(C, tf);
uint raw_idx = Compile::AliasIdxRaw; uint raw_idx = Compile::AliasIdxRaw;
unlock->init_req( TypeFunc::Control, control() ); unlock->init_req( TypeFunc::Control, control() );
unlock->init_req( TypeFunc::Memory , memory(raw_idx) ); unlock->init_req( TypeFunc::Memory , memory(raw_idx) );
@ -3353,24 +3333,25 @@ static void hook_memory_on_init(GraphKit& kit, int alias_idx,
//---------------------------set_output_for_allocation------------------------- //---------------------------set_output_for_allocation-------------------------
Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, Node* GraphKit::set_output_for_allocation(AllocateNode* alloc,
const TypeOopPtr* oop_type) { const TypeOopPtr* oop_type,
bool deoptimize_on_exception) {
int rawidx = Compile::AliasIdxRaw; int rawidx = Compile::AliasIdxRaw;
alloc->set_req( TypeFunc::FramePtr, frameptr() ); alloc->set_req( TypeFunc::FramePtr, frameptr() );
add_safepoint_edges(alloc); add_safepoint_edges(alloc);
Node* allocx = _gvn.transform(alloc); Node* allocx = _gvn.transform(alloc);
set_control( _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Control) ) ); set_control( _gvn.transform(new ProjNode(allocx, TypeFunc::Control) ) );
// create memory projection for i_o // create memory projection for i_o
set_memory ( _gvn.transform( new (C) ProjNode(allocx, TypeFunc::Memory, true) ), rawidx ); set_memory ( _gvn.transform( new ProjNode(allocx, TypeFunc::Memory, true) ), rawidx );
make_slow_call_ex(allocx, env()->Throwable_klass(), true); make_slow_call_ex(allocx, env()->Throwable_klass(), true, deoptimize_on_exception);
// create a memory projection as for the normal control path // create a memory projection as for the normal control path
Node* malloc = _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Memory)); Node* malloc = _gvn.transform(new ProjNode(allocx, TypeFunc::Memory));
set_memory(malloc, rawidx); set_memory(malloc, rawidx);
// a normal slow-call doesn't change i_o, but an allocation does // a normal slow-call doesn't change i_o, but an allocation does
// we create a separate i_o projection for the normal control path // we create a separate i_o projection for the normal control path
set_i_o(_gvn.transform( new (C) ProjNode(allocx, TypeFunc::I_O, false) ) ); set_i_o(_gvn.transform( new ProjNode(allocx, TypeFunc::I_O, false) ) );
Node* rawoop = _gvn.transform( new (C) ProjNode(allocx, TypeFunc::Parms) ); Node* rawoop = _gvn.transform( new ProjNode(allocx, TypeFunc::Parms) );
// put in an initialization barrier // put in an initialization barrier
InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, rawidx, InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, rawidx,
@ -3406,7 +3387,7 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc,
} }
// Cast raw oop to the real thing... // Cast raw oop to the real thing...
Node* javaoop = new (C) CheckCastPPNode(control(), rawoop, oop_type); Node* javaoop = new CheckCastPPNode(control(), rawoop, oop_type);
javaoop = _gvn.transform(javaoop); javaoop = _gvn.transform(javaoop);
C->set_recent_alloc(control(), javaoop); C->set_recent_alloc(control(), javaoop);
assert(just_allocated_object(control()) == javaoop, "just allocated"); assert(just_allocated_object(control()) == javaoop, "just allocated");
@ -3439,9 +3420,11 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc,
// The optional arguments are for specialized use by intrinsics: // The optional arguments are for specialized use by intrinsics:
// - If 'extra_slow_test' if not null is an extra condition for the slow-path. // - If 'extra_slow_test' if not null is an extra condition for the slow-path.
// - If 'return_size_val', report the the total object size to the caller. // - If 'return_size_val', report the the total object size to the caller.
// - deoptimize_on_exception controls how Java exceptions are handled (rethrow vs deoptimize)
Node* GraphKit::new_instance(Node* klass_node, Node* GraphKit::new_instance(Node* klass_node,
Node* extra_slow_test, Node* extra_slow_test,
Node* *return_size_val) { Node* *return_size_val,
bool deoptimize_on_exception) {
// Compute size in doublewords // Compute size in doublewords
// The size is always an integral number of doublewords, represented // The size is always an integral number of doublewords, represented
// as a positive bytewise size stored in the klass's layout_helper. // as a positive bytewise size stored in the klass's layout_helper.
@ -3465,9 +3448,9 @@ Node* GraphKit::new_instance(Node* klass_node,
// (It may be stress-tested by specifying StressReflectiveCode.) // (It may be stress-tested by specifying StressReflectiveCode.)
// Basically, we want to get into the VM is there's an illegal argument. // Basically, we want to get into the VM is there's an illegal argument.
Node* bit = intcon(Klass::_lh_instance_slow_path_bit); Node* bit = intcon(Klass::_lh_instance_slow_path_bit);
initial_slow_test = _gvn.transform( new (C) AndINode(layout_val, bit) ); initial_slow_test = _gvn.transform( new AndINode(layout_val, bit) );
if (extra_slow_test != intcon(0)) { if (extra_slow_test != intcon(0)) {
initial_slow_test = _gvn.transform( new (C) OrINode(initial_slow_test, extra_slow_test) ); initial_slow_test = _gvn.transform( new OrINode(initial_slow_test, extra_slow_test) );
} }
// (Macro-expander will further convert this to a Bool, if necessary.) // (Macro-expander will further convert this to a Bool, if necessary.)
} }
@ -3484,7 +3467,7 @@ Node* GraphKit::new_instance(Node* klass_node,
// Clear the low bits to extract layout_helper_size_in_bytes: // Clear the low bits to extract layout_helper_size_in_bytes:
assert((int)Klass::_lh_instance_slow_path_bit < BytesPerLong, "clear bit"); assert((int)Klass::_lh_instance_slow_path_bit < BytesPerLong, "clear bit");
Node* mask = MakeConX(~ (intptr_t)right_n_bits(LogBytesPerLong)); Node* mask = MakeConX(~ (intptr_t)right_n_bits(LogBytesPerLong));
size = _gvn.transform( new (C) AndXNode(size, mask) ); size = _gvn.transform( new AndXNode(size, mask) );
} }
if (return_size_val != NULL) { if (return_size_val != NULL) {
(*return_size_val) = size; (*return_size_val) = size;
@ -3504,13 +3487,12 @@ Node* GraphKit::new_instance(Node* klass_node,
Node *mem = reset_memory(); Node *mem = reset_memory();
set_all_memory(mem); // Create new memory state set_all_memory(mem); // Create new memory state
AllocateNode* alloc AllocateNode* alloc = new AllocateNode(C, AllocateNode::alloc_type(Type::TOP),
= 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);
return set_output_for_allocation(alloc, oop_type); return set_output_for_allocation(alloc, oop_type, deoptimize_on_exception);
} }
//-------------------------------new_array------------------------------------- //-------------------------------new_array-------------------------------------
@ -3520,7 +3502,8 @@ Node* GraphKit::new_instance(Node* klass_node,
Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
Node* length, // number of array elements Node* length, // number of array elements
int nargs, // number of arguments to push back for uncommon trap int nargs, // number of arguments to push back for uncommon trap
Node* *return_size_val) { Node* *return_size_val,
bool deoptimize_on_exception) {
jint layout_con = Klass::_lh_neutral_value; jint layout_con = Klass::_lh_neutral_value;
Node* layout_val = get_layout_helper(klass_node, layout_con); Node* layout_val = get_layout_helper(klass_node, layout_con);
int layout_is_con = (layout_val == NULL); int layout_is_con = (layout_val == NULL);
@ -3531,8 +3514,8 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
// Optimistically assume that it is a subtype of Object[], // Optimistically assume that it is a subtype of Object[],
// so that we can fold up all the address arithmetic. // so that we can fold up all the address arithmetic.
layout_con = Klass::array_layout_helper(T_OBJECT); layout_con = Klass::array_layout_helper(T_OBJECT);
Node* cmp_lh = _gvn.transform( new(C) CmpINode(layout_val, intcon(layout_con)) ); Node* cmp_lh = _gvn.transform( new CmpINode(layout_val, intcon(layout_con)) );
Node* bol_lh = _gvn.transform( new(C) BoolNode(cmp_lh, BoolTest::eq) ); Node* bol_lh = _gvn.transform( new BoolNode(cmp_lh, BoolTest::eq) );
{ BuildCutout unless(this, bol_lh, PROB_MAX); { BuildCutout unless(this, bol_lh, PROB_MAX);
inc_sp(nargs); inc_sp(nargs);
uncommon_trap(Deoptimization::Reason_class_check, uncommon_trap(Deoptimization::Reason_class_check,
@ -3556,8 +3539,8 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
fast_size_limit <<= (LogBytesPerLong - log2_esize); fast_size_limit <<= (LogBytesPerLong - log2_esize);
} }
Node* initial_slow_cmp = _gvn.transform( new (C) CmpUNode( length, intcon( fast_size_limit ) ) ); Node* initial_slow_cmp = _gvn.transform( new CmpUNode( length, intcon( fast_size_limit ) ) );
Node* initial_slow_test = _gvn.transform( new (C) BoolNode( initial_slow_cmp, BoolTest::gt ) ); Node* initial_slow_test = _gvn.transform( new BoolNode( initial_slow_cmp, BoolTest::gt ) );
if (initial_slow_test->is_Bool()) { if (initial_slow_test->is_Bool()) {
// Hide it behind a CMoveI, or else PhaseIdealLoop::split_up will get sick. // Hide it behind a CMoveI, or else PhaseIdealLoop::split_up will get sick.
initial_slow_test = initial_slow_test->as_Bool()->as_int_value(&_gvn); initial_slow_test = initial_slow_test->as_Bool()->as_int_value(&_gvn);
@ -3585,10 +3568,10 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
} else { } else {
Node* hss = intcon(Klass::_lh_header_size_shift); Node* hss = intcon(Klass::_lh_header_size_shift);
Node* hsm = intcon(Klass::_lh_header_size_mask); Node* hsm = intcon(Klass::_lh_header_size_mask);
Node* hsize = _gvn.transform( new(C) URShiftINode(layout_val, hss) ); Node* hsize = _gvn.transform( new URShiftINode(layout_val, hss) );
hsize = _gvn.transform( new(C) AndINode(hsize, hsm) ); hsize = _gvn.transform( new AndINode(hsize, hsm) );
Node* mask = intcon(round_mask); Node* mask = intcon(round_mask);
header_size = _gvn.transform( new(C) AddINode(hsize, mask) ); header_size = _gvn.transform( new AddINode(hsize, mask) );
} }
Node* elem_shift = NULL; Node* elem_shift = NULL;
@ -3613,7 +3596,7 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
jlong size_max = arrayOopDesc::max_array_length(T_BYTE); jlong size_max = arrayOopDesc::max_array_length(T_BYTE);
if (size_max > tllen->_hi) size_max = tllen->_hi; if (size_max > tllen->_hi) size_max = tllen->_hi;
const TypeLong* tlcon = TypeLong::make(CONST64(0), size_max, Type::WidenMin); const TypeLong* tlcon = TypeLong::make(CONST64(0), size_max, Type::WidenMin);
lengthx = _gvn.transform( new (C) ConvI2LNode(length, tlcon)); lengthx = _gvn.transform( new ConvI2LNode(length, tlcon));
} }
} }
#endif #endif
@ -3624,11 +3607,11 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
// after a successful allocation. // after a successful allocation.
Node* abody = lengthx; Node* abody = lengthx;
if (elem_shift != NULL) if (elem_shift != NULL)
abody = _gvn.transform( new(C) LShiftXNode(lengthx, elem_shift) ); abody = _gvn.transform( new LShiftXNode(lengthx, elem_shift) );
Node* size = _gvn.transform( new(C) AddXNode(headerx, abody) ); Node* size = _gvn.transform( new AddXNode(headerx, abody) );
if (round_mask != 0) { if (round_mask != 0) {
Node* mask = MakeConX(~round_mask); Node* mask = MakeConX(~round_mask);
size = _gvn.transform( new(C) AndXNode(size, mask) ); size = _gvn.transform( new AndXNode(size, mask) );
} }
// else if round_mask == 0, the size computation is self-rounding // else if round_mask == 0, the size computation is self-rounding
@ -3646,7 +3629,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(TypeInt::INT), = new 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,
@ -3663,7 +3646,7 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
ary_type = ary_type->is_aryptr()->cast_to_size(length_type); ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
} }
Node* javaoop = set_output_for_allocation(alloc, ary_type); Node* javaoop = set_output_for_allocation(alloc, ary_type, deoptimize_on_exception);
// Cast length on remaining path to be as narrow as possible // Cast length on remaining path to be as narrow as possible
if (map()->find_edge(length) >= 0) { if (map()->find_edge(length) >= 0) {
@ -3760,10 +3743,10 @@ void GraphKit::add_predicate_impl(Deoptimization::DeoptReason reason, int nargs)
} }
Node *cont = _gvn.intcon(1); Node *cont = _gvn.intcon(1);
Node* opq = _gvn.transform(new (C) Opaque1Node(C, cont)); Node* opq = _gvn.transform(new Opaque1Node(C, cont));
Node *bol = _gvn.transform(new (C) Conv2BNode(opq)); Node *bol = _gvn.transform(new Conv2BNode(opq));
IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN); IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN);
Node* iffalse = _gvn.transform(new (C) IfFalseNode(iff)); Node* iffalse = _gvn.transform(new IfFalseNode(iff));
C->add_predicate_opaq(opq); C->add_predicate_opaq(opq);
{ {
PreserveJVMState pjvms(this); PreserveJVMState pjvms(this);
@ -3771,7 +3754,7 @@ void GraphKit::add_predicate_impl(Deoptimization::DeoptReason reason, int nargs)
inc_sp(nargs); inc_sp(nargs);
uncommon_trap(reason, Deoptimization::Action_maybe_recompile); uncommon_trap(reason, Deoptimization::Action_maybe_recompile);
} }
Node* iftrue = _gvn.transform(new (C) IfTrueNode(iff)); Node* iftrue = _gvn.transform(new IfTrueNode(iff));
set_control(iftrue); set_control(iftrue);
} }
@ -3963,7 +3946,7 @@ void GraphKit::g1_write_barrier_pre(bool do_load,
__ if_then(index, BoolTest::ne, zeroX, likely); { __ if_then(index, BoolTest::ne, zeroX, likely); {
// decrement the index // decrement the index
Node* next_index = _gvn.transform(new (C) SubXNode(index, __ ConX(sizeof(intptr_t)))); Node* next_index = _gvn.transform(new SubXNode(index, __ ConX(sizeof(intptr_t))));
// Now get the buffer location we will log the previous value into and store it // Now get the buffer location we will log the previous value into and store it
Node *log_addr = __ AddP(no_base, buffer, next_index); Node *log_addr = __ AddP(no_base, buffer, next_index);
@ -4006,7 +3989,7 @@ void GraphKit::g1_mark_card(IdealKit& ideal,
// Now do the queue work // Now do the queue work
__ if_then(index, BoolTest::ne, zeroX); { __ if_then(index, BoolTest::ne, zeroX); {
Node* next_index = _gvn.transform(new (C) SubXNode(index, __ ConX(sizeof(intptr_t)))); Node* next_index = _gvn.transform(new SubXNode(index, __ ConX(sizeof(intptr_t))));
Node* log_addr = __ AddP(no_base, buffer, next_index); Node* log_addr = __ AddP(no_base, buffer, next_index);
// Order, see storeCM. // Order, see storeCM.
@ -4213,5 +4196,5 @@ void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) {
Node* GraphKit::cast_array_to_stable(Node* ary, const TypeAryPtr* ary_type) { Node* GraphKit::cast_array_to_stable(Node* ary, const TypeAryPtr* ary_type) {
// Reify the property as a CastPP node in Ideal graph to comply with monotonicity // Reify the property as a CastPP node in Ideal graph to comply with monotonicity
// assumption of CCP analysis. // assumption of CCP analysis.
return _gvn.transform(new(C) CastPPNode(ary, ary_type->cast_to_stable(true))); return _gvn.transform(new CastPPNode(ary, ary_type->cast_to_stable(true)));
} }

View File

@ -309,31 +309,31 @@ class GraphKit : public Phase {
// Some convenient shortcuts for common nodes // Some convenient shortcuts for common nodes
Node* IfTrue(IfNode* iff) { return _gvn.transform(new (C) IfTrueNode(iff)); } Node* IfTrue(IfNode* iff) { return _gvn.transform(new IfTrueNode(iff)); }
Node* IfFalse(IfNode* iff) { return _gvn.transform(new (C) IfFalseNode(iff)); } Node* IfFalse(IfNode* iff) { return _gvn.transform(new IfFalseNode(iff)); }
Node* AddI(Node* l, Node* r) { return _gvn.transform(new (C) AddINode(l, r)); } Node* AddI(Node* l, Node* r) { return _gvn.transform(new AddINode(l, r)); }
Node* SubI(Node* l, Node* r) { return _gvn.transform(new (C) SubINode(l, r)); } Node* SubI(Node* l, Node* r) { return _gvn.transform(new SubINode(l, r)); }
Node* MulI(Node* l, Node* r) { return _gvn.transform(new (C) MulINode(l, r)); } Node* MulI(Node* l, Node* r) { return _gvn.transform(new MulINode(l, r)); }
Node* DivI(Node* ctl, Node* l, Node* r) { return _gvn.transform(new (C) DivINode(ctl, l, r)); } Node* DivI(Node* ctl, Node* l, Node* r) { return _gvn.transform(new DivINode(ctl, l, r)); }
Node* AndI(Node* l, Node* r) { return _gvn.transform(new (C) AndINode(l, r)); } Node* AndI(Node* l, Node* r) { return _gvn.transform(new AndINode(l, r)); }
Node* OrI(Node* l, Node* r) { return _gvn.transform(new (C) OrINode(l, r)); } Node* OrI(Node* l, Node* r) { return _gvn.transform(new OrINode(l, r)); }
Node* XorI(Node* l, Node* r) { return _gvn.transform(new (C) XorINode(l, r)); } Node* XorI(Node* l, Node* r) { return _gvn.transform(new XorINode(l, r)); }
Node* MaxI(Node* l, Node* r) { return _gvn.transform(new (C) MaxINode(l, r)); } Node* MaxI(Node* l, Node* r) { return _gvn.transform(new MaxINode(l, r)); }
Node* MinI(Node* l, Node* r) { return _gvn.transform(new (C) MinINode(l, r)); } Node* MinI(Node* l, Node* r) { return _gvn.transform(new MinINode(l, r)); }
Node* LShiftI(Node* l, Node* r) { return _gvn.transform(new (C) LShiftINode(l, r)); } Node* LShiftI(Node* l, Node* r) { return _gvn.transform(new LShiftINode(l, r)); }
Node* RShiftI(Node* l, Node* r) { return _gvn.transform(new (C) RShiftINode(l, r)); } Node* RShiftI(Node* l, Node* r) { return _gvn.transform(new RShiftINode(l, r)); }
Node* URShiftI(Node* l, Node* r) { return _gvn.transform(new (C) URShiftINode(l, r)); } Node* URShiftI(Node* l, Node* r) { return _gvn.transform(new URShiftINode(l, r)); }
Node* CmpI(Node* l, Node* r) { return _gvn.transform(new (C) CmpINode(l, r)); } Node* CmpI(Node* l, Node* r) { return _gvn.transform(new CmpINode(l, r)); }
Node* CmpL(Node* l, Node* r) { return _gvn.transform(new (C) CmpLNode(l, r)); } Node* CmpL(Node* l, Node* r) { return _gvn.transform(new CmpLNode(l, r)); }
Node* CmpP(Node* l, Node* r) { return _gvn.transform(new (C) CmpPNode(l, r)); } Node* CmpP(Node* l, Node* r) { return _gvn.transform(new CmpPNode(l, r)); }
Node* Bool(Node* cmp, BoolTest::mask relop) { return _gvn.transform(new (C) BoolNode(cmp, relop)); } Node* Bool(Node* cmp, BoolTest::mask relop) { return _gvn.transform(new BoolNode(cmp, relop)); }
Node* AddP(Node* b, Node* a, Node* o) { return _gvn.transform(new (C) AddPNode(b, a, o)); } Node* AddP(Node* b, Node* a, Node* o) { return _gvn.transform(new AddPNode(b, a, o)); }
// Convert between int and long, and size_t. // Convert between int and long, and size_t.
// (See macros ConvI2X, etc., in type.hpp for ConvI2X, etc.) // (See macros ConvI2X, etc., in type.hpp for ConvI2X, etc.)
@ -690,7 +690,7 @@ class GraphKit : public Phase {
// Replace the call with the current state of the kit. Requires // Replace the call with the current state of the kit. Requires
// that the call was generated with separate io_projs so that // that the call was generated with separate io_projs so that
// exceptional control flow can be handled properly. // exceptional control flow can be handled properly.
void replace_call(CallNode* call, Node* result); void replace_call(CallNode* call, Node* result, bool do_replaced_nodes = false);
// helper functions for statistics // helper functions for statistics
void increment_counter(address counter_addr); // increment a debug counter void increment_counter(address counter_addr); // increment a debug counter
@ -807,7 +807,7 @@ class GraphKit : public Phase {
// merge in all memory slices from new_mem, along the given path // merge in all memory slices from new_mem, along the given path
void merge_memory(Node* new_mem, Node* region, int new_path); void merge_memory(Node* new_mem, Node* region, int new_path);
void make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj); void make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj, bool deoptimize = false);
// Helper functions to build synchronizations // Helper functions to build synchronizations
int next_monitor(); int next_monitor();
@ -849,13 +849,16 @@ class GraphKit : public Phase {
// implementation of object creation // implementation of object creation
Node* set_output_for_allocation(AllocateNode* alloc, Node* set_output_for_allocation(AllocateNode* alloc,
const TypeOopPtr* oop_type); const TypeOopPtr* oop_type,
bool deoptimize_on_exception=false);
Node* get_layout_helper(Node* klass_node, jint& constant_value); Node* get_layout_helper(Node* klass_node, jint& constant_value);
Node* new_instance(Node* klass_node, Node* new_instance(Node* klass_node,
Node* slow_test = NULL, Node* slow_test = NULL,
Node* *return_size_val = NULL); Node* *return_size_val = NULL,
bool deoptimize_on_exception = false);
Node* new_array(Node* klass_node, Node* count_val, int nargs, Node* new_array(Node* klass_node, Node* count_val, int nargs,
Node* *return_size_val = NULL); Node* *return_size_val = NULL,
bool deoptimize_on_exception = false);
// java.lang.String helpers // java.lang.String helpers
Node* load_String_offset(Node* ctrl, Node* str); Node* load_String_offset(Node* ctrl, Node* str);
@ -867,7 +870,7 @@ class GraphKit : public Phase {
// Handy for making control flow // Handy for making control flow
IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) { IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) {
IfNode* iff = new (C) IfNode(ctrl, tst, prob, cnt);// New IfNode's IfNode* iff = new IfNode(ctrl, tst, prob, cnt);// New IfNode's
_gvn.set_type(iff, iff->Value(&_gvn)); // Value may be known at parse-time _gvn.set_type(iff, iff->Value(&_gvn)); // Value may be known at parse-time
// Place 'if' on worklist if it will be in graph // Place 'if' on worklist if it will be in graph
if (!tst->is_Con()) record_for_igvn(iff); // Range-check and Null-check removal is later if (!tst->is_Con()) record_for_igvn(iff); // Range-check and Null-check removal is later
@ -875,7 +878,7 @@ class GraphKit : public Phase {
} }
IfNode* create_and_xform_if(Node* ctrl, Node* tst, float prob, float cnt) { IfNode* create_and_xform_if(Node* ctrl, Node* tst, float prob, float cnt) {
IfNode* iff = new (C) IfNode(ctrl, tst, prob, cnt);// New IfNode's IfNode* iff = new IfNode(ctrl, tst, prob, cnt);// New IfNode's
_gvn.transform(iff); // Value may be known at parse-time _gvn.transform(iff); // Value may be known at parse-time
// Place 'if' on worklist if it will be in graph // Place 'if' on worklist if it will be in graph
if (!tst->is_Con()) record_for_igvn(iff); // Range-check and Null-check removal is later if (!tst->is_Con()) record_for_igvn(iff); // Range-check and Null-check removal is later

View File

@ -86,7 +86,7 @@ void IdealKit::if_then(Node* left, BoolTest::mask relop,
} }
// Delay gvn.tranform on if-nodes until construction is finished // Delay gvn.tranform on if-nodes until construction is finished
// to prevent a constant bool input from discarding a control output. // to prevent a constant bool input from discarding a control output.
IfNode* iff = delay_transform(new (C) IfNode(ctrl(), bol, prob, cnt))->as_If(); IfNode* iff = delay_transform(new IfNode(ctrl(), bol, prob, cnt))->as_If();
Node* then = IfTrue(iff); Node* then = IfTrue(iff);
Node* elsen = IfFalse(iff); Node* elsen = IfFalse(iff);
Node* else_cvstate = copy_cvstate(); Node* else_cvstate = copy_cvstate();
@ -205,7 +205,7 @@ Node* IdealKit::make_label(int goto_ct) {
assert(_cvstate != NULL, "must declare variables before labels"); assert(_cvstate != NULL, "must declare variables before labels");
Node* lab = new_cvstate(); Node* lab = new_cvstate();
int sz = 1 + goto_ct + 1 /* fall thru */; int sz = 1 + goto_ct + 1 /* fall thru */;
Node* reg = delay_transform(new (C) RegionNode(sz)); Node* reg = delay_transform(new RegionNode(sz));
lab->init_req(TypeFunc::Control, reg); lab->init_req(TypeFunc::Control, reg);
return lab; return lab;
} }
@ -312,7 +312,7 @@ Node* IdealKit::delay_transform(Node* n) {
//-----------------------------new_cvstate----------------------------------- //-----------------------------new_cvstate-----------------------------------
Node* IdealKit::new_cvstate() { Node* IdealKit::new_cvstate() {
uint sz = _var_ct + first_var; uint sz = _var_ct + first_var;
return new (C) Node(sz); return new Node(sz);
} }
//-----------------------------copy_cvstate----------------------------------- //-----------------------------copy_cvstate-----------------------------------
@ -397,7 +397,7 @@ Node* IdealKit::storeCM(Node* ctl, Node* adr, Node *val, Node* oop_store, int oo
// Add required edge to oop_store, optimizer does not support precedence edges. // Add required edge to oop_store, optimizer does not support precedence edges.
// Convert required edge to precedence edge before allocation. // Convert required edge to precedence edge before allocation.
Node* st = new (C) StoreCMNode(ctl, mem, adr, adr_type, val, oop_store, oop_adr_idx); Node* st = new StoreCMNode(ctl, mem, adr, adr_type, val, oop_store, oop_adr_idx);
st = transform(st); st = transform(st);
set_memory(st, adr_idx); set_memory(st, adr_idx);
@ -497,7 +497,7 @@ void IdealKit::make_leaf_call(const TypeFunc *slow_call_type,
uint adr_idx = C->get_alias_index(adr_type); uint adr_idx = C->get_alias_index(adr_type);
// Slow-path leaf call // Slow-path leaf call
CallNode *call = (CallNode*)new (C) CallLeafNode( slow_call_type, slow_call, leaf_name, adr_type); CallNode *call = (CallNode*)new CallLeafNode( slow_call_type, slow_call, leaf_name, adr_type);
// Set fixed predefined input arguments // Set fixed predefined input arguments
call->init_req( TypeFunc::Control, ctrl() ); call->init_req( TypeFunc::Control, ctrl() );
@ -518,10 +518,10 @@ void IdealKit::make_leaf_call(const TypeFunc *slow_call_type,
// Slow leaf call has no side-effects, sets few values // Slow leaf call has no side-effects, sets few values
set_ctrl(transform( new (C) ProjNode(call,TypeFunc::Control) )); set_ctrl(transform( new ProjNode(call,TypeFunc::Control) ));
// Make memory for the call // Make memory for the call
Node* mem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) ); Node* mem = _gvn.transform( new ProjNode(call, TypeFunc::Memory) );
// Set the RawPtr memory state only. // Set the RawPtr memory state only.
set_memory(mem, adr_idx); set_memory(mem, adr_idx);
@ -544,7 +544,7 @@ void IdealKit::make_leaf_call_no_fp(const TypeFunc *slow_call_type,
uint adr_idx = C->get_alias_index(adr_type); uint adr_idx = C->get_alias_index(adr_type);
// Slow-path leaf call // Slow-path leaf call
CallNode *call = (CallNode*)new (C) CallLeafNoFPNode( slow_call_type, slow_call, leaf_name, adr_type); CallNode *call = (CallNode*)new CallLeafNoFPNode( slow_call_type, slow_call, leaf_name, adr_type);
// Set fixed predefined input arguments // Set fixed predefined input arguments
call->init_req( TypeFunc::Control, ctrl() ); call->init_req( TypeFunc::Control, ctrl() );
@ -565,10 +565,10 @@ void IdealKit::make_leaf_call_no_fp(const TypeFunc *slow_call_type,
// Slow leaf call has no side-effects, sets few values // Slow leaf call has no side-effects, sets few values
set_ctrl(transform( new (C) ProjNode(call,TypeFunc::Control) )); set_ctrl(transform( new ProjNode(call,TypeFunc::Control) ));
// Make memory for the call // Make memory for the call
Node* mem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) ); Node* mem = _gvn.transform( new ProjNode(call, TypeFunc::Memory) );
// Set the RawPtr memory state only. // Set the RawPtr memory state only.
set_memory(mem, adr_idx); set_memory(mem, adr_idx);

View File

@ -173,43 +173,43 @@ class IdealKit: public StackObj {
void goto_(Node* lab, bool bind = false); void goto_(Node* lab, bool bind = false);
void declarations_done(); void declarations_done();
Node* IfTrue(IfNode* iff) { return transform(new (C) IfTrueNode(iff)); } Node* IfTrue(IfNode* iff) { return transform(new IfTrueNode(iff)); }
Node* IfFalse(IfNode* iff) { return transform(new (C) IfFalseNode(iff)); } Node* IfFalse(IfNode* iff) { return transform(new IfFalseNode(iff)); }
// Data // Data
Node* ConI(jint k) { return (Node*)gvn().intcon(k); } Node* ConI(jint k) { return (Node*)gvn().intcon(k); }
Node* makecon(const Type *t) const { return _gvn.makecon(t); } Node* makecon(const Type *t) const { return _gvn.makecon(t); }
Node* AddI(Node* l, Node* r) { return transform(new (C) AddINode(l, r)); } Node* AddI(Node* l, Node* r) { return transform(new AddINode(l, r)); }
Node* SubI(Node* l, Node* r) { return transform(new (C) SubINode(l, r)); } Node* SubI(Node* l, Node* r) { return transform(new SubINode(l, r)); }
Node* AndI(Node* l, Node* r) { return transform(new (C) AndINode(l, r)); } Node* AndI(Node* l, Node* r) { return transform(new AndINode(l, r)); }
Node* MaxI(Node* l, Node* r) { return transform(new (C) MaxINode(l, r)); } Node* MaxI(Node* l, Node* r) { return transform(new MaxINode(l, r)); }
Node* LShiftI(Node* l, Node* r) { return transform(new (C) LShiftINode(l, r)); } Node* LShiftI(Node* l, Node* r) { return transform(new LShiftINode(l, r)); }
Node* CmpI(Node* l, Node* r) { return transform(new (C) CmpINode(l, r)); } Node* CmpI(Node* l, Node* r) { return transform(new CmpINode(l, r)); }
Node* Bool(Node* cmp, BoolTest::mask relop) { return transform(new (C) BoolNode(cmp, relop)); } Node* Bool(Node* cmp, BoolTest::mask relop) { return transform(new BoolNode(cmp, relop)); }
void increment(IdealVariable& v, Node* j) { set(v, AddI(value(v), j)); } void increment(IdealVariable& v, Node* j) { set(v, AddI(value(v), j)); }
void decrement(IdealVariable& v, Node* j) { set(v, SubI(value(v), j)); } void decrement(IdealVariable& v, Node* j) { set(v, SubI(value(v), j)); }
Node* CmpL(Node* l, Node* r) { return transform(new (C) CmpLNode(l, r)); } Node* CmpL(Node* l, Node* r) { return transform(new CmpLNode(l, r)); }
// TLS // TLS
Node* thread() { return gvn().transform(new (C) ThreadLocalNode()); } Node* thread() { return gvn().transform(new ThreadLocalNode()); }
// Pointers // Pointers
// Raw address should be transformed regardless 'delay_transform' flag // Raw address should be transformed regardless 'delay_transform' flag
// to produce canonical form CastX2P(offset). // to produce canonical form CastX2P(offset).
Node* AddP(Node *base, Node *ptr, Node *off) { return _gvn.transform(new (C) AddPNode(base, ptr, off)); } Node* AddP(Node *base, Node *ptr, Node *off) { return _gvn.transform(new AddPNode(base, ptr, off)); }
Node* CmpP(Node* l, Node* r) { return transform(new (C) CmpPNode(l, r)); } Node* CmpP(Node* l, Node* r) { return transform(new CmpPNode(l, r)); }
#ifdef _LP64 #ifdef _LP64
Node* XorX(Node* l, Node* r) { return transform(new (C) XorLNode(l, r)); } Node* XorX(Node* l, Node* r) { return transform(new XorLNode(l, r)); }
#else // _LP64 #else // _LP64
Node* XorX(Node* l, Node* r) { return transform(new (C) XorINode(l, r)); } Node* XorX(Node* l, Node* r) { return transform(new XorINode(l, r)); }
#endif // _LP64 #endif // _LP64
Node* URShiftX(Node* l, Node* r) { return transform(new (C) URShiftXNode(l, r)); } Node* URShiftX(Node* l, Node* r) { return transform(new URShiftXNode(l, r)); }
Node* ConX(jint k) { return (Node*)gvn().MakeConX(k); } Node* ConX(jint k) { return (Node*)gvn().MakeConX(k); }
Node* CastPX(Node* ctl, Node* p) { return transform(new (C) CastP2XNode(ctl, p)); } Node* CastPX(Node* ctl, Node* p) { return transform(new CastP2XNode(ctl, p)); }
// Memory operations // Memory operations

View File

@ -238,10 +238,10 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
Node* predicate_x = NULL; Node* predicate_x = NULL;
bool counted_loop = r->is_CountedLoop(); bool counted_loop = r->is_CountedLoop();
Node *region_c = new (igvn->C) RegionNode(req_c + 1); Node *region_c = new RegionNode(req_c + 1);
Node *phi_c = con1; Node *phi_c = con1;
uint len = r->req(); uint len = r->req();
Node *region_x = new (igvn->C) RegionNode(len - req_c); Node *region_x = new RegionNode(len - req_c);
Node *phi_x = PhiNode::make_blank(region_x, phi); Node *phi_x = PhiNode::make_blank(region_x, phi);
for (uint i = 1, i_c = 1, i_x = 1; i < len; i++) { for (uint i = 1, i_c = 1, i_x = 1; i < len; i++) {
if (phi->in(i) == con1) { if (phi->in(i) == con1) {
@ -272,7 +272,7 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
// Prevent the untimely death of phi_x. Currently he has no uses. He is // Prevent the untimely death of phi_x. Currently he has no uses. He is
// about to get one. If this only use goes away, then phi_x will look dead. // about to get one. If this only use goes away, then phi_x will look dead.
// However, he will be picking up some more uses down below. // However, he will be picking up some more uses down below.
Node *hook = new (igvn->C) Node(4); Node *hook = new Node(4);
hook->init_req(0, phi_x); hook->init_req(0, phi_x);
hook->init_req(1, phi_c); hook->init_req(1, phi_c);
phi_x = phase->transform( phi_x ); phi_x = phase->transform( phi_x );
@ -284,30 +284,30 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
cmp_x->set_req(2,con2); cmp_x->set_req(2,con2);
cmp_x = phase->transform(cmp_x); cmp_x = phase->transform(cmp_x);
// Make the bool // Make the bool
Node *b_c = phase->transform(new (igvn->C) BoolNode(cmp_c,b->_test._test)); Node *b_c = phase->transform(new BoolNode(cmp_c,b->_test._test));
Node *b_x = phase->transform(new (igvn->C) BoolNode(cmp_x,b->_test._test)); Node *b_x = phase->transform(new BoolNode(cmp_x,b->_test._test));
// Make the IfNode // Make the IfNode
IfNode *iff_c = new (igvn->C) IfNode(region_c,b_c,iff->_prob,iff->_fcnt); IfNode *iff_c = new IfNode(region_c,b_c,iff->_prob,iff->_fcnt);
igvn->set_type_bottom(iff_c); igvn->set_type_bottom(iff_c);
igvn->_worklist.push(iff_c); igvn->_worklist.push(iff_c);
hook->init_req(2, iff_c); hook->init_req(2, iff_c);
IfNode *iff_x = new (igvn->C) IfNode(region_x,b_x,iff->_prob, iff->_fcnt); IfNode *iff_x = new IfNode(region_x,b_x,iff->_prob, iff->_fcnt);
igvn->set_type_bottom(iff_x); igvn->set_type_bottom(iff_x);
igvn->_worklist.push(iff_x); igvn->_worklist.push(iff_x);
hook->init_req(3, iff_x); hook->init_req(3, iff_x);
// Make the true/false arms // Make the true/false arms
Node *iff_c_t = phase->transform(new (igvn->C) IfTrueNode (iff_c)); Node *iff_c_t = phase->transform(new IfTrueNode (iff_c));
Node *iff_c_f = phase->transform(new (igvn->C) IfFalseNode(iff_c)); Node *iff_c_f = phase->transform(new IfFalseNode(iff_c));
if (predicate_c != NULL) { if (predicate_c != NULL) {
assert(predicate_x == NULL, "only one predicate entry expected"); assert(predicate_x == NULL, "only one predicate entry expected");
// Clone loop predicates to each path // Clone loop predicates to each path
iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t, !counted_loop); iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t, !counted_loop);
iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f, !counted_loop); iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f, !counted_loop);
} }
Node *iff_x_t = phase->transform(new (igvn->C) IfTrueNode (iff_x)); Node *iff_x_t = phase->transform(new IfTrueNode (iff_x));
Node *iff_x_f = phase->transform(new (igvn->C) IfFalseNode(iff_x)); Node *iff_x_f = phase->transform(new IfFalseNode(iff_x));
if (predicate_x != NULL) { if (predicate_x != NULL) {
assert(predicate_c == NULL, "only one predicate entry expected"); assert(predicate_c == NULL, "only one predicate entry expected");
// Clone loop predicates to each path // Clone loop predicates to each path
@ -316,14 +316,14 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
} }
// Merge the TRUE paths // Merge the TRUE paths
Node *region_s = new (igvn->C) RegionNode(3); Node *region_s = new RegionNode(3);
igvn->_worklist.push(region_s); igvn->_worklist.push(region_s);
region_s->init_req(1, iff_c_t); region_s->init_req(1, iff_c_t);
region_s->init_req(2, iff_x_t); region_s->init_req(2, iff_x_t);
igvn->register_new_node_with_optimizer( region_s ); igvn->register_new_node_with_optimizer( region_s );
// Merge the FALSE paths // Merge the FALSE paths
Node *region_f = new (igvn->C) RegionNode(3); Node *region_f = new RegionNode(3);
igvn->_worklist.push(region_f); igvn->_worklist.push(region_f);
region_f->init_req(1, iff_c_f); region_f->init_req(1, iff_c_f);
region_f->init_req(2, iff_x_f); region_f->init_req(2, iff_x_f);
@ -438,7 +438,7 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
// Must return either the original node (now dead) or a new node // 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.) // (Do not return a top here, since that would break the uniqueness of top.)
return new (igvn->C) ConINode(TypeInt::ZERO); return new ConINode(TypeInt::ZERO);
} }
//------------------------------is_range_check--------------------------------- //------------------------------is_range_check---------------------------------
@ -541,16 +541,16 @@ static void adjust_check(Node* proj, Node* range, Node* index,
// Compute a new check // Compute a new check
Node *new_add = gvn->intcon(off_lo); Node *new_add = gvn->intcon(off_lo);
if( index ) { if( index ) {
new_add = off_lo ? gvn->transform(new (gvn->C) AddINode( index, new_add )) : index; new_add = off_lo ? gvn->transform(new AddINode( index, new_add )) : index;
} }
Node *new_cmp = (flip == 1) Node *new_cmp = (flip == 1)
? new (gvn->C) CmpUNode( new_add, range ) ? new CmpUNode( new_add, range )
: new (gvn->C) CmpUNode( range, new_add ); : new CmpUNode( range, new_add );
new_cmp = gvn->transform(new_cmp); new_cmp = gvn->transform(new_cmp);
// See if no need to adjust the existing check // See if no need to adjust the existing check
if( new_cmp == cmp ) return; if( new_cmp == cmp ) return;
// Else, adjust existing check // Else, adjust existing check
Node *new_bol = gvn->transform( new (gvn->C) BoolNode( new_cmp, bol->as_Bool()->_test._test ) ); Node *new_bol = gvn->transform( new BoolNode( new_cmp, bol->as_Bool()->_test._test ) );
igvn->rehash_node_delayed( iff ); igvn->rehash_node_delayed( iff );
iff->set_req_X( 1, new_bol, igvn ); iff->set_req_X( 1, new_bol, igvn );
} }
@ -728,9 +728,9 @@ Node* IfNode::fold_compares(PhaseGVN* phase) {
if (failtype->_hi != max_jint && failtype->_lo != min_jint && bound > 1) { if (failtype->_hi != max_jint && failtype->_lo != min_jint && bound > 1) {
// Merge the two compares into a single unsigned compare by building (CmpU (n - lo) hi) // Merge the two compares into a single unsigned compare by building (CmpU (n - lo) hi)
BoolTest::mask cond = fail->as_Proj()->_con ? BoolTest::lt : BoolTest::ge; BoolTest::mask cond = fail->as_Proj()->_con ? BoolTest::lt : BoolTest::ge;
Node* adjusted = phase->transform(new (phase->C) SubINode(n, phase->intcon(failtype->_lo))); Node* adjusted = phase->transform(new SubINode(n, phase->intcon(failtype->_lo)));
Node* newcmp = phase->transform(new (phase->C) CmpUNode(adjusted, phase->intcon(bound))); Node* newcmp = phase->transform(new CmpUNode(adjusted, phase->intcon(bound)));
Node* newbool = phase->transform(new (phase->C) BoolNode(newcmp, cond)); Node* newbool = phase->transform(new BoolNode(newcmp, cond));
phase->is_IterGVN()->replace_input_of(dom_iff, 1, phase->intcon(ctrl->as_Proj()->_con)); phase->is_IterGVN()->replace_input_of(dom_iff, 1, phase->intcon(ctrl->as_Proj()->_con));
phase->hash_delete(this); phase->hash_delete(this);
set_req(1, newbool); set_req(1, newbool);
@ -1003,7 +1003,7 @@ Node *IfNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// Must return either the original node (now dead) or a new node // 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.) // (Do not return a top here, since that would break the uniqueness of top.)
return new (phase->C) ConINode(TypeInt::ZERO); return new ConINode(TypeInt::ZERO);
} }
//------------------------------dominated_by----------------------------------- //------------------------------dominated_by-----------------------------------
@ -1099,7 +1099,7 @@ static IfNode* idealize_test(PhaseGVN* phase, IfNode* iff) {
// Flip test to be canonical. Requires flipping the IfFalse/IfTrue and // Flip test to be canonical. Requires flipping the IfFalse/IfTrue and
// cloning the IfNode. // cloning the IfNode.
Node* new_b = phase->transform( new (phase->C) BoolNode(b->in(1), bt.negate()) ); Node* new_b = phase->transform( new BoolNode(b->in(1), bt.negate()) );
if( !new_b->is_Bool() ) return NULL; if( !new_b->is_Bool() ) return NULL;
b = new_b->as_Bool(); b = new_b->as_Bool();
@ -1107,7 +1107,7 @@ static IfNode* idealize_test(PhaseGVN* phase, IfNode* iff) {
assert( igvn, "Test is not canonical in parser?" ); assert( igvn, "Test is not canonical in parser?" );
// The IF node never really changes, but it needs to be cloned // The IF node never really changes, but it needs to be cloned
iff = new (phase->C) IfNode( iff->in(0), b, 1.0-iff->_prob, iff->_fcnt); iff = new IfNode( iff->in(0), b, 1.0-iff->_prob, iff->_fcnt);
Node *prior = igvn->hash_find_insert(iff); Node *prior = igvn->hash_find_insert(iff);
if( prior ) { if( prior ) {
@ -1120,8 +1120,8 @@ static IfNode* idealize_test(PhaseGVN* phase, IfNode* iff) {
igvn->_worklist.push(iff); igvn->_worklist.push(iff);
// Now handle projections. Cloning not required. // Now handle projections. Cloning not required.
Node* new_if_f = (Node*)(new (phase->C) IfFalseNode( iff )); Node* new_if_f = (Node*)(new IfFalseNode( iff ));
Node* new_if_t = (Node*)(new (phase->C) IfTrueNode ( iff )); Node* new_if_t = (Node*)(new IfTrueNode ( iff ));
igvn->register_new_node_with_optimizer(new_if_f); igvn->register_new_node_with_optimizer(new_if_f);
igvn->register_new_node_with_optimizer(new_if_t); igvn->register_new_node_with_optimizer(new_if_t);

View File

@ -419,7 +419,7 @@ void PhaseCFG::implicit_null_check(Block* block, Node *proj, Node *val, int allo
Node *tmp2 = block->get_node(block->end_idx()+2); Node *tmp2 = block->get_node(block->end_idx()+2);
block->map_node(tmp2, block->end_idx()+1); block->map_node(tmp2, block->end_idx()+1);
block->map_node(tmp1, block->end_idx()+2); block->map_node(tmp1, block->end_idx()+2);
Node *tmp = new (C) Node(C->top()); // Use not NULL input Node *tmp = new Node(C->top()); // Use not NULL input
tmp1->replace_by(tmp); tmp1->replace_by(tmp);
tmp2->replace_by(tmp1); tmp2->replace_by(tmp1);
tmp->replace_by(tmp2); tmp->replace_by(tmp2);
@ -430,7 +430,7 @@ void PhaseCFG::implicit_null_check(Block* block, Node *proj, Node *val, int allo
// Since schedule-local needs precise def-use info, we need to correct // Since schedule-local needs precise def-use info, we need to correct
// it as well. // it as well.
Node *old_tst = proj->in(0); Node *old_tst = proj->in(0);
MachNode *nul_chk = new (C) MachNullCheckNode(old_tst->in(0),best,bidx); MachNode *nul_chk = new MachNullCheckNode(old_tst->in(0),best,bidx);
block->map_node(nul_chk, block->end_idx()); block->map_node(nul_chk, block->end_idx());
map_node_to_block(nul_chk, block); map_node_to_block(nul_chk, block);
// Redirect users of old_test to nul_chk // Redirect users of old_test to nul_chk
@ -671,7 +671,7 @@ uint PhaseCFG::sched_call(Block* block, uint node_cnt, Node_List& worklist, Grow
// Set all registers killed and not already defined by the call. // Set all registers killed and not already defined by the call.
uint r_cnt = mcall->tf()->range()->cnt(); uint r_cnt = mcall->tf()->range()->cnt();
int op = mcall->ideal_Opcode(); int op = mcall->ideal_Opcode();
MachProjNode *proj = new (C) MachProjNode( mcall, r_cnt+1, RegMask::Empty, MachProjNode::fat_proj ); MachProjNode *proj = new MachProjNode( mcall, r_cnt+1, RegMask::Empty, MachProjNode::fat_proj );
map_node_to_block(proj, block); map_node_to_block(proj, block);
block->insert_node(proj, node_cnt++); block->insert_node(proj, node_cnt++);
@ -900,7 +900,7 @@ bool PhaseCFG::schedule_local(Block* block, GrowableArray<int>& ready_cnt, Vecto
regs.Insert(_matcher.c_frame_pointer()); regs.Insert(_matcher.c_frame_pointer());
regs.OR(n->out_RegMask()); regs.OR(n->out_RegMask());
MachProjNode *proj = new (C) MachProjNode( n, 1, RegMask::Empty, MachProjNode::fat_proj ); MachProjNode *proj = new MachProjNode( n, 1, RegMask::Empty, MachProjNode::fat_proj );
map_node_to_block(proj, block); map_node_to_block(proj, block);
block->insert_node(proj, phi_cnt++); block->insert_node(proj, phi_cnt++);

File diff suppressed because it is too large Load Diff

View File

@ -104,7 +104,7 @@ ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node*
assert(rgn->is_Call(), "must be call uct"); assert(rgn->is_Call(), "must be call uct");
CallNode* call = rgn->as_Call(); CallNode* call = rgn->as_Call();
IdealLoopTree* loop = get_loop(call); IdealLoopTree* loop = get_loop(call);
rgn = new (C) RegionNode(1); rgn = new RegionNode(1);
rgn->add_req(uncommon_proj); rgn->add_req(uncommon_proj);
register_control(rgn, loop, uncommon_proj); register_control(rgn, loop, uncommon_proj);
_igvn.hash_delete(call); _igvn.hash_delete(call);
@ -130,8 +130,8 @@ ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node*
IfNode *new_iff = iff->clone()->as_If(); IfNode *new_iff = iff->clone()->as_If();
new_iff->set_req(0, entry); new_iff->set_req(0, entry);
register_control(new_iff, lp, entry); register_control(new_iff, lp, entry);
Node *if_cont = new (C) IfTrueNode(new_iff); Node *if_cont = new IfTrueNode(new_iff);
Node *if_uct = new (C) IfFalseNode(new_iff); Node *if_uct = new IfFalseNode(new_iff);
if (cont_proj->is_IfFalse()) { if (cont_proj->is_IfFalse()) {
// Swap // Swap
Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp; Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp;
@ -191,7 +191,7 @@ ProjNode* PhaseIterGVN::create_new_if_for_predicate(ProjNode* cont_proj, Node* n
if (!rgn->is_Region()) { // create a region to guard the call if (!rgn->is_Region()) { // create a region to guard the call
assert(rgn->is_Call(), "must be call uct"); assert(rgn->is_Call(), "must be call uct");
CallNode* call = rgn->as_Call(); CallNode* call = rgn->as_Call();
rgn = new (C) RegionNode(1); rgn = new RegionNode(1);
register_new_node_with_optimizer(rgn); register_new_node_with_optimizer(rgn);
rgn->add_req(uncommon_proj); rgn->add_req(uncommon_proj);
hash_delete(call); hash_delete(call);
@ -208,8 +208,8 @@ ProjNode* PhaseIterGVN::create_new_if_for_predicate(ProjNode* cont_proj, Node* n
new_iff->set_req(0, new_entry); new_iff->set_req(0, new_entry);
register_new_node_with_optimizer(new_iff); register_new_node_with_optimizer(new_iff);
Node *if_cont = new (C) IfTrueNode(new_iff); Node *if_cont = new IfTrueNode(new_iff);
Node *if_uct = new (C) IfFalseNode(new_iff); Node *if_uct = new IfFalseNode(new_iff);
if (cont_proj->is_IfFalse()) { if (cont_proj->is_IfFalse()) {
// Swap // Swap
Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp; Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp;
@ -254,10 +254,10 @@ ProjNode* PhaseIdealLoop::clone_predicate(ProjNode* predicate_proj, Node* new_en
// Match original condition since predicate's projections could be swapped. // Match original condition since predicate's projections could be swapped.
assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
Node* opq = new (igvn->C) Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1)); Node* opq = new Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1));
igvn->C->add_predicate_opaq(opq); igvn->C->add_predicate_opaq(opq);
Node* bol = new (igvn->C) Conv2BNode(opq); Node* bol = new Conv2BNode(opq);
if (loop_phase != NULL) { if (loop_phase != NULL) {
loop_phase->register_new_node(opq, ctrl); loop_phase->register_new_node(opq, ctrl);
loop_phase->register_new_node(bol, ctrl); loop_phase->register_new_node(bol, ctrl);
@ -605,11 +605,11 @@ BoolNode* PhaseIdealLoop::rc_predicate(IdealLoopTree *loop, Node* ctrl,
// Calculate exact limit here. // Calculate exact limit here.
// Note, counted loop's test is '<' or '>'. // Note, counted loop's test is '<' or '>'.
limit = exact_limit(loop); limit = exact_limit(loop);
max_idx_expr = new (C) SubINode(limit, stride); max_idx_expr = new SubINode(limit, stride);
register_new_node(max_idx_expr, ctrl); register_new_node(max_idx_expr, ctrl);
if (TraceLoopPredicate) predString->print("(limit - stride) "); if (TraceLoopPredicate) predString->print("(limit - stride) ");
} else { } else {
max_idx_expr = new (C) SubINode(limit, stride); max_idx_expr = new SubINode(limit, stride);
register_new_node(max_idx_expr, ctrl); register_new_node(max_idx_expr, ctrl);
if (TraceLoopPredicate) predString->print("(limit - stride) "); if (TraceLoopPredicate) predString->print("(limit - stride) ");
} }
@ -619,22 +619,22 @@ BoolNode* PhaseIdealLoop::rc_predicate(IdealLoopTree *loop, Node* ctrl,
if (scale != 1) { if (scale != 1) {
ConNode* con_scale = _igvn.intcon(scale); ConNode* con_scale = _igvn.intcon(scale);
max_idx_expr = new (C) MulINode(max_idx_expr, con_scale); max_idx_expr = new MulINode(max_idx_expr, con_scale);
register_new_node(max_idx_expr, ctrl); register_new_node(max_idx_expr, ctrl);
if (TraceLoopPredicate) predString->print("* %d ", scale); if (TraceLoopPredicate) predString->print("* %d ", scale);
} }
if (offset && (!offset->is_Con() || offset->get_int() != 0)){ if (offset && (!offset->is_Con() || offset->get_int() != 0)){
max_idx_expr = new (C) AddINode(max_idx_expr, offset); max_idx_expr = new AddINode(max_idx_expr, offset);
register_new_node(max_idx_expr, ctrl); register_new_node(max_idx_expr, ctrl);
if (TraceLoopPredicate) if (TraceLoopPredicate)
if (offset->is_Con()) predString->print("+ %d ", offset->get_int()); if (offset->is_Con()) predString->print("+ %d ", offset->get_int());
else predString->print("+ offset "); else predString->print("+ offset ");
} }
CmpUNode* cmp = new (C) CmpUNode(max_idx_expr, range); CmpUNode* cmp = new CmpUNode(max_idx_expr, range);
register_new_node(cmp, ctrl); register_new_node(cmp, ctrl);
BoolNode* bol = new (C) BoolNode(cmp, BoolTest::lt); BoolNode* bol = new BoolNode(cmp, BoolTest::lt);
register_new_node(bol, ctrl); register_new_node(bol, ctrl);
if (TraceLoopPredicate) { if (TraceLoopPredicate) {
@ -750,7 +750,7 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) {
// Negate test if necessary // Negate test if necessary
bool negated = false; bool negated = false;
if (proj->_con != predicate_proj->_con) { if (proj->_con != predicate_proj->_con) {
new_predicate_bol = new (C) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate()); new_predicate_bol = new BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate());
register_new_node(new_predicate_bol, ctrl); register_new_node(new_predicate_bol, ctrl);
negated = true; negated = true;
} }

View File

@ -227,24 +227,24 @@ Node* IdealLoopTree::reassociate_add_sub(Node* n1, PhaseIdealLoop *phase) {
if (neg_inv1) { if (neg_inv1) {
Node *zero = phase->_igvn.intcon(0); Node *zero = phase->_igvn.intcon(0);
phase->set_ctrl(zero, phase->C->root()); phase->set_ctrl(zero, phase->C->root());
n_inv1 = new (phase->C) SubINode(zero, inv1); n_inv1 = new SubINode(zero, inv1);
phase->register_new_node(n_inv1, inv1_c); phase->register_new_node(n_inv1, inv1_c);
} else { } else {
n_inv1 = inv1; n_inv1 = inv1;
} }
Node* inv; Node* inv;
if (neg_inv2) { if (neg_inv2) {
inv = new (phase->C) SubINode(n_inv1, inv2); inv = new SubINode(n_inv1, inv2);
} else { } else {
inv = new (phase->C) AddINode(n_inv1, inv2); inv = new AddINode(n_inv1, inv2);
} }
phase->register_new_node(inv, phase->get_early_ctrl(inv)); phase->register_new_node(inv, phase->get_early_ctrl(inv));
Node* addx; Node* addx;
if (neg_x) { if (neg_x) {
addx = new (phase->C) SubINode(inv, x); addx = new SubINode(inv, x);
} else { } else {
addx = new (phase->C) AddINode(x, inv); addx = new AddINode(x, inv);
} }
phase->register_new_node(addx, phase->get_ctrl(x)); phase->register_new_node(addx, phase->get_ctrl(x));
phase->_igvn.replace_node(n1, addx); phase->_igvn.replace_node(n1, addx);
@ -953,7 +953,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
post_end->_prob = PROB_FAIR; post_end->_prob = PROB_FAIR;
// Build the main-loop normal exit. // Build the main-loop normal exit.
IfFalseNode *new_main_exit = new (C) IfFalseNode(main_end); IfFalseNode *new_main_exit = new IfFalseNode(main_end);
_igvn.register_new_node_with_optimizer( new_main_exit ); _igvn.register_new_node_with_optimizer( new_main_exit );
set_idom(new_main_exit, main_end, dd_main_exit ); set_idom(new_main_exit, main_end, dd_main_exit );
set_loop(new_main_exit, loop->_parent); set_loop(new_main_exit, loop->_parent);
@ -963,15 +963,15 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
// (the main-loop trip-counter exit value) because we will be changing // (the main-loop trip-counter exit value) because we will be changing
// the exit value (via unrolling) so we cannot constant-fold away the zero // the exit value (via unrolling) so we cannot constant-fold away the zero
// trip guard until all unrolling is done. // trip guard until all unrolling is done.
Node *zer_opaq = new (C) Opaque1Node(C, incr); Node *zer_opaq = new Opaque1Node(C, incr);
Node *zer_cmp = new (C) CmpINode( zer_opaq, limit ); Node *zer_cmp = new CmpINode( zer_opaq, limit );
Node *zer_bol = new (C) BoolNode( zer_cmp, b_test ); Node *zer_bol = new BoolNode( zer_cmp, b_test );
register_new_node( zer_opaq, new_main_exit ); register_new_node( zer_opaq, new_main_exit );
register_new_node( zer_cmp , new_main_exit ); register_new_node( zer_cmp , new_main_exit );
register_new_node( zer_bol , new_main_exit ); register_new_node( zer_bol , new_main_exit );
// Build the IfNode // Build the IfNode
IfNode *zer_iff = new (C) IfNode( new_main_exit, zer_bol, PROB_FAIR, COUNT_UNKNOWN ); IfNode *zer_iff = new IfNode( new_main_exit, zer_bol, PROB_FAIR, COUNT_UNKNOWN );
_igvn.register_new_node_with_optimizer( zer_iff ); _igvn.register_new_node_with_optimizer( zer_iff );
set_idom(zer_iff, new_main_exit, dd_main_exit); set_idom(zer_iff, new_main_exit, dd_main_exit);
set_loop(zer_iff, loop->_parent); set_loop(zer_iff, loop->_parent);
@ -981,7 +981,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
set_idom(main_exit, zer_iff, dd_main_exit); set_idom(main_exit, zer_iff, dd_main_exit);
set_idom(main_exit->unique_out(), zer_iff, dd_main_exit); set_idom(main_exit->unique_out(), zer_iff, dd_main_exit);
// Make the true-path, must enter the post loop // Make the true-path, must enter the post loop
Node *zer_taken = new (C) IfTrueNode( zer_iff ); Node *zer_taken = new IfTrueNode( zer_iff );
_igvn.register_new_node_with_optimizer( zer_taken ); _igvn.register_new_node_with_optimizer( zer_taken );
set_idom(zer_taken, zer_iff, dd_main_exit); set_idom(zer_taken, zer_iff, dd_main_exit);
set_loop(zer_taken, loop->_parent); set_loop(zer_taken, loop->_parent);
@ -1029,7 +1029,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
// Find the pre-loop normal exit. // Find the pre-loop normal exit.
Node* pre_exit = pre_end->proj_out(false); Node* pre_exit = pre_end->proj_out(false);
assert( pre_exit->Opcode() == Op_IfFalse, "" ); assert( pre_exit->Opcode() == Op_IfFalse, "" );
IfFalseNode *new_pre_exit = new (C) IfFalseNode(pre_end); IfFalseNode *new_pre_exit = new IfFalseNode(pre_end);
_igvn.register_new_node_with_optimizer( new_pre_exit ); _igvn.register_new_node_with_optimizer( new_pre_exit );
set_idom(new_pre_exit, pre_end, dd_main_head); set_idom(new_pre_exit, pre_end, dd_main_head);
set_loop(new_pre_exit, loop->_parent); set_loop(new_pre_exit, loop->_parent);
@ -1038,15 +1038,15 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
// pre-loop, the main-loop may not execute at all. Later in life this // pre-loop, the main-loop may not execute at all. Later in life this
// zero-trip guard will become the minimum-trip guard when we unroll // zero-trip guard will become the minimum-trip guard when we unroll
// the main-loop. // the main-loop.
Node *min_opaq = new (C) Opaque1Node(C, limit); Node *min_opaq = new Opaque1Node(C, limit);
Node *min_cmp = new (C) CmpINode( pre_incr, min_opaq ); Node *min_cmp = new CmpINode( pre_incr, min_opaq );
Node *min_bol = new (C) BoolNode( min_cmp, b_test ); Node *min_bol = new BoolNode( min_cmp, b_test );
register_new_node( min_opaq, new_pre_exit ); register_new_node( min_opaq, new_pre_exit );
register_new_node( min_cmp , new_pre_exit ); register_new_node( min_cmp , new_pre_exit );
register_new_node( min_bol , new_pre_exit ); register_new_node( min_bol , new_pre_exit );
// Build the IfNode (assume the main-loop is executed always). // Build the IfNode (assume the main-loop is executed always).
IfNode *min_iff = new (C) IfNode( new_pre_exit, min_bol, PROB_ALWAYS, COUNT_UNKNOWN ); IfNode *min_iff = new IfNode( new_pre_exit, min_bol, PROB_ALWAYS, COUNT_UNKNOWN );
_igvn.register_new_node_with_optimizer( min_iff ); _igvn.register_new_node_with_optimizer( min_iff );
set_idom(min_iff, new_pre_exit, dd_main_head); set_idom(min_iff, new_pre_exit, dd_main_head);
set_loop(min_iff, loop->_parent); set_loop(min_iff, loop->_parent);
@ -1057,7 +1057,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
set_idom(pre_exit, min_iff, dd_main_head); set_idom(pre_exit, min_iff, dd_main_head);
set_idom(pre_exit->unique_out(), min_iff, dd_main_head); set_idom(pre_exit->unique_out(), min_iff, dd_main_head);
// Make the true-path, must enter the main loop // Make the true-path, must enter the main loop
Node *min_taken = new (C) IfTrueNode( min_iff ); Node *min_taken = new IfTrueNode( min_iff );
_igvn.register_new_node_with_optimizer( min_taken ); _igvn.register_new_node_with_optimizer( min_taken );
set_idom(min_taken, min_iff, dd_main_head); set_idom(min_taken, min_iff, dd_main_head);
set_loop(min_taken, loop->_parent); set_loop(min_taken, loop->_parent);
@ -1087,11 +1087,11 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
// RCE and alignment may change this later. // RCE and alignment may change this later.
Node *cmp_end = pre_end->cmp_node(); Node *cmp_end = pre_end->cmp_node();
assert( cmp_end->in(2) == limit, "" ); assert( cmp_end->in(2) == limit, "" );
Node *pre_limit = new (C) AddINode( init, stride ); Node *pre_limit = new AddINode( init, stride );
// Save the original loop limit in this Opaque1 node for // Save the original loop limit in this Opaque1 node for
// use by range check elimination. // use by range check elimination.
Node *pre_opaq = new (C) Opaque1Node(C, pre_limit, limit); Node *pre_opaq = new Opaque1Node(C, pre_limit, limit);
register_new_node( pre_limit, pre_head->in(0) ); register_new_node( pre_limit, pre_head->in(0) );
register_new_node( pre_opaq , pre_head->in(0) ); register_new_node( pre_opaq , pre_head->in(0) );
@ -1116,19 +1116,19 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
BoolTest::mask new_test = (main_end->stride_con() > 0) ? BoolTest::lt : BoolTest::gt; BoolTest::mask new_test = (main_end->stride_con() > 0) ? BoolTest::lt : BoolTest::gt;
// Modify pre loop end condition // Modify pre loop end condition
Node* pre_bol = pre_end->in(CountedLoopEndNode::TestValue)->as_Bool(); Node* pre_bol = pre_end->in(CountedLoopEndNode::TestValue)->as_Bool();
BoolNode* new_bol0 = new (C) BoolNode(pre_bol->in(1), new_test); BoolNode* new_bol0 = new BoolNode(pre_bol->in(1), new_test);
register_new_node( new_bol0, pre_head->in(0) ); register_new_node( new_bol0, pre_head->in(0) );
_igvn.hash_delete(pre_end); _igvn.hash_delete(pre_end);
pre_end->set_req(CountedLoopEndNode::TestValue, new_bol0); pre_end->set_req(CountedLoopEndNode::TestValue, new_bol0);
// Modify main loop guard condition // Modify main loop guard condition
assert(min_iff->in(CountedLoopEndNode::TestValue) == min_bol, "guard okay"); assert(min_iff->in(CountedLoopEndNode::TestValue) == min_bol, "guard okay");
BoolNode* new_bol1 = new (C) BoolNode(min_bol->in(1), new_test); BoolNode* new_bol1 = new BoolNode(min_bol->in(1), new_test);
register_new_node( new_bol1, new_pre_exit ); register_new_node( new_bol1, new_pre_exit );
_igvn.hash_delete(min_iff); _igvn.hash_delete(min_iff);
min_iff->set_req(CountedLoopEndNode::TestValue, new_bol1); min_iff->set_req(CountedLoopEndNode::TestValue, new_bol1);
// Modify main loop end condition // Modify main loop end condition
BoolNode* main_bol = main_end->in(CountedLoopEndNode::TestValue)->as_Bool(); BoolNode* main_bol = main_end->in(CountedLoopEndNode::TestValue)->as_Bool();
BoolNode* new_bol2 = new (C) BoolNode(main_bol->in(1), new_test); BoolNode* new_bol2 = new BoolNode(main_bol->in(1), new_test);
register_new_node( new_bol2, main_end->in(CountedLoopEndNode::TestControl) ); register_new_node( new_bol2, main_end->in(CountedLoopEndNode::TestControl) );
_igvn.hash_delete(main_end); _igvn.hash_delete(main_end);
main_end->set_req(CountedLoopEndNode::TestValue, new_bol2); main_end->set_req(CountedLoopEndNode::TestValue, new_bol2);
@ -1279,13 +1279,13 @@ void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool ad
// zero trip guard limit will be different from loop limit. // zero trip guard limit will be different from loop limit.
assert(has_ctrl(opaq), "should have it"); assert(has_ctrl(opaq), "should have it");
Node* opaq_ctrl = get_ctrl(opaq); Node* opaq_ctrl = get_ctrl(opaq);
limit = new (C) Opaque2Node( C, limit ); limit = new Opaque2Node( C, limit );
register_new_node( limit, opaq_ctrl ); register_new_node( limit, opaq_ctrl );
} }
if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) || if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) ||
stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) { stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) {
// No underflow. // No underflow.
new_limit = new (C) SubINode(limit, stride); new_limit = new SubINode(limit, stride);
} else { } else {
// (limit - stride) may underflow. // (limit - stride) may underflow.
// Clamp the adjustment value with MININT or MAXINT: // Clamp the adjustment value with MININT or MAXINT:
@ -1315,18 +1315,18 @@ void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool ad
old_limit = bol->in(1)->in(1); old_limit = bol->in(1)->in(1);
// Adjust previous adjusted limit. // Adjust previous adjusted limit.
adj_limit = limit->in(CMoveNode::IfFalse); adj_limit = limit->in(CMoveNode::IfFalse);
adj_limit = new (C) SubINode(adj_limit, stride); adj_limit = new SubINode(adj_limit, stride);
} else { } else {
old_limit = limit; old_limit = limit;
adj_limit = new (C) SubINode(limit, stride); adj_limit = new SubINode(limit, stride);
} }
assert(old_limit != NULL && adj_limit != NULL, ""); assert(old_limit != NULL && adj_limit != NULL, "");
register_new_node( adj_limit, ctrl ); // adjust amount register_new_node( adj_limit, ctrl ); // adjust amount
Node* adj_cmp = new (C) CmpINode(old_limit, adj_limit); Node* adj_cmp = new CmpINode(old_limit, adj_limit);
register_new_node( adj_cmp, ctrl ); register_new_node( adj_cmp, ctrl );
Node* adj_bool = new (C) BoolNode(adj_cmp, bt); Node* adj_bool = new BoolNode(adj_cmp, bt);
register_new_node( adj_bool, ctrl ); register_new_node( adj_bool, ctrl );
new_limit = new (C) CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT); new_limit = new CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT);
} }
register_new_node(new_limit, ctrl); register_new_node(new_limit, ctrl);
} }
@ -1388,24 +1388,24 @@ void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool ad
// CountedLoop this is exact (stride divides limit-init exactly). // CountedLoop this is exact (stride divides limit-init exactly).
// We are going to double the loop body, so we want to knock off any // We are going to double the loop body, so we want to knock off any
// odd iteration: (trip_cnt & ~1). Then back compute a new limit. // odd iteration: (trip_cnt & ~1). Then back compute a new limit.
Node *span = new (C) SubINode( limit, init ); Node *span = new SubINode( limit, init );
register_new_node( span, ctrl ); register_new_node( span, ctrl );
Node *trip = new (C) DivINode( 0, span, stride ); Node *trip = new DivINode( 0, span, stride );
register_new_node( trip, ctrl ); register_new_node( trip, ctrl );
Node *mtwo = _igvn.intcon(-2); Node *mtwo = _igvn.intcon(-2);
set_ctrl(mtwo, C->root()); set_ctrl(mtwo, C->root());
Node *rond = new (C) AndINode( trip, mtwo ); Node *rond = new AndINode( trip, mtwo );
register_new_node( rond, ctrl ); register_new_node( rond, ctrl );
Node *spn2 = new (C) MulINode( rond, stride ); Node *spn2 = new MulINode( rond, stride );
register_new_node( spn2, ctrl ); register_new_node( spn2, ctrl );
new_limit = new (C) AddINode( spn2, init ); new_limit = new AddINode( spn2, init );
register_new_node( new_limit, ctrl ); register_new_node( new_limit, ctrl );
// Hammer in the new limit // Hammer in the new limit
Node *ctrl2 = loop_end->in(0); Node *ctrl2 = loop_end->in(0);
Node *cmp2 = new (C) CmpINode( loop_head->incr(), new_limit ); Node *cmp2 = new CmpINode( loop_head->incr(), new_limit );
register_new_node( cmp2, ctrl2 ); register_new_node( cmp2, ctrl2 );
Node *bol2 = new (C) BoolNode( cmp2, loop_end->test_trip() ); Node *bol2 = new BoolNode( cmp2, loop_end->test_trip() );
register_new_node( bol2, ctrl2 ); register_new_node( bol2, ctrl2 );
_igvn.hash_delete(loop_end); _igvn.hash_delete(loop_end);
loop_end->set_req(CountedLoopEndNode::TestValue, bol2); loop_end->set_req(CountedLoopEndNode::TestValue, bol2);
@ -1511,15 +1511,15 @@ bool IdealLoopTree::dominates_backedge(Node* ctrl) {
// Helper function for add_constraint(). // Helper function for add_constraint().
Node* PhaseIdealLoop::adjust_limit(int stride_con, Node * scale, Node *offset, Node *rc_limit, Node *loop_limit, Node *pre_ctrl) { Node* PhaseIdealLoop::adjust_limit(int stride_con, Node * scale, Node *offset, Node *rc_limit, Node *loop_limit, Node *pre_ctrl) {
// Compute "I :: (limit-offset)/scale" // Compute "I :: (limit-offset)/scale"
Node *con = new (C) SubINode(rc_limit, offset); Node *con = new SubINode(rc_limit, offset);
register_new_node(con, pre_ctrl); register_new_node(con, pre_ctrl);
Node *X = new (C) DivINode(0, con, scale); Node *X = new DivINode(0, con, scale);
register_new_node(X, pre_ctrl); register_new_node(X, pre_ctrl);
// Adjust loop limit // Adjust loop limit
loop_limit = (stride_con > 0) loop_limit = (stride_con > 0)
? (Node*)(new (C) MinINode(loop_limit, X)) ? (Node*)(new MinINode(loop_limit, X))
: (Node*)(new (C) MaxINode(loop_limit, X)); : (Node*)(new MaxINode(loop_limit, X));
register_new_node(loop_limit, pre_ctrl); register_new_node(loop_limit, pre_ctrl);
return loop_limit; return loop_limit;
} }
@ -1580,9 +1580,9 @@ void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset
// to avoid problem with scale == -1 (min_int/(-1) == min_int). // to avoid problem with scale == -1 (min_int/(-1) == min_int).
Node* shift = _igvn.intcon(31); Node* shift = _igvn.intcon(31);
set_ctrl(shift, C->root()); set_ctrl(shift, C->root());
Node* sign = new (C) RShiftINode(offset, shift); Node* sign = new RShiftINode(offset, shift);
register_new_node(sign, pre_ctrl); register_new_node(sign, pre_ctrl);
offset = new (C) AndINode(offset, sign); offset = new AndINode(offset, sign);
register_new_node(offset, pre_ctrl); register_new_node(offset, pre_ctrl);
} else { } else {
assert(low_limit->get_int() == 0, "wrong low limit for range check"); assert(low_limit->get_int() == 0, "wrong low limit for range check");
@ -1615,7 +1615,7 @@ void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset
Node *one = _igvn.intcon(1); Node *one = _igvn.intcon(1);
set_ctrl(one, C->root()); set_ctrl(one, C->root());
Node *plus_one = new (C) AddINode(offset, one); Node *plus_one = new AddINode(offset, one);
register_new_node( plus_one, pre_ctrl ); register_new_node( plus_one, pre_ctrl );
// Pass (-stride) to indicate pre_loop_cond = NOT(main_loop_cond); // Pass (-stride) to indicate pre_loop_cond = NOT(main_loop_cond);
*pre_limit = adjust_limit((-stride_con), scale, plus_one, upper_limit, *pre_limit, pre_ctrl); *pre_limit = adjust_limit((-stride_con), scale, plus_one, upper_limit, *pre_limit, pre_ctrl);
@ -1633,9 +1633,9 @@ void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset
// to avoid problem with scale == -1 (min_int/(-1) == min_int). // to avoid problem with scale == -1 (min_int/(-1) == min_int).
Node* shift = _igvn.intcon(31); Node* shift = _igvn.intcon(31);
set_ctrl(shift, C->root()); set_ctrl(shift, C->root());
Node* sign = new (C) RShiftINode(plus_one, shift); Node* sign = new RShiftINode(plus_one, shift);
register_new_node(sign, pre_ctrl); register_new_node(sign, pre_ctrl);
plus_one = new (C) AndINode(plus_one, sign); plus_one = new AndINode(plus_one, sign);
register_new_node(plus_one, pre_ctrl); register_new_node(plus_one, pre_ctrl);
} else { } else {
assert(low_limit->get_int() == 0, "wrong low limit for range check"); assert(low_limit->get_int() == 0, "wrong low limit for range check");
@ -1718,7 +1718,7 @@ bool PhaseIdealLoop::is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale,
p_offset != NULL ? &offset2 : NULL, depth+1)) { p_offset != NULL ? &offset2 : NULL, depth+1)) {
if (p_offset != NULL) { if (p_offset != NULL) {
Node *ctrl_off2 = get_ctrl(offset2); Node *ctrl_off2 = get_ctrl(offset2);
Node* offset = new (C) AddINode(offset2, exp->in(2)); Node* offset = new AddINode(offset2, exp->in(2));
register_new_node(offset, ctrl_off2); register_new_node(offset, ctrl_off2);
*p_offset = offset; *p_offset = offset;
} }
@ -1731,7 +1731,7 @@ bool PhaseIdealLoop::is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale,
Node *zero = _igvn.intcon(0); Node *zero = _igvn.intcon(0);
set_ctrl(zero, C->root()); set_ctrl(zero, C->root());
Node *ctrl_off = get_ctrl(exp->in(2)); Node *ctrl_off = get_ctrl(exp->in(2));
Node* offset = new (C) SubINode(zero, exp->in(2)); Node* offset = new SubINode(zero, exp->in(2));
register_new_node(offset, ctrl_off); register_new_node(offset, ctrl_off);
*p_offset = offset; *p_offset = offset;
} }
@ -1934,15 +1934,15 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) {
case BoolTest::ge: case BoolTest::ge:
// Convert (I*scale+offset) >= Limit to (I*(-scale)+(-offset)) <= -Limit // Convert (I*scale+offset) >= Limit to (I*(-scale)+(-offset)) <= -Limit
scale_con = -scale_con; scale_con = -scale_con;
offset = new (C) SubINode( zero, offset ); offset = new SubINode( zero, offset );
register_new_node( offset, pre_ctrl ); register_new_node( offset, pre_ctrl );
limit = new (C) SubINode( zero, limit ); limit = new SubINode( zero, limit );
register_new_node( limit, pre_ctrl ); register_new_node( limit, pre_ctrl );
// Fall into LE case // Fall into LE case
case BoolTest::le: case BoolTest::le:
if (b_test._test != BoolTest::gt) { if (b_test._test != BoolTest::gt) {
// Convert X <= Y to X < Y+1 // Convert X <= Y to X < Y+1
limit = new (C) AddINode( limit, one ); limit = new AddINode( limit, one );
register_new_node( limit, pre_ctrl ); register_new_node( limit, pre_ctrl );
} }
// Fall into LT case // Fall into LT case
@ -1993,8 +1993,8 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) {
// Update loop limits // Update loop limits
if (conditional_rc) { if (conditional_rc) {
pre_limit = (stride_con > 0) ? (Node*)new (C) MinINode(pre_limit, orig_limit) pre_limit = (stride_con > 0) ? (Node*)new MinINode(pre_limit, orig_limit)
: (Node*)new (C) MaxINode(pre_limit, orig_limit); : (Node*)new MaxINode(pre_limit, orig_limit);
register_new_node(pre_limit, pre_ctrl); register_new_node(pre_limit, pre_ctrl);
} }
_igvn.hash_delete(pre_opaq); _igvn.hash_delete(pre_opaq);
@ -2009,16 +2009,16 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) {
Node *ctrl = get_ctrl(main_limit); Node *ctrl = get_ctrl(main_limit);
Node *stride = cl->stride(); Node *stride = cl->stride();
Node *init = cl->init_trip(); Node *init = cl->init_trip();
Node *span = new (C) SubINode(main_limit,init); Node *span = new SubINode(main_limit,init);
register_new_node(span,ctrl); register_new_node(span,ctrl);
Node *rndup = _igvn.intcon(stride_con + ((stride_con>0)?-1:1)); Node *rndup = _igvn.intcon(stride_con + ((stride_con>0)?-1:1));
Node *add = new (C) AddINode(span,rndup); Node *add = new AddINode(span,rndup);
register_new_node(add,ctrl); register_new_node(add,ctrl);
Node *div = new (C) DivINode(0,add,stride); Node *div = new DivINode(0,add,stride);
register_new_node(div,ctrl); register_new_node(div,ctrl);
Node *mul = new (C) MulINode(div,stride); Node *mul = new MulINode(div,stride);
register_new_node(mul,ctrl); register_new_node(mul,ctrl);
Node *newlim = new (C) AddINode(mul,init); Node *newlim = new AddINode(mul,init);
register_new_node(newlim,ctrl); register_new_node(newlim,ctrl);
main_limit = newlim; main_limit = newlim;
} }
@ -2189,7 +2189,7 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) {
} }
// Note: the final value after increment should not overflow since // Note: the final value after increment should not overflow since
// counted loop has limit check predicate. // counted loop has limit check predicate.
Node *final = new (phase->C) SubINode( exact_limit, cl->stride() ); Node *final = new SubINode( exact_limit, cl->stride() );
phase->register_new_node(final,cl->in(LoopNode::EntryControl)); phase->register_new_node(final,cl->in(LoopNode::EntryControl));
phase->_igvn.replace_node(phi,final); phase->_igvn.replace_node(phi,final);
phase->C->set_major_progress(); phase->C->set_major_progress();
@ -2676,20 +2676,20 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) {
// Build an expression for the beginning of the copy region // Build an expression for the beginning of the copy region
Node* index = head->init_trip(); Node* index = head->init_trip();
#ifdef _LP64 #ifdef _LP64
index = new (C) ConvI2LNode(index); index = new ConvI2LNode(index);
_igvn.register_new_node_with_optimizer(index); _igvn.register_new_node_with_optimizer(index);
#endif #endif
if (shift != NULL) { if (shift != NULL) {
// byte arrays don't require a shift but others do. // byte arrays don't require a shift but others do.
index = new (C) LShiftXNode(index, shift->in(2)); index = new LShiftXNode(index, shift->in(2));
_igvn.register_new_node_with_optimizer(index); _igvn.register_new_node_with_optimizer(index);
} }
index = new (C) AddPNode(base, base, index); index = new AddPNode(base, base, index);
_igvn.register_new_node_with_optimizer(index); _igvn.register_new_node_with_optimizer(index);
Node* from = new (C) AddPNode(base, index, offset); Node* from = new AddPNode(base, index, offset);
_igvn.register_new_node_with_optimizer(from); _igvn.register_new_node_with_optimizer(from);
// Compute the number of elements to copy // Compute the number of elements to copy
Node* len = new (C) SubINode(head->limit(), head->init_trip()); Node* len = new SubINode(head->limit(), head->init_trip());
_igvn.register_new_node_with_optimizer(len); _igvn.register_new_node_with_optimizer(len);
BasicType t = store->as_Mem()->memory_type(); BasicType t = store->as_Mem()->memory_type();
@ -2706,17 +2706,17 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) {
// Convert float/double to int/long for fill routines // Convert float/double to int/long for fill routines
if (t == T_FLOAT) { if (t == T_FLOAT) {
store_value = new (C) MoveF2INode(store_value); store_value = new MoveF2INode(store_value);
_igvn.register_new_node_with_optimizer(store_value); _igvn.register_new_node_with_optimizer(store_value);
} else if (t == T_DOUBLE) { } else if (t == T_DOUBLE) {
store_value = new (C) MoveD2LNode(store_value); store_value = new MoveD2LNode(store_value);
_igvn.register_new_node_with_optimizer(store_value); _igvn.register_new_node_with_optimizer(store_value);
} }
if (CCallingConventionRequiresIntsAsLongs && if (CCallingConventionRequiresIntsAsLongs &&
// See StubRoutines::select_fill_function for types. FLOAT has been converted to INT. // See StubRoutines::select_fill_function for types. FLOAT has been converted to INT.
(t == T_FLOAT || t == T_INT || is_subword_type(t))) { (t == T_FLOAT || t == T_INT || is_subword_type(t))) {
store_value = new (C) ConvI2LNode(store_value); store_value = new ConvI2LNode(store_value);
_igvn.register_new_node_with_optimizer(store_value); _igvn.register_new_node_with_optimizer(store_value);
} }
@ -2724,7 +2724,7 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) {
Node* result_ctrl; Node* result_ctrl;
Node* result_mem; Node* result_mem;
const TypeFunc* call_type = OptoRuntime::array_fill_Type(); const TypeFunc* call_type = OptoRuntime::array_fill_Type();
CallLeafNode *call = new (C) CallLeafNoFPNode(call_type, fill, CallLeafNode *call = new CallLeafNoFPNode(call_type, fill,
fill_name, TypeAryPtr::get_array_body_type(t)); fill_name, TypeAryPtr::get_array_body_type(t));
uint cnt = 0; uint cnt = 0;
call->init_req(TypeFunc::Parms + cnt++, from); call->init_req(TypeFunc::Parms + cnt++, from);
@ -2733,7 +2733,7 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) {
call->init_req(TypeFunc::Parms + cnt++, C->top()); call->init_req(TypeFunc::Parms + cnt++, C->top());
} }
#ifdef _LP64 #ifdef _LP64
len = new (C) ConvI2LNode(len); len = new ConvI2LNode(len);
_igvn.register_new_node_with_optimizer(len); _igvn.register_new_node_with_optimizer(len);
#endif #endif
call->init_req(TypeFunc::Parms + cnt++, len); call->init_req(TypeFunc::Parms + cnt++, len);
@ -2746,9 +2746,9 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) {
call->init_req(TypeFunc::ReturnAdr, C->start()->proj_out(TypeFunc::ReturnAdr)); call->init_req(TypeFunc::ReturnAdr, C->start()->proj_out(TypeFunc::ReturnAdr));
call->init_req(TypeFunc::FramePtr, C->start()->proj_out(TypeFunc::FramePtr)); call->init_req(TypeFunc::FramePtr, C->start()->proj_out(TypeFunc::FramePtr));
_igvn.register_new_node_with_optimizer(call); _igvn.register_new_node_with_optimizer(call);
result_ctrl = new (C) ProjNode(call,TypeFunc::Control); result_ctrl = new ProjNode(call,TypeFunc::Control);
_igvn.register_new_node_with_optimizer(result_ctrl); _igvn.register_new_node_with_optimizer(result_ctrl);
result_mem = new (C) ProjNode(call,TypeFunc::Memory); result_mem = new ProjNode(call,TypeFunc::Memory);
_igvn.register_new_node_with_optimizer(result_mem); _igvn.register_new_node_with_optimizer(result_mem);
/* Disable following optimization until proper fix (add missing checks). /* Disable following optimization until proper fix (add missing checks).

View File

@ -225,15 +225,15 @@ ProjNode* PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree *loop,
Node *cont = _igvn.intcon(1); Node *cont = _igvn.intcon(1);
set_ctrl(cont, C->root()); set_ctrl(cont, C->root());
Node* opq = new (C) Opaque1Node(C, cont); Node* opq = new Opaque1Node(C, cont);
register_node(opq, outer_loop, entry, dom_depth(entry)); register_node(opq, outer_loop, entry, dom_depth(entry));
Node *bol = new (C) Conv2BNode(opq); Node *bol = new Conv2BNode(opq);
register_node(bol, outer_loop, entry, dom_depth(entry)); register_node(bol, outer_loop, entry, dom_depth(entry));
IfNode* iff = new (C) IfNode(entry, bol, PROB_MAX, COUNT_UNKNOWN); IfNode* iff = new IfNode(entry, bol, PROB_MAX, COUNT_UNKNOWN);
register_node(iff, outer_loop, entry, dom_depth(entry)); register_node(iff, outer_loop, entry, dom_depth(entry));
ProjNode* iffast = new (C) IfTrueNode(iff); ProjNode* iffast = new IfTrueNode(iff);
register_node(iffast, outer_loop, iff, dom_depth(iff)); register_node(iffast, outer_loop, iff, dom_depth(iff));
ProjNode* ifslow = new (C) IfFalseNode(iff); ProjNode* ifslow = new IfFalseNode(iff);
register_node(ifslow, outer_loop, iff, dom_depth(iff)); register_node(ifslow, outer_loop, iff, dom_depth(iff));
// Clone the loop body. The clone becomes the fast loop. The // Clone the loop body. The clone becomes the fast loop. The

View File

@ -443,7 +443,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
assert(x->Opcode() == Op_Loop, "regular loops only"); assert(x->Opcode() == Op_Loop, "regular loops only");
C->print_method(PHASE_BEFORE_CLOOPS, 3); C->print_method(PHASE_BEFORE_CLOOPS, 3);
Node *hook = new (C) Node(6); Node *hook = new Node(6);
if (LoopLimitCheck) { if (LoopLimitCheck) {
@ -506,11 +506,11 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
Node* bol; Node* bol;
if (stride_con > 0) { if (stride_con > 0) {
cmp_limit = new (C) CmpINode(limit, _igvn.intcon(max_jint - stride_m)); cmp_limit = new CmpINode(limit, _igvn.intcon(max_jint - stride_m));
bol = new (C) BoolNode(cmp_limit, BoolTest::le); bol = new BoolNode(cmp_limit, BoolTest::le);
} else { } else {
cmp_limit = new (C) CmpINode(limit, _igvn.intcon(min_jint - stride_m)); cmp_limit = new CmpINode(limit, _igvn.intcon(min_jint - stride_m));
bol = new (C) BoolNode(cmp_limit, BoolTest::ge); bol = new BoolNode(cmp_limit, BoolTest::ge);
} }
cmp_limit = _igvn.register_new_node_with_optimizer(cmp_limit); cmp_limit = _igvn.register_new_node_with_optimizer(cmp_limit);
bol = _igvn.register_new_node_with_optimizer(bol); bol = _igvn.register_new_node_with_optimizer(bol);
@ -547,7 +547,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
// is converted to // is converted to
// i = init; do {} while(++i < limit+1); // i = init; do {} while(++i < limit+1);
// //
limit = gvn->transform(new (C) AddINode(limit, stride)); limit = gvn->transform(new AddINode(limit, stride));
} }
// Now we need to canonicalize loop condition. // Now we need to canonicalize loop condition.
@ -566,7 +566,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
// we can convert 'i <= limit' to 'i < limit+1' since stride != 0. // we can convert 'i <= limit' to 'i < limit+1' since stride != 0.
// //
Node* one = (stride_con > 0) ? gvn->intcon( 1) : gvn->intcon(-1); Node* one = (stride_con > 0) ? gvn->intcon( 1) : gvn->intcon(-1);
limit = gvn->transform(new (C) AddINode(limit, one)); limit = gvn->transform(new AddINode(limit, one));
if (bt == BoolTest::le) if (bt == BoolTest::le)
bt = BoolTest::lt; bt = BoolTest::lt;
else if (bt == BoolTest::ge) else if (bt == BoolTest::ge)
@ -582,7 +582,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
// can directly point to the phi; in this case adjust the compare so that // can directly point to the phi; in this case adjust the compare so that
// it points to the incr by adjusting the limit. // it points to the incr by adjusting the limit.
if (cmp->in(1) == phi || cmp->in(2) == phi) if (cmp->in(1) == phi || cmp->in(2) == phi)
limit = gvn->transform(new (C) AddINode(limit,stride)); limit = gvn->transform(new AddINode(limit,stride));
// trip-count for +-tive stride should be: (limit - init_trip + stride - 1)/stride. // trip-count for +-tive stride should be: (limit - init_trip + stride - 1)/stride.
// Final value for iterator should be: trip_count * stride + init_trip. // Final value for iterator should be: trip_count * stride + init_trip.
@ -595,16 +595,16 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
ShouldNotReachHere(); ShouldNotReachHere();
case BoolTest::ne: // Ahh, the case we desire case BoolTest::ne: // Ahh, the case we desire
if (stride_con == 1) if (stride_con == 1)
trip_count = gvn->transform(new (C) SubINode(limit,init_trip)); trip_count = gvn->transform(new SubINode(limit,init_trip));
else if (stride_con == -1) else if (stride_con == -1)
trip_count = gvn->transform(new (C) SubINode(init_trip,limit)); trip_count = gvn->transform(new SubINode(init_trip,limit));
else else
ShouldNotReachHere(); ShouldNotReachHere();
set_subtree_ctrl(trip_count); set_subtree_ctrl(trip_count);
//_loop.map(trip_count->_idx,loop(limit)); //_loop.map(trip_count->_idx,loop(limit));
break; break;
case BoolTest::le: // Maybe convert to '<' case case BoolTest::le: // Maybe convert to '<' case
limit = gvn->transform(new (C) AddINode(limit,one_p)); limit = gvn->transform(new AddINode(limit,one_p));
set_subtree_ctrl( limit ); set_subtree_ctrl( limit );
hook->init_req(4, limit); hook->init_req(4, limit);
@ -615,26 +615,26 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
case BoolTest::lt: { // Maybe convert to '!=' case case BoolTest::lt: { // Maybe convert to '!=' case
if (stride_con < 0) // Count down loop rolls through MAXINT if (stride_con < 0) // Count down loop rolls through MAXINT
ShouldNotReachHere(); ShouldNotReachHere();
Node *range = gvn->transform(new (C) SubINode(limit,init_trip)); Node *range = gvn->transform(new SubINode(limit,init_trip));
set_subtree_ctrl( range ); set_subtree_ctrl( range );
hook->init_req(0, range); hook->init_req(0, range);
Node *bias = gvn->transform(new (C) AddINode(range,stride)); Node *bias = gvn->transform(new AddINode(range,stride));
set_subtree_ctrl( bias ); set_subtree_ctrl( bias );
hook->init_req(1, bias); hook->init_req(1, bias);
Node *bias1 = gvn->transform(new (C) AddINode(bias,one_m)); Node *bias1 = gvn->transform(new AddINode(bias,one_m));
set_subtree_ctrl( bias1 ); set_subtree_ctrl( bias1 );
hook->init_req(2, bias1); hook->init_req(2, bias1);
trip_count = gvn->transform(new (C) DivINode(0,bias1,stride)); trip_count = gvn->transform(new DivINode(0,bias1,stride));
set_subtree_ctrl( trip_count ); set_subtree_ctrl( trip_count );
hook->init_req(3, trip_count); hook->init_req(3, trip_count);
break; break;
} }
case BoolTest::ge: // Maybe convert to '>' case case BoolTest::ge: // Maybe convert to '>' case
limit = gvn->transform(new (C) AddINode(limit,one_m)); limit = gvn->transform(new AddINode(limit,one_m));
set_subtree_ctrl( limit ); set_subtree_ctrl( limit );
hook->init_req(4 ,limit); hook->init_req(4 ,limit);
@ -645,30 +645,30 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
case BoolTest::gt: { // Maybe convert to '!=' case case BoolTest::gt: { // Maybe convert to '!=' case
if (stride_con > 0) // count up loop rolls through MININT if (stride_con > 0) // count up loop rolls through MININT
ShouldNotReachHere(); ShouldNotReachHere();
Node *range = gvn->transform(new (C) SubINode(limit,init_trip)); Node *range = gvn->transform(new SubINode(limit,init_trip));
set_subtree_ctrl( range ); set_subtree_ctrl( range );
hook->init_req(0, range); hook->init_req(0, range);
Node *bias = gvn->transform(new (C) AddINode(range,stride)); Node *bias = gvn->transform(new AddINode(range,stride));
set_subtree_ctrl( bias ); set_subtree_ctrl( bias );
hook->init_req(1, bias); hook->init_req(1, bias);
Node *bias1 = gvn->transform(new (C) AddINode(bias,one_p)); Node *bias1 = gvn->transform(new AddINode(bias,one_p));
set_subtree_ctrl( bias1 ); set_subtree_ctrl( bias1 );
hook->init_req(2, bias1); hook->init_req(2, bias1);
trip_count = gvn->transform(new (C) DivINode(0,bias1,stride)); trip_count = gvn->transform(new DivINode(0,bias1,stride));
set_subtree_ctrl( trip_count ); set_subtree_ctrl( trip_count );
hook->init_req(3, trip_count); hook->init_req(3, trip_count);
break; break;
} }
} // switch( bt ) } // switch( bt )
Node *span = gvn->transform(new (C) MulINode(trip_count,stride)); Node *span = gvn->transform(new MulINode(trip_count,stride));
set_subtree_ctrl( span ); set_subtree_ctrl( span );
hook->init_req(5, span); hook->init_req(5, span);
limit = gvn->transform(new (C) AddINode(span,init_trip)); limit = gvn->transform(new AddINode(span,init_trip));
set_subtree_ctrl( limit ); set_subtree_ctrl( limit );
} // LoopLimitCheck } // LoopLimitCheck
@ -717,7 +717,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
set_ctrl(test, iff->in(0)); set_ctrl(test, iff->in(0));
// Replace the old IfNode with a new LoopEndNode // Replace the old IfNode with a new LoopEndNode
Node *lex = _igvn.register_new_node_with_optimizer(new (C) CountedLoopEndNode( iff->in(0), test, cl_prob, iff->as_If()->_fcnt )); Node *lex = _igvn.register_new_node_with_optimizer(new CountedLoopEndNode( iff->in(0), test, cl_prob, iff->as_If()->_fcnt ));
IfNode *le = lex->as_If(); IfNode *le = lex->as_If();
uint dd = dom_depth(iff); uint dd = dom_depth(iff);
set_idom(le, le->in(0), dd); // Update dominance for loop exit set_idom(le, le->in(0), dd); // Update dominance for loop exit
@ -728,8 +728,8 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
// Need to swap loop-exit and loop-back control? // Need to swap loop-exit and loop-back control?
if (iftrue_op == Op_IfFalse) { if (iftrue_op == Op_IfFalse) {
Node *ift2=_igvn.register_new_node_with_optimizer(new (C) IfTrueNode (le)); Node *ift2=_igvn.register_new_node_with_optimizer(new IfTrueNode (le));
Node *iff2=_igvn.register_new_node_with_optimizer(new (C) IfFalseNode(le)); Node *iff2=_igvn.register_new_node_with_optimizer(new IfFalseNode(le));
loop->_tail = back_control = ift2; loop->_tail = back_control = ift2;
set_loop(ift2, loop); set_loop(ift2, loop);
@ -755,7 +755,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
lazy_replace( iff, le ); // fix 'get_ctrl' lazy_replace( iff, le ); // fix 'get_ctrl'
// Now setup a new CountedLoopNode to replace the existing LoopNode // Now setup a new CountedLoopNode to replace the existing LoopNode
CountedLoopNode *l = new (C) CountedLoopNode(init_control, back_control); CountedLoopNode *l = new CountedLoopNode(init_control, back_control);
l->set_unswitch_count(x->as_Loop()->unswitch_count()); // Preserve l->set_unswitch_count(x->as_Loop()->unswitch_count()); // Preserve
// The following assert is approximately true, and defines the intention // The following assert is approximately true, and defines the intention
// of can_be_counted_loop. It fails, however, because phase->type // of can_be_counted_loop. It fails, however, because phase->type
@ -829,7 +829,7 @@ Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) {
limit = _igvn.intcon(final_int); limit = _igvn.intcon(final_int);
} else { } else {
// Create new LoopLimit node to get exact limit (final iv value). // Create new LoopLimit node to get exact limit (final iv value).
limit = new (C) LoopLimitNode(C, cl->init_trip(), cl->limit(), cl->stride()); limit = new LoopLimitNode(C, cl->init_trip(), cl->limit(), cl->stride());
register_new_node(limit, cl->in(LoopNode::EntryControl)); register_new_node(limit, cl->in(LoopNode::EntryControl));
} }
assert(limit != NULL, "sanity"); assert(limit != NULL, "sanity");
@ -946,11 +946,11 @@ Node *LoopLimitNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if (range <= max) { if (range <= max) {
// Convert to integer expression if it is not overflow. // Convert to integer expression if it is not overflow.
Node* stride_m = phase->intcon(stride_con - (stride_con > 0 ? 1 : -1)); Node* stride_m = phase->intcon(stride_con - (stride_con > 0 ? 1 : -1));
Node *range = phase->transform(new (phase->C) SubINode(in(Limit), in(Init))); Node *range = phase->transform(new SubINode(in(Limit), in(Init)));
Node *bias = phase->transform(new (phase->C) AddINode(range, stride_m)); Node *bias = phase->transform(new AddINode(range, stride_m));
Node *trip = phase->transform(new (phase->C) DivINode(0, bias, in(Stride))); Node *trip = phase->transform(new DivINode(0, bias, in(Stride)));
Node *span = phase->transform(new (phase->C) MulINode(trip, in(Stride))); Node *span = phase->transform(new MulINode(trip, in(Stride)));
return new (phase->C) AddINode(span, in(Init)); // exact limit return new AddINode(span, in(Init)); // exact limit
} }
if (is_power_of_2(stride_p) || // divisor is 2^n if (is_power_of_2(stride_p) || // divisor is 2^n
@ -958,13 +958,13 @@ Node *LoopLimitNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// Convert to long expression to avoid integer overflow // Convert to long expression to avoid integer overflow
// and let igvn optimizer convert this division. // and let igvn optimizer convert this division.
// //
Node* init = phase->transform( new (phase->C) ConvI2LNode(in(Init))); Node* init = phase->transform( new ConvI2LNode(in(Init)));
Node* limit = phase->transform( new (phase->C) ConvI2LNode(in(Limit))); Node* limit = phase->transform( new ConvI2LNode(in(Limit)));
Node* stride = phase->longcon(stride_con); Node* stride = phase->longcon(stride_con);
Node* stride_m = phase->longcon(stride_con - (stride_con > 0 ? 1 : -1)); Node* stride_m = phase->longcon(stride_con - (stride_con > 0 ? 1 : -1));
Node *range = phase->transform(new (phase->C) SubLNode(limit, init)); Node *range = phase->transform(new SubLNode(limit, init));
Node *bias = phase->transform(new (phase->C) AddLNode(range, stride_m)); Node *bias = phase->transform(new AddLNode(range, stride_m));
Node *span; Node *span;
if (stride_con > 0 && is_power_of_2(stride_p)) { if (stride_con > 0 && is_power_of_2(stride_p)) {
// bias >= 0 if stride >0, so if stride is 2^n we can use &(-stride) // bias >= 0 if stride >0, so if stride is 2^n we can use &(-stride)
@ -975,14 +975,14 @@ Node *LoopLimitNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// only RCE predicate where exact limit is used and the predicate // only RCE predicate where exact limit is used and the predicate
// will simply fail forcing recompilation. // will simply fail forcing recompilation.
Node* neg_stride = phase->longcon(-stride_con); Node* neg_stride = phase->longcon(-stride_con);
span = phase->transform(new (phase->C) AndLNode(bias, neg_stride)); span = phase->transform(new AndLNode(bias, neg_stride));
} else { } else {
Node *trip = phase->transform(new (phase->C) DivLNode(0, bias, stride)); Node *trip = phase->transform(new DivLNode(0, bias, stride));
span = phase->transform(new (phase->C) MulLNode(trip, stride)); span = phase->transform(new MulLNode(trip, stride));
} }
// Convert back to int // Convert back to int
Node *span_int = phase->transform(new (phase->C) ConvL2INode(span)); Node *span_int = phase->transform(new ConvL2INode(span));
return new (phase->C) AddINode(span_int, in(Init)); // exact limit return new AddINode(span_int, in(Init)); // exact limit
} }
return NULL; // No progress return NULL; // No progress
@ -1188,7 +1188,7 @@ void IdealLoopTree::split_fall_in( PhaseIdealLoop *phase, int fall_in_cnt ) {
uint i; uint i;
// Make a new RegionNode to be the landing pad. // Make a new RegionNode to be the landing pad.
Node *landing_pad = new (phase->C) RegionNode( fall_in_cnt+1 ); Node *landing_pad = new RegionNode( fall_in_cnt+1 );
phase->set_loop(landing_pad,_parent); phase->set_loop(landing_pad,_parent);
// Gather all the fall-in control paths into the landing pad // Gather all the fall-in control paths into the landing pad
uint icnt = fall_in_cnt; uint icnt = fall_in_cnt;
@ -1274,7 +1274,7 @@ void IdealLoopTree::split_outer_loop( PhaseIdealLoop *phase ) {
// Make a LoopNode for the outermost loop. // Make a LoopNode for the outermost loop.
Node *ctl = _head->in(LoopNode::EntryControl); Node *ctl = _head->in(LoopNode::EntryControl);
Node *outer = new (phase->C) LoopNode( ctl, _head->in(outer_idx) ); Node *outer = new LoopNode( ctl, _head->in(outer_idx) );
outer = igvn.register_new_node_with_optimizer(outer, _head); outer = igvn.register_new_node_with_optimizer(outer, _head);
phase->set_created_loop_node(); phase->set_created_loop_node();
@ -1388,7 +1388,7 @@ void IdealLoopTree::merge_many_backedges( PhaseIdealLoop *phase ) {
Node *hot_tail = NULL; Node *hot_tail = NULL;
// Make a Region for the merge point // Make a Region for the merge point
Node *r = new (phase->C) RegionNode(1); Node *r = new RegionNode(1);
for( i = 2; i < _head->req(); i++ ) { for( i = 2; i < _head->req(); i++ ) {
if( i != hot_idx ) if( i != hot_idx )
r->add_req( _head->in(i) ); r->add_req( _head->in(i) );
@ -1407,7 +1407,7 @@ void IdealLoopTree::merge_many_backedges( PhaseIdealLoop *phase ) {
PhiNode* n = out->as_Phi(); PhiNode* n = out->as_Phi();
igvn.hash_delete(n); // Delete from hash before hacking edges igvn.hash_delete(n); // Delete from hash before hacking edges
Node *hot_phi = NULL; Node *hot_phi = NULL;
Node *phi = new (phase->C) PhiNode(r, n->type(), n->adr_type()); Node *phi = new PhiNode(r, n->type(), n->adr_type());
// Check all inputs for the ones to peel out // Check all inputs for the ones to peel out
uint j = 1; uint j = 1;
for( uint i = 2; i < n->req(); i++ ) { for( uint i = 2; i < n->req(); i++ ) {
@ -1529,7 +1529,7 @@ bool IdealLoopTree::beautify_loops( PhaseIdealLoop *phase ) {
} else if (!_head->is_Loop() && !_irreducible) { } else if (!_head->is_Loop() && !_irreducible) {
// Make a new LoopNode to replace the old loop head // Make a new LoopNode to replace the old loop head
Node *l = new (phase->C) LoopNode( _head->in(1), _head->in(2) ); Node *l = new LoopNode( _head->in(1), _head->in(2) );
l = igvn.register_new_node_with_optimizer(l, _head); l = igvn.register_new_node_with_optimizer(l, _head);
phase->set_created_loop_node(); phase->set_created_loop_node();
// Go ahead and replace _head // Go ahead and replace _head
@ -1771,16 +1771,16 @@ void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) {
// It is scaled by the 'ratio_con'. // It is scaled by the 'ratio_con'.
Node* ratio = _igvn.intcon(ratio_con); Node* ratio = _igvn.intcon(ratio_con);
set_ctrl(ratio, C->root()); set_ctrl(ratio, C->root());
Node* ratio_init = new (C) MulINode(init, ratio); Node* ratio_init = new MulINode(init, ratio);
_igvn.register_new_node_with_optimizer(ratio_init, init); _igvn.register_new_node_with_optimizer(ratio_init, init);
set_early_ctrl(ratio_init); set_early_ctrl(ratio_init);
Node* diff = new (C) SubINode(init2, ratio_init); Node* diff = new SubINode(init2, ratio_init);
_igvn.register_new_node_with_optimizer(diff, init2); _igvn.register_new_node_with_optimizer(diff, init2);
set_early_ctrl(diff); set_early_ctrl(diff);
Node* ratio_idx = new (C) MulINode(phi, ratio); Node* ratio_idx = new MulINode(phi, ratio);
_igvn.register_new_node_with_optimizer(ratio_idx, phi); _igvn.register_new_node_with_optimizer(ratio_idx, phi);
set_ctrl(ratio_idx, cl); set_ctrl(ratio_idx, cl);
Node* add = new (C) AddINode(ratio_idx, diff); Node* add = new AddINode(ratio_idx, diff);
_igvn.register_new_node_with_optimizer(add); _igvn.register_new_node_with_optimizer(add);
set_ctrl(add, cl); set_ctrl(add, cl);
_igvn.replace_node( phi2, add ); _igvn.replace_node( phi2, add );
@ -2888,10 +2888,10 @@ int PhaseIdealLoop::build_loop_tree_impl( Node *n, int pre_order ) {
if (!_verify_only) { if (!_verify_only) {
// Insert the NeverBranch between 'm' and it's control user. // Insert the NeverBranch between 'm' and it's control user.
NeverBranchNode *iff = new (C) NeverBranchNode( m ); NeverBranchNode *iff = new NeverBranchNode( m );
_igvn.register_new_node_with_optimizer(iff); _igvn.register_new_node_with_optimizer(iff);
set_loop(iff, l); set_loop(iff, l);
Node *if_t = new (C) CProjNode( iff, 0 ); Node *if_t = new CProjNode( iff, 0 );
_igvn.register_new_node_with_optimizer(if_t); _igvn.register_new_node_with_optimizer(if_t);
set_loop(if_t, l); set_loop(if_t, l);
@ -2907,16 +2907,16 @@ int PhaseIdealLoop::build_loop_tree_impl( Node *n, int pre_order ) {
cfg->set_req( k, if_t ); // Now point to NeverBranch cfg->set_req( k, if_t ); // Now point to NeverBranch
// Now create the never-taken loop exit // Now create the never-taken loop exit
Node *if_f = new (C) CProjNode( iff, 1 ); Node *if_f = new CProjNode( iff, 1 );
_igvn.register_new_node_with_optimizer(if_f); _igvn.register_new_node_with_optimizer(if_f);
set_loop(if_f, l); set_loop(if_f, l);
// Find frame ptr for Halt. Relies on the optimizer // Find frame ptr for Halt. Relies on the optimizer
// V-N'ing. Easier and quicker than searching through // V-N'ing. Easier and quicker than searching through
// the program structure. // the program structure.
Node *frame = new (C) ParmNode( C->start(), TypeFunc::FramePtr ); Node *frame = new ParmNode( C->start(), TypeFunc::FramePtr );
_igvn.register_new_node_with_optimizer(frame); _igvn.register_new_node_with_optimizer(frame);
// Halt & Catch Fire // Halt & Catch Fire
Node *halt = new (C) HaltNode( if_f, frame ); Node *halt = new HaltNode( if_f, frame );
_igvn.register_new_node_with_optimizer(halt); _igvn.register_new_node_with_optimizer(halt);
set_loop(halt, l); set_loop(halt, l);
C->root()->add_req(halt); C->root()->add_req(halt);

View File

@ -56,7 +56,7 @@ Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *region, int policy ) {
int iid = t_oop->instance_id(); int iid = t_oop->instance_id();
int index = C->get_alias_index(t_oop); int index = C->get_alias_index(t_oop);
int offset = t_oop->offset(); int offset = t_oop->offset();
phi = new (C) PhiNode(region, type, NULL, iid, index, offset); phi = new PhiNode(region, type, NULL, iid, index, offset);
} else { } else {
phi = PhiNode::make_blank(region, n); phi = PhiNode::make_blank(region, n);
} }
@ -363,9 +363,9 @@ Node *PhaseIdealLoop::remix_address_expressions( Node *n ) {
_igvn.type( add->in(1) ) != TypeInt::ZERO ) { _igvn.type( add->in(1) ) != TypeInt::ZERO ) {
Node *zero = _igvn.intcon(0); Node *zero = _igvn.intcon(0);
set_ctrl(zero, C->root()); set_ctrl(zero, C->root());
Node *neg = new (C) SubINode( _igvn.intcon(0), add->in(2) ); Node *neg = new SubINode( _igvn.intcon(0), add->in(2) );
register_new_node( neg, get_ctrl(add->in(2) ) ); register_new_node( neg, get_ctrl(add->in(2) ) );
add = new (C) AddINode( add->in(1), neg ); add = new AddINode( add->in(1), neg );
register_new_node( add, add_ctrl ); register_new_node( add, add_ctrl );
} }
if( add->Opcode() != Op_AddI ) return NULL; if( add->Opcode() != Op_AddI ) return NULL;
@ -391,14 +391,14 @@ Node *PhaseIdealLoop::remix_address_expressions( Node *n ) {
return NULL; // No invariant part of the add? return NULL; // No invariant part of the add?
// Yes! Reshape address expression! // Yes! Reshape address expression!
Node *inv_scale = new (C) LShiftINode( add_invar, scale ); Node *inv_scale = new LShiftINode( add_invar, scale );
Node *inv_scale_ctrl = Node *inv_scale_ctrl =
dom_depth(add_invar_ctrl) > dom_depth(scale_ctrl) ? dom_depth(add_invar_ctrl) > dom_depth(scale_ctrl) ?
add_invar_ctrl : scale_ctrl; add_invar_ctrl : scale_ctrl;
register_new_node( inv_scale, inv_scale_ctrl ); register_new_node( inv_scale, inv_scale_ctrl );
Node *var_scale = new (C) LShiftINode( add_var, scale ); Node *var_scale = new LShiftINode( add_var, scale );
register_new_node( var_scale, n_ctrl ); register_new_node( var_scale, n_ctrl );
Node *var_add = new (C) AddINode( var_scale, inv_scale ); Node *var_add = new AddINode( var_scale, inv_scale );
register_new_node( var_add, n_ctrl ); register_new_node( var_add, n_ctrl );
_igvn.replace_node( n, var_add ); _igvn.replace_node( n, var_add );
return var_add; return var_add;
@ -430,10 +430,10 @@ Node *PhaseIdealLoop::remix_address_expressions( Node *n ) {
IdealLoopTree *n23_loop = get_loop( n23_ctrl ); IdealLoopTree *n23_loop = get_loop( n23_ctrl );
if( n22loop != n_loop && n22loop->is_member(n_loop) && if( n22loop != n_loop && n22loop->is_member(n_loop) &&
n23_loop == n_loop ) { n23_loop == n_loop ) {
Node *add1 = new (C) AddPNode( n->in(1), n->in(2)->in(2), n->in(3) ); Node *add1 = new AddPNode( n->in(1), n->in(2)->in(2), n->in(3) );
// Stuff new AddP in the loop preheader // Stuff new AddP in the loop preheader
register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) ); register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) );
Node *add2 = new (C) AddPNode( n->in(1), add1, n->in(2)->in(3) ); Node *add2 = new AddPNode( n->in(1), add1, n->in(2)->in(3) );
register_new_node( add2, n_ctrl ); register_new_node( add2, n_ctrl );
_igvn.replace_node( n, add2 ); _igvn.replace_node( n, add2 );
return add2; return add2;
@ -451,10 +451,10 @@ Node *PhaseIdealLoop::remix_address_expressions( Node *n ) {
Node *tmp = V; V = I; I = tmp; Node *tmp = V; V = I; I = tmp;
} }
if( !is_member(n_loop,get_ctrl(I)) ) { if( !is_member(n_loop,get_ctrl(I)) ) {
Node *add1 = new (C) AddPNode( n->in(1), n->in(2), I ); Node *add1 = new AddPNode( n->in(1), n->in(2), I );
// Stuff new AddP in the loop preheader // Stuff new AddP in the loop preheader
register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) ); register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) );
Node *add2 = new (C) AddPNode( n->in(1), add1, V ); Node *add2 = new AddPNode( n->in(1), add1, V );
register_new_node( add2, n_ctrl ); register_new_node( add2, n_ctrl );
_igvn.replace_node( n, add2 ); _igvn.replace_node( n, add2 );
return add2; return add2;
@ -1104,8 +1104,8 @@ BoolNode *PhaseIdealLoop::clone_iff( PhiNode *phi, IdealLoopTree *loop ) {
Node *sample_cmp = sample_bool->in(1); Node *sample_cmp = sample_bool->in(1);
// Make Phis to merge the Cmp's inputs. // Make Phis to merge the Cmp's inputs.
PhiNode *phi1 = new (C) PhiNode( phi->in(0), Type::TOP ); PhiNode *phi1 = new PhiNode( phi->in(0), Type::TOP );
PhiNode *phi2 = new (C) PhiNode( phi->in(0), Type::TOP ); PhiNode *phi2 = new PhiNode( phi->in(0), Type::TOP );
for( i = 1; i < phi->req(); i++ ) { for( i = 1; i < phi->req(); i++ ) {
Node *n1 = phi->in(i)->in(1)->in(1); Node *n1 = phi->in(i)->in(1)->in(1);
Node *n2 = phi->in(i)->in(1)->in(2); Node *n2 = phi->in(i)->in(1)->in(2);
@ -1172,8 +1172,8 @@ CmpNode *PhaseIdealLoop::clone_bool( PhiNode *phi, IdealLoopTree *loop ) {
Node *sample_cmp = phi->in(1); Node *sample_cmp = phi->in(1);
// Make Phis to merge the Cmp's inputs. // Make Phis to merge the Cmp's inputs.
PhiNode *phi1 = new (C) PhiNode( phi->in(0), Type::TOP ); PhiNode *phi1 = new PhiNode( phi->in(0), Type::TOP );
PhiNode *phi2 = new (C) PhiNode( phi->in(0), Type::TOP ); PhiNode *phi2 = new PhiNode( phi->in(0), Type::TOP );
for( uint j = 1; j < phi->req(); j++ ) { for( uint j = 1; j < phi->req(); j++ ) {
Node *cmp_top = phi->in(j); // Inputs are all Cmp or TOP Node *cmp_top = phi->in(j); // Inputs are all Cmp or TOP
Node *n1, *n2; Node *n1, *n2;
@ -1337,7 +1337,7 @@ void PhaseIdealLoop::clone_loop( IdealLoopTree *loop, Node_List &old_new, int dd
// We need a Region to merge the exit from the peeled body and the // We need a Region to merge the exit from the peeled body and the
// exit from the old loop body. // exit from the old loop body.
RegionNode *r = new (C) RegionNode(3); RegionNode *r = new RegionNode(3);
// Map the old use to the new merge point // Map the old use to the new merge point
old_new.map( use->_idx, r ); old_new.map( use->_idx, r );
uint dd_r = MIN2(dom_depth(newuse),dom_depth(use)); uint dd_r = MIN2(dom_depth(newuse),dom_depth(use));
@ -1403,7 +1403,8 @@ void PhaseIdealLoop::clone_loop( IdealLoopTree *loop, Node_List &old_new, int dd
// loop. Happens if people set a loop-exit flag; then test the flag // loop. Happens if people set a loop-exit flag; then test the flag
// in the loop to break the loop, then test is again outside of the // in the loop to break the loop, then test is again outside of the
// loop to determine which way the loop exited. // loop to determine which way the loop exited.
if( use->is_If() || use->is_CMove() ) { // Loop predicate If node connects to Bool node through Opaque1 node.
if (use->is_If() || use->is_CMove() || C->is_predicate_opaq(use)) {
// Since this code is highly unlikely, we lazily build the worklist // Since this code is highly unlikely, we lazily build the worklist
// of such Nodes to go split. // of such Nodes to go split.
if( !split_if_set ) if( !split_if_set )
@ -1684,13 +1685,13 @@ ProjNode* PhaseIdealLoop::insert_if_before_proj(Node* left, bool Signed, BoolTes
ProjNode* proj2 = proj_clone(proj, iff); ProjNode* proj2 = proj_clone(proj, iff);
register_node(proj2, loop, iff, ddepth); register_node(proj2, loop, iff, ddepth);
Node* cmp = Signed ? (Node*) new (C)CmpINode(left, right) : (Node*) new (C)CmpUNode(left, right); Node* cmp = Signed ? (Node*) new CmpINode(left, right) : (Node*) new CmpUNode(left, right);
register_node(cmp, loop, proj2, ddepth); register_node(cmp, loop, proj2, ddepth);
BoolNode* bol = new (C)BoolNode(cmp, relop); BoolNode* bol = new BoolNode(cmp, relop);
register_node(bol, loop, proj2, ddepth); register_node(bol, loop, proj2, ddepth);
IfNode* new_if = new (C)IfNode(proj2, bol, iff->_prob, iff->_fcnt); IfNode* new_if = new IfNode(proj2, bol, iff->_prob, iff->_fcnt);
register_node(new_if, loop, proj2, ddepth); register_node(new_if, loop, proj2, ddepth);
proj->set_req(0, new_if); // reattach proj->set_req(0, new_if); // reattach
@ -1742,11 +1743,11 @@ RegionNode* PhaseIdealLoop::insert_region_before_proj(ProjNode* proj) {
ProjNode* proj2 = proj_clone(proj, iff); ProjNode* proj2 = proj_clone(proj, iff);
register_node(proj2, loop, iff, ddepth); register_node(proj2, loop, iff, ddepth);
RegionNode* reg = new (C)RegionNode(2); RegionNode* reg = new RegionNode(2);
reg->set_req(1, proj2); reg->set_req(1, proj2);
register_node(reg, loop, iff, ddepth); register_node(reg, loop, iff, ddepth);
IfNode* dum_if = new (C)IfNode(reg, short_circuit_if(NULL, proj), iff->_prob, iff->_fcnt); IfNode* dum_if = new IfNode(reg, short_circuit_if(NULL, proj), iff->_prob, iff->_fcnt);
register_node(dum_if, loop, reg, ddepth); register_node(dum_if, loop, reg, ddepth);
proj->set_req(0, dum_if); // reattach proj->set_req(0, dum_if); // reattach
@ -2569,7 +2570,7 @@ bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
// Create new loop head for new phis and to hang // Create new loop head for new phis and to hang
// the nodes being moved (sinked) from the peel region. // the nodes being moved (sinked) from the peel region.
LoopNode* new_head = new (C) LoopNode(last_peel, last_peel); LoopNode* new_head = new LoopNode(last_peel, last_peel);
new_head->set_unswitch_count(head->unswitch_count()); // Preserve new_head->set_unswitch_count(head->unswitch_count()); // Preserve
_igvn.register_new_node_with_optimizer(new_head); _igvn.register_new_node_with_optimizer(new_head);
assert(first_not_peeled->in(0) == last_peel, "last_peel <- first_not_peeled"); assert(first_not_peeled->in(0) == last_peel, "last_peel <- first_not_peeled");
@ -2769,12 +2770,12 @@ void PhaseIdealLoop::reorg_offsets(IdealLoopTree *loop) {
if (dom_lca(exit, u_ctrl) != exit) continue; if (dom_lca(exit, u_ctrl) != exit) continue;
// Hit! Refactor use to use the post-incremented tripcounter. // Hit! Refactor use to use the post-incremented tripcounter.
// Compute a post-increment tripcounter. // Compute a post-increment tripcounter.
Node *opaq = new (C) Opaque2Node( C, cle->incr() ); Node *opaq = new Opaque2Node( C, cle->incr() );
register_new_node( opaq, u_ctrl ); register_new_node(opaq, exit);
Node *neg_stride = _igvn.intcon(-cle->stride_con()); Node *neg_stride = _igvn.intcon(-cle->stride_con());
set_ctrl(neg_stride, C->root()); set_ctrl(neg_stride, C->root());
Node *post = new (C) AddINode( opaq, neg_stride); Node *post = new AddINode( opaq, neg_stride);
register_new_node( post, u_ctrl ); register_new_node(post, exit);
_igvn.rehash_node_delayed(use); _igvn.rehash_node_delayed(use);
for (uint j = 1; j < use->req(); j++) { for (uint j = 1; j < use->req(); j++) {
if (use->in(j) == phi) if (use->in(j) == phi)

View File

@ -60,7 +60,10 @@ class State;
class MachOper : public ResourceObj { class MachOper : public ResourceObj {
public: public:
// Allocate right next to the MachNodes in the same arena // Allocate right next to the MachNodes in the same arena
void *operator new( size_t x, Compile* C ) throw() { return C->node_arena()->Amalloc_D(x); } void *operator new(size_t x) throw() {
Compile* C = Compile::current();
return C->node_arena()->Amalloc_D(x);
}
// Opcode // Opcode
virtual uint opcode() const = 0; virtual uint opcode() const = 0;

View File

@ -108,20 +108,20 @@ void PhaseMacroExpand::copy_call_debug_info(CallNode *oldcall, CallNode * newcal
Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path) { Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path) {
Node* cmp; Node* cmp;
if (mask != 0) { if (mask != 0) {
Node* and_node = transform_later(new (C) AndXNode(word, MakeConX(mask))); Node* and_node = transform_later(new AndXNode(word, MakeConX(mask)));
cmp = transform_later(new (C) CmpXNode(and_node, MakeConX(bits))); cmp = transform_later(new CmpXNode(and_node, MakeConX(bits)));
} else { } else {
cmp = word; cmp = word;
} }
Node* bol = transform_later(new (C) BoolNode(cmp, BoolTest::ne)); Node* bol = transform_later(new BoolNode(cmp, BoolTest::ne));
IfNode* iff = new (C) IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN ); IfNode* iff = new IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN );
transform_later(iff); transform_later(iff);
// Fast path taken. // Fast path taken.
Node *fast_taken = transform_later( new (C) IfFalseNode(iff) ); Node *fast_taken = transform_later(new IfFalseNode(iff));
// Fast path not-taken, i.e. slow path // Fast path not-taken, i.e. slow path
Node *slow_taken = transform_later( new (C) IfTrueNode(iff) ); Node *slow_taken = transform_later(new IfTrueNode(iff));
if (return_fast_path) { if (return_fast_path) {
region->init_req(edge, slow_taken); // Capture slow-control region->init_req(edge, slow_taken); // Capture slow-control
@ -147,8 +147,8 @@ CallNode* PhaseMacroExpand::make_slow_call(CallNode *oldcall, const TypeFunc* sl
// Slow-path call // Slow-path call
CallNode *call = leaf_name CallNode *call = leaf_name
? (CallNode*)new (C) CallLeafNode ( slow_call_type, slow_call, leaf_name, TypeRawPtr::BOTTOM ) ? (CallNode*)new CallLeafNode ( slow_call_type, slow_call, leaf_name, TypeRawPtr::BOTTOM )
: (CallNode*)new (C) CallStaticJavaNode( slow_call_type, slow_call, OptoRuntime::stub_name(slow_call), oldcall->jvms()->bci(), TypeRawPtr::BOTTOM ); : (CallNode*)new CallStaticJavaNode( slow_call_type, slow_call, OptoRuntime::stub_name(slow_call), oldcall->jvms()->bci(), TypeRawPtr::BOTTOM );
// Slow path call has no side-effects, uses few values // Slow path call has no side-effects, uses few values
copy_predefined_input_for_runtime_call(slow_path, oldcall, call ); copy_predefined_input_for_runtime_call(slow_path, oldcall, call );
@ -423,7 +423,7 @@ Node *PhaseMacroExpand::value_from_mem_phi(Node *mem, BasicType ft, const Type *
GrowableArray <Node *> values(length, length, NULL, false); GrowableArray <Node *> values(length, length, NULL, false);
// create a new Phi for the value // create a new Phi for the value
PhiNode *phi = new (C) PhiNode(mem->in(0), phi_type, NULL, instance_id, alias_idx, offset); PhiNode *phi = new PhiNode(mem->in(0), phi_type, NULL, instance_id, alias_idx, offset);
transform_later(phi); transform_later(phi);
value_phis->push(phi, mem->_idx); value_phis->push(phi, mem->_idx);
@ -735,7 +735,7 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray <Sa
// of regular debuginfo at the last (youngest) JVMS. // of regular debuginfo at the last (youngest) JVMS.
// Record relative start index. // Record relative start index.
uint first_ind = (sfpt->req() - sfpt->jvms()->scloff()); uint first_ind = (sfpt->req() - sfpt->jvms()->scloff());
SafePointScalarObjectNode* sobj = new (C) SafePointScalarObjectNode(res_type, SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type,
#ifdef ASSERT #ifdef ASSERT
alloc, alloc,
#endif #endif
@ -843,7 +843,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->get_ptr_type())); field_val = transform_later(new DecodeNNode(field_val, field_val->get_ptr_type()));
} }
} }
sfpt->add_req(field_val); sfpt->add_req(field_val);
@ -1069,7 +1069,7 @@ bool PhaseMacroExpand::eliminate_boxing_node(CallStaticJavaNode *boxing) {
//---------------------------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) {
if (UseTLAB) { // Private allocation: load from TLS if (UseTLAB) { // Private allocation: load from TLS
Node* thread = transform_later(new (C) ThreadLocalNode()); Node* thread = transform_later(new ThreadLocalNode());
int tlab_top_offset = in_bytes(JavaThread::tlab_top_offset()); int tlab_top_offset = in_bytes(JavaThread::tlab_top_offset());
int tlab_end_offset = in_bytes(JavaThread::tlab_end_offset()); int tlab_end_offset = in_bytes(JavaThread::tlab_end_offset());
eden_top_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_top_offset); eden_top_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_top_offset);
@ -1205,18 +1205,18 @@ void PhaseMacroExpand::expand_allocate_common(
assert (initial_slow_test == NULL || !always_slow, "arguments must be consistent"); assert (initial_slow_test == NULL || !always_slow, "arguments must be consistent");
// generate the initial test if necessary // generate the initial test if necessary
if (initial_slow_test != NULL ) { if (initial_slow_test != NULL ) {
slow_region = new (C) RegionNode(3); slow_region = new RegionNode(3);
// Now make the initial failure test. Usually a too-big test but // Now make the initial failure test. Usually a too-big test but
// might be a TRUE for finalizers or a fancy class check for // might be a TRUE for finalizers or a fancy class check for
// newInstance0. // newInstance0.
IfNode *toobig_iff = new (C) IfNode(ctrl, initial_slow_test, PROB_MIN, COUNT_UNKNOWN); IfNode *toobig_iff = new IfNode(ctrl, initial_slow_test, PROB_MIN, COUNT_UNKNOWN);
transform_later(toobig_iff); transform_later(toobig_iff);
// Plug the failing-too-big test into the slow-path region // Plug the failing-too-big test into the slow-path region
Node *toobig_true = new (C) IfTrueNode( toobig_iff ); Node *toobig_true = new IfTrueNode( toobig_iff );
transform_later(toobig_true); transform_later(toobig_true);
slow_region ->init_req( too_big_or_final_path, toobig_true ); slow_region ->init_req( too_big_or_final_path, toobig_true );
toobig_false = new (C) IfFalseNode( toobig_iff ); toobig_false = new IfFalseNode( toobig_iff );
transform_later(toobig_false); transform_later(toobig_false);
} else { // No initial test, just fall into next case } else { // No initial test, just fall into next case
toobig_false = ctrl; toobig_false = ctrl;
@ -1249,10 +1249,10 @@ void PhaseMacroExpand::expand_allocate_common(
Node *eden_end = make_load(ctrl, mem, eden_end_adr, 0, TypeRawPtr::BOTTOM, T_ADDRESS); Node *eden_end = make_load(ctrl, mem, eden_end_adr, 0, TypeRawPtr::BOTTOM, T_ADDRESS);
// allocate the Region and Phi nodes for the result // allocate the Region and Phi nodes for the result
result_region = new (C) RegionNode(3); result_region = new RegionNode(3);
result_phi_rawmem = new (C) PhiNode(result_region, Type::MEMORY, TypeRawPtr::BOTTOM); result_phi_rawmem = new PhiNode(result_region, Type::MEMORY, TypeRawPtr::BOTTOM);
result_phi_rawoop = new (C) PhiNode(result_region, TypeRawPtr::BOTTOM); result_phi_rawoop = new PhiNode(result_region, TypeRawPtr::BOTTOM);
result_phi_i_o = new (C) PhiNode(result_region, Type::ABIO); // I/O is used for Prefetch result_phi_i_o = new PhiNode(result_region, Type::ABIO); // I/O is used for Prefetch
// We need a Region for the loop-back contended case. // We need a Region for the loop-back contended case.
enum { fall_in_path = 1, contended_loopback_path = 2 }; enum { fall_in_path = 1, contended_loopback_path = 2 };
@ -1262,8 +1262,8 @@ void PhaseMacroExpand::expand_allocate_common(
contended_region = toobig_false; contended_region = toobig_false;
contended_phi_rawmem = mem; contended_phi_rawmem = mem;
} else { } else {
contended_region = new (C) RegionNode(3); contended_region = new RegionNode(3);
contended_phi_rawmem = new (C) PhiNode(contended_region, Type::MEMORY, TypeRawPtr::BOTTOM); contended_phi_rawmem = new PhiNode(contended_region, Type::MEMORY, TypeRawPtr::BOTTOM);
// Now handle the passing-too-big test. We fall into the contended // Now handle the passing-too-big test. We fall into the contended
// loop-back merge point. // loop-back merge point.
contended_region ->init_req(fall_in_path, toobig_false); contended_region ->init_req(fall_in_path, toobig_false);
@ -1275,23 +1275,23 @@ void PhaseMacroExpand::expand_allocate_common(
// Load(-locked) the heap top. // Load(-locked) the heap top.
// See note above concerning the control input when using a TLAB // See note above concerning the control input when using a TLAB
Node *old_eden_top = UseTLAB Node *old_eden_top = UseTLAB
? new (C) LoadPNode (ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered) ? new LoadPNode (ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered)
: new (C) LoadPLockedNode(contended_region, contended_phi_rawmem, eden_top_adr, MemNode::acquire); : new LoadPLockedNode(contended_region, contended_phi_rawmem, eden_top_adr, MemNode::acquire);
transform_later(old_eden_top); transform_later(old_eden_top);
// Add to heap top to get a new heap top // Add to heap top to get a new heap top
Node *new_eden_top = new (C) AddPNode(top(), old_eden_top, size_in_bytes); Node *new_eden_top = new AddPNode(top(), old_eden_top, size_in_bytes);
transform_later(new_eden_top); transform_later(new_eden_top);
// Check for needing a GC; compare against heap end // Check for needing a GC; compare against heap end
Node *needgc_cmp = new (C) CmpPNode(new_eden_top, eden_end); Node *needgc_cmp = new CmpPNode(new_eden_top, eden_end);
transform_later(needgc_cmp); transform_later(needgc_cmp);
Node *needgc_bol = new (C) BoolNode(needgc_cmp, BoolTest::ge); Node *needgc_bol = new BoolNode(needgc_cmp, BoolTest::ge);
transform_later(needgc_bol); transform_later(needgc_bol);
IfNode *needgc_iff = new (C) IfNode(contended_region, needgc_bol, PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN); IfNode *needgc_iff = new IfNode(contended_region, needgc_bol, PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN);
transform_later(needgc_iff); transform_later(needgc_iff);
// Plug the failing-heap-space-need-gc test into the slow-path region // Plug the failing-heap-space-need-gc test into the slow-path region
Node *needgc_true = new (C) IfTrueNode(needgc_iff); Node *needgc_true = new IfTrueNode(needgc_iff);
transform_later(needgc_true); transform_later(needgc_true);
if (initial_slow_test) { if (initial_slow_test) {
slow_region->init_req(need_gc_path, needgc_true); slow_region->init_req(need_gc_path, needgc_true);
@ -1302,7 +1302,7 @@ void PhaseMacroExpand::expand_allocate_common(
slow_region = needgc_true; slow_region = needgc_true;
} }
// No need for a GC. Setup for the Store-Conditional // No need for a GC. Setup for the Store-Conditional
Node *needgc_false = new (C) IfFalseNode(needgc_iff); Node *needgc_false = new IfFalseNode(needgc_iff);
transform_later(needgc_false); transform_later(needgc_false);
// Grab regular I/O before optional prefetch may change it. // Grab regular I/O before optional prefetch may change it.
@ -1322,37 +1322,37 @@ void PhaseMacroExpand::expand_allocate_common(
// memory state. // memory state.
if (UseTLAB) { if (UseTLAB) {
Node* store_eden_top = Node* store_eden_top =
new (C) StorePNode(needgc_false, contended_phi_rawmem, eden_top_adr, new StorePNode(needgc_false, contended_phi_rawmem, eden_top_adr,
TypeRawPtr::BOTTOM, new_eden_top, MemNode::unordered); TypeRawPtr::BOTTOM, new_eden_top, MemNode::unordered);
transform_later(store_eden_top); transform_later(store_eden_top);
fast_oop_ctrl = needgc_false; // No contention, so this is the fast path fast_oop_ctrl = needgc_false; // No contention, so this is the fast path
fast_oop_rawmem = store_eden_top; fast_oop_rawmem = store_eden_top;
} else { } else {
Node* store_eden_top = Node* store_eden_top =
new (C) StorePConditionalNode(needgc_false, contended_phi_rawmem, eden_top_adr, new StorePConditionalNode(needgc_false, contended_phi_rawmem, eden_top_adr,
new_eden_top, fast_oop/*old_eden_top*/); new_eden_top, fast_oop/*old_eden_top*/);
transform_later(store_eden_top); transform_later(store_eden_top);
Node *contention_check = new (C) BoolNode(store_eden_top, BoolTest::ne); Node *contention_check = new BoolNode(store_eden_top, BoolTest::ne);
transform_later(contention_check); transform_later(contention_check);
store_eden_top = new (C) SCMemProjNode(store_eden_top); store_eden_top = new SCMemProjNode(store_eden_top);
transform_later(store_eden_top); transform_later(store_eden_top);
// If not using TLABs, check to see if there was contention. // If not using TLABs, check to see if there was contention.
IfNode *contention_iff = new (C) IfNode (needgc_false, contention_check, PROB_MIN, COUNT_UNKNOWN); IfNode *contention_iff = new IfNode (needgc_false, contention_check, PROB_MIN, COUNT_UNKNOWN);
transform_later(contention_iff); transform_later(contention_iff);
Node *contention_true = new (C) IfTrueNode(contention_iff); Node *contention_true = new IfTrueNode(contention_iff);
transform_later(contention_true); transform_later(contention_true);
// If contention, loopback and try again. // If contention, loopback and try again.
contended_region->init_req(contended_loopback_path, contention_true); contended_region->init_req(contended_loopback_path, contention_true);
contended_phi_rawmem->init_req(contended_loopback_path, store_eden_top); contended_phi_rawmem->init_req(contended_loopback_path, store_eden_top);
// Fast-path succeeded with no contention! // Fast-path succeeded with no contention!
Node *contention_false = new (C) IfFalseNode(contention_iff); Node *contention_false = new IfFalseNode(contention_iff);
transform_later(contention_false); transform_later(contention_false);
fast_oop_ctrl = contention_false; fast_oop_ctrl = contention_false;
// Bump total allocated bytes for this thread // Bump total allocated bytes for this thread
Node* thread = new (C) ThreadLocalNode(); Node* thread = new ThreadLocalNode();
transform_later(thread); transform_later(thread);
Node* alloc_bytes_adr = basic_plus_adr(top()/*not oop*/, thread, Node* alloc_bytes_adr = basic_plus_adr(top()/*not oop*/, thread,
in_bytes(JavaThread::allocated_bytes_offset())); in_bytes(JavaThread::allocated_bytes_offset()));
@ -1361,10 +1361,10 @@ void PhaseMacroExpand::expand_allocate_common(
#ifdef _LP64 #ifdef _LP64
Node* alloc_size = size_in_bytes; Node* alloc_size = size_in_bytes;
#else #else
Node* alloc_size = new (C) ConvI2LNode(size_in_bytes); Node* alloc_size = new ConvI2LNode(size_in_bytes);
transform_later(alloc_size); transform_later(alloc_size);
#endif #endif
Node* new_alloc_bytes = new (C) AddLNode(alloc_bytes, alloc_size); Node* new_alloc_bytes = new AddLNode(alloc_bytes, alloc_size);
transform_later(new_alloc_bytes); transform_later(new_alloc_bytes);
fast_oop_rawmem = make_store(fast_oop_ctrl, store_eden_top, alloc_bytes_adr, fast_oop_rawmem = make_store(fast_oop_ctrl, store_eden_top, alloc_bytes_adr,
0, new_alloc_bytes, T_LONG); 0, new_alloc_bytes, T_LONG);
@ -1391,9 +1391,9 @@ void PhaseMacroExpand::expand_allocate_common(
mb->init_req(TypeFunc::Memory, fast_oop_rawmem); mb->init_req(TypeFunc::Memory, fast_oop_rawmem);
mb->init_req(TypeFunc::Control, fast_oop_ctrl); mb->init_req(TypeFunc::Control, fast_oop_ctrl);
fast_oop_ctrl = new (C) ProjNode(mb,TypeFunc::Control); fast_oop_ctrl = new ProjNode(mb,TypeFunc::Control);
transform_later(fast_oop_ctrl); transform_later(fast_oop_ctrl);
fast_oop_rawmem = new (C) ProjNode(mb,TypeFunc::Memory); fast_oop_rawmem = new ProjNode(mb,TypeFunc::Memory);
transform_later(fast_oop_rawmem); transform_later(fast_oop_rawmem);
} else { } else {
// Add the MemBarStoreStore after the InitializeNode so that // Add the MemBarStoreStore after the InitializeNode so that
@ -1407,9 +1407,9 @@ void PhaseMacroExpand::expand_allocate_common(
MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot); MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot);
transform_later(mb); transform_later(mb);
Node* ctrl = new (C) ProjNode(init,TypeFunc::Control); Node* ctrl = new ProjNode(init,TypeFunc::Control);
transform_later(ctrl); transform_later(ctrl);
Node* mem = new (C) ProjNode(init,TypeFunc::Memory); Node* mem = new ProjNode(init,TypeFunc::Memory);
transform_later(mem); transform_later(mem);
// The MemBarStoreStore depends on control and memory coming // The MemBarStoreStore depends on control and memory coming
@ -1417,9 +1417,9 @@ void PhaseMacroExpand::expand_allocate_common(
mb->init_req(TypeFunc::Memory, mem); mb->init_req(TypeFunc::Memory, mem);
mb->init_req(TypeFunc::Control, ctrl); mb->init_req(TypeFunc::Control, ctrl);
ctrl = new (C) ProjNode(mb,TypeFunc::Control); ctrl = new ProjNode(mb,TypeFunc::Control);
transform_later(ctrl); transform_later(ctrl);
mem = new (C) ProjNode(mb,TypeFunc::Memory); mem = new ProjNode(mb,TypeFunc::Memory);
transform_later(mem); transform_later(mem);
// All nodes that depended on the InitializeNode for control // All nodes that depended on the InitializeNode for control
@ -1433,13 +1433,13 @@ void PhaseMacroExpand::expand_allocate_common(
if (C->env()->dtrace_extended_probes()) { if (C->env()->dtrace_extended_probes()) {
// Slow-path call // Slow-path call
int size = TypeFunc::Parms + 2; int size = TypeFunc::Parms + 2;
CallLeafNode *call = new (C) CallLeafNode(OptoRuntime::dtrace_object_alloc_Type(), CallLeafNode *call = new CallLeafNode(OptoRuntime::dtrace_object_alloc_Type(),
CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc_base), CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc_base),
"dtrace_object_alloc", "dtrace_object_alloc",
TypeRawPtr::BOTTOM); TypeRawPtr::BOTTOM);
// Get base of thread-local storage area // Get base of thread-local storage area
Node* thread = new (C) ThreadLocalNode(); Node* thread = new ThreadLocalNode();
transform_later(thread); transform_later(thread);
call->init_req(TypeFunc::Parms+0, thread); call->init_req(TypeFunc::Parms+0, thread);
@ -1450,9 +1450,9 @@ void PhaseMacroExpand::expand_allocate_common(
call->init_req(TypeFunc::ReturnAdr, alloc->in(TypeFunc::ReturnAdr)); call->init_req(TypeFunc::ReturnAdr, alloc->in(TypeFunc::ReturnAdr));
call->init_req(TypeFunc::FramePtr, alloc->in(TypeFunc::FramePtr)); call->init_req(TypeFunc::FramePtr, alloc->in(TypeFunc::FramePtr));
transform_later(call); transform_later(call);
fast_oop_ctrl = new (C) ProjNode(call,TypeFunc::Control); fast_oop_ctrl = new ProjNode(call,TypeFunc::Control);
transform_later(fast_oop_ctrl); transform_later(fast_oop_ctrl);
fast_oop_rawmem = new (C) ProjNode(call,TypeFunc::Memory); fast_oop_rawmem = new ProjNode(call,TypeFunc::Memory);
transform_later(fast_oop_rawmem); transform_later(fast_oop_rawmem);
} }
@ -1467,7 +1467,7 @@ void PhaseMacroExpand::expand_allocate_common(
} }
// Generate slow-path call // Generate slow-path call
CallNode *call = new (C) CallStaticJavaNode(slow_call_type, slow_call_address, CallNode *call = new CallStaticJavaNode(slow_call_type, slow_call_address,
OptoRuntime::stub_name(slow_call_address), OptoRuntime::stub_name(slow_call_address),
alloc->jvms()->bci(), alloc->jvms()->bci(),
TypePtr::BOTTOM); TypePtr::BOTTOM);
@ -1524,7 +1524,7 @@ void PhaseMacroExpand::expand_allocate_common(
// _memproj_catchall so we end up with a call that has only 1 memory projection. // _memproj_catchall so we end up with a call that has only 1 memory projection.
if (_memproj_catchall != NULL ) { if (_memproj_catchall != NULL ) {
if (_memproj_fallthrough == NULL) { if (_memproj_fallthrough == NULL) {
_memproj_fallthrough = new (C) ProjNode(call, TypeFunc::Memory); _memproj_fallthrough = new ProjNode(call, TypeFunc::Memory);
transform_later(_memproj_fallthrough); transform_later(_memproj_fallthrough);
} }
for (DUIterator_Fast imax, i = _memproj_catchall->fast_outs(imax); i < imax; i++) { for (DUIterator_Fast imax, i = _memproj_catchall->fast_outs(imax); i < imax; i++) {
@ -1556,7 +1556,7 @@ void PhaseMacroExpand::expand_allocate_common(
// _ioproj_catchall so we end up with a call that has only 1 i_o projection. // _ioproj_catchall so we end up with a call that has only 1 i_o projection.
if (_ioproj_catchall != NULL ) { if (_ioproj_catchall != NULL ) {
if (_ioproj_fallthrough == NULL) { if (_ioproj_fallthrough == NULL) {
_ioproj_fallthrough = new (C) ProjNode(call, TypeFunc::I_O); _ioproj_fallthrough = new ProjNode(call, TypeFunc::I_O);
transform_later(_ioproj_fallthrough); transform_later(_ioproj_fallthrough);
} }
for (DUIterator_Fast imax, i = _ioproj_catchall->fast_outs(imax); i < imax; i++) { for (DUIterator_Fast imax, i = _ioproj_catchall->fast_outs(imax); i < imax; i++) {
@ -1690,47 +1690,47 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
// As an allocation hits the watermark, we will prefetch starting // As an allocation hits the watermark, we will prefetch starting
// at a "distance" away from watermark. // at a "distance" away from watermark.
Node *pf_region = new (C) RegionNode(3); Node *pf_region = new RegionNode(3);
Node *pf_phi_rawmem = new (C) PhiNode( pf_region, Type::MEMORY, Node *pf_phi_rawmem = new PhiNode( pf_region, Type::MEMORY,
TypeRawPtr::BOTTOM ); TypeRawPtr::BOTTOM );
// I/O is used for Prefetch // I/O is used for Prefetch
Node *pf_phi_abio = new (C) PhiNode( pf_region, Type::ABIO ); Node *pf_phi_abio = new PhiNode( pf_region, Type::ABIO );
Node *thread = new (C) ThreadLocalNode(); Node *thread = new ThreadLocalNode();
transform_later(thread); transform_later(thread);
Node *eden_pf_adr = new (C) AddPNode( top()/*not oop*/, thread, Node *eden_pf_adr = new AddPNode( top()/*not oop*/, thread,
_igvn.MakeConX(in_bytes(JavaThread::tlab_pf_top_offset())) ); _igvn.MakeConX(in_bytes(JavaThread::tlab_pf_top_offset())) );
transform_later(eden_pf_adr); transform_later(eden_pf_adr);
Node *old_pf_wm = new (C) LoadPNode(needgc_false, Node *old_pf_wm = new LoadPNode(needgc_false,
contended_phi_rawmem, eden_pf_adr, contended_phi_rawmem, eden_pf_adr,
TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM,
MemNode::unordered); MemNode::unordered);
transform_later(old_pf_wm); transform_later(old_pf_wm);
// check against new_eden_top // check against new_eden_top
Node *need_pf_cmp = new (C) CmpPNode( new_eden_top, old_pf_wm ); Node *need_pf_cmp = new CmpPNode( new_eden_top, old_pf_wm );
transform_later(need_pf_cmp); transform_later(need_pf_cmp);
Node *need_pf_bol = new (C) BoolNode( need_pf_cmp, BoolTest::ge ); Node *need_pf_bol = new BoolNode( need_pf_cmp, BoolTest::ge );
transform_later(need_pf_bol); transform_later(need_pf_bol);
IfNode *need_pf_iff = new (C) IfNode( needgc_false, need_pf_bol, IfNode *need_pf_iff = new IfNode( needgc_false, need_pf_bol,
PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN ); PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN );
transform_later(need_pf_iff); transform_later(need_pf_iff);
// true node, add prefetchdistance // true node, add prefetchdistance
Node *need_pf_true = new (C) IfTrueNode( need_pf_iff ); Node *need_pf_true = new IfTrueNode( need_pf_iff );
transform_later(need_pf_true); transform_later(need_pf_true);
Node *need_pf_false = new (C) IfFalseNode( need_pf_iff ); Node *need_pf_false = new IfFalseNode( need_pf_iff );
transform_later(need_pf_false); transform_later(need_pf_false);
Node *new_pf_wmt = new (C) AddPNode( top(), old_pf_wm, Node *new_pf_wmt = new AddPNode( top(), old_pf_wm,
_igvn.MakeConX(AllocatePrefetchDistance) ); _igvn.MakeConX(AllocatePrefetchDistance) );
transform_later(new_pf_wmt ); transform_later(new_pf_wmt );
new_pf_wmt->set_req(0, need_pf_true); new_pf_wmt->set_req(0, need_pf_true);
Node *store_new_wmt = new (C) StorePNode(need_pf_true, Node *store_new_wmt = new StorePNode(need_pf_true,
contended_phi_rawmem, eden_pf_adr, contended_phi_rawmem, eden_pf_adr,
TypeRawPtr::BOTTOM, new_pf_wmt, TypeRawPtr::BOTTOM, new_pf_wmt,
MemNode::unordered); MemNode::unordered);
@ -1746,10 +1746,10 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
uint distance = 0; uint distance = 0;
for ( uint i = 0; i < lines; i++ ) { for ( uint i = 0; i < lines; i++ ) {
prefetch_adr = new (C) AddPNode( old_pf_wm, new_pf_wmt, prefetch_adr = new AddPNode( old_pf_wm, new_pf_wmt,
_igvn.MakeConX(distance) ); _igvn.MakeConX(distance) );
transform_later(prefetch_adr); transform_later(prefetch_adr);
prefetch = new (C) PrefetchAllocationNode( i_o, prefetch_adr ); prefetch = new PrefetchAllocationNode( i_o, prefetch_adr );
transform_later(prefetch); transform_later(prefetch);
distance += step_size; distance += step_size;
i_o = prefetch; i_o = prefetch;
@ -1772,8 +1772,8 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
} else if( UseTLAB && AllocatePrefetchStyle == 3 ) { } else if( UseTLAB && AllocatePrefetchStyle == 3 ) {
// Insert a prefetch for each allocation. // Insert a prefetch for each allocation.
// This code is used for Sparc with BIS. // This code is used for Sparc with BIS.
Node *pf_region = new (C) RegionNode(3); Node *pf_region = new RegionNode(3);
Node *pf_phi_rawmem = new (C) PhiNode( pf_region, Type::MEMORY, Node *pf_phi_rawmem = new PhiNode( pf_region, Type::MEMORY,
TypeRawPtr::BOTTOM ); TypeRawPtr::BOTTOM );
// Generate several prefetch instructions. // Generate several prefetch instructions.
@ -1782,29 +1782,29 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
uint distance = AllocatePrefetchDistance; uint distance = AllocatePrefetchDistance;
// Next cache address. // Next cache address.
Node *cache_adr = new (C) AddPNode(old_eden_top, old_eden_top, Node *cache_adr = new AddPNode(old_eden_top, old_eden_top,
_igvn.MakeConX(distance)); _igvn.MakeConX(distance));
transform_later(cache_adr); transform_later(cache_adr);
cache_adr = new (C) CastP2XNode(needgc_false, cache_adr); cache_adr = new CastP2XNode(needgc_false, cache_adr);
transform_later(cache_adr); transform_later(cache_adr);
Node* mask = _igvn.MakeConX(~(intptr_t)(step_size-1)); Node* mask = _igvn.MakeConX(~(intptr_t)(step_size-1));
cache_adr = new (C) AndXNode(cache_adr, mask); cache_adr = new AndXNode(cache_adr, mask);
transform_later(cache_adr); transform_later(cache_adr);
cache_adr = new (C) CastX2PNode(cache_adr); cache_adr = new CastX2PNode(cache_adr);
transform_later(cache_adr); transform_later(cache_adr);
// Prefetch // Prefetch
Node *prefetch = new (C) PrefetchAllocationNode( contended_phi_rawmem, cache_adr ); Node *prefetch = new PrefetchAllocationNode( contended_phi_rawmem, cache_adr );
prefetch->set_req(0, needgc_false); prefetch->set_req(0, needgc_false);
transform_later(prefetch); transform_later(prefetch);
contended_phi_rawmem = prefetch; contended_phi_rawmem = prefetch;
Node *prefetch_adr; Node *prefetch_adr;
distance = step_size; distance = step_size;
for ( uint i = 1; i < lines; i++ ) { for ( uint i = 1; i < lines; i++ ) {
prefetch_adr = new (C) AddPNode( cache_adr, cache_adr, prefetch_adr = new AddPNode( cache_adr, cache_adr,
_igvn.MakeConX(distance) ); _igvn.MakeConX(distance) );
transform_later(prefetch_adr); transform_later(prefetch_adr);
prefetch = new (C) PrefetchAllocationNode( contended_phi_rawmem, prefetch_adr ); prefetch = new PrefetchAllocationNode( contended_phi_rawmem, prefetch_adr );
transform_later(prefetch); transform_later(prefetch);
distance += step_size; distance += step_size;
contended_phi_rawmem = prefetch; contended_phi_rawmem = prefetch;
@ -1818,10 +1818,10 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
uint step_size = AllocatePrefetchStepSize; uint step_size = AllocatePrefetchStepSize;
uint distance = AllocatePrefetchDistance; uint distance = AllocatePrefetchDistance;
for ( uint i = 0; i < lines; i++ ) { for ( uint i = 0; i < lines; i++ ) {
prefetch_adr = new (C) AddPNode( old_eden_top, new_eden_top, prefetch_adr = new AddPNode( old_eden_top, new_eden_top,
_igvn.MakeConX(distance) ); _igvn.MakeConX(distance) );
transform_later(prefetch_adr); transform_later(prefetch_adr);
prefetch = new (C) PrefetchAllocationNode( i_o, prefetch_adr ); prefetch = new PrefetchAllocationNode( i_o, prefetch_adr );
// Do not let it float too high, since if eden_top == eden_end, // Do not let it float too high, since if eden_top == eden_end,
// both might be null. // both might be null.
if( i == 0 ) { // Set control for first prefetch, next follows it if( i == 0 ) { // Set control for first prefetch, next follows it
@ -2170,12 +2170,12 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
* } * }
*/ */
region = new (C) RegionNode(5); region = new RegionNode(5);
// create a Phi for the memory state // create a Phi for the memory state
mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
Node* fast_lock_region = new (C) RegionNode(3); Node* fast_lock_region = new RegionNode(3);
Node* fast_lock_mem_phi = new (C) PhiNode( fast_lock_region, Type::MEMORY, TypeRawPtr::BOTTOM); Node* fast_lock_mem_phi = new PhiNode( fast_lock_region, Type::MEMORY, TypeRawPtr::BOTTOM);
// First, check mark word for the biased lock pattern. // First, check mark word for the biased lock pattern.
Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type());
@ -2205,10 +2205,10 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
} }
Node *proto_node = make_load(ctrl, mem, klass_node, in_bytes(Klass::prototype_header_offset()), TypeX_X, TypeX_X->basic_type()); Node *proto_node = make_load(ctrl, mem, klass_node, in_bytes(Klass::prototype_header_offset()), TypeX_X, TypeX_X->basic_type());
Node* thread = transform_later(new (C) ThreadLocalNode()); Node* thread = transform_later(new ThreadLocalNode());
Node* cast_thread = transform_later(new (C) CastP2XNode(ctrl, thread)); Node* cast_thread = transform_later(new CastP2XNode(ctrl, thread));
Node* o_node = transform_later(new (C) OrXNode(cast_thread, proto_node)); Node* o_node = transform_later(new OrXNode(cast_thread, proto_node));
Node* x_node = transform_later(new (C) XorXNode(o_node, mark_node)); Node* x_node = transform_later(new XorXNode(o_node, mark_node));
// Get slow path - mark word does NOT match the value. // Get slow path - mark word does NOT match the value.
Node* not_biased_ctrl = opt_bits_test(ctrl, region, 3, x_node, Node* not_biased_ctrl = opt_bits_test(ctrl, region, 3, x_node,
@ -2231,17 +2231,17 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
// We are going to try to reset the mark of this object to the prototype // We are going to try to reset the mark of this object to the prototype
// value and fall through to the CAS-based locking scheme. // value and fall through to the CAS-based locking scheme.
Node* adr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes()); Node* adr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
Node* cas = new (C) StoreXConditionalNode(not_biased_ctrl, mem, adr, Node* cas = new StoreXConditionalNode(not_biased_ctrl, mem, adr,
proto_node, mark_node); proto_node, mark_node);
transform_later(cas); transform_later(cas);
Node* proj = transform_later( new (C) SCMemProjNode(cas)); Node* proj = transform_later(new SCMemProjNode(cas));
fast_lock_mem_phi->init_req(2, proj); fast_lock_mem_phi->init_req(2, proj);
// Second, check epoch bits. // Second, check epoch bits.
Node* rebiased_region = new (C) RegionNode(3); Node* rebiased_region = new RegionNode(3);
Node* old_phi = new (C) PhiNode( rebiased_region, TypeX_X); Node* old_phi = new PhiNode( rebiased_region, TypeX_X);
Node* new_phi = new (C) PhiNode( rebiased_region, TypeX_X); Node* new_phi = new PhiNode( rebiased_region, TypeX_X);
// Get slow path - mark word does NOT match epoch bits. // Get slow path - mark word does NOT match epoch bits.
Node* epoch_ctrl = opt_bits_test(ctrl, rebiased_region, 1, x_node, Node* epoch_ctrl = opt_bits_test(ctrl, rebiased_region, 1, x_node,
@ -2258,9 +2258,9 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
Node* cmask = MakeConX(markOopDesc::biased_lock_mask_in_place | Node* cmask = MakeConX(markOopDesc::biased_lock_mask_in_place |
markOopDesc::age_mask_in_place | markOopDesc::age_mask_in_place |
markOopDesc::epoch_mask_in_place); markOopDesc::epoch_mask_in_place);
Node* old = transform_later(new (C) AndXNode(mark_node, cmask)); Node* old = transform_later(new AndXNode(mark_node, cmask));
cast_thread = transform_later(new (C) CastP2XNode(ctrl, thread)); cast_thread = transform_later(new CastP2XNode(ctrl, thread));
Node* new_mark = transform_later(new (C) OrXNode(cast_thread, old)); Node* new_mark = transform_later(new OrXNode(cast_thread, old));
old_phi->init_req(1, old); old_phi->init_req(1, old);
new_phi->init_req(1, new_mark); new_phi->init_req(1, new_mark);
@ -2270,10 +2270,9 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
// Try to acquire the bias of the object using an atomic operation. // Try to acquire the bias of the object using an atomic operation.
// If this fails we will go in to the runtime to revoke the object's bias. // If this fails we will go in to the runtime to revoke the object's bias.
cas = new (C) StoreXConditionalNode(rebiased_region, mem, adr, cas = new StoreXConditionalNode(rebiased_region, mem, adr, new_phi, old_phi);
new_phi, old_phi);
transform_later(cas); transform_later(cas);
proj = transform_later( new (C) SCMemProjNode(cas)); proj = transform_later(new SCMemProjNode(cas));
// Get slow path - Failed to CAS. // Get slow path - Failed to CAS.
not_biased_ctrl = opt_bits_test(rebiased_region, region, 4, cas, 0, 0); not_biased_ctrl = opt_bits_test(rebiased_region, region, 4, cas, 0, 0);
@ -2281,8 +2280,8 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
// region->in(4) is set to fast path - the object is rebiased to the current thread. // region->in(4) is set to fast path - the object is rebiased to the current thread.
// Failed to CAS. // Failed to CAS.
slow_path = new (C) RegionNode(3); slow_path = new RegionNode(3);
Node *slow_mem = new (C) PhiNode( slow_path, Type::MEMORY, TypeRawPtr::BOTTOM); Node *slow_mem = new PhiNode( slow_path, Type::MEMORY, TypeRawPtr::BOTTOM);
slow_path->init_req(1, not_biased_ctrl); // Capture slow-control slow_path->init_req(1, not_biased_ctrl); // Capture slow-control
slow_mem->init_req(1, proj); slow_mem->init_req(1, proj);
@ -2306,9 +2305,9 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
lock->set_req(TypeFunc::Memory, slow_mem); lock->set_req(TypeFunc::Memory, slow_mem);
} else { } else {
region = new (C) RegionNode(3); region = new RegionNode(3);
// create a Phi for the memory state // create a Phi for the memory state
mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
// Optimize test; set region slot 2 // Optimize test; set region slot 2
slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0); slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0);
@ -2339,7 +2338,7 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
transform_later(region); transform_later(region);
_igvn.replace_node(_fallthroughproj, region); _igvn.replace_node(_fallthroughproj, region);
Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) ); Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory));
mem_phi->init_req(1, memproj ); mem_phi->init_req(1, memproj );
transform_later(mem_phi); transform_later(mem_phi);
_igvn.replace_node(_memproj_fallthrough, mem_phi); _igvn.replace_node(_memproj_fallthrough, mem_phi);
@ -2364,9 +2363,9 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
if (UseOptoBiasInlining) { if (UseOptoBiasInlining) {
// Check for biased locking unlock case, which is a no-op. // Check for biased locking unlock case, which is a no-op.
// See the full description in MacroAssembler::biased_locking_exit(). // See the full description in MacroAssembler::biased_locking_exit().
region = new (C) RegionNode(4); region = new RegionNode(4);
// create a Phi for the memory state // create a Phi for the memory state
mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
mem_phi->init_req(3, mem); mem_phi->init_req(3, mem);
Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type());
@ -2374,12 +2373,12 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
markOopDesc::biased_lock_mask_in_place, markOopDesc::biased_lock_mask_in_place,
markOopDesc::biased_lock_pattern); markOopDesc::biased_lock_pattern);
} else { } else {
region = new (C) RegionNode(3); region = new RegionNode(3);
// create a Phi for the memory state // create a Phi for the memory state
mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
} }
FastUnlockNode *funlock = new (C) FastUnlockNode( ctrl, obj, box ); FastUnlockNode *funlock = new FastUnlockNode( ctrl, obj, box );
funlock = transform_later( funlock )->as_FastUnlock(); funlock = transform_later( funlock )->as_FastUnlock();
// Optimize test; set region slot 2 // Optimize test; set region slot 2
Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0); Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0);
@ -2404,7 +2403,7 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
transform_later(region); transform_later(region);
_igvn.replace_node(_fallthroughproj, region); _igvn.replace_node(_fallthroughproj, region);
Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) ); Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory) );
mem_phi->init_req(1, memproj ); mem_phi->init_req(1, memproj );
mem_phi->init_req(2, mem); mem_phi->init_req(2, mem);
transform_later(mem_phi); transform_later(mem_phi);

View File

@ -52,7 +52,7 @@ private:
return basic_plus_adr(base, base, offset); return basic_plus_adr(base, base, offset);
} }
Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) { Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) {
Node* adr = new (C) AddPNode(base, ptr, offset); Node* adr = new AddPNode(base, ptr, offset);
return transform_later(adr); return transform_later(adr);
} }
Node* transform_later(Node* n) { Node* transform_later(Node* n) {

View File

@ -751,7 +751,7 @@ void Matcher::Fixup_Save_On_Entry( ) {
tail_call_rms[tail_call_edge_cnt].Insert(OptoReg::Name(i+1)); tail_call_rms[tail_call_edge_cnt].Insert(OptoReg::Name(i+1));
tail_jump_rms[tail_jump_edge_cnt].Insert(OptoReg::Name(i+1)); tail_jump_rms[tail_jump_edge_cnt].Insert(OptoReg::Name(i+1));
halt_rms [ halt_edge_cnt].Insert(OptoReg::Name(i+1)); halt_rms [ halt_edge_cnt].Insert(OptoReg::Name(i+1));
mproj = new (C) MachProjNode( start, proj_cnt, ret_rms[ret_edge_cnt], Op_RegD ); mproj = new MachProjNode( start, proj_cnt, ret_rms[ret_edge_cnt], Op_RegD );
proj_cnt += 2; // Skip 2 for doubles proj_cnt += 2; // Skip 2 for doubles
} }
else if( (i&1) == 1 && // Else check for high half of double else if( (i&1) == 1 && // Else check for high half of double
@ -777,7 +777,7 @@ void Matcher::Fixup_Save_On_Entry( ) {
tail_call_rms[tail_call_edge_cnt].Insert(OptoReg::Name(i+1)); tail_call_rms[tail_call_edge_cnt].Insert(OptoReg::Name(i+1));
tail_jump_rms[tail_jump_edge_cnt].Insert(OptoReg::Name(i+1)); tail_jump_rms[tail_jump_edge_cnt].Insert(OptoReg::Name(i+1));
halt_rms [ halt_edge_cnt].Insert(OptoReg::Name(i+1)); halt_rms [ halt_edge_cnt].Insert(OptoReg::Name(i+1));
mproj = new (C) MachProjNode( start, proj_cnt, ret_rms[ret_edge_cnt], Op_RegL ); mproj = new MachProjNode( start, proj_cnt, ret_rms[ret_edge_cnt], Op_RegL );
proj_cnt += 2; // Skip 2 for longs proj_cnt += 2; // Skip 2 for longs
} }
else if( (i&1) == 1 && // Else check for high half of long else if( (i&1) == 1 && // Else check for high half of long
@ -792,7 +792,7 @@ void Matcher::Fixup_Save_On_Entry( ) {
mproj = C->top(); mproj = C->top();
} else { } else {
// Make a projection for it off the Start // Make a projection for it off the Start
mproj = new (C) MachProjNode( start, proj_cnt++, ret_rms[ret_edge_cnt], _register_save_type[i] ); mproj = new MachProjNode( start, proj_cnt++, ret_rms[ret_edge_cnt], _register_save_type[i] );
} }
ret_edge_cnt ++; ret_edge_cnt ++;
@ -845,13 +845,13 @@ void Matcher::init_spill_mask( Node *ret ) {
// Compute generic short-offset Loads // Compute generic short-offset Loads
#ifdef _LP64 #ifdef _LP64
MachNode *spillCP = match_tree(new (C) LoadNNode(NULL,mem,fp,atp,TypeInstPtr::BOTTOM,MemNode::unordered)); MachNode *spillCP = match_tree(new LoadNNode(NULL,mem,fp,atp,TypeInstPtr::BOTTOM,MemNode::unordered));
#endif #endif
MachNode *spillI = match_tree(new (C) LoadINode(NULL,mem,fp,atp,TypeInt::INT,MemNode::unordered)); MachNode *spillI = match_tree(new LoadINode(NULL,mem,fp,atp,TypeInt::INT,MemNode::unordered));
MachNode *spillL = match_tree(new (C) LoadLNode(NULL,mem,fp,atp,TypeLong::LONG,MemNode::unordered,false)); MachNode *spillL = match_tree(new LoadLNode(NULL,mem,fp,atp,TypeLong::LONG,MemNode::unordered,false));
MachNode *spillF = match_tree(new (C) LoadFNode(NULL,mem,fp,atp,Type::FLOAT,MemNode::unordered)); MachNode *spillF = match_tree(new LoadFNode(NULL,mem,fp,atp,Type::FLOAT,MemNode::unordered));
MachNode *spillD = match_tree(new (C) LoadDNode(NULL,mem,fp,atp,Type::DOUBLE,MemNode::unordered)); MachNode *spillD = match_tree(new LoadDNode(NULL,mem,fp,atp,Type::DOUBLE,MemNode::unordered));
MachNode *spillP = match_tree(new (C) LoadPNode(NULL,mem,fp,atp,TypeInstPtr::BOTTOM,MemNode::unordered)); MachNode *spillP = match_tree(new LoadPNode(NULL,mem,fp,atp,TypeInstPtr::BOTTOM,MemNode::unordered));
assert(spillI != NULL && spillL != NULL && spillF != NULL && assert(spillI != NULL && spillL != NULL && spillF != NULL &&
spillD != NULL && spillP != NULL, ""); spillD != NULL && spillP != NULL, "");
// Get the ADLC notion of the right regmask, for each basic type. // Get the ADLC notion of the right regmask, for each basic type.
@ -867,19 +867,19 @@ void Matcher::init_spill_mask( Node *ret ) {
// Vector regmasks. // Vector regmasks.
if (Matcher::vector_size_supported(T_BYTE,4)) { if (Matcher::vector_size_supported(T_BYTE,4)) {
TypeVect::VECTS = TypeVect::make(T_BYTE, 4); TypeVect::VECTS = TypeVect::make(T_BYTE, 4);
MachNode *spillVectS = match_tree(new (C) LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTS)); MachNode *spillVectS = match_tree(new LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTS));
idealreg2regmask[Op_VecS] = &spillVectS->out_RegMask(); idealreg2regmask[Op_VecS] = &spillVectS->out_RegMask();
} }
if (Matcher::vector_size_supported(T_FLOAT,2)) { if (Matcher::vector_size_supported(T_FLOAT,2)) {
MachNode *spillVectD = match_tree(new (C) LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTD)); MachNode *spillVectD = match_tree(new LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTD));
idealreg2regmask[Op_VecD] = &spillVectD->out_RegMask(); idealreg2regmask[Op_VecD] = &spillVectD->out_RegMask();
} }
if (Matcher::vector_size_supported(T_FLOAT,4)) { if (Matcher::vector_size_supported(T_FLOAT,4)) {
MachNode *spillVectX = match_tree(new (C) LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTX)); MachNode *spillVectX = match_tree(new LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTX));
idealreg2regmask[Op_VecX] = &spillVectX->out_RegMask(); idealreg2regmask[Op_VecX] = &spillVectX->out_RegMask();
} }
if (Matcher::vector_size_supported(T_FLOAT,8)) { if (Matcher::vector_size_supported(T_FLOAT,8)) {
MachNode *spillVectY = match_tree(new (C) LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTY)); MachNode *spillVectY = match_tree(new LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTY));
idealreg2regmask[Op_VecY] = &spillVectY->out_RegMask(); idealreg2regmask[Op_VecY] = &spillVectY->out_RegMask();
} }
} }
@ -1319,7 +1319,7 @@ MachNode *Matcher::match_sfpt( SafePointNode *sfpt ) {
// is excluded on the max-per-method basis, debug info cannot land in // is excluded on the max-per-method basis, debug info cannot land in
// this killed area. // this killed area.
uint r_cnt = mcall->tf()->range()->cnt(); uint r_cnt = mcall->tf()->range()->cnt();
MachProjNode *proj = new (C) MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj ); MachProjNode *proj = new MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj );
if (!RegMask::can_represent_arg(OptoReg::Name(out_arg_limit_per_call-1))) { if (!RegMask::can_represent_arg(OptoReg::Name(out_arg_limit_per_call-1))) {
C->record_method_not_compilable_all_tiers("unsupported outgoing calling sequence"); C->record_method_not_compilable_all_tiers("unsupported outgoing calling sequence");
} else { } else {
@ -2274,7 +2274,7 @@ void Matcher::find_shared( Node *n ) {
case Op_CompareAndSwapN: { // Convert trinary to binary-tree case Op_CompareAndSwapN: { // Convert trinary to binary-tree
Node *newval = n->in(MemNode::ValueIn ); Node *newval = n->in(MemNode::ValueIn );
Node *oldval = n->in(LoadStoreConditionalNode::ExpectedIn); Node *oldval = n->in(LoadStoreConditionalNode::ExpectedIn);
Node *pair = new (C) BinaryNode( oldval, newval ); Node *pair = new BinaryNode( oldval, newval );
n->set_req(MemNode::ValueIn,pair); n->set_req(MemNode::ValueIn,pair);
n->del_req(LoadStoreConditionalNode::ExpectedIn); n->del_req(LoadStoreConditionalNode::ExpectedIn);
break; break;
@ -2289,22 +2289,22 @@ void Matcher::find_shared( Node *n ) {
// we could move this code up next to the graph reshaping for IfNodes // we could move this code up next to the graph reshaping for IfNodes
// or vice-versa, but I do not want to debug this for Ladybird. // or vice-versa, but I do not want to debug this for Ladybird.
// 10/2/2000 CNC. // 10/2/2000 CNC.
Node *pair1 = new (C) BinaryNode(n->in(1),n->in(1)->in(1)); Node *pair1 = new BinaryNode(n->in(1),n->in(1)->in(1));
n->set_req(1,pair1); n->set_req(1,pair1);
Node *pair2 = new (C) BinaryNode(n->in(2),n->in(3)); Node *pair2 = new BinaryNode(n->in(2),n->in(3));
n->set_req(2,pair2); n->set_req(2,pair2);
n->del_req(3); n->del_req(3);
break; break;
} }
case Op_LoopLimit: { case Op_LoopLimit: {
Node *pair1 = new (C) BinaryNode(n->in(1),n->in(2)); Node *pair1 = new BinaryNode(n->in(1),n->in(2));
n->set_req(1,pair1); n->set_req(1,pair1);
n->set_req(2,n->in(3)); n->set_req(2,n->in(3));
n->del_req(3); n->del_req(3);
break; break;
} }
case Op_StrEquals: { case Op_StrEquals: {
Node *pair1 = new (C) BinaryNode(n->in(2),n->in(3)); Node *pair1 = new BinaryNode(n->in(2),n->in(3));
n->set_req(2,pair1); n->set_req(2,pair1);
n->set_req(3,n->in(4)); n->set_req(3,n->in(4));
n->del_req(4); n->del_req(4);
@ -2312,9 +2312,9 @@ void Matcher::find_shared( Node *n ) {
} }
case Op_StrComp: case Op_StrComp:
case Op_StrIndexOf: { case Op_StrIndexOf: {
Node *pair1 = new (C) BinaryNode(n->in(2),n->in(3)); Node *pair1 = new BinaryNode(n->in(2),n->in(3));
n->set_req(2,pair1); n->set_req(2,pair1);
Node *pair2 = new (C) BinaryNode(n->in(4),n->in(5)); Node *pair2 = new BinaryNode(n->in(4),n->in(5));
n->set_req(3,pair2); n->set_req(3,pair2);
n->del_req(5); n->del_req(5);
n->del_req(4); n->del_req(4);
@ -2322,7 +2322,7 @@ void Matcher::find_shared( Node *n ) {
} }
case Op_EncodeISOArray: { case Op_EncodeISOArray: {
// Restructure into a binary tree for Matching. // Restructure into a binary tree for Matching.
Node* pair = new (C) BinaryNode(n->in(3), n->in(4)); Node* pair = new BinaryNode(n->in(3), n->in(4));
n->set_req(3, pair); n->set_req(3, pair);
n->del_req(4); n->del_req(4);
break; break;

View File

@ -908,25 +908,25 @@ Node *LoadNode::make(PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const TypeP
rt->isa_oopptr() || is_immutable_value(adr), rt->isa_oopptr() || is_immutable_value(adr),
"raw memory operations should have control edge"); "raw memory operations should have control edge");
switch (bt) { switch (bt) {
case T_BOOLEAN: return new (C) LoadUBNode(ctl, mem, adr, adr_type, rt->is_int(), mo); case T_BOOLEAN: return new LoadUBNode(ctl, mem, adr, adr_type, rt->is_int(), mo);
case T_BYTE: return new (C) LoadBNode (ctl, mem, adr, adr_type, rt->is_int(), mo); case T_BYTE: return new LoadBNode (ctl, mem, adr, adr_type, rt->is_int(), mo);
case T_INT: return new (C) LoadINode (ctl, mem, adr, adr_type, rt->is_int(), mo); case T_INT: return new LoadINode (ctl, mem, adr, adr_type, rt->is_int(), mo);
case T_CHAR: return new (C) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int(), mo); case T_CHAR: return new LoadUSNode(ctl, mem, adr, adr_type, rt->is_int(), mo);
case T_SHORT: return new (C) LoadSNode (ctl, mem, adr, adr_type, rt->is_int(), mo); case T_SHORT: return new LoadSNode (ctl, mem, adr, adr_type, rt->is_int(), mo);
case T_LONG: return new (C) LoadLNode (ctl, mem, adr, adr_type, rt->is_long(), mo); case T_LONG: return new LoadLNode (ctl, mem, adr, adr_type, rt->is_long(), mo);
case T_FLOAT: return new (C) LoadFNode (ctl, mem, adr, adr_type, rt, mo); case T_FLOAT: return new LoadFNode (ctl, mem, adr, adr_type, rt, mo);
case T_DOUBLE: return new (C) LoadDNode (ctl, mem, adr, adr_type, rt, mo); case T_DOUBLE: return new LoadDNode (ctl, mem, adr, adr_type, rt, mo);
case T_ADDRESS: return new (C) LoadPNode (ctl, mem, adr, adr_type, rt->is_ptr(), mo); case T_ADDRESS: return new LoadPNode (ctl, mem, adr, adr_type, rt->is_ptr(), mo);
case T_OBJECT: case T_OBJECT:
#ifdef _LP64 #ifdef _LP64
if (adr->bottom_type()->is_ptr_to_narrowoop()) { if (adr->bottom_type()->is_ptr_to_narrowoop()) {
Node* load = gvn.transform(new (C) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop(), mo)); Node* load = gvn.transform(new LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop(), mo));
return new (C) DecodeNNode(load, load->bottom_type()->make_ptr()); return new DecodeNNode(load, load->bottom_type()->make_ptr());
} else } else
#endif #endif
{ {
assert(!adr->bottom_type()->is_ptr_to_narrowoop() && !adr->bottom_type()->is_ptr_to_narrowklass(), "should have got back a narrow oop"); assert(!adr->bottom_type()->is_ptr_to_narrowoop() && !adr->bottom_type()->is_ptr_to_narrowklass(), "should have got back a narrow oop");
return new (C) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr(), mo); return new LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr(), mo);
} }
} }
ShouldNotReachHere(); ShouldNotReachHere();
@ -935,12 +935,12 @@ Node *LoadNode::make(PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const TypeP
LoadLNode* LoadLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt, MemOrd mo) { LoadLNode* LoadLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt, MemOrd mo) {
bool require_atomic = true; bool require_atomic = true;
return new (C) LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), mo, require_atomic); return new LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), mo, require_atomic);
} }
LoadDNode* LoadDNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt, MemOrd mo) { LoadDNode* LoadDNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt, MemOrd mo) {
bool require_atomic = true; bool require_atomic = true;
return new (C) LoadDNode(ctl, mem, adr, adr_type, rt, mo, require_atomic); return new LoadDNode(ctl, mem, adr, adr_type, rt, mo, require_atomic);
} }
@ -1228,33 +1228,33 @@ Node* LoadNode::eliminate_autobox(PhaseGVN* phase) {
// Add up all the offsets making of the address of the load // Add up all the offsets making of the address of the load
Node* result = elements[0]; Node* result = elements[0];
for (int i = 1; i < count; i++) { for (int i = 1; i < count; i++) {
result = phase->transform(new (phase->C) AddXNode(result, elements[i])); result = phase->transform(new AddXNode(result, elements[i]));
} }
// Remove the constant offset from the address and then // Remove the constant offset from the address and then
result = phase->transform(new (phase->C) AddXNode(result, phase->MakeConX(-(int)offset))); result = phase->transform(new AddXNode(result, phase->MakeConX(-(int)offset)));
// remove the scaling of the offset to recover the original index. // remove the scaling of the offset to recover the original index.
if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) { if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) {
// Peel the shift off directly but wrap it in a dummy node // Peel the shift off directly but wrap it in a dummy node
// since Ideal can't return existing nodes // since Ideal can't return existing nodes
result = new (phase->C) RShiftXNode(result->in(1), phase->intcon(0)); result = new RShiftXNode(result->in(1), phase->intcon(0));
} else if (result->is_Add() && result->in(2)->is_Con() && } else if (result->is_Add() && result->in(2)->is_Con() &&
result->in(1)->Opcode() == Op_LShiftX && result->in(1)->Opcode() == Op_LShiftX &&
result->in(1)->in(2) == phase->intcon(shift)) { result->in(1)->in(2) == phase->intcon(shift)) {
// We can't do general optimization: ((X<<Z) + Y) >> Z ==> X + (Y>>Z) // 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 // 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. // (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)); Node* add_con = new RShiftXNode(result->in(2), phase->intcon(shift));
result = new (phase->C) AddXNode(result->in(1)->in(1), phase->transform(add_con)); result = new AddXNode(result->in(1)->in(1), phase->transform(add_con));
} else { } else {
result = new (phase->C) RShiftXNode(result, phase->intcon(shift)); result = new RShiftXNode(result, phase->intcon(shift));
} }
#ifdef _LP64 #ifdef _LP64
if (bt != T_LONG) { if (bt != T_LONG) {
result = new (phase->C) ConvL2INode(phase->transform(result)); result = new ConvL2INode(phase->transform(result));
} }
#else #else
if (bt == T_LONG) { if (bt == T_LONG) {
result = new (phase->C) ConvI2LNode(phase->transform(result)); result = new ConvI2LNode(phase->transform(result));
} }
#endif #endif
return result; return result;
@ -1385,7 +1385,7 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) {
this_iid = base->_idx; this_iid = base->_idx;
} }
PhaseIterGVN* igvn = phase->is_IterGVN(); PhaseIterGVN* igvn = phase->is_IterGVN();
Node* phi = new (C) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset); Node* phi = new 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;
@ -1408,7 +1408,7 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) {
} }
if (base_is_phi && (base->in(0) == region)) { if (base_is_phi && (base->in(0) == region)) {
Node* base_x = base->in(i); // Clone address for loads from boxed objects. 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))); Node* adr_x = phase->transform(new AddPNode(base_x,base_x,address->in(AddPNode::Offset)));
x->set_req(Address, adr_x); x->set_req(Address, adr_x);
} }
} }
@ -1897,8 +1897,8 @@ Node *LoadBNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* mem = in(MemNode::Memory); Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase); Node* value = can_see_stored_value(mem,phase);
if( value && !phase->type(value)->higher_equal( _type ) ) { if( value && !phase->type(value)->higher_equal( _type ) ) {
Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(24)) ); Node *result = phase->transform( new LShiftINode(value, phase->intcon(24)) );
return new (phase->C) RShiftINode(result, phase->intcon(24)); return new RShiftINode(result, phase->intcon(24));
} }
// Identity call will handle the case where truncation is not needed. // Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape); return LoadNode::Ideal(phase, can_reshape);
@ -1929,7 +1929,7 @@ Node* LoadUBNode::Ideal(PhaseGVN* phase, bool can_reshape) {
Node* mem = in(MemNode::Memory); Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem, phase); Node* value = can_see_stored_value(mem, phase);
if (value && !phase->type(value)->higher_equal(_type)) if (value && !phase->type(value)->higher_equal(_type))
return new (phase->C) AndINode(value, phase->intcon(0xFF)); return new AndINode(value, phase->intcon(0xFF));
// Identity call will handle the case where truncation is not needed. // Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape); return LoadNode::Ideal(phase, can_reshape);
} }
@ -1959,7 +1959,7 @@ Node *LoadUSNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* mem = in(MemNode::Memory); Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase); Node* value = can_see_stored_value(mem,phase);
if( value && !phase->type(value)->higher_equal( _type ) ) if( value && !phase->type(value)->higher_equal( _type ) )
return new (phase->C) AndINode(value,phase->intcon(0xFFFF)); return new AndINode(value,phase->intcon(0xFFFF));
// Identity call will handle the case where truncation is not needed. // Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape); return LoadNode::Ideal(phase, can_reshape);
} }
@ -1989,8 +1989,8 @@ Node *LoadSNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* mem = in(MemNode::Memory); Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase); Node* value = can_see_stored_value(mem,phase);
if( value && !phase->type(value)->higher_equal( _type ) ) { if( value && !phase->type(value)->higher_equal( _type ) ) {
Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(16)) ); Node *result = phase->transform( new LShiftINode(value, phase->intcon(16)) );
return new (phase->C) RShiftINode(result, phase->intcon(16)); return new RShiftINode(result, phase->intcon(16));
} }
// Identity call will handle the case where truncation is not needed. // Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape); return LoadNode::Ideal(phase, can_reshape);
@ -2022,12 +2022,12 @@ Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* a
#ifdef _LP64 #ifdef _LP64
if (adr_type->is_ptr_to_narrowklass()) { if (adr_type->is_ptr_to_narrowklass()) {
assert(UseCompressedClassPointers, "no compressed klasses"); assert(UseCompressedClassPointers, "no compressed klasses");
Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowklass(), MemNode::unordered)); Node* load_klass = gvn.transform(new LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowklass(), MemNode::unordered));
return new (C) DecodeNKlassNode(load_klass, load_klass->bottom_type()->make_ptr()); return new DecodeNKlassNode(load_klass, load_klass->bottom_type()->make_ptr());
} }
#endif #endif
assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop"); assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
return new (C) LoadKlassNode(ctl, mem, adr, at, tk, MemNode::unordered); return new LoadKlassNode(ctl, mem, adr, at, tk, MemNode::unordered);
} }
//------------------------------Value------------------------------------------ //------------------------------Value------------------------------------------
@ -2255,7 +2255,7 @@ Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
if( t->isa_narrowklass()) return x; if( t->isa_narrowklass()) return x;
assert (!t->isa_narrowoop(), "no narrow oop here"); assert (!t->isa_narrowoop(), "no narrow oop here");
return phase->transform(new (phase->C) EncodePKlassNode(x, t->make_narrowklass())); return phase->transform(new EncodePKlassNode(x, t->make_narrowklass()));
} }
//------------------------------Value----------------------------------------- //------------------------------Value-----------------------------------------
@ -2350,29 +2350,29 @@ StoreNode* StoreNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const
switch (bt) { switch (bt) {
case T_BOOLEAN: case T_BOOLEAN:
case T_BYTE: return new (C) StoreBNode(ctl, mem, adr, adr_type, val, mo); case T_BYTE: return new StoreBNode(ctl, mem, adr, adr_type, val, mo);
case T_INT: return new (C) StoreINode(ctl, mem, adr, adr_type, val, mo); case T_INT: return new StoreINode(ctl, mem, adr, adr_type, val, mo);
case T_CHAR: case T_CHAR:
case T_SHORT: return new (C) StoreCNode(ctl, mem, adr, adr_type, val, mo); case T_SHORT: return new StoreCNode(ctl, mem, adr, adr_type, val, mo);
case T_LONG: return new (C) StoreLNode(ctl, mem, adr, adr_type, val, mo); case T_LONG: return new StoreLNode(ctl, mem, adr, adr_type, val, mo);
case T_FLOAT: return new (C) StoreFNode(ctl, mem, adr, adr_type, val, mo); case T_FLOAT: return new StoreFNode(ctl, mem, adr, adr_type, val, mo);
case T_DOUBLE: return new (C) StoreDNode(ctl, mem, adr, adr_type, val, mo); case T_DOUBLE: return new StoreDNode(ctl, mem, adr, adr_type, val, mo);
case T_METADATA: case T_METADATA:
case T_ADDRESS: case T_ADDRESS:
case T_OBJECT: case T_OBJECT:
#ifdef _LP64 #ifdef _LP64
if (adr->bottom_type()->is_ptr_to_narrowoop()) { if (adr->bottom_type()->is_ptr_to_narrowoop()) {
val = gvn.transform(new (C) EncodePNode(val, val->bottom_type()->make_narrowoop())); val = gvn.transform(new EncodePNode(val, val->bottom_type()->make_narrowoop()));
return new (C) StoreNNode(ctl, mem, adr, adr_type, val, mo); return new StoreNNode(ctl, mem, adr, adr_type, val, mo);
} else if (adr->bottom_type()->is_ptr_to_narrowklass() || } else if (adr->bottom_type()->is_ptr_to_narrowklass() ||
(UseCompressedClassPointers && val->bottom_type()->isa_klassptr() && (UseCompressedClassPointers && val->bottom_type()->isa_klassptr() &&
adr->bottom_type()->isa_rawptr())) { adr->bottom_type()->isa_rawptr())) {
val = gvn.transform(new (C) EncodePKlassNode(val, val->bottom_type()->make_narrowklass())); val = gvn.transform(new EncodePKlassNode(val, val->bottom_type()->make_narrowklass()));
return new (C) StoreNKlassNode(ctl, mem, adr, adr_type, val, mo); return new StoreNKlassNode(ctl, mem, adr, adr_type, val, mo);
} }
#endif #endif
{ {
return new (C) StorePNode(ctl, mem, adr, adr_type, val, mo); return new StorePNode(ctl, mem, adr, adr_type, val, mo);
} }
} }
ShouldNotReachHere(); ShouldNotReachHere();
@ -2381,12 +2381,12 @@ StoreNode* StoreNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const
StoreLNode* StoreLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo) { StoreLNode* StoreLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo) {
bool require_atomic = true; bool require_atomic = true;
return new (C) StoreLNode(ctl, mem, adr, adr_type, val, mo, require_atomic); return new StoreLNode(ctl, mem, adr, adr_type, val, mo, require_atomic);
} }
StoreDNode* StoreDNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo) { StoreDNode* StoreDNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo) {
bool require_atomic = true; bool require_atomic = true;
return new (C) StoreDNode(ctl, mem, adr, adr_type, val, mo, require_atomic); return new StoreDNode(ctl, mem, adr, adr_type, val, mo, require_atomic);
} }
@ -2779,12 +2779,12 @@ Node *ClearArrayNode::Ideal(PhaseGVN *phase, bool can_reshape){
Node *zero = phase->makecon(TypeLong::ZERO); Node *zero = phase->makecon(TypeLong::ZERO);
Node *off = phase->MakeConX(BytesPerLong); Node *off = phase->MakeConX(BytesPerLong);
mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero,MemNode::unordered,false); mem = new StoreLNode(in(0),mem,adr,atp,zero,MemNode::unordered,false);
count--; count--;
while( count-- ) { while( count-- ) {
mem = phase->transform(mem); mem = phase->transform(mem);
adr = phase->transform(new (phase->C) AddPNode(base,adr,off)); adr = phase->transform(new AddPNode(base,adr,off));
mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero,MemNode::unordered,false); mem = new StoreLNode(in(0),mem,adr,atp,zero,MemNode::unordered,false);
} }
return mem; return mem;
} }
@ -2825,7 +2825,7 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest,
int unit = BytesPerLong; int unit = BytesPerLong;
if ((offset % unit) != 0) { if ((offset % unit) != 0) {
Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(offset)); Node* adr = new AddPNode(dest, dest, phase->MakeConX(offset));
adr = phase->transform(adr); adr = phase->transform(adr);
const TypePtr* atp = TypeRawPtr::BOTTOM; const TypePtr* atp = TypeRawPtr::BOTTOM;
mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT, MemNode::unordered); mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT, MemNode::unordered);
@ -2855,14 +2855,14 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest,
// Scale to the unit required by the CPU: // Scale to the unit required by the CPU:
if (!Matcher::init_array_count_is_in_bytes) { if (!Matcher::init_array_count_is_in_bytes) {
Node* shift = phase->intcon(exact_log2(unit)); Node* shift = phase->intcon(exact_log2(unit));
zbase = phase->transform( new(C) URShiftXNode(zbase, shift) ); zbase = phase->transform(new URShiftXNode(zbase, shift) );
zend = phase->transform( new(C) URShiftXNode(zend, shift) ); zend = phase->transform(new URShiftXNode(zend, shift) );
} }
// Bulk clear double-words // Bulk clear double-words
Node* zsize = phase->transform( new(C) SubXNode(zend, zbase) ); Node* zsize = phase->transform(new SubXNode(zend, zbase) );
Node* adr = phase->transform( new(C) AddPNode(dest, dest, start_offset) ); Node* adr = phase->transform(new AddPNode(dest, dest, start_offset) );
mem = new (C) ClearArrayNode(ctl, mem, zsize, adr); mem = new ClearArrayNode(ctl, mem, zsize, adr);
return phase->transform(mem); return phase->transform(mem);
} }
@ -2886,7 +2886,7 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest,
start_offset, phase->MakeConX(done_offset), phase); start_offset, phase->MakeConX(done_offset), phase);
} }
if (done_offset < end_offset) { // emit the final 32-bit store if (done_offset < end_offset) { // emit the final 32-bit store
Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(done_offset)); Node* adr = new AddPNode(dest, dest, phase->MakeConX(done_offset));
adr = phase->transform(adr); adr = phase->transform(adr);
const TypePtr* atp = TypeRawPtr::BOTTOM; const TypePtr* atp = TypeRawPtr::BOTTOM;
mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT, MemNode::unordered); mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT, MemNode::unordered);
@ -2920,16 +2920,16 @@ uint MemBarNode::cmp( const Node &n ) const {
//------------------------------make------------------------------------------- //------------------------------make-------------------------------------------
MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) { MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) {
switch (opcode) { switch (opcode) {
case Op_MemBarAcquire: return new(C) MemBarAcquireNode(C, atp, pn); case Op_MemBarAcquire: return new MemBarAcquireNode(C, atp, pn);
case Op_LoadFence: return new(C) LoadFenceNode(C, atp, pn); case Op_LoadFence: return new LoadFenceNode(C, atp, pn);
case Op_MemBarRelease: return new(C) MemBarReleaseNode(C, atp, pn); case Op_MemBarRelease: return new MemBarReleaseNode(C, atp, pn);
case Op_StoreFence: return new(C) StoreFenceNode(C, atp, pn); case Op_StoreFence: return new StoreFenceNode(C, atp, pn);
case Op_MemBarAcquireLock: return new(C) MemBarAcquireLockNode(C, atp, pn); case Op_MemBarAcquireLock: return new MemBarAcquireLockNode(C, atp, pn);
case Op_MemBarReleaseLock: return new(C) MemBarReleaseLockNode(C, atp, pn); case Op_MemBarReleaseLock: return new MemBarReleaseLockNode(C, atp, pn);
case Op_MemBarVolatile: return new(C) MemBarVolatileNode(C, atp, pn); case Op_MemBarVolatile: return new MemBarVolatileNode(C, atp, pn);
case Op_MemBarCPUOrder: return new(C) MemBarCPUOrderNode(C, atp, pn); case Op_MemBarCPUOrder: return new MemBarCPUOrderNode(C, atp, pn);
case Op_Initialize: return new(C) InitializeNode(C, atp, pn); case Op_Initialize: return new InitializeNode(C, atp, pn);
case Op_MemBarStoreStore: return new(C) MemBarStoreStoreNode(C, atp, pn); case Op_MemBarStoreStore: return new MemBarStoreStoreNode(C, atp, pn);
default: ShouldNotReachHere(); return NULL; default: ShouldNotReachHere(); return NULL;
} }
} }
@ -2992,7 +2992,7 @@ Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) {
igvn->replace_node(proj_out(TypeFunc::Control), in(TypeFunc::Control)); igvn->replace_node(proj_out(TypeFunc::Control), in(TypeFunc::Control));
// Must return either the original node (now dead) or a new node // 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.) // (Do not return a top here, since that would break the uniqueness of top.)
return new (phase->C) ConINode(TypeInt::ZERO); return new ConINode(TypeInt::ZERO);
} }
} }
return NULL; return NULL;
@ -3012,7 +3012,7 @@ Node *MemBarNode::match( const ProjNode *proj, const Matcher *m ) {
switch (proj->_con) { switch (proj->_con) {
case TypeFunc::Control: case TypeFunc::Control:
case TypeFunc::Memory: case TypeFunc::Memory:
return new (m->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); return new MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
} }
ShouldNotReachHere(); ShouldNotReachHere();
return NULL; return NULL;
@ -3438,7 +3438,7 @@ Node* InitializeNode::make_raw_address(intptr_t offset,
Node* addr = in(RawAddress); Node* addr = in(RawAddress);
if (offset != 0) { if (offset != 0) {
Compile* C = phase->C; Compile* C = phase->C;
addr = phase->transform( new (C) AddPNode(C->top(), addr, addr = phase->transform( new AddPNode(C->top(), addr,
phase->MakeConX(offset)) ); phase->MakeConX(offset)) );
} }
return addr; return addr;
@ -4127,7 +4127,7 @@ MergeMemNode::MergeMemNode(Node *new_base) : Node(1+Compile::AliasIdxRaw) {
// Make a new, untransformed MergeMem with the same base as 'mem'. // Make a new, untransformed MergeMem with the same base as 'mem'.
// If mem is itself a MergeMem, populate the result with the same edges. // If mem is itself a MergeMem, populate the result with the same edges.
MergeMemNode* MergeMemNode::make(Compile* C, Node* mem) { MergeMemNode* MergeMemNode::make(Compile* C, Node* mem) {
return new(C) MergeMemNode(mem); return new MergeMemNode(mem);
} }
//------------------------------cmp-------------------------------------------- //------------------------------cmp--------------------------------------------

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