Tue, 13 Oct 2009 12:04:21 -0700
6890308: integrate zero assembler hotspot changes
Reviewed-by: never
Contributed-by: gbenson@redhat.com
1.1 --- a/make/Makefile Wed Oct 07 15:38:37 2009 -0700 1.2 +++ b/make/Makefile Tue Oct 13 12:04:21 2009 -0700 1.3 @@ -84,6 +84,7 @@ 1.4 C1_VM_TARGETS=product1 fastdebug1 optimized1 jvmg1 1.5 C2_VM_TARGETS=product fastdebug optimized jvmg 1.6 KERNEL_VM_TARGETS=productkernel fastdebugkernel optimizedkernel jvmgkernel 1.7 +ZERO_VM_TARGETS=productzero fastdebugzero optimizedzero jvmgzero 1.8 1.9 # JDK directory list 1.10 JDK_DIRS=bin include jre lib demo 1.11 @@ -94,6 +95,12 @@ 1.12 all_debug: jvmg jvmg1 jvmgkernel docs export_debug 1.13 all_optimized: optimized optimized1 optimizedkernel docs export_optimized 1.14 1.15 +allzero: all_productzero all_fastdebugzero 1.16 +all_productzero: productzero docs export_product 1.17 +all_fastdebugzero: fastdebugzero docs export_fastdebug 1.18 +all_debugzero: jvmgzero docs export_debug 1.19 +all_optimizedzero: optimizedzero docs export_optimized 1.20 + 1.21 # Do everything 1.22 world: all create_jdk 1.23 1.24 @@ -120,6 +127,10 @@ 1.25 $(CD) $(GAMMADIR)/make; \ 1.26 $(MAKE) VM_TARGET=$@ generic_buildkernel $(ALT_OUT) 1.27 1.28 +$(ZERO_VM_TARGETS): 1.29 + $(CD) $(GAMMADIR)/make; \ 1.30 + $(MAKE) VM_TARGET=$@ generic_buildzero $(ALT_OUT) 1.31 + 1.32 # Build compiler1 (client) rule, different for platforms 1.33 generic_build1: 1.34 $(MKDIR) -p $(OUTPUTDIR) 1.35 @@ -180,6 +191,12 @@ 1.36 @$(ECHO) "No kernel ($(VM_TARGET)) for OS_NAME=$(OSNAME)" 1.37 endif 1.38 1.39 +generic_buildzero: 1.40 + $(MKDIR) -p $(OUTPUTDIR) 1.41 + $(CD) $(OUTPUTDIR); \ 1.42 + $(MAKE) -f $(ABS_OS_MAKEFILE) \ 1.43 + $(MAKE_ARGS) $(VM_TARGET) 1.44 + 1.45 # Export file rule 1.46 generic_export: $(EXPORT_LIST) 1.47 export_product: 1.48 @@ -210,11 +227,17 @@ 1.49 C1_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler1 1.50 C2_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2 1.51 KERNEL_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_kernel 1.52 +ZERO_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_zero 1.53 C1_DIR=$(C1_BASE_DIR)/$(VM_SUBDIR) 1.54 C2_DIR=$(C2_BASE_DIR)/$(VM_SUBDIR) 1.55 KERNEL_DIR=$(KERNEL_BASE_DIR)/$(VM_SUBDIR) 1.56 +ZERO_DIR=$(ZERO_BASE_DIR)/$(VM_SUBDIR) 1.57 1.58 # Misc files and generated files need to come from C1 or C2 area 1.59 +ifeq ($(ZERO_BUILD), true) 1.60 + MISC_DIR=$(ZERO_DIR) 1.61 + GEN_DIR=$(ZERO_BASE_DIR)/generated 1.62 +else 1.63 ifeq ($(ARCH_DATA_MODEL), 32) 1.64 MISC_DIR=$(C1_DIR) 1.65 GEN_DIR=$(C1_BASE_DIR)/generated 1.66 @@ -222,6 +245,7 @@ 1.67 MISC_DIR=$(C2_DIR) 1.68 GEN_DIR=$(C2_BASE_DIR)/generated 1.69 endif 1.70 +endif 1.71 1.72 # Bin files (windows) 1.73 ifeq ($(OSNAME),windows) 1.74 @@ -265,6 +289,12 @@ 1.75 1.76 # Shared Library 1.77 ifneq ($(OSNAME),windows) 1.78 + ifeq ($(ZERO_BUILD), true) 1.79 +$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(ZERO_DIR)/%.so 1.80 + $(install-file) 1.81 +$(EXPORT_SERVER_DIR)/%.so: $(ZERO_DIR)/%.so 1.82 + $(install-file) 1.83 + else 1.84 $(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so 1.85 $(install-file) 1.86 $(EXPORT_CLIENT_DIR)/%.so: $(C1_DIR)/%.so 1.87 @@ -275,6 +305,7 @@ 1.88 $(install-file) 1.89 $(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so 1.90 $(install-file) 1.91 + endif 1.92 endif 1.93 1.94 # Jar file (sa-jdi.jar) 1.95 @@ -313,6 +344,7 @@ 1.96 $(RM) -r $(C1_DIR) 1.97 $(RM) -r $(C2_DIR) 1.98 $(RM) -r $(KERNEL_DIR) 1.99 + $(RM) -r $(ZERO_DIR) 1.100 clean_export: 1.101 $(RM) -r $(EXPORT_PATH) 1.102 clean_jdk: 1.103 @@ -335,8 +367,10 @@ 1.104 ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -) 1.105 1.106 test_jdk: 1.107 - ifeq ($(ARCH_DATA_MODEL), 32) 1.108 + ifneq ($(ZERO_BUILD), true) 1.109 + ifeq ($(ARCH_DATA_MODEL), 32) 1.110 $(JDK_IMAGE_DIR)/bin/java -client -version 1.111 + endif 1.112 endif 1.113 $(JDK_IMAGE_DIR)/bin/java -server -version 1.114
2.1 --- a/make/defs.make Wed Oct 07 15:38:37 2009 -0700 2.2 +++ b/make/defs.make Tue Oct 13 12:04:21 2009 -0700 2.3 @@ -192,13 +192,14 @@ 2.4 2.5 # Use uname output for SRCARCH, but deal with platform differences. If ARCH 2.6 # is not explicitly listed below, it is treated as x86. 2.7 - SRCARCH = $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64,$(ARCH))) 2.8 + SRCARCH = $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 zero,$(ARCH))) 2.9 ARCH/ = x86 2.10 ARCH/sparc = sparc 2.11 ARCH/sparc64= sparc 2.12 ARCH/ia64 = ia64 2.13 ARCH/amd64 = x86 2.14 ARCH/x86_64 = x86 2.15 + ARCH/zero = zero 2.16 2.17 # BUILDARCH is usually the same as SRCARCH, except for sparcv9 2.18 BUILDARCH = $(SRCARCH) 2.19 @@ -222,8 +223,9 @@ 2.20 LIBARCH/sparc = sparc 2.21 LIBARCH/sparcv9 = sparcv9 2.22 LIBARCH/ia64 = ia64 2.23 + LIBARCH/zero = $(ZERO_LIBARCH) 2.24 2.25 - LP64_ARCH = sparcv9 amd64 ia64 2.26 + LP64_ARCH = sparcv9 amd64 ia64 zero 2.27 endif 2.28 2.29 # Required make macro settings for all platforms
3.1 --- a/make/linux/Makefile Wed Oct 07 15:38:37 2009 -0700 3.2 +++ b/make/linux/Makefile Tue Oct 13 12:04:21 2009 -0700 3.3 @@ -132,6 +132,9 @@ 3.4 3.5 endif 3.6 3.7 +# BUILDARCH is set to "zero" for Zero builds. VARIANTARCH 3.8 +# is used to give the build directories meaningful names. 3.9 +VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH)) 3.10 3.11 # There is a (semi-) regular correspondence between make targets and actions: 3.12 # 3.13 @@ -158,6 +161,13 @@ 3.14 # profiledcore core <os>_<arch>_core/profiled 3.15 # productcore core <os>_<arch>_core/product 3.16 # 3.17 +# debugzero zero <os>_<arch>_zero/debug 3.18 +# fastdebugzero zero <os>_<arch>_zero/fastdebug 3.19 +# jvmgzero zero <os>_<arch>_zero/jvmg 3.20 +# optimizedzero zero <os>_<arch>_zero/optimized 3.21 +# profiledzero zero <os>_<arch>_zero/profiled 3.22 +# productzero zero <os>_<arch>_zero/product 3.23 +# 3.24 # What you get with each target: 3.25 # 3.26 # debug* - "thin" libjvm_g - debug info linked into the gamma_g launcher 3.27 @@ -171,16 +181,22 @@ 3.28 # in the build.sh script: 3.29 TARGETS = debug jvmg fastdebug optimized profiled product 3.30 3.31 -SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs 3.32 +ifeq ($(ZERO_BUILD), true) 3.33 + SUBDIR_DOCS = $(OSNAME)_$(VARIANTARCH)_docs 3.34 +else 3.35 + SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs 3.36 +endif 3.37 SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS)) 3.38 SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS)) 3.39 SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS)) 3.40 SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS)) 3.41 +SUBDIRS_ZERO = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS)) 3.42 3.43 TARGETS_C2 = $(TARGETS) 3.44 TARGETS_C1 = $(addsuffix 1,$(TARGETS)) 3.45 TARGETS_TIERED = $(addsuffix tiered,$(TARGETS)) 3.46 TARGETS_CORE = $(addsuffix core,$(TARGETS)) 3.47 +TARGETS_ZERO = $(addsuffix zero,$(TARGETS)) 3.48 3.49 BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make 3.50 BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) 3.51 @@ -196,6 +212,7 @@ 3.52 @echo " $(TARGETS_C2)" 3.53 @echo " $(TARGETS_C1)" 3.54 @echo " $(TARGETS_CORE)" 3.55 + @echo " $(TARGETS_ZERO)" 3.56 3.57 checks: check_os_version check_j2se_version 3.58 3.59 @@ -245,6 +262,13 @@ 3.60 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 3.61 $(BUILDTREE) VARIANT=core 3.62 3.63 +$(SUBDIRS_ZERO): $(BUILDTREE_MAKE) platform_zero 3.64 + $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 3.65 + $(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH) 3.66 + 3.67 +platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in 3.68 + $(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@ 3.69 + 3.70 # Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME 3.71 3.72 $(TARGETS_C2): $(SUBDIRS_C2) 3.73 @@ -275,10 +299,18 @@ 3.74 cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install 3.75 endif 3.76 3.77 +$(TARGETS_ZERO): $(SUBDIRS_ZERO) 3.78 + cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) 3.79 + cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && ./test_gamma 3.80 +ifdef INSTALL 3.81 + cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install 3.82 +endif 3.83 + 3.84 # Just build the tree, and nothing else: 3.85 tree: $(SUBDIRS_C2) 3.86 tree1: $(SUBDIRS_C1) 3.87 treecore: $(SUBDIRS_CORE) 3.88 +treezero: $(SUBDIRS_ZERO) 3.89 3.90 # Doc target. This is the same for all build options. 3.91 # Hence create a docs directory beside ...$(ARCH)_[...] 3.92 @@ -293,20 +325,22 @@ 3.93 3.94 core: jvmgcore productcore 3.95 3.96 +zero: jvmgzero productzero 3.97 + 3.98 clean_docs: 3.99 rm -rf $(SUBDIR_DOCS) 3.100 3.101 -clean_compiler1 clean_compiler2 clean_core: 3.102 +clean_compiler1 clean_compiler2 clean_core clean_zero: 3.103 rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@) 3.104 3.105 -clean: clean_compiler2 clean_compiler1 clean_core clean_docs 3.106 +clean: clean_compiler2 clean_compiler1 clean_core clean_zero clean_docs 3.107 3.108 include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make 3.109 3.110 #------------------------------------------------------------------------------- 3.111 3.112 -.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) 3.113 -.PHONY: tree tree1 treecore 3.114 -.PHONY: all compiler1 compiler2 core 3.115 -.PHONY: clean clean_compiler1 clean_compiler2 clean_core docs clean_docs 3.116 +.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) 3.117 +.PHONY: tree tree1 treecore treezero 3.118 +.PHONY: all compiler1 compiler2 core zero 3.119 +.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero docs clean_docs 3.120 .PHONY: checks check_os_version check_j2se_version
4.1 --- a/make/linux/makefiles/buildtree.make Wed Oct 07 15:38:37 2009 -0700 4.2 +++ b/make/linux/makefiles/buildtree.make Tue Oct 13 12:04:21 2009 -0700 4.3 @@ -63,20 +63,30 @@ 4.4 # For now, until the compiler is less wobbly: 4.5 TESTFLAGS = -Xbatch -showversion 4.6 4.7 -ifdef USE_SUNCC 4.8 -PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc 4.9 +ifeq ($(ZERO_BUILD), true) 4.10 + PLATFORM_FILE = $(shell dirname $(shell dirname $(shell pwd)))/platform_zero 4.11 else 4.12 -PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH) 4.13 + ifdef USE_SUNCC 4.14 + PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc 4.15 + else 4.16 + PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH) 4.17 + endif 4.18 +endif 4.19 + 4.20 +# Allow overriding of the arch part of the directory but default 4.21 +# to BUILDARCH if nothing is specified 4.22 +ifeq ($(VARIANTARCH),) 4.23 + VARIANTARCH=$(BUILDARCH) 4.24 endif 4.25 4.26 ifdef FORCE_TIERED 4.27 ifeq ($(VARIANT),tiered) 4.28 -PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_compiler2 4.29 +PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_compiler2 4.30 else 4.31 -PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_$(VARIANT) 4.32 +PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT) 4.33 endif 4.34 else 4.35 -PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_$(VARIANT) 4.36 +PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT) 4.37 endif 4.38 4.39 # 4.40 @@ -321,6 +331,7 @@ 4.41 DATA_MODE/sparcv9 = 64 4.42 DATA_MODE/amd64 = 64 4.43 DATA_MODE/ia64 = 64 4.44 +DATA_MODE/zero = $(ARCH_DATA_MODEL) 4.45 4.46 JAVA_FLAG/32 = -d32 4.47 JAVA_FLAG/64 = -d64
5.1 --- a/make/linux/makefiles/defs.make Wed Oct 07 15:38:37 2009 -0700 5.2 +++ b/make/linux/makefiles/defs.make Tue Oct 13 12:04:21 2009 -0700 5.3 @@ -37,6 +37,17 @@ 5.4 ARCH_DATA_MODEL ?= 32 5.5 endif 5.6 5.7 +# zero 5.8 +ifeq ($(ZERO_BUILD), true) 5.9 + ifeq ($(ARCH_DATA_MODEL), 64) 5.10 + MAKE_ARGS += LP64=1 5.11 + endif 5.12 + PLATFORM = linux-zero 5.13 + VM_PLATFORM = linux_$(subst i386,i486,$(ZERO_LIBARCH)) 5.14 + HS_ARCH = zero 5.15 + ARCH = zero 5.16 +endif 5.17 + 5.18 # ia64 5.19 ifeq ($(ARCH), ia64) 5.20 ARCH_DATA_MODEL = 64 5.21 @@ -97,17 +108,19 @@ 5.22 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt 5.23 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjsig.so 5.24 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so 5.25 -ifeq ($(ARCH_DATA_MODEL), 32) 5.26 - EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client 5.27 - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt 5.28 - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjsig.so 5.29 - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so 5.30 - EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so 5.31 - EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar 5.32 -else 5.33 - ifeq ($(ARCH),ia64) 5.34 - else 5.35 - EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so 5.36 - EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar 5.37 +ifneq ($(ZERO_BUILD), true) 5.38 + ifeq ($(ARCH_DATA_MODEL), 32) 5.39 + EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client 5.40 + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt 5.41 + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjsig.so 5.42 + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so 5.43 + EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so 5.44 + EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar 5.45 + else 5.46 + ifeq ($(ARCH),ia64) 5.47 + else 5.48 + EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so 5.49 + EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar 5.50 endif 5.51 + endif 5.52 endif
6.1 --- a/make/linux/makefiles/gcc.make Wed Oct 07 15:38:37 2009 -0700 6.2 +++ b/make/linux/makefiles/gcc.make Tue Oct 13 12:04:21 2009 -0700 6.3 @@ -52,6 +52,9 @@ 6.4 VM_PICFLAG/AOUT = 6.5 VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) 6.6 6.7 +ifeq ($(ZERO_BUILD), true) 6.8 +CFLAGS += $(LIBFFI_CFLAGS) 6.9 +endif 6.10 CFLAGS += $(VM_PICFLAG) 6.11 CFLAGS += -fno-rtti 6.12 CFLAGS += -fno-exceptions 6.13 @@ -64,6 +67,7 @@ 6.14 ARCHFLAG/ia64 = 6.15 ARCHFLAG/sparc = -m32 -mcpu=v9 6.16 ARCHFLAG/sparcv9 = -m64 -mcpu=v9 6.17 +ARCHFLAG/zero = $(ZERO_ARCHFLAG) 6.18 6.19 CFLAGS += $(ARCHFLAG) 6.20 AOUT_FLAGS += $(ARCHFLAG)
7.1 --- a/make/linux/makefiles/sa.make Wed Oct 07 15:38:37 2009 -0700 7.2 +++ b/make/linux/makefiles/sa.make Tue Oct 13 12:04:21 2009 -0700 7.3 @@ -52,10 +52,10 @@ 7.4 SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties 7.5 7.6 # if $(AGENT_DIR) does not exist, we don't build SA 7.7 -# also, we don't build SA on Itanium. 7.8 +# also, we don't build SA on Itanium or zero. 7.9 7.10 all: 7.11 - if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" ] ; then \ 7.12 + if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "zero" ] ; then \ 7.13 $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ 7.14 fi 7.15
8.1 --- a/make/linux/makefiles/saproc.make Wed Oct 07 15:38:37 2009 -0700 8.2 +++ b/make/linux/makefiles/saproc.make Tue Oct 13 12:04:21 2009 -0700 8.3 @@ -49,10 +49,10 @@ 8.4 endif 8.5 8.6 # if $(AGENT_DIR) does not exist, we don't build SA 8.7 -# also, we don't build SA on Itanium. 8.8 +# also, we don't build SA on Itanium or zero. 8.9 8.10 checkAndBuildSA: 8.11 - $(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" ] ; then \ 8.12 + $(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "zero" ] ; then \ 8.13 $(MAKE) -f vm.make $(LIBSAPROC); \ 8.14 fi 8.15
9.1 --- a/make/linux/makefiles/top.make Wed Oct 07 15:38:37 2009 -0700 9.2 +++ b/make/linux/makefiles/top.make Tue Oct 13 12:04:21 2009 -0700 9.3 @@ -74,6 +74,7 @@ 9.4 Include_DBs/COMPILER1 = $(Include_DBs/CORE) $(VM)/includeDB_compiler1 9.5 Include_DBs/COMPILER2 = $(Include_DBs/CORE) $(VM)/includeDB_compiler2 9.6 Include_DBs/TIERED = $(Include_DBs/CORE) $(VM)/includeDB_compiler1 $(VM)/includeDB_compiler2 9.7 +Include_DBs/ZERO = $(Include_DBs/CORE) $(VM)/includeDB_zero 9.8 Include_DBs = $(Include_DBs/$(TYPE)) 9.9 9.10 Cached_plat = $(GENERATED)/platform.current
10.1 --- a/make/linux/makefiles/vm.make Wed Oct 07 15:38:37 2009 -0700 10.2 +++ b/make/linux/makefiles/vm.make Tue Oct 13 12:04:21 2009 -0700 10.3 @@ -40,7 +40,11 @@ 10.4 include $(GENERATED)/Dependencies 10.5 10.6 # read machine-specific adjustments (%%% should do this via buildtree.make?) 10.7 -include $(MAKEFILES_DIR)/$(BUILDARCH).make 10.8 +ifeq ($(ZERO_BUILD), true) 10.9 + include $(MAKEFILES_DIR)/zeroshark.make 10.10 +else 10.11 + include $(MAKEFILES_DIR)/$(BUILDARCH).make 10.12 +endif 10.13 10.14 # set VPATH so make knows where to look for source files 10.15 # Src_Dirs is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm 10.16 @@ -124,7 +128,11 @@ 10.17 rm -f $@ 10.18 cat $^ > $@ 10.19 10.20 -STATIC_CXX = true 10.21 +ifeq ($(ZERO_LIBARCH), ppc64) 10.22 + STATIC_CXX = false 10.23 +else 10.24 + STATIC_CXX = true 10.25 +endif 10.26 10.27 ifeq ($(LINK_INTO),AOUT) 10.28 LIBJVM.o = 10.29 @@ -148,6 +156,9 @@ 10.30 10.31 LIBS_VM += $(LIBS) 10.32 endif 10.33 +ifeq ($(ZERO_BUILD), true) 10.34 + LIBS_VM += $(LIBFFI_LIBS) 10.35 +endif 10.36 10.37 LINK_VM = $(LINK_LIB.c) 10.38
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/make/linux/makefiles/zero.make Tue Oct 13 12:04:21 2009 -0700 11.3 @@ -0,0 +1,32 @@ 11.4 +# 11.5 +# Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. 11.6 +# Copyright 2009 Red Hat, Inc. 11.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 +# 11.9 +# This code is free software; you can redistribute it and/or modify it 11.10 +# under the terms of the GNU General Public License version 2 only, as 11.11 +# published by the Free Software Foundation. 11.12 +# 11.13 +# This code is distributed in the hope that it will be useful, but WITHOUT 11.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11.15 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11.16 +# version 2 for more details (a copy is included in the LICENSE file that 11.17 +# accompanied this code). 11.18 +# 11.19 +# You should have received a copy of the GNU General Public License version 11.20 +# 2 along with this work; if not, write to the Free Software Foundation, 11.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 11.22 +# 11.23 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 11.24 +# CA 95054 USA or visit www.sun.com if you need additional information or 11.25 +# have any questions. 11.26 +# 11.27 +# 11.28 + 11.29 +# Setup for Zero (non-Shark) version of VM 11.30 + 11.31 +# Select which includeDB files to use (in top.make) 11.32 +TYPE = ZERO 11.33 + 11.34 +# Install libjvm.so, etc in in server directory. 11.35 +VM_SUBDIR = server
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/make/linux/makefiles/zeroshark.make Tue Oct 13 12:04:21 2009 -0700 12.3 @@ -0,0 +1,43 @@ 12.4 +# 12.5 +# Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 12.6 +# Copyright 2007, 2008 Red Hat, Inc. 12.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.8 +# 12.9 +# This code is free software; you can redistribute it and/or modify it 12.10 +# under the terms of the GNU General Public License version 2 only, as 12.11 +# published by the Free Software Foundation. 12.12 +# 12.13 +# This code is distributed in the hope that it will be useful, but WITHOUT 12.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12.15 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12.16 +# version 2 for more details (a copy is included in the LICENSE file that 12.17 +# accompanied this code). 12.18 +# 12.19 +# You should have received a copy of the GNU General Public License version 12.20 +# 2 along with this work; if not, write to the Free Software Foundation, 12.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 12.22 +# 12.23 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 12.24 +# CA 95054 USA or visit www.sun.com if you need additional information or 12.25 +# have any questions. 12.26 +# 12.27 +# 12.28 + 12.29 +# Setup common to Zero (non-Shark) and Shark versions of VM 12.30 + 12.31 +# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized 12.32 +OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) 12.33 +# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized 12.34 +OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) 12.35 + 12.36 +# Specify that the CPU is little endian, if necessary 12.37 +ifeq ($(ZERO_ENDIANNESS), little) 12.38 + CFLAGS += -DVM_LITTLE_ENDIAN 12.39 +endif 12.40 + 12.41 +# Specify that the CPU is 64 bit, if necessary 12.42 +ifeq ($(ARCH_DATA_MODEL), 64) 12.43 + CFLAGS += -D_LP64=1 12.44 +endif 12.45 + 12.46 +OPT_CFLAGS/compactingPermGenGen.o = -O1
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/make/linux/platform_zero.in Tue Oct 13 12:04:21 2009 -0700 13.3 @@ -0,0 +1,17 @@ 13.4 +os_family = linux 13.5 + 13.6 +arch = zero 13.7 + 13.8 +arch_model = zero 13.9 + 13.10 +os_arch = linux_zero 13.11 + 13.12 +os_arch_model = linux_zero 13.13 + 13.14 +lib_arch = zero 13.15 + 13.16 +compiler = gcc 13.17 + 13.18 +gnu_dis_arch = zero 13.19 + 13.20 +sysdefs = -DLINUX -D_GNU_SOURCE -DCC_INTERP -DZERO -D@ZERO_ARCHDEF@ -DZERO_LIBARCH=\"@ZERO_LIBARCH@\"
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/src/cpu/zero/vm/assembler_zero.cpp Tue Oct 13 12:04:21 2009 -0700 14.3 @@ -0,0 +1,77 @@ 14.4 +/* 14.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 14.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 14.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.8 + * 14.9 + * This code is free software; you can redistribute it and/or modify it 14.10 + * under the terms of the GNU General Public License version 2 only, as 14.11 + * published by the Free Software Foundation. 14.12 + * 14.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 14.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14.16 + * version 2 for more details (a copy is included in the LICENSE file that 14.17 + * accompanied this code). 14.18 + * 14.19 + * You should have received a copy of the GNU General Public License version 14.20 + * 2 along with this work; if not, write to the Free Software Foundation, 14.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 14.22 + * 14.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 14.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 14.25 + * have any questions. 14.26 + * 14.27 + */ 14.28 + 14.29 +#include "incls/_precompiled.incl" 14.30 +#include "incls/_assembler_zero.cpp.incl" 14.31 + 14.32 +int AbstractAssembler::code_fill_byte() { 14.33 + return 0; 14.34 +} 14.35 + 14.36 +void Assembler::pd_patch_instruction(address branch, address target) { 14.37 + ShouldNotCallThis(); 14.38 +} 14.39 + 14.40 +#ifndef PRODUCT 14.41 +void Assembler::pd_print_patched_instruction(address branch) { 14.42 + ShouldNotCallThis(); 14.43 +} 14.44 +#endif // PRODUCT 14.45 + 14.46 +void MacroAssembler::align(int modulus) { 14.47 + while (offset() % modulus != 0) 14.48 + emit_byte(AbstractAssembler::code_fill_byte()); 14.49 +} 14.50 + 14.51 +void MacroAssembler::bang_stack_with_offset(int offset) { 14.52 + ShouldNotCallThis(); 14.53 +} 14.54 + 14.55 +void MacroAssembler::advance(int bytes) { 14.56 + _code_pos += bytes; 14.57 + sync(); 14.58 +} 14.59 + 14.60 +RegisterOrConstant MacroAssembler::delayed_value_impl( 14.61 + intptr_t* delayed_value_addr, Register tmpl, int offset) { 14.62 + ShouldNotCallThis(); 14.63 +} 14.64 + 14.65 +void MacroAssembler::store_oop(jobject obj) { 14.66 + code_section()->relocate(pc(), oop_Relocation::spec_for_immediate()); 14.67 + emit_address((address) obj); 14.68 +} 14.69 + 14.70 +static void should_not_call() { 14.71 + report_should_not_call(__FILE__, __LINE__); 14.72 +} 14.73 + 14.74 +address ShouldNotCallThisStub() { 14.75 + return (address) should_not_call; 14.76 +} 14.77 + 14.78 +address ShouldNotCallThisEntry() { 14.79 + return (address) should_not_call; 14.80 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/src/cpu/zero/vm/assembler_zero.hpp Tue Oct 13 12:04:21 2009 -0700 15.3 @@ -0,0 +1,64 @@ 15.4 +/* 15.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 15.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 15.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.8 + * 15.9 + * This code is free software; you can redistribute it and/or modify it 15.10 + * under the terms of the GNU General Public License version 2 only, as 15.11 + * published by the Free Software Foundation. 15.12 + * 15.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.16 + * version 2 for more details (a copy is included in the LICENSE file that 15.17 + * accompanied this code). 15.18 + * 15.19 + * You should have received a copy of the GNU General Public License version 15.20 + * 2 along with this work; if not, write to the Free Software Foundation, 15.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.22 + * 15.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 15.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 15.25 + * have any questions. 15.26 + * 15.27 + */ 15.28 + 15.29 +// In normal, CPU-specific ports of HotSpot these two classes are used 15.30 +// for generating assembly language. We don't do any of this in zero, 15.31 +// of course, but we do sneak entry points around in CodeBuffers so we 15.32 +// generate those here. 15.33 + 15.34 +class Assembler : public AbstractAssembler { 15.35 + public: 15.36 + Assembler(CodeBuffer* code) : AbstractAssembler(code) {} 15.37 + 15.38 + public: 15.39 + void pd_patch_instruction(address branch, address target); 15.40 +#ifndef PRODUCT 15.41 + static void pd_print_patched_instruction(address branch); 15.42 +#endif // PRODUCT 15.43 +}; 15.44 + 15.45 +class MacroAssembler : public Assembler { 15.46 + public: 15.47 + MacroAssembler(CodeBuffer* code) : Assembler(code) {} 15.48 + 15.49 + public: 15.50 + void align(int modulus); 15.51 + void bang_stack_with_offset(int offset); 15.52 + bool needs_explicit_null_check(intptr_t offset); 15.53 + RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr, 15.54 + Register tmp, int offset); 15.55 + public: 15.56 + void advance(int bytes); 15.57 + void store_oop(jobject obj); 15.58 +}; 15.59 + 15.60 +#ifdef ASSERT 15.61 +inline bool AbstractAssembler::pd_check_instruction_mark() { 15.62 + ShouldNotCallThis(); 15.63 +} 15.64 +#endif 15.65 + 15.66 +address ShouldNotCallThisStub(); 15.67 +address ShouldNotCallThisEntry();
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/src/cpu/zero/vm/assembler_zero.inline.hpp Tue Oct 13 12:04:21 2009 -0700 16.3 @@ -0,0 +1,26 @@ 16.4 +/* 16.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 16.6 + * Copyright 2009 Red Hat, Inc. 16.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 + * 16.9 + * This code is free software; you can redistribute it and/or modify it 16.10 + * under the terms of the GNU General Public License version 2 only, as 16.11 + * published by the Free Software Foundation. 16.12 + * 16.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.16 + * version 2 for more details (a copy is included in the LICENSE file that 16.17 + * accompanied this code). 16.18 + * 16.19 + * You should have received a copy of the GNU General Public License version 16.20 + * 2 along with this work; if not, write to the Free Software Foundation, 16.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.22 + * 16.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 16.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 16.25 + * have any questions. 16.26 + * 16.27 + */ 16.28 + 16.29 +// This file is intentionally empty
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/src/cpu/zero/vm/bytecodeInterpreter_zero.cpp Tue Oct 13 12:04:21 2009 -0700 17.3 @@ -0,0 +1,54 @@ 17.4 +/* 17.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 17.6 + * Copyright 2008 Red Hat, Inc. 17.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 + * 17.9 + * This code is free software; you can redistribute it and/or modify it 17.10 + * under the terms of the GNU General Public License version 2 only, as 17.11 + * published by the Free Software Foundation. 17.12 + * 17.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 17.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17.16 + * version 2 for more details (a copy is included in the LICENSE file that 17.17 + * accompanied this code). 17.18 + * 17.19 + * You should have received a copy of the GNU General Public License version 17.20 + * 2 along with this work; if not, write to the Free Software Foundation, 17.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17.22 + * 17.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 17.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 17.25 + * have any questions. 17.26 + * 17.27 + */ 17.28 + 17.29 +#include "incls/_precompiled.incl" 17.30 +#include "incls/_cppInterpreter_zero.cpp.incl" 17.31 + 17.32 +#ifdef CC_INTERP 17.33 + 17.34 +const char *BytecodeInterpreter::name_of_field_at_address(address addr) { 17.35 +#define DO(member) {if (addr == (address) &(member)) return XSTR(member);} 17.36 + DO(_thread); 17.37 + DO(_bcp); 17.38 + DO(_locals); 17.39 + DO(_constants); 17.40 + DO(_method); 17.41 + DO(_mdx); 17.42 + DO(_stack); 17.43 + DO(_msg); 17.44 + DO(_result); 17.45 + DO(_prev_link); 17.46 + DO(_oop_temp); 17.47 + DO(_stack_base); 17.48 + DO(_stack_limit); 17.49 + DO(_monitor_base); 17.50 + DO(_self_link); 17.51 +#undef DO 17.52 + if (addr > (address) &_result && addr < (address) (&_result + 1)) 17.53 + return "_result)"; 17.54 + return NULL; 17.55 +} 17.56 + 17.57 +#endif // CC_INTERP
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/src/cpu/zero/vm/bytecodeInterpreter_zero.hpp Tue Oct 13 12:04:21 2009 -0700 18.3 @@ -0,0 +1,148 @@ 18.4 +/* 18.5 + * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. 18.6 + * Copyright 2007, 2008 Red Hat, Inc. 18.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 + * 18.9 + * This code is free software; you can redistribute it and/or modify it 18.10 + * under the terms of the GNU General Public License version 2 only, as 18.11 + * published by the Free Software Foundation. 18.12 + * 18.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 18.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.16 + * version 2 for more details (a copy is included in the LICENSE file that 18.17 + * accompanied this code). 18.18 + * 18.19 + * You should have received a copy of the GNU General Public License version 18.20 + * 2 along with this work; if not, write to the Free Software Foundation, 18.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.22 + * 18.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 18.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 18.25 + * have any questions. 18.26 + * 18.27 + */ 18.28 + 18.29 +// Platform specific for C++ based Interpreter 18.30 + 18.31 +#if defined(PPC) || defined(SPARC) || defined(IA64) 18.32 +#define LOTS_OF_REGS // Use plenty of registers 18.33 +#else 18.34 +#undef LOTS_OF_REGS // Loser platforms 18.35 +#endif 18.36 + 18.37 + private: 18.38 + interpreterState _self_link; 18.39 + 18.40 + public: 18.41 + inline void set_locals(intptr_t* new_locals) { 18.42 + _locals = new_locals; 18.43 + } 18.44 + inline void set_method(methodOop new_method) { 18.45 + _method = new_method; 18.46 + } 18.47 + inline interpreterState self_link() { 18.48 + return _self_link; 18.49 + } 18.50 + inline void set_self_link(interpreterState new_self_link) { 18.51 + _self_link = new_self_link; 18.52 + } 18.53 + inline interpreterState prev_link() { 18.54 + return _prev_link; 18.55 + } 18.56 + inline void set_prev_link(interpreterState new_prev_link) { 18.57 + _prev_link = new_prev_link; 18.58 + } 18.59 + inline void set_stack_limit(intptr_t* new_stack_limit) { 18.60 + _stack_limit = new_stack_limit; 18.61 + } 18.62 + inline void set_stack_base(intptr_t* new_stack_base) { 18.63 + _stack_base = new_stack_base; 18.64 + } 18.65 + inline void set_monitor_base(BasicObjectLock *new_monitor_base) { 18.66 + _monitor_base = new_monitor_base; 18.67 + } 18.68 + inline void set_thread(JavaThread* new_thread) { 18.69 + _thread = new_thread; 18.70 + } 18.71 + inline void set_constants(constantPoolCacheOop new_constants) { 18.72 + _constants = new_constants; 18.73 + } 18.74 + inline oop oop_temp() { 18.75 + return _oop_temp; 18.76 + } 18.77 + inline oop *oop_temp_addr() { 18.78 + return &_oop_temp; 18.79 + } 18.80 + inline void set_oop_temp(oop new_oop_temp) { 18.81 + _oop_temp = new_oop_temp; 18.82 + } 18.83 + inline address callee_entry_point() { 18.84 + return _result._to_call._callee_entry_point; 18.85 + } 18.86 + inline address osr_buf() { 18.87 + return _result._osr._osr_buf; 18.88 + } 18.89 + inline address osr_entry() { 18.90 + return _result._osr._osr_entry; 18.91 + } 18.92 + 18.93 + public: 18.94 + const char *name_of_field_at_address(address addr); 18.95 + 18.96 +// The frame manager handles this 18.97 +#define SET_LAST_JAVA_FRAME() 18.98 +#define RESET_LAST_JAVA_FRAME() 18.99 + 18.100 +// ZeroStack Implementation 18.101 + 18.102 +#undef STACK_INT 18.103 +#undef STACK_FLOAT 18.104 +#undef STACK_ADDR 18.105 +#undef STACK_OBJECT 18.106 +#undef STACK_DOUBLE 18.107 +#undef STACK_LONG 18.108 + 18.109 +#define GET_STACK_SLOT(offset) (*((intptr_t*) &topOfStack[-(offset)])) 18.110 +#define STACK_SLOT(offset) ((address) &topOfStack[-(offset)]) 18.111 +#define STACK_ADDR(offset) (*((address *) &topOfStack[-(offset)])) 18.112 +#define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)])) 18.113 +#define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)])) 18.114 +#define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)])) 18.115 +#define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d) 18.116 +#define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l) 18.117 + 18.118 +#define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value)) 18.119 +#define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value)) 18.120 +#define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value)) 18.121 +#define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value)) 18.122 +#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value)) 18.123 +#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value)) 18.124 +#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \ 18.125 + ((VMJavaVal64*)(addr))->d) 18.126 +#define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value)) 18.127 +#define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \ 18.128 + ((VMJavaVal64*)(addr))->l) 18.129 +// JavaLocals implementation 18.130 + 18.131 +#define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)]) 18.132 +#define LOCALS_ADDR(offset) ((address)locals[-(offset)]) 18.133 +#define LOCALS_INT(offset) (*((jint*)&locals[-(offset)])) 18.134 +#define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)])) 18.135 +#define LOCALS_OBJECT(offset) ((oop)locals[-(offset)]) 18.136 +#define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d) 18.137 +#define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l) 18.138 +#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)])) 18.139 +#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)])) 18.140 + 18.141 +#define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value)) 18.142 +#define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value)) 18.143 +#define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value)) 18.144 +#define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value)) 18.145 +#define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value)) 18.146 +#define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value)) 18.147 +#define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value)) 18.148 +#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \ 18.149 + ((VMJavaVal64*)(addr))->d) 18.150 +#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \ 18.151 + ((VMJavaVal64*)(addr))->l)
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/src/cpu/zero/vm/bytecodeInterpreter_zero.inline.hpp Tue Oct 13 12:04:21 2009 -0700 19.3 @@ -0,0 +1,301 @@ 19.4 +/* 19.5 + * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. 19.6 + * Copyright 2007 Red Hat, Inc. 19.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.8 + * 19.9 + * This code is free software; you can redistribute it and/or modify it 19.10 + * under the terms of the GNU General Public License version 2 only, as 19.11 + * published by the Free Software Foundation. 19.12 + * 19.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 19.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.16 + * version 2 for more details (a copy is included in the LICENSE file that 19.17 + * accompanied this code). 19.18 + * 19.19 + * You should have received a copy of the GNU General Public License version 19.20 + * 2 along with this work; if not, write to the Free Software Foundation, 19.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.22 + * 19.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 19.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 19.25 + * have any questions. 19.26 + * 19.27 + */ 19.28 + 19.29 +// Inline interpreter functions for zero 19.30 + 19.31 +inline jfloat BytecodeInterpreter::VMfloatAdd(jfloat op1, jfloat op2) { 19.32 + return op1 + op2; 19.33 +} 19.34 + 19.35 +inline jfloat BytecodeInterpreter::VMfloatSub(jfloat op1, jfloat op2) { 19.36 + return op1 - op2; 19.37 +} 19.38 + 19.39 +inline jfloat BytecodeInterpreter::VMfloatMul(jfloat op1, jfloat op2) { 19.40 + return op1 * op2; 19.41 +} 19.42 + 19.43 +inline jfloat BytecodeInterpreter::VMfloatDiv(jfloat op1, jfloat op2) { 19.44 + return op1 / op2; 19.45 +} 19.46 + 19.47 +inline jfloat BytecodeInterpreter::VMfloatRem(jfloat op1, jfloat op2) { 19.48 + return fmod(op1, op2); 19.49 +} 19.50 + 19.51 +inline jfloat BytecodeInterpreter::VMfloatNeg(jfloat op) { 19.52 + return -op; 19.53 +} 19.54 + 19.55 +inline int32_t BytecodeInterpreter::VMfloatCompare(jfloat op1, 19.56 + jfloat op2, 19.57 + int32_t direction) { 19.58 + return ( op1 < op2 ? -1 : 19.59 + op1 > op2 ? 1 : 19.60 + op1 == op2 ? 0 : 19.61 + (direction == -1 || direction == 1) ? direction : 0); 19.62 + 19.63 +} 19.64 + 19.65 +inline void BytecodeInterpreter::VMmemCopy64(uint32_t to[2], 19.66 + const uint32_t from[2]) { 19.67 + *(uint64_t *) to = *(uint64_t *) from; 19.68 +} 19.69 + 19.70 +inline jlong BytecodeInterpreter::VMlongAdd(jlong op1, jlong op2) { 19.71 + return op1 + op2; 19.72 +} 19.73 + 19.74 +inline jlong BytecodeInterpreter::VMlongAnd(jlong op1, jlong op2) { 19.75 + return op1 & op2; 19.76 +} 19.77 + 19.78 +inline jlong BytecodeInterpreter::VMlongDiv(jlong op1, jlong op2) { 19.79 + /* it's possible we could catch this special case implicitly */ 19.80 + if (op1 == (jlong) 0x8000000000000000LL && op2 == -1) return op1; 19.81 + else return op1 / op2; 19.82 +} 19.83 + 19.84 +inline jlong BytecodeInterpreter::VMlongMul(jlong op1, jlong op2) { 19.85 + return op1 * op2; 19.86 +} 19.87 + 19.88 +inline jlong BytecodeInterpreter::VMlongOr(jlong op1, jlong op2) { 19.89 + return op1 | op2; 19.90 +} 19.91 + 19.92 +inline jlong BytecodeInterpreter::VMlongSub(jlong op1, jlong op2) { 19.93 + return op1 - op2; 19.94 +} 19.95 + 19.96 +inline jlong BytecodeInterpreter::VMlongXor(jlong op1, jlong op2) { 19.97 + return op1 ^ op2; 19.98 +} 19.99 + 19.100 +inline jlong BytecodeInterpreter::VMlongRem(jlong op1, jlong op2) { 19.101 + /* it's possible we could catch this special case implicitly */ 19.102 + if (op1 == (jlong) 0x8000000000000000LL && op2 == -1) return 0; 19.103 + else return op1 % op2; 19.104 +} 19.105 + 19.106 +inline jlong BytecodeInterpreter::VMlongUshr(jlong op1, jint op2) { 19.107 + return ((unsigned long long) op1) >> (op2 & 0x3F); 19.108 +} 19.109 + 19.110 +inline jlong BytecodeInterpreter::VMlongShr(jlong op1, jint op2) { 19.111 + return op1 >> (op2 & 0x3F); 19.112 +} 19.113 + 19.114 +inline jlong BytecodeInterpreter::VMlongShl(jlong op1, jint op2) { 19.115 + return op1 << (op2 & 0x3F); 19.116 +} 19.117 + 19.118 +inline jlong BytecodeInterpreter::VMlongNeg(jlong op) { 19.119 + return -op; 19.120 +} 19.121 + 19.122 +inline jlong BytecodeInterpreter::VMlongNot(jlong op) { 19.123 + return ~op; 19.124 +} 19.125 + 19.126 +inline int32_t BytecodeInterpreter::VMlongLtz(jlong op) { 19.127 + return (op <= 0); 19.128 +} 19.129 + 19.130 +inline int32_t BytecodeInterpreter::VMlongGez(jlong op) { 19.131 + return (op >= 0); 19.132 +} 19.133 + 19.134 +inline int32_t BytecodeInterpreter::VMlongEqz(jlong op) { 19.135 + return (op == 0); 19.136 +} 19.137 + 19.138 +inline int32_t BytecodeInterpreter::VMlongEq(jlong op1, jlong op2) { 19.139 + return (op1 == op2); 19.140 +} 19.141 + 19.142 +inline int32_t BytecodeInterpreter::VMlongNe(jlong op1, jlong op2) { 19.143 + return (op1 != op2); 19.144 +} 19.145 + 19.146 +inline int32_t BytecodeInterpreter::VMlongGe(jlong op1, jlong op2) { 19.147 + return (op1 >= op2); 19.148 +} 19.149 + 19.150 +inline int32_t BytecodeInterpreter::VMlongLe(jlong op1, jlong op2) { 19.151 + return (op1 <= op2); 19.152 +} 19.153 + 19.154 +inline int32_t BytecodeInterpreter::VMlongLt(jlong op1, jlong op2) { 19.155 + return (op1 < op2); 19.156 +} 19.157 + 19.158 +inline int32_t BytecodeInterpreter::VMlongGt(jlong op1, jlong op2) { 19.159 + return (op1 > op2); 19.160 +} 19.161 + 19.162 +inline int32_t BytecodeInterpreter::VMlongCompare(jlong op1, jlong op2) { 19.163 + return (VMlongLt(op1, op2) ? -1 : VMlongGt(op1, op2) ? 1 : 0); 19.164 +} 19.165 + 19.166 +// Long conversions 19.167 + 19.168 +inline jdouble BytecodeInterpreter::VMlong2Double(jlong val) { 19.169 + return (jdouble) val; 19.170 +} 19.171 + 19.172 +inline jfloat BytecodeInterpreter::VMlong2Float(jlong val) { 19.173 + return (jfloat) val; 19.174 +} 19.175 + 19.176 +inline jint BytecodeInterpreter::VMlong2Int(jlong val) { 19.177 + return (jint) val; 19.178 +} 19.179 + 19.180 +// Double Arithmetic 19.181 + 19.182 +inline jdouble BytecodeInterpreter::VMdoubleAdd(jdouble op1, jdouble op2) { 19.183 + return op1 + op2; 19.184 +} 19.185 + 19.186 +inline jdouble BytecodeInterpreter::VMdoubleDiv(jdouble op1, jdouble op2) { 19.187 + // Divide by zero... QQQ 19.188 + return op1 / op2; 19.189 +} 19.190 + 19.191 +inline jdouble BytecodeInterpreter::VMdoubleMul(jdouble op1, jdouble op2) { 19.192 + return op1 * op2; 19.193 +} 19.194 + 19.195 +inline jdouble BytecodeInterpreter::VMdoubleNeg(jdouble op) { 19.196 + return -op; 19.197 +} 19.198 + 19.199 +inline jdouble BytecodeInterpreter::VMdoubleRem(jdouble op1, jdouble op2) { 19.200 + return fmod(op1, op2); 19.201 +} 19.202 + 19.203 +inline jdouble BytecodeInterpreter::VMdoubleSub(jdouble op1, jdouble op2) { 19.204 + return op1 - op2; 19.205 +} 19.206 + 19.207 +inline int32_t BytecodeInterpreter::VMdoubleCompare(jdouble op1, 19.208 + jdouble op2, 19.209 + int32_t direction) { 19.210 + return ( op1 < op2 ? -1 : 19.211 + op1 > op2 ? 1 : 19.212 + op1 == op2 ? 0 : 19.213 + (direction == -1 || direction == 1) ? direction : 0); 19.214 +} 19.215 + 19.216 +// Double Conversions 19.217 + 19.218 +inline jfloat BytecodeInterpreter::VMdouble2Float(jdouble val) { 19.219 + return (jfloat) val; 19.220 +} 19.221 + 19.222 +// Float Conversions 19.223 + 19.224 +inline jdouble BytecodeInterpreter::VMfloat2Double(jfloat op) { 19.225 + return (jdouble) op; 19.226 +} 19.227 + 19.228 +// Integer Arithmetic 19.229 + 19.230 +inline jint BytecodeInterpreter::VMintAdd(jint op1, jint op2) { 19.231 + return op1 + op2; 19.232 +} 19.233 + 19.234 +inline jint BytecodeInterpreter::VMintAnd(jint op1, jint op2) { 19.235 + return op1 & op2; 19.236 +} 19.237 + 19.238 +inline jint BytecodeInterpreter::VMintDiv(jint op1, jint op2) { 19.239 + /* it's possible we could catch this special case implicitly */ 19.240 + if (op1 == (jint) 0x80000000 && op2 == -1) return op1; 19.241 + else return op1 / op2; 19.242 +} 19.243 + 19.244 +inline jint BytecodeInterpreter::VMintMul(jint op1, jint op2) { 19.245 + return op1 * op2; 19.246 +} 19.247 + 19.248 +inline jint BytecodeInterpreter::VMintNeg(jint op) { 19.249 + return -op; 19.250 +} 19.251 + 19.252 +inline jint BytecodeInterpreter::VMintOr(jint op1, jint op2) { 19.253 + return op1 | op2; 19.254 +} 19.255 + 19.256 +inline jint BytecodeInterpreter::VMintRem(jint op1, jint op2) { 19.257 + /* it's possible we could catch this special case implicitly */ 19.258 + if (op1 == (jint) 0x80000000 && op2 == -1) return 0; 19.259 + else return op1 % op2; 19.260 +} 19.261 + 19.262 +inline jint BytecodeInterpreter::VMintShl(jint op1, jint op2) { 19.263 + return op1 << (op2 & 0x1F); 19.264 +} 19.265 + 19.266 +inline jint BytecodeInterpreter::VMintShr(jint op1, jint op2) { 19.267 + return op1 >> (op2 & 0x1F); 19.268 +} 19.269 + 19.270 +inline jint BytecodeInterpreter::VMintSub(jint op1, jint op2) { 19.271 + return op1 - op2; 19.272 +} 19.273 + 19.274 +inline jint BytecodeInterpreter::VMintUshr(jint op1, jint op2) { 19.275 + return ((juint) op1) >> (op2 & 0x1F); 19.276 +} 19.277 + 19.278 +inline jint BytecodeInterpreter::VMintXor(jint op1, jint op2) { 19.279 + return op1 ^ op2; 19.280 +} 19.281 + 19.282 +inline jdouble BytecodeInterpreter::VMint2Double(jint val) { 19.283 + return (jdouble) val; 19.284 +} 19.285 + 19.286 +inline jfloat BytecodeInterpreter::VMint2Float(jint val) { 19.287 + return (jfloat) val; 19.288 +} 19.289 + 19.290 +inline jlong BytecodeInterpreter::VMint2Long(jint val) { 19.291 + return (jlong) val; 19.292 +} 19.293 + 19.294 +inline jchar BytecodeInterpreter::VMint2Char(jint val) { 19.295 + return (jchar) val; 19.296 +} 19.297 + 19.298 +inline jshort BytecodeInterpreter::VMint2Short(jint val) { 19.299 + return (jshort) val; 19.300 +} 19.301 + 19.302 +inline jbyte BytecodeInterpreter::VMint2Byte(jint val) { 19.303 + return (jbyte) val; 19.304 +}
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/src/cpu/zero/vm/bytecodes_zero.cpp Tue Oct 13 12:04:21 2009 -0700 20.3 @@ -0,0 +1,31 @@ 20.4 +/* 20.5 + * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. 20.6 + * Copyright 2007 Red Hat, Inc. 20.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 + * 20.9 + * This code is free software; you can redistribute it and/or modify it 20.10 + * under the terms of the GNU General Public License version 2 only, as 20.11 + * published by the Free Software Foundation. 20.12 + * 20.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 20.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.16 + * version 2 for more details (a copy is included in the LICENSE file that 20.17 + * accompanied this code). 20.18 + * 20.19 + * You should have received a copy of the GNU General Public License version 20.20 + * 2 along with this work; if not, write to the Free Software Foundation, 20.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.22 + * 20.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 20.25 + * have any questions. 20.26 + * 20.27 + */ 20.28 + 20.29 +#include "incls/_precompiled.incl" 20.30 +#include "incls/_bytecodes_zero.cpp.incl" 20.31 + 20.32 +void Bytecodes::pd_initialize() { 20.33 + // No zero specific initialization 20.34 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/src/cpu/zero/vm/bytecodes_zero.hpp Tue Oct 13 12:04:21 2009 -0700 21.3 @@ -0,0 +1,26 @@ 21.4 +/* 21.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 21.6 + * Copyright 2009 Red Hat, Inc. 21.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 + * 21.9 + * This code is free software; you can redistribute it and/or modify it 21.10 + * under the terms of the GNU General Public License version 2 only, as 21.11 + * published by the Free Software Foundation. 21.12 + * 21.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 21.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.16 + * version 2 for more details (a copy is included in the LICENSE file that 21.17 + * accompanied this code). 21.18 + * 21.19 + * You should have received a copy of the GNU General Public License version 21.20 + * 2 along with this work; if not, write to the Free Software Foundation, 21.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.22 + * 21.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 21.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 21.25 + * have any questions. 21.26 + * 21.27 + */ 21.28 + 21.29 +// This file is intentionally empty
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/src/cpu/zero/vm/bytes_zero.hpp Tue Oct 13 12:04:21 2009 -0700 22.3 @@ -0,0 +1,164 @@ 22.4 +/* 22.5 + * Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved. 22.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 22.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 + * 22.9 + * This code is free software; you can redistribute it and/or modify it 22.10 + * under the terms of the GNU General Public License version 2 only, as 22.11 + * published by the Free Software Foundation. 22.12 + * 22.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 22.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 22.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22.16 + * version 2 for more details (a copy is included in the LICENSE file that 22.17 + * accompanied this code). 22.18 + * 22.19 + * You should have received a copy of the GNU General Public License version 22.20 + * 2 along with this work; if not, write to the Free Software Foundation, 22.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 22.22 + * 22.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 22.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 22.25 + * have any questions. 22.26 + * 22.27 + */ 22.28 + 22.29 +typedef union unaligned { 22.30 + u4 u; 22.31 + u2 us; 22.32 + u8 ul; 22.33 +} __attribute__((packed)) unaligned; 22.34 + 22.35 +class Bytes: AllStatic { 22.36 + public: 22.37 + // Returns true if the byte ordering used by Java is different 22.38 + // from the native byte ordering of the underlying machine. 22.39 + static inline bool is_Java_byte_ordering_different() { 22.40 +#ifdef VM_LITTLE_ENDIAN 22.41 + return true; 22.42 +#else 22.43 + return false; 22.44 +#endif 22.45 + } 22.46 + 22.47 + // Efficient reading and writing of unaligned unsigned data in 22.48 + // platform-specific byte ordering. 22.49 + static inline u2 get_native_u2(address p){ 22.50 + unaligned *up = (unaligned *) p; 22.51 + return up->us; 22.52 + } 22.53 + 22.54 + static inline u4 get_native_u4(address p) { 22.55 + unaligned *up = (unaligned *) p; 22.56 + return up->u; 22.57 + } 22.58 + 22.59 + static inline u8 get_native_u8(address p) { 22.60 + unaligned *up = (unaligned *) p; 22.61 + return up->ul; 22.62 + } 22.63 + 22.64 + static inline void put_native_u2(address p, u2 x) { 22.65 + unaligned *up = (unaligned *) p; 22.66 + up->us = x; 22.67 + } 22.68 + 22.69 + static inline void put_native_u4(address p, u4 x) { 22.70 + unaligned *up = (unaligned *) p; 22.71 + up->u = x; 22.72 + } 22.73 + 22.74 + static inline void put_native_u8(address p, u8 x) { 22.75 + unaligned *up = (unaligned *) p; 22.76 + up->ul = x; 22.77 + } 22.78 + 22.79 + // Efficient reading and writing of unaligned unsigned data in Java 22.80 + // byte ordering (i.e. big-endian ordering). 22.81 +#ifdef VM_LITTLE_ENDIAN 22.82 + // Byte-order reversal is needed 22.83 + static inline u2 get_Java_u2(address p) { 22.84 + return (u2(p[0]) << 8) | 22.85 + (u2(p[1]) ); 22.86 + } 22.87 + static inline u4 get_Java_u4(address p) { 22.88 + return (u4(p[0]) << 24) | 22.89 + (u4(p[1]) << 16) | 22.90 + (u4(p[2]) << 8) | 22.91 + (u4(p[3]) ); 22.92 + } 22.93 + static inline u8 get_Java_u8(address p) { 22.94 + u4 hi, lo; 22.95 + hi = (u4(p[0]) << 24) | 22.96 + (u4(p[1]) << 16) | 22.97 + (u4(p[2]) << 8) | 22.98 + (u4(p[3]) ); 22.99 + lo = (u4(p[4]) << 24) | 22.100 + (u4(p[5]) << 16) | 22.101 + (u4(p[6]) << 8) | 22.102 + (u4(p[7]) ); 22.103 + return u8(lo) | (u8(hi) << 32); 22.104 + } 22.105 + 22.106 + static inline void put_Java_u2(address p, u2 x) { 22.107 + p[0] = x >> 8; 22.108 + p[1] = x; 22.109 + } 22.110 + static inline void put_Java_u4(address p, u4 x) { 22.111 + p[0] = x >> 24; 22.112 + p[1] = x >> 16; 22.113 + p[2] = x >> 8; 22.114 + p[3] = x; 22.115 + } 22.116 + static inline void put_Java_u8(address p, u8 x) { 22.117 + u4 hi, lo; 22.118 + lo = x; 22.119 + hi = x >> 32; 22.120 + p[0] = hi >> 24; 22.121 + p[1] = hi >> 16; 22.122 + p[2] = hi >> 8; 22.123 + p[3] = hi; 22.124 + p[4] = lo >> 24; 22.125 + p[5] = lo >> 16; 22.126 + p[6] = lo >> 8; 22.127 + p[7] = lo; 22.128 + } 22.129 + 22.130 + // Efficient swapping of byte ordering 22.131 + static inline u2 swap_u2(u2 x); 22.132 + static inline u4 swap_u4(u4 x); 22.133 + static inline u8 swap_u8(u8 x); 22.134 +#else 22.135 + // No byte-order reversal is needed 22.136 + static inline u2 get_Java_u2(address p) { 22.137 + return get_native_u2(p); 22.138 + } 22.139 + static inline u4 get_Java_u4(address p) { 22.140 + return get_native_u4(p); 22.141 + } 22.142 + static inline u8 get_Java_u8(address p) { 22.143 + return get_native_u8(p); 22.144 + } 22.145 + 22.146 + static inline void put_Java_u2(address p, u2 x) { 22.147 + put_native_u2(p, x); 22.148 + } 22.149 + static inline void put_Java_u4(address p, u4 x) { 22.150 + put_native_u4(p, x); 22.151 + } 22.152 + static inline void put_Java_u8(address p, u8 x) { 22.153 + put_native_u8(p, x); 22.154 + } 22.155 + 22.156 + // No byte-order reversal is needed 22.157 + static inline u2 swap_u2(u2 x) { return x; } 22.158 + static inline u4 swap_u4(u4 x) { return x; } 22.159 + static inline u8 swap_u8(u8 x) { return x; } 22.160 +#endif // VM_LITTLE_ENDIAN 22.161 +}; 22.162 + 22.163 +#ifdef VM_LITTLE_ENDIAN 22.164 +// The following header contains the implementations of swap_u2, 22.165 +// swap_u4, and swap_u8 22.166 +#include "incls/_bytes_pd.inline.hpp.incl" 22.167 +#endif // VM_LITTLE_ENDIAN
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/src/cpu/zero/vm/codeBuffer_zero.hpp Tue Oct 13 12:04:21 2009 -0700 23.3 @@ -0,0 +1,27 @@ 23.4 +/* 23.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 23.6 + * Copyright 2007 Red Hat, Inc. 23.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.8 + * 23.9 + * This code is free software; you can redistribute it and/or modify it 23.10 + * under the terms of the GNU General Public License version 2 only, as 23.11 + * published by the Free Software Foundation. 23.12 + * 23.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.16 + * version 2 for more details (a copy is included in the LICENSE file that 23.17 + * accompanied this code). 23.18 + * 23.19 + * You should have received a copy of the GNU General Public License version 23.20 + * 2 along with this work; if not, write to the Free Software Foundation, 23.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.22 + * 23.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 23.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 23.25 + * have any questions. 23.26 + * 23.27 + */ 23.28 + 23.29 + private: 23.30 + void pd_initialize() {}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 24.2 +++ b/src/cpu/zero/vm/copy_zero.hpp Tue Oct 13 12:04:21 2009 -0700 24.3 @@ -0,0 +1,178 @@ 24.4 +/* 24.5 + * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved. 24.6 + * Copyright 2007 Red Hat, Inc. 24.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.8 + * 24.9 + * This code is free software; you can redistribute it and/or modify it 24.10 + * under the terms of the GNU General Public License version 2 only, as 24.11 + * published by the Free Software Foundation. 24.12 + * 24.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 24.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24.16 + * version 2 for more details (a copy is included in the LICENSE file that 24.17 + * accompanied this code). 24.18 + * 24.19 + * You should have received a copy of the GNU General Public License version 24.20 + * 2 along with this work; if not, write to the Free Software Foundation, 24.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24.22 + * 24.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 24.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 24.25 + * have any questions. 24.26 + * 24.27 + */ 24.28 + 24.29 +// Inline functions for memory copy and fill. 24.30 + 24.31 +static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) { 24.32 + memmove(to, from, count * HeapWordSize); 24.33 +} 24.34 + 24.35 +static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) { 24.36 + switch (count) { 24.37 + case 8: to[7] = from[7]; 24.38 + case 7: to[6] = from[6]; 24.39 + case 6: to[5] = from[5]; 24.40 + case 5: to[4] = from[4]; 24.41 + case 4: to[3] = from[3]; 24.42 + case 3: to[2] = from[2]; 24.43 + case 2: to[1] = from[1]; 24.44 + case 1: to[0] = from[0]; 24.45 + case 0: break; 24.46 + default: 24.47 + memcpy(to, from, count * HeapWordSize); 24.48 + break; 24.49 + } 24.50 +} 24.51 + 24.52 +static void pd_disjoint_words_atomic(HeapWord* from, 24.53 + HeapWord* to, 24.54 + size_t count) { 24.55 + switch (count) { 24.56 + case 8: to[7] = from[7]; 24.57 + case 7: to[6] = from[6]; 24.58 + case 6: to[5] = from[5]; 24.59 + case 5: to[4] = from[4]; 24.60 + case 4: to[3] = from[3]; 24.61 + case 3: to[2] = from[2]; 24.62 + case 2: to[1] = from[1]; 24.63 + case 1: to[0] = from[0]; 24.64 + case 0: break; 24.65 + default: 24.66 + while (count-- > 0) { 24.67 + *to++ = *from++; 24.68 + } 24.69 + break; 24.70 + } 24.71 +} 24.72 + 24.73 +static void pd_aligned_conjoint_words(HeapWord* from, 24.74 + HeapWord* to, 24.75 + size_t count) { 24.76 + memmove(to, from, count * HeapWordSize); 24.77 +} 24.78 + 24.79 +static void pd_aligned_disjoint_words(HeapWord* from, 24.80 + HeapWord* to, 24.81 + size_t count) { 24.82 + pd_disjoint_words(from, to, count); 24.83 +} 24.84 + 24.85 +static void pd_conjoint_bytes(void* from, void* to, size_t count) { 24.86 + memmove(to, from, count); 24.87 +} 24.88 + 24.89 +static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) { 24.90 + memmove(to, from, count); 24.91 +} 24.92 + 24.93 +static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { 24.94 + _Copy_conjoint_jshorts_atomic(from, to, count); 24.95 +} 24.96 + 24.97 +static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) { 24.98 + _Copy_conjoint_jints_atomic(from, to, count); 24.99 +} 24.100 + 24.101 +static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { 24.102 + _Copy_conjoint_jlongs_atomic(from, to, count); 24.103 +} 24.104 + 24.105 +static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) { 24.106 +#ifdef _LP64 24.107 + assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); 24.108 + _Copy_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count); 24.109 +#else 24.110 + assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size"); 24.111 + _Copy_conjoint_jints_atomic((jint*)from, (jint*)to, count); 24.112 +#endif // _LP64 24.113 +} 24.114 + 24.115 +static void pd_arrayof_conjoint_bytes(HeapWord* from, 24.116 + HeapWord* to, 24.117 + size_t count) { 24.118 + _Copy_arrayof_conjoint_bytes(from, to, count); 24.119 +} 24.120 + 24.121 +static void pd_arrayof_conjoint_jshorts(HeapWord* from, 24.122 + HeapWord* to, 24.123 + size_t count) { 24.124 + _Copy_arrayof_conjoint_jshorts(from, to, count); 24.125 +} 24.126 + 24.127 +static void pd_arrayof_conjoint_jints(HeapWord* from, 24.128 + HeapWord* to, 24.129 + size_t count) { 24.130 + _Copy_arrayof_conjoint_jints(from, to, count); 24.131 +} 24.132 + 24.133 +static void pd_arrayof_conjoint_jlongs(HeapWord* from, 24.134 + HeapWord* to, 24.135 + size_t count) { 24.136 + _Copy_arrayof_conjoint_jlongs(from, to, count); 24.137 +} 24.138 + 24.139 +static void pd_arrayof_conjoint_oops(HeapWord* from, 24.140 + HeapWord* to, 24.141 + size_t count) { 24.142 +#ifdef _LP64 24.143 + assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); 24.144 + _Copy_arrayof_conjoint_jlongs(from, to, count); 24.145 +#else 24.146 + assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size"); 24.147 + _Copy_arrayof_conjoint_jints(from, to, count); 24.148 +#endif // _LP64 24.149 +} 24.150 + 24.151 +static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) { 24.152 +#ifdef _LP64 24.153 + julong* to = (julong*) tohw; 24.154 + julong v = ((julong) value << 32) | value; 24.155 +#else 24.156 + juint* to = (juint*) tohw; 24.157 + juint v = value; 24.158 +#endif // _LP64 24.159 + 24.160 + while (count-- > 0) { 24.161 + *to++ = v; 24.162 + } 24.163 +} 24.164 + 24.165 +static void pd_fill_to_aligned_words(HeapWord* tohw, 24.166 + size_t count, 24.167 + juint value) { 24.168 + pd_fill_to_words(tohw, count, value); 24.169 +} 24.170 + 24.171 +static void pd_fill_to_bytes(void* to, size_t count, jubyte value) { 24.172 + memset(to, value, count); 24.173 +} 24.174 + 24.175 +static void pd_zero_to_words(HeapWord* tohw, size_t count) { 24.176 + pd_fill_to_words(tohw, count, 0); 24.177 +} 24.178 + 24.179 +static void pd_zero_to_bytes(void* to, size_t count) { 24.180 + memset(to, 0, count); 24.181 +}
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/src/cpu/zero/vm/cppInterpreterGenerator_zero.hpp Tue Oct 13 12:04:21 2009 -0700 25.3 @@ -0,0 +1,37 @@ 25.4 +/* 25.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 25.6 + * Copyright 2008, 2009 Red Hat, Inc. 25.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.8 + * 25.9 + * This code is free software; you can redistribute it and/or modify it 25.10 + * under the terms of the GNU General Public License version 2 only, as 25.11 + * published by the Free Software Foundation. 25.12 + * 25.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 25.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.16 + * version 2 for more details (a copy is included in the LICENSE file that 25.17 + * accompanied this code). 25.18 + * 25.19 + * You should have received a copy of the GNU General Public License version 25.20 + * 2 along with this work; if not, write to the Free Software Foundation, 25.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.22 + * 25.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 25.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 25.25 + * have any questions. 25.26 + * 25.27 + */ 25.28 + 25.29 + protected: 25.30 + MacroAssembler* assembler() const { 25.31 + return _masm; 25.32 + } 25.33 + 25.34 + protected: 25.35 + address generate_entry(address entry_point) { 25.36 + ZeroEntry *entry = (ZeroEntry *) assembler()->pc(); 25.37 + assembler()->advance(sizeof(ZeroEntry)); 25.38 + entry->set_entry_point(entry_point); 25.39 + return (address) entry; 25.40 + }
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp Tue Oct 13 12:04:21 2009 -0700 26.3 @@ -0,0 +1,946 @@ 26.4 +/* 26.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 26.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 26.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.8 + * 26.9 + * This code is free software; you can redistribute it and/or modify it 26.10 + * under the terms of the GNU General Public License version 2 only, as 26.11 + * published by the Free Software Foundation. 26.12 + * 26.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 26.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.16 + * version 2 for more details (a copy is included in the LICENSE file that 26.17 + * accompanied this code). 26.18 + * 26.19 + * You should have received a copy of the GNU General Public License version 26.20 + * 2 along with this work; if not, write to the Free Software Foundation, 26.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.22 + * 26.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 26.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 26.25 + * have any questions. 26.26 + * 26.27 + */ 26.28 + 26.29 +#include "incls/_precompiled.incl" 26.30 +#include "incls/_cppInterpreter_zero.cpp.incl" 26.31 + 26.32 +#ifdef CC_INTERP 26.33 + 26.34 +#define fixup_after_potential_safepoint() \ 26.35 + method = istate->method() 26.36 + 26.37 +#define CALL_VM_NOCHECK(func) \ 26.38 + thread->set_last_Java_frame(); \ 26.39 + func; \ 26.40 + thread->reset_last_Java_frame(); \ 26.41 + fixup_after_potential_safepoint() 26.42 + 26.43 +void CppInterpreter::normal_entry(methodOop method, intptr_t UNUSED, TRAPS) { 26.44 + JavaThread *thread = (JavaThread *) THREAD; 26.45 + ZeroStack *stack = thread->zero_stack(); 26.46 + 26.47 + // Adjust the caller's stack frame to accomodate any additional 26.48 + // local variables we have contiguously with our parameters. 26.49 + int extra_locals = method->max_locals() - method->size_of_parameters(); 26.50 + if (extra_locals > 0) { 26.51 + if (extra_locals > stack->available_words()) { 26.52 + Unimplemented(); 26.53 + } 26.54 + for (int i = 0; i < extra_locals; i++) 26.55 + stack->push(0); 26.56 + } 26.57 + 26.58 + // Allocate and initialize our frame. 26.59 + InterpreterFrame *frame = InterpreterFrame::build(stack, method, thread); 26.60 + thread->push_zero_frame(frame); 26.61 + 26.62 + // Execute those bytecodes! 26.63 + main_loop(0, THREAD); 26.64 +} 26.65 + 26.66 +void CppInterpreter::main_loop(int recurse, TRAPS) { 26.67 + JavaThread *thread = (JavaThread *) THREAD; 26.68 + ZeroStack *stack = thread->zero_stack(); 26.69 + 26.70 + // If we are entering from a deopt we may need to call 26.71 + // ourself a few times in order to get to our frame. 26.72 + if (recurse) 26.73 + main_loop(recurse - 1, THREAD); 26.74 + 26.75 + InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame(); 26.76 + interpreterState istate = frame->interpreter_state(); 26.77 + methodOop method = istate->method(); 26.78 + 26.79 + intptr_t *result = NULL; 26.80 + int result_slots = 0; 26.81 + 26.82 + // Check we're not about to run out of stack 26.83 + if (stack_overflow_imminent(thread)) { 26.84 + CALL_VM_NOCHECK(InterpreterRuntime::throw_StackOverflowError(thread)); 26.85 + goto unwind_and_return; 26.86 + } 26.87 + 26.88 + while (true) { 26.89 + // We can set up the frame anchor with everything we want at 26.90 + // this point as we are thread_in_Java and no safepoints can 26.91 + // occur until we go to vm mode. We do have to clear flags 26.92 + // on return from vm but that is it. 26.93 + thread->set_last_Java_frame(); 26.94 + 26.95 + // Call the interpreter 26.96 + if (JvmtiExport::can_post_interpreter_events()) 26.97 + BytecodeInterpreter::runWithChecks(istate); 26.98 + else 26.99 + BytecodeInterpreter::run(istate); 26.100 + fixup_after_potential_safepoint(); 26.101 + 26.102 + // Clear the frame anchor 26.103 + thread->reset_last_Java_frame(); 26.104 + 26.105 + // Examine the message from the interpreter to decide what to do 26.106 + if (istate->msg() == BytecodeInterpreter::call_method) { 26.107 + methodOop callee = istate->callee(); 26.108 + 26.109 + // Trim back the stack to put the parameters at the top 26.110 + stack->set_sp(istate->stack() + 1); 26.111 + 26.112 + // Make the call 26.113 + Interpreter::invoke_method(callee, istate->callee_entry_point(), THREAD); 26.114 + fixup_after_potential_safepoint(); 26.115 + 26.116 + // Convert the result 26.117 + istate->set_stack(stack->sp() - 1); 26.118 + 26.119 + // Restore the stack 26.120 + stack->set_sp(istate->stack_limit() + 1); 26.121 + 26.122 + // Resume the interpreter 26.123 + istate->set_msg(BytecodeInterpreter::method_resume); 26.124 + } 26.125 + else if (istate->msg() == BytecodeInterpreter::more_monitors) { 26.126 + int monitor_words = frame::interpreter_frame_monitor_size(); 26.127 + 26.128 + // Allocate the space 26.129 + if (monitor_words > stack->available_words()) { 26.130 + Unimplemented(); 26.131 + } 26.132 + stack->alloc(monitor_words * wordSize); 26.133 + 26.134 + // Move the expression stack contents 26.135 + for (intptr_t *p = istate->stack() + 1; p < istate->stack_base(); p++) 26.136 + *(p - monitor_words) = *p; 26.137 + 26.138 + // Move the expression stack pointers 26.139 + istate->set_stack_limit(istate->stack_limit() - monitor_words); 26.140 + istate->set_stack(istate->stack() - monitor_words); 26.141 + istate->set_stack_base(istate->stack_base() - monitor_words); 26.142 + 26.143 + // Zero the new monitor so the interpreter can find it. 26.144 + ((BasicObjectLock *) istate->stack_base())->set_obj(NULL); 26.145 + 26.146 + // Resume the interpreter 26.147 + istate->set_msg(BytecodeInterpreter::got_monitors); 26.148 + } 26.149 + else if (istate->msg() == BytecodeInterpreter::return_from_method) { 26.150 + // Copy the result into the caller's frame 26.151 + result_slots = type2size[method->result_type()]; 26.152 + assert(result_slots >= 0 && result_slots <= 2, "what?"); 26.153 + result = istate->stack() + result_slots; 26.154 + break; 26.155 + } 26.156 + else if (istate->msg() == BytecodeInterpreter::throwing_exception) { 26.157 + assert(HAS_PENDING_EXCEPTION, "should do"); 26.158 + break; 26.159 + } 26.160 + else if (istate->msg() == BytecodeInterpreter::do_osr) { 26.161 + // Unwind the current frame 26.162 + thread->pop_zero_frame(); 26.163 + 26.164 + // Remove any extension of the previous frame 26.165 + int extra_locals = method->max_locals() - method->size_of_parameters(); 26.166 + stack->set_sp(stack->sp() + extra_locals); 26.167 + 26.168 + // Jump into the OSR method 26.169 + Interpreter::invoke_osr( 26.170 + method, istate->osr_entry(), istate->osr_buf(), THREAD); 26.171 + return; 26.172 + } 26.173 + else { 26.174 + ShouldNotReachHere(); 26.175 + } 26.176 + } 26.177 + 26.178 + unwind_and_return: 26.179 + 26.180 + // Unwind the current frame 26.181 + thread->pop_zero_frame(); 26.182 + 26.183 + // Pop our local variables 26.184 + stack->set_sp(stack->sp() + method->max_locals()); 26.185 + 26.186 + // Push our result 26.187 + for (int i = 0; i < result_slots; i++) 26.188 + stack->push(result[-i]); 26.189 +} 26.190 + 26.191 +void CppInterpreter::native_entry(methodOop method, intptr_t UNUSED, TRAPS) { 26.192 + // Make sure method is native and not abstract 26.193 + assert(method->is_native() && !method->is_abstract(), "should be"); 26.194 + 26.195 + JavaThread *thread = (JavaThread *) THREAD; 26.196 + ZeroStack *stack = thread->zero_stack(); 26.197 + 26.198 + // Allocate and initialize our frame 26.199 + InterpreterFrame *frame = InterpreterFrame::build(stack, method, thread); 26.200 + thread->push_zero_frame(frame); 26.201 + interpreterState istate = frame->interpreter_state(); 26.202 + intptr_t *locals = istate->locals(); 26.203 + 26.204 + // Check we're not about to run out of stack 26.205 + if (stack_overflow_imminent(thread)) { 26.206 + CALL_VM_NOCHECK(InterpreterRuntime::throw_StackOverflowError(thread)); 26.207 + goto unwind_and_return; 26.208 + } 26.209 + 26.210 + // Lock if necessary 26.211 + BasicObjectLock *monitor; 26.212 + monitor = NULL; 26.213 + if (method->is_synchronized()) { 26.214 + monitor = (BasicObjectLock*) istate->stack_base(); 26.215 + oop lockee = monitor->obj(); 26.216 + markOop disp = lockee->mark()->set_unlocked(); 26.217 + 26.218 + monitor->lock()->set_displaced_header(disp); 26.219 + if (Atomic::cmpxchg_ptr(monitor, lockee->mark_addr(), disp) != disp) { 26.220 + if (thread->is_lock_owned((address) disp->clear_lock_bits())) { 26.221 + monitor->lock()->set_displaced_header(NULL); 26.222 + } 26.223 + else { 26.224 + CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor)); 26.225 + if (HAS_PENDING_EXCEPTION) 26.226 + goto unwind_and_return; 26.227 + } 26.228 + } 26.229 + } 26.230 + 26.231 + // Get the signature handler 26.232 + InterpreterRuntime::SignatureHandler *handler; { 26.233 + address handlerAddr = method->signature_handler(); 26.234 + if (handlerAddr == NULL) { 26.235 + CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method)); 26.236 + if (HAS_PENDING_EXCEPTION) 26.237 + goto unwind_and_return; 26.238 + 26.239 + handlerAddr = method->signature_handler(); 26.240 + assert(handlerAddr != NULL, "eh?"); 26.241 + } 26.242 + if (handlerAddr == (address) InterpreterRuntime::slow_signature_handler) { 26.243 + CALL_VM_NOCHECK(handlerAddr = 26.244 + InterpreterRuntime::slow_signature_handler(thread, method, NULL,NULL)); 26.245 + if (HAS_PENDING_EXCEPTION) 26.246 + goto unwind_and_return; 26.247 + } 26.248 + handler = \ 26.249 + InterpreterRuntime::SignatureHandler::from_handlerAddr(handlerAddr); 26.250 + } 26.251 + 26.252 + // Get the native function entry point 26.253 + address function; 26.254 + function = method->native_function(); 26.255 + assert(function != NULL, "should be set if signature handler is"); 26.256 + 26.257 + // Build the argument list 26.258 + if (handler->argument_count() * 2 > stack->available_words()) { 26.259 + Unimplemented(); 26.260 + } 26.261 + void **arguments; 26.262 + void *mirror; { 26.263 + arguments = 26.264 + (void **) stack->alloc(handler->argument_count() * sizeof(void **)); 26.265 + void **dst = arguments; 26.266 + 26.267 + void *env = thread->jni_environment(); 26.268 + *(dst++) = &env; 26.269 + 26.270 + if (method->is_static()) { 26.271 + istate->set_oop_temp( 26.272 + method->constants()->pool_holder()->klass_part()->java_mirror()); 26.273 + mirror = istate->oop_temp_addr(); 26.274 + *(dst++) = &mirror; 26.275 + } 26.276 + 26.277 + intptr_t *src = locals; 26.278 + for (int i = dst - arguments; i < handler->argument_count(); i++) { 26.279 + ffi_type *type = handler->argument_type(i); 26.280 + if (type == &ffi_type_pointer) { 26.281 + if (*src) { 26.282 + stack->push((intptr_t) src); 26.283 + *(dst++) = stack->sp(); 26.284 + } 26.285 + else { 26.286 + *(dst++) = src; 26.287 + } 26.288 + src--; 26.289 + } 26.290 + else if (type->size == 4) { 26.291 + *(dst++) = src--; 26.292 + } 26.293 + else if (type->size == 8) { 26.294 + src--; 26.295 + *(dst++) = src--; 26.296 + } 26.297 + else { 26.298 + ShouldNotReachHere(); 26.299 + } 26.300 + } 26.301 + } 26.302 + 26.303 + // Set up the Java frame anchor 26.304 + thread->set_last_Java_frame(); 26.305 + 26.306 + // Change the thread state to _thread_in_native 26.307 + ThreadStateTransition::transition_from_java(thread, _thread_in_native); 26.308 + 26.309 + // Make the call 26.310 + intptr_t result[4 - LogBytesPerWord]; 26.311 + ffi_call(handler->cif(), (void (*)()) function, result, arguments); 26.312 + 26.313 + // Change the thread state back to _thread_in_Java. 26.314 + // ThreadStateTransition::transition_from_native() cannot be used 26.315 + // here because it does not check for asynchronous exceptions. 26.316 + // We have to manage the transition ourself. 26.317 + thread->set_thread_state(_thread_in_native_trans); 26.318 + 26.319 + // Make sure new state is visible in the GC thread 26.320 + if (os::is_MP()) { 26.321 + if (UseMembar) { 26.322 + OrderAccess::fence(); 26.323 + } 26.324 + else { 26.325 + InterfaceSupport::serialize_memory(thread); 26.326 + } 26.327 + } 26.328 + 26.329 + // Handle safepoint operations, pending suspend requests, 26.330 + // and pending asynchronous exceptions. 26.331 + if (SafepointSynchronize::do_call_back() || 26.332 + thread->has_special_condition_for_native_trans()) { 26.333 + JavaThread::check_special_condition_for_native_trans(thread); 26.334 + CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops()); 26.335 + } 26.336 + 26.337 + // Finally we can change the thread state to _thread_in_Java. 26.338 + thread->set_thread_state(_thread_in_Java); 26.339 + fixup_after_potential_safepoint(); 26.340 + 26.341 + // Clear the frame anchor 26.342 + thread->reset_last_Java_frame(); 26.343 + 26.344 + // If the result was an oop then unbox it and store it in 26.345 + // oop_temp where the garbage collector can see it before 26.346 + // we release the handle it might be protected by. 26.347 + if (handler->result_type() == &ffi_type_pointer) { 26.348 + if (result[0]) 26.349 + istate->set_oop_temp(*(oop *) result[0]); 26.350 + else 26.351 + istate->set_oop_temp(NULL); 26.352 + } 26.353 + 26.354 + // Reset handle block 26.355 + thread->active_handles()->clear(); 26.356 + 26.357 + // Unlock if necessary. It seems totally wrong that this 26.358 + // is skipped in the event of an exception but apparently 26.359 + // the template interpreter does this so we do too. 26.360 + if (monitor && !HAS_PENDING_EXCEPTION) { 26.361 + BasicLock *lock = monitor->lock(); 26.362 + markOop header = lock->displaced_header(); 26.363 + oop rcvr = monitor->obj(); 26.364 + monitor->set_obj(NULL); 26.365 + 26.366 + if (header != NULL) { 26.367 + if (Atomic::cmpxchg_ptr(header, rcvr->mark_addr(), lock) != lock) { 26.368 + monitor->set_obj(rcvr); { 26.369 + HandleMark hm(thread); 26.370 + CALL_VM_NOCHECK(InterpreterRuntime::monitorexit(thread, monitor)); 26.371 + } 26.372 + } 26.373 + } 26.374 + } 26.375 + 26.376 + unwind_and_return: 26.377 + 26.378 + // Unwind the current activation 26.379 + thread->pop_zero_frame(); 26.380 + 26.381 + // Pop our parameters 26.382 + stack->set_sp(stack->sp() + method->size_of_parameters()); 26.383 + 26.384 + // Push our result 26.385 + if (!HAS_PENDING_EXCEPTION) { 26.386 + stack->set_sp(stack->sp() - type2size[method->result_type()]); 26.387 + 26.388 + switch (method->result_type()) { 26.389 + case T_VOID: 26.390 + break; 26.391 + 26.392 + case T_BOOLEAN: 26.393 +#ifndef VM_LITTLE_ENDIAN 26.394 + result[0] <<= (BitsPerWord - BitsPerByte); 26.395 +#endif 26.396 + SET_LOCALS_INT(*(jboolean *) result != 0, 0); 26.397 + break; 26.398 + 26.399 + case T_CHAR: 26.400 +#ifndef VM_LITTLE_ENDIAN 26.401 + result[0] <<= (BitsPerWord - BitsPerShort); 26.402 +#endif 26.403 + SET_LOCALS_INT(*(jchar *) result, 0); 26.404 + break; 26.405 + 26.406 + case T_BYTE: 26.407 +#ifndef VM_LITTLE_ENDIAN 26.408 + result[0] <<= (BitsPerWord - BitsPerByte); 26.409 +#endif 26.410 + SET_LOCALS_INT(*(jbyte *) result, 0); 26.411 + break; 26.412 + 26.413 + case T_SHORT: 26.414 +#ifndef VM_LITTLE_ENDIAN 26.415 + result[0] <<= (BitsPerWord - BitsPerShort); 26.416 +#endif 26.417 + SET_LOCALS_INT(*(jshort *) result, 0); 26.418 + break; 26.419 + 26.420 + case T_INT: 26.421 +#ifndef VM_LITTLE_ENDIAN 26.422 + result[0] <<= (BitsPerWord - BitsPerInt); 26.423 +#endif 26.424 + SET_LOCALS_INT(*(jint *) result, 0); 26.425 + break; 26.426 + 26.427 + case T_LONG: 26.428 + SET_LOCALS_LONG(*(jlong *) result, 0); 26.429 + break; 26.430 + 26.431 + case T_FLOAT: 26.432 + SET_LOCALS_FLOAT(*(jfloat *) result, 0); 26.433 + break; 26.434 + 26.435 + case T_DOUBLE: 26.436 + SET_LOCALS_DOUBLE(*(jdouble *) result, 0); 26.437 + break; 26.438 + 26.439 + case T_OBJECT: 26.440 + case T_ARRAY: 26.441 + SET_LOCALS_OBJECT(istate->oop_temp(), 0); 26.442 + break; 26.443 + 26.444 + default: 26.445 + ShouldNotReachHere(); 26.446 + } 26.447 + } 26.448 +} 26.449 + 26.450 +void CppInterpreter::accessor_entry(methodOop method, intptr_t UNUSED, TRAPS) { 26.451 + JavaThread *thread = (JavaThread *) THREAD; 26.452 + ZeroStack *stack = thread->zero_stack(); 26.453 + intptr_t *locals = stack->sp(); 26.454 + 26.455 + // Drop into the slow path if we need a safepoint check 26.456 + if (SafepointSynchronize::do_call_back()) { 26.457 + normal_entry(method, 0, THREAD); 26.458 + return; 26.459 + } 26.460 + 26.461 + // Load the object pointer and drop into the slow path 26.462 + // if we have a NullPointerException 26.463 + oop object = LOCALS_OBJECT(0); 26.464 + if (object == NULL) { 26.465 + normal_entry(method, 0, THREAD); 26.466 + return; 26.467 + } 26.468 + 26.469 + // Read the field index from the bytecode, which looks like this: 26.470 + // 0: aload_0 26.471 + // 1: getfield 26.472 + // 2: index 26.473 + // 3: index 26.474 + // 4: ireturn/areturn 26.475 + // NB this is not raw bytecode: index is in machine order 26.476 + u1 *code = method->code_base(); 26.477 + assert(code[0] == Bytecodes::_aload_0 && 26.478 + code[1] == Bytecodes::_getfield && 26.479 + (code[4] == Bytecodes::_ireturn || 26.480 + code[4] == Bytecodes::_areturn), "should do"); 26.481 + u2 index = Bytes::get_native_u2(&code[2]); 26.482 + 26.483 + // Get the entry from the constant pool cache, and drop into 26.484 + // the slow path if it has not been resolved 26.485 + constantPoolCacheOop cache = method->constants()->cache(); 26.486 + ConstantPoolCacheEntry* entry = cache->entry_at(index); 26.487 + if (!entry->is_resolved(Bytecodes::_getfield)) { 26.488 + normal_entry(method, 0, THREAD); 26.489 + return; 26.490 + } 26.491 + 26.492 + // Get the result and push it onto the stack 26.493 + switch (entry->flag_state()) { 26.494 + case ltos: 26.495 + case dtos: 26.496 + if (stack->available_words() < 1) { 26.497 + Unimplemented(); 26.498 + } 26.499 + stack->alloc(wordSize); 26.500 + break; 26.501 + } 26.502 + if (entry->is_volatile()) { 26.503 + switch (entry->flag_state()) { 26.504 + case ctos: 26.505 + SET_LOCALS_INT(object->char_field_acquire(entry->f2()), 0); 26.506 + break; 26.507 + 26.508 + case btos: 26.509 + SET_LOCALS_INT(object->byte_field_acquire(entry->f2()), 0); 26.510 + break; 26.511 + 26.512 + case stos: 26.513 + SET_LOCALS_INT(object->short_field_acquire(entry->f2()), 0); 26.514 + break; 26.515 + 26.516 + case itos: 26.517 + SET_LOCALS_INT(object->int_field_acquire(entry->f2()), 0); 26.518 + break; 26.519 + 26.520 + case ltos: 26.521 + SET_LOCALS_LONG(object->long_field_acquire(entry->f2()), 0); 26.522 + break; 26.523 + 26.524 + case ftos: 26.525 + SET_LOCALS_FLOAT(object->float_field_acquire(entry->f2()), 0); 26.526 + break; 26.527 + 26.528 + case dtos: 26.529 + SET_LOCALS_DOUBLE(object->double_field_acquire(entry->f2()), 0); 26.530 + break; 26.531 + 26.532 + case atos: 26.533 + SET_LOCALS_OBJECT(object->obj_field_acquire(entry->f2()), 0); 26.534 + break; 26.535 + 26.536 + default: 26.537 + ShouldNotReachHere(); 26.538 + } 26.539 + } 26.540 + else { 26.541 + switch (entry->flag_state()) { 26.542 + case ctos: 26.543 + SET_LOCALS_INT(object->char_field(entry->f2()), 0); 26.544 + break; 26.545 + 26.546 + case btos: 26.547 + SET_LOCALS_INT(object->byte_field(entry->f2()), 0); 26.548 + break; 26.549 + 26.550 + case stos: 26.551 + SET_LOCALS_INT(object->short_field(entry->f2()), 0); 26.552 + break; 26.553 + 26.554 + case itos: 26.555 + SET_LOCALS_INT(object->int_field(entry->f2()), 0); 26.556 + break; 26.557 + 26.558 + case ltos: 26.559 + SET_LOCALS_LONG(object->long_field(entry->f2()), 0); 26.560 + break; 26.561 + 26.562 + case ftos: 26.563 + SET_LOCALS_FLOAT(object->float_field(entry->f2()), 0); 26.564 + break; 26.565 + 26.566 + case dtos: 26.567 + SET_LOCALS_DOUBLE(object->double_field(entry->f2()), 0); 26.568 + break; 26.569 + 26.570 + case atos: 26.571 + SET_LOCALS_OBJECT(object->obj_field(entry->f2()), 0); 26.572 + break; 26.573 + 26.574 + default: 26.575 + ShouldNotReachHere(); 26.576 + } 26.577 + } 26.578 +} 26.579 + 26.580 +void CppInterpreter::empty_entry(methodOop method, intptr_t UNUSED, TRAPS) { 26.581 + JavaThread *thread = (JavaThread *) THREAD; 26.582 + ZeroStack *stack = thread->zero_stack(); 26.583 + 26.584 + // Drop into the slow path if we need a safepoint check 26.585 + if (SafepointSynchronize::do_call_back()) { 26.586 + normal_entry(method, 0, THREAD); 26.587 + return; 26.588 + } 26.589 + 26.590 + // Pop our parameters 26.591 + stack->set_sp(stack->sp() + method->size_of_parameters()); 26.592 +} 26.593 + 26.594 +bool CppInterpreter::stack_overflow_imminent(JavaThread *thread) { 26.595 + // How is the ABI stack? 26.596 + address stack_top = thread->stack_base() - thread->stack_size(); 26.597 + int free_stack = os::current_stack_pointer() - stack_top; 26.598 + if (free_stack < StackShadowPages * os::vm_page_size()) { 26.599 + return true; 26.600 + } 26.601 + 26.602 + // How is the Zero stack? 26.603 + // Throwing a StackOverflowError involves a VM call, which means 26.604 + // we need a frame on the stack. We should be checking here to 26.605 + // ensure that methods we call have enough room to install the 26.606 + // largest possible frame, but that's more than twice the size 26.607 + // of the entire Zero stack we get by default, so we just check 26.608 + // we have *some* space instead... 26.609 + free_stack = thread->zero_stack()->available_words() * wordSize; 26.610 + if (free_stack < StackShadowPages * os::vm_page_size()) { 26.611 + return true; 26.612 + } 26.613 + 26.614 + return false; 26.615 +} 26.616 + 26.617 +InterpreterFrame *InterpreterFrame::build(ZeroStack* stack, 26.618 + const methodOop method, 26.619 + JavaThread* thread) { 26.620 + int monitor_words = 26.621 + method->is_synchronized() ? frame::interpreter_frame_monitor_size() : 0; 26.622 + int stack_words = method->is_native() ? 0 : method->max_stack(); 26.623 + 26.624 + if (header_words + monitor_words + stack_words > stack->available_words()) { 26.625 + Unimplemented(); 26.626 + } 26.627 + 26.628 + intptr_t *locals; 26.629 + if (method->is_native()) 26.630 + locals = stack->sp() + (method->size_of_parameters() - 1); 26.631 + else 26.632 + locals = stack->sp() + (method->max_locals() - 1); 26.633 + 26.634 + stack->push(0); // next_frame, filled in later 26.635 + intptr_t *fp = stack->sp(); 26.636 + assert(fp - stack->sp() == next_frame_off, "should be"); 26.637 + 26.638 + stack->push(INTERPRETER_FRAME); 26.639 + assert(fp - stack->sp() == frame_type_off, "should be"); 26.640 + 26.641 + interpreterState istate = 26.642 + (interpreterState) stack->alloc(sizeof(BytecodeInterpreter)); 26.643 + assert(fp - stack->sp() == istate_off, "should be"); 26.644 + 26.645 + istate->set_locals(locals); 26.646 + istate->set_method(method); 26.647 + istate->set_self_link(istate); 26.648 + istate->set_prev_link(NULL); 26.649 + istate->set_thread(thread); 26.650 + istate->set_bcp(method->is_native() ? NULL : method->code_base()); 26.651 + istate->set_constants(method->constants()->cache()); 26.652 + istate->set_msg(BytecodeInterpreter::method_entry); 26.653 + istate->set_oop_temp(NULL); 26.654 + istate->set_mdx(NULL); 26.655 + istate->set_callee(NULL); 26.656 + 26.657 + istate->set_monitor_base((BasicObjectLock *) stack->sp()); 26.658 + if (method->is_synchronized()) { 26.659 + BasicObjectLock *monitor = 26.660 + (BasicObjectLock *) stack->alloc(monitor_words * wordSize); 26.661 + oop object; 26.662 + if (method->is_static()) 26.663 + object = method->constants()->pool_holder()->klass_part()->java_mirror(); 26.664 + else 26.665 + object = (oop) locals[0]; 26.666 + monitor->set_obj(object); 26.667 + } 26.668 + 26.669 + istate->set_stack_base(stack->sp()); 26.670 + istate->set_stack(stack->sp() - 1); 26.671 + if (stack_words) 26.672 + stack->alloc(stack_words * wordSize); 26.673 + istate->set_stack_limit(stack->sp() - 1); 26.674 + 26.675 + return (InterpreterFrame *) fp; 26.676 +} 26.677 + 26.678 +int AbstractInterpreter::BasicType_as_index(BasicType type) { 26.679 + int i = 0; 26.680 + switch (type) { 26.681 + case T_BOOLEAN: i = 0; break; 26.682 + case T_CHAR : i = 1; break; 26.683 + case T_BYTE : i = 2; break; 26.684 + case T_SHORT : i = 3; break; 26.685 + case T_INT : i = 4; break; 26.686 + case T_LONG : i = 5; break; 26.687 + case T_VOID : i = 6; break; 26.688 + case T_FLOAT : i = 7; break; 26.689 + case T_DOUBLE : i = 8; break; 26.690 + case T_OBJECT : i = 9; break; 26.691 + case T_ARRAY : i = 9; break; 26.692 + default : ShouldNotReachHere(); 26.693 + } 26.694 + assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, 26.695 + "index out of bounds"); 26.696 + return i; 26.697 +} 26.698 + 26.699 +address InterpreterGenerator::generate_empty_entry() { 26.700 + if (!UseFastEmptyMethods) 26.701 + return NULL; 26.702 + 26.703 + return generate_entry((address) CppInterpreter::empty_entry); 26.704 +} 26.705 + 26.706 +address InterpreterGenerator::generate_accessor_entry() { 26.707 + if (!UseFastAccessorMethods) 26.708 + return NULL; 26.709 + 26.710 + return generate_entry((address) CppInterpreter::accessor_entry); 26.711 +} 26.712 + 26.713 +address InterpreterGenerator::generate_native_entry(bool synchronized) { 26.714 + assert(synchronized == false, "should be"); 26.715 + 26.716 + return generate_entry((address) CppInterpreter::native_entry); 26.717 +} 26.718 + 26.719 +address InterpreterGenerator::generate_normal_entry(bool synchronized) { 26.720 + assert(synchronized == false, "should be"); 26.721 + 26.722 + return generate_entry((address) CppInterpreter::normal_entry); 26.723 +} 26.724 + 26.725 +address AbstractInterpreterGenerator::generate_method_entry( 26.726 + AbstractInterpreter::MethodKind kind) { 26.727 + address entry_point = NULL; 26.728 + 26.729 + switch (kind) { 26.730 + case Interpreter::zerolocals: 26.731 + case Interpreter::zerolocals_synchronized: 26.732 + break; 26.733 + 26.734 + case Interpreter::native: 26.735 + entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false); 26.736 + break; 26.737 + 26.738 + case Interpreter::native_synchronized: 26.739 + entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false); 26.740 + break; 26.741 + 26.742 + case Interpreter::empty: 26.743 + entry_point = ((InterpreterGenerator*) this)->generate_empty_entry(); 26.744 + break; 26.745 + 26.746 + case Interpreter::accessor: 26.747 + entry_point = ((InterpreterGenerator*) this)->generate_accessor_entry(); 26.748 + break; 26.749 + 26.750 + case Interpreter::abstract: 26.751 + entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry(); 26.752 + break; 26.753 + 26.754 + case Interpreter::method_handle: 26.755 + entry_point = ((InterpreterGenerator*) this)->generate_method_handle_entry(); 26.756 + break; 26.757 + 26.758 + case Interpreter::java_lang_math_sin: 26.759 + case Interpreter::java_lang_math_cos: 26.760 + case Interpreter::java_lang_math_tan: 26.761 + case Interpreter::java_lang_math_abs: 26.762 + case Interpreter::java_lang_math_log: 26.763 + case Interpreter::java_lang_math_log10: 26.764 + case Interpreter::java_lang_math_sqrt: 26.765 + entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind); 26.766 + break; 26.767 + 26.768 + default: 26.769 + ShouldNotReachHere(); 26.770 + } 26.771 + 26.772 + if (entry_point == NULL) 26.773 + entry_point = ((InterpreterGenerator*) this)->generate_normal_entry(false); 26.774 + 26.775 + return entry_point; 26.776 +} 26.777 + 26.778 +InterpreterGenerator::InterpreterGenerator(StubQueue* code) 26.779 + : CppInterpreterGenerator(code) { 26.780 + generate_all(); 26.781 +} 26.782 + 26.783 +// Deoptimization helpers 26.784 + 26.785 +InterpreterFrame *InterpreterFrame::build(ZeroStack* stack, int size) { 26.786 + int size_in_words = size >> LogBytesPerWord; 26.787 + assert(size_in_words * wordSize == size, "unaligned"); 26.788 + assert(size_in_words >= header_words, "too small"); 26.789 + 26.790 + if (size_in_words > stack->available_words()) { 26.791 + Unimplemented(); 26.792 + } 26.793 + 26.794 + stack->push(0); // next_frame, filled in later 26.795 + intptr_t *fp = stack->sp(); 26.796 + assert(fp - stack->sp() == next_frame_off, "should be"); 26.797 + 26.798 + stack->push(INTERPRETER_FRAME); 26.799 + assert(fp - stack->sp() == frame_type_off, "should be"); 26.800 + 26.801 + interpreterState istate = 26.802 + (interpreterState) stack->alloc(sizeof(BytecodeInterpreter)); 26.803 + assert(fp - stack->sp() == istate_off, "should be"); 26.804 + istate->set_self_link(NULL); // mark invalid 26.805 + 26.806 + stack->alloc((size_in_words - header_words) * wordSize); 26.807 + 26.808 + return (InterpreterFrame *) fp; 26.809 +} 26.810 + 26.811 +int AbstractInterpreter::layout_activation(methodOop method, 26.812 + int tempcount, 26.813 + int popframe_extra_args, 26.814 + int moncount, 26.815 + int callee_param_count, 26.816 + int callee_locals, 26.817 + frame* caller, 26.818 + frame* interpreter_frame, 26.819 + bool is_top_frame) { 26.820 + assert(popframe_extra_args == 0, "what to do?"); 26.821 + assert(!is_top_frame || (!callee_locals && !callee_param_count), 26.822 + "top frame should have no caller") 26.823 + 26.824 + // This code must exactly match what InterpreterFrame::build 26.825 + // does (the full InterpreterFrame::build, that is, not the 26.826 + // one that creates empty frames for the deoptimizer). 26.827 + // 26.828 + // If interpreter_frame is not NULL then it will be filled in. 26.829 + // It's size is determined by a previous call to this method, 26.830 + // so it should be correct. 26.831 + // 26.832 + // Note that tempcount is the current size of the expression 26.833 + // stack. For top most frames we will allocate a full sized 26.834 + // expression stack and not the trimmed version that non-top 26.835 + // frames have. 26.836 + 26.837 + int header_words = InterpreterFrame::header_words; 26.838 + int monitor_words = moncount * frame::interpreter_frame_monitor_size(); 26.839 + int stack_words = is_top_frame ? method->max_stack() : tempcount; 26.840 + int callee_extra_locals = callee_locals - callee_param_count; 26.841 + 26.842 + if (interpreter_frame) { 26.843 + intptr_t *locals = interpreter_frame->sp() + method->max_locals(); 26.844 + interpreterState istate = interpreter_frame->get_interpreterState(); 26.845 + intptr_t *monitor_base = (intptr_t*) istate; 26.846 + intptr_t *stack_base = monitor_base - monitor_words; 26.847 + intptr_t *stack = stack_base - tempcount - 1; 26.848 + 26.849 + BytecodeInterpreter::layout_interpreterState(istate, 26.850 + caller, 26.851 + NULL, 26.852 + method, 26.853 + locals, 26.854 + stack, 26.855 + stack_base, 26.856 + monitor_base, 26.857 + NULL, 26.858 + is_top_frame); 26.859 + } 26.860 + return header_words + monitor_words + stack_words + callee_extra_locals; 26.861 +} 26.862 + 26.863 +void BytecodeInterpreter::layout_interpreterState(interpreterState istate, 26.864 + frame* caller, 26.865 + frame* current, 26.866 + methodOop method, 26.867 + intptr_t* locals, 26.868 + intptr_t* stack, 26.869 + intptr_t* stack_base, 26.870 + intptr_t* monitor_base, 26.871 + intptr_t* frame_bottom, 26.872 + bool is_top_frame) { 26.873 + istate->set_locals(locals); 26.874 + istate->set_method(method); 26.875 + istate->set_self_link(istate); 26.876 + istate->set_prev_link(NULL); 26.877 + // thread will be set by a hacky repurposing of frame::patch_pc() 26.878 + // bcp will be set by vframeArrayElement::unpack_on_stack() 26.879 + istate->set_constants(method->constants()->cache()); 26.880 + istate->set_msg(BytecodeInterpreter::method_resume); 26.881 + istate->set_bcp_advance(0); 26.882 + istate->set_oop_temp(NULL); 26.883 + istate->set_mdx(NULL); 26.884 + if (caller->is_interpreted_frame()) { 26.885 + interpreterState prev = caller->get_interpreterState(); 26.886 + prev->set_callee(method); 26.887 + if (*prev->bcp() == Bytecodes::_invokeinterface) 26.888 + prev->set_bcp_advance(5); 26.889 + else 26.890 + prev->set_bcp_advance(3); 26.891 + } 26.892 + istate->set_callee(NULL); 26.893 + istate->set_monitor_base((BasicObjectLock *) monitor_base); 26.894 + istate->set_stack_base(stack_base); 26.895 + istate->set_stack(stack); 26.896 + istate->set_stack_limit(stack_base - method->max_stack() - 1); 26.897 +} 26.898 + 26.899 +address CppInterpreter::return_entry(TosState state, int length) { 26.900 + ShouldNotCallThis(); 26.901 +} 26.902 + 26.903 +address CppInterpreter::deopt_entry(TosState state, int length) { 26.904 + return NULL; 26.905 +} 26.906 + 26.907 +// Helper for (runtime) stack overflow checks 26.908 + 26.909 +int AbstractInterpreter::size_top_interpreter_activation(methodOop method) { 26.910 + return 0; 26.911 +} 26.912 + 26.913 +// Helper for figuring out if frames are interpreter frames 26.914 + 26.915 +bool CppInterpreter::contains(address pc) { 26.916 +#ifdef PRODUCT 26.917 + ShouldNotCallThis(); 26.918 +#else 26.919 + return false; // make frame::print_value_on work 26.920 +#endif // !PRODUCT 26.921 +} 26.922 + 26.923 +// Result handlers and convertors 26.924 + 26.925 +address CppInterpreterGenerator::generate_result_handler_for( 26.926 + BasicType type) { 26.927 + assembler()->advance(1); 26.928 + return ShouldNotCallThisStub(); 26.929 +} 26.930 + 26.931 +address CppInterpreterGenerator::generate_tosca_to_stack_converter( 26.932 + BasicType type) { 26.933 + assembler()->advance(1); 26.934 + return ShouldNotCallThisStub(); 26.935 +} 26.936 + 26.937 +address CppInterpreterGenerator::generate_stack_to_stack_converter( 26.938 + BasicType type) { 26.939 + assembler()->advance(1); 26.940 + return ShouldNotCallThisStub(); 26.941 +} 26.942 + 26.943 +address CppInterpreterGenerator::generate_stack_to_native_abi_converter( 26.944 + BasicType type) { 26.945 + assembler()->advance(1); 26.946 + return ShouldNotCallThisStub(); 26.947 +} 26.948 + 26.949 +#endif // CC_INTERP
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/src/cpu/zero/vm/cppInterpreter_zero.hpp Tue Oct 13 12:04:21 2009 -0700 27.3 @@ -0,0 +1,43 @@ 27.4 +/* 27.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 27.6 + * Copyright 2007, 2008 Red Hat, Inc. 27.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.8 + * 27.9 + * This code is free software; you can redistribute it and/or modify it 27.10 + * under the terms of the GNU General Public License version 2 only, as 27.11 + * published by the Free Software Foundation. 27.12 + * 27.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 27.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 27.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27.16 + * version 2 for more details (a copy is included in the LICENSE file that 27.17 + * accompanied this code). 27.18 + * 27.19 + * You should have received a copy of the GNU General Public License version 27.20 + * 2 along with this work; if not, write to the Free Software Foundation, 27.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27.22 + * 27.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 27.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 27.25 + * have any questions. 27.26 + * 27.27 + */ 27.28 + 27.29 + protected: 27.30 + // Size of interpreter code 27.31 + const static int InterpreterCodeSize = 6 * K; 27.32 + 27.33 + public: 27.34 + // Method entries 27.35 + static void normal_entry(methodOop method, intptr_t UNUSED, TRAPS); 27.36 + static void native_entry(methodOop method, intptr_t UNUSED, TRAPS); 27.37 + static void accessor_entry(methodOop method, intptr_t UNUSED, TRAPS); 27.38 + static void empty_entry(methodOop method, intptr_t UNUSED, TRAPS); 27.39 + 27.40 + public: 27.41 + // Main loop of normal_entry 27.42 + static void main_loop(int recurse, TRAPS); 27.43 + 27.44 + private: 27.45 + // Stack overflow checks 27.46 + static bool stack_overflow_imminent(JavaThread *thread);
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/src/cpu/zero/vm/debug_zero.cpp Tue Oct 13 12:04:21 2009 -0700 28.3 @@ -0,0 +1,31 @@ 28.4 +/* 28.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 28.6 + * Copyright 2007 Red Hat, Inc. 28.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.8 + * 28.9 + * This code is free software; you can redistribute it and/or modify it 28.10 + * under the terms of the GNU General Public License version 2 only, as 28.11 + * published by the Free Software Foundation. 28.12 + * 28.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 28.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 28.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 28.16 + * version 2 for more details (a copy is included in the LICENSE file that 28.17 + * accompanied this code). 28.18 + * 28.19 + * You should have received a copy of the GNU General Public License version 28.20 + * 2 along with this work; if not, write to the Free Software Foundation, 28.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 28.22 + * 28.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 28.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 28.25 + * have any questions. 28.26 + * 28.27 + */ 28.28 + 28.29 +#include "incls/_precompiled.incl" 28.30 +#include "incls/_debug_zero.cpp.incl" 28.31 + 28.32 +void pd_ps(frame f) { 28.33 + ShouldNotCallThis(); 28.34 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 29.2 +++ b/src/cpu/zero/vm/depChecker_zero.cpp Tue Oct 13 12:04:21 2009 -0700 29.3 @@ -0,0 +1,26 @@ 29.4 +/* 29.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 29.6 + * Copyright 2009 Red Hat, Inc. 29.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.8 + * 29.9 + * This code is free software; you can redistribute it and/or modify it 29.10 + * under the terms of the GNU General Public License version 2 only, as 29.11 + * published by the Free Software Foundation. 29.12 + * 29.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 29.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 29.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 29.16 + * version 2 for more details (a copy is included in the LICENSE file that 29.17 + * accompanied this code). 29.18 + * 29.19 + * You should have received a copy of the GNU General Public License version 29.20 + * 2 along with this work; if not, write to the Free Software Foundation, 29.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 29.22 + * 29.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 29.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 29.25 + * have any questions. 29.26 + * 29.27 + */ 29.28 + 29.29 +// This file is intentionally empty
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/src/cpu/zero/vm/depChecker_zero.hpp Tue Oct 13 12:04:21 2009 -0700 30.3 @@ -0,0 +1,26 @@ 30.4 +/* 30.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 30.6 + * Copyright 2009 Red Hat, Inc. 30.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.8 + * 30.9 + * This code is free software; you can redistribute it and/or modify it 30.10 + * under the terms of the GNU General Public License version 2 only, as 30.11 + * published by the Free Software Foundation. 30.12 + * 30.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 30.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 30.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 30.16 + * version 2 for more details (a copy is included in the LICENSE file that 30.17 + * accompanied this code). 30.18 + * 30.19 + * You should have received a copy of the GNU General Public License version 30.20 + * 2 along with this work; if not, write to the Free Software Foundation, 30.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 30.22 + * 30.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 30.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 30.25 + * have any questions. 30.26 + * 30.27 + */ 30.28 + 30.29 +// This file is intentionally empty
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 31.2 +++ b/src/cpu/zero/vm/disassembler_zero.cpp Tue Oct 13 12:04:21 2009 -0700 31.3 @@ -0,0 +1,26 @@ 31.4 +/* 31.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 31.6 + * Copyright 2009 Red Hat, Inc. 31.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.8 + * 31.9 + * This code is free software; you can redistribute it and/or modify it 31.10 + * under the terms of the GNU General Public License version 2 only, as 31.11 + * published by the Free Software Foundation. 31.12 + * 31.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 31.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 31.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 31.16 + * version 2 for more details (a copy is included in the LICENSE file that 31.17 + * accompanied this code). 31.18 + * 31.19 + * You should have received a copy of the GNU General Public License version 31.20 + * 2 along with this work; if not, write to the Free Software Foundation, 31.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 31.22 + * 31.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 31.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 31.25 + * have any questions. 31.26 + * 31.27 + */ 31.28 + 31.29 +// This file is intentionally empty
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/src/cpu/zero/vm/disassembler_zero.hpp Tue Oct 13 12:04:21 2009 -0700 32.3 @@ -0,0 +1,35 @@ 32.4 +/* 32.5 + * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. 32.6 + * Copyright 2007 Red Hat, Inc. 32.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.8 + * 32.9 + * This code is free software; you can redistribute it and/or modify it 32.10 + * under the terms of the GNU General Public License version 2 only, as 32.11 + * published by the Free Software Foundation. 32.12 + * 32.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 32.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 32.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 32.16 + * version 2 for more details (a copy is included in the LICENSE file that 32.17 + * accompanied this code). 32.18 + * 32.19 + * You should have received a copy of the GNU General Public License version 32.20 + * 2 along with this work; if not, write to the Free Software Foundation, 32.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 32.22 + * 32.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 32.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 32.25 + * have any questions. 32.26 + * 32.27 + */ 32.28 + 32.29 +// The disassembler prints out zero code annotated 32.30 +// with Java specific information. 32.31 + 32.32 + static int pd_instruction_alignment() { 32.33 + ShouldNotCallThis(); 32.34 + } 32.35 + 32.36 + static const char* pd_cpu_opts() { 32.37 + ShouldNotCallThis(); 32.38 + }
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/src/cpu/zero/vm/dump_zero.cpp Tue Oct 13 12:04:21 2009 -0700 33.3 @@ -0,0 +1,36 @@ 33.4 +/* 33.5 + * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved. 33.6 + * Copyright 2007 Red Hat, Inc. 33.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.8 + * 33.9 + * This code is free software; you can redistribute it and/or modify it 33.10 + * under the terms of the GNU General Public License version 2 only, as 33.11 + * published by the Free Software Foundation. 33.12 + * 33.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 33.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 33.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 33.16 + * version 2 for more details (a copy is included in the LICENSE file that 33.17 + * accompanied this code). 33.18 + * 33.19 + * You should have received a copy of the GNU General Public License version 33.20 + * 2 along with this work; if not, write to the Free Software Foundation, 33.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 33.22 + * 33.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 33.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 33.25 + * have any questions. 33.26 + * 33.27 + */ 33.28 + 33.29 +#include "incls/_precompiled.incl" 33.30 +#include "incls/_dump_zero.cpp.incl" 33.31 + 33.32 +void CompactingPermGenGen::generate_vtable_methods(void** vtbl_list, 33.33 + void** vtable, 33.34 + char** md_top, 33.35 + char* md_end, 33.36 + char** mc_top, 33.37 + char* mc_end) { 33.38 + ShouldNotCallThis(); 33.39 +}
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 34.2 +++ b/src/cpu/zero/vm/entryFrame_zero.hpp Tue Oct 13 12:04:21 2009 -0700 34.3 @@ -0,0 +1,65 @@ 34.4 +/* 34.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 34.6 + * Copyright 2008 Red Hat, Inc. 34.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 34.8 + * 34.9 + * This code is free software; you can redistribute it and/or modify it 34.10 + * under the terms of the GNU General Public License version 2 only, as 34.11 + * published by the Free Software Foundation. 34.12 + * 34.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 34.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 34.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 34.16 + * version 2 for more details (a copy is included in the LICENSE file that 34.17 + * accompanied this code). 34.18 + * 34.19 + * You should have received a copy of the GNU General Public License version 34.20 + * 2 along with this work; if not, write to the Free Software Foundation, 34.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 34.22 + * 34.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 34.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 34.25 + * have any questions. 34.26 + * 34.27 + */ 34.28 + 34.29 +// | ... | 34.30 +// +--------------------+ ------------------ 34.31 +// | parameter n-1 | low addresses 34.32 +// | ... | 34.33 +// | parameter 0 | 34.34 +// | call_wrapper | 34.35 +// | frame_type | 34.36 +// | next_frame | high addresses 34.37 +// +--------------------+ ------------------ 34.38 +// | ... | 34.39 + 34.40 +class EntryFrame : public ZeroFrame { 34.41 + private: 34.42 + EntryFrame() : ZeroFrame() { 34.43 + ShouldNotCallThis(); 34.44 + } 34.45 + 34.46 + protected: 34.47 + enum Layout { 34.48 + call_wrapper_off = jf_header_words, 34.49 + header_words 34.50 + }; 34.51 + 34.52 + public: 34.53 + static EntryFrame *build(ZeroStack* stack, 34.54 + const intptr_t* parameters, 34.55 + int parameter_words, 34.56 + JavaCallWrapper* call_wrapper); 34.57 + public: 34.58 + JavaCallWrapper *call_wrapper() const { 34.59 + return (JavaCallWrapper *) value_of_word(call_wrapper_off); 34.60 + } 34.61 + 34.62 + public: 34.63 + void identify_word(int frame_index, 34.64 + int offset, 34.65 + char* fieldbuf, 34.66 + char* valuebuf, 34.67 + int buflen) const; 34.68 +};
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 35.2 +++ b/src/cpu/zero/vm/entry_zero.hpp Tue Oct 13 12:04:21 2009 -0700 35.3 @@ -0,0 +1,64 @@ 35.4 +/* 35.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 35.6 + * Copyright 2008, 2009 Red Hat, Inc. 35.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.8 + * 35.9 + * This code is free software; you can redistribute it and/or modify it 35.10 + * under the terms of the GNU General Public License version 2 only, as 35.11 + * published by the Free Software Foundation. 35.12 + * 35.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 35.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 35.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 35.16 + * version 2 for more details (a copy is included in the LICENSE file that 35.17 + * accompanied this code). 35.18 + * 35.19 + * You should have received a copy of the GNU General Public License version 35.20 + * 2 along with this work; if not, write to the Free Software Foundation, 35.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 35.22 + * 35.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 35.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 35.25 + * have any questions. 35.26 + * 35.27 + */ 35.28 + 35.29 +class ZeroEntry { 35.30 + public: 35.31 + ZeroEntry() { 35.32 + ShouldNotCallThis(); 35.33 + } 35.34 + 35.35 + private: 35.36 + address _entry_point; 35.37 + 35.38 + public: 35.39 + address entry_point() const { 35.40 + return _entry_point; 35.41 + } 35.42 + void set_entry_point(address entry_point) { 35.43 + _entry_point = entry_point; 35.44 + } 35.45 + 35.46 + private: 35.47 + typedef void (*NormalEntryFunc)(methodOop method, 35.48 + intptr_t base_pc, 35.49 + TRAPS); 35.50 + typedef void (*OSREntryFunc)(methodOop method, 35.51 + address osr_buf, 35.52 + intptr_t base_pc, 35.53 + TRAPS); 35.54 + 35.55 + public: 35.56 + void invoke(methodOop method, TRAPS) const { 35.57 + ((NormalEntryFunc) entry_point())(method, (intptr_t) this, THREAD); 35.58 + } 35.59 + void invoke_osr(methodOop method, address osr_buf, TRAPS) const { 35.60 + ((OSREntryFunc) entry_point())(method, osr_buf, (intptr_t) this, THREAD); 35.61 + } 35.62 + 35.63 + public: 35.64 + static ByteSize entry_point_offset() { 35.65 + return byte_offset_of(ZeroEntry, _entry_point); 35.66 + } 35.67 +};
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 36.2 +++ b/src/cpu/zero/vm/fakeStubFrame_zero.hpp Tue Oct 13 12:04:21 2009 -0700 36.3 @@ -0,0 +1,53 @@ 36.4 +/* 36.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 36.6 + * Copyright 2008 Red Hat, Inc. 36.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.8 + * 36.9 + * This code is free software; you can redistribute it and/or modify it 36.10 + * under the terms of the GNU General Public License version 2 only, as 36.11 + * published by the Free Software Foundation. 36.12 + * 36.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 36.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 36.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 36.16 + * version 2 for more details (a copy is included in the LICENSE file that 36.17 + * accompanied this code). 36.18 + * 36.19 + * You should have received a copy of the GNU General Public License version 36.20 + * 2 along with this work; if not, write to the Free Software Foundation, 36.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 36.22 + * 36.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 36.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 36.25 + * have any questions. 36.26 + * 36.27 + */ 36.28 + 36.29 +// | ... | 36.30 +// +--------------------+ ------------------ 36.31 +// | frame_type | low addresses 36.32 +// | next_frame | high addresses 36.33 +// +--------------------+ ------------------ 36.34 +// | ... | 36.35 + 36.36 +class FakeStubFrame : public ZeroFrame { 36.37 + private: 36.38 + FakeStubFrame() : ZeroFrame() { 36.39 + ShouldNotCallThis(); 36.40 + } 36.41 + 36.42 + protected: 36.43 + enum Layout { 36.44 + header_words = jf_header_words 36.45 + }; 36.46 + 36.47 + public: 36.48 + static FakeStubFrame *build(ZeroStack* stack); 36.49 + 36.50 + public: 36.51 + void identify_word(int frame_index, 36.52 + int offset, 36.53 + char* fieldbuf, 36.54 + char* valuebuf, 36.55 + int buflen) const {} 36.56 +};
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 37.2 +++ b/src/cpu/zero/vm/frame_zero.cpp Tue Oct 13 12:04:21 2009 -0700 37.3 @@ -0,0 +1,414 @@ 37.4 +/* 37.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 37.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 37.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.8 + * 37.9 + * This code is free software; you can redistribute it and/or modify it 37.10 + * under the terms of the GNU General Public License version 2 only, as 37.11 + * published by the Free Software Foundation. 37.12 + * 37.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 37.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 37.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 37.16 + * version 2 for more details (a copy is included in the LICENSE file that 37.17 + * accompanied this code). 37.18 + * 37.19 + * You should have received a copy of the GNU General Public License version 37.20 + * 2 along with this work; if not, write to the Free Software Foundation, 37.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 37.22 + * 37.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 37.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 37.25 + * have any questions. 37.26 + * 37.27 + */ 37.28 + 37.29 +#include "incls/_precompiled.incl" 37.30 +#include "incls/_frame_zero.cpp.incl" 37.31 + 37.32 +#ifdef ASSERT 37.33 +void RegisterMap::check_location_valid() { 37.34 + ShouldNotCallThis(); 37.35 +} 37.36 +#endif 37.37 + 37.38 +bool frame::is_interpreted_frame() const { 37.39 + return zeroframe()->is_interpreter_frame(); 37.40 +} 37.41 + 37.42 +bool frame::is_fake_stub_frame() const { 37.43 + return zeroframe()->is_fake_stub_frame(); 37.44 +} 37.45 + 37.46 +frame frame::sender_for_entry_frame(RegisterMap *map) const { 37.47 + assert(map != NULL, "map must be set"); 37.48 + assert(!entry_frame_is_first(), "next Java fp must be non zero"); 37.49 + assert(entry_frame_call_wrapper()->anchor()->last_Java_sp() == sender_sp(), 37.50 + "sender should be next Java frame"); 37.51 + map->clear(); 37.52 + assert(map->include_argument_oops(), "should be set by clear"); 37.53 + return frame(sender_sp(), sp() + 1); 37.54 +} 37.55 + 37.56 +frame frame::sender_for_interpreter_frame(RegisterMap *map) const { 37.57 + return frame(sender_sp(), sp() + 1); 37.58 +} 37.59 + 37.60 +frame frame::sender_for_compiled_frame(RegisterMap *map) const { 37.61 + return frame(sender_sp(), sp() + 1); 37.62 +} 37.63 + 37.64 +frame frame::sender_for_fake_stub_frame(RegisterMap *map) const { 37.65 + return frame(sender_sp(), sp() + 1); 37.66 +} 37.67 + 37.68 +frame frame::sender(RegisterMap* map) const { 37.69 + // Default is not to follow arguments; the various 37.70 + // sender_for_xxx methods update this accordingly. 37.71 + map->set_include_argument_oops(false); 37.72 + 37.73 + if (is_entry_frame()) 37.74 + return sender_for_entry_frame(map); 37.75 + 37.76 + if (is_interpreted_frame()) 37.77 + return sender_for_interpreter_frame(map); 37.78 + 37.79 + if (is_compiled_frame()) 37.80 + return sender_for_compiled_frame(map); 37.81 + 37.82 + if (is_fake_stub_frame()) 37.83 + return sender_for_fake_stub_frame(map); 37.84 + 37.85 + ShouldNotReachHere(); 37.86 +} 37.87 + 37.88 +#ifdef CC_INTERP 37.89 +BasicObjectLock* frame::interpreter_frame_monitor_begin() const { 37.90 + return get_interpreterState()->monitor_base(); 37.91 +} 37.92 + 37.93 +BasicObjectLock* frame::interpreter_frame_monitor_end() const { 37.94 + return (BasicObjectLock*) get_interpreterState()->stack_base(); 37.95 +} 37.96 +#endif // CC_INTERP 37.97 + 37.98 +void frame::patch_pc(Thread* thread, address pc) { 37.99 + // We borrow this call to set the thread pointer in the interpreter 37.100 + // state; the hook to set up deoptimized frames isn't supplied it. 37.101 + assert(pc == NULL, "should be"); 37.102 + get_interpreterState()->set_thread((JavaThread *) thread); 37.103 +} 37.104 + 37.105 +bool frame::safe_for_sender(JavaThread *thread) { 37.106 + ShouldNotCallThis(); 37.107 +} 37.108 + 37.109 +void frame::pd_gc_epilog() { 37.110 +} 37.111 + 37.112 +bool frame::is_interpreted_frame_valid(JavaThread *thread) const { 37.113 + ShouldNotCallThis(); 37.114 +} 37.115 + 37.116 +BasicType frame::interpreter_frame_result(oop* oop_result, 37.117 + jvalue* value_result) { 37.118 + assert(is_interpreted_frame(), "interpreted frame expected"); 37.119 + methodOop method = interpreter_frame_method(); 37.120 + BasicType type = method->result_type(); 37.121 + intptr_t* tos_addr = (intptr_t *) interpreter_frame_tos_address(); 37.122 + oop obj; 37.123 + 37.124 + switch (type) { 37.125 + case T_VOID: 37.126 + break; 37.127 + case T_BOOLEAN: 37.128 + value_result->z = *(jboolean *) tos_addr; 37.129 + break; 37.130 + case T_BYTE: 37.131 + value_result->b = *(jbyte *) tos_addr; 37.132 + break; 37.133 + case T_CHAR: 37.134 + value_result->c = *(jchar *) tos_addr; 37.135 + break; 37.136 + case T_SHORT: 37.137 + value_result->s = *(jshort *) tos_addr; 37.138 + break; 37.139 + case T_INT: 37.140 + value_result->i = *(jint *) tos_addr; 37.141 + break; 37.142 + case T_LONG: 37.143 + value_result->j = *(jlong *) tos_addr; 37.144 + break; 37.145 + case T_FLOAT: 37.146 + value_result->f = *(jfloat *) tos_addr; 37.147 + break; 37.148 + case T_DOUBLE: 37.149 + value_result->d = *(jdouble *) tos_addr; 37.150 + break; 37.151 + 37.152 + case T_OBJECT: 37.153 + case T_ARRAY: 37.154 + if (method->is_native()) { 37.155 + obj = get_interpreterState()->oop_temp(); 37.156 + } 37.157 + else { 37.158 + oop* obj_p = (oop *) tos_addr; 37.159 + obj = (obj_p == NULL) ? (oop) NULL : *obj_p; 37.160 + } 37.161 + assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check"); 37.162 + *oop_result = obj; 37.163 + break; 37.164 + 37.165 + default: 37.166 + ShouldNotReachHere(); 37.167 + } 37.168 + 37.169 + return type; 37.170 +} 37.171 + 37.172 +int frame::frame_size(RegisterMap* map) const { 37.173 +#ifdef PRODUCT 37.174 + ShouldNotCallThis(); 37.175 +#else 37.176 + return 0; // make javaVFrame::print_value work 37.177 +#endif // PRODUCT 37.178 +} 37.179 + 37.180 +intptr_t* frame::interpreter_frame_tos_at(jint offset) const { 37.181 + int index = (Interpreter::expr_offset_in_bytes(offset) / wordSize); 37.182 + return &interpreter_frame_tos_address()[index]; 37.183 +} 37.184 + 37.185 +void frame::zero_print_on_error(int frame_index, 37.186 + outputStream* st, 37.187 + char* buf, 37.188 + int buflen) const { 37.189 + // Divide the buffer between the field and the value 37.190 + buflen >>= 1; 37.191 + char *fieldbuf = buf; 37.192 + char *valuebuf = buf + buflen; 37.193 + 37.194 + // Print each word of the frame 37.195 + for (intptr_t *addr = fp(); addr <= sp(); addr++) { 37.196 + int offset = sp() - addr; 37.197 + 37.198 + // Fill in default values, then try and improve them 37.199 + snprintf(fieldbuf, buflen, "word[%d]", offset); 37.200 + snprintf(valuebuf, buflen, PTR_FORMAT, *addr); 37.201 + zeroframe()->identify_word(frame_index, offset, fieldbuf, valuebuf, buflen); 37.202 + fieldbuf[buflen - 1] = '\0'; 37.203 + valuebuf[buflen - 1] = '\0'; 37.204 + 37.205 + // Print the result 37.206 + st->print_cr(" " PTR_FORMAT ": %-21s = %s", addr, fieldbuf, valuebuf); 37.207 + } 37.208 +} 37.209 + 37.210 +void ZeroFrame::identify_word(int frame_index, 37.211 + int offset, 37.212 + char* fieldbuf, 37.213 + char* valuebuf, 37.214 + int buflen) const { 37.215 + switch (offset) { 37.216 + case next_frame_off: 37.217 + strncpy(fieldbuf, "next_frame", buflen); 37.218 + break; 37.219 + 37.220 + case frame_type_off: 37.221 + strncpy(fieldbuf, "frame_type", buflen); 37.222 + if (is_entry_frame()) 37.223 + strncpy(valuebuf, "ENTRY_FRAME", buflen); 37.224 + else if (is_interpreter_frame()) 37.225 + strncpy(valuebuf, "INTERPRETER_FRAME", buflen); 37.226 + else if (is_shark_frame()) 37.227 + strncpy(valuebuf, "SHARK_FRAME", buflen); 37.228 + else if (is_fake_stub_frame()) 37.229 + strncpy(valuebuf, "FAKE_STUB_FRAME", buflen); 37.230 + break; 37.231 + 37.232 + default: 37.233 + if (is_entry_frame()) { 37.234 + as_entry_frame()->identify_word( 37.235 + frame_index, offset, fieldbuf, valuebuf, buflen); 37.236 + } 37.237 + else if (is_interpreter_frame()) { 37.238 + as_interpreter_frame()->identify_word( 37.239 + frame_index, offset, fieldbuf, valuebuf, buflen); 37.240 + } 37.241 + else if (is_shark_frame()) { 37.242 + as_shark_frame()->identify_word( 37.243 + frame_index, offset, fieldbuf, valuebuf, buflen); 37.244 + } 37.245 + else if (is_fake_stub_frame()) { 37.246 + as_fake_stub_frame()->identify_word( 37.247 + frame_index, offset, fieldbuf, valuebuf, buflen); 37.248 + } 37.249 + } 37.250 +} 37.251 + 37.252 +void EntryFrame::identify_word(int frame_index, 37.253 + int offset, 37.254 + char* fieldbuf, 37.255 + char* valuebuf, 37.256 + int buflen) const { 37.257 + switch (offset) { 37.258 + case call_wrapper_off: 37.259 + strncpy(fieldbuf, "call_wrapper", buflen); 37.260 + break; 37.261 + 37.262 + default: 37.263 + snprintf(fieldbuf, buflen, "local[%d]", offset - 3); 37.264 + } 37.265 +} 37.266 + 37.267 +void InterpreterFrame::identify_word(int frame_index, 37.268 + int offset, 37.269 + char* fieldbuf, 37.270 + char* valuebuf, 37.271 + int buflen) const { 37.272 + interpreterState istate = interpreter_state(); 37.273 + bool is_valid = istate->self_link() == istate; 37.274 + intptr_t *addr = addr_of_word(offset); 37.275 + 37.276 + // Fixed part 37.277 + if (addr >= (intptr_t *) istate) { 37.278 + const char *field = istate->name_of_field_at_address((address) addr); 37.279 + if (field) { 37.280 + if (is_valid && !strcmp(field, "_method")) { 37.281 + istate->method()->name_and_sig_as_C_string(valuebuf, buflen); 37.282 + } 37.283 + else if (is_valid && !strcmp(field, "_bcp") && istate->bcp()) { 37.284 + snprintf(valuebuf, buflen, PTR_FORMAT " (bci %d)", 37.285 + (intptr_t) istate->bcp(), 37.286 + istate->method()->bci_from(istate->bcp())); 37.287 + } 37.288 + snprintf(fieldbuf, buflen, "%sistate->%s", 37.289 + field[strlen(field) - 1] == ')' ? "(": "", field); 37.290 + } 37.291 + else if (addr == (intptr_t *) istate) { 37.292 + strncpy(fieldbuf, "(vtable for istate)", buflen); 37.293 + } 37.294 + return; 37.295 + } 37.296 + 37.297 + // Variable part 37.298 + if (!is_valid) 37.299 + return; 37.300 + 37.301 + // JNI stuff 37.302 + if (istate->method()->is_native() && addr < istate->stack_base()) { 37.303 + address hA = istate->method()->signature_handler(); 37.304 + if (hA != NULL) { 37.305 + if (hA != (address) InterpreterRuntime::slow_signature_handler) { 37.306 + InterpreterRuntime::SignatureHandler *handler = 37.307 + InterpreterRuntime::SignatureHandler::from_handlerAddr(hA); 37.308 + 37.309 + intptr_t *params = istate->stack_base() - handler->argument_count(); 37.310 + if (addr >= params) { 37.311 + int param = addr - params; 37.312 + const char *desc = ""; 37.313 + if (param == 0) 37.314 + desc = " (JNIEnv)"; 37.315 + else if (param == 1) { 37.316 + if (istate->method()->is_static()) 37.317 + desc = " (mirror)"; 37.318 + else 37.319 + desc = " (this)"; 37.320 + } 37.321 + snprintf(fieldbuf, buflen, "parameter[%d]%s", param, desc); 37.322 + return; 37.323 + } 37.324 + 37.325 + for (int i = 0; i < handler->argument_count(); i++) { 37.326 + if (params[i] == (intptr_t) addr) { 37.327 + snprintf(fieldbuf, buflen, "unboxed parameter[%d]", i); 37.328 + return; 37.329 + } 37.330 + } 37.331 + } 37.332 + } 37.333 + return; 37.334 + } 37.335 + 37.336 + // Monitors and stack 37.337 + identify_vp_word(frame_index, addr, 37.338 + (intptr_t *) istate->monitor_base(), 37.339 + istate->stack_base(), 37.340 + fieldbuf, buflen); 37.341 +} 37.342 + 37.343 +void SharkFrame::identify_word(int frame_index, 37.344 + int offset, 37.345 + char* fieldbuf, 37.346 + char* valuebuf, 37.347 + int buflen) const { 37.348 + // Fixed part 37.349 + switch (offset) { 37.350 + case pc_off: 37.351 + strncpy(fieldbuf, "pc", buflen); 37.352 + if (method()->is_oop()) { 37.353 + nmethod *code = method()->code(); 37.354 + if (code && code->pc_desc_at(pc())) { 37.355 + SimpleScopeDesc ssd(code, pc()); 37.356 + snprintf(valuebuf, buflen, PTR_FORMAT " (bci %d)", 37.357 + (intptr_t) pc(), ssd.bci()); 37.358 + } 37.359 + } 37.360 + return; 37.361 + 37.362 + case unextended_sp_off: 37.363 + strncpy(fieldbuf, "unextended_sp", buflen); 37.364 + return; 37.365 + 37.366 + case method_off: 37.367 + strncpy(fieldbuf, "method", buflen); 37.368 + if (method()->is_oop()) { 37.369 + method()->name_and_sig_as_C_string(valuebuf, buflen); 37.370 + } 37.371 + return; 37.372 + 37.373 + case oop_tmp_off: 37.374 + strncpy(fieldbuf, "oop_tmp", buflen); 37.375 + return; 37.376 + } 37.377 + 37.378 + // Variable part 37.379 + if (method()->is_oop()) { 37.380 + identify_vp_word(frame_index, addr_of_word(offset), 37.381 + addr_of_word(header_words + 1), 37.382 + unextended_sp() + method()->max_stack(), 37.383 + fieldbuf, buflen); 37.384 + } 37.385 +} 37.386 + 37.387 +void ZeroFrame::identify_vp_word(int frame_index, 37.388 + intptr_t* addr, 37.389 + intptr_t* monitor_base, 37.390 + intptr_t* stack_base, 37.391 + char* fieldbuf, 37.392 + int buflen) const { 37.393 + // Monitors 37.394 + if (addr >= stack_base && addr < monitor_base) { 37.395 + int monitor_size = frame::interpreter_frame_monitor_size(); 37.396 + int last_index = (monitor_base - stack_base) / monitor_size - 1; 37.397 + int index = last_index - (addr - stack_base) / monitor_size; 37.398 + intptr_t monitor = (intptr_t) ( 37.399 + (BasicObjectLock *) monitor_base - 1 - index); 37.400 + intptr_t offset = (intptr_t) addr - monitor; 37.401 + 37.402 + if (offset == BasicObjectLock::obj_offset_in_bytes()) 37.403 + snprintf(fieldbuf, buflen, "monitor[%d]->_obj", index); 37.404 + else if (offset == BasicObjectLock::lock_offset_in_bytes()) 37.405 + snprintf(fieldbuf, buflen, "monitor[%d]->_lock", index); 37.406 + 37.407 + return; 37.408 + } 37.409 + 37.410 + // Expression stack 37.411 + if (addr < stack_base) { 37.412 + snprintf(fieldbuf, buflen, "%s[%d]", 37.413 + frame_index == 0 ? "stack_word" : "local", 37.414 + (int) (stack_base - addr - 1)); 37.415 + return; 37.416 + } 37.417 +}
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 38.2 +++ b/src/cpu/zero/vm/frame_zero.hpp Tue Oct 13 12:04:21 2009 -0700 38.3 @@ -0,0 +1,77 @@ 38.4 +/* 38.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 38.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 38.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.8 + * 38.9 + * This code is free software; you can redistribute it and/or modify it 38.10 + * under the terms of the GNU General Public License version 2 only, as 38.11 + * published by the Free Software Foundation. 38.12 + * 38.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 38.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 38.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 38.16 + * version 2 for more details (a copy is included in the LICENSE file that 38.17 + * accompanied this code). 38.18 + * 38.19 + * You should have received a copy of the GNU General Public License version 38.20 + * 2 along with this work; if not, write to the Free Software Foundation, 38.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 38.22 + * 38.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 38.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 38.25 + * have any questions. 38.26 + * 38.27 + */ 38.28 + 38.29 +// A frame represents a physical stack frame on the Zero stack. 38.30 + 38.31 + public: 38.32 + enum { 38.33 + pc_return_offset = 0 38.34 + }; 38.35 + 38.36 + // Constructor 38.37 + public: 38.38 + frame(intptr_t* sp, intptr_t* fp); 38.39 + 38.40 + // The sp of a Zero frame is the address of the highest word in 38.41 + // that frame. We keep track of the lowest address too, so the 38.42 + // boundaries of the frame are available for debug printing. 38.43 + private: 38.44 + intptr_t* _fp; 38.45 + 38.46 + public: 38.47 + intptr_t* fp() const { 38.48 + return _fp; 38.49 + } 38.50 + 38.51 +#ifdef CC_INTERP 38.52 + inline interpreterState get_interpreterState() const; 38.53 +#endif // CC_INTERP 38.54 + 38.55 + public: 38.56 + const ZeroFrame *zeroframe() const { 38.57 + return (ZeroFrame *) sp(); 38.58 + } 38.59 + 38.60 + const EntryFrame *zero_entryframe() const { 38.61 + return zeroframe()->as_entry_frame(); 38.62 + } 38.63 + const InterpreterFrame *zero_interpreterframe() const { 38.64 + return zeroframe()->as_interpreter_frame(); 38.65 + } 38.66 + const SharkFrame *zero_sharkframe() const { 38.67 + return zeroframe()->as_shark_frame(); 38.68 + } 38.69 + 38.70 + public: 38.71 + bool is_fake_stub_frame() const; 38.72 + 38.73 + public: 38.74 + frame sender_for_fake_stub_frame(RegisterMap* map) const; 38.75 + 38.76 + public: 38.77 + void zero_print_on_error(int index, 38.78 + outputStream* st, 38.79 + char* buf, 38.80 + int buflen) const;
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/src/cpu/zero/vm/frame_zero.inline.hpp Tue Oct 13 12:04:21 2009 -0700 39.3 @@ -0,0 +1,151 @@ 39.4 +/* 39.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 39.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 39.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.8 + * 39.9 + * This code is free software; you can redistribute it and/or modify it 39.10 + * under the terms of the GNU General Public License version 2 only, as 39.11 + * published by the Free Software Foundation. 39.12 + * 39.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 39.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 39.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 39.16 + * version 2 for more details (a copy is included in the LICENSE file that 39.17 + * accompanied this code). 39.18 + * 39.19 + * You should have received a copy of the GNU General Public License version 39.20 + * 2 along with this work; if not, write to the Free Software Foundation, 39.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 39.22 + * 39.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 39.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 39.25 + * have any questions. 39.26 + * 39.27 + */ 39.28 + 39.29 +// Constructors 39.30 + 39.31 +inline frame::frame() { 39.32 + _sp = NULL; 39.33 + _fp = NULL; 39.34 + _pc = NULL; 39.35 + _cb = NULL; 39.36 + _deopt_state = unknown; 39.37 +} 39.38 + 39.39 +inline frame::frame(intptr_t* sp, intptr_t* fp) { 39.40 + _sp = sp; 39.41 + _fp = fp; 39.42 + switch (zeroframe()->type()) { 39.43 + case ZeroFrame::ENTRY_FRAME: 39.44 + _pc = StubRoutines::call_stub_return_pc(); 39.45 + _cb = NULL; 39.46 + break; 39.47 + 39.48 + case ZeroFrame::INTERPRETER_FRAME: 39.49 + _pc = NULL; 39.50 + _cb = NULL; 39.51 + break; 39.52 + 39.53 + case ZeroFrame::SHARK_FRAME: 39.54 + _pc = zero_sharkframe()->pc(); 39.55 + _cb = CodeCache::find_blob_unsafe(pc()); 39.56 + break; 39.57 + 39.58 + case ZeroFrame::FAKE_STUB_FRAME: 39.59 + _pc = NULL; 39.60 + _cb = NULL; 39.61 + break; 39.62 + 39.63 + default: 39.64 + ShouldNotReachHere(); 39.65 + } 39.66 + _deopt_state = not_deoptimized; 39.67 +} 39.68 + 39.69 +// Accessors 39.70 + 39.71 +inline intptr_t* frame::sender_sp() const { 39.72 + return (intptr_t *) zeroframe()->next(); 39.73 +} 39.74 + 39.75 +inline intptr_t* frame::link() const { 39.76 + ShouldNotCallThis(); 39.77 +} 39.78 + 39.79 +#ifdef CC_INTERP 39.80 +inline interpreterState frame::get_interpreterState() const { 39.81 + return zero_interpreterframe()->interpreter_state(); 39.82 +} 39.83 + 39.84 +inline intptr_t** frame::interpreter_frame_locals_addr() const { 39.85 + return &(get_interpreterState()->_locals); 39.86 +} 39.87 + 39.88 +inline intptr_t* frame::interpreter_frame_bcx_addr() const { 39.89 + return (intptr_t*) &(get_interpreterState()->_bcp); 39.90 +} 39.91 + 39.92 +inline constantPoolCacheOop* frame::interpreter_frame_cache_addr() const { 39.93 + return &(get_interpreterState()->_constants); 39.94 +} 39.95 + 39.96 +inline methodOop* frame::interpreter_frame_method_addr() const { 39.97 + return &(get_interpreterState()->_method); 39.98 +} 39.99 + 39.100 +inline intptr_t* frame::interpreter_frame_mdx_addr() const { 39.101 + return (intptr_t*) &(get_interpreterState()->_mdx); 39.102 +} 39.103 + 39.104 +inline intptr_t* frame::interpreter_frame_tos_address() const { 39.105 + return get_interpreterState()->_stack + 1; 39.106 +} 39.107 +#endif // CC_INTERP 39.108 + 39.109 +inline int frame::interpreter_frame_monitor_size() { 39.110 + return BasicObjectLock::size(); 39.111 +} 39.112 + 39.113 +inline intptr_t* frame::interpreter_frame_expression_stack() const { 39.114 + intptr_t* monitor_end = (intptr_t*) interpreter_frame_monitor_end(); 39.115 + return monitor_end - 1; 39.116 +} 39.117 + 39.118 +inline jint frame::interpreter_frame_expression_stack_direction() { 39.119 + return -1; 39.120 +} 39.121 + 39.122 +// Return a unique id for this frame. The id must have a value where 39.123 +// we can distinguish identity and younger/older relationship. NULL 39.124 +// represents an invalid (incomparable) frame. 39.125 +inline intptr_t* frame::id() const { 39.126 + return sp(); 39.127 +} 39.128 + 39.129 +inline JavaCallWrapper* frame::entry_frame_call_wrapper() const { 39.130 + return zero_entryframe()->call_wrapper(); 39.131 +} 39.132 + 39.133 +inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) { 39.134 + ShouldNotCallThis(); 39.135 +} 39.136 + 39.137 +inline oop frame::saved_oop_result(RegisterMap* map) const { 39.138 + ShouldNotCallThis(); 39.139 +} 39.140 + 39.141 +inline bool frame::is_older(intptr_t* id) const { 39.142 + ShouldNotCallThis(); 39.143 +} 39.144 + 39.145 +inline intptr_t* frame::entry_frame_argument_at(int offset) const { 39.146 + ShouldNotCallThis(); 39.147 +} 39.148 + 39.149 +inline intptr_t* frame::unextended_sp() const { 39.150 + if (zeroframe()->is_shark_frame()) 39.151 + return zero_sharkframe()->unextended_sp(); 39.152 + else 39.153 + return (intptr_t *) -1; 39.154 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 40.2 +++ b/src/cpu/zero/vm/globalDefinitions_zero.hpp Tue Oct 13 12:04:21 2009 -0700 40.3 @@ -0,0 +1,26 @@ 40.4 +/* 40.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 40.6 + * Copyright 2009 Red Hat, Inc. 40.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 40.8 + * 40.9 + * This code is free software; you can redistribute it and/or modify it 40.10 + * under the terms of the GNU General Public License version 2 only, as 40.11 + * published by the Free Software Foundation. 40.12 + * 40.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 40.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 40.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 40.16 + * version 2 for more details (a copy is included in the LICENSE file that 40.17 + * accompanied this code). 40.18 + * 40.19 + * You should have received a copy of the GNU General Public License version 40.20 + * 2 along with this work; if not, write to the Free Software Foundation, 40.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 40.22 + * 40.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 40.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 40.25 + * have any questions. 40.26 + * 40.27 + */ 40.28 + 40.29 +#include <ffi.h>
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 41.2 +++ b/src/cpu/zero/vm/globals_zero.hpp Tue Oct 13 12:04:21 2009 -0700 41.3 @@ -0,0 +1,55 @@ 41.4 +/* 41.5 + * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. 41.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 41.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41.8 + * 41.9 + * This code is free software; you can redistribute it and/or modify it 41.10 + * under the terms of the GNU General Public License version 2 only, as 41.11 + * published by the Free Software Foundation. 41.12 + * 41.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 41.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 41.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 41.16 + * version 2 for more details (a copy is included in the LICENSE file that 41.17 + * accompanied this code). 41.18 + * 41.19 + * You should have received a copy of the GNU General Public License version 41.20 + * 2 along with this work; if not, write to the Free Software Foundation, 41.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 41.22 + * 41.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 41.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 41.25 + * have any questions. 41.26 + * 41.27 + */ 41.28 + 41.29 +// 41.30 +// Set the default values for platform dependent flags used by the 41.31 +// runtime system. See globals.hpp for details of what they do. 41.32 +// 41.33 + 41.34 +define_pd_global(bool, ConvertSleepToYield, true); 41.35 +define_pd_global(bool, ShareVtableStubs, true); 41.36 +define_pd_global(bool, CountInterpCalls, true); 41.37 +define_pd_global(bool, NeedsDeoptSuspend, false); 41.38 + 41.39 +define_pd_global(bool, ImplicitNullChecks, true); 41.40 +define_pd_global(bool, UncommonNullCast, true); 41.41 + 41.42 +define_pd_global(intx, CodeEntryAlignment, 32); 41.43 +define_pd_global(uintx, TLABSize, 0); 41.44 +#ifdef _LP64 41.45 +define_pd_global(uintx, NewSize, ScaleForWordSize(2048 * K)); 41.46 +#else 41.47 +define_pd_global(uintx, NewSize, ScaleForWordSize(1024 * K)); 41.48 +#endif // _LP64 41.49 +define_pd_global(intx, InlineFrequencyCount, 100); 41.50 +define_pd_global(intx, InlineSmallCode, 1000); 41.51 +define_pd_global(intx, PreInflateSpin, 10); 41.52 + 41.53 +define_pd_global(intx, StackYellowPages, 2); 41.54 +define_pd_global(intx, StackRedPages, 1); 41.55 +define_pd_global(intx, StackShadowPages, 3 LP64_ONLY(+3) DEBUG_ONLY(+3)); 41.56 + 41.57 +define_pd_global(bool, RewriteBytecodes, true); 41.58 +define_pd_global(bool, RewriteFrequentPairs, true);
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 42.2 +++ b/src/cpu/zero/vm/icBuffer_zero.cpp Tue Oct 13 12:04:21 2009 -0700 42.3 @@ -0,0 +1,49 @@ 42.4 +/* 42.5 + * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. 42.6 + * Copyright 2007 Red Hat, Inc. 42.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 42.8 + * 42.9 + * This code is free software; you can redistribute it and/or modify it 42.10 + * under the terms of the GNU General Public License version 2 only, as 42.11 + * published by the Free Software Foundation. 42.12 + * 42.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 42.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 42.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 42.16 + * version 2 for more details (a copy is included in the LICENSE file that 42.17 + * accompanied this code). 42.18 + * 42.19 + * You should have received a copy of the GNU General Public License version 42.20 + * 2 along with this work; if not, write to the Free Software Foundation, 42.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 42.22 + * 42.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 42.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 42.25 + * have any questions. 42.26 + * 42.27 + */ 42.28 + 42.29 +#include "incls/_precompiled.incl" 42.30 +#include "incls/_icBuffer_zero.cpp.incl" 42.31 + 42.32 +int InlineCacheBuffer::ic_stub_code_size() { 42.33 + // NB set this once the functions below are implemented 42.34 + return 4; 42.35 +} 42.36 + 42.37 +void InlineCacheBuffer::assemble_ic_buffer_code(address code_begin, 42.38 + oop cached_oop, 42.39 + address entry_point) { 42.40 + // NB ic_stub_code_size() must return the size of the code we generate 42.41 + ShouldNotCallThis(); 42.42 +} 42.43 + 42.44 +address InlineCacheBuffer::ic_buffer_entry_point(address code_begin) { 42.45 + // NB ic_stub_code_size() must return the size of the code we generate 42.46 + ShouldNotCallThis(); 42.47 +} 42.48 + 42.49 +oop InlineCacheBuffer::ic_buffer_cached_oop(address code_begin) { 42.50 + // NB ic_stub_code_size() must return the size of the code we generate 42.51 + ShouldNotCallThis(); 42.52 +}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 43.2 +++ b/src/cpu/zero/vm/icache_zero.cpp Tue Oct 13 12:04:21 2009 -0700 43.3 @@ -0,0 +1,32 @@ 43.4 +/* 43.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 43.6 + * Copyright 2007, 2009 Red Hat, Inc. 43.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 43.8 + * 43.9 + * This code is free software; you can redistribute it and/or modify it 43.10 + * under the terms of the GNU General Public License version 2 only, as 43.11 + * published by the Free Software Foundation. 43.12 + * 43.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 43.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 43.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 43.16 + * version 2 for more details (a copy is included in the LICENSE file that 43.17 + * accompanied this code). 43.18 + * 43.19 + * You should have received a copy of the GNU General Public License version 43.20 + * 2 along with this work; if not, write to the Free Software Foundation, 43.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 43.22 + * 43.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 43.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 43.25 + * have any questions. 43.26 + * 43.27 + */ 43.28 + 43.29 +#include "incls/_precompiled.incl" 43.30 +#include "incls/_icache_zero.cpp.incl" 43.31 + 43.32 +void ICacheStubGenerator::generate_icache_flush( 43.33 + ICache::flush_icache_stub_t* flush_icache_stub) { 43.34 + ShouldNotCallThis(); 43.35 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 44.2 +++ b/src/cpu/zero/vm/icache_zero.hpp Tue Oct 13 12:04:21 2009 -0700 44.3 @@ -0,0 +1,36 @@ 44.4 +/* 44.5 + * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved. 44.6 + * Copyright 2007, 2009 Red Hat, Inc. 44.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 44.8 + * 44.9 + * This code is free software; you can redistribute it and/or modify it 44.10 + * under the terms of the GNU General Public License version 2 only, as 44.11 + * published by the Free Software Foundation. 44.12 + * 44.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 44.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 44.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 44.16 + * version 2 for more details (a copy is included in the LICENSE file that 44.17 + * accompanied this code). 44.18 + * 44.19 + * You should have received a copy of the GNU General Public License version 44.20 + * 2 along with this work; if not, write to the Free Software Foundation, 44.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 44.22 + * 44.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 44.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 44.25 + * have any questions. 44.26 + * 44.27 + */ 44.28 + 44.29 +// Interface for updating the instruction cache. Whenever the VM 44.30 +// modifies code, part of the processor instruction cache potentially 44.31 +// has to be flushed. This implementation is empty: Zero never deals 44.32 +// with code, and LLVM handles cache flushing for Shark. 44.33 + 44.34 +class ICache : public AbstractICache { 44.35 + public: 44.36 + static void initialize() {} 44.37 + static void invalidate_word(address addr) {} 44.38 + static void invalidate_range(address start, int nbytes) {} 44.39 +};
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 45.2 +++ b/src/cpu/zero/vm/interp_masm_zero.cpp Tue Oct 13 12:04:21 2009 -0700 45.3 @@ -0,0 +1,26 @@ 45.4 +/* 45.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 45.6 + * Copyright 2009 Red Hat, Inc. 45.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 45.8 + * 45.9 + * This code is free software; you can redistribute it and/or modify it 45.10 + * under the terms of the GNU General Public License version 2 only, as 45.11 + * published by the Free Software Foundation. 45.12 + * 45.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 45.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 45.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 45.16 + * version 2 for more details (a copy is included in the LICENSE file that 45.17 + * accompanied this code). 45.18 + * 45.19 + * You should have received a copy of the GNU General Public License version 45.20 + * 2 along with this work; if not, write to the Free Software Foundation, 45.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 45.22 + * 45.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 45.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 45.25 + * have any questions. 45.26 + * 45.27 + */ 45.28 + 45.29 +// This file is intentionally empty
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 46.2 +++ b/src/cpu/zero/vm/interp_masm_zero.hpp Tue Oct 13 12:04:21 2009 -0700 46.3 @@ -0,0 +1,38 @@ 46.4 +/* 46.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 46.6 + * Copyright 2007 Red Hat, Inc. 46.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 46.8 + * 46.9 + * This code is free software; you can redistribute it and/or modify it 46.10 + * under the terms of the GNU General Public License version 2 only, as 46.11 + * published by the Free Software Foundation. 46.12 + * 46.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 46.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 46.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 46.16 + * version 2 for more details (a copy is included in the LICENSE file that 46.17 + * accompanied this code). 46.18 + * 46.19 + * You should have received a copy of the GNU General Public License version 46.20 + * 2 along with this work; if not, write to the Free Software Foundation, 46.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 46.22 + * 46.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 46.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 46.25 + * have any questions. 46.26 + * 46.27 + */ 46.28 + 46.29 +// This file specializes the assember with interpreter-specific macros 46.30 + 46.31 +class InterpreterMacroAssembler : public MacroAssembler { 46.32 + public: 46.33 + InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {} 46.34 + 46.35 + public: 46.36 + RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr, 46.37 + Register tmp, 46.38 + int offset) { 46.39 + ShouldNotCallThis(); 46.40 + } 46.41 +};
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 47.2 +++ b/src/cpu/zero/vm/interpreterFrame_zero.hpp Tue Oct 13 12:04:21 2009 -0700 47.3 @@ -0,0 +1,75 @@ 47.4 +/* 47.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 47.6 + * Copyright 2008 Red Hat, Inc. 47.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 47.8 + * 47.9 + * This code is free software; you can redistribute it and/or modify it 47.10 + * under the terms of the GNU General Public License version 2 only, as 47.11 + * published by the Free Software Foundation. 47.12 + * 47.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 47.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 47.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 47.16 + * version 2 for more details (a copy is included in the LICENSE file that 47.17 + * accompanied this code). 47.18 + * 47.19 + * You should have received a copy of the GNU General Public License version 47.20 + * 2 along with this work; if not, write to the Free Software Foundation, 47.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 47.22 + * 47.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 47.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 47.25 + * have any questions. 47.26 + * 47.27 + */ 47.28 + 47.29 +#ifdef CC_INTERP 47.30 +// | ... | 47.31 +// +--------------------+ ------------------ 47.32 +// | stack slot n-1 | low addresses 47.33 +// | ... | 47.34 +// | stack slot 0 | 47.35 +// | monitor 0 (maybe) | 47.36 +// | ... | 47.37 +// | interpreter state | 47.38 +// | ... | 47.39 +// | frame_type | 47.40 +// | next_frame | high addresses 47.41 +// +--------------------+ ------------------ 47.42 +// | ... | 47.43 + 47.44 +class InterpreterFrame : public ZeroFrame { 47.45 + friend class AbstractInterpreter; 47.46 + 47.47 + private: 47.48 + InterpreterFrame() : ZeroFrame() { 47.49 + ShouldNotCallThis(); 47.50 + } 47.51 + 47.52 + protected: 47.53 + enum Layout { 47.54 + istate_off = jf_header_words + 47.55 + (align_size_up_(sizeof(BytecodeInterpreter), 47.56 + wordSize) >> LogBytesPerWord) - 1, 47.57 + header_words 47.58 + }; 47.59 + 47.60 + public: 47.61 + static InterpreterFrame *build(ZeroStack* stack, 47.62 + const methodOop method, 47.63 + JavaThread* thread); 47.64 + static InterpreterFrame *build(ZeroStack* stack, int size); 47.65 + 47.66 + public: 47.67 + interpreterState interpreter_state() const { 47.68 + return (interpreterState) addr_of_word(istate_off); 47.69 + } 47.70 + 47.71 + public: 47.72 + void identify_word(int frame_index, 47.73 + int offset, 47.74 + char* fieldbuf, 47.75 + char* valuebuf, 47.76 + int buflen) const; 47.77 +}; 47.78 +#endif // CC_INTERP
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 48.2 +++ b/src/cpu/zero/vm/interpreterGenerator_zero.hpp Tue Oct 13 12:04:21 2009 -0700 48.3 @@ -0,0 +1,37 @@ 48.4 +/* 48.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 48.6 + * Copyright 2007 Red Hat, Inc. 48.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 48.8 + * 48.9 + * This code is free software; you can redistribute it and/or modify it 48.10 + * under the terms of the GNU General Public License version 2 only, as 48.11 + * published by the Free Software Foundation. 48.12 + * 48.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 48.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 48.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 48.16 + * version 2 for more details (a copy is included in the LICENSE file that 48.17 + * accompanied this code). 48.18 + * 48.19 + * You should have received a copy of the GNU General Public License version 48.20 + * 2 along with this work; if not, write to the Free Software Foundation, 48.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 48.22 + * 48.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 48.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 48.25 + * have any questions. 48.26 + * 48.27 + */ 48.28 + 48.29 + // Generation of Interpreter 48.30 + // 48.31 + friend class AbstractInterpreterGenerator; 48.32 + 48.33 + private: 48.34 + address generate_normal_entry(bool synchronized); 48.35 + address generate_native_entry(bool synchronized); 48.36 + address generate_abstract_entry(); 48.37 + address generate_math_entry(AbstractInterpreter::MethodKind kind); 48.38 + address generate_empty_entry(); 48.39 + address generate_accessor_entry(); 48.40 + address generate_method_handle_entry();
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 49.2 +++ b/src/cpu/zero/vm/interpreterRT_zero.cpp Tue Oct 13 12:04:21 2009 -0700 49.3 @@ -0,0 +1,162 @@ 49.4 +/* 49.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 49.6 + * Copyright 2007, 2008 Red Hat, Inc. 49.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 49.8 + * 49.9 + * This code is free software; you can redistribute it and/or modify it 49.10 + * under the terms of the GNU General Public License version 2 only, as 49.11 + * published by the Free Software Foundation. 49.12 + * 49.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 49.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 49.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 49.16 + * version 2 for more details (a copy is included in the LICENSE file that 49.17 + * accompanied this code). 49.18 + * 49.19 + * You should have received a copy of the GNU General Public License version 49.20 + * 2 along with this work; if not, write to the Free Software Foundation, 49.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 49.22 + * 49.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 49.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 49.25 + * have any questions. 49.26 + * 49.27 + */ 49.28 + 49.29 +#include "incls/_precompiled.incl" 49.30 +#include "incls/_interpreterRT_zero.cpp.incl" 49.31 + 49.32 +void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_int() { 49.33 + push(T_INT); 49.34 + _cif->nargs++; 49.35 +} 49.36 + 49.37 +void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_long() { 49.38 + push(T_LONG); 49.39 + _cif->nargs++; 49.40 +} 49.41 + 49.42 +void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_float() { 49.43 + push(T_FLOAT); 49.44 + _cif->nargs++; 49.45 +} 49.46 + 49.47 +void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_double() { 49.48 + push(T_DOUBLE); 49.49 + _cif->nargs++; 49.50 +} 49.51 + 49.52 +void InterpreterRuntime::SignatureHandlerGeneratorBase::pass_object() { 49.53 + push(T_OBJECT); 49.54 + _cif->nargs++; 49.55 +} 49.56 + 49.57 +void InterpreterRuntime::SignatureHandlerGeneratorBase::push(BasicType type) { 49.58 + ffi_type *ftype; 49.59 + switch (type) { 49.60 + case T_VOID: 49.61 + ftype = &ffi_type_void; 49.62 + break; 49.63 + 49.64 + case T_BOOLEAN: 49.65 + ftype = &ffi_type_uint8; 49.66 + break; 49.67 + 49.68 + case T_CHAR: 49.69 + ftype = &ffi_type_uint16; 49.70 + break; 49.71 + 49.72 + case T_BYTE: 49.73 + ftype = &ffi_type_sint8; 49.74 + break; 49.75 + 49.76 + case T_SHORT: 49.77 + ftype = &ffi_type_sint16; 49.78 + break; 49.79 + 49.80 + case T_INT: 49.81 + ftype = &ffi_type_sint32; 49.82 + break; 49.83 + 49.84 + case T_LONG: 49.85 + ftype = &ffi_type_sint64; 49.86 + break; 49.87 + 49.88 + case T_FLOAT: 49.89 + ftype = &ffi_type_float; 49.90 + break; 49.91 + 49.92 + case T_DOUBLE: 49.93 + ftype = &ffi_type_double; 49.94 + break; 49.95 + 49.96 + case T_OBJECT: 49.97 + case T_ARRAY: 49.98 + ftype = &ffi_type_pointer; 49.99 + break; 49.100 + 49.101 + default: 49.102 + ShouldNotReachHere(); 49.103 + } 49.104 + push((intptr_t) ftype); 49.105 +} 49.106 + 49.107 +// For fast signature handlers the "signature handler" is generated 49.108 +// into a temporary buffer. It is then copied to its final location, 49.109 +// and pd_set_handler is called on it. We have this two stage thing 49.110 +// to accomodate this. 49.111 + 49.112 +void InterpreterRuntime::SignatureHandlerGeneratorBase::generate( 49.113 + uint64_t fingerprint) { 49.114 + 49.115 + // Build the argument types list 49.116 + pass_object(); 49.117 + if (method()->is_static()) 49.118 + pass_object(); 49.119 + iterate(fingerprint); 49.120 + 49.121 + // Tack on the result type 49.122 + push(method()->result_type()); 49.123 +} 49.124 + 49.125 +void InterpreterRuntime::SignatureHandler::finalize() { 49.126 + ffi_status status = 49.127 + ffi_prep_cif(cif(), 49.128 + FFI_DEFAULT_ABI, 49.129 + argument_count(), 49.130 + result_type(), 49.131 + argument_types()); 49.132 + 49.133 + assert(status == FFI_OK, "should be"); 49.134 +} 49.135 + 49.136 +IRT_ENTRY(address, 49.137 + InterpreterRuntime::slow_signature_handler(JavaThread* thread, 49.138 + methodOop method, 49.139 + intptr_t* unused1, 49.140 + intptr_t* unused2)) 49.141 + ZeroStack *stack = thread->zero_stack(); 49.142 + 49.143 + int required_words = 49.144 + (align_size_up(sizeof(ffi_cif), wordSize) >> LogBytesPerWord) + 49.145 + (method->is_static() ? 2 : 1) + method->size_of_parameters() + 1; 49.146 + if (required_words > stack->available_words()) { 49.147 + Unimplemented(); 49.148 + } 49.149 + 49.150 + intptr_t *buf = (intptr_t *) stack->alloc(required_words * wordSize); 49.151 + SlowSignatureHandlerGenerator sshg(methodHandle(thread, method), buf); 49.152 + sshg.generate(UCONST64(-1)); 49.153 + 49.154 + SignatureHandler *handler = sshg.handler(); 49.155 + handler->finalize(); 49.156 + 49.157 + return (address) handler; 49.158 +IRT_END 49.159 + 49.160 +void SignatureHandlerLibrary::pd_set_handler(address handlerAddr) { 49.161 + InterpreterRuntime::SignatureHandler *handler = 49.162 + InterpreterRuntime::SignatureHandler::from_handlerAddr(handlerAddr); 49.163 + 49.164 + handler->finalize(); 49.165 +}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 50.2 +++ b/src/cpu/zero/vm/interpreterRT_zero.hpp Tue Oct 13 12:04:21 2009 -0700 50.3 @@ -0,0 +1,127 @@ 50.4 +/* 50.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 50.6 + * Copyright 2007, 2008 Red Hat, Inc. 50.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 50.8 + * 50.9 + * This code is free software; you can redistribute it and/or modify it 50.10 + * under the terms of the GNU General Public License version 2 only, as 50.11 + * published by the Free Software Foundation. 50.12 + * 50.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 50.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 50.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 50.16 + * version 2 for more details (a copy is included in the LICENSE file that 50.17 + * accompanied this code). 50.18 + * 50.19 + * You should have received a copy of the GNU General Public License version 50.20 + * 2 along with this work; if not, write to the Free Software Foundation, 50.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 50.22 + * 50.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 50.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 50.25 + * have any questions. 50.26 + * 50.27 + */ 50.28 + 50.29 +class SignatureHandler { 50.30 + public: 50.31 + static SignatureHandler *from_handlerAddr(address handlerAddr) { 50.32 + return (SignatureHandler *) handlerAddr; 50.33 + } 50.34 + 50.35 + public: 50.36 + ffi_cif* cif() const { 50.37 + return (ffi_cif *) this; 50.38 + } 50.39 + 50.40 + int argument_count() const { 50.41 + return cif()->nargs; 50.42 + } 50.43 + 50.44 + ffi_type** argument_types() const { 50.45 + return (ffi_type**) (cif() + 1); 50.46 + } 50.47 + 50.48 + ffi_type* argument_type(int i) const { 50.49 + return argument_types()[i]; 50.50 + } 50.51 + 50.52 + ffi_type* result_type() const { 50.53 + return *(argument_types() + argument_count()); 50.54 + } 50.55 + 50.56 + protected: 50.57 + friend class InterpreterRuntime; 50.58 + friend class SignatureHandlerLibrary; 50.59 + 50.60 + void finalize(); 50.61 +}; 50.62 + 50.63 +class SignatureHandlerGeneratorBase : public NativeSignatureIterator { 50.64 + private: 50.65 + ffi_cif* _cif; 50.66 + 50.67 + protected: 50.68 + SignatureHandlerGeneratorBase(methodHandle method, ffi_cif *cif) 50.69 + : NativeSignatureIterator(method), _cif(cif) { 50.70 + _cif->nargs = 0; 50.71 + } 50.72 + 50.73 + ffi_cif *cif() const { 50.74 + return _cif; 50.75 + } 50.76 + 50.77 + public: 50.78 + void generate(uint64_t fingerprint); 50.79 + 50.80 + private: 50.81 + void pass_int(); 50.82 + void pass_long(); 50.83 + void pass_float(); 50.84 + void pass_double(); 50.85 + void pass_object(); 50.86 + 50.87 + private: 50.88 + void push(BasicType type); 50.89 + virtual void push(intptr_t value) = 0; 50.90 +}; 50.91 + 50.92 +class SignatureHandlerGenerator : public SignatureHandlerGeneratorBase { 50.93 + private: 50.94 + CodeBuffer* _cb; 50.95 + 50.96 + public: 50.97 + SignatureHandlerGenerator(methodHandle method, CodeBuffer* buffer) 50.98 + : SignatureHandlerGeneratorBase(method, (ffi_cif *) buffer->code_end()), 50.99 + _cb(buffer) { 50.100 + _cb->set_code_end((address) (cif() + 1)); 50.101 + } 50.102 + 50.103 + private: 50.104 + void push(intptr_t value) { 50.105 + intptr_t *dst = (intptr_t *) _cb->code_end(); 50.106 + _cb->set_code_end((address) (dst + 1)); 50.107 + *dst = value; 50.108 + } 50.109 +}; 50.110 + 50.111 +class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase { 50.112 + private: 50.113 + intptr_t *_dst; 50.114 + 50.115 + public: 50.116 + SlowSignatureHandlerGenerator(methodHandle method, intptr_t* buf) 50.117 + : SignatureHandlerGeneratorBase(method, (ffi_cif *) buf) { 50.118 + _dst = (intptr_t *) (cif() + 1); 50.119 + } 50.120 + 50.121 + private: 50.122 + void push(intptr_t value) { 50.123 + *(_dst++) = value; 50.124 + } 50.125 + 50.126 + public: 50.127 + SignatureHandler *handler() const { 50.128 + return (SignatureHandler *) cif(); 50.129 + } 50.130 +};
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 51.2 +++ b/src/cpu/zero/vm/interpreter_zero.cpp Tue Oct 13 12:04:21 2009 -0700 51.3 @@ -0,0 +1,70 @@ 51.4 +/* 51.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 51.6 + * Copyright 2007, 2008 Red Hat, Inc. 51.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 51.8 + * 51.9 + * This code is free software; you can redistribute it and/or modify it 51.10 + * under the terms of the GNU General Public License version 2 only, as 51.11 + * published by the Free Software Foundation. 51.12 + * 51.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 51.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 51.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 51.16 + * version 2 for more details (a copy is included in the LICENSE file that 51.17 + * accompanied this code). 51.18 + * 51.19 + * You should have received a copy of the GNU General Public License version 51.20 + * 2 along with this work; if not, write to the Free Software Foundation, 51.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 51.22 + * 51.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 51.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 51.25 + * have any questions. 51.26 + * 51.27 + */ 51.28 + 51.29 +#include "incls/_precompiled.incl" 51.30 +#include "incls/_interpreter_zero.cpp.incl" 51.31 + 51.32 +address AbstractInterpreterGenerator::generate_slow_signature_handler() { 51.33 + _masm->advance(1); 51.34 + return (address) InterpreterRuntime::slow_signature_handler; 51.35 +} 51.36 + 51.37 +address InterpreterGenerator::generate_math_entry( 51.38 + AbstractInterpreter::MethodKind kind) { 51.39 + if (!InlineIntrinsics) 51.40 + return NULL; 51.41 + 51.42 + Unimplemented(); 51.43 +} 51.44 + 51.45 +address InterpreterGenerator::generate_abstract_entry() { 51.46 + return ShouldNotCallThisEntry(); 51.47 +} 51.48 + 51.49 +address InterpreterGenerator::generate_method_handle_entry() { 51.50 + return ShouldNotCallThisEntry(); 51.51 +} 51.52 + 51.53 +int AbstractInterpreter::size_activation(methodOop method, 51.54 + int tempcount, 51.55 + int popframe_extra_args, 51.56 + int moncount, 51.57 + int callee_param_count, 51.58 + int callee_locals, 51.59 + bool is_top_frame) { 51.60 + return layout_activation(method, 51.61 + tempcount, 51.62 + popframe_extra_args, 51.63 + moncount, 51.64 + callee_param_count, 51.65 + callee_locals, 51.66 + (frame*) NULL, 51.67 + (frame*) NULL, 51.68 + is_top_frame); 51.69 +} 51.70 + 51.71 +void Deoptimization::unwind_callee_save_values(frame* f, 51.72 + vframeArray* vframe_array) { 51.73 +}
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 52.2 +++ b/src/cpu/zero/vm/interpreter_zero.hpp Tue Oct 13 12:04:21 2009 -0700 52.3 @@ -0,0 +1,61 @@ 52.4 +/* 52.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 52.6 + * Copyright 2007, 2008 Red Hat, Inc. 52.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 52.8 + * 52.9 + * This code is free software; you can redistribute it and/or modify it 52.10 + * under the terms of the GNU General Public License version 2 only, as 52.11 + * published by the Free Software Foundation. 52.12 + * 52.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 52.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 52.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 52.16 + * version 2 for more details (a copy is included in the LICENSE file that 52.17 + * accompanied this code). 52.18 + * 52.19 + * You should have received a copy of the GNU General Public License version 52.20 + * 2 along with this work; if not, write to the Free Software Foundation, 52.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 52.22 + * 52.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 52.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 52.25 + * have any questions. 52.26 + * 52.27 + */ 52.28 + 52.29 + public: 52.30 + static void invoke_method(methodOop method, address entry_point, TRAPS) { 52.31 + ((ZeroEntry *) entry_point)->invoke(method, THREAD); 52.32 + } 52.33 + static void invoke_osr(methodOop method, 52.34 + address entry_point, 52.35 + address osr_buf, 52.36 + TRAPS) { 52.37 + ((ZeroEntry *) entry_point)->invoke_osr(method, osr_buf, THREAD); 52.38 + } 52.39 + 52.40 + public: 52.41 + static int expr_index_at(int i) { 52.42 + return stackElementWords() * i; 52.43 + } 52.44 + static int expr_tag_index_at(int i) { 52.45 + assert(TaggedStackInterpreter, "should not call this"); 52.46 + Unimplemented(); 52.47 + } 52.48 + 52.49 + static int expr_offset_in_bytes(int i) { 52.50 + return stackElementSize() * i; 52.51 + } 52.52 + static int expr_tag_offset_in_bytes(int i) { 52.53 + assert(TaggedStackInterpreter, "should not call this"); 52.54 + Unimplemented(); 52.55 + } 52.56 + 52.57 + static int local_index_at(int i) { 52.58 + assert(i <= 0, "local direction already negated"); 52.59 + return stackElementWords() * i + (value_offset_in_bytes() / wordSize); 52.60 + } 52.61 + static int local_tag_index_at(int i) { 52.62 + assert(TaggedStackInterpreter, "should not call this"); 52.63 + Unimplemented(); 52.64 + }
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 53.2 +++ b/src/cpu/zero/vm/javaFrameAnchor_zero.hpp Tue Oct 13 12:04:21 2009 -0700 53.3 @@ -0,0 +1,72 @@ 53.4 +/* 53.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 53.6 + * Copyright 2007, 2008 Red Hat, Inc. 53.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.8 + * 53.9 + * This code is free software; you can redistribute it and/or modify it 53.10 + * under the terms of the GNU General Public License version 2 only, as 53.11 + * published by the Free Software Foundation. 53.12 + * 53.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 53.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 53.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 53.16 + * version 2 for more details (a copy is included in the LICENSE file that 53.17 + * accompanied this code). 53.18 + * 53.19 + * You should have received a copy of the GNU General Public License version 53.20 + * 2 along with this work; if not, write to the Free Software Foundation, 53.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 53.22 + * 53.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 53.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 53.25 + * have any questions. 53.26 + * 53.27 + */ 53.28 + 53.29 + public: 53.30 + // Each arch must define reset, save, restore 53.31 + // These are used by objects that only care about: 53.32 + // 1 - initializing a new state (thread creation, javaCalls) 53.33 + // 2 - saving a current state (javaCalls) 53.34 + // 3 - restoring an old state (javaCalls) 53.35 + 53.36 + void clear() { 53.37 + // clearing _last_Java_sp must be first 53.38 + _last_Java_sp = NULL; 53.39 + // fence? 53.40 + _last_Java_pc = NULL; 53.41 + } 53.42 + 53.43 + void copy(JavaFrameAnchor* src) { 53.44 + // In order to make sure the transition state is valid for "this" 53.45 + // We must clear _last_Java_sp before copying the rest of the new 53.46 + // data 53.47 + // 53.48 + // Hack Alert: Temporary bugfix for 4717480/4721647 To act like 53.49 + // previous version (pd_cache_state) don't NULL _last_Java_sp 53.50 + // unless the value is changing 53.51 + // 53.52 + if (_last_Java_sp != src->_last_Java_sp) 53.53 + _last_Java_sp = NULL; 53.54 + 53.55 + _last_Java_pc = src->_last_Java_pc; 53.56 + // Must be last so profiler will always see valid frame if 53.57 + // has_last_frame() is true 53.58 + _last_Java_sp = src->_last_Java_sp; 53.59 + } 53.60 + 53.61 + bool walkable() { 53.62 + return true; 53.63 + } 53.64 + 53.65 + void make_walkable(JavaThread* thread) { 53.66 + // nothing to do 53.67 + } 53.68 + 53.69 + intptr_t* last_Java_sp() const { 53.70 + return _last_Java_sp; 53.71 + } 53.72 + 53.73 + void set_last_Java_sp(intptr_t* sp) { 53.74 + _last_Java_sp = sp; 53.75 + }
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 54.2 +++ b/src/cpu/zero/vm/jniFastGetField_zero.cpp Tue Oct 13 12:04:21 2009 -0700 54.3 @@ -0,0 +1,59 @@ 54.4 +/* 54.5 + * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved. 54.6 + * Copyright 2007 Red Hat, Inc. 54.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 54.8 + * 54.9 + * This code is free software; you can redistribute it and/or modify it 54.10 + * under the terms of the GNU General Public License version 2 only, as 54.11 + * published by the Free Software Foundation. 54.12 + * 54.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 54.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 54.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 54.16 + * version 2 for more details (a copy is included in the LICENSE file that 54.17 + * accompanied this code). 54.18 + * 54.19 + * You should have received a copy of the GNU General Public License version 54.20 + * 2 along with this work; if not, write to the Free Software Foundation, 54.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 54.22 + * 54.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 54.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 54.25 + * have any questions. 54.26 + * 54.27 + */ 54.28 + 54.29 +#include "incls/_precompiled.incl" 54.30 +#include "incls/_jniFastGetField_zero.cpp.incl" 54.31 + 54.32 +address JNI_FastGetField::generate_fast_get_boolean_field() { 54.33 + return (address) -1; 54.34 +} 54.35 + 54.36 +address JNI_FastGetField::generate_fast_get_byte_field() { 54.37 + return (address) -1; 54.38 +} 54.39 + 54.40 +address JNI_FastGetField::generate_fast_get_char_field() { 54.41 + return (address) -1; 54.42 +} 54.43 + 54.44 +address JNI_FastGetField::generate_fast_get_short_field() { 54.45 + return (address) -1; 54.46 +} 54.47 + 54.48 +address JNI_FastGetField::generate_fast_get_int_field() { 54.49 + return (address) -1; 54.50 +} 54.51 + 54.52 +address JNI_FastGetField::generate_fast_get_long_field() { 54.53 + return (address) -1; 54.54 +} 54.55 + 54.56 +address JNI_FastGetField::generate_fast_get_float_field() { 54.57 + return (address) -1; 54.58 +} 54.59 + 54.60 +address JNI_FastGetField::generate_fast_get_double_field() { 54.61 + return (address) -1; 54.62 +}
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 55.2 +++ b/src/cpu/zero/vm/jniTypes_zero.hpp Tue Oct 13 12:04:21 2009 -0700 55.3 @@ -0,0 +1,108 @@ 55.4 +/* 55.5 + * Copyright 1998-2002 Sun Microsystems, Inc. All Rights Reserved. 55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 55.7 + * 55.8 + * This code is free software; you can redistribute it and/or modify it 55.9 + * under the terms of the GNU General Public License version 2 only, as 55.10 + * published by the Free Software Foundation. 55.11 + * 55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 55.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 55.15 + * version 2 for more details (a copy is included in the LICENSE file that 55.16 + * accompanied this code). 55.17 + * 55.18 + * You should have received a copy of the GNU General Public License version 55.19 + * 2 along with this work; if not, write to the Free Software Foundation, 55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 55.21 + * 55.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 55.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 55.24 + * have any questions. 55.25 + * 55.26 + */ 55.27 + 55.28 +// This file holds platform-dependent routines used to write primitive jni 55.29 +// types to the array of arguments passed into JavaCalls::call 55.30 + 55.31 +class JNITypes : AllStatic { 55.32 + // These functions write a java primitive type (in native format) 55.33 + // to a java stack slot array to be passed as an argument to JavaCalls:calls. 55.34 + // I.e., they are functionally 'push' operations if they have a 'pos' 55.35 + // formal parameter. Note that jlong's and jdouble's are written 55.36 + // _in reverse_ of the order in which they appear in the interpreter 55.37 + // stack. This is because call stubs (see stubGenerator_zero.cpp) 55.38 + // reverse the argument list constructed by JavaCallArguments (see 55.39 + // javaCalls.hpp). 55.40 + 55.41 +private: 55.42 + // Helper routines. 55.43 + static inline void put_int2 (jint *from, jint *to) { to[0] = from[0]; to[1] = from[1]; } 55.44 + static inline void put_int2 (jint *from, jint *to, int& pos) { put_int2 (from, (jint *)((intptr_t *)to + pos)); pos += 2; } 55.45 + static inline void put_int2r(jint *from, jint *to) { to[0] = from[1]; to[1] = from[0]; } 55.46 + static inline void put_int2r(jint *from, jint *to, int& pos) { put_int2r(from, (jint *)((intptr_t *)to + pos)); pos += 2; } 55.47 + 55.48 +public: 55.49 + // Ints are stored in native format in one JavaCallArgument slot at *to. 55.50 + static inline void put_int(jint from, intptr_t *to) { *(jint *)(to + 0 ) = from; } 55.51 + static inline void put_int(jint from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = from; } 55.52 + static inline void put_int(jint *from, intptr_t *to, int& pos) { *(jint *)(to + pos++) = *from; } 55.53 + 55.54 +#ifdef _LP64 55.55 + // Longs are stored in native format in one JavaCallArgument slot at *(to+1). 55.56 + static inline void put_long(jlong from, intptr_t *to) { *(jlong *)(to + 1 + 0) = from; } 55.57 + static inline void put_long(jlong from, intptr_t *to, int& pos) { *(jlong *)(to + 1 + pos) = from; pos += 2; } 55.58 + static inline void put_long(jlong *from, intptr_t *to, int& pos) { *(jlong *)(to + 1 + pos) = *from; pos += 2; } 55.59 +#else 55.60 + // Longs are stored in reversed native word format in two JavaCallArgument slots at *to. 55.61 + // The high half is in *(to+1) and the low half in *to. 55.62 + static inline void put_long(jlong from, intptr_t *to) { put_int2r((jint *)&from, (jint *)to); } 55.63 + static inline void put_long(jlong from, intptr_t *to, int& pos) { put_int2r((jint *)&from, (jint *)to, pos); } 55.64 + static inline void put_long(jlong *from, intptr_t *to, int& pos) { put_int2r((jint *) from, (jint *)to, pos); } 55.65 +#endif 55.66 + 55.67 + // Oops are stored in native format in one JavaCallArgument slot at *to. 55.68 + static inline void put_obj(oop from, intptr_t *to) { *(oop *)(to + 0 ) = from; } 55.69 + static inline void put_obj(oop from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = from; } 55.70 + static inline void put_obj(oop *from, intptr_t *to, int& pos) { *(oop *)(to + pos++) = *from; } 55.71 + 55.72 + // Floats are stored in native format in one JavaCallArgument slot at *to. 55.73 + static inline void put_float(jfloat from, intptr_t *to) { *(jfloat *)(to + 0 ) = from; } 55.74 + static inline void put_float(jfloat from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = from; } 55.75 + static inline void put_float(jfloat *from, intptr_t *to, int& pos) { *(jfloat *)(to + pos++) = *from; } 55.76 + 55.77 +#ifdef _LP64 55.78 + // Doubles are stored in native word format in one JavaCallArgument slot at *(to+1). 55.79 + static inline void put_double(jdouble from, intptr_t *to) { *(jdouble *)(to + 1 + 0) = from; } 55.80 + static inline void put_double(jdouble from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) = from; pos += 2; } 55.81 + static inline void put_double(jdouble *from, intptr_t *to, int& pos) { *(jdouble *)(to + 1 + pos) = *from; pos += 2; } 55.82 +#else 55.83 + // Doubles are stored in reversed native word format in two JavaCallArgument slots at *to. 55.84 + static inline void put_double(jdouble from, intptr_t *to) { put_int2r((jint *)&from, (jint *)to); } 55.85 + static inline void put_double(jdouble from, intptr_t *to, int& pos) { put_int2r((jint *)&from, (jint *)to, pos); } 55.86 + static inline void put_double(jdouble *from, intptr_t *to, int& pos) { put_int2r((jint *) from, (jint *)to, pos); } 55.87 +#endif 55.88 + 55.89 + // The get_xxx routines, on the other hand, actually _do_ fetch 55.90 + // java primitive types from the interpreter stack. 55.91 + static inline jint get_int(intptr_t *from) { return *(jint *)from; } 55.92 + 55.93 +#ifdef _LP64 55.94 + static inline jlong get_long(intptr_t *from) { return *(jlong *)from; } 55.95 +#else 55.96 + static inline jlong get_long(intptr_t *from) { return ((jlong)(*( signed int *)((jint *)from )) << 32) | 55.97 + ((jlong)(*(unsigned int *)((jint *)from + 1)) << 0); } 55.98 +#endif 55.99 + 55.100 + static inline oop get_obj(intptr_t *from) { return *(oop *)from; } 55.101 + static inline jfloat get_float(intptr_t *from) { return *(jfloat *)from; } 55.102 + 55.103 +#ifdef _LP64 55.104 + static inline jdouble get_double(intptr_t *from) { return *(jdouble *)from; } 55.105 +#else 55.106 + static inline jdouble get_double(intptr_t *from) { jlong jl = ((jlong)(*( signed int *)((jint *)from )) << 32) | 55.107 + ((jlong)(*(unsigned int *)((jint *)from + 1)) << 0); 55.108 + return *(jdouble *)&jl; } 55.109 +#endif 55.110 + 55.111 +};
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 56.2 +++ b/src/cpu/zero/vm/jni_zero.h Tue Oct 13 12:04:21 2009 -0700 56.3 @@ -0,0 +1,38 @@ 56.4 +/* 56.5 + * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved. 56.6 + * Copyright 2009 Red Hat, Inc. 56.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 56.8 + * 56.9 + * This code is free software; you can redistribute it and/or modify it 56.10 + * under the terms of the GNU General Public License version 2 only, as 56.11 + * published by the Free Software Foundation. Sun designates this 56.12 + * particular file as subject to the "Classpath" exception as provided 56.13 + * by Sun in the LICENSE file that accompanied this code. 56.14 + * 56.15 + * This code is distributed in the hope that it will be useful, but WITHOUT 56.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 56.17 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 56.18 + * version 2 for more details (a copy is included in the LICENSE file that 56.19 + * accompanied this code). 56.20 + * 56.21 + * You should have received a copy of the GNU General Public License version 56.22 + * 2 along with this work; if not, write to the Free Software Foundation, 56.23 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 56.24 + * 56.25 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 56.26 + * CA 95054 USA or visit www.sun.com if you need additional information or 56.27 + * have any questions. 56.28 + */ 56.29 + 56.30 +#define JNIEXPORT 56.31 +#define JNIIMPORT 56.32 +#define JNICALL 56.33 + 56.34 +typedef int jint; 56.35 +typedef signed char jbyte; 56.36 + 56.37 +#ifdef _LP64 56.38 +typedef long jlong; 56.39 +#else 56.40 +typedef long long jlong; 56.41 +#endif
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 57.2 +++ b/src/cpu/zero/vm/methodHandles_zero.cpp Tue Oct 13 12:04:21 2009 -0700 57.3 @@ -0,0 +1,26 @@ 57.4 +/* 57.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 57.6 + * Copyright 2009 Red Hat, Inc. 57.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 57.8 + * 57.9 + * This code is free software; you can redistribute it and/or modify it 57.10 + * under the terms of the GNU General Public License version 2 only, as 57.11 + * published by the Free Software Foundation. 57.12 + * 57.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 57.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 57.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 57.16 + * version 2 for more details (a copy is included in the LICENSE file that 57.17 + * accompanied this code). 57.18 + * 57.19 + * You should have received a copy of the GNU General Public License version 57.20 + * 2 along with this work; if not, write to the Free Software Foundation, 57.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 57.22 + * 57.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 57.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 57.25 + * have any questions. 57.26 + * 57.27 + */ 57.28 + 57.29 +// This file is intentionally empty
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 58.2 +++ b/src/cpu/zero/vm/nativeInst_zero.cpp Tue Oct 13 12:04:21 2009 -0700 58.3 @@ -0,0 +1,50 @@ 58.4 +/* 58.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 58.6 + * Copyright 2008 Red Hat, Inc. 58.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 58.8 + * 58.9 + * This code is free software; you can redistribute it and/or modify it 58.10 + * under the terms of the GNU General Public License version 2 only, as 58.11 + * published by the Free Software Foundation. 58.12 + * 58.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 58.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 58.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 58.16 + * version 2 for more details (a copy is included in the LICENSE file that 58.17 + * accompanied this code). 58.18 + * 58.19 + * You should have received a copy of the GNU General Public License version 58.20 + * 2 along with this work; if not, write to the Free Software Foundation, 58.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 58.22 + * 58.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 58.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 58.25 + * have any questions. 58.26 + * 58.27 + */ 58.28 + 58.29 +#include "incls/_precompiled.incl" 58.30 +#include "incls/_nativeInst_zero.cpp.incl" 58.31 + 58.32 +// This method is called by nmethod::make_not_entrant_or_zombie to 58.33 +// insert a jump to SharedRuntime::get_handle_wrong_method_stub() 58.34 +// (dest) at the start of a compiled method (verified_entry) to avoid 58.35 +// a race where a method is invoked while being made non-entrant. 58.36 +// 58.37 +// In Shark, verified_entry is a pointer to a SharkEntry. We can 58.38 +// handle this simply by changing it's entry point to point at the 58.39 +// interpreter. This only works because the interpreter and Shark 58.40 +// calling conventions are the same. 58.41 + 58.42 +void NativeJump::patch_verified_entry(address entry, 58.43 + address verified_entry, 58.44 + address dest) { 58.45 + assert(dest == SharedRuntime::get_handle_wrong_method_stub(), "should be"); 58.46 + 58.47 +#ifdef CC_INTERP 58.48 + ((ZeroEntry*) verified_entry)->set_entry_point( 58.49 + (address) CppInterpreter::normal_entry); 58.50 +#else 58.51 + Unimplemented(); 58.52 +#endif // CC_INTERP 58.53 +}
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 59.2 +++ b/src/cpu/zero/vm/nativeInst_zero.hpp Tue Oct 13 12:04:21 2009 -0700 59.3 @@ -0,0 +1,185 @@ 59.4 +/* 59.5 + * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. 59.6 + * Copyright 2007 Red Hat, Inc. 59.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 59.8 + * 59.9 + * This code is free software; you can redistribute it and/or modify it 59.10 + * under the terms of the GNU General Public License version 2 only, as 59.11 + * published by the Free Software Foundation. 59.12 + * 59.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 59.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 59.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 59.16 + * version 2 for more details (a copy is included in the LICENSE file that 59.17 + * accompanied this code). 59.18 + * 59.19 + * You should have received a copy of the GNU General Public License version 59.20 + * 2 along with this work; if not, write to the Free Software Foundation, 59.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 59.22 + * 59.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 59.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 59.25 + * have any questions. 59.26 + * 59.27 + */ 59.28 + 59.29 +// We have interfaces for the following instructions: 59.30 +// - NativeInstruction 59.31 +// - - NativeCall 59.32 +// - - NativeMovConstReg 59.33 +// - - NativeMovConstRegPatching 59.34 +// - - NativeJump 59.35 +// - - NativeIllegalOpCode 59.36 +// - - NativeReturn 59.37 +// - - NativeReturnX (return with argument) 59.38 +// - - NativePushConst 59.39 +// - - NativeTstRegMem 59.40 + 59.41 +// The base class for different kinds of native instruction abstractions. 59.42 +// Provides the primitive operations to manipulate code relative to this. 59.43 + 59.44 +class NativeInstruction VALUE_OBJ_CLASS_SPEC { 59.45 + public: 59.46 + bool is_jump() { 59.47 + ShouldNotCallThis(); 59.48 + } 59.49 + 59.50 + bool is_safepoint_poll() { 59.51 + ShouldNotCallThis(); 59.52 + } 59.53 +}; 59.54 + 59.55 +inline NativeInstruction* nativeInstruction_at(address address) { 59.56 + ShouldNotCallThis(); 59.57 +} 59.58 + 59.59 +class NativeCall : public NativeInstruction { 59.60 + public: 59.61 + enum zero_specific_constants { 59.62 + instruction_size = 0 // not used within the interpreter 59.63 + }; 59.64 + 59.65 + address instruction_address() const { 59.66 + ShouldNotCallThis(); 59.67 + } 59.68 + 59.69 + address next_instruction_address() const { 59.70 + ShouldNotCallThis(); 59.71 + } 59.72 + 59.73 + address return_address() const { 59.74 + ShouldNotCallThis(); 59.75 + } 59.76 + 59.77 + address destination() const { 59.78 + ShouldNotCallThis(); 59.79 + } 59.80 + 59.81 + void set_destination_mt_safe(address dest) { 59.82 + ShouldNotCallThis(); 59.83 + } 59.84 + 59.85 + void verify_alignment() { 59.86 + ShouldNotCallThis(); 59.87 + } 59.88 + 59.89 + void verify() { 59.90 + ShouldNotCallThis(); 59.91 + } 59.92 + 59.93 + static bool is_call_before(address return_address) { 59.94 + ShouldNotCallThis(); 59.95 + } 59.96 +}; 59.97 + 59.98 +inline NativeCall* nativeCall_before(address return_address) { 59.99 + ShouldNotCallThis(); 59.100 +} 59.101 + 59.102 +inline NativeCall* nativeCall_at(address address) { 59.103 + ShouldNotCallThis(); 59.104 +} 59.105 + 59.106 +class NativeMovConstReg : public NativeInstruction { 59.107 + public: 59.108 + address next_instruction_address() const { 59.109 + ShouldNotCallThis(); 59.110 + } 59.111 + 59.112 + intptr_t data() const { 59.113 + ShouldNotCallThis(); 59.114 + } 59.115 + 59.116 + void set_data(intptr_t x) { 59.117 + ShouldNotCallThis(); 59.118 + } 59.119 +}; 59.120 + 59.121 +inline NativeMovConstReg* nativeMovConstReg_at(address address) { 59.122 + ShouldNotCallThis(); 59.123 +} 59.124 + 59.125 +class NativeMovRegMem : public NativeInstruction { 59.126 + public: 59.127 + int offset() const { 59.128 + ShouldNotCallThis(); 59.129 + } 59.130 + 59.131 + void set_offset(intptr_t x) { 59.132 + ShouldNotCallThis(); 59.133 + } 59.134 + 59.135 + void add_offset_in_bytes(int add_offset) { 59.136 + ShouldNotCallThis(); 59.137 + } 59.138 +}; 59.139 + 59.140 +inline NativeMovRegMem* nativeMovRegMem_at(address address) { 59.141 + ShouldNotCallThis(); 59.142 +} 59.143 + 59.144 +class NativeJump : public NativeInstruction { 59.145 + public: 59.146 + enum zero_specific_constants { 59.147 + instruction_size = 0 // not used within the interpreter 59.148 + }; 59.149 + 59.150 + address jump_destination() const { 59.151 + ShouldNotCallThis(); 59.152 + } 59.153 + 59.154 + void set_jump_destination(address dest) { 59.155 + ShouldNotCallThis(); 59.156 + } 59.157 + 59.158 + static void check_verified_entry_alignment(address entry, 59.159 + address verified_entry) { 59.160 + } 59.161 + 59.162 + static void patch_verified_entry(address entry, 59.163 + address verified_entry, 59.164 + address dest); 59.165 +}; 59.166 + 59.167 +inline NativeJump* nativeJump_at(address address) { 59.168 + ShouldNotCallThis(); 59.169 +} 59.170 + 59.171 +class NativeGeneralJump : public NativeInstruction { 59.172 + public: 59.173 + address jump_destination() const { 59.174 + ShouldNotCallThis(); 59.175 + } 59.176 + 59.177 + static void insert_unconditional(address code_pos, address entry) { 59.178 + ShouldNotCallThis(); 59.179 + } 59.180 + 59.181 + static void replace_mt_safe(address instr_addr, address code_buffer) { 59.182 + ShouldNotCallThis(); 59.183 + } 59.184 +}; 59.185 + 59.186 +inline NativeGeneralJump* nativeGeneralJump_at(address address) { 59.187 + ShouldNotCallThis(); 59.188 +}
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 60.2 +++ b/src/cpu/zero/vm/registerMap_zero.hpp Tue Oct 13 12:04:21 2009 -0700 60.3 @@ -0,0 +1,39 @@ 60.4 +/* 60.5 + * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. 60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 60.7 + * 60.8 + * This code is free software; you can redistribute it and/or modify it 60.9 + * under the terms of the GNU General Public License version 2 only, as 60.10 + * published by the Free Software Foundation. 60.11 + * 60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 60.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 60.15 + * version 2 for more details (a copy is included in the LICENSE file that 60.16 + * accompanied this code). 60.17 + * 60.18 + * You should have received a copy of the GNU General Public License version 60.19 + * 2 along with this work; if not, write to the Free Software Foundation, 60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 60.21 + * 60.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 60.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 60.24 + * have any questions. 60.25 + * 60.26 + */ 60.27 + 60.28 + // machine-dependent implemention for register maps 60.29 + friend class frame; 60.30 + 60.31 + private: 60.32 + // This is the hook for finding a register in an "well-known" location, 60.33 + // such as a register block of a predetermined format. 60.34 + // Since there is none, we just return NULL. 60.35 + // See registerMap_sparc.hpp for an example of grabbing registers 60.36 + // from register save areas of a standard layout. 60.37 + address pd_location(VMReg reg) const { return NULL; } 60.38 + 60.39 + // no PD state to clear or copy: 60.40 + void pd_clear() {} 60.41 + void pd_initialize() {} 60.42 + void pd_initialize_from(const RegisterMap* map) {}
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 61.2 +++ b/src/cpu/zero/vm/register_definitions_zero.cpp Tue Oct 13 12:04:21 2009 -0700 61.3 @@ -0,0 +1,26 @@ 61.4 +/* 61.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 61.6 + * Copyright 2009 Red Hat, Inc. 61.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.8 + * 61.9 + * This code is free software; you can redistribute it and/or modify it 61.10 + * under the terms of the GNU General Public License version 2 only, as 61.11 + * published by the Free Software Foundation. 61.12 + * 61.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 61.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 61.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 61.16 + * version 2 for more details (a copy is included in the LICENSE file that 61.17 + * accompanied this code). 61.18 + * 61.19 + * You should have received a copy of the GNU General Public License version 61.20 + * 2 along with this work; if not, write to the Free Software Foundation, 61.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 61.22 + * 61.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 61.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 61.25 + * have any questions. 61.26 + * 61.27 + */ 61.28 + 61.29 +// This file is intentionally empty
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 62.2 +++ b/src/cpu/zero/vm/register_zero.cpp Tue Oct 13 12:04:21 2009 -0700 62.3 @@ -0,0 +1,39 @@ 62.4 +/* 62.5 + * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. 62.6 + * Copyright 2007 Red Hat, Inc. 62.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 62.8 + * 62.9 + * This code is free software; you can redistribute it and/or modify it 62.10 + * under the terms of the GNU General Public License version 2 only, as 62.11 + * published by the Free Software Foundation. 62.12 + * 62.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 62.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 62.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 62.16 + * version 2 for more details (a copy is included in the LICENSE file that 62.17 + * accompanied this code). 62.18 + * 62.19 + * You should have received a copy of the GNU General Public License version 62.20 + * 2 along with this work; if not, write to the Free Software Foundation, 62.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 62.22 + * 62.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 62.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 62.25 + * have any questions. 62.26 + * 62.27 + */ 62.28 + 62.29 +#include "incls/_precompiled.incl" 62.30 +#include "incls/_register_zero.cpp.incl" 62.31 + 62.32 +const int ConcreteRegisterImpl::max_gpr = RegisterImpl::number_of_registers; 62.33 +const int ConcreteRegisterImpl::max_fpr = 62.34 + ConcreteRegisterImpl::max_gpr + FloatRegisterImpl::number_of_registers; 62.35 + 62.36 +const char* RegisterImpl::name() const { 62.37 + ShouldNotCallThis(); 62.38 +} 62.39 + 62.40 +const char* FloatRegisterImpl::name() const { 62.41 + ShouldNotCallThis(); 62.42 +}
63.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 63.2 +++ b/src/cpu/zero/vm/register_zero.hpp Tue Oct 13 12:04:21 2009 -0700 63.3 @@ -0,0 +1,110 @@ 63.4 +/* 63.5 + * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. 63.6 + * Copyright 2007 Red Hat, Inc. 63.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 63.8 + * 63.9 + * This code is free software; you can redistribute it and/or modify it 63.10 + * under the terms of the GNU General Public License version 2 only, as 63.11 + * published by the Free Software Foundation. 63.12 + * 63.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 63.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 63.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 63.16 + * version 2 for more details (a copy is included in the LICENSE file that 63.17 + * accompanied this code). 63.18 + * 63.19 + * You should have received a copy of the GNU General Public License version 63.20 + * 2 along with this work; if not, write to the Free Software Foundation, 63.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 63.22 + * 63.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 63.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 63.25 + * have any questions. 63.26 + * 63.27 + */ 63.28 + 63.29 +class VMRegImpl; 63.30 +typedef VMRegImpl* VMReg; 63.31 + 63.32 +// Use Register as shortcut 63.33 +class RegisterImpl; 63.34 +typedef RegisterImpl* Register; 63.35 + 63.36 +inline Register as_Register(int encoding) { 63.37 + return (Register)(intptr_t) encoding; 63.38 +} 63.39 + 63.40 +// The implementation of integer registers for the zero architecture 63.41 +class RegisterImpl : public AbstractRegisterImpl { 63.42 + public: 63.43 + enum { 63.44 + number_of_registers = 0 63.45 + }; 63.46 + 63.47 + // construction 63.48 + inline friend Register as_Register(int encoding); 63.49 + VMReg as_VMReg(); 63.50 + 63.51 + // derived registers, offsets, and addresses 63.52 + Register successor() const { 63.53 + return as_Register(encoding() + 1); 63.54 + } 63.55 + 63.56 + // accessors 63.57 + int encoding() const { 63.58 + assert(is_valid(), "invalid register"); 63.59 + return (intptr_t)this; 63.60 + } 63.61 + bool is_valid() const { 63.62 + return 0 <= (intptr_t) this && (intptr_t)this < number_of_registers; 63.63 + } 63.64 + const char* name() const; 63.65 +}; 63.66 + 63.67 +// Use FloatRegister as shortcut 63.68 +class FloatRegisterImpl; 63.69 +typedef FloatRegisterImpl* FloatRegister; 63.70 + 63.71 +inline FloatRegister as_FloatRegister(int encoding) { 63.72 + return (FloatRegister)(intptr_t) encoding; 63.73 +} 63.74 + 63.75 +// The implementation of floating point registers for the zero architecture 63.76 +class FloatRegisterImpl : public AbstractRegisterImpl { 63.77 + public: 63.78 + enum { 63.79 + number_of_registers = 0 63.80 + }; 63.81 + 63.82 + // construction 63.83 + inline friend FloatRegister as_FloatRegister(int encoding); 63.84 + VMReg as_VMReg(); 63.85 + 63.86 + // derived registers, offsets, and addresses 63.87 + FloatRegister successor() const { 63.88 + return as_FloatRegister(encoding() + 1); 63.89 + } 63.90 + 63.91 + // accessors 63.92 + int encoding() const { 63.93 + assert(is_valid(), "invalid register"); 63.94 + return (intptr_t)this; 63.95 + } 63.96 + bool is_valid() const { 63.97 + return 0 <= (intptr_t) this && (intptr_t)this < number_of_registers; 63.98 + } 63.99 + const char* name() const; 63.100 +}; 63.101 + 63.102 +class ConcreteRegisterImpl : public AbstractRegisterImpl { 63.103 + public: 63.104 + enum { 63.105 + number_of_registers = RegisterImpl::number_of_registers + 63.106 + FloatRegisterImpl::number_of_registers 63.107 + }; 63.108 + 63.109 + static const int max_gpr; 63.110 + static const int max_fpr; 63.111 +}; 63.112 + 63.113 +CONSTANT_REGISTER_DECLARATION(Register, noreg, (-1));
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 64.2 +++ b/src/cpu/zero/vm/relocInfo_zero.cpp Tue Oct 13 12:04:21 2009 -0700 64.3 @@ -0,0 +1,74 @@ 64.4 +/* 64.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 64.6 + * Copyright 2007, 2009 Red Hat, Inc. 64.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 64.8 + * 64.9 + * This code is free software; you can redistribute it and/or modify it 64.10 + * under the terms of the GNU General Public License version 2 only, as 64.11 + * published by the Free Software Foundation. 64.12 + * 64.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 64.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 64.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 64.16 + * version 2 for more details (a copy is included in the LICENSE file that 64.17 + * accompanied this code). 64.18 + * 64.19 + * You should have received a copy of the GNU General Public License version 64.20 + * 2 along with this work; if not, write to the Free Software Foundation, 64.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 64.22 + * 64.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 64.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 64.25 + * have any questions. 64.26 + * 64.27 + */ 64.28 + 64.29 +#include "incls/_precompiled.incl" 64.30 +#include "incls/_relocInfo_zero.cpp.incl" 64.31 + 64.32 +void Relocation::pd_set_data_value(address x, intptr_t o) { 64.33 + ShouldNotCallThis(); 64.34 +} 64.35 + 64.36 +address Relocation::pd_call_destination(address orig_addr) { 64.37 + ShouldNotCallThis(); 64.38 +} 64.39 + 64.40 +void Relocation::pd_set_call_destination(address x) { 64.41 + ShouldNotCallThis(); 64.42 +} 64.43 + 64.44 +address Relocation::pd_get_address_from_code() { 64.45 + ShouldNotCallThis(); 64.46 +} 64.47 + 64.48 +address* Relocation::pd_address_in_code() { 64.49 + // Relocations in Shark are just stored directly 64.50 + return (address *) addr(); 64.51 +} 64.52 + 64.53 +int Relocation::pd_breakpoint_size() { 64.54 + ShouldNotCallThis(); 64.55 +} 64.56 + 64.57 +void Relocation::pd_swap_in_breakpoint(address x, 64.58 + short* instrs, 64.59 + int instrlen) { 64.60 + ShouldNotCallThis(); 64.61 +} 64.62 + 64.63 +void Relocation::pd_swap_out_breakpoint(address x, 64.64 + short* instrs, 64.65 + int instrlen) { 64.66 + ShouldNotCallThis(); 64.67 +} 64.68 + 64.69 +void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, 64.70 + CodeBuffer* dst) { 64.71 + ShouldNotCallThis(); 64.72 +} 64.73 + 64.74 +void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, 64.75 + CodeBuffer* dst) { 64.76 + ShouldNotCallThis(); 64.77 +}
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 65.2 +++ b/src/cpu/zero/vm/relocInfo_zero.hpp Tue Oct 13 12:04:21 2009 -0700 65.3 @@ -0,0 +1,32 @@ 65.4 +/* 65.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 65.6 + * Copyright 2007 Red Hat, Inc. 65.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 65.8 + * 65.9 + * This code is free software; you can redistribute it and/or modify it 65.10 + * under the terms of the GNU General Public License version 2 only, as 65.11 + * published by the Free Software Foundation. 65.12 + * 65.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 65.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 65.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 65.16 + * version 2 for more details (a copy is included in the LICENSE file that 65.17 + * accompanied this code). 65.18 + * 65.19 + * You should have received a copy of the GNU General Public License version 65.20 + * 2 along with this work; if not, write to the Free Software Foundation, 65.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 65.22 + * 65.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 65.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 65.25 + * have any questions. 65.26 + * 65.27 + */ 65.28 + 65.29 + // machine-dependent parts of class relocInfo 65.30 + private: 65.31 + enum { 65.32 + // these constants mean nothing without an assembler 65.33 + offset_unit = 1, 65.34 + format_width = 1 65.35 + };
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 66.2 +++ b/src/cpu/zero/vm/sharedRuntime_zero.cpp Tue Oct 13 12:04:21 2009 -0700 66.3 @@ -0,0 +1,108 @@ 66.4 +/* 66.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 66.6 + * Copyright 2007, 2008 Red Hat, Inc. 66.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 66.8 + * 66.9 + * This code is free software; you can redistribute it and/or modify it 66.10 + * under the terms of the GNU General Public License version 2 only, as 66.11 + * published by the Free Software Foundation. 66.12 + * 66.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 66.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 66.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 66.16 + * version 2 for more details (a copy is included in the LICENSE file that 66.17 + * accompanied this code). 66.18 + * 66.19 + * You should have received a copy of the GNU General Public License version 66.20 + * 2 along with this work; if not, write to the Free Software Foundation, 66.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 66.22 + * 66.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 66.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 66.25 + * have any questions. 66.26 + * 66.27 + */ 66.28 + 66.29 +#include "incls/_precompiled.incl" 66.30 +#include "incls/_sharedRuntime_zero.cpp.incl" 66.31 + 66.32 +DeoptimizationBlob *SharedRuntime::_deopt_blob; 66.33 +SafepointBlob *SharedRuntime::_polling_page_safepoint_handler_blob; 66.34 +SafepointBlob *SharedRuntime::_polling_page_return_handler_blob; 66.35 +RuntimeStub *SharedRuntime::_wrong_method_blob; 66.36 +RuntimeStub *SharedRuntime::_ic_miss_blob; 66.37 +RuntimeStub *SharedRuntime::_resolve_opt_virtual_call_blob; 66.38 +RuntimeStub *SharedRuntime::_resolve_virtual_call_blob; 66.39 +RuntimeStub *SharedRuntime::_resolve_static_call_blob; 66.40 + 66.41 +int SharedRuntime::java_calling_convention(const BasicType *sig_bt, 66.42 + VMRegPair *regs, 66.43 + int total_args_passed, 66.44 + int is_outgoing) { 66.45 + return 0; 66.46 +} 66.47 + 66.48 +AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters( 66.49 + MacroAssembler *masm, 66.50 + int total_args_passed, 66.51 + int comp_args_on_stack, 66.52 + const BasicType *sig_bt, 66.53 + const VMRegPair *regs) { 66.54 + return new AdapterHandlerEntry( 66.55 + ShouldNotCallThisStub(), 66.56 + ShouldNotCallThisStub(), 66.57 + ShouldNotCallThisStub()); 66.58 +} 66.59 + 66.60 +nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm, 66.61 + methodHandle method, 66.62 + int total_in_args, 66.63 + int comp_args_on_stack, 66.64 + BasicType *in_sig_bt, 66.65 + VMRegPair *in_regs, 66.66 + BasicType ret_type) { 66.67 + ShouldNotCallThis(); 66.68 +} 66.69 + 66.70 +int Deoptimization::last_frame_adjust(int callee_parameters, 66.71 + int callee_locals) { 66.72 + return 0; 66.73 +} 66.74 + 66.75 +uint SharedRuntime::out_preserve_stack_slots() { 66.76 + ShouldNotCallThis(); 66.77 +} 66.78 + 66.79 +static RuntimeStub* generate_empty_runtime_stub(const char* name) { 66.80 + CodeBuffer buffer(name, 0, 0); 66.81 + return RuntimeStub::new_runtime_stub(name, &buffer, 0, 0, NULL, false); 66.82 +} 66.83 + 66.84 +static SafepointBlob* generate_empty_safepoint_blob() { 66.85 + CodeBuffer buffer("handler_blob", 0, 0); 66.86 + return SafepointBlob::create(&buffer, NULL, 0); 66.87 +} 66.88 + 66.89 +void SharedRuntime::generate_stubs() { 66.90 + _wrong_method_blob = 66.91 + generate_empty_runtime_stub("wrong_method_stub"); 66.92 + _ic_miss_blob = 66.93 + generate_empty_runtime_stub("ic_miss_stub"); 66.94 + _resolve_opt_virtual_call_blob = 66.95 + generate_empty_runtime_stub("resolve_opt_virtual_call"); 66.96 + _resolve_virtual_call_blob = 66.97 + generate_empty_runtime_stub("resolve_virtual_call"); 66.98 + _resolve_static_call_blob = 66.99 + generate_empty_runtime_stub("resolve_static_call"); 66.100 + 66.101 + _polling_page_safepoint_handler_blob = 66.102 + generate_empty_safepoint_blob(); 66.103 + _polling_page_return_handler_blob = 66.104 + generate_empty_safepoint_blob(); 66.105 +} 66.106 + 66.107 +int SharedRuntime::c_calling_convention(const BasicType *sig_bt, 66.108 + VMRegPair *regs, 66.109 + int total_args_passed) { 66.110 + ShouldNotCallThis(); 66.111 +}
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 67.2 +++ b/src/cpu/zero/vm/sharkFrame_zero.hpp Tue Oct 13 12:04:21 2009 -0700 67.3 @@ -0,0 +1,79 @@ 67.4 +/* 67.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 67.6 + * Copyright 2008 Red Hat, Inc. 67.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 67.8 + * 67.9 + * This code is free software; you can redistribute it and/or modify it 67.10 + * under the terms of the GNU General Public License version 2 only, as 67.11 + * published by the Free Software Foundation. 67.12 + * 67.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 67.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 67.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 67.16 + * version 2 for more details (a copy is included in the LICENSE file that 67.17 + * accompanied this code). 67.18 + * 67.19 + * You should have received a copy of the GNU General Public License version 67.20 + * 2 along with this work; if not, write to the Free Software Foundation, 67.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 67.22 + * 67.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 67.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 67.25 + * have any questions. 67.26 + * 67.27 + */ 67.28 + 67.29 +// | ... | 67.30 +// +--------------------+ ------------------ 67.31 +// | stack slot n-1 | low addresses 67.32 +// | ... | 67.33 +// | stack slot 0 | 67.34 +// | monitor m-1 | 67.35 +// | ... | 67.36 +// | monitor 0 | 67.37 +// | oop_tmp | 67.38 +// | method | 67.39 +// | unextended_sp | 67.40 +// | pc | 67.41 +// | frame_type | 67.42 +// | next_frame | high addresses 67.43 +// +--------------------+ ------------------ 67.44 +// | ... | 67.45 + 67.46 +class SharkFrame : public ZeroFrame { 67.47 + friend class SharkFunction; 67.48 + 67.49 + private: 67.50 + SharkFrame() : ZeroFrame() { 67.51 + ShouldNotCallThis(); 67.52 + } 67.53 + 67.54 + protected: 67.55 + enum Layout { 67.56 + pc_off = jf_header_words, 67.57 + unextended_sp_off, 67.58 + method_off, 67.59 + oop_tmp_off, 67.60 + header_words 67.61 + }; 67.62 + 67.63 + public: 67.64 + address pc() const { 67.65 + return (address) value_of_word(pc_off); 67.66 + } 67.67 + 67.68 + intptr_t* unextended_sp() const { 67.69 + return (intptr_t *) value_of_word(unextended_sp_off); 67.70 + } 67.71 + 67.72 + methodOop method() const { 67.73 + return (methodOop) value_of_word(method_off); 67.74 + } 67.75 + 67.76 + public: 67.77 + void identify_word(int frame_index, 67.78 + int offset, 67.79 + char* fieldbuf, 67.80 + char* valuebuf, 67.81 + int buflen) const; 67.82 +};
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 68.2 +++ b/src/cpu/zero/vm/stack_zero.hpp Tue Oct 13 12:04:21 2009 -0700 68.3 @@ -0,0 +1,197 @@ 68.4 +/* 68.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 68.6 + * Copyright 2008, 2009 Red Hat, Inc. 68.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 68.8 + * 68.9 + * This code is free software; you can redistribute it and/or modify it 68.10 + * under the terms of the GNU General Public License version 2 only, as 68.11 + * published by the Free Software Foundation. 68.12 + * 68.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 68.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 68.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 68.16 + * version 2 for more details (a copy is included in the LICENSE file that 68.17 + * accompanied this code). 68.18 + * 68.19 + * You should have received a copy of the GNU General Public License version 68.20 + * 2 along with this work; if not, write to the Free Software Foundation, 68.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 68.22 + * 68.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 68.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 68.25 + * have any questions. 68.26 + * 68.27 + */ 68.28 + 68.29 +class ZeroStack { 68.30 + private: 68.31 + intptr_t *_base; // the last available word 68.32 + intptr_t *_top; // the word past the end of the stack 68.33 + intptr_t *_sp; // the top word on the stack 68.34 + 68.35 + public: 68.36 + ZeroStack() 68.37 + : _base(NULL), _top(NULL), _sp(NULL) {} 68.38 + 68.39 + bool needs_setup() const { 68.40 + return _base == NULL; 68.41 + } 68.42 + 68.43 + void setup(void *mem, size_t size) { 68.44 + assert(needs_setup(), "already set up"); 68.45 + assert(!(size & WordAlignmentMask), "unaligned"); 68.46 + 68.47 + _base = (intptr_t *) mem; 68.48 + _top = _base + (size >> LogBytesPerWord); 68.49 + _sp = _top; 68.50 + } 68.51 + void teardown() { 68.52 + assert(!needs_setup(), "not set up"); 68.53 + assert(_sp == _top, "stuff on stack at teardown"); 68.54 + 68.55 + _base = NULL; 68.56 + _top = NULL; 68.57 + _sp = NULL; 68.58 + } 68.59 + 68.60 + intptr_t *sp() const { 68.61 + return _sp; 68.62 + } 68.63 + void set_sp(intptr_t *new_sp) { 68.64 + assert(_top >= new_sp && new_sp >= _base, "bad stack pointer"); 68.65 + _sp = new_sp; 68.66 + } 68.67 + 68.68 + int available_words() const { 68.69 + return _sp - _base; 68.70 + } 68.71 + 68.72 + void push(intptr_t value) { 68.73 + assert(_sp > _base, "stack overflow"); 68.74 + *(--_sp) = value; 68.75 + } 68.76 + intptr_t pop() { 68.77 + assert(_sp < _top, "stack underflow"); 68.78 + return *(_sp++); 68.79 + } 68.80 + 68.81 + void *alloc(size_t size) { 68.82 + int count = align_size_up(size, wordSize) >> LogBytesPerWord; 68.83 + assert(count <= available_words(), "stack overflow"); 68.84 + return _sp -= count; 68.85 + } 68.86 + 68.87 + public: 68.88 + static ByteSize base_offset() { 68.89 + return byte_offset_of(ZeroStack, _base); 68.90 + } 68.91 + static ByteSize top_offset() { 68.92 + return byte_offset_of(ZeroStack, _top); 68.93 + } 68.94 + static ByteSize sp_offset() { 68.95 + return byte_offset_of(ZeroStack, _sp); 68.96 + } 68.97 +}; 68.98 + 68.99 + 68.100 +class EntryFrame; 68.101 +class InterpreterFrame; 68.102 +class SharkFrame; 68.103 +class FakeStubFrame; 68.104 + 68.105 +// 68.106 +// | ... | 68.107 +// +--------------------+ ------------------ 68.108 +// | ... | low addresses 68.109 +// | frame_type | 68.110 +// | next_frame | high addresses 68.111 +// +--------------------+ ------------------ 68.112 +// | ... | 68.113 + 68.114 +class ZeroFrame { 68.115 + friend class frame; 68.116 + friend class ZeroStackPrinter; 68.117 + 68.118 + protected: 68.119 + ZeroFrame() { 68.120 + ShouldNotCallThis(); 68.121 + } 68.122 + 68.123 + enum Layout { 68.124 + next_frame_off, 68.125 + frame_type_off, 68.126 + jf_header_words 68.127 + }; 68.128 + 68.129 + enum FrameType { 68.130 + ENTRY_FRAME = 1, 68.131 + INTERPRETER_FRAME, 68.132 + SHARK_FRAME, 68.133 + FAKE_STUB_FRAME 68.134 + }; 68.135 + 68.136 + protected: 68.137 + intptr_t *addr_of_word(int offset) const { 68.138 + return (intptr_t *) this - offset; 68.139 + } 68.140 + intptr_t value_of_word(int offset) const { 68.141 + return *addr_of_word(offset); 68.142 + } 68.143 + 68.144 + public: 68.145 + ZeroFrame *next() const { 68.146 + return (ZeroFrame *) value_of_word(next_frame_off); 68.147 + } 68.148 + 68.149 + protected: 68.150 + FrameType type() const { 68.151 + return (FrameType) value_of_word(frame_type_off); 68.152 + } 68.153 + 68.154 + public: 68.155 + bool is_entry_frame() const { 68.156 + return type() == ENTRY_FRAME; 68.157 + } 68.158 + bool is_interpreter_frame() const { 68.159 + return type() == INTERPRETER_FRAME; 68.160 + } 68.161 + bool is_shark_frame() const { 68.162 + return type() == SHARK_FRAME; 68.163 + } 68.164 + bool is_fake_stub_frame() const { 68.165 + return type() == FAKE_STUB_FRAME; 68.166 + } 68.167 + 68.168 + public: 68.169 + EntryFrame *as_entry_frame() const { 68.170 + assert(is_entry_frame(), "should be"); 68.171 + return (EntryFrame *) this; 68.172 + } 68.173 + InterpreterFrame *as_interpreter_frame() const { 68.174 + assert(is_interpreter_frame(), "should be"); 68.175 + return (InterpreterFrame *) this; 68.176 + } 68.177 + SharkFrame *as_shark_frame() const { 68.178 + assert(is_shark_frame(), "should be"); 68.179 + return (SharkFrame *) this; 68.180 + } 68.181 + FakeStubFrame *as_fake_stub_frame() const { 68.182 + assert(is_fake_stub_frame(), "should be"); 68.183 + return (FakeStubFrame *) this; 68.184 + } 68.185 + 68.186 + public: 68.187 + void identify_word(int frame_index, 68.188 + int offset, 68.189 + char* fieldbuf, 68.190 + char* valuebuf, 68.191 + int buflen) const; 68.192 + 68.193 + protected: 68.194 + void identify_vp_word(int frame_index, 68.195 + intptr_t* addr, 68.196 + intptr_t* monitor_base, 68.197 + intptr_t* stack_base, 68.198 + char* fieldbuf, 68.199 + int buflen) const; 68.200 +};
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 69.2 +++ b/src/cpu/zero/vm/stubGenerator_zero.cpp Tue Oct 13 12:04:21 2009 -0700 69.3 @@ -0,0 +1,251 @@ 69.4 +/* 69.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 69.6 + * Copyright 2007, 2008 Red Hat, Inc. 69.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 69.8 + * 69.9 + * This code is free software; you can redistribute it and/or modify it 69.10 + * under the terms of the GNU General Public License version 2 only, as 69.11 + * published by the Free Software Foundation. 69.12 + * 69.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 69.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 69.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 69.16 + * version 2 for more details (a copy is included in the LICENSE file that 69.17 + * accompanied this code). 69.18 + * 69.19 + * You should have received a copy of the GNU General Public License version 69.20 + * 2 along with this work; if not, write to the Free Software Foundation, 69.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 69.22 + * 69.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 69.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 69.25 + * have any questions. 69.26 + * 69.27 + */ 69.28 + 69.29 +#include "incls/_precompiled.incl" 69.30 +#include "incls/_stubGenerator_zero.cpp.incl" 69.31 + 69.32 +// Declaration and definition of StubGenerator (no .hpp file). 69.33 +// For a more detailed description of the stub routine structure 69.34 +// see the comment in stubRoutines.hpp 69.35 + 69.36 +class StubGenerator: public StubCodeGenerator { 69.37 + private: 69.38 + // The call stub is used to call Java from C 69.39 + static void call_stub( 69.40 + JavaCallWrapper *call_wrapper, 69.41 + intptr_t* result, 69.42 + BasicType result_type, 69.43 + methodOop method, 69.44 + address entry_point, 69.45 + intptr_t* parameters, 69.46 + int parameter_words, 69.47 + TRAPS) { 69.48 + JavaThread *thread = (JavaThread *) THREAD; 69.49 + ZeroStack *stack = thread->zero_stack(); 69.50 + 69.51 + // Make sure we have no pending exceptions 69.52 + assert(!HAS_PENDING_EXCEPTION, "call_stub called with pending exception"); 69.53 + 69.54 + // Set up the stack if necessary 69.55 + bool stack_needs_teardown = false; 69.56 + if (stack->needs_setup()) { 69.57 + size_t stack_used = thread->stack_base() - (address) &stack_used; 69.58 + size_t stack_free = thread->stack_size() - stack_used; 69.59 + size_t zero_stack_size = align_size_down(stack_free / 2, wordSize); 69.60 + 69.61 + stack->setup(alloca(zero_stack_size), zero_stack_size); 69.62 + stack_needs_teardown = true; 69.63 + } 69.64 + 69.65 + // Allocate and initialize our frame 69.66 + thread->push_zero_frame( 69.67 + EntryFrame::build(stack, parameters, parameter_words, call_wrapper)); 69.68 + 69.69 + // Make the call 69.70 + Interpreter::invoke_method(method, entry_point, THREAD); 69.71 + 69.72 + // Store result depending on type 69.73 + if (!HAS_PENDING_EXCEPTION) { 69.74 + switch (result_type) { 69.75 + case T_INT: 69.76 + *(jint *) result = *(jint *) stack->sp(); 69.77 + break; 69.78 + case T_LONG: 69.79 + *(jlong *) result = *(jlong *) stack->sp(); 69.80 + break; 69.81 + case T_FLOAT: 69.82 + *(jfloat *) result = *(jfloat *) stack->sp(); 69.83 + break; 69.84 + case T_DOUBLE: 69.85 + *(jdouble *) result = *(jdouble *) stack->sp(); 69.86 + break; 69.87 + case T_OBJECT: 69.88 + *(oop *) result = *(oop *) stack->sp(); 69.89 + break; 69.90 + default: 69.91 + ShouldNotReachHere(); 69.92 + } 69.93 + } 69.94 + 69.95 + // Unwind our frame 69.96 + thread->pop_zero_frame(); 69.97 + 69.98 + // Tear down the stack if necessary 69.99 + if (stack_needs_teardown) 69.100 + stack->teardown(); 69.101 + } 69.102 + 69.103 + // These stubs get called from some dumb test routine. 69.104 + // I'll write them properly when they're called from 69.105 + // something that's actually doing something. 69.106 + static void fake_arraycopy_stub(address src, address dst, int count) { 69.107 + assert(count == 0, "huh?"); 69.108 + } 69.109 + 69.110 + void generate_arraycopy_stubs() { 69.111 + // Call the conjoint generation methods immediately after 69.112 + // the disjoint ones so that short branches from the former 69.113 + // to the latter can be generated. 69.114 + StubRoutines::_jbyte_disjoint_arraycopy = (address) fake_arraycopy_stub; 69.115 + StubRoutines::_jbyte_arraycopy = (address) fake_arraycopy_stub; 69.116 + 69.117 + StubRoutines::_jshort_disjoint_arraycopy = (address) fake_arraycopy_stub; 69.118 + StubRoutines::_jshort_arraycopy = (address) fake_arraycopy_stub; 69.119 + 69.120 + StubRoutines::_jint_disjoint_arraycopy = (address) fake_arraycopy_stub; 69.121 + StubRoutines::_jint_arraycopy = (address) fake_arraycopy_stub; 69.122 + 69.123 + StubRoutines::_jlong_disjoint_arraycopy = (address) fake_arraycopy_stub; 69.124 + StubRoutines::_jlong_arraycopy = (address) fake_arraycopy_stub; 69.125 + 69.126 + StubRoutines::_oop_disjoint_arraycopy = ShouldNotCallThisStub(); 69.127 + StubRoutines::_oop_arraycopy = ShouldNotCallThisStub(); 69.128 + 69.129 + StubRoutines::_checkcast_arraycopy = ShouldNotCallThisStub(); 69.130 + StubRoutines::_unsafe_arraycopy = ShouldNotCallThisStub(); 69.131 + StubRoutines::_generic_arraycopy = ShouldNotCallThisStub(); 69.132 + 69.133 + // We don't generate specialized code for HeapWord-aligned source 69.134 + // arrays, so just use the code we've already generated 69.135 + StubRoutines::_arrayof_jbyte_disjoint_arraycopy = 69.136 + StubRoutines::_jbyte_disjoint_arraycopy; 69.137 + StubRoutines::_arrayof_jbyte_arraycopy = 69.138 + StubRoutines::_jbyte_arraycopy; 69.139 + 69.140 + StubRoutines::_arrayof_jshort_disjoint_arraycopy = 69.141 + StubRoutines::_jshort_disjoint_arraycopy; 69.142 + StubRoutines::_arrayof_jshort_arraycopy = 69.143 + StubRoutines::_jshort_arraycopy; 69.144 + 69.145 + StubRoutines::_arrayof_jint_disjoint_arraycopy = 69.146 + StubRoutines::_jint_disjoint_arraycopy; 69.147 + StubRoutines::_arrayof_jint_arraycopy = 69.148 + StubRoutines::_jint_arraycopy; 69.149 + 69.150 + StubRoutines::_arrayof_jlong_disjoint_arraycopy = 69.151 + StubRoutines::_jlong_disjoint_arraycopy; 69.152 + StubRoutines::_arrayof_jlong_arraycopy = 69.153 + StubRoutines::_jlong_arraycopy; 69.154 + 69.155 + StubRoutines::_arrayof_oop_disjoint_arraycopy = 69.156 + StubRoutines::_oop_disjoint_arraycopy; 69.157 + StubRoutines::_arrayof_oop_arraycopy = 69.158 + StubRoutines::_oop_arraycopy; 69.159 + } 69.160 + 69.161 + void generate_initial() { 69.162 + // Generates all stubs and initializes the entry points 69.163 + 69.164 + // entry points that exist in all platforms Note: This is code 69.165 + // that could be shared among different platforms - however the 69.166 + // benefit seems to be smaller than the disadvantage of having a 69.167 + // much more complicated generator structure. See also comment in 69.168 + // stubRoutines.hpp. 69.169 + 69.170 + StubRoutines::_forward_exception_entry = ShouldNotCallThisStub(); 69.171 + StubRoutines::_call_stub_entry = (address) call_stub; 69.172 + StubRoutines::_catch_exception_entry = ShouldNotCallThisStub(); 69.173 + 69.174 + // atomic calls 69.175 + StubRoutines::_atomic_xchg_entry = ShouldNotCallThisStub(); 69.176 + StubRoutines::_atomic_xchg_ptr_entry = ShouldNotCallThisStub(); 69.177 + StubRoutines::_atomic_cmpxchg_entry = ShouldNotCallThisStub(); 69.178 + StubRoutines::_atomic_cmpxchg_ptr_entry = ShouldNotCallThisStub(); 69.179 + StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub(); 69.180 + StubRoutines::_atomic_add_entry = ShouldNotCallThisStub(); 69.181 + StubRoutines::_atomic_add_ptr_entry = ShouldNotCallThisStub(); 69.182 + StubRoutines::_fence_entry = ShouldNotCallThisStub(); 69.183 + 69.184 + // amd64 does this here, sparc does it in generate_all() 69.185 + StubRoutines::_handler_for_unsafe_access_entry = 69.186 + ShouldNotCallThisStub(); 69.187 + } 69.188 + 69.189 + void generate_all() { 69.190 + // Generates all stubs and initializes the entry points 69.191 + 69.192 + // These entry points require SharedInfo::stack0 to be set up in 69.193 + // non-core builds and need to be relocatable, so they each 69.194 + // fabricate a RuntimeStub internally. 69.195 + StubRoutines::_throw_AbstractMethodError_entry = 69.196 + ShouldNotCallThisStub(); 69.197 + 69.198 + StubRoutines::_throw_ArithmeticException_entry = 69.199 + ShouldNotCallThisStub(); 69.200 + 69.201 + StubRoutines::_throw_NullPointerException_entry = 69.202 + ShouldNotCallThisStub(); 69.203 + 69.204 + StubRoutines::_throw_NullPointerException_at_call_entry = 69.205 + ShouldNotCallThisStub(); 69.206 + 69.207 + StubRoutines::_throw_StackOverflowError_entry = 69.208 + ShouldNotCallThisStub(); 69.209 + 69.210 + // support for verify_oop (must happen after universe_init) 69.211 + StubRoutines::_verify_oop_subroutine_entry = 69.212 + ShouldNotCallThisStub(); 69.213 + 69.214 + // arraycopy stubs used by compilers 69.215 + generate_arraycopy_stubs(); 69.216 + } 69.217 + 69.218 + public: 69.219 + StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) { 69.220 + if (all) { 69.221 + generate_all(); 69.222 + } else { 69.223 + generate_initial(); 69.224 + } 69.225 + } 69.226 +}; 69.227 + 69.228 +void StubGenerator_generate(CodeBuffer* code, bool all) { 69.229 + StubGenerator g(code, all); 69.230 +} 69.231 + 69.232 +EntryFrame *EntryFrame::build(ZeroStack* stack, 69.233 + const intptr_t* parameters, 69.234 + int parameter_words, 69.235 + JavaCallWrapper* call_wrapper) { 69.236 + if (header_words + parameter_words > stack->available_words()) { 69.237 + Unimplemented(); 69.238 + } 69.239 + 69.240 + stack->push(0); // next_frame, filled in later 69.241 + intptr_t *fp = stack->sp(); 69.242 + assert(fp - stack->sp() == next_frame_off, "should be"); 69.243 + 69.244 + stack->push(ENTRY_FRAME); 69.245 + assert(fp - stack->sp() == frame_type_off, "should be"); 69.246 + 69.247 + stack->push((intptr_t) call_wrapper); 69.248 + assert(fp - stack->sp() == call_wrapper_off, "should be"); 69.249 + 69.250 + for (int i = 0; i < parameter_words; i++) 69.251 + stack->push(parameters[i]); 69.252 + 69.253 + return (EntryFrame *) fp; 69.254 +}
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 70.2 +++ b/src/cpu/zero/vm/stubRoutines_zero.cpp Tue Oct 13 12:04:21 2009 -0700 70.3 @@ -0,0 +1,31 @@ 70.4 +/* 70.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 70.6 + * Copyright 2008, 2009 Red Hat, Inc. 70.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 70.8 + * 70.9 + * This code is free software; you can redistribute it and/or modify it 70.10 + * under the terms of the GNU General Public License version 2 only, as 70.11 + * published by the Free Software Foundation. 70.12 + * 70.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 70.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 70.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 70.16 + * version 2 for more details (a copy is included in the LICENSE file that 70.17 + * accompanied this code). 70.18 + * 70.19 + * You should have received a copy of the GNU General Public License version 70.20 + * 2 along with this work; if not, write to the Free Software Foundation, 70.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 70.22 + * 70.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 70.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 70.25 + * have any questions. 70.26 + * 70.27 + */ 70.28 + 70.29 +#include "incls/_precompiled.incl" 70.30 +#include "incls/_stubRoutines_zero.cpp.incl" 70.31 + 70.32 +#ifdef IA32 70.33 +address StubRoutines::x86::_call_stub_compiled_return = NULL; 70.34 +#endif // IA32
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 71.2 +++ b/src/cpu/zero/vm/stubRoutines_zero.hpp Tue Oct 13 12:04:21 2009 -0700 71.3 @@ -0,0 +1,51 @@ 71.4 +/* 71.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 71.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 71.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 71.8 + * 71.9 + * This code is free software; you can redistribute it and/or modify it 71.10 + * under the terms of the GNU General Public License version 2 only, as 71.11 + * published by the Free Software Foundation. 71.12 + * 71.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 71.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 71.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 71.16 + * version 2 for more details (a copy is included in the LICENSE file that 71.17 + * accompanied this code). 71.18 + * 71.19 + * You should have received a copy of the GNU General Public License version 71.20 + * 2 along with this work; if not, write to the Free Software Foundation, 71.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 71.22 + * 71.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 71.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 71.25 + * have any questions. 71.26 + * 71.27 + */ 71.28 + 71.29 + // This file holds the platform specific parts of the StubRoutines 71.30 + // definition. See stubRoutines.hpp for a description on how to 71.31 + // extend it. 71.32 + 71.33 + public: 71.34 + static address call_stub_return_pc() { 71.35 + return (address) -1; 71.36 + } 71.37 + 71.38 + static bool returns_to_call_stub(address return_pc) { 71.39 + return return_pc == call_stub_return_pc(); 71.40 + } 71.41 + 71.42 + enum platform_dependent_constants { 71.43 + code_size1 = 0, // The assembler will fail with a guarantee 71.44 + code_size2 = 0 // if these are too small. Simply increase 71.45 + }; // them if that happens. 71.46 + 71.47 +#ifdef IA32 71.48 + class x86 { 71.49 + friend class VMStructs; 71.50 + 71.51 + private: 71.52 + static address _call_stub_compiled_return; 71.53 + }; 71.54 +#endif // IA32
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 72.2 +++ b/src/cpu/zero/vm/templateInterpreterGenerator_zero.hpp Tue Oct 13 12:04:21 2009 -0700 72.3 @@ -0,0 +1,26 @@ 72.4 +/* 72.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 72.6 + * Copyright 2009 Red Hat, Inc. 72.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 72.8 + * 72.9 + * This code is free software; you can redistribute it and/or modify it 72.10 + * under the terms of the GNU General Public License version 2 only, as 72.11 + * published by the Free Software Foundation. 72.12 + * 72.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 72.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 72.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 72.16 + * version 2 for more details (a copy is included in the LICENSE file that 72.17 + * accompanied this code). 72.18 + * 72.19 + * You should have received a copy of the GNU General Public License version 72.20 + * 2 along with this work; if not, write to the Free Software Foundation, 72.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 72.22 + * 72.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 72.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 72.25 + * have any questions. 72.26 + * 72.27 + */ 72.28 + 72.29 +// This file is intentionally empty
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 73.2 +++ b/src/cpu/zero/vm/templateInterpreter_zero.cpp Tue Oct 13 12:04:21 2009 -0700 73.3 @@ -0,0 +1,26 @@ 73.4 +/* 73.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 73.6 + * Copyright 2009 Red Hat, Inc. 73.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 73.8 + * 73.9 + * This code is free software; you can redistribute it and/or modify it 73.10 + * under the terms of the GNU General Public License version 2 only, as 73.11 + * published by the Free Software Foundation. 73.12 + * 73.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 73.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 73.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 73.16 + * version 2 for more details (a copy is included in the LICENSE file that 73.17 + * accompanied this code). 73.18 + * 73.19 + * You should have received a copy of the GNU General Public License version 73.20 + * 2 along with this work; if not, write to the Free Software Foundation, 73.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 73.22 + * 73.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 73.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 73.25 + * have any questions. 73.26 + * 73.27 + */ 73.28 + 73.29 +// This file is intentionally empty
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 74.2 +++ b/src/cpu/zero/vm/templateInterpreter_zero.hpp Tue Oct 13 12:04:21 2009 -0700 74.3 @@ -0,0 +1,26 @@ 74.4 +/* 74.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 74.6 + * Copyright 2009 Red Hat, Inc. 74.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 74.8 + * 74.9 + * This code is free software; you can redistribute it and/or modify it 74.10 + * under the terms of the GNU General Public License version 2 only, as 74.11 + * published by the Free Software Foundation. 74.12 + * 74.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 74.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 74.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 74.16 + * version 2 for more details (a copy is included in the LICENSE file that 74.17 + * accompanied this code). 74.18 + * 74.19 + * You should have received a copy of the GNU General Public License version 74.20 + * 2 along with this work; if not, write to the Free Software Foundation, 74.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 74.22 + * 74.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 74.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 74.25 + * have any questions. 74.26 + * 74.27 + */ 74.28 + 74.29 +// This file is intentionally empty
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 75.2 +++ b/src/cpu/zero/vm/templateTable_zero.cpp Tue Oct 13 12:04:21 2009 -0700 75.3 @@ -0,0 +1,26 @@ 75.4 +/* 75.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 75.6 + * Copyright 2009 Red Hat, Inc. 75.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 75.8 + * 75.9 + * This code is free software; you can redistribute it and/or modify it 75.10 + * under the terms of the GNU General Public License version 2 only, as 75.11 + * published by the Free Software Foundation. 75.12 + * 75.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 75.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 75.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 75.16 + * version 2 for more details (a copy is included in the LICENSE file that 75.17 + * accompanied this code). 75.18 + * 75.19 + * You should have received a copy of the GNU General Public License version 75.20 + * 2 along with this work; if not, write to the Free Software Foundation, 75.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 75.22 + * 75.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 75.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 75.25 + * have any questions. 75.26 + * 75.27 + */ 75.28 + 75.29 +// This file is intentionally empty
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 76.2 +++ b/src/cpu/zero/vm/templateTable_zero.hpp Tue Oct 13 12:04:21 2009 -0700 76.3 @@ -0,0 +1,26 @@ 76.4 +/* 76.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 76.6 + * Copyright 2009 Red Hat, Inc. 76.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 76.8 + * 76.9 + * This code is free software; you can redistribute it and/or modify it 76.10 + * under the terms of the GNU General Public License version 2 only, as 76.11 + * published by the Free Software Foundation. 76.12 + * 76.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 76.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 76.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 76.16 + * version 2 for more details (a copy is included in the LICENSE file that 76.17 + * accompanied this code). 76.18 + * 76.19 + * You should have received a copy of the GNU General Public License version 76.20 + * 2 along with this work; if not, write to the Free Software Foundation, 76.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 76.22 + * 76.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 76.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 76.25 + * have any questions. 76.26 + * 76.27 + */ 76.28 + 76.29 +// This file is intentionally empty
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 77.2 +++ b/src/cpu/zero/vm/vmStructs_zero.hpp Tue Oct 13 12:04:21 2009 -0700 77.3 @@ -0,0 +1,52 @@ 77.4 +/* 77.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 77.6 + * Copyright 2007 Red Hat, Inc. 77.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 77.8 + * 77.9 + * This code is free software; you can redistribute it and/or modify it 77.10 + * under the terms of the GNU General Public License version 2 only, as 77.11 + * published by the Free Software Foundation. 77.12 + * 77.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 77.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 77.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 77.16 + * version 2 for more details (a copy is included in the LICENSE file that 77.17 + * accompanied this code). 77.18 + * 77.19 + * You should have received a copy of the GNU General Public License version 77.20 + * 2 along with this work; if not, write to the Free Software Foundation, 77.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 77.22 + * 77.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 77.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 77.25 + * have any questions. 77.26 + * 77.27 + */ 77.28 + 77.29 +// These are the CPU-specific fields, types and integer 77.30 +// constants required by the Serviceability Agent. This file is 77.31 +// referenced by vmStructs.cpp. 77.32 + 77.33 +#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ 77.34 + 77.35 + /* NOTE that we do not use the last_entry() macro here; it is used */ 77.36 + /* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must */ 77.37 + /* be present there) */ 77.38 + 77.39 +#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ 77.40 + 77.41 + /* NOTE that we do not use the last_entry() macro here; it is used */ 77.42 + /* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must */ 77.43 + /* be present there) */ 77.44 + 77.45 +#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ 77.46 + 77.47 + /* NOTE that we do not use the last_entry() macro here; it is used */ 77.48 + /* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must */ 77.49 + /* be present there) */ 77.50 + 77.51 +#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ 77.52 + 77.53 + /* NOTE that we do not use the last_entry() macro here; it is used */ 77.54 + /* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */ 77.55 + /* be present there) */
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 78.2 +++ b/src/cpu/zero/vm/vm_version_zero.cpp Tue Oct 13 12:04:21 2009 -0700 78.3 @@ -0,0 +1,26 @@ 78.4 +/* 78.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 78.6 + * Copyright 2009 Red Hat, Inc. 78.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 78.8 + * 78.9 + * This code is free software; you can redistribute it and/or modify it 78.10 + * under the terms of the GNU General Public License version 2 only, as 78.11 + * published by the Free Software Foundation. 78.12 + * 78.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 78.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 78.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 78.16 + * version 2 for more details (a copy is included in the LICENSE file that 78.17 + * accompanied this code). 78.18 + * 78.19 + * You should have received a copy of the GNU General Public License version 78.20 + * 2 along with this work; if not, write to the Free Software Foundation, 78.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 78.22 + * 78.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 78.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 78.25 + * have any questions. 78.26 + * 78.27 + */ 78.28 + 78.29 +// This file is intentionally empty
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 79.2 +++ b/src/cpu/zero/vm/vm_version_zero.hpp Tue Oct 13 12:04:21 2009 -0700 79.3 @@ -0,0 +1,31 @@ 79.4 +/* 79.5 + * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. 79.6 + * Copyright 2007 Red Hat, Inc. 79.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 79.8 + * 79.9 + * This code is free software; you can redistribute it and/or modify it 79.10 + * under the terms of the GNU General Public License version 2 only, as 79.11 + * published by the Free Software Foundation. 79.12 + * 79.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 79.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 79.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 79.16 + * version 2 for more details (a copy is included in the LICENSE file that 79.17 + * accompanied this code). 79.18 + * 79.19 + * You should have received a copy of the GNU General Public License version 79.20 + * 2 along with this work; if not, write to the Free Software Foundation, 79.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 79.22 + * 79.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 79.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 79.25 + * have any questions. 79.26 + * 79.27 + */ 79.28 + 79.29 +class VM_Version : public Abstract_VM_Version { 79.30 + public: 79.31 + static const char* cpu_features() { 79.32 + return ""; 79.33 + } 79.34 +};
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 80.2 +++ b/src/cpu/zero/vm/vmreg_zero.cpp Tue Oct 13 12:04:21 2009 -0700 80.3 @@ -0,0 +1,62 @@ 80.4 +/* 80.5 + * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved. 80.6 + * Copyright 2007 Red Hat, Inc. 80.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 80.8 + * 80.9 + * This code is free software; you can redistribute it and/or modify it 80.10 + * under the terms of the GNU General Public License version 2 only, as 80.11 + * published by the Free Software Foundation. 80.12 + * 80.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 80.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 80.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 80.16 + * version 2 for more details (a copy is included in the LICENSE file that 80.17 + * accompanied this code). 80.18 + * 80.19 + * You should have received a copy of the GNU General Public License version 80.20 + * 2 along with this work; if not, write to the Free Software Foundation, 80.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 80.22 + * 80.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 80.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 80.25 + * have any questions. 80.26 + * 80.27 + */ 80.28 + 80.29 +#include "incls/_precompiled.incl" 80.30 +#include "incls/_vmreg_zero.cpp.incl" 80.31 + 80.32 +void VMRegImpl::set_regName() { 80.33 + int i = 0; 80.34 + Register reg = ::as_Register(0); 80.35 + for ( ; i < ConcreteRegisterImpl::max_gpr ; ) { 80.36 + regName[i++] = reg->name(); 80.37 + reg = reg->successor(); 80.38 + } 80.39 + FloatRegister freg = ::as_FloatRegister(0); 80.40 + for ( ; i < ConcreteRegisterImpl::max_fpr ; ) { 80.41 + regName[i++] = freg->name(); 80.42 + freg = freg->successor(); 80.43 + } 80.44 + assert(i == ConcreteRegisterImpl::number_of_registers, "fix this"); 80.45 +} 80.46 + 80.47 +bool VMRegImpl::is_Register() { 80.48 + return value() >= 0 && 80.49 + value() < ConcreteRegisterImpl::max_gpr; 80.50 +} 80.51 + 80.52 +bool VMRegImpl::is_FloatRegister() { 80.53 + return value() >= ConcreteRegisterImpl::max_gpr && 80.54 + value() < ConcreteRegisterImpl::max_fpr; 80.55 +} 80.56 + 80.57 +Register VMRegImpl::as_Register() { 80.58 + assert(is_Register(), "must be"); 80.59 + return ::as_Register(value()); 80.60 +} 80.61 + 80.62 +FloatRegister VMRegImpl::as_FloatRegister() { 80.63 + assert(is_FloatRegister(), "must be" ); 80.64 + return ::as_FloatRegister(value() - ConcreteRegisterImpl::max_gpr); 80.65 +}
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 81.2 +++ b/src/cpu/zero/vm/vmreg_zero.hpp Tue Oct 13 12:04:21 2009 -0700 81.3 @@ -0,0 +1,29 @@ 81.4 +/* 81.5 + * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. 81.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 81.7 + * 81.8 + * This code is free software; you can redistribute it and/or modify it 81.9 + * under the terms of the GNU General Public License version 2 only, as 81.10 + * published by the Free Software Foundation. 81.11 + * 81.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 81.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 81.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 81.15 + * version 2 for more details (a copy is included in the LICENSE file that 81.16 + * accompanied this code). 81.17 + * 81.18 + * You should have received a copy of the GNU General Public License version 81.19 + * 2 along with this work; if not, write to the Free Software Foundation, 81.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 81.21 + * 81.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 81.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 81.24 + * have any questions. 81.25 + * 81.26 + */ 81.27 + 81.28 + bool is_Register(); 81.29 + Register as_Register(); 81.30 + 81.31 + bool is_FloatRegister(); 81.32 + FloatRegister as_FloatRegister();
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 82.2 +++ b/src/cpu/zero/vm/vmreg_zero.inline.hpp Tue Oct 13 12:04:21 2009 -0700 82.3 @@ -0,0 +1,32 @@ 82.4 +/* 82.5 + * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved. 82.6 + * Copyright 2007 Red Hat, Inc. 82.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 82.8 + * 82.9 + * This code is free software; you can redistribute it and/or modify it 82.10 + * under the terms of the GNU General Public License version 2 only, as 82.11 + * published by the Free Software Foundation. 82.12 + * 82.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 82.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 82.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 82.16 + * version 2 for more details (a copy is included in the LICENSE file that 82.17 + * accompanied this code). 82.18 + * 82.19 + * You should have received a copy of the GNU General Public License version 82.20 + * 2 along with this work; if not, write to the Free Software Foundation, 82.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 82.22 + * 82.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 82.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 82.25 + * have any questions. 82.26 + * 82.27 + */ 82.28 + 82.29 +inline VMReg RegisterImpl::as_VMReg() { 82.30 + return VMRegImpl::as_VMReg(encoding()); 82.31 +} 82.32 + 82.33 +inline VMReg FloatRegisterImpl::as_VMReg() { 82.34 + return VMRegImpl::as_VMReg(encoding() + ConcreteRegisterImpl::max_gpr); 82.35 +}
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 83.2 +++ b/src/cpu/zero/vm/vtableStubs_zero.cpp Tue Oct 13 12:04:21 2009 -0700 83.3 @@ -0,0 +1,43 @@ 83.4 +/* 83.5 + * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. 83.6 + * Copyright 2007 Red Hat, Inc. 83.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 83.8 + * 83.9 + * This code is free software; you can redistribute it and/or modify it 83.10 + * under the terms of the GNU General Public License version 2 only, as 83.11 + * published by the Free Software Foundation. 83.12 + * 83.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 83.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 83.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 83.16 + * version 2 for more details (a copy is included in the LICENSE file that 83.17 + * accompanied this code). 83.18 + * 83.19 + * You should have received a copy of the GNU General Public License version 83.20 + * 2 along with this work; if not, write to the Free Software Foundation, 83.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 83.22 + * 83.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 83.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 83.25 + * have any questions. 83.26 + * 83.27 + */ 83.28 + 83.29 +#include "incls/_precompiled.incl" 83.30 +#include "incls/_vtableStubs_zero.cpp.incl" 83.31 + 83.32 +VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { 83.33 + ShouldNotCallThis(); 83.34 +} 83.35 + 83.36 +VtableStub* VtableStubs::create_itable_stub(int vtable_index) { 83.37 + ShouldNotCallThis(); 83.38 +} 83.39 + 83.40 +int VtableStub::pd_code_size_limit(bool is_vtable_stub) { 83.41 + ShouldNotCallThis(); 83.42 +} 83.43 + 83.44 +int VtableStub::pd_code_alignment() { 83.45 + ShouldNotCallThis(); 83.46 +}
84.1 --- a/src/os/linux/vm/os_linux.cpp Wed Oct 07 15:38:37 2009 -0700 84.2 +++ b/src/os/linux/vm/os_linux.cpp Tue Oct 13 12:04:21 2009 -0700 84.3 @@ -176,7 +176,9 @@ 84.4 #endif 84.5 84.6 // Cpu architecture string 84.7 -#if defined(IA64) 84.8 +#if defined(ZERO) 84.9 +static char cpu_arch[] = ZERO_LIBARCH; 84.10 +#elif defined(IA64) 84.11 static char cpu_arch[] = "ia64"; 84.12 #elif defined(IA32) 84.13 static char cpu_arch[] = "i386"; 84.14 @@ -1743,7 +1745,14 @@ 84.15 {EM_SPARC32PLUS, EM_SPARC, ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"}, 84.16 {EM_SPARCV9, EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"}, 84.17 {EM_PPC, EM_PPC, ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"}, 84.18 - {EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"} 84.19 + {EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"}, 84.20 + {EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"}, 84.21 + {EM_S390, EM_S390, ELFCLASSNONE, ELFDATA2MSB, (char*)"IBM System/390"}, 84.22 + {EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"}, 84.23 + {EM_MIPS_RS3_LE, EM_MIPS_RS3_LE, ELFCLASS32, ELFDATA2LSB, (char*)"MIPSel"}, 84.24 + {EM_MIPS, EM_MIPS, ELFCLASS32, ELFDATA2MSB, (char*)"MIPS"}, 84.25 + {EM_PARISC, EM_PARISC, ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"}, 84.26 + {EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"} 84.27 }; 84.28 84.29 #if (defined IA32) 84.30 @@ -1760,9 +1769,23 @@ 84.31 static Elf32_Half running_arch_code=EM_PPC64; 84.32 #elif (defined __powerpc__) 84.33 static Elf32_Half running_arch_code=EM_PPC; 84.34 + #elif (defined ARM) 84.35 + static Elf32_Half running_arch_code=EM_ARM; 84.36 + #elif (defined S390) 84.37 + static Elf32_Half running_arch_code=EM_S390; 84.38 + #elif (defined ALPHA) 84.39 + static Elf32_Half running_arch_code=EM_ALPHA; 84.40 + #elif (defined MIPSEL) 84.41 + static Elf32_Half running_arch_code=EM_MIPS_RS3_LE; 84.42 + #elif (defined PARISC) 84.43 + static Elf32_Half running_arch_code=EM_PARISC; 84.44 + #elif (defined MIPS) 84.45 + static Elf32_Half running_arch_code=EM_MIPS; 84.46 + #elif (defined M68K) 84.47 + static Elf32_Half running_arch_code=EM_68K; 84.48 #else 84.49 #error Method os::dll_load requires that one of following is defined:\ 84.50 - IA32, AMD64, IA64, __sparc, __powerpc__ 84.51 + IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K 84.52 #endif 84.53 84.54 // Identify compatability class for VM's architecture and library's architecture 84.55 @@ -1794,10 +1817,12 @@ 84.56 return NULL; 84.57 } 84.58 84.59 +#ifndef S390 84.60 if (lib_arch.elf_class != arch_array[running_arch_index].elf_class) { 84.61 ::snprintf(diag_msg_buf, diag_msg_max_length-1," (Possible cause: architecture word width mismatch)"); 84.62 return NULL; 84.63 } 84.64 +#endif // !S390 84.65 84.66 if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) { 84.67 if ( lib_arch.name!=NULL ) { 84.68 @@ -2586,7 +2611,9 @@ 84.69 // format has been changed), we'll use the largest page size supported by 84.70 // the processor. 84.71 84.72 +#ifndef ZERO 84.73 _large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M); 84.74 +#endif // ZERO 84.75 84.76 FILE *fp = fopen("/proc/meminfo", "r"); 84.77 if (fp) {
85.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 85.2 +++ b/src/os_cpu/linux_zero/vm/assembler_linux_zero.cpp Tue Oct 13 12:04:21 2009 -0700 85.3 @@ -0,0 +1,26 @@ 85.4 +/* 85.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 85.6 + * Copyright 2009 Red Hat, Inc. 85.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 85.8 + * 85.9 + * This code is free software; you can redistribute it and/or modify it 85.10 + * under the terms of the GNU General Public License version 2 only, as 85.11 + * published by the Free Software Foundation. 85.12 + * 85.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 85.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 85.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 85.16 + * version 2 for more details (a copy is included in the LICENSE file that 85.17 + * accompanied this code). 85.18 + * 85.19 + * You should have received a copy of the GNU General Public License version 85.20 + * 2 along with this work; if not, write to the Free Software Foundation, 85.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 85.22 + * 85.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 85.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 85.25 + * have any questions. 85.26 + * 85.27 + */ 85.28 + 85.29 +// This file is intentionally empty
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 86.2 +++ b/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp Tue Oct 13 12:04:21 2009 -0700 86.3 @@ -0,0 +1,293 @@ 86.4 +/* 86.5 + * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 86.6 + * Copyright 2007, 2008 Red Hat, Inc. 86.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 86.8 + * 86.9 + * This code is free software; you can redistribute it and/or modify it 86.10 + * under the terms of the GNU General Public License version 2 only, as 86.11 + * published by the Free Software Foundation. 86.12 + * 86.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 86.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 86.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 86.16 + * version 2 for more details (a copy is included in the LICENSE file that 86.17 + * accompanied this code). 86.18 + * 86.19 + * You should have received a copy of the GNU General Public License version 86.20 + * 2 along with this work; if not, write to the Free Software Foundation, 86.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 86.22 + * 86.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 86.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 86.25 + * have any questions. 86.26 + * 86.27 + */ 86.28 + 86.29 +// Implementation of class atomic 86.30 + 86.31 +#ifdef M68K 86.32 + 86.33 +/* 86.34 + * __m68k_cmpxchg 86.35 + * 86.36 + * Atomically store newval in *ptr if *ptr is equal to oldval for user space. 86.37 + * Returns newval on success and oldval if no exchange happened. 86.38 + * This implementation is processor specific and works on 86.39 + * 68020 68030 68040 and 68060. 86.40 + * 86.41 + * It will not work on ColdFire, 68000 and 68010 since they lack the CAS 86.42 + * instruction. 86.43 + * Using a kernelhelper would be better for arch complete implementation. 86.44 + * 86.45 + */ 86.46 + 86.47 +static inline int __m68k_cmpxchg(int oldval, int newval, volatile int *ptr) { 86.48 + int ret; 86.49 + __asm __volatile ("cas%.l %0,%2,%1" 86.50 + : "=d" (ret), "+m" (*(ptr)) 86.51 + : "d" (newval), "0" (oldval)); 86.52 + return ret; 86.53 +} 86.54 + 86.55 +/* Perform an atomic compare and swap: if the current value of `*PTR' 86.56 + is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of 86.57 + `*PTR' before the operation.*/ 86.58 +static inline int m68k_compare_and_swap(volatile int *ptr, 86.59 + int oldval, 86.60 + int newval) { 86.61 + for (;;) { 86.62 + int prev = *ptr; 86.63 + if (prev != oldval) 86.64 + return prev; 86.65 + 86.66 + if (__m68k_cmpxchg (prev, newval, ptr) == newval) 86.67 + // Success. 86.68 + return prev; 86.69 + 86.70 + // We failed even though prev == oldval. Try again. 86.71 + } 86.72 +} 86.73 + 86.74 +/* Atomically add an int to memory. */ 86.75 +static inline int m68k_add_and_fetch(volatile int *ptr, int add_value) { 86.76 + for (;;) { 86.77 + // Loop until success. 86.78 + 86.79 + int prev = *ptr; 86.80 + 86.81 + if (__m68k_cmpxchg (prev, prev + add_value, ptr) == prev + add_value) 86.82 + return prev + add_value; 86.83 + } 86.84 +} 86.85 + 86.86 +/* Atomically write VALUE into `*PTR' and returns the previous 86.87 + contents of `*PTR'. */ 86.88 +static inline int m68k_lock_test_and_set(volatile int *ptr, int newval) { 86.89 + for (;;) { 86.90 + // Loop until success. 86.91 + int prev = *ptr; 86.92 + 86.93 + if (__m68k_cmpxchg (prev, newval, ptr) == prev) 86.94 + return prev; 86.95 + } 86.96 +} 86.97 +#endif // M68K 86.98 + 86.99 +#ifdef ARM 86.100 + 86.101 +/* 86.102 + * __kernel_cmpxchg 86.103 + * 86.104 + * Atomically store newval in *ptr if *ptr is equal to oldval for user space. 86.105 + * Return zero if *ptr was changed or non-zero if no exchange happened. 86.106 + * The C flag is also set if *ptr was changed to allow for assembly 86.107 + * optimization in the calling code. 86.108 + * 86.109 + */ 86.110 + 86.111 +typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr); 86.112 +#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0) 86.113 + 86.114 + 86.115 + 86.116 +/* Perform an atomic compare and swap: if the current value of `*PTR' 86.117 + is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of 86.118 + `*PTR' before the operation.*/ 86.119 +static inline int arm_compare_and_swap(volatile int *ptr, 86.120 + int oldval, 86.121 + int newval) { 86.122 + for (;;) { 86.123 + int prev = *ptr; 86.124 + if (prev != oldval) 86.125 + return prev; 86.126 + 86.127 + if (__kernel_cmpxchg (prev, newval, ptr) == 0) 86.128 + // Success. 86.129 + return prev; 86.130 + 86.131 + // We failed even though prev == oldval. Try again. 86.132 + } 86.133 +} 86.134 + 86.135 +/* Atomically add an int to memory. */ 86.136 +static inline int arm_add_and_fetch(volatile int *ptr, int add_value) { 86.137 + for (;;) { 86.138 + // Loop until a __kernel_cmpxchg succeeds. 86.139 + 86.140 + int prev = *ptr; 86.141 + 86.142 + if (__kernel_cmpxchg (prev, prev + add_value, ptr) == 0) 86.143 + return prev + add_value; 86.144 + } 86.145 +} 86.146 + 86.147 +/* Atomically write VALUE into `*PTR' and returns the previous 86.148 + contents of `*PTR'. */ 86.149 +static inline int arm_lock_test_and_set(volatile int *ptr, int newval) { 86.150 + for (;;) { 86.151 + // Loop until a __kernel_cmpxchg succeeds. 86.152 + int prev = *ptr; 86.153 + 86.154 + if (__kernel_cmpxchg (prev, newval, ptr) == 0) 86.155 + return prev; 86.156 + } 86.157 +} 86.158 +#endif // ARM 86.159 + 86.160 +inline void Atomic::store(jint store_value, volatile jint* dest) { 86.161 + *dest = store_value; 86.162 +} 86.163 + 86.164 +inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { 86.165 + *dest = store_value; 86.166 +} 86.167 + 86.168 +inline jint Atomic::add(jint add_value, volatile jint* dest) { 86.169 +#ifdef ARM 86.170 + return arm_add_and_fetch(dest, add_value); 86.171 +#else 86.172 +#ifdef M68K 86.173 + return m68k_add_and_fetch(dest, add_value); 86.174 +#else 86.175 + return __sync_add_and_fetch(dest, add_value); 86.176 +#endif // M68K 86.177 +#endif // ARM 86.178 +} 86.179 + 86.180 +inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) { 86.181 +#ifdef ARM 86.182 + return arm_add_and_fetch(dest, add_value); 86.183 +#else 86.184 +#ifdef M68K 86.185 + return m68k_add_and_fetch(dest, add_value); 86.186 +#else 86.187 + return __sync_add_and_fetch(dest, add_value); 86.188 +#endif // M68K 86.189 +#endif // ARM 86.190 +} 86.191 + 86.192 +inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) { 86.193 + return (void *) add_ptr(add_value, (volatile intptr_t *) dest); 86.194 +} 86.195 + 86.196 +inline void Atomic::inc(volatile jint* dest) { 86.197 + add(1, dest); 86.198 +} 86.199 + 86.200 +inline void Atomic::inc_ptr(volatile intptr_t* dest) { 86.201 + add_ptr(1, dest); 86.202 +} 86.203 + 86.204 +inline void Atomic::inc_ptr(volatile void* dest) { 86.205 + add_ptr(1, dest); 86.206 +} 86.207 + 86.208 +inline void Atomic::dec(volatile jint* dest) { 86.209 + add(-1, dest); 86.210 +} 86.211 + 86.212 +inline void Atomic::dec_ptr(volatile intptr_t* dest) { 86.213 + add_ptr(-1, dest); 86.214 +} 86.215 + 86.216 +inline void Atomic::dec_ptr(volatile void* dest) { 86.217 + add_ptr(-1, dest); 86.218 +} 86.219 + 86.220 +inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) { 86.221 +#ifdef ARM 86.222 + return arm_lock_test_and_set(dest, exchange_value); 86.223 +#else 86.224 +#ifdef M68K 86.225 + return m68k_lock_test_and_set(dest, exchange_value); 86.226 +#else 86.227 + // __sync_lock_test_and_set is a bizarrely named atomic exchange 86.228 + // operation. Note that some platforms only support this with the 86.229 + // limitation that the only valid value to store is the immediate 86.230 + // constant 1. There is a test for this in JNI_CreateJavaVM(). 86.231 + return __sync_lock_test_and_set (dest, exchange_value); 86.232 +#endif // M68K 86.233 +#endif // ARM 86.234 +} 86.235 + 86.236 +inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, 86.237 + volatile intptr_t* dest) { 86.238 +#ifdef ARM 86.239 + return arm_lock_test_and_set(dest, exchange_value); 86.240 +#else 86.241 +#ifdef M68K 86.242 + return m68k_lock_test_and_set(dest, exchange_value); 86.243 +#else 86.244 + return __sync_lock_test_and_set (dest, exchange_value); 86.245 +#endif // M68K 86.246 +#endif // ARM 86.247 +} 86.248 + 86.249 +inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) { 86.250 + return (void *) xchg_ptr((intptr_t) exchange_value, 86.251 + (volatile intptr_t*) dest); 86.252 +} 86.253 + 86.254 +inline jint Atomic::cmpxchg(jint exchange_value, 86.255 + volatile jint* dest, 86.256 + jint compare_value) { 86.257 +#ifdef ARM 86.258 + return arm_compare_and_swap(dest, compare_value, exchange_value); 86.259 +#else 86.260 +#ifdef M68K 86.261 + return m68k_compare_and_swap(dest, compare_value, exchange_value); 86.262 +#else 86.263 + return __sync_val_compare_and_swap(dest, compare_value, exchange_value); 86.264 +#endif // M68K 86.265 +#endif // ARM 86.266 +} 86.267 + 86.268 +inline jlong Atomic::cmpxchg(jlong exchange_value, 86.269 + volatile jlong* dest, 86.270 + jlong compare_value) { 86.271 + 86.272 + return __sync_val_compare_and_swap(dest, compare_value, exchange_value); 86.273 +} 86.274 + 86.275 +inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, 86.276 + volatile intptr_t* dest, 86.277 + intptr_t compare_value) { 86.278 +#ifdef ARM 86.279 + return arm_compare_and_swap(dest, compare_value, exchange_value); 86.280 +#else 86.281 +#ifdef M68K 86.282 + return m68k_compare_and_swap(dest, compare_value, exchange_value); 86.283 +#else 86.284 + return __sync_val_compare_and_swap(dest, compare_value, exchange_value); 86.285 +#endif // M68K 86.286 +#endif // ARM 86.287 +} 86.288 + 86.289 +inline void* Atomic::cmpxchg_ptr(void* exchange_value, 86.290 + volatile void* dest, 86.291 + void* compare_value) { 86.292 + 86.293 + return (void *) cmpxchg_ptr((intptr_t) exchange_value, 86.294 + (volatile intptr_t*) dest, 86.295 + (intptr_t) compare_value); 86.296 +}
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/src/os_cpu/linux_zero/vm/bytes_linux_zero.inline.hpp Tue Oct 13 12:04:21 2009 -0700 87.3 @@ -0,0 +1,40 @@ 87.4 +/* 87.5 + * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. 87.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 87.7 + * 87.8 + * This code is free software; you can redistribute it and/or modify it 87.9 + * under the terms of the GNU General Public License version 2 only, as 87.10 + * published by the Free Software Foundation. 87.11 + * 87.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 87.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 87.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 87.15 + * version 2 for more details (a copy is included in the LICENSE file that 87.16 + * accompanied this code). 87.17 + * 87.18 + * You should have received a copy of the GNU General Public License version 87.19 + * 2 along with this work; if not, write to the Free Software Foundation, 87.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 87.21 + * 87.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 87.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 87.24 + * have any questions. 87.25 + * 87.26 + */ 87.27 + 87.28 +// Efficient swapping of data bytes from Java byte 87.29 +// ordering to native byte ordering and vice versa. 87.30 + 87.31 +#include <byteswap.h> 87.32 + 87.33 +inline u2 Bytes::swap_u2(u2 x) { 87.34 + return bswap_16(x); 87.35 +} 87.36 + 87.37 +inline u4 Bytes::swap_u4(u4 x) { 87.38 + return bswap_32(x); 87.39 +} 87.40 + 87.41 +inline u8 Bytes::swap_u8(u8 x) { 87.42 + return bswap_64(x); 87.43 +}
88.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 88.2 +++ b/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp Tue Oct 13 12:04:21 2009 -0700 88.3 @@ -0,0 +1,45 @@ 88.4 +/* 88.5 + * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved. 88.6 + * Copyright 2007, 2008 Red Hat, Inc. 88.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 88.8 + * 88.9 + * This code is free software; you can redistribute it and/or modify it 88.10 + * under the terms of the GNU General Public License version 2 only, as 88.11 + * published by the Free Software Foundation. 88.12 + * 88.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 88.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 88.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 88.16 + * version 2 for more details (a copy is included in the LICENSE file that 88.17 + * accompanied this code). 88.18 + * 88.19 + * You should have received a copy of the GNU General Public License version 88.20 + * 2 along with this work; if not, write to the Free Software Foundation, 88.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 88.22 + * 88.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 88.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 88.25 + * have any questions. 88.26 + * 88.27 + */ 88.28 + 88.29 +// 88.30 +// Set the default values for platform dependent flags used by the 88.31 +// runtime system. See globals.hpp for details of what they do. 88.32 +// 88.33 + 88.34 +define_pd_global(bool, DontYieldALot, false); 88.35 +#ifdef _LP64 88.36 +define_pd_global(intx, ThreadStackSize, 1536); 88.37 +define_pd_global(intx, VMThreadStackSize, 1024); 88.38 +#else 88.39 +define_pd_global(intx, ThreadStackSize, 1024); 88.40 +define_pd_global(intx, VMThreadStackSize, 512); 88.41 +#endif // _LP64 88.42 +define_pd_global(intx, SurvivorRatio, 8); 88.43 +define_pd_global(intx, CompilerThreadStackSize, 0); 88.44 +define_pd_global(uintx, JVMInvokeMethodSlack, 8192); 88.45 + 88.46 +define_pd_global(bool, UseVectoredExceptions, false); 88.47 +// Only used on 64 bit platforms 88.48 +define_pd_global(uintx, HeapBaseMinAddress, 2*G);
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 89.2 +++ b/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp Tue Oct 13 12:04:21 2009 -0700 89.3 @@ -0,0 +1,167 @@ 89.4 +/* 89.5 + * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. 89.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 89.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 89.8 + * 89.9 + * This code is free software; you can redistribute it and/or modify it 89.10 + * under the terms of the GNU General Public License version 2 only, as 89.11 + * published by the Free Software Foundation. 89.12 + * 89.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 89.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 89.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 89.16 + * version 2 for more details (a copy is included in the LICENSE file that 89.17 + * accompanied this code). 89.18 + * 89.19 + * You should have received a copy of the GNU General Public License version 89.20 + * 2 along with this work; if not, write to the Free Software Foundation, 89.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 89.22 + * 89.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 89.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 89.25 + * have any questions. 89.26 + * 89.27 + */ 89.28 + 89.29 +#ifdef ARM 89.30 + 89.31 +/* 89.32 + * ARM Kernel helper for memory barrier. 89.33 + * Using __asm __volatile ("":::"memory") does not work reliable on ARM 89.34 + * and gcc __sync_synchronize(); implementation does not use the kernel 89.35 + * helper for all gcc versions so it is unreliable to use as well. 89.36 + */ 89.37 +typedef void (__kernel_dmb_t) (void); 89.38 +#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0) 89.39 + 89.40 +#define FULL_MEM_BARRIER __kernel_dmb() 89.41 +#define READ_MEM_BARRIER __kernel_dmb() 89.42 +#define WRITE_MEM_BARRIER __kernel_dmb() 89.43 + 89.44 +#else // ARM 89.45 + 89.46 +#define FULL_MEM_BARRIER __sync_synchronize() 89.47 + 89.48 +#ifdef PPC 89.49 + 89.50 +#define READ_MEM_BARRIER __asm __volatile ("isync":::"memory") 89.51 +#ifdef __NO_LWSYNC__ 89.52 +#define WRITE_MEM_BARRIER __asm __volatile ("sync":::"memory") 89.53 +#else 89.54 +#define WRITE_MEM_BARRIER __asm __volatile ("lwsync":::"memory") 89.55 +#endif 89.56 + 89.57 +#else // PPC 89.58 + 89.59 +#define READ_MEM_BARRIER __asm __volatile ("":::"memory") 89.60 +#define WRITE_MEM_BARRIER __asm __volatile ("":::"memory") 89.61 + 89.62 +#endif // PPC 89.63 + 89.64 +#endif // ARM 89.65 + 89.66 + 89.67 +inline void OrderAccess::loadload() { acquire(); } 89.68 +inline void OrderAccess::storestore() { release(); } 89.69 +inline void OrderAccess::loadstore() { acquire(); } 89.70 +inline void OrderAccess::storeload() { fence(); } 89.71 + 89.72 +inline void OrderAccess::acquire() { 89.73 + READ_MEM_BARRIER; 89.74 +} 89.75 + 89.76 +inline void OrderAccess::release() { 89.77 + WRITE_MEM_BARRIER; 89.78 +} 89.79 + 89.80 +inline void OrderAccess::fence() { 89.81 + FULL_MEM_BARRIER; 89.82 +} 89.83 + 89.84 +inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { jbyte data = *p; acquire(); return data; } 89.85 +inline jshort OrderAccess::load_acquire(volatile jshort* p) { jshort data = *p; acquire(); return data; } 89.86 +inline jint OrderAccess::load_acquire(volatile jint* p) { jint data = *p; acquire(); return data; } 89.87 +inline jlong OrderAccess::load_acquire(volatile jlong* p) { 89.88 + jlong tmp; 89.89 + os::atomic_copy64(p, &tmp); 89.90 + acquire(); 89.91 + return tmp; 89.92 +} 89.93 +inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { jubyte data = *p; acquire(); return data; } 89.94 +inline jushort OrderAccess::load_acquire(volatile jushort* p) { jushort data = *p; acquire(); return data; } 89.95 +inline juint OrderAccess::load_acquire(volatile juint* p) { juint data = *p; acquire(); return data; } 89.96 +inline julong OrderAccess::load_acquire(volatile julong* p) { 89.97 + julong tmp; 89.98 + os::atomic_copy64(p, &tmp); 89.99 + acquire(); 89.100 + return tmp; 89.101 +} 89.102 +inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { jfloat data = *p; acquire(); return data; } 89.103 +inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { 89.104 + jdouble tmp; 89.105 + os::atomic_copy64(p, &tmp); 89.106 + acquire(); 89.107 + return tmp; 89.108 +} 89.109 + 89.110 +inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { 89.111 + intptr_t data = *p; 89.112 + acquire(); 89.113 + return data; 89.114 +} 89.115 +inline void* OrderAccess::load_ptr_acquire(volatile void* p) { 89.116 + void *data = *(void* volatile *)p; 89.117 + acquire(); 89.118 + return data; 89.119 +} 89.120 +inline void* OrderAccess::load_ptr_acquire(const volatile void* p) { 89.121 + void *data = *(void* const volatile *)p; 89.122 + acquire(); 89.123 + return data; 89.124 +} 89.125 + 89.126 +inline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { release(); *p = v; } 89.127 +inline void OrderAccess::release_store(volatile jshort* p, jshort v) { release(); *p = v; } 89.128 +inline void OrderAccess::release_store(volatile jint* p, jint v) { release(); *p = v; } 89.129 +inline void OrderAccess::release_store(volatile jlong* p, jlong v) 89.130 +{ release(); os::atomic_copy64(&v, p); } 89.131 +inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { release(); *p = v; } 89.132 +inline void OrderAccess::release_store(volatile jushort* p, jushort v) { release(); *p = v; } 89.133 +inline void OrderAccess::release_store(volatile juint* p, juint v) { release(); *p = v; } 89.134 +inline void OrderAccess::release_store(volatile julong* p, julong v) 89.135 +{ release(); os::atomic_copy64(&v, p); } 89.136 +inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { release(); *p = v; } 89.137 +inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) 89.138 +{ release(); os::atomic_copy64(&v, p); } 89.139 + 89.140 +inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { release(); *p = v; } 89.141 +inline void OrderAccess::release_store_ptr(volatile void* p, void* v) 89.142 +{ release(); *(void* volatile *)p = v; } 89.143 + 89.144 +inline void OrderAccess::store_fence(jbyte* p, jbyte v) { *p = v; fence(); } 89.145 +inline void OrderAccess::store_fence(jshort* p, jshort v) { *p = v; fence(); } 89.146 +inline void OrderAccess::store_fence(jint* p, jint v) { *p = v; fence(); } 89.147 +inline void OrderAccess::store_fence(jlong* p, jlong v) { os::atomic_copy64(&v, p); fence(); } 89.148 +inline void OrderAccess::store_fence(jubyte* p, jubyte v) { *p = v; fence(); } 89.149 +inline void OrderAccess::store_fence(jushort* p, jushort v) { *p = v; fence(); } 89.150 +inline void OrderAccess::store_fence(juint* p, juint v) { *p = v; fence(); } 89.151 +inline void OrderAccess::store_fence(julong* p, julong v) { os::atomic_copy64(&v, p); fence(); } 89.152 +inline void OrderAccess::store_fence(jfloat* p, jfloat v) { *p = v; fence(); } 89.153 +inline void OrderAccess::store_fence(jdouble* p, jdouble v) { os::atomic_copy64(&v, p); fence(); } 89.154 + 89.155 +inline void OrderAccess::store_ptr_fence(intptr_t* p, intptr_t v) { *p = v; fence(); } 89.156 +inline void OrderAccess::store_ptr_fence(void** p, void* v) { *p = v; fence(); } 89.157 + 89.158 +inline void OrderAccess::release_store_fence(volatile jbyte* p, jbyte v) { release_store(p, v); fence(); } 89.159 +inline void OrderAccess::release_store_fence(volatile jshort* p, jshort v) { release_store(p, v); fence(); } 89.160 +inline void OrderAccess::release_store_fence(volatile jint* p, jint v) { release_store(p, v); fence(); } 89.161 +inline void OrderAccess::release_store_fence(volatile jlong* p, jlong v) { release_store(p, v); fence(); } 89.162 +inline void OrderAccess::release_store_fence(volatile jubyte* p, jubyte v) { release_store(p, v); fence(); } 89.163 +inline void OrderAccess::release_store_fence(volatile jushort* p, jushort v) { release_store(p, v); fence(); } 89.164 +inline void OrderAccess::release_store_fence(volatile juint* p, juint v) { release_store(p, v); fence(); } 89.165 +inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store(p, v); fence(); } 89.166 +inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { release_store(p, v); fence(); } 89.167 +inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { release_store(p, v); fence(); } 89.168 + 89.169 +inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { release_store_ptr(p, v); fence(); } 89.170 +inline void OrderAccess::release_store_ptr_fence(volatile void* p, void* v) { release_store_ptr(p, v); fence(); }
90.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 90.2 +++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp Tue Oct 13 12:04:21 2009 -0700 90.3 @@ -0,0 +1,456 @@ 90.4 +/* 90.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 90.6 + * Copyright 2007, 2008 Red Hat, Inc. 90.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 90.8 + * 90.9 + * This code is free software; you can redistribute it and/or modify it 90.10 + * under the terms of the GNU General Public License version 2 only, as 90.11 + * published by the Free Software Foundation. 90.12 + * 90.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 90.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 90.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 90.16 + * version 2 for more details (a copy is included in the LICENSE file that 90.17 + * accompanied this code). 90.18 + * 90.19 + * You should have received a copy of the GNU General Public License version 90.20 + * 2 along with this work; if not, write to the Free Software Foundation, 90.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 90.22 + * 90.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 90.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 90.25 + * have any questions. 90.26 + * 90.27 + */ 90.28 + 90.29 +// do not include precompiled header file 90.30 +#include "incls/_os_linux_zero.cpp.incl" 90.31 + 90.32 +address os::current_stack_pointer() { 90.33 + address dummy = (address) &dummy; 90.34 + return dummy; 90.35 +} 90.36 + 90.37 +frame os::get_sender_for_C_frame(frame* fr) { 90.38 + ShouldNotCallThis(); 90.39 +} 90.40 + 90.41 +frame os::current_frame() { 90.42 + // The only thing that calls this is the stack printing code in 90.43 + // VMError::report: 90.44 + // - Step 110 (printing stack bounds) uses the sp in the frame 90.45 + // to determine the amount of free space on the stack. We 90.46 + // set the sp to a close approximation of the real value in 90.47 + // order to allow this step to complete. 90.48 + // - Step 120 (printing native stack) tries to walk the stack. 90.49 + // The frame we create has a NULL pc, which is ignored as an 90.50 + // invalid frame. 90.51 + frame dummy = frame(); 90.52 + dummy.set_sp((intptr_t *) current_stack_pointer()); 90.53 + return dummy; 90.54 +} 90.55 + 90.56 +char* os::non_memory_address_word() { 90.57 + // Must never look like an address returned by reserve_memory, 90.58 + // even in its subfields (as defined by the CPU immediate fields, 90.59 + // if the CPU splits constants across multiple instructions). 90.60 +#ifdef SPARC 90.61 + // On SPARC, 0 != %hi(any real address), because there is no 90.62 + // allocation in the first 1Kb of the virtual address space. 90.63 + return (char *) 0; 90.64 +#else 90.65 + // This is the value for x86; works pretty well for PPC too. 90.66 + return (char *) -1; 90.67 +#endif // SPARC 90.68 +} 90.69 + 90.70 +void os::initialize_thread() { 90.71 + // Nothing to do. 90.72 +} 90.73 + 90.74 +address os::Linux::ucontext_get_pc(ucontext_t* uc) { 90.75 + ShouldNotCallThis(); 90.76 +} 90.77 + 90.78 +ExtendedPC os::fetch_frame_from_context(void* ucVoid, 90.79 + intptr_t** ret_sp, 90.80 + intptr_t** ret_fp) { 90.81 + ShouldNotCallThis(); 90.82 +} 90.83 + 90.84 +frame os::fetch_frame_from_context(void* ucVoid) { 90.85 + ShouldNotCallThis(); 90.86 +} 90.87 + 90.88 +extern "C" int 90.89 +JVM_handle_linux_signal(int sig, 90.90 + siginfo_t* info, 90.91 + void* ucVoid, 90.92 + int abort_if_unrecognized) { 90.93 + ucontext_t* uc = (ucontext_t*) ucVoid; 90.94 + 90.95 + Thread* t = ThreadLocalStorage::get_thread_slow(); 90.96 + 90.97 + SignalHandlerMark shm(t); 90.98 + 90.99 + // Note: it's not uncommon that JNI code uses signal/sigset to 90.100 + // install then restore certain signal handler (e.g. to temporarily 90.101 + // block SIGPIPE, or have a SIGILL handler when detecting CPU 90.102 + // type). When that happens, JVM_handle_linux_signal() might be 90.103 + // invoked with junk info/ucVoid. To avoid unnecessary crash when 90.104 + // libjsig is not preloaded, try handle signals that do not require 90.105 + // siginfo/ucontext first. 90.106 + 90.107 + if (sig == SIGPIPE || sig == SIGXFSZ) { 90.108 + // allow chained handler to go first 90.109 + if (os::Linux::chained_handler(sig, info, ucVoid)) { 90.110 + return true; 90.111 + } else { 90.112 + if (PrintMiscellaneous && (WizardMode || Verbose)) { 90.113 + char buf[64]; 90.114 + warning("Ignoring %s - see bugs 4229104 or 646499219", 90.115 + os::exception_name(sig, buf, sizeof(buf))); 90.116 + } 90.117 + return true; 90.118 + } 90.119 + } 90.120 + 90.121 + JavaThread* thread = NULL; 90.122 + VMThread* vmthread = NULL; 90.123 + if (os::Linux::signal_handlers_are_installed) { 90.124 + if (t != NULL ){ 90.125 + if(t->is_Java_thread()) { 90.126 + thread = (JavaThread*)t; 90.127 + } 90.128 + else if(t->is_VM_thread()){ 90.129 + vmthread = (VMThread *)t; 90.130 + } 90.131 + } 90.132 + } 90.133 + 90.134 + if (info != NULL && thread != NULL) { 90.135 + // Handle ALL stack overflow variations here 90.136 + if (sig == SIGSEGV) { 90.137 + address addr = (address) info->si_addr; 90.138 + 90.139 + // check if fault address is within thread stack 90.140 + if (addr < thread->stack_base() && 90.141 + addr >= thread->stack_base() - thread->stack_size()) { 90.142 + // stack overflow 90.143 + if (thread->in_stack_yellow_zone(addr)) { 90.144 + thread->disable_stack_yellow_zone(); 90.145 + ShouldNotCallThis(); 90.146 + } 90.147 + else if (thread->in_stack_red_zone(addr)) { 90.148 + thread->disable_stack_red_zone(); 90.149 + ShouldNotCallThis(); 90.150 + } 90.151 + else { 90.152 + // Accessing stack address below sp may cause SEGV if 90.153 + // current thread has MAP_GROWSDOWN stack. This should 90.154 + // only happen when current thread was created by user 90.155 + // code with MAP_GROWSDOWN flag and then attached to VM. 90.156 + // See notes in os_linux.cpp. 90.157 + if (thread->osthread()->expanding_stack() == 0) { 90.158 + thread->osthread()->set_expanding_stack(); 90.159 + if (os::Linux::manually_expand_stack(thread, addr)) { 90.160 + thread->osthread()->clear_expanding_stack(); 90.161 + return true; 90.162 + } 90.163 + thread->osthread()->clear_expanding_stack(); 90.164 + } 90.165 + else { 90.166 + fatal("recursive segv. expanding stack."); 90.167 + } 90.168 + } 90.169 + } 90.170 + } 90.171 + 90.172 + /*if (thread->thread_state() == _thread_in_Java) { 90.173 + ShouldNotCallThis(); 90.174 + } 90.175 + else*/ if (thread->thread_state() == _thread_in_vm && 90.176 + sig == SIGBUS && thread->doing_unsafe_access()) { 90.177 + ShouldNotCallThis(); 90.178 + } 90.179 + 90.180 + // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC 90.181 + // kicks in and the heap gets shrunk before the field access. 90.182 + /*if (sig == SIGSEGV || sig == SIGBUS) { 90.183 + address addr = JNI_FastGetField::find_slowcase_pc(pc); 90.184 + if (addr != (address)-1) { 90.185 + stub = addr; 90.186 + } 90.187 + }*/ 90.188 + 90.189 + // Check to see if we caught the safepoint code in the process 90.190 + // of write protecting the memory serialization page. It write 90.191 + // enables the page immediately after protecting it so we can 90.192 + // just return to retry the write. 90.193 + if (sig == SIGSEGV && 90.194 + os::is_memory_serialize_page(thread, (address) info->si_addr)) { 90.195 + // Block current thread until permission is restored. 90.196 + os::block_on_serialize_page_trap(); 90.197 + return true; 90.198 + } 90.199 + } 90.200 + 90.201 + // signal-chaining 90.202 + if (os::Linux::chained_handler(sig, info, ucVoid)) { 90.203 + return true; 90.204 + } 90.205 + 90.206 + if (!abort_if_unrecognized) { 90.207 + // caller wants another chance, so give it to him 90.208 + return false; 90.209 + } 90.210 + 90.211 +#ifndef PRODUCT 90.212 + if (sig == SIGSEGV) { 90.213 + fatal("\n#" 90.214 + "\n# /--------------------\\" 90.215 + "\n# | segmentation fault |" 90.216 + "\n# \\---\\ /--------------/" 90.217 + "\n# /" 90.218 + "\n# [-] |\\_/| " 90.219 + "\n# (+)=C |o o|__ " 90.220 + "\n# | | =-*-=__\\ " 90.221 + "\n# OOO c_c_(___)"); 90.222 + } 90.223 +#endif // !PRODUCT 90.224 + 90.225 + const char *fmt = "caught unhandled signal %d"; 90.226 + char buf[64]; 90.227 + 90.228 + sprintf(buf, fmt, sig); 90.229 + fatal(buf); 90.230 +} 90.231 + 90.232 +void os::Linux::init_thread_fpu_state(void) { 90.233 + // Nothing to do 90.234 +} 90.235 + 90.236 +int os::Linux::get_fpu_control_word() { 90.237 + ShouldNotCallThis(); 90.238 +} 90.239 + 90.240 +void os::Linux::set_fpu_control_word(int fpu) { 90.241 + ShouldNotCallThis(); 90.242 +} 90.243 + 90.244 +bool os::is_allocatable(size_t bytes) { 90.245 + ShouldNotCallThis(); 90.246 +} 90.247 + 90.248 +/////////////////////////////////////////////////////////////////////////////// 90.249 +// thread stack 90.250 + 90.251 +size_t os::Linux::min_stack_allowed = 64 * K; 90.252 + 90.253 +bool os::Linux::supports_variable_stack_size() { 90.254 + return true; 90.255 +} 90.256 + 90.257 +size_t os::Linux::default_stack_size(os::ThreadType thr_type) { 90.258 +#ifdef _LP64 90.259 + size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M); 90.260 +#else 90.261 + size_t s = (thr_type == os::compiler_thread ? 2 * M : 512 * K); 90.262 +#endif // _LP64 90.263 + return s; 90.264 +} 90.265 + 90.266 +size_t os::Linux::default_guard_size(os::ThreadType thr_type) { 90.267 + // Only enable glibc guard pages for non-Java threads 90.268 + // (Java threads have HotSpot guard pages) 90.269 + return (thr_type == java_thread ? 0 : page_size()); 90.270 +} 90.271 + 90.272 +static void current_stack_region(address *bottom, size_t *size) { 90.273 + pthread_attr_t attr; 90.274 + int res = pthread_getattr_np(pthread_self(), &attr); 90.275 + if (res != 0) { 90.276 + if (res == ENOMEM) { 90.277 + vm_exit_out_of_memory(0, "pthread_getattr_np"); 90.278 + } 90.279 + else { 90.280 + fatal1("pthread_getattr_np failed with errno = %d", res); 90.281 + } 90.282 + } 90.283 + 90.284 + address stack_bottom; 90.285 + size_t stack_bytes; 90.286 + res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes); 90.287 + if (res != 0) { 90.288 + fatal1("pthread_attr_getstack failed with errno = %d", res); 90.289 + } 90.290 + address stack_top = stack_bottom + stack_bytes; 90.291 + 90.292 + // The block of memory returned by pthread_attr_getstack() includes 90.293 + // guard pages where present. We need to trim these off. 90.294 + size_t page_bytes = os::Linux::page_size(); 90.295 + assert(((intptr_t) stack_bottom & (page_bytes - 1)) == 0, "unaligned stack"); 90.296 + 90.297 + size_t guard_bytes; 90.298 + res = pthread_attr_getguardsize(&attr, &guard_bytes); 90.299 + if (res != 0) { 90.300 + fatal1("pthread_attr_getguardsize failed with errno = %d", res); 90.301 + } 90.302 + int guard_pages = align_size_up(guard_bytes, page_bytes) / page_bytes; 90.303 + assert(guard_bytes == guard_pages * page_bytes, "unaligned guard"); 90.304 + 90.305 +#ifdef IA64 90.306 + // IA64 has two stacks sharing the same area of memory, a normal 90.307 + // stack growing downwards and a register stack growing upwards. 90.308 + // Guard pages, if present, are in the centre. This code splits 90.309 + // the stack in two even without guard pages, though in theory 90.310 + // there's nothing to stop us allocating more to the normal stack 90.311 + // or more to the register stack if one or the other were found 90.312 + // to grow faster. 90.313 + int total_pages = align_size_down(stack_bytes, page_bytes) / page_bytes; 90.314 + stack_bottom += (total_pages - guard_pages) / 2 * page_bytes; 90.315 +#endif // IA64 90.316 + 90.317 + stack_bottom += guard_bytes; 90.318 + 90.319 + pthread_attr_destroy(&attr); 90.320 + 90.321 + // The initial thread has a growable stack, and the size reported 90.322 + // by pthread_attr_getstack is the maximum size it could possibly 90.323 + // be given what currently mapped. This can be huge, so we cap it. 90.324 + if (os::Linux::is_initial_thread()) { 90.325 + stack_bytes = stack_top - stack_bottom; 90.326 + 90.327 + if (stack_bytes > JavaThread::stack_size_at_create()) 90.328 + stack_bytes = JavaThread::stack_size_at_create(); 90.329 + 90.330 + stack_bottom = stack_top - stack_bytes; 90.331 + } 90.332 + 90.333 + assert(os::current_stack_pointer() >= stack_bottom, "should do"); 90.334 + assert(os::current_stack_pointer() < stack_top, "should do"); 90.335 + 90.336 + *bottom = stack_bottom; 90.337 + *size = stack_top - stack_bottom; 90.338 +} 90.339 + 90.340 +address os::current_stack_base() { 90.341 + address bottom; 90.342 + size_t size; 90.343 + current_stack_region(&bottom, &size); 90.344 + return bottom + size; 90.345 +} 90.346 + 90.347 +size_t os::current_stack_size() { 90.348 + // stack size includes normal stack and HotSpot guard pages 90.349 + address bottom; 90.350 + size_t size; 90.351 + current_stack_region(&bottom, &size); 90.352 + return size; 90.353 +} 90.354 + 90.355 +///////////////////////////////////////////////////////////////////////////// 90.356 +// helper functions for fatal error handler 90.357 + 90.358 +void os::print_context(outputStream* st, void* context) { 90.359 + ShouldNotCallThis(); 90.360 +} 90.361 + 90.362 +///////////////////////////////////////////////////////////////////////////// 90.363 +// Stubs for things that would be in linux_zero.s if it existed. 90.364 +// You probably want to disassemble these monkeys to check they're ok. 90.365 + 90.366 +extern "C" { 90.367 + int SpinPause() { 90.368 + } 90.369 + 90.370 + int SafeFetch32(int *adr, int errValue) { 90.371 + int value = errValue; 90.372 + value = *adr; 90.373 + return value; 90.374 + } 90.375 + intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) { 90.376 + intptr_t value = errValue; 90.377 + value = *adr; 90.378 + return value; 90.379 + } 90.380 + 90.381 + void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { 90.382 + if (from > to) { 90.383 + jshort *end = from + count; 90.384 + while (from < end) 90.385 + *(to++) = *(from++); 90.386 + } 90.387 + else if (from < to) { 90.388 + jshort *end = from; 90.389 + from += count - 1; 90.390 + to += count - 1; 90.391 + while (from >= end) 90.392 + *(to--) = *(from--); 90.393 + } 90.394 + } 90.395 + void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) { 90.396 + if (from > to) { 90.397 + jint *end = from + count; 90.398 + while (from < end) 90.399 + *(to++) = *(from++); 90.400 + } 90.401 + else if (from < to) { 90.402 + jint *end = from; 90.403 + from += count - 1; 90.404 + to += count - 1; 90.405 + while (from >= end) 90.406 + *(to--) = *(from--); 90.407 + } 90.408 + } 90.409 + void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { 90.410 + if (from > to) { 90.411 + jlong *end = from + count; 90.412 + while (from < end) 90.413 + os::atomic_copy64(from++, to++); 90.414 + } 90.415 + else if (from < to) { 90.416 + jlong *end = from; 90.417 + from += count - 1; 90.418 + to += count - 1; 90.419 + while (from >= end) 90.420 + os::atomic_copy64(from--, to--); 90.421 + } 90.422 + } 90.423 + 90.424 + void _Copy_arrayof_conjoint_bytes(HeapWord* from, 90.425 + HeapWord* to, 90.426 + size_t count) { 90.427 + ShouldNotCallThis(); 90.428 + } 90.429 + void _Copy_arrayof_conjoint_jshorts(HeapWord* from, 90.430 + HeapWord* to, 90.431 + size_t count) { 90.432 + ShouldNotCallThis(); 90.433 + } 90.434 + void _Copy_arrayof_conjoint_jints(HeapWord* from, 90.435 + HeapWord* to, 90.436 + size_t count) { 90.437 + ShouldNotCallThis(); 90.438 + } 90.439 + void _Copy_arrayof_conjoint_jlongs(HeapWord* from, 90.440 + HeapWord* to, 90.441 + size_t count) { 90.442 + ShouldNotCallThis(); 90.443 + } 90.444 +}; 90.445 + 90.446 +///////////////////////////////////////////////////////////////////////////// 90.447 +// Implementations of atomic operations not supported by processors. 90.448 +// -- http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Atomic-Builtins.html 90.449 + 90.450 +#ifndef _LP64 90.451 +extern "C" { 90.452 + long long unsigned int __sync_val_compare_and_swap_8( 90.453 + volatile void *ptr, 90.454 + long long unsigned int oldval, 90.455 + long long unsigned int newval) { 90.456 + ShouldNotCallThis(); 90.457 + } 90.458 +}; 90.459 +#endif // !_LP64
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 91.2 +++ b/src/os_cpu/linux_zero/vm/os_linux_zero.hpp Tue Oct 13 12:04:21 2009 -0700 91.3 @@ -0,0 +1,45 @@ 91.4 +/* 91.5 + * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved. 91.6 + * Copyright 2007, 2008 Red Hat, Inc. 91.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 91.8 + * 91.9 + * This code is free software; you can redistribute it and/or modify it 91.10 + * under the terms of the GNU General Public License version 2 only, as 91.11 + * published by the Free Software Foundation. 91.12 + * 91.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 91.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 91.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 91.16 + * version 2 for more details (a copy is included in the LICENSE file that 91.17 + * accompanied this code). 91.18 + * 91.19 + * You should have received a copy of the GNU General Public License version 91.20 + * 2 along with this work; if not, write to the Free Software Foundation, 91.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 91.22 + * 91.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 91.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 91.25 + * have any questions. 91.26 + * 91.27 + */ 91.28 + 91.29 + static void setup_fpu() {} 91.30 + 91.31 + static bool is_allocatable(size_t bytes); 91.32 + 91.33 + // Used to register dynamic code cache area with the OS 91.34 + // Note: Currently only used in 64 bit Windows implementations 91.35 + static bool register_code_area(char *low, char *high) { return true; } 91.36 + 91.37 + // Atomically copy 64 bits of data 91.38 + static void atomic_copy64(volatile void *src, volatile void *dst) { 91.39 +#if defined(PPC) && !defined(_LP64) 91.40 + double tmp; 91.41 + asm volatile ("lfd %0, 0(%1)\n" 91.42 + "stfd %0, 0(%2)\n" 91.43 + : "=f"(tmp) 91.44 + : "b"(src), "b"(dst)); 91.45 +#else 91.46 + *(jlong *) dst = *(jlong *) src; 91.47 +#endif // PPC && !_LP64 91.48 + }
92.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 92.2 +++ b/src/os_cpu/linux_zero/vm/prefetch_linux_zero.inline.hpp Tue Oct 13 12:04:21 2009 -0700 92.3 @@ -0,0 +1,30 @@ 92.4 +/* 92.5 + * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved. 92.6 + * Copyright 2007, 2008 Red Hat, Inc. 92.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 92.8 + * 92.9 + * This code is free software; you can redistribute it and/or modify it 92.10 + * under the terms of the GNU General Public License version 2 only, as 92.11 + * published by the Free Software Foundation. 92.12 + * 92.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 92.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 92.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 92.16 + * version 2 for more details (a copy is included in the LICENSE file that 92.17 + * accompanied this code). 92.18 + * 92.19 + * You should have received a copy of the GNU General Public License version 92.20 + * 2 along with this work; if not, write to the Free Software Foundation, 92.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 92.22 + * 92.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 92.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 92.25 + * have any questions. 92.26 + * 92.27 + */ 92.28 + 92.29 +inline void Prefetch::read(void* loc, intx interval) { 92.30 +} 92.31 + 92.32 +inline void Prefetch::write(void* loc, intx interval) { 92.33 +}
93.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 93.2 +++ b/src/os_cpu/linux_zero/vm/threadLS_linux_zero.cpp Tue Oct 13 12:04:21 2009 -0700 93.3 @@ -0,0 +1,39 @@ 93.4 +/* 93.5 + * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. 93.6 + * Copyright 2007 Red Hat, Inc. 93.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 93.8 + * 93.9 + * This code is free software; you can redistribute it and/or modify it 93.10 + * under the terms of the GNU General Public License version 2 only, as 93.11 + * published by the Free Software Foundation. 93.12 + * 93.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 93.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 93.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 93.16 + * version 2 for more details (a copy is included in the LICENSE file that 93.17 + * accompanied this code). 93.18 + * 93.19 + * You should have received a copy of the GNU General Public License version 93.20 + * 2 along with this work; if not, write to the Free Software Foundation, 93.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 93.22 + * 93.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 93.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 93.25 + * have any questions. 93.26 + * 93.27 + */ 93.28 + 93.29 +#include "incls/_precompiled.incl" 93.30 +#include "incls/_threadLS_linux_zero.cpp.incl" 93.31 + 93.32 +void ThreadLocalStorage::generate_code_for_get_thread() { 93.33 + // nothing to do 93.34 +} 93.35 + 93.36 +void ThreadLocalStorage::pd_init() { 93.37 + // nothing to do 93.38 +} 93.39 + 93.40 +void ThreadLocalStorage::pd_set_thread(Thread* thread) { 93.41 + os::thread_local_storage_at_put(ThreadLocalStorage::thread_index(), thread); 93.42 +}
94.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 94.2 +++ b/src/os_cpu/linux_zero/vm/threadLS_linux_zero.hpp Tue Oct 13 12:04:21 2009 -0700 94.3 @@ -0,0 +1,30 @@ 94.4 +/* 94.5 + * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. 94.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 94.7 + * 94.8 + * This code is free software; you can redistribute it and/or modify it 94.9 + * under the terms of the GNU General Public License version 2 only, as 94.10 + * published by the Free Software Foundation. 94.11 + * 94.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 94.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 94.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 94.15 + * version 2 for more details (a copy is included in the LICENSE file that 94.16 + * accompanied this code). 94.17 + * 94.18 + * You should have received a copy of the GNU General Public License version 94.19 + * 2 along with this work; if not, write to the Free Software Foundation, 94.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 94.21 + * 94.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 94.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 94.24 + * have any questions. 94.25 + * 94.26 + */ 94.27 + 94.28 +// Processor dependent parts of ThreadLocalStorage 94.29 + 94.30 + public: 94.31 + static Thread* thread() { 94.32 + return (Thread*) os::thread_local_storage_at(thread_index()); 94.33 + }
95.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 95.2 +++ b/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp Tue Oct 13 12:04:21 2009 -0700 95.3 @@ -0,0 +1,26 @@ 95.4 +/* 95.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 95.6 + * Copyright 2009 Red Hat, Inc. 95.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 95.8 + * 95.9 + * This code is free software; you can redistribute it and/or modify it 95.10 + * under the terms of the GNU General Public License version 2 only, as 95.11 + * published by the Free Software Foundation. 95.12 + * 95.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 95.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 95.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 95.16 + * version 2 for more details (a copy is included in the LICENSE file that 95.17 + * accompanied this code). 95.18 + * 95.19 + * You should have received a copy of the GNU General Public License version 95.20 + * 2 along with this work; if not, write to the Free Software Foundation, 95.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 95.22 + * 95.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 95.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 95.25 + * have any questions. 95.26 + * 95.27 + */ 95.28 + 95.29 +// This file is intentionally empty
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 96.2 +++ b/src/os_cpu/linux_zero/vm/thread_linux_zero.hpp Tue Oct 13 12:04:21 2009 -0700 96.3 @@ -0,0 +1,104 @@ 96.4 +/* 96.5 + * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. 96.6 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 96.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 96.8 + * 96.9 + * This code is free software; you can redistribute it and/or modify it 96.10 + * under the terms of the GNU General Public License version 2 only, as 96.11 + * published by the Free Software Foundation. 96.12 + * 96.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 96.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 96.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 96.16 + * version 2 for more details (a copy is included in the LICENSE file that 96.17 + * accompanied this code). 96.18 + * 96.19 + * You should have received a copy of the GNU General Public License version 96.20 + * 2 along with this work; if not, write to the Free Software Foundation, 96.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 96.22 + * 96.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 96.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 96.25 + * have any questions. 96.26 + * 96.27 + */ 96.28 + 96.29 + private: 96.30 + ZeroStack _zero_stack; 96.31 + ZeroFrame* _top_zero_frame; 96.32 + 96.33 + void pd_initialize() { 96.34 + _top_zero_frame = NULL; 96.35 + } 96.36 + 96.37 + public: 96.38 + ZeroStack *zero_stack() { 96.39 + return &_zero_stack; 96.40 + } 96.41 + 96.42 + public: 96.43 + ZeroFrame *top_zero_frame() { 96.44 + return _top_zero_frame; 96.45 + } 96.46 + void push_zero_frame(ZeroFrame *frame) { 96.47 + *(ZeroFrame **) frame = _top_zero_frame; 96.48 + _top_zero_frame = frame; 96.49 + } 96.50 + void pop_zero_frame() { 96.51 + zero_stack()->set_sp((intptr_t *) _top_zero_frame + 1); 96.52 + _top_zero_frame = *(ZeroFrame **) _top_zero_frame; 96.53 + } 96.54 + 96.55 + public: 96.56 + static ByteSize zero_stack_offset() { 96.57 + return byte_offset_of(JavaThread, _zero_stack); 96.58 + } 96.59 + static ByteSize top_zero_frame_offset() { 96.60 + return byte_offset_of(JavaThread, _top_zero_frame); 96.61 + } 96.62 + 96.63 + public: 96.64 + void record_base_of_stack_pointer() { 96.65 + assert(top_zero_frame() == NULL, "junk on stack prior to Java call"); 96.66 + } 96.67 + void set_base_of_stack_pointer(intptr_t* base_sp) { 96.68 + assert(base_sp == NULL, "should be"); 96.69 + assert(top_zero_frame() == NULL, "junk on stack after Java call"); 96.70 + } 96.71 + 96.72 + public: 96.73 + void set_last_Java_frame() { 96.74 + JavaFrameAnchor *jfa = frame_anchor(); 96.75 + jfa->set_last_Java_sp((intptr_t *) top_zero_frame()); 96.76 + } 96.77 + void reset_last_Java_frame() { 96.78 + JavaFrameAnchor *jfa = frame_anchor(); 96.79 + jfa->set_last_Java_sp(NULL); 96.80 + } 96.81 + 96.82 + private: 96.83 + frame pd_last_frame() { 96.84 + assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); 96.85 + return frame(last_Java_sp(), zero_stack()->sp()); 96.86 + } 96.87 + 96.88 + public: 96.89 + // Check for pending suspend requests and pending asynchronous 96.90 + // exceptions. There are separate accessors for these, but 96.91 + // _suspend_flags is volatile so using them would be unsafe. 96.92 + bool has_special_condition_for_native_trans() { 96.93 + return _suspend_flags != 0; 96.94 + } 96.95 + 96.96 + public: 96.97 + bool pd_get_top_frame_for_signal_handler(frame* fr_addr, 96.98 + void* ucontext, 96.99 + bool isInJava) { 96.100 + ShouldNotCallThis(); 96.101 + } 96.102 + 96.103 + // These routines are only used on cpu architectures that 96.104 + // have separate register stacks (Itanium). 96.105 + static bool register_stack_overflow() { return false; } 96.106 + static void enable_register_stack_guard() {} 96.107 + static void disable_register_stack_guard() {}
97.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 97.2 +++ b/src/os_cpu/linux_zero/vm/vmStructs_linux_zero.hpp Tue Oct 13 12:04:21 2009 -0700 97.3 @@ -0,0 +1,45 @@ 97.4 +/* 97.5 + * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 97.6 + * Copyright 2007 Red Hat, Inc. 97.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 97.8 + * 97.9 + * This code is free software; you can redistribute it and/or modify it 97.10 + * under the terms of the GNU General Public License version 2 only, as 97.11 + * published by the Free Software Foundation. 97.12 + * 97.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 97.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 97.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 97.16 + * version 2 for more details (a copy is included in the LICENSE file that 97.17 + * accompanied this code). 97.18 + * 97.19 + * You should have received a copy of the GNU General Public License version 97.20 + * 2 along with this work; if not, write to the Free Software Foundation, 97.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 97.22 + * 97.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 97.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 97.25 + * have any questions. 97.26 + * 97.27 + */ 97.28 + 97.29 +// These are the OS and CPU-specific fields, types and integer 97.30 +// constants required by the Serviceability Agent. This file is 97.31 +// referenced by vmStructs.cpp. 97.32 + 97.33 +#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ 97.34 + /* This must be the last entry, and must be present */ \ 97.35 + last_entry() 97.36 + 97.37 + 97.38 +#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ 97.39 + /* This must be the last entry, and must be present */ \ 97.40 + last_entry() 97.41 + 97.42 +#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ 97.43 + /* This must be the last entry, and must be present */ \ 97.44 + last_entry() 97.45 + 97.46 +#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ 97.47 + /* This must be the last entry, and must be present */ \ 97.48 + last_entry()
98.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 98.2 +++ b/src/os_cpu/linux_zero/vm/vm_version_linux_zero.cpp Tue Oct 13 12:04:21 2009 -0700 98.3 @@ -0,0 +1,26 @@ 98.4 +/* 98.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 98.6 + * Copyright 2009 Red Hat, Inc. 98.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 98.8 + * 98.9 + * This code is free software; you can redistribute it and/or modify it 98.10 + * under the terms of the GNU General Public License version 2 only, as 98.11 + * published by the Free Software Foundation. 98.12 + * 98.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 98.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 98.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 98.16 + * version 2 for more details (a copy is included in the LICENSE file that 98.17 + * accompanied this code). 98.18 + * 98.19 + * You should have received a copy of the GNU General Public License version 98.20 + * 2 along with this work; if not, write to the Free Software Foundation, 98.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 98.22 + * 98.23 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 98.24 + * CA 95054 USA or visit www.sun.com if you need additional information or 98.25 + * have any questions. 98.26 + * 98.27 + */ 98.28 + 98.29 +// This file is intentionally empty
99.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 99.2 +++ b/src/share/vm/includeDB_zero Tue Oct 13 12:04:21 2009 -0700 99.3 @@ -0,0 +1,55 @@ 99.4 +// 99.5 +// Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. 99.6 +// Copyright 2009 Red Hat, Inc. 99.7 +// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 99.8 +// 99.9 +// This code is free software; you can redistribute it and/or modify it 99.10 +// under the terms of the GNU General Public License version 2 only, as 99.11 +// published by the Free Software Foundation. 99.12 +// 99.13 +// This code is distributed in the hope that it will be useful, but WITHOUT 99.14 +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 99.15 +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 99.16 +// version 2 for more details (a copy is included in the LICENSE file that 99.17 +// accompanied this code). 99.18 +// 99.19 +// You should have received a copy of the GNU General Public License version 99.20 +// 2 along with this work; if not, write to the Free Software Foundation, 99.21 +// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 99.22 +// 99.23 +// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 99.24 +// CA 95054 USA or visit www.sun.com if you need additional information or 99.25 +// have any questions. 99.26 +// 99.27 +// 99.28 + 99.29 +// NOTE: DO NOT CHANGE THIS COPYRIGHT TO NEW STYLE - IT WILL BREAK makeDeps! 99.30 + 99.31 +entryFrame_<arch>.hpp javaCalls.hpp 99.32 +entryFrame_<arch>.hpp stack_<arch>.hpp 99.33 + 99.34 +fakeStubFrame_<arch>.hpp stack_<arch>.hpp 99.35 + 99.36 +frame.hpp stack_<arch>.hpp 99.37 + 99.38 +frame.inline.hpp fakeStubFrame_<arch>.hpp 99.39 +frame.inline.hpp entryFrame_<arch>.hpp 99.40 +frame.inline.hpp interpreterFrame_<arch>.hpp 99.41 +frame.inline.hpp sharkFrame_<arch>.hpp 99.42 + 99.43 +frame_<arch>.cpp interpreterRuntime.hpp 99.44 +frame_<arch>.cpp scopeDesc.hpp 99.45 + 99.46 +interpreter.hpp entry_<arch>.hpp 99.47 + 99.48 +interpreterFrame_<arch>.hpp bytecodeInterpreter.hpp 99.49 +interpreterFrame_<arch>.hpp methodOop.hpp 99.50 +interpreterFrame_<arch>.hpp stack_<arch>.hpp 99.51 +interpreterFrame_<arch>.hpp thread.hpp 99.52 + 99.53 +sharkFrame_<arch>.hpp methodOop.hpp 99.54 +sharkFrame_<arch>.hpp stack_<arch>.hpp 99.55 + 99.56 +stack_<arch>.hpp sizes.hpp 99.57 + 99.58 +thread.hpp stack_<arch>.hpp
100.1 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp Wed Oct 07 15:38:37 2009 -0700 100.2 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp Tue Oct 13 12:04:21 2009 -0700 100.3 @@ -3031,9 +3031,9 @@ 100.4 tty->print_cr("&native_fresult: " INTPTR_FORMAT, (uintptr_t) &this->_native_fresult); 100.5 tty->print_cr("native_lresult: " INTPTR_FORMAT, (uintptr_t) this->_native_lresult); 100.6 #endif 100.7 -#ifdef IA64 100.8 +#if defined(IA64) && !defined(ZERO) 100.9 tty->print_cr("last_Java_fp: " INTPTR_FORMAT, (uintptr_t) this->_last_Java_fp); 100.10 -#endif // IA64 100.11 +#endif // IA64 && !ZERO 100.12 tty->print_cr("self_link: " INTPTR_FORMAT, (uintptr_t) this->_self_link); 100.13 } 100.14
101.1 --- a/src/share/vm/interpreter/oopMapCache.cpp Wed Oct 07 15:38:37 2009 -0700 101.2 +++ b/src/share/vm/interpreter/oopMapCache.cpp Tue Oct 13 12:04:21 2009 -0700 101.3 @@ -281,7 +281,7 @@ 101.4 public: 101.5 void pass_int() { /* ignore */ } 101.6 void pass_long() { /* ignore */ } 101.7 -#ifdef _LP64 101.8 +#if defined(_LP64) || defined(ZERO) 101.9 void pass_float() { /* ignore */ } 101.10 #endif 101.11 void pass_double() { /* ignore */ }
102.1 --- a/src/share/vm/runtime/arguments.cpp Wed Oct 07 15:38:37 2009 -0700 102.2 +++ b/src/share/vm/runtime/arguments.cpp Tue Oct 13 12:04:21 2009 -0700 102.3 @@ -1229,6 +1229,7 @@ 102.4 } 102.5 } 102.6 102.7 +#ifndef ZERO 102.8 #ifdef _LP64 102.9 // Check that UseCompressedOops can be set with the max heap size allocated 102.10 // by ergonomics. 102.11 @@ -1254,6 +1255,7 @@ 102.12 // Also checks that certain machines are slower with compressed oops 102.13 // in vm_version initialization code. 102.14 #endif // _LP64 102.15 +#endif // !ZERO 102.16 } 102.17 102.18 void Arguments::set_parallel_gc_flags() {
103.1 --- a/src/share/vm/runtime/globals.hpp Wed Oct 07 15:38:37 2009 -0700 103.2 +++ b/src/share/vm/runtime/globals.hpp Tue Oct 13 12:04:21 2009 -0700 103.3 @@ -47,7 +47,6 @@ 103.4 define_pd_global(intx, OnStackReplacePercentage, 0); 103.5 define_pd_global(bool, ResizeTLAB, false); 103.6 define_pd_global(intx, FreqInlineSize, 0); 103.7 -define_pd_global(intx, InlineSmallCode, 0); 103.8 define_pd_global(intx, NewSizeThreadIncrease, 4*K); 103.9 define_pd_global(intx, NewRatio, 4); 103.10 define_pd_global(intx, InlineClassNatives, true);
104.1 --- a/src/share/vm/runtime/jniHandles.hpp Wed Oct 07 15:38:37 2009 -0700 104.2 +++ b/src/share/vm/runtime/jniHandles.hpp Tue Oct 13 12:04:21 2009 -0700 104.3 @@ -99,6 +99,8 @@ 104.4 104.5 class JNIHandleBlock : public CHeapObj { 104.6 friend class VMStructs; 104.7 + friend class CppInterpreter; 104.8 + 104.9 private: 104.10 enum SomeConstants { 104.11 block_size_in_oops = 32 // Number of handles per handle block 104.12 @@ -126,9 +128,11 @@ 104.13 // Fill block with bad_handle values 104.14 void zap(); 104.15 104.16 + protected: 104.17 // No more handles in the both the current and following blocks 104.18 void clear() { _top = 0; } 104.19 104.20 + private: 104.21 // Free list computation 104.22 void rebuild_free_list(); 104.23
105.1 --- a/src/share/vm/runtime/mutex.hpp Wed Oct 07 15:38:37 2009 -0700 105.2 +++ b/src/share/vm/runtime/mutex.hpp Tue Oct 13 12:04:21 2009 -0700 105.3 @@ -61,18 +61,10 @@ 105.4 } ; 105.5 105.6 // Endian-ness ... index of least-significant byte in SplitWord.Bytes[] 105.7 -#ifdef AMD64 // little 105.8 +#ifdef VM_LITTLE_ENDIAN 105.9 #define _LSBINDEX 0 105.10 #else 105.11 -#if IA32 // little 105.12 - #define _LSBINDEX 0 105.13 -#else 105.14 -#ifdef SPARC // big 105.15 #define _LSBINDEX (sizeof(intptr_t)-1) 105.16 -#else 105.17 - #error "unknown architecture" 105.18 -#endif 105.19 -#endif 105.20 #endif 105.21 105.22 class ParkEvent ;
106.1 --- a/src/share/vm/runtime/signature.hpp Wed Oct 07 15:38:37 2009 -0700 106.2 +++ b/src/share/vm/runtime/signature.hpp Tue Oct 13 12:04:21 2009 -0700 106.3 @@ -275,11 +275,14 @@ 106.4 106.5 void do_bool () { pass_int(); _jni_offset++; _offset++; } 106.6 void do_char () { pass_int(); _jni_offset++; _offset++; } 106.7 +#if defined(_LP64) || defined(ZERO) 106.8 + void do_float () { pass_float(); _jni_offset++; _offset++; } 106.9 +#else 106.10 + void do_float () { pass_int(); _jni_offset++; _offset++; } 106.11 +#endif 106.12 #ifdef _LP64 106.13 - void do_float () { pass_float(); _jni_offset++; _offset++; } 106.14 void do_double() { pass_double(); _jni_offset++; _offset += 2; } 106.15 #else 106.16 - void do_float () { pass_int(); _jni_offset++; _offset++; } 106.17 void do_double() { pass_double(); _jni_offset += 2; _offset += 2; } 106.18 #endif 106.19 void do_byte () { pass_int(); _jni_offset++; _offset++; } 106.20 @@ -303,8 +306,10 @@ 106.21 virtual void pass_int() = 0; 106.22 virtual void pass_long() = 0; 106.23 virtual void pass_object() = 0; 106.24 +#if defined(_LP64) || defined(ZERO) 106.25 + virtual void pass_float() = 0; 106.26 +#endif 106.27 #ifdef _LP64 106.28 - virtual void pass_float() = 0; 106.29 virtual void pass_double() = 0; 106.30 #else 106.31 virtual void pass_double() { pass_long(); } // may be same as long
107.1 --- a/src/share/vm/runtime/vm_version.cpp Wed Oct 07 15:38:37 2009 -0700 107.2 +++ b/src/share/vm/runtime/vm_version.cpp Tue Oct 13 12:04:21 2009 -0700 107.3 @@ -93,9 +93,13 @@ 107.4 #else // KERNEL 107.5 #ifdef TIERED 107.6 #define VMTYPE "Server" 107.7 -#else 107.8 - #define VMTYPE COMPILER1_PRESENT("Client") \ 107.9 - COMPILER2_PRESENT("Server") 107.10 +#else // TIERED 107.11 +#ifdef ZERO 107.12 + #define VMTYPE "Zero" 107.13 +#else // ZERO 107.14 + #define VMTYPE COMPILER1_PRESENT("Client") \ 107.15 + COMPILER2_PRESENT("Server") 107.16 +#endif // ZERO 107.17 #endif // TIERED 107.18 #endif // KERNEL 107.19 107.20 @@ -142,10 +146,14 @@ 107.21 WINDOWS_ONLY("windows") \ 107.22 SOLARIS_ONLY("solaris") 107.23 107.24 +#ifdef ZERO 107.25 +#define CPU ZERO_LIBARCH 107.26 +#else 107.27 #define CPU IA32_ONLY("x86") \ 107.28 IA64_ONLY("ia64") \ 107.29 AMD64_ONLY("amd64") \ 107.30 SPARC_ONLY("sparc") 107.31 +#endif // ZERO 107.32 107.33 const char *Abstract_VM_Version::vm_platform_string() { 107.34 return OS "-" CPU;
108.1 --- a/src/share/vm/utilities/vmError.cpp Wed Oct 07 15:38:37 2009 -0700 108.2 +++ b/src/share/vm/utilities/vmError.cpp Tue Oct 13 12:04:21 2009 -0700 108.3 @@ -458,6 +458,40 @@ 108.4 108.5 if (_verbose && _thread && _thread->is_Java_thread()) { 108.6 JavaThread* jt = (JavaThread*)_thread; 108.7 +#ifdef ZERO 108.8 + if (jt->zero_stack()->sp() && jt->top_zero_frame()) { 108.9 + // StackFrameStream uses the frame anchor, which may not have 108.10 + // been set up. This can be done at any time in Zero, however, 108.11 + // so if it hasn't been set up then we just set it up now and 108.12 + // clear it again when we're done. 108.13 + bool has_last_Java_frame = jt->has_last_Java_frame(); 108.14 + if (!has_last_Java_frame) 108.15 + jt->set_last_Java_frame(); 108.16 + st->print("Java frames:"); 108.17 + 108.18 + // If the top frame is a Shark frame and the frame anchor isn't 108.19 + // set up then it's possible that the information in the frame 108.20 + // is garbage: it could be from a previous decache, or it could 108.21 + // simply have never been written. So we print a warning... 108.22 + StackFrameStream sfs(jt); 108.23 + if (!has_last_Java_frame && !sfs.is_done()) { 108.24 + if (sfs.current()->zeroframe()->is_shark_frame()) { 108.25 + st->print(" (TOP FRAME MAY BE JUNK)"); 108.26 + } 108.27 + } 108.28 + st->cr(); 108.29 + 108.30 + // Print the frames 108.31 + for(int i = 0; !sfs.is_done(); sfs.next(), i++) { 108.32 + sfs.current()->zero_print_on_error(i, st, buf, sizeof(buf)); 108.33 + st->cr(); 108.34 + } 108.35 + 108.36 + // Reset the frame anchor if necessary 108.37 + if (!has_last_Java_frame) 108.38 + jt->reset_last_Java_frame(); 108.39 + } 108.40 +#else 108.41 if (jt->has_last_Java_frame()) { 108.42 st->print_cr("Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)"); 108.43 for(StackFrameStream sfs(jt); !sfs.is_done(); sfs.next()) { 108.44 @@ -465,6 +499,7 @@ 108.45 st->cr(); 108.46 } 108.47 } 108.48 +#endif // ZERO 108.49 } 108.50 108.51 STEP(140, "(printing VM operation)" )