提交 3fecd1b0 编写于 作者: N never

6890308: integrate zero assembler hotspot changes

Reviewed-by: never
Contributed-by: gbenson@redhat.com
上级 32fea676
...@@ -84,6 +84,7 @@ endif ...@@ -84,6 +84,7 @@ endif
C1_VM_TARGETS=product1 fastdebug1 optimized1 jvmg1 C1_VM_TARGETS=product1 fastdebug1 optimized1 jvmg1
C2_VM_TARGETS=product fastdebug optimized jvmg C2_VM_TARGETS=product fastdebug optimized jvmg
KERNEL_VM_TARGETS=productkernel fastdebugkernel optimizedkernel jvmgkernel KERNEL_VM_TARGETS=productkernel fastdebugkernel optimizedkernel jvmgkernel
ZERO_VM_TARGETS=productzero fastdebugzero optimizedzero jvmgzero
# JDK directory list # JDK directory list
JDK_DIRS=bin include jre lib demo JDK_DIRS=bin include jre lib demo
...@@ -94,6 +95,12 @@ all_fastdebug: fastdebug fastdebug1 fastdebugkernel docs export_fastdebug ...@@ -94,6 +95,12 @@ all_fastdebug: fastdebug fastdebug1 fastdebugkernel docs export_fastdebug
all_debug: jvmg jvmg1 jvmgkernel docs export_debug all_debug: jvmg jvmg1 jvmgkernel docs export_debug
all_optimized: optimized optimized1 optimizedkernel docs export_optimized all_optimized: optimized optimized1 optimizedkernel docs export_optimized
allzero: all_productzero all_fastdebugzero
all_productzero: productzero docs export_product
all_fastdebugzero: fastdebugzero docs export_fastdebug
all_debugzero: jvmgzero docs export_debug
all_optimizedzero: optimizedzero docs export_optimized
# Do everything # Do everything
world: all create_jdk world: all create_jdk
...@@ -120,6 +127,10 @@ $(KERNEL_VM_TARGETS): ...@@ -120,6 +127,10 @@ $(KERNEL_VM_TARGETS):
$(CD) $(GAMMADIR)/make; \ $(CD) $(GAMMADIR)/make; \
$(MAKE) VM_TARGET=$@ generic_buildkernel $(ALT_OUT) $(MAKE) VM_TARGET=$@ generic_buildkernel $(ALT_OUT)
$(ZERO_VM_TARGETS):
$(CD) $(GAMMADIR)/make; \
$(MAKE) VM_TARGET=$@ generic_buildzero $(ALT_OUT)
# Build compiler1 (client) rule, different for platforms # Build compiler1 (client) rule, different for platforms
generic_build1: generic_build1:
$(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)
...@@ -180,6 +191,12 @@ else ...@@ -180,6 +191,12 @@ else
@$(ECHO) "No kernel ($(VM_TARGET)) for OS_NAME=$(OSNAME)" @$(ECHO) "No kernel ($(VM_TARGET)) for OS_NAME=$(OSNAME)"
endif endif
generic_buildzero:
$(MKDIR) -p $(OUTPUTDIR)
$(CD) $(OUTPUTDIR); \
$(MAKE) -f $(ABS_OS_MAKEFILE) \
$(MAKE_ARGS) $(VM_TARGET)
# Export file rule # Export file rule
generic_export: $(EXPORT_LIST) generic_export: $(EXPORT_LIST)
export_product: export_product:
...@@ -210,11 +227,17 @@ DOCS_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_docs ...@@ -210,11 +227,17 @@ DOCS_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_docs
C1_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler1 C1_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler1
C2_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2 C2_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2
KERNEL_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_kernel KERNEL_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_kernel
ZERO_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_zero
C1_DIR=$(C1_BASE_DIR)/$(VM_SUBDIR) C1_DIR=$(C1_BASE_DIR)/$(VM_SUBDIR)
C2_DIR=$(C2_BASE_DIR)/$(VM_SUBDIR) C2_DIR=$(C2_BASE_DIR)/$(VM_SUBDIR)
KERNEL_DIR=$(KERNEL_BASE_DIR)/$(VM_SUBDIR) KERNEL_DIR=$(KERNEL_BASE_DIR)/$(VM_SUBDIR)
ZERO_DIR=$(ZERO_BASE_DIR)/$(VM_SUBDIR)
# Misc files and generated files need to come from C1 or C2 area # Misc files and generated files need to come from C1 or C2 area
ifeq ($(ZERO_BUILD), true)
MISC_DIR=$(ZERO_DIR)
GEN_DIR=$(ZERO_BASE_DIR)/generated
else
ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(ARCH_DATA_MODEL), 32)
MISC_DIR=$(C1_DIR) MISC_DIR=$(C1_DIR)
GEN_DIR=$(C1_BASE_DIR)/generated GEN_DIR=$(C1_BASE_DIR)/generated
...@@ -222,6 +245,7 @@ else ...@@ -222,6 +245,7 @@ else
MISC_DIR=$(C2_DIR) MISC_DIR=$(C2_DIR)
GEN_DIR=$(C2_BASE_DIR)/generated GEN_DIR=$(C2_BASE_DIR)/generated
endif endif
endif
# Bin files (windows) # Bin files (windows)
ifeq ($(OSNAME),windows) ifeq ($(OSNAME),windows)
...@@ -265,6 +289,12 @@ endif ...@@ -265,6 +289,12 @@ endif
# Shared Library # Shared Library
ifneq ($(OSNAME),windows) ifneq ($(OSNAME),windows)
ifeq ($(ZERO_BUILD), true)
$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(ZERO_DIR)/%.so
$(install-file)
$(EXPORT_SERVER_DIR)/%.so: $(ZERO_DIR)/%.so
$(install-file)
else
$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so $(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so
$(install-file) $(install-file)
$(EXPORT_CLIENT_DIR)/%.so: $(C1_DIR)/%.so $(EXPORT_CLIENT_DIR)/%.so: $(C1_DIR)/%.so
...@@ -275,6 +305,7 @@ $(EXPORT_SERVER_DIR)/%.so: $(C2_DIR)/%.so ...@@ -275,6 +305,7 @@ $(EXPORT_SERVER_DIR)/%.so: $(C2_DIR)/%.so
$(install-file) $(install-file)
$(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so $(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so
$(install-file) $(install-file)
endif
endif endif
# Jar file (sa-jdi.jar) # Jar file (sa-jdi.jar)
...@@ -313,6 +344,7 @@ clean_build: ...@@ -313,6 +344,7 @@ clean_build:
$(RM) -r $(C1_DIR) $(RM) -r $(C1_DIR)
$(RM) -r $(C2_DIR) $(RM) -r $(C2_DIR)
$(RM) -r $(KERNEL_DIR) $(RM) -r $(KERNEL_DIR)
$(RM) -r $(ZERO_DIR)
clean_export: clean_export:
$(RM) -r $(EXPORT_PATH) $(RM) -r $(EXPORT_PATH)
clean_jdk: clean_jdk:
...@@ -335,8 +367,10 @@ $(JDK_IMAGE_DIR)/jre/lib/rt.jar: ...@@ -335,8 +367,10 @@ $(JDK_IMAGE_DIR)/jre/lib/rt.jar:
($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -) ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -)
test_jdk: test_jdk:
ifeq ($(ARCH_DATA_MODEL), 32) ifneq ($(ZERO_BUILD), true)
ifeq ($(ARCH_DATA_MODEL), 32)
$(JDK_IMAGE_DIR)/bin/java -client -version $(JDK_IMAGE_DIR)/bin/java -client -version
endif
endif endif
$(JDK_IMAGE_DIR)/bin/java -server -version $(JDK_IMAGE_DIR)/bin/java -server -version
......
...@@ -192,13 +192,14 @@ ifneq ($(OSNAME),windows) ...@@ -192,13 +192,14 @@ ifneq ($(OSNAME),windows)
# Use uname output for SRCARCH, but deal with platform differences. If ARCH # Use uname output for SRCARCH, but deal with platform differences. If ARCH
# is not explicitly listed below, it is treated as x86. # is not explicitly listed below, it is treated as x86.
SRCARCH = $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64,$(ARCH))) SRCARCH = $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 zero,$(ARCH)))
ARCH/ = x86 ARCH/ = x86
ARCH/sparc = sparc ARCH/sparc = sparc
ARCH/sparc64= sparc ARCH/sparc64= sparc
ARCH/ia64 = ia64 ARCH/ia64 = ia64
ARCH/amd64 = x86 ARCH/amd64 = x86
ARCH/x86_64 = x86 ARCH/x86_64 = x86
ARCH/zero = zero
# BUILDARCH is usually the same as SRCARCH, except for sparcv9 # BUILDARCH is usually the same as SRCARCH, except for sparcv9
BUILDARCH = $(SRCARCH) BUILDARCH = $(SRCARCH)
...@@ -222,8 +223,9 @@ ifneq ($(OSNAME),windows) ...@@ -222,8 +223,9 @@ ifneq ($(OSNAME),windows)
LIBARCH/sparc = sparc LIBARCH/sparc = sparc
LIBARCH/sparcv9 = sparcv9 LIBARCH/sparcv9 = sparcv9
LIBARCH/ia64 = ia64 LIBARCH/ia64 = ia64
LIBARCH/zero = $(ZERO_LIBARCH)
LP64_ARCH = sparcv9 amd64 ia64 LP64_ARCH = sparcv9 amd64 ia64 zero
endif endif
# Required make macro settings for all platforms # Required make macro settings for all platforms
......
...@@ -132,6 +132,9 @@ ifeq ($(OSNAME),solaris) ...@@ -132,6 +132,9 @@ ifeq ($(OSNAME),solaris)
endif endif
# BUILDARCH is set to "zero" for Zero builds. VARIANTARCH
# is used to give the build directories meaningful names.
VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH))
# There is a (semi-) regular correspondence between make targets and actions: # There is a (semi-) regular correspondence between make targets and actions:
# #
...@@ -158,6 +161,13 @@ endif ...@@ -158,6 +161,13 @@ endif
# profiledcore core <os>_<arch>_core/profiled # profiledcore core <os>_<arch>_core/profiled
# productcore core <os>_<arch>_core/product # productcore core <os>_<arch>_core/product
# #
# debugzero zero <os>_<arch>_zero/debug
# fastdebugzero zero <os>_<arch>_zero/fastdebug
# jvmgzero zero <os>_<arch>_zero/jvmg
# optimizedzero zero <os>_<arch>_zero/optimized
# profiledzero zero <os>_<arch>_zero/profiled
# productzero zero <os>_<arch>_zero/product
#
# What you get with each target: # What you get with each target:
# #
# debug* - "thin" libjvm_g - debug info linked into the gamma_g launcher # debug* - "thin" libjvm_g - debug info linked into the gamma_g launcher
...@@ -171,16 +181,22 @@ endif ...@@ -171,16 +181,22 @@ endif
# in the build.sh script: # in the build.sh script:
TARGETS = debug jvmg fastdebug optimized profiled product TARGETS = debug jvmg fastdebug optimized profiled product
SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs ifeq ($(ZERO_BUILD), true)
SUBDIR_DOCS = $(OSNAME)_$(VARIANTARCH)_docs
else
SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs
endif
SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS)) SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS))
SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS)) SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS))
SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS)) SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS))
SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS)) SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS))
SUBDIRS_ZERO = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS))
TARGETS_C2 = $(TARGETS) TARGETS_C2 = $(TARGETS)
TARGETS_C1 = $(addsuffix 1,$(TARGETS)) TARGETS_C1 = $(addsuffix 1,$(TARGETS))
TARGETS_TIERED = $(addsuffix tiered,$(TARGETS)) TARGETS_TIERED = $(addsuffix tiered,$(TARGETS))
TARGETS_CORE = $(addsuffix core,$(TARGETS)) TARGETS_CORE = $(addsuffix core,$(TARGETS))
TARGETS_ZERO = $(addsuffix zero,$(TARGETS))
BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
...@@ -196,6 +212,7 @@ all: ...@@ -196,6 +212,7 @@ all:
@echo " $(TARGETS_C2)" @echo " $(TARGETS_C2)"
@echo " $(TARGETS_C1)" @echo " $(TARGETS_C1)"
@echo " $(TARGETS_CORE)" @echo " $(TARGETS_CORE)"
@echo " $(TARGETS_ZERO)"
checks: check_os_version check_j2se_version checks: check_os_version check_j2se_version
...@@ -245,6 +262,13 @@ $(SUBDIRS_CORE): $(BUILDTREE_MAKE) ...@@ -245,6 +262,13 @@ $(SUBDIRS_CORE): $(BUILDTREE_MAKE)
$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
$(BUILDTREE) VARIANT=core $(BUILDTREE) VARIANT=core
$(SUBDIRS_ZERO): $(BUILDTREE_MAKE) platform_zero
$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
$(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH)
platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in
$(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@
# Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME # Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME
$(TARGETS_C2): $(SUBDIRS_C2) $(TARGETS_C2): $(SUBDIRS_C2)
...@@ -275,10 +299,18 @@ ifdef INSTALL ...@@ -275,10 +299,18 @@ ifdef INSTALL
cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install
endif endif
$(TARGETS_ZERO): $(SUBDIRS_ZERO)
cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS)
cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && ./test_gamma
ifdef INSTALL
cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install
endif
# Just build the tree, and nothing else: # Just build the tree, and nothing else:
tree: $(SUBDIRS_C2) tree: $(SUBDIRS_C2)
tree1: $(SUBDIRS_C1) tree1: $(SUBDIRS_C1)
treecore: $(SUBDIRS_CORE) treecore: $(SUBDIRS_CORE)
treezero: $(SUBDIRS_ZERO)
# Doc target. This is the same for all build options. # Doc target. This is the same for all build options.
# Hence create a docs directory beside ...$(ARCH)_[...] # Hence create a docs directory beside ...$(ARCH)_[...]
...@@ -293,20 +325,22 @@ compiler1: jvmg1 product1 ...@@ -293,20 +325,22 @@ compiler1: jvmg1 product1
core: jvmgcore productcore core: jvmgcore productcore
zero: jvmgzero productzero
clean_docs: clean_docs:
rm -rf $(SUBDIR_DOCS) rm -rf $(SUBDIR_DOCS)
clean_compiler1 clean_compiler2 clean_core: clean_compiler1 clean_compiler2 clean_core clean_zero:
rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@) rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)
clean: clean_compiler2 clean_compiler1 clean_core clean_docs clean: clean_compiler2 clean_compiler1 clean_core clean_zero clean_docs
include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) .PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO)
.PHONY: tree tree1 treecore .PHONY: tree tree1 treecore treezero
.PHONY: all compiler1 compiler2 core .PHONY: all compiler1 compiler2 core zero
.PHONY: clean clean_compiler1 clean_compiler2 clean_core docs clean_docs .PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero docs clean_docs
.PHONY: checks check_os_version check_j2se_version .PHONY: checks check_os_version check_j2se_version
...@@ -63,20 +63,30 @@ QUIETLY$(MAKE_VERBOSE) = @ ...@@ -63,20 +63,30 @@ QUIETLY$(MAKE_VERBOSE) = @
# For now, until the compiler is less wobbly: # For now, until the compiler is less wobbly:
TESTFLAGS = -Xbatch -showversion TESTFLAGS = -Xbatch -showversion
ifdef USE_SUNCC ifeq ($(ZERO_BUILD), true)
PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc PLATFORM_FILE = $(shell dirname $(shell dirname $(shell pwd)))/platform_zero
else else
PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH) ifdef USE_SUNCC
PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc
else
PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH)
endif
endif
# Allow overriding of the arch part of the directory but default
# to BUILDARCH if nothing is specified
ifeq ($(VARIANTARCH),)
VARIANTARCH=$(BUILDARCH)
endif endif
ifdef FORCE_TIERED ifdef FORCE_TIERED
ifeq ($(VARIANT),tiered) ifeq ($(VARIANT),tiered)
PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_compiler2 PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_compiler2
else else
PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_$(VARIANT) PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT)
endif endif
else else
PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_$(VARIANT) PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT)
endif endif
# #
...@@ -321,6 +331,7 @@ DATA_MODE/sparc = 32 ...@@ -321,6 +331,7 @@ DATA_MODE/sparc = 32
DATA_MODE/sparcv9 = 64 DATA_MODE/sparcv9 = 64
DATA_MODE/amd64 = 64 DATA_MODE/amd64 = 64
DATA_MODE/ia64 = 64 DATA_MODE/ia64 = 64
DATA_MODE/zero = $(ARCH_DATA_MODEL)
JAVA_FLAG/32 = -d32 JAVA_FLAG/32 = -d32
JAVA_FLAG/64 = -d64 JAVA_FLAG/64 = -d64
......
...@@ -37,6 +37,17 @@ else ...@@ -37,6 +37,17 @@ else
ARCH_DATA_MODEL ?= 32 ARCH_DATA_MODEL ?= 32
endif endif
# zero
ifeq ($(ZERO_BUILD), true)
ifeq ($(ARCH_DATA_MODEL), 64)
MAKE_ARGS += LP64=1
endif
PLATFORM = linux-zero
VM_PLATFORM = linux_$(subst i386,i486,$(ZERO_LIBARCH))
HS_ARCH = zero
ARCH = zero
endif
# ia64 # ia64
ifeq ($(ARCH), ia64) ifeq ($(ARCH), ia64)
ARCH_DATA_MODEL = 64 ARCH_DATA_MODEL = 64
...@@ -97,17 +108,19 @@ EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server ...@@ -97,17 +108,19 @@ EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjsig.so EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjsig.so
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so
ifeq ($(ARCH_DATA_MODEL), 32) ifneq ($(ZERO_BUILD), true)
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client ifeq ($(ARCH_DATA_MODEL), 32)
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjsig.so EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjsig.so
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so
EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so
else EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
ifeq ($(ARCH),ia64) else
else ifeq ($(ARCH),ia64)
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so else
EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so
EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
endif endif
endif
endif endif
...@@ -52,6 +52,9 @@ VM_PICFLAG/LIBJVM = $(PICFLAG) ...@@ -52,6 +52,9 @@ VM_PICFLAG/LIBJVM = $(PICFLAG)
VM_PICFLAG/AOUT = VM_PICFLAG/AOUT =
VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
ifeq ($(ZERO_BUILD), true)
CFLAGS += $(LIBFFI_CFLAGS)
endif
CFLAGS += $(VM_PICFLAG) CFLAGS += $(VM_PICFLAG)
CFLAGS += -fno-rtti CFLAGS += -fno-rtti
CFLAGS += -fno-exceptions CFLAGS += -fno-exceptions
...@@ -64,6 +67,7 @@ ARCHFLAG/amd64 = -m64 ...@@ -64,6 +67,7 @@ ARCHFLAG/amd64 = -m64
ARCHFLAG/ia64 = ARCHFLAG/ia64 =
ARCHFLAG/sparc = -m32 -mcpu=v9 ARCHFLAG/sparc = -m32 -mcpu=v9
ARCHFLAG/sparcv9 = -m64 -mcpu=v9 ARCHFLAG/sparcv9 = -m64 -mcpu=v9
ARCHFLAG/zero = $(ZERO_ARCHFLAG)
CFLAGS += $(ARCHFLAG) CFLAGS += $(ARCHFLAG)
AOUT_FLAGS += $(ARCHFLAG) AOUT_FLAGS += $(ARCHFLAG)
......
...@@ -52,10 +52,10 @@ SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VE ...@@ -52,10 +52,10 @@ SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VE
SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
# if $(AGENT_DIR) does not exist, we don't build SA # if $(AGENT_DIR) does not exist, we don't build SA
# also, we don't build SA on Itanium. # also, we don't build SA on Itanium or zero.
all: all:
if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" ] ; then \ if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "zero" ] ; then \
$(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
fi fi
......
...@@ -49,10 +49,10 @@ ifeq ($(DEBUG_BINARIES), true) ...@@ -49,10 +49,10 @@ ifeq ($(DEBUG_BINARIES), true)
endif endif
# if $(AGENT_DIR) does not exist, we don't build SA # if $(AGENT_DIR) does not exist, we don't build SA
# also, we don't build SA on Itanium. # also, we don't build SA on Itanium or zero.
checkAndBuildSA: checkAndBuildSA:
$(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" ] ; then \ $(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "zero" ] ; then \
$(MAKE) -f vm.make $(LIBSAPROC); \ $(MAKE) -f vm.make $(LIBSAPROC); \
fi fi
......
...@@ -74,6 +74,7 @@ Include_DBs/CORE = $(VM)/includeDB_core $(Include_DBs/GC) \ ...@@ -74,6 +74,7 @@ Include_DBs/CORE = $(VM)/includeDB_core $(Include_DBs/GC) \
Include_DBs/COMPILER1 = $(Include_DBs/CORE) $(VM)/includeDB_compiler1 Include_DBs/COMPILER1 = $(Include_DBs/CORE) $(VM)/includeDB_compiler1
Include_DBs/COMPILER2 = $(Include_DBs/CORE) $(VM)/includeDB_compiler2 Include_DBs/COMPILER2 = $(Include_DBs/CORE) $(VM)/includeDB_compiler2
Include_DBs/TIERED = $(Include_DBs/CORE) $(VM)/includeDB_compiler1 $(VM)/includeDB_compiler2 Include_DBs/TIERED = $(Include_DBs/CORE) $(VM)/includeDB_compiler1 $(VM)/includeDB_compiler2
Include_DBs/ZERO = $(Include_DBs/CORE) $(VM)/includeDB_zero
Include_DBs = $(Include_DBs/$(TYPE)) Include_DBs = $(Include_DBs/$(TYPE))
Cached_plat = $(GENERATED)/platform.current Cached_plat = $(GENERATED)/platform.current
......
...@@ -40,7 +40,11 @@ GENERATED = ../generated ...@@ -40,7 +40,11 @@ GENERATED = ../generated
include $(GENERATED)/Dependencies include $(GENERATED)/Dependencies
# read machine-specific adjustments (%%% should do this via buildtree.make?) # read machine-specific adjustments (%%% should do this via buildtree.make?)
include $(MAKEFILES_DIR)/$(BUILDARCH).make ifeq ($(ZERO_BUILD), true)
include $(MAKEFILES_DIR)/zeroshark.make
else
include $(MAKEFILES_DIR)/$(BUILDARCH).make
endif
# set VPATH so make knows where to look for source files # set VPATH so make knows where to look for source files
# Src_Dirs is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm # Src_Dirs is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
...@@ -124,7 +128,11 @@ mapfile_reorder : mapfile $(REORDERFILE) ...@@ -124,7 +128,11 @@ mapfile_reorder : mapfile $(REORDERFILE)
rm -f $@ rm -f $@
cat $^ > $@ cat $^ > $@
STATIC_CXX = true ifeq ($(ZERO_LIBARCH), ppc64)
STATIC_CXX = false
else
STATIC_CXX = true
endif
ifeq ($(LINK_INTO),AOUT) ifeq ($(LINK_INTO),AOUT)
LIBJVM.o = LIBJVM.o =
...@@ -148,6 +156,9 @@ else ...@@ -148,6 +156,9 @@ else
LIBS_VM += $(LIBS) LIBS_VM += $(LIBS)
endif endif
ifeq ($(ZERO_BUILD), true)
LIBS_VM += $(LIBFFI_LIBS)
endif
LINK_VM = $(LINK_LIB.c) LINK_VM = $(LINK_LIB.c)
......
#
# Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2009 Red Hat, Inc.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
#
# Setup for Zero (non-Shark) version of VM
# Select which includeDB files to use (in top.make)
TYPE = ZERO
# Install libjvm.so, etc in in server directory.
VM_SUBDIR = server
#
# Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2007, 2008 Red Hat, Inc.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
#
# Setup common to Zero (non-Shark) and Shark versions of VM
# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized
OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized
OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT)
# Specify that the CPU is little endian, if necessary
ifeq ($(ZERO_ENDIANNESS), little)
CFLAGS += -DVM_LITTLE_ENDIAN
endif
# Specify that the CPU is 64 bit, if necessary
ifeq ($(ARCH_DATA_MODEL), 64)
CFLAGS += -D_LP64=1
endif
OPT_CFLAGS/compactingPermGenGen.o = -O1
os_family = linux
arch = zero
arch_model = zero
os_arch = linux_zero
os_arch_model = linux_zero
lib_arch = zero
compiler = gcc
gnu_dis_arch = zero
sysdefs = -DLINUX -D_GNU_SOURCE -DCC_INTERP -DZERO -D@ZERO_ARCHDEF@ -DZERO_LIBARCH=\"@ZERO_LIBARCH@\"
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_assembler_zero.cpp.incl"
int AbstractAssembler::code_fill_byte() {
return 0;
}
void Assembler::pd_patch_instruction(address branch, address target) {
ShouldNotCallThis();
}
#ifndef PRODUCT
void Assembler::pd_print_patched_instruction(address branch) {
ShouldNotCallThis();
}
#endif // PRODUCT
void MacroAssembler::align(int modulus) {
while (offset() % modulus != 0)
emit_byte(AbstractAssembler::code_fill_byte());
}
void MacroAssembler::bang_stack_with_offset(int offset) {
ShouldNotCallThis();
}
void MacroAssembler::advance(int bytes) {
_code_pos += bytes;
sync();
}
RegisterOrConstant MacroAssembler::delayed_value_impl(
intptr_t* delayed_value_addr, Register tmpl, int offset) {
ShouldNotCallThis();
}
void MacroAssembler::store_oop(jobject obj) {
code_section()->relocate(pc(), oop_Relocation::spec_for_immediate());
emit_address((address) obj);
}
static void should_not_call() {
report_should_not_call(__FILE__, __LINE__);
}
address ShouldNotCallThisStub() {
return (address) should_not_call;
}
address ShouldNotCallThisEntry() {
return (address) should_not_call;
}
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// In normal, CPU-specific ports of HotSpot these two classes are used
// for generating assembly language. We don't do any of this in zero,
// of course, but we do sneak entry points around in CodeBuffers so we
// generate those here.
class Assembler : public AbstractAssembler {
public:
Assembler(CodeBuffer* code) : AbstractAssembler(code) {}
public:
void pd_patch_instruction(address branch, address target);
#ifndef PRODUCT
static void pd_print_patched_instruction(address branch);
#endif // PRODUCT
};
class MacroAssembler : public Assembler {
public:
MacroAssembler(CodeBuffer* code) : Assembler(code) {}
public:
void align(int modulus);
void bang_stack_with_offset(int offset);
bool needs_explicit_null_check(intptr_t offset);
RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr,
Register tmp, int offset);
public:
void advance(int bytes);
void store_oop(jobject obj);
};
#ifdef ASSERT
inline bool AbstractAssembler::pd_check_instruction_mark() {
ShouldNotCallThis();
}
#endif
address ShouldNotCallThisStub();
address ShouldNotCallThisEntry();
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file is intentionally empty
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_cppInterpreter_zero.cpp.incl"
#ifdef CC_INTERP
const char *BytecodeInterpreter::name_of_field_at_address(address addr) {
#define DO(member) {if (addr == (address) &(member)) return XSTR(member);}
DO(_thread);
DO(_bcp);
DO(_locals);
DO(_constants);
DO(_method);
DO(_mdx);
DO(_stack);
DO(_msg);
DO(_result);
DO(_prev_link);
DO(_oop_temp);
DO(_stack_base);
DO(_stack_limit);
DO(_monitor_base);
DO(_self_link);
#undef DO
if (addr > (address) &_result && addr < (address) (&_result + 1))
return "_result)";
return NULL;
}
#endif // CC_INTERP
/*
* Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// Platform specific for C++ based Interpreter
#if defined(PPC) || defined(SPARC) || defined(IA64)
#define LOTS_OF_REGS // Use plenty of registers
#else
#undef LOTS_OF_REGS // Loser platforms
#endif
private:
interpreterState _self_link;
public:
inline void set_locals(intptr_t* new_locals) {
_locals = new_locals;
}
inline void set_method(methodOop new_method) {
_method = new_method;
}
inline interpreterState self_link() {
return _self_link;
}
inline void set_self_link(interpreterState new_self_link) {
_self_link = new_self_link;
}
inline interpreterState prev_link() {
return _prev_link;
}
inline void set_prev_link(interpreterState new_prev_link) {
_prev_link = new_prev_link;
}
inline void set_stack_limit(intptr_t* new_stack_limit) {
_stack_limit = new_stack_limit;
}
inline void set_stack_base(intptr_t* new_stack_base) {
_stack_base = new_stack_base;
}
inline void set_monitor_base(BasicObjectLock *new_monitor_base) {
_monitor_base = new_monitor_base;
}
inline void set_thread(JavaThread* new_thread) {
_thread = new_thread;
}
inline void set_constants(constantPoolCacheOop new_constants) {
_constants = new_constants;
}
inline oop oop_temp() {
return _oop_temp;
}
inline oop *oop_temp_addr() {
return &_oop_temp;
}
inline void set_oop_temp(oop new_oop_temp) {
_oop_temp = new_oop_temp;
}
inline address callee_entry_point() {
return _result._to_call._callee_entry_point;
}
inline address osr_buf() {
return _result._osr._osr_buf;
}
inline address osr_entry() {
return _result._osr._osr_entry;
}
public:
const char *name_of_field_at_address(address addr);
// The frame manager handles this
#define SET_LAST_JAVA_FRAME()
#define RESET_LAST_JAVA_FRAME()
// ZeroStack Implementation
#undef STACK_INT
#undef STACK_FLOAT
#undef STACK_ADDR
#undef STACK_OBJECT
#undef STACK_DOUBLE
#undef STACK_LONG
#define GET_STACK_SLOT(offset) (*((intptr_t*) &topOfStack[-(offset)]))
#define STACK_SLOT(offset) ((address) &topOfStack[-(offset)])
#define STACK_ADDR(offset) (*((address *) &topOfStack[-(offset)]))
#define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)]))
#define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)]))
#define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)]))
#define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d)
#define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l)
#define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))
#define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value))
#define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value))
#define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value))
#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))
#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))
#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \
((VMJavaVal64*)(addr))->d)
#define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))
#define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \
((VMJavaVal64*)(addr))->l)
// JavaLocals implementation
#define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)])
#define LOCALS_ADDR(offset) ((address)locals[-(offset)])
#define LOCALS_INT(offset) (*((jint*)&locals[-(offset)]))
#define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)]))
#define LOCALS_OBJECT(offset) ((oop)locals[-(offset)])
#define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
#define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l)
#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
#define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
#define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value))
#define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))
#define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value))
#define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value))
#define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
#define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
((VMJavaVal64*)(addr))->d)
#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
((VMJavaVal64*)(addr))->l)
/*
* Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// Inline interpreter functions for zero
inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) {
return op1 + op2;
}
inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) {
return op1 - op2;
}
inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) {
return op1 * op2;
}
inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) {
return op1 / op2;
}
inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) {
return fmod(op1, op2);
}
inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) {
return -op;
}
inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1,
jfloat op2,
int32_t direction) {
return ( op1 < op2 ? -1 :
op1 > op2 ? 1 :
op1 == op2 ? 0 :
(direction == -1 || direction == 1) ? direction : 0);
}
inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2],
const uint32_t from[2]) {
*(uint64_t *) to = *(uint64_t *) from;
}
inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) {
return op1 + op2;
}
inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) {
return op1 & op2;
}
inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) {
/* it's possible we could catch this special case implicitly */
if (op1 == (jlong) 0x8000000000000000LL && op2 == -1) return op1;
else return op1 / op2;
}
inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) {
return op1 * op2;
}
inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) {
return op1 | op2;
}
inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) {
return op1 - op2;
}
inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) {
return op1 ^ op2;
}
inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) {
/* it's possible we could catch this special case implicitly */
if (op1 == (jlong) 0x8000000000000000LL && op2 == -1) return 0;
else return op1 % op2;
}
inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) {
return ((unsigned long long) op1) >> (op2 & 0x3F);
}
inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) {
return op1 >> (op2 & 0x3F);
}
inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) {
return op1 << (op2 & 0x3F);
}
inline jlong BytecodeInterpreter::VMlongNeg(jlong op) {
return -op;
}
inline jlong BytecodeInterpreter::VMlongNot(jlong op) {
return ~op;
}
inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) {
return (op <= 0);
}
inline int32_t BytecodeInterpreter::VMlongGez(jlong op) {
return (op >= 0);
}
inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) {
return (op == 0);
}
inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) {
return (op1 == op2);
}
inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) {
return (op1 != op2);
}
inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) {
return (op1 >= op2);
}
inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) {
return (op1 <= op2);
}
inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) {
return (op1 < op2);
}
inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) {
return (op1 > op2);
}
inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) {
return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0);
}
// Long conversions
inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) {
return (jdouble) val;
}
inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) {
return (jfloat) val;
}
inline jint BytecodeInterpreter::VMlong2Int(jlong val) {
return (jint) val;
}
// Double Arithmetic
inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) {
return op1 + op2;
}
inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) {
// Divide by zero... QQQ
return op1 / op2;
}
inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) {
return op1 * op2;
}
inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) {
return -op;
}
inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) {
return fmod(op1, op2);
}
inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) {
return op1 - op2;
}
inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1,
jdouble op2,
int32_t direction) {
return ( op1 < op2 ? -1 :
op1 > op2 ? 1 :
op1 == op2 ? 0 :
(direction == -1 || direction == 1) ? direction : 0);
}
// Double Conversions
inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) {
return (jfloat) val;
}
// Float Conversions
inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) {
return (jdouble) op;
}
// Integer Arithmetic
inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) {
return op1 + op2;
}
inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) {
return op1 & op2;
}
inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) {
/* it's possible we could catch this special case implicitly */
if (op1 == (jint) 0x80000000 && op2 == -1) return op1;
else return op1 / op2;
}
inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) {
return op1 * op2;
}
inline jint BytecodeInterpreter::VMintNeg(jint op) {
return -op;
}
inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) {
return op1 | op2;
}
inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) {
/* it's possible we could catch this special case implicitly */
if (op1 == (jint) 0x80000000 && op2 == -1) return 0;
else return op1 % op2;
}
inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) {
return op1 << (op2 & 0x1F);
}
inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) {
return op1 >> (op2 & 0x1F);
}
inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) {
return op1 - op2;
}
inline jint BytecodeInterpreter::VMintUshr(jint op1, jint op2) {
return ((juint) op1) >> (op2 & 0x1F);
}
inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) {
return op1 ^ op2;
}
inline jdouble BytecodeInterpreter::VMint2Double(jint val) {
return (jdouble) val;
}
inline jfloat BytecodeInterpreter::VMint2Float(jint val) {
return (jfloat) val;
}
inline jlong BytecodeInterpreter::VMint2Long(jint val) {
return (jlong) val;
}
inline jchar BytecodeInterpreter::VMint2Char(jint val) {
return (jchar) val;
}
inline jshort BytecodeInterpreter::VMint2Short(jint val) {
return (jshort) val;
}
inline jbyte BytecodeInterpreter::VMint2Byte(jint val) {
return (jbyte) val;
}
/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_bytecodes_zero.cpp.incl"
void Bytecodes::pd_initialize() {
// No zero specific initialization
}
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file is intentionally empty
/*
* Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
typedef union unaligned {
u4 u;
u2 us;
u8 ul;
} __attribute__((packed)) unaligned;
class Bytes: AllStatic {
public:
// Returns true if the byte ordering used by Java is different
// from the native byte ordering of the underlying machine.
static inline bool is_Java_byte_ordering_different() {
#ifdef VM_LITTLE_ENDIAN
return true;
#else
return false;
#endif
}
// Efficient reading and writing of unaligned unsigned data in
// platform-specific byte ordering.
static inline u2 get_native_u2(address p){
unaligned *up = (unaligned *) p;
return up->us;
}
static inline u4 get_native_u4(address p) {
unaligned *up = (unaligned *) p;
return up->u;
}
static inline u8 get_native_u8(address p) {
unaligned *up = (unaligned *) p;
return up->ul;
}
static inline void put_native_u2(address p, u2 x) {
unaligned *up = (unaligned *) p;
up->us = x;
}
static inline void put_native_u4(address p, u4 x) {
unaligned *up = (unaligned *) p;
up->u = x;
}
static inline void put_native_u8(address p, u8 x) {
unaligned *up = (unaligned *) p;
up->ul = x;
}
// Efficient reading and writing of unaligned unsigned data in Java
// byte ordering (i.e. big-endian ordering).
#ifdef VM_LITTLE_ENDIAN
// Byte-order reversal is needed
static inline u2 get_Java_u2(address p) {
return (u2(p[0]) << 8) |
(u2(p[1]) );
}
static inline u4 get_Java_u4(address p) {
return (u4(p[0]) << 24) |
(u4(p[1]) << 16) |
(u4(p[2]) << 8) |
(u4(p[3]) );
}
static inline u8 get_Java_u8(address p) {
u4 hi, lo;
hi = (u4(p[0]) << 24) |
(u4(p[1]) << 16) |
(u4(p[2]) << 8) |
(u4(p[3]) );
lo = (u4(p[4]) << 24) |
(u4(p[5]) << 16) |
(u4(p[6]) << 8) |
(u4(p[7]) );
return u8(lo) | (u8(hi) << 32);
}
static inline void put_Java_u2(address p, u2 x) {
p[0] = x >> 8;
p[1] = x;
}
static inline void put_Java_u4(address p, u4 x) {
p[0] = x >> 24;
p[1] = x >> 16;
p[2] = x >> 8;
p[3] = x;
}
static inline void put_Java_u8(address p, u8 x) {
u4 hi, lo;
lo = x;
hi = x >> 32;
p[0] = hi >> 24;
p[1] = hi >> 16;
p[2] = hi >> 8;
p[3] = hi;
p[4] = lo >> 24;
p[5] = lo >> 16;
p[6] = lo >> 8;
p[7] = lo;
}
// Efficient swapping of byte ordering
static inline u2 swap_u2(u2 x);
static inline u4 swap_u4(u4 x);
static inline u8 swap_u8(u8 x);
#else
// No byte-order reversal is needed
static inline u2 get_Java_u2(address p) {
return get_native_u2(p);
}
static inline u4 get_Java_u4(address p) {
return get_native_u4(p);
}
static inline u8 get_Java_u8(address p) {
return get_native_u8(p);
}
static inline void put_Java_u2(address p, u2 x) {
put_native_u2(p, x);
}
static inline void put_Java_u4(address p, u4 x) {
put_native_u4(p, x);
}
static inline void put_Java_u8(address p, u8 x) {
put_native_u8(p, x);
}
// No byte-order reversal is needed
static inline u2 swap_u2(u2 x) { return x; }
static inline u4 swap_u4(u4 x) { return x; }
static inline u8 swap_u8(u8 x) { return x; }
#endif // VM_LITTLE_ENDIAN
};
#ifdef VM_LITTLE_ENDIAN
// The following header contains the implementations of swap_u2,
// swap_u4, and swap_u8
#include "incls/_bytes_pd.inline.hpp.incl"
#endif // VM_LITTLE_ENDIAN
/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
private:
void pd_initialize() {}
/*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// Inline functions for memory copy and fill.
static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
memmove(to, from, count * HeapWordSize);
}
static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
switch (count) {
case 8: to[7] = from[7];
case 7: to[6] = from[6];
case 6: to[5] = from[5];
case 5: to[4] = from[4];
case 4: to[3] = from[3];
case 3: to[2] = from[2];
case 2: to[1] = from[1];
case 1: to[0] = from[0];
case 0: break;
default:
memcpy(to, from, count * HeapWordSize);
break;
}
}
static void pd_disjoint_words_atomic(HeapWord* from,
HeapWord* to,
size_t count) {
switch (count) {
case 8: to[7] = from[7];
case 7: to[6] = from[6];
case 6: to[5] = from[5];
case 5: to[4] = from[4];
case 4: to[3] = from[3];
case 3: to[2] = from[2];
case 2: to[1] = from[1];
case 1: to[0] = from[0];
case 0: break;
default:
while (count-- > 0) {
*to++ = *from++;
}
break;
}
}
static void pd_aligned_conjoint_words(HeapWord* from,
HeapWord* to,
size_t count) {
memmove(to, from, count * HeapWordSize);
}
static void pd_aligned_disjoint_words(HeapWord* from,
HeapWord* to,
size_t count) {
pd_disjoint_words(from, to, count);
}
static void pd_conjoint_bytes(void* from, void* to, size_t count) {
memmove(to, from, count);
}
static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) {
memmove(to, from, count);
}
static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
_Copy_conjoint_jshorts_atomic(from, to, count);
}
static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
_Copy_conjoint_jints_atomic(from, to, count);
}
static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
_Copy_conjoint_jlongs_atomic(from, to, count);
}
static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) {
#ifdef _LP64
assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
_Copy_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
#else
assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size");
_Copy_conjoint_jints_atomic((jint*)from, (jint*)to, count);
#endif // _LP64
}
static void pd_arrayof_conjoint_bytes(HeapWord* from,
HeapWord* to,
size_t count) {
_Copy_arrayof_conjoint_bytes(from, to, count);
}
static void pd_arrayof_conjoint_jshorts(HeapWord* from,
HeapWord* to,
size_t count) {
_Copy_arrayof_conjoint_jshorts(from, to, count);
}
static void pd_arrayof_conjoint_jints(HeapWord* from,
HeapWord* to,
size_t count) {
_Copy_arrayof_conjoint_jints(from, to, count);
}
static void pd_arrayof_conjoint_jlongs(HeapWord* from,
HeapWord* to,
size_t count) {
_Copy_arrayof_conjoint_jlongs(from, to, count);
}
static void pd_arrayof_conjoint_oops(HeapWord* from,
HeapWord* to,
size_t count) {
#ifdef _LP64
assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
_Copy_arrayof_conjoint_jlongs(from, to, count);
#else
assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size");
_Copy_arrayof_conjoint_jints(from, to, count);
#endif // _LP64
}
static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
#ifdef _LP64
julong* to = (julong*) tohw;
julong v = ((julong) value << 32) | value;
#else
juint* to = (juint*) tohw;
juint v = value;
#endif // _LP64
while (count-- > 0) {
*to++ = v;
}
}
static void pd_fill_to_aligned_words(HeapWord* tohw,
size_t count,
juint value) {
pd_fill_to_words(tohw, count, value);
}
static void pd_fill_to_bytes(void* to, size_t count, jubyte value) {
memset(to, value, count);
}
static void pd_zero_to_words(HeapWord* tohw, size_t count) {
pd_fill_to_words(tohw, count, 0);
}
static void pd_zero_to_bytes(void* to, size_t count) {
memset(to, 0, count);
}
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
protected:
MacroAssembler* assembler() const {
return _masm;
}
protected:
address generate_entry(address entry_point) {
ZeroEntry *entry = (ZeroEntry *) assembler()->pc();
assembler()->advance(sizeof(ZeroEntry));
entry->set_entry_point(entry_point);
return (address) entry;
}
此差异已折叠。
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
protected:
// Size of interpreter code
const static int InterpreterCodeSize = 6 * K;
public:
// Method entries
static void normal_entry(methodOop method, intptr_t UNUSED, TRAPS);
static void native_entry(methodOop method, intptr_t UNUSED, TRAPS);
static void accessor_entry(methodOop method, intptr_t UNUSED, TRAPS);
static void empty_entry(methodOop method, intptr_t UNUSED, TRAPS);
public:
// Main loop of normal_entry
static void main_loop(int recurse, TRAPS);
private:
// Stack overflow checks
static bool stack_overflow_imminent(JavaThread *thread);
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_debug_zero.cpp.incl"
void pd_ps(frame f) {
ShouldNotCallThis();
}
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file is intentionally empty
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file is intentionally empty
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file is intentionally empty
/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// The disassembler prints out zero code annotated
// with Java specific information.
static int pd_instruction_alignment() {
ShouldNotCallThis();
}
static const char* pd_cpu_opts() {
ShouldNotCallThis();
}
/*
* Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_dump_zero.cpp.incl"
void CompactingPermGenGen::generate_vtable_methods(void** vtbl_list,
void** vtable,
char** md_top,
char* md_end,
char** mc_top,
char* mc_end) {
ShouldNotCallThis();
}
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// | ... |
// +--------------------+ ------------------
// | parameter n-1 | low addresses
// | ... |
// | parameter 0 |
// | call_wrapper |
// | frame_type |
// | next_frame | high addresses
// +--------------------+ ------------------
// | ... |
class EntryFrame : public ZeroFrame {
private:
EntryFrame() : ZeroFrame() {
ShouldNotCallThis();
}
protected:
enum Layout {
call_wrapper_off = jf_header_words,
header_words
};
public:
static EntryFrame *build(ZeroStack* stack,
const intptr_t* parameters,
int parameter_words,
JavaCallWrapper* call_wrapper);
public:
JavaCallWrapper *call_wrapper() const {
return (JavaCallWrapper *) value_of_word(call_wrapper_off);
}
public:
void identify_word(int frame_index,
int offset,
char* fieldbuf,
char* valuebuf,
int buflen) const;
};
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
class ZeroEntry {
public:
ZeroEntry() {
ShouldNotCallThis();
}
private:
address _entry_point;
public:
address entry_point() const {
return _entry_point;
}
void set_entry_point(address entry_point) {
_entry_point = entry_point;
}
private:
typedef void (*NormalEntryFunc)(methodOop method,
intptr_t base_pc,
TRAPS);
typedef void (*OSREntryFunc)(methodOop method,
address osr_buf,
intptr_t base_pc,
TRAPS);
public:
void invoke(methodOop method, TRAPS) const {
((NormalEntryFunc) entry_point())(method, (intptr_t) this, THREAD);
}
void invoke_osr(methodOop method, address osr_buf, TRAPS) const {
((OSREntryFunc) entry_point())(method, osr_buf, (intptr_t) this, THREAD);
}
public:
static ByteSize entry_point_offset() {
return byte_offset_of(ZeroEntry, _entry_point);
}
};
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// | ... |
// +--------------------+ ------------------
// | frame_type | low addresses
// | next_frame | high addresses
// +--------------------+ ------------------
// | ... |
class FakeStubFrame : public ZeroFrame {
private:
FakeStubFrame() : ZeroFrame() {
ShouldNotCallThis();
}
protected:
enum Layout {
header_words = jf_header_words
};
public:
static FakeStubFrame *build(ZeroStack* stack);
public:
void identify_word(int frame_index,
int offset,
char* fieldbuf,
char* valuebuf,
int buflen) const {}
};
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_frame_zero.cpp.incl"
#ifdef ASSERT
void RegisterMap::check_location_valid() {
ShouldNotCallThis();
}
#endif
bool frame::is_interpreted_frame() const {
return zeroframe()->is_interpreter_frame();
}
bool frame::is_fake_stub_frame() const {
return zeroframe()->is_fake_stub_frame();
}
frame frame::sender_for_entry_frame(RegisterMap *map) const {
assert(map != NULL, "map must be set");
assert(!entry_frame_is_first(), "next Java fp must be non zero");
assert(entry_frame_call_wrapper()->anchor()->last_Java_sp() == sender_sp(),
"sender should be next Java frame");
map->clear();
assert(map->include_argument_oops(), "should be set by clear");
return frame(sender_sp(), sp() + 1);
}
frame frame::sender_for_interpreter_frame(RegisterMap *map) const {
return frame(sender_sp(), sp() + 1);
}
frame frame::sender_for_compiled_frame(RegisterMap *map) const {
return frame(sender_sp(), sp() + 1);
}
frame frame::sender_for_fake_stub_frame(RegisterMap *map) const {
return frame(sender_sp(), sp() + 1);
}
frame frame::sender(RegisterMap* map) const {
// Default is not to follow arguments; the various
// sender_for_xxx methods update this accordingly.
map->set_include_argument_oops(false);
if (is_entry_frame())
return sender_for_entry_frame(map);
if (is_interpreted_frame())
return sender_for_interpreter_frame(map);
if (is_compiled_frame())
return sender_for_compiled_frame(map);
if (is_fake_stub_frame())
return sender_for_fake_stub_frame(map);
ShouldNotReachHere();
}
#ifdef CC_INTERP
BasicObjectLock* frame::interpreter_frame_monitor_begin() const {
return get_interpreterState()->monitor_base();
}
BasicObjectLock* frame::interpreter_frame_monitor_end() const {
return (BasicObjectLock*) get_interpreterState()->stack_base();
}
#endif // CC_INTERP
void frame::patch_pc(Thread* thread, address pc) {
// We borrow this call to set the thread pointer in the interpreter
// state; the hook to set up deoptimized frames isn't supplied it.
assert(pc == NULL, "should be");
get_interpreterState()->set_thread((JavaThread *) thread);
}
bool frame::safe_for_sender(JavaThread *thread) {
ShouldNotCallThis();
}
void frame::pd_gc_epilog() {
}
bool frame::is_interpreted_frame_valid(JavaThread *thread) const {
ShouldNotCallThis();
}
BasicType frame::interpreter_frame_result(oop* oop_result,
jvalue* value_result) {
assert(is_interpreted_frame(), "interpreted frame expected");
methodOop method = interpreter_frame_method();
BasicType type = method->result_type();
intptr_t* tos_addr = (intptr_t *) interpreter_frame_tos_address();
oop obj;
switch (type) {
case T_VOID:
break;
case T_BOOLEAN:
value_result->z = *(jboolean *) tos_addr;
break;
case T_BYTE:
value_result->b = *(jbyte *) tos_addr;
break;
case T_CHAR:
value_result->c = *(jchar *) tos_addr;
break;
case T_SHORT:
value_result->s = *(jshort *) tos_addr;
break;
case T_INT:
value_result->i = *(jint *) tos_addr;
break;
case T_LONG:
value_result->j = *(jlong *) tos_addr;
break;
case T_FLOAT:
value_result->f = *(jfloat *) tos_addr;
break;
case T_DOUBLE:
value_result->d = *(jdouble *) tos_addr;
break;
case T_OBJECT:
case T_ARRAY:
if (method->is_native()) {
obj = get_interpreterState()->oop_temp();
}
else {
oop* obj_p = (oop *) tos_addr;
obj = (obj_p == NULL) ? (oop) NULL : *obj_p;
}
assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
*oop_result = obj;
break;
default:
ShouldNotReachHere();
}
return type;
}
int frame::frame_size(RegisterMap* map) const {
#ifdef PRODUCT
ShouldNotCallThis();
#else
return 0; // make javaVFrame::print_value work
#endif // PRODUCT
}
intptr_t* frame::interpreter_frame_tos_at(jint offset) const {
int index = (Interpreter::expr_offset_in_bytes(offset) / wordSize);
return &interpreter_frame_tos_address()[index];
}
void frame::zero_print_on_error(int frame_index,
outputStream* st,
char* buf,
int buflen) const {
// Divide the buffer between the field and the value
buflen >>= 1;
char *fieldbuf = buf;
char *valuebuf = buf + buflen;
// Print each word of the frame
for (intptr_t *addr = fp(); addr <= sp(); addr++) {
int offset = sp() - addr;
// Fill in default values, then try and improve them
snprintf(fieldbuf, buflen, "word[%d]", offset);
snprintf(valuebuf, buflen, PTR_FORMAT, *addr);
zeroframe()->identify_word(frame_index, offset, fieldbuf, valuebuf, buflen);
fieldbuf[buflen - 1] = '\0';
valuebuf[buflen - 1] = '\0';
// Print the result
st->print_cr(" " PTR_FORMAT ": %-21s = %s", addr, fieldbuf, valuebuf);
}
}
void ZeroFrame::identify_word(int frame_index,
int offset,
char* fieldbuf,
char* valuebuf,
int buflen) const {
switch (offset) {
case next_frame_off:
strncpy(fieldbuf, "next_frame", buflen);
break;
case frame_type_off:
strncpy(fieldbuf, "frame_type", buflen);
if (is_entry_frame())
strncpy(valuebuf, "ENTRY_FRAME", buflen);
else if (is_interpreter_frame())
strncpy(valuebuf, "INTERPRETER_FRAME", buflen);
else if (is_shark_frame())
strncpy(valuebuf, "SHARK_FRAME", buflen);
else if (is_fake_stub_frame())
strncpy(valuebuf, "FAKE_STUB_FRAME", buflen);
break;
default:
if (is_entry_frame()) {
as_entry_frame()->identify_word(
frame_index, offset, fieldbuf, valuebuf, buflen);
}
else if (is_interpreter_frame()) {
as_interpreter_frame()->identify_word(
frame_index, offset, fieldbuf, valuebuf, buflen);
}
else if (is_shark_frame()) {
as_shark_frame()->identify_word(
frame_index, offset, fieldbuf, valuebuf, buflen);
}
else if (is_fake_stub_frame()) {
as_fake_stub_frame()->identify_word(
frame_index, offset, fieldbuf, valuebuf, buflen);
}
}
}
void EntryFrame::identify_word(int frame_index,
int offset,
char* fieldbuf,
char* valuebuf,
int buflen) const {
switch (offset) {
case call_wrapper_off:
strncpy(fieldbuf, "call_wrapper", buflen);
break;
default:
snprintf(fieldbuf, buflen, "local[%d]", offset - 3);
}
}
void InterpreterFrame::identify_word(int frame_index,
int offset,
char* fieldbuf,
char* valuebuf,
int buflen) const {
interpreterState istate = interpreter_state();
bool is_valid = istate->self_link() == istate;
intptr_t *addr = addr_of_word(offset);
// Fixed part
if (addr >= (intptr_t *) istate) {
const char *field = istate->name_of_field_at_address((address) addr);
if (field) {
if (is_valid && !strcmp(field, "_method")) {
istate->method()->name_and_sig_as_C_string(valuebuf, buflen);
}
else if (is_valid && !strcmp(field, "_bcp") && istate->bcp()) {
snprintf(valuebuf, buflen, PTR_FORMAT " (bci %d)",
(intptr_t) istate->bcp(),
istate->method()->bci_from(istate->bcp()));
}
snprintf(fieldbuf, buflen, "%sistate->%s",
field[strlen(field) - 1] == ')' ? "(": "", field);
}
else if (addr == (intptr_t *) istate) {
strncpy(fieldbuf, "(vtable for istate)", buflen);
}
return;
}
// Variable part
if (!is_valid)
return;
// JNI stuff
if (istate->method()->is_native() && addr < istate->stack_base()) {
address hA = istate->method()->signature_handler();
if (hA != NULL) {
if (hA != (address) InterpreterRuntime::slow_signature_handler) {
InterpreterRuntime::SignatureHandler *handler =
InterpreterRuntime::SignatureHandler::from_handlerAddr(hA);
intptr_t *params = istate->stack_base() - handler->argument_count();
if (addr >= params) {
int param = addr - params;
const char *desc = "";
if (param == 0)
desc = " (JNIEnv)";
else if (param == 1) {
if (istate->method()->is_static())
desc = " (mirror)";
else
desc = " (this)";
}
snprintf(fieldbuf, buflen, "parameter[%d]%s", param, desc);
return;
}
for (int i = 0; i < handler->argument_count(); i++) {
if (params[i] == (intptr_t) addr) {
snprintf(fieldbuf, buflen, "unboxed parameter[%d]", i);
return;
}
}
}
}
return;
}
// Monitors and stack
identify_vp_word(frame_index, addr,
(intptr_t *) istate->monitor_base(),
istate->stack_base(),
fieldbuf, buflen);
}
void SharkFrame::identify_word(int frame_index,
int offset,
char* fieldbuf,
char* valuebuf,
int buflen) const {
// Fixed part
switch (offset) {
case pc_off:
strncpy(fieldbuf, "pc", buflen);
if (method()->is_oop()) {
nmethod *code = method()->code();
if (code && code->pc_desc_at(pc())) {
SimpleScopeDesc ssd(code, pc());
snprintf(valuebuf, buflen, PTR_FORMAT " (bci %d)",
(intptr_t) pc(), ssd.bci());
}
}
return;
case unextended_sp_off:
strncpy(fieldbuf, "unextended_sp", buflen);
return;
case method_off:
strncpy(fieldbuf, "method", buflen);
if (method()->is_oop()) {
method()->name_and_sig_as_C_string(valuebuf, buflen);
}
return;
case oop_tmp_off:
strncpy(fieldbuf, "oop_tmp", buflen);
return;
}
// Variable part
if (method()->is_oop()) {
identify_vp_word(frame_index, addr_of_word(offset),
addr_of_word(header_words + 1),
unextended_sp() + method()->max_stack(),
fieldbuf, buflen);
}
}
void ZeroFrame::identify_vp_word(int frame_index,
intptr_t* addr,
intptr_t* monitor_base,
intptr_t* stack_base,
char* fieldbuf,
int buflen) const {
// Monitors
if (addr >= stack_base && addr < monitor_base) {
int monitor_size = frame::interpreter_frame_monitor_size();
int last_index = (monitor_base - stack_base) / monitor_size - 1;
int index = last_index - (addr - stack_base) / monitor_size;
intptr_t monitor = (intptr_t) (
(BasicObjectLock *) monitor_base - 1 - index);
intptr_t offset = (intptr_t) addr - monitor;
if (offset == BasicObjectLock::obj_offset_in_bytes())
snprintf(fieldbuf, buflen, "monitor[%d]->_obj", index);
else if (offset == BasicObjectLock::lock_offset_in_bytes())
snprintf(fieldbuf, buflen, "monitor[%d]->_lock", index);
return;
}
// Expression stack
if (addr < stack_base) {
snprintf(fieldbuf, buflen, "%s[%d]",
frame_index == 0 ? "stack_word" : "local",
(int) (stack_base - addr - 1));
return;
}
}
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// A frame represents a physical stack frame on the Zero stack.
public:
enum {
pc_return_offset = 0
};
// Constructor
public:
frame(intptr_t* sp, intptr_t* fp);
// The sp of a Zero frame is the address of the highest word in
// that frame. We keep track of the lowest address too, so the
// boundaries of the frame are available for debug printing.
private:
intptr_t* _fp;
public:
intptr_t* fp() const {
return _fp;
}
#ifdef CC_INTERP
inline interpreterState get_interpreterState() const;
#endif // CC_INTERP
public:
const ZeroFrame *zeroframe() const {
return (ZeroFrame *) sp();
}
const EntryFrame *zero_entryframe() const {
return zeroframe()->as_entry_frame();
}
const InterpreterFrame *zero_interpreterframe() const {
return zeroframe()->as_interpreter_frame();
}
const SharkFrame *zero_sharkframe() const {
return zeroframe()->as_shark_frame();
}
public:
bool is_fake_stub_frame() const;
public:
frame sender_for_fake_stub_frame(RegisterMap* map) const;
public:
void zero_print_on_error(int index,
outputStream* st,
char* buf,
int buflen) const;
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// Constructors
inline frame::frame() {
_sp = NULL;
_fp = NULL;
_pc = NULL;
_cb = NULL;
_deopt_state = unknown;
}
inline frame::frame(intptr_t* sp, intptr_t* fp) {
_sp = sp;
_fp = fp;
switch (zeroframe()->type()) {
case ZeroFrame::ENTRY_FRAME:
_pc = StubRoutines::call_stub_return_pc();
_cb = NULL;
break;
case ZeroFrame::INTERPRETER_FRAME:
_pc = NULL;
_cb = NULL;
break;
case ZeroFrame::SHARK_FRAME:
_pc = zero_sharkframe()->pc();
_cb = CodeCache::find_blob_unsafe(pc());
break;
case ZeroFrame::FAKE_STUB_FRAME:
_pc = NULL;
_cb = NULL;
break;
default:
ShouldNotReachHere();
}
_deopt_state = not_deoptimized;
}
// Accessors
inline intptr_t* frame::sender_sp() const {
return (intptr_t *) zeroframe()->next();
}
inline intptr_t* frame::link() const {
ShouldNotCallThis();
}
#ifdef CC_INTERP
inline interpreterState frame::get_interpreterState() const {
return zero_interpreterframe()->interpreter_state();
}
inline intptr_t** frame::interpreter_frame_locals_addr() const {
return &(get_interpreterState()->_locals);
}
inline intptr_t* frame::interpreter_frame_bcx_addr() const {
return (intptr_t*) &(get_interpreterState()->_bcp);
}
inline constantPoolCacheOop* frame::interpreter_frame_cache_addr() const {
return &(get_interpreterState()->_constants);
}
inline methodOop* frame::interpreter_frame_method_addr() const {
return &(get_interpreterState()->_method);
}
inline intptr_t* frame::interpreter_frame_mdx_addr() const {
return (intptr_t*) &(get_interpreterState()->_mdx);
}
inline intptr_t* frame::interpreter_frame_tos_address() const {
return get_interpreterState()->_stack + 1;
}
#endif // CC_INTERP
inline int frame::interpreter_frame_monitor_size() {
return BasicObjectLock::size();
}
inline intptr_t* frame::interpreter_frame_expression_stack() const {
intptr_t* monitor_end = (intptr_t*) interpreter_frame_monitor_end();
return monitor_end - 1;
}
inline jint frame::interpreter_frame_expression_stack_direction() {
return -1;
}
// Return a unique id for this frame. The id must have a value where
// we can distinguish identity and younger/older relationship. NULL
// represents an invalid (incomparable) frame.
inline intptr_t* frame::id() const {
return sp();
}
inline JavaCallWrapper* frame::entry_frame_call_wrapper() const {
return zero_entryframe()->call_wrapper();
}
inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {
ShouldNotCallThis();
}
inline oop frame::saved_oop_result(RegisterMap* map) const {
ShouldNotCallThis();
}
inline bool frame::is_older(intptr_t* id) const {
ShouldNotCallThis();
}
inline intptr_t* frame::entry_frame_argument_at(int offset) const {
ShouldNotCallThis();
}
inline intptr_t* frame::unextended_sp() const {
if (zeroframe()->is_shark_frame())
return zero_sharkframe()->unextended_sp();
else
return (intptr_t *) -1;
}
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include <ffi.h>
/*
* Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
//
// Set the default values for platform dependent flags used by the
// runtime system. See globals.hpp for details of what they do.
//
define_pd_global(bool, ConvertSleepToYield, true);
define_pd_global(bool, ShareVtableStubs, true);
define_pd_global(bool, CountInterpCalls, true);
define_pd_global(bool, NeedsDeoptSuspend, false);
define_pd_global(bool, ImplicitNullChecks, true);
define_pd_global(bool, UncommonNullCast, true);
define_pd_global(intx, CodeEntryAlignment, 32);
define_pd_global(uintx, TLABSize, 0);
#ifdef _LP64
define_pd_global(uintx, NewSize, ScaleForWordSize(2048 * K));
#else
define_pd_global(uintx, NewSize, ScaleForWordSize(1024 * K));
#endif // _LP64
define_pd_global(intx, InlineFrequencyCount, 100);
define_pd_global(intx, InlineSmallCode, 1000);
define_pd_global(intx, PreInflateSpin, 10);
define_pd_global(intx, StackYellowPages, 2);
define_pd_global(intx, StackRedPages, 1);
define_pd_global(intx, StackShadowPages, 3 LP64_ONLY(+3) DEBUG_ONLY(+3));
define_pd_global(bool, RewriteBytecodes, true);
define_pd_global(bool, RewriteFrequentPairs, true);
/*
* Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_icBuffer_zero.cpp.incl"
int InlineCacheBuffer::ic_stub_code_size() {
// NB set this once the functions below are implemented
return 4;
}
void InlineCacheBuffer::assemble_ic_buffer_code(address code_begin,
oop cached_oop,
address entry_point) {
// NB ic_stub_code_size() must return the size of the code we generate
ShouldNotCallThis();
}
address InlineCacheBuffer::ic_buffer_entry_point(address code_begin) {
// NB ic_stub_code_size() must return the size of the code we generate
ShouldNotCallThis();
}
oop InlineCacheBuffer::ic_buffer_cached_oop(address code_begin) {
// NB ic_stub_code_size() must return the size of the code we generate
ShouldNotCallThis();
}
/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_icache_zero.cpp.incl"
void ICacheStubGenerator::generate_icache_flush(
ICache::flush_icache_stub_t* flush_icache_stub) {
ShouldNotCallThis();
}
/*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// Interface for updating the instruction cache. Whenever the VM
// modifies code, part of the processor instruction cache potentially
// has to be flushed. This implementation is empty: Zero never deals
// with code, and LLVM handles cache flushing for Shark.
class ICache : public AbstractICache {
public:
static void initialize() {}
static void invalidate_word(address addr) {}
static void invalidate_range(address start, int nbytes) {}
};
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file is intentionally empty
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file specializes the assember with interpreter-specific macros
class InterpreterMacroAssembler : public MacroAssembler {
public:
InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {}
public:
RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr,
Register tmp,
int offset) {
ShouldNotCallThis();
}
};
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#ifdef CC_INTERP
// | ... |
// +--------------------+ ------------------
// | stack slot n-1 | low addresses
// | ... |
// | stack slot 0 |
// | monitor 0 (maybe) |
// | ... |
// | interpreter state |
// | ... |
// | frame_type |
// | next_frame | high addresses
// +--------------------+ ------------------
// | ... |
class InterpreterFrame : public ZeroFrame {
friend class AbstractInterpreter;
private:
InterpreterFrame() : ZeroFrame() {
ShouldNotCallThis();
}
protected:
enum Layout {
istate_off = jf_header_words +
(align_size_up_(sizeof(BytecodeInterpreter),
wordSize) >> LogBytesPerWord) - 1,
header_words
};
public:
static InterpreterFrame *build(ZeroStack* stack,
const methodOop method,
JavaThread* thread);
static InterpreterFrame *build(ZeroStack* stack, int size);
public:
interpreterState interpreter_state() const {
return (interpreterState) addr_of_word(istate_off);
}
public:
void identify_word(int frame_index,
int offset,
char* fieldbuf,
char* valuebuf,
int buflen) const;
};
#endif // CC_INTERP
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// Generation of Interpreter
//
friend class AbstractInterpreterGenerator;
private:
address generate_normal_entry(bool synchronized);
address generate_native_entry(bool synchronized);
address generate_abstract_entry();
address generate_math_entry(AbstractInterpreter::MethodKind kind);
address generate_empty_entry();
address generate_accessor_entry();
address generate_method_handle_entry();
/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_interpreterRT_zero.cpp.incl"
void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_int() {
push(T_INT);
_cif->nargs++;
}
void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_long() {
push(T_LONG);
_cif->nargs++;
}
void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_float() {
push(T_FLOAT);
_cif->nargs++;
}
void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_double() {
push(T_DOUBLE);
_cif->nargs++;
}
void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_object() {
push(T_OBJECT);
_cif->nargs++;
}
void InterpreterRuntime::SignatureHandlerGeneratorBase::push(BasicType type) {
ffi_type *ftype;
switch (type) {
case T_VOID:
ftype = &ffi_type_void;
break;
case T_BOOLEAN:
ftype = &ffi_type_uint8;
break;
case T_CHAR:
ftype = &ffi_type_uint16;
break;
case T_BYTE:
ftype = &ffi_type_sint8;
break;
case T_SHORT:
ftype = &ffi_type_sint16;
break;
case T_INT:
ftype = &ffi_type_sint32;
break;
case T_LONG:
ftype = &ffi_type_sint64;
break;
case T_FLOAT:
ftype = &ffi_type_float;
break;
case T_DOUBLE:
ftype = &ffi_type_double;
break;
case T_OBJECT:
case T_ARRAY:
ftype = &ffi_type_pointer;
break;
default:
ShouldNotReachHere();
}
push((intptr_t) ftype);
}
// For fast signature handlers the "signature handler" is generated
// into a temporary buffer. It is then copied to its final location,
// and pd_set_handler is called on it. We have this two stage thing
// to accomodate this.
void InterpreterRuntime::SignatureHandlerGeneratorBase::generate(
uint64_t fingerprint) {
// Build the argument types list
pass_object();
if (method()->is_static())
pass_object();
iterate(fingerprint);
// Tack on the result type
push(method()->result_type());
}
void InterpreterRuntime::SignatureHandler::finalize() {
ffi_status status =
ffi_prep_cif(cif(),
FFI_DEFAULT_ABI,
argument_count(),
result_type(),
argument_types());
assert(status == FFI_OK, "should be");
}
IRT_ENTRY(address,
InterpreterRuntime::slow_signature_handler(JavaThread* thread,
methodOop method,
intptr_t* unused1,
intptr_t* unused2))
ZeroStack *stack = thread->zero_stack();
int required_words =
(align_size_up(sizeof(ffi_cif), wordSize) >> LogBytesPerWord) +
(method->is_static() ? 2 : 1) + method->size_of_parameters() + 1;
if (required_words > stack->available_words()) {
Unimplemented();
}
intptr_t *buf = (intptr_t *) stack->alloc(required_words * wordSize);
SlowSignatureHandlerGenerator sshg(methodHandle(thread, method), buf);
sshg.generate(UCONST64(-1));
SignatureHandler *handler = sshg.handler();
handler->finalize();
return (address) handler;
IRT_END
void SignatureHandlerLibrary::pd_set_handler(address handlerAddr) {
InterpreterRuntime::SignatureHandler *handler =
InterpreterRuntime::SignatureHandler::from_handlerAddr(handlerAddr);
handler->finalize();
}
/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
class SignatureHandler {
public:
static SignatureHandler *from_handlerAddr(address handlerAddr) {
return (SignatureHandler *) handlerAddr;
}
public:
ffi_cif* cif() const {
return (ffi_cif *) this;
}
int argument_count() const {
return cif()->nargs;
}
ffi_type** argument_types() const {
return (ffi_type**) (cif() + 1);
}
ffi_type* argument_type(int i) const {
return argument_types()[i];
}
ffi_type* result_type() const {
return *(argument_types() + argument_count());
}
protected:
friend class InterpreterRuntime;
friend class SignatureHandlerLibrary;
void finalize();
};
class SignatureHandlerGeneratorBase : public NativeSignatureIterator {
private:
ffi_cif* _cif;
protected:
SignatureHandlerGeneratorBase(methodHandle method, ffi_cif *cif)
: NativeSignatureIterator(method), _cif(cif) {
_cif->nargs = 0;
}
ffi_cif *cif() const {
return _cif;
}
public:
void generate(uint64_t fingerprint);
private:
void pass_int();
void pass_long();
void pass_float();
void pass_double();
void pass_object();
private:
void push(BasicType type);
virtual void push(intptr_t value) = 0;
};
class SignatureHandlerGenerator : public SignatureHandlerGeneratorBase {
private:
CodeBuffer* _cb;
public:
SignatureHandlerGenerator(methodHandle method, CodeBuffer* buffer)
: SignatureHandlerGeneratorBase(method, (ffi_cif *) buffer->code_end()),
_cb(buffer) {
_cb->set_code_end((address) (cif() + 1));
}
private:
void push(intptr_t value) {
intptr_t *dst = (intptr_t *) _cb->code_end();
_cb->set_code_end((address) (dst + 1));
*dst = value;
}
};
class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase {
private:
intptr_t *_dst;
public:
SlowSignatureHandlerGenerator(methodHandle method, intptr_t* buf)
: SignatureHandlerGeneratorBase(method, (ffi_cif *) buf) {
_dst = (intptr_t *) (cif() + 1);
}
private:
void push(intptr_t value) {
*(_dst++) = value;
}
public:
SignatureHandler *handler() const {
return (SignatureHandler *) cif();
}
};
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_interpreter_zero.cpp.incl"
address AbstractInterpreterGenerator::generate_slow_signature_handler() {
_masm->advance(1);
return (address) InterpreterRuntime::slow_signature_handler;
}
address InterpreterGenerator::generate_math_entry(
AbstractInterpreter::MethodKind kind) {
if (!InlineIntrinsics)
return NULL;
Unimplemented();
}
address InterpreterGenerator::generate_abstract_entry() {
return ShouldNotCallThisEntry();
}
address InterpreterGenerator::generate_method_handle_entry() {
return ShouldNotCallThisEntry();
}
int AbstractInterpreter::size_activation(methodOop method,
int tempcount,
int popframe_extra_args,
int moncount,
int callee_param_count,
int callee_locals,
bool is_top_frame) {
return layout_activation(method,
tempcount,
popframe_extra_args,
moncount,
callee_param_count,
callee_locals,
(frame*) NULL,
(frame*) NULL,
is_top_frame);
}
void Deoptimization::unwind_callee_save_values(frame* f,
vframeArray* vframe_array) {
}
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
public:
static void invoke_method(methodOop method, address entry_point, TRAPS) {
((ZeroEntry *) entry_point)->invoke(method, THREAD);
}
static void invoke_osr(methodOop method,
address entry_point,
address osr_buf,
TRAPS) {
((ZeroEntry *) entry_point)->invoke_osr(method, osr_buf, THREAD);
}
public:
static int expr_index_at(int i) {
return stackElementWords() * i;
}
static int expr_tag_index_at(int i) {
assert(TaggedStackInterpreter, "should not call this");
Unimplemented();
}
static int expr_offset_in_bytes(int i) {
return stackElementSize() * i;
}
static int expr_tag_offset_in_bytes(int i) {
assert(TaggedStackInterpreter, "should not call this");
Unimplemented();
}
static int local_index_at(int i) {
assert(i <= 0, "local direction already negated");
return stackElementWords() * i + (value_offset_in_bytes() / wordSize);
}
static int local_tag_index_at(int i) {
assert(TaggedStackInterpreter, "should not call this");
Unimplemented();
}
/*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
public:
// Each arch must define reset, save, restore
// These are used by objects that only care about:
// 1 - initializing a new state (thread creation, javaCalls)
// 2 - saving a current state (javaCalls)
// 3 - restoring an old state (javaCalls)
void clear() {
// clearing _last_Java_sp must be first
_last_Java_sp = NULL;
// fence?
_last_Java_pc = NULL;
}
void copy(JavaFrameAnchor* src) {
// In order to make sure the transition state is valid for "this"
// We must clear _last_Java_sp before copying the rest of the new
// data
//
// Hack Alert: Temporary bugfix for 4717480/4721647 To act like
// previous version (pd_cache_state) don't NULL _last_Java_sp
// unless the value is changing
//
if (_last_Java_sp != src->_last_Java_sp)
_last_Java_sp = NULL;
_last_Java_pc = src->_last_Java_pc;
// Must be last so profiler will always see valid frame if
// has_last_frame() is true
_last_Java_sp = src->_last_Java_sp;
}
bool walkable() {
return true;
}
void make_walkable(JavaThread* thread) {
// nothing to do
}
intptr_t* last_Java_sp() const {
return _last_Java_sp;
}
void set_last_Java_sp(intptr_t* sp) {
_last_Java_sp = sp;
}
/*
* Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_jniFastGetField_zero.cpp.incl"
address JNI_FastGetField::generate_fast_get_boolean_field() {
return (address) -1;
}
address JNI_FastGetField::generate_fast_get_byte_field() {
return (address) -1;
}
address JNI_FastGetField::generate_fast_get_char_field() {
return (address) -1;
}
address JNI_FastGetField::generate_fast_get_short_field() {
return (address) -1;
}
address JNI_FastGetField::generate_fast_get_int_field() {
return (address) -1;
}
address JNI_FastGetField::generate_fast_get_long_field() {
return (address) -1;
}
address JNI_FastGetField::generate_fast_get_float_field() {
return (address) -1;
}
address JNI_FastGetField::generate_fast_get_double_field() {
return (address) -1;
}
/*
* Copyright 1998-2002 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file holds platform-dependent routines used to write primitive jni
// types to the array of arguments passed into JavaCalls::call
class JNITypes : AllStatic {
// These functions write a java primitive type (in native format)
// to a java stack slot array to be passed as an argument to JavaCalls:calls.
// I.e., they are functionally 'push' operations if they have a 'pos'
// formal parameter. Note that jlong's and jdouble's are written
// _in reverse_ of the order in which they appear in the interpreter
// stack. This is because call stubs (see stubGenerator_zero.cpp)
// reverse the argument list constructed by JavaCallArguments (see
// javaCalls.hpp).
private:
// Helper routines.
static inline void put_int2 (jint *from, jint *to) { to[0] = from[0]; to[1] = from[1]; }
static inline void put_int2 (jint *from, jint *to, int& pos) { put_int2 (from, (jint *)((intptr_t *)to + pos)); pos += 2; }
static inline void put_int2r(jint *from, jint *to) { to[0] = from[1]; to[1] = from[0]; }
static inline void put_int2r(jint *from, jint *to, int& pos) { put_int2r(from, (jint *)((intptr_t *)to + pos)); pos += 2; }
public:
// Ints are stored in native format in one JavaCallArgument slot at *to.
static inline void put_int(jint from, intptr_t *to) { *(jint *)(to + 0 ) = from; }
static inline void put_int(jint from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = from; }
static inline void put_int(jint *from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = *from; }
#ifdef _LP64
// Longs are stored in native format in one JavaCallArgument slot at *(to+1).
static inline void put_long(jlong from, intptr_t *to) { *(jlong *)(to + 1 + 0) = from; }
static inline void put_long(jlong from, intptr_t *to, int& pos) { *(jlong *)(to + 1 + pos) = from; pos += 2; }
static inline void put_long(jlong *from, intptr_t *to, int& pos) { *(jlong *)(to + 1 + pos) = *from; pos += 2; }
#else
// Longs are stored in reversed native word format in two JavaCallArgument slots at *to.
// The high half is in *(to+1) and the low half in *to.
static inline void put_long(jlong from, intptr_t *to) { put_int2r((jint *)&from, (jint *)to); }
static inline void put_long(jlong from, intptr_t *to, int& pos) { put_int2r((jint *)&from, (jint *)to, pos); }
static inline void put_long(jlong *from, intptr_t *to, int& pos) { put_int2r((jint *) from, (jint *)to, pos); }
#endif
// Oops are stored in native format in one JavaCallArgument slot at *to.
static inline void put_obj(oop from, intptr_t *to) { *(oop *)(to + 0 ) = from; }
static inline void put_obj(oop from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = from; }
static inline void put_obj(oop *from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = *from; }
// Floats are stored in native format in one JavaCallArgument slot at *to.
static inline void put_float(jfloat from, intptr_t *to) { *(jfloat *)(to + 0 ) = from; }
static inline void put_float(jfloat from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = from; }
static inline void put_float(jfloat *from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = *from; }
#ifdef _LP64
// Doubles are stored in native word format in one JavaCallArgument slot at *(to+1).
static inline void put_double(jdouble from, intptr_t *to) { *(jdouble *)(to + 1 + 0) = from; }
static inline void put_double(jdouble from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) = from; pos += 2; }
static inline void put_double(jdouble *from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) = *from; pos += 2; }
#else
// Doubles are stored in reversed native word format in two JavaCallArgument slots at *to.
static inline void put_double(jdouble from, intptr_t *to) { put_int2r((jint *)&from, (jint *)to); }
static inline void put_double(jdouble from, intptr_t *to, int& pos) { put_int2r((jint *)&from, (jint *)to, pos); }
static inline void put_double(jdouble *from, intptr_t *to, int& pos) { put_int2r((jint *) from, (jint *)to, pos); }
#endif
// The get_xxx routines, on the other hand, actually _do_ fetch
// java primitive types from the interpreter stack.
static inline jint get_int(intptr_t *from) { return *(jint *)from; }
#ifdef _LP64
static inline jlong get_long(intptr_t *from) { return *(jlong *)from; }
#else
static inline jlong get_long(intptr_t *from) { return ((jlong)(*( signed int *)((jint *)from )) << 32) |
((jlong)(*(unsigned int *)((jint *)from + 1)) << 0); }
#endif
static inline oop get_obj(intptr_t *from) { return *(oop *)from; }
static inline jfloat get_float(intptr_t *from) { return *(jfloat *)from; }
#ifdef _LP64
static inline jdouble get_double(intptr_t *from) { return *(jdouble *)from; }
#else
static inline jdouble get_double(intptr_t *from) { jlong jl = ((jlong)(*( signed int *)((jint *)from )) << 32) |
((jlong)(*(unsigned int *)((jint *)from + 1)) << 0);
return *(jdouble *)&jl; }
#endif
};
/*
* Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
#define JNIEXPORT
#define JNIIMPORT
#define JNICALL
typedef int jint;
typedef signed char jbyte;
#ifdef _LP64
typedef long jlong;
#else
typedef long long jlong;
#endif
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file is intentionally empty
/*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_nativeInst_zero.cpp.incl"
// This method is called by nmethod::make_not_entrant_or_zombie to
// insert a jump to SharedRuntime::get_handle_wrong_method_stub()
// (dest) at the start of a compiled method (verified_entry) to avoid
// a race where a method is invoked while being made non-entrant.
//
// In Shark, verified_entry is a pointer to a SharkEntry. We can
// handle this simply by changing it's entry point to point at the
// interpreter. This only works because the interpreter and Shark
// calling conventions are the same.
void NativeJump::patch_verified_entry(address entry,
address verified_entry,
address dest) {
assert(dest == SharedRuntime::get_handle_wrong_method_stub(), "should be");
#ifdef CC_INTERP
((ZeroEntry*) verified_entry)->set_entry_point(
(address) CppInterpreter::normal_entry);
#else
Unimplemented();
#endif // CC_INTERP
}
/*
* Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// We have interfaces for the following instructions:
// - NativeInstruction
// - - NativeCall
// - - NativeMovConstReg
// - - NativeMovConstRegPatching
// - - NativeJump
// - - NativeIllegalOpCode
// - - NativeReturn
// - - NativeReturnX (return with argument)
// - - NativePushConst
// - - NativeTstRegMem
// The base class for different kinds of native instruction abstractions.
// Provides the primitive operations to manipulate code relative to this.
class NativeInstruction VALUE_OBJ_CLASS_SPEC {
public:
bool is_jump() {
ShouldNotCallThis();
}
bool is_safepoint_poll() {
ShouldNotCallThis();
}
};
inline NativeInstruction* nativeInstruction_at(address address) {
ShouldNotCallThis();
}
class NativeCall : public NativeInstruction {
public:
enum zero_specific_constants {
instruction_size = 0 // not used within the interpreter
};
address instruction_address() const {
ShouldNotCallThis();
}
address next_instruction_address() const {
ShouldNotCallThis();
}
address return_address() const {
ShouldNotCallThis();
}
address destination() const {
ShouldNotCallThis();
}
void set_destination_mt_safe(address dest) {
ShouldNotCallThis();
}
void verify_alignment() {
ShouldNotCallThis();
}
void verify() {
ShouldNotCallThis();
}
static bool is_call_before(address return_address) {
ShouldNotCallThis();
}
};
inline NativeCall* nativeCall_before(address return_address) {
ShouldNotCallThis();
}
inline NativeCall* nativeCall_at(address address) {
ShouldNotCallThis();
}
class NativeMovConstReg : public NativeInstruction {
public:
address next_instruction_address() const {
ShouldNotCallThis();
}
intptr_t data() const {
ShouldNotCallThis();
}
void set_data(intptr_t x) {
ShouldNotCallThis();
}
};
inline NativeMovConstReg* nativeMovConstReg_at(address address) {
ShouldNotCallThis();
}
class NativeMovRegMem : public NativeInstruction {
public:
int offset() const {
ShouldNotCallThis();
}
void set_offset(intptr_t x) {
ShouldNotCallThis();
}
void add_offset_in_bytes(int add_offset) {
ShouldNotCallThis();
}
};
inline NativeMovRegMem* nativeMovRegMem_at(address address) {
ShouldNotCallThis();
}
class NativeJump : public NativeInstruction {
public:
enum zero_specific_constants {
instruction_size = 0 // not used within the interpreter
};
address jump_destination() const {
ShouldNotCallThis();
}
void set_jump_destination(address dest) {
ShouldNotCallThis();
}
static void check_verified_entry_alignment(address entry,
address verified_entry) {
}
static void patch_verified_entry(address entry,
address verified_entry,
address dest);
};
inline NativeJump* nativeJump_at(address address) {
ShouldNotCallThis();
}
class NativeGeneralJump : public NativeInstruction {
public:
address jump_destination() const {
ShouldNotCallThis();
}
static void insert_unconditional(address code_pos, address entry) {
ShouldNotCallThis();
}
static void replace_mt_safe(address instr_addr, address code_buffer) {
ShouldNotCallThis();
}
};
inline NativeGeneralJump* nativeGeneralJump_at(address address) {
ShouldNotCallThis();
}
/*
* Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// machine-dependent implemention for register maps
friend class frame;
private:
// This is the hook for finding a register in an "well-known" location,
// such as a register block of a predetermined format.
// Since there is none, we just return NULL.
// See registerMap_sparc.hpp for an example of grabbing registers
// from register save areas of a standard layout.
address pd_location(VMReg reg) const { return NULL; }
// no PD state to clear or copy:
void pd_clear() {}
void pd_initialize() {}
void pd_initialize_from(const RegisterMap* map) {}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册