Mercurial > hg > openjdk > icedtea > jdk7 > hotspot
changeset 3512:25544370b08a
Merge jdk7u6-b13
author | andrew |
---|---|
date | Fri, 08 Jun 2012 17:13:09 +0100 |
parents | 09d95d97bb19 (current diff) 28746e6d615f (diff) |
children | ed8a0575ebdc |
files | .hgtags make/hotspot_version make/linux/makefiles/vm.make make/solaris/makefiles/dtrace.make make/solaris/makefiles/jsig.make make/solaris/makefiles/saproc.make make/solaris/makefiles/vm.make src/os/linux/vm/os_linux.cpp src/share/vm/classfile/systemDictionary.cpp src/share/vm/opto/library_call.cpp src/share/vm/runtime/arguments.cpp src/share/vm/utilities/vmError.cpp |
diffstat | 46 files changed, 1317 insertions(+), 503 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Wed May 23 20:37:54 2012 +0100 +++ b/.hgtags Fri Jun 08 17:13:09 2012 +0100 @@ -293,3 +293,9 @@ 6b668c1049a8910aabc9d23345d357f20fa24714 jdk7u6-b08 94d7a305da4dcf46049efd81c2afca512d2afa7f jdk7u6-b09 1fcba869fe4a932616067e051565590ff375a63b hs23.2-b01 +702b62a5e1a546ba5eea17619f9056a86fec03f1 jdk7u6-b10 +b7ae1ee1d2e49bbfbcf35587cb51c04abf2710a2 hs23.2-b02 +5921bdc6ce5cd9e3511a4177f9995becb2c2981d jdk7u6-b11 +e974e15945658e574e6c344c4a7ba225f5708c10 hs23.2-b03 +f08a3a0e60c32cb0e8350e72fdc54849759096a4 jdk7u6-b12 +7a8d3cd6562170f4c262e962270f679ac503f456 hs23.2-b04
--- a/make/hotspot_version Wed May 23 20:37:54 2012 +0100 +++ b/make/hotspot_version Fri Jun 08 17:13:09 2012 +0100 @@ -35,7 +35,7 @@ HS_MAJOR_VER=23 HS_MINOR_VER=2 -HS_BUILD_NUMBER=01 +HS_BUILD_NUMBER=04 JDK_MAJOR_VER=1 JDK_MINOR_VER=7
--- a/make/jprt.properties Wed May 23 20:37:54 2012 +0100 +++ b/make/jprt.properties Fri Jun 08 17:13:09 2012 +0100 @@ -38,7 +38,7 @@ # This tells jprt what default release we want to build -jprt.hotspot.default.release=jdk7u4 +jprt.hotspot.default.release=jdk7u6 jprt.tools.default.release=${jprt.submit.option.release?${jprt.submit.option.release}:${jprt.hotspot.default.release}} @@ -54,72 +54,72 @@ # Define the Solaris platforms we want for the various releases jprt.my.solaris.sparc.jdk8=solaris_sparc_5.10 jprt.my.solaris.sparc.jdk7=solaris_sparc_5.10 -jprt.my.solaris.sparc.jdk7u4=${jprt.my.solaris.sparc.jdk7} +jprt.my.solaris.sparc.jdk7u6=${jprt.my.solaris.sparc.jdk7} jprt.my.solaris.sparc=${jprt.my.solaris.sparc.${jprt.tools.default.release}} jprt.my.solaris.sparcv9.jdk8=solaris_sparcv9_5.10 jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10 -jprt.my.solaris.sparcv9.jdk7u4=${jprt.my.solaris.sparcv9.jdk7} +jprt.my.solaris.sparcv9.jdk7u6=${jprt.my.solaris.sparcv9.jdk7} jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}} jprt.my.solaris.i586.jdk8=solaris_i586_5.10 jprt.my.solaris.i586.jdk7=solaris_i586_5.10 -jprt.my.solaris.i586.jdk7u4=${jprt.my.solaris.i586.jdk7} +jprt.my.solaris.i586.jdk7u6=${jprt.my.solaris.i586.jdk7} jprt.my.solaris.i586=${jprt.my.solaris.i586.${jprt.tools.default.release}} jprt.my.solaris.x64.jdk8=solaris_x64_5.10 jprt.my.solaris.x64.jdk7=solaris_x64_5.10 -jprt.my.solaris.x64.jdk7u4=${jprt.my.solaris.x64.jdk7} +jprt.my.solaris.x64.jdk7u6=${jprt.my.solaris.x64.jdk7} jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}} jprt.my.linux.i586.jdk8=linux_i586_2.6 jprt.my.linux.i586.jdk7=linux_i586_2.6 -jprt.my.linux.i586.jdk7u4=${jprt.my.linux.i586.jdk7} +jprt.my.linux.i586.jdk7u6=${jprt.my.linux.i586.jdk7} jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}} jprt.my.linux.x64.jdk8=linux_x64_2.6 jprt.my.linux.x64.jdk7=linux_x64_2.6 -jprt.my.linux.x64.jdk7u4=${jprt.my.linux.x64.jdk7} +jprt.my.linux.x64.jdk7u6=${jprt.my.linux.x64.jdk7} jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}} jprt.my.linux.ppc.jdk8=linux_ppc_2.6 jprt.my.linux.ppc.jdk7=linux_ppc_2.6 -jprt.my.linux.ppc.jdk7u4=${jprt.my.linux.ppc.jdk7} +jprt.my.linux.ppc.jdk7u6=${jprt.my.linux.ppc.jdk7} jprt.my.linux.ppc=${jprt.my.linux.ppc.${jprt.tools.default.release}} jprt.my.linux.ppcv2.jdk8=linux_ppcv2_2.6 jprt.my.linux.ppcv2.jdk7=linux_ppcv2_2.6 -jprt.my.linux.ppcv2.jdk7u4=${jprt.my.linux.ppcv2.jdk7} +jprt.my.linux.ppcv2.jdk7u6=${jprt.my.linux.ppcv2.jdk7} jprt.my.linux.ppcv2=${jprt.my.linux.ppcv2.${jprt.tools.default.release}} jprt.my.linux.ppcsflt.jdk8=linux_ppcsflt_2.6 jprt.my.linux.ppcsflt.jdk7=linux_ppcsflt_2.6 -jprt.my.linux.ppcsflt.jdk7u4=${jprt.my.linux.ppcsflt.jdk7} +jprt.my.linux.ppcsflt.jdk7u6=${jprt.my.linux.ppcsflt.jdk7} jprt.my.linux.ppcsflt=${jprt.my.linux.ppcsflt.${jprt.tools.default.release}} jprt.my.linux.armvfp.jdk8=linux_armvfp_2.6 jprt.my.linux.armvfp.jdk7=linux_armvfp_2.6 -jprt.my.linux.armvfp.jdk7u4=${jprt.my.linux.armvfp.jdk7} +jprt.my.linux.armvfp.jdk7u6=${jprt.my.linux.armvfp.jdk7} jprt.my.linux.armvfp=${jprt.my.linux.armvfp.${jprt.tools.default.release}} jprt.my.linux.armsflt.jdk8=linux_armsflt_2.6 jprt.my.linux.armsflt.jdk7=linux_armsflt_2.6 -jprt.my.linux.armsflt.jdk7u4=${jprt.my.linux.armsflt.jdk7} +jprt.my.linux.armsflt.jdk7u6=${jprt.my.linux.armsflt.jdk7} jprt.my.linux.armsflt=${jprt.my.linux.armsflt.${jprt.tools.default.release}} jprt.my.macosx.x64.jdk8=macosx_x64_10.7 jprt.my.macosx.x64.jdk7=macosx_x64_10.7 -jprt.my.macosx.x64.jdk7u4=${jprt.my.macosx.x64.jdk7} +jprt.my.macosx.x64.jdk7u6=${jprt.my.macosx.x64.jdk7} jprt.my.macosx.x64=${jprt.my.macosx.x64.${jprt.tools.default.release}} jprt.my.windows.i586.jdk8=windows_i586_5.1 jprt.my.windows.i586.jdk7=windows_i586_5.1 -jprt.my.windows.i586.jdk7u4=${jprt.my.windows.i586.jdk7} +jprt.my.windows.i586.jdk7u6=${jprt.my.windows.i586.jdk7} jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}} jprt.my.windows.x64.jdk8=windows_x64_5.2 jprt.my.windows.x64.jdk7=windows_x64_5.2 -jprt.my.windows.x64.jdk7u4=${jprt.my.windows.x64.jdk7} +jprt.my.windows.x64.jdk7u6=${jprt.my.windows.x64.jdk7} jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}} # Standard list of jprt build targets for this source tree @@ -133,7 +133,8 @@ ${jprt.my.linux.x64}-{product|fastdebug}, \ ${jprt.my.macosx.x64}-{product|fastdebug|debug}, \ ${jprt.my.windows.i586}-{product|fastdebug|debug}, \ - ${jprt.my.windows.x64}-{product|fastdebug|debug} + ${jprt.my.windows.x64}-{product|fastdebug|debug}, \ + ${jprt.my.linux.armvfp}-{product|fastdebug} jprt.build.targets.open= \ ${jprt.my.solaris.i586}-{productOpen}, \ @@ -153,7 +154,7 @@ jprt.build.targets.jdk8=${jprt.build.targets.all} jprt.build.targets.jdk7=${jprt.build.targets.all} -jprt.build.targets.jdk7u4=${jprt.build.targets.all} +jprt.build.targets.jdk7u6=${jprt.build.targets.all} jprt.build.targets.jdk7temp=${jprt.build.targets.all} jprt.build.targets.jdk7b107=${jprt.build.targets.all} jprt.build.targets.jdk6=${jprt.build.targets.standard} @@ -456,7 +457,7 @@ jprt.test.targets.jdk8=${jprt.test.targets.standard} jprt.test.targets.jdk7=${jprt.test.targets.standard} -jprt.test.targets.jdk7u4=${jprt.test.targets.jdk7} +jprt.test.targets.jdk7u6=${jprt.test.targets.jdk7} jprt.test.targets=${jprt.test.targets.${jprt.tools.default.release}} # The default test/Makefile targets that should be run @@ -501,6 +502,6 @@ jprt.make.rule.test.targets.jdk8=${jprt.make.rule.test.targets.standard} jprt.make.rule.test.targets.jdk7=${jprt.make.rule.test.targets.standard} -jprt.make.rule.test.targets.jdk7u4=${jprt.make.rule.test.targets.jdk7} +jprt.make.rule.test.targets.jdk7u6=${jprt.make.rule.test.targets.jdk7} jprt.make.rule.test.targets=${jprt.make.rule.test.targets.${jprt.tools.default.release}}
--- a/make/linux/makefiles/vm.make Wed May 23 20:37:54 2012 +0100 +++ b/make/linux/makefiles/vm.make Fri Jun 08 17:13:09 2012 +0100 @@ -106,9 +106,11 @@ # a time and date. vm_version.o: CXXFLAGS += ${JRE_VERSION} -ifndef JAVASE_EMBEDDED +ifndef JAVASE_EMBEDDED +ifneq (${ARCH},arm) CFLAGS += -DINCLUDE_TRACE endif +endif ifdef DISTRIBUTION_ID CPPFLAGS += -DDISTRIBUTION_ID="\"$(DISTRIBUTION_ID)\"" @@ -161,11 +163,13 @@ SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm -ifndef JAVASE_EMBEDDED +ifndef JAVASE_EMBEDDED +ifneq (${ARCH},arm) SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \ find $(HS_ALT_SRC)/share/vm/jfr -type d; \ fi) endif +endif CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) CORE_PATHS+=$(GENERATED)/jvmtifiles
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/solaris/makefiles/add_gnu_debuglink.make Fri Jun 08 17:13:09 2012 +0100 @@ -0,0 +1,51 @@ +# +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# + +# Rules to build add_gnu_debuglink, used by vm.make on Solaris + +GENERATED = ../generated +ADD_GNU_DEBUGLINK = $(GENERATED)/add_gnu_debuglink + +ADD_GNU_DEBUGLINK_DIR = $(GAMMADIR)/src/os/solaris/add_gnu_debuglink +ADD_GNU_DEBUGLINK_SRC = $(ADD_GNU_DEBUGLINK_DIR)/add_gnu_debuglink.c +ADD_GNU_DEBUGLINK_FLAGS = +LIBS_ADD_GNU_DEBUGLINK += -lelf + +ifeq ("${Platform_compiler}", "sparcWorks") +# Enable the following ADD_GNU_DEBUGLINK_FLAGS addition if you need to +# compare the built ELF objects. +# +# The -g option makes static data global and the "-W0,-noglobal" +# option tells the compiler to not globalize static data using a unique +# globalization prefix. Instead force the use of a static globalization +# prefix based on the source filepath so the objects from two identical +# compilations are the same. +# +# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't +# seem to work. I got "-W0,-noglobal" from Kelly and that works. +#ADD_GNU_DEBUGLINK_FLAGS += -W0,-noglobal +endif # Platform_compiler == sparcWorks + +$(ADD_GNU_DEBUGLINK): $(ADD_GNU_DEBUGLINK_SRC) + $(CC) -g -o $@ $< $(ADD_GNU_DEBUGLINK_FLAGS) $(LIBS_ADD_GNU_DEBUGLINK)
--- a/make/solaris/makefiles/defs.make Wed May 23 20:37:54 2012 +0100 +++ b/make/solaris/makefiles/defs.make Fri Jun 08 17:13:09 2012 +0100 @@ -97,18 +97,12 @@ # overridden in some situations, e.g., a BUILD_FLAVOR != product # build. - # Disable FULL_DEBUG_SYMBOLS by default because dtrace tests are - # failing in nightly when the debug info files are ZIP'ed. On - # Solaris debug info files need to be ZIP'ed to reduce the impact - # on disk space footprint. - FULL_DEBUG_SYMBOLS ?= 0 ifeq ($(BUILD_FLAVOR), product) - # FULL_DEBUG_SYMBOLS ?= 1 + FULL_DEBUG_SYMBOLS ?= 1 ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) else # debug variants always get Full Debug Symbols (if available) - # ENABLE_FULL_DEBUG_SYMBOLS = 1 - ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) + ENABLE_FULL_DEBUG_SYMBOLS = 1 endif _JUNK_ := $(shell \ echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") @@ -117,25 +111,10 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) # Default OBJCOPY comes from the SUNWbinutils package: DEF_OBJCOPY=/usr/sfw/bin/gobjcopy - ifeq ($(VM_PLATFORM),solaris_amd64) - # On Solaris AMD64/X64, gobjcopy is not happy and fails: - # - # usr/sfw/bin/gobjcopy --add-gnu-debuglink=<lib>.debuginfo <lib>.so - # BFD: stKPaiop: Not enough room for program headers, try linking with -N - # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value - # BFD: stKPaiop: Not enough room for program headers, try linking with -N - # /usr/sfw/bin/gobjcopy: libsaproc.debuginfo: Bad value - # BFD: stKPaiop: Not enough room for program headers, try linking with -N - # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value - _JUNK_ := $(shell \ - echo >&2 "INFO: $(DEF_OBJCOPY) is not working on Solaris AMD64/X64") - OBJCOPY= - else - OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) - ifneq ($(ALT_OBJCOPY),) - _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") - OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) - endif + OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) + ifneq ($(ALT_OBJCOPY),) + _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") + OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) endif else OBJCOPY= @@ -166,9 +145,7 @@ _JUNK_ := $(shell \ echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") - # Disable ZIP_DEBUGINFO_FILES by default because dtrace tests are - # failing in nightly when the debug info files are ZIP'ed. - ZIP_DEBUGINFO_FILES ?= 0 + ZIP_DEBUGINFO_FILES ?= 1 _JUNK_ := $(shell \ echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
--- a/make/solaris/makefiles/dtrace.make Wed May 23 20:37:54 2012 +0100 +++ b/make/solaris/makefiles/dtrace.make Fri Jun 08 17:13:09 2012 +0100 @@ -108,7 +108,7 @@ XLIBJVM_DTRACE_G_DEBUGINFO = 64/$(LIBJVM_DTRACE_G_DEBUGINFO) XLIBJVM_DTRACE_G_DIZ = 64/$(LIBJVM_DTRACE_G_DIZ) -$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) +$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) @echo Making $@ $(QUIETLY) mkdir -p 64/ ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ @@ -116,8 +116,17 @@ [ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifneq ($(STRIP_POLICY),no_strip) +# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. +# Clear the SHF_ALLOC flag (if set) from empty section headers. +# An empty section header has sh_addr == 0 and sh_size == 0. +# This problem has only been seen on Solaris X64, but we call this tool +# on all Solaris builds just in case. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DB_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DB_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(XLIBJVM_DB_DEBUGINFO) $@ endif ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ @@ -137,7 +146,7 @@ endif endif -$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) +$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) @echo Making $@ $(QUIETLY) mkdir -p 64/ ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \ @@ -145,8 +154,12 @@ [ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifneq ($(STRIP_POLICY),no_strip) +# Clear the SHF_ALLOC flag (if set) from empty section headers. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DTRACE_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DTRACE_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(XLIBJVM_DTRACE_DEBUGINFO) $@ endif ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ @@ -206,15 +219,19 @@ $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp -$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) +$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) @echo Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc [ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifneq ($(STRIP_POLICY),no_strip) +# Clear the SHF_ALLOC flag (if set) from empty section headers. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@ endif ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@ @@ -234,15 +251,19 @@ endif endif -$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) +$(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) @echo Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor [ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifneq ($(STRIP_POLICY),no_strip) +# Clear the SHF_ALLOC flag (if set) from empty section headers. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@ endif ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/solaris/makefiles/fix_empty_sec_hdr_flags.make Fri Jun 08 17:13:09 2012 +0100 @@ -0,0 +1,51 @@ +# +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# + +# Rules to build fix_empty_sec_hdr_flags, used by vm.make on Solaris + +GENERATED = ../generated +FIX_EMPTY_SEC_HDR_FLAGS = $(GENERATED)/fix_empty_sec_hdr_flags + +FIX_EMPTY_SEC_HDR_FLAGS_DIR = $(GAMMADIR)/src/os/solaris/fix_empty_sec_hdr_flags +FIX_EMPTY_SEC_HDR_FLAGS_SRC = $(FIX_EMPTY_SEC_HDR_FLAGS_DIR)/fix_empty_sec_hdr_flags.c +FIX_EMPTY_SEC_HDR_FLAGS_FLAGS = +LIBS_FIX_EMPTY_SEC_HDR_FLAGS += -lelf + +ifeq ("${Platform_compiler}", "sparcWorks") +# Enable the following FIX_EMPTY_SEC_HDR_FLAGS_FLAGS addition if you need to +# compare the built ELF objects. +# +# The -g option makes static data global and the "-W0,-noglobal" +# option tells the compiler to not globalize static data using a unique +# globalization prefix. Instead force the use of a static globalization +# prefix based on the source filepath so the objects from two identical +# compilations are the same. +# +# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't +# seem to work. I got "-W0,-noglobal" from Kelly and that works. +#FIX_EMPTY_SEC_HDR_FLAGS_FLAGS += -W0,-noglobal +endif # Platform_compiler == sparcWorks + +$(FIX_EMPTY_SEC_HDR_FLAGS): $(FIX_EMPTY_SEC_HDR_FLAGS_SRC) + $(CC) -g -o $@ $< $(FIX_EMPTY_SEC_HDR_FLAGS_FLAGS) $(LIBS_FIX_EMPTY_SEC_HDR_FLAGS)
--- a/make/solaris/makefiles/jsig.make Wed May 23 20:37:54 2012 +0100 +++ b/make/solaris/makefiles/jsig.make Fri Jun 08 17:13:09 2012 +0100 @@ -52,15 +52,24 @@ LFLAGS_JSIG += -mt -xnolib endif -$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) +$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) @echo Making signal interposition lib... $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ - $(LFLAGS_JSIG) -o $@ $< -ldl + $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifneq ($(STRIP_POLICY),no_strip) +# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. +# Clear the SHF_ALLOC flag (if set) from empty section headers. +# An empty section header has sh_addr == 0 and sh_size == 0. +# This problem has only been seen on Solaris X64, but we call this tool +# on all Solaris builds just in case. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJSIG_DEBUGINFO) $@ endif ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@
--- a/make/solaris/makefiles/saproc.make Wed May 23 20:37:54 2012 +0100 +++ b/make/solaris/makefiles/saproc.make Fri Jun 08 17:13:09 2012 +0100 @@ -90,7 +90,7 @@ # when actually building on Nevada-B158 or earlier: #SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER -$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) +$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SAMAPFILE) $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ @@ -110,8 +110,17 @@ [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); } ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifneq ($(STRIP_POLICY),no_strip) +# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. +# Clear the SHF_ALLOC flag (if set) from empty section headers. +# An empty section header has sh_addr == 0 and sh_size == 0. +# This problem has only been seen on Solaris X64, but we call this tool +# on all Solaris builds just in case. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBSAPROC_DEBUGINFO) $@ endif ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@
--- a/make/solaris/makefiles/vm.make Wed May 23 20:37:54 2012 +0100 +++ b/make/solaris/makefiles/vm.make Fri Jun 08 17:13:09 2012 +0100 @@ -153,6 +153,14 @@ include $(MAKEFILES_DIR)/dtrace.make #---------------------------------------------------------------------- +# add_gnu_debuglink tool +include $(MAKEFILES_DIR)/add_gnu_debuglink.make + +#---------------------------------------------------------------------- +# fix_empty_sec_hdr_flags tool +include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make + +#---------------------------------------------------------------------- # JVM JVM = jvm @@ -284,7 +292,7 @@ LINK_VM = $(LINK_LIB.CXX) endif # making the library: -$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) +$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE) ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) @echo Linking vm... $(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK) @@ -295,8 +303,17 @@ $(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) ifneq ($(STRIP_POLICY),no_strip) +# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. +# Clear the SHF_ALLOC flag (if set) from empty section headers. +# An empty section header has sh_addr == 0 and sh_size == 0. +# This problem has only been seen on Solaris X64, but we call this tool +# on all Solaris builds just in case. + $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. +# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. +# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ + $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@ endif ifeq ($(STRIP_POLICY),all_strip) $(QUIETLY) $(STRIP) $@
--- a/make/windows/makefiles/defs.make Wed May 23 20:37:54 2012 +0100 +++ b/make/windows/makefiles/defs.make Fri Jun 08 17:13:09 2012 +0100 @@ -143,9 +143,7 @@ MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - # Disable ZIP_DEBUGINFO_FILES by default because various tests are - # failing in nightly when the debug info files are ZIP'ed. - ZIP_DEBUGINFO_FILES ?= 0 + ZIP_DEBUGINFO_FILES ?= 1 else ZIP_DEBUGINFO_FILES=0 endif
--- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -238,9 +238,12 @@ Register result = dst->as_register(); { - // Get a pointer to the first character of string0 in tmp0 and get string0.count in str0 - // Get a pointer to the first character of string1 in tmp1 and get string1.count in str1 - // Also, get string0.count-string1.count in o7 and get the condition code set + // Get a pointer to the first character of string0 in tmp0 + // and get string0.length() in str0 + // Get a pointer to the first character of string1 in tmp1 + // and get string1.length() in str1 + // Also, get string0.length()-string1.length() in + // o7 and get the condition code set // Note: some instructions have been hoisted for better instruction scheduling Register tmp0 = L0; @@ -248,27 +251,40 @@ Register tmp2 = L2; int value_offset = java_lang_String:: value_offset_in_bytes(); // char array - int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position - int count_offset = java_lang_String:: count_offset_in_bytes(); - - __ load_heap_oop(str0, value_offset, tmp0); - __ ld(str0, offset_offset, tmp2); - __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); - __ ld(str0, count_offset, str0); - __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + if (java_lang_String::has_offset_field()) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position + int count_offset = java_lang_String:: count_offset_in_bytes(); + __ load_heap_oop(str0, value_offset, tmp0); + __ ld(str0, offset_offset, tmp2); + __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); + __ ld(str0, count_offset, str0); + __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + } else { + __ load_heap_oop(str0, value_offset, tmp1); + __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); + __ ld(tmp1, arrayOopDesc::length_offset_in_bytes(), str0); + } // str1 may be null add_debug_info_for_null_check_here(info); - __ load_heap_oop(str1, value_offset, tmp1); - __ add(tmp0, tmp2, tmp0); - - __ ld(str1, offset_offset, tmp2); - __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); - __ ld(str1, count_offset, str1); - __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + if (java_lang_String::has_offset_field()) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position + int count_offset = java_lang_String:: count_offset_in_bytes(); + __ load_heap_oop(str1, value_offset, tmp1); + __ add(tmp0, tmp2, tmp0); + + __ ld(str1, offset_offset, tmp2); + __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); + __ ld(str1, count_offset, str1); + __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); + __ add(tmp1, tmp2, tmp1); + } else { + __ load_heap_oop(str1, value_offset, tmp2); + __ add(tmp2, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); + __ ld(tmp2, arrayOopDesc::length_offset_in_bytes(), str1); + } __ subcc(str0, str1, O7); - __ add(tmp1, tmp2, tmp1); } { @@ -302,7 +318,7 @@ // Shift base0 and base1 to the end of the arrays, negate limit __ add(base0, limit, base0); __ add(base1, limit, base1); - __ neg(limit); // limit = -min{string0.count, strin1.count} + __ neg(limit); // limit = -min{string0.length(), string1.length()} __ lduh(base0, limit, chr0); __ bind(Lloop);
--- a/src/cpu/x86/vm/assembler_x86.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/cpu/x86/vm/assembler_x86.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -528,10 +528,12 @@ if (which == end_pc_operand) return ip + (is_64bit ? 8 : 4); // these asserts are somewhat nonsensical #ifndef _LP64 - assert(which == imm_operand || which == disp32_operand, ""); + assert(which == imm_operand || which == disp32_operand, + err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip)); #else assert((which == call32_operand || which == imm_operand) && is_64bit || - which == narrow_oop_operand && !is_64bit, ""); + which == narrow_oop_operand && !is_64bit, + err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip)); #endif // _LP64 return ip;
--- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -505,19 +505,28 @@ // Get addresses of first characters from both Strings __ load_heap_oop(rsi, Address(rax, java_lang_String::value_offset_in_bytes())); - __ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes())); - __ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); - + if (java_lang_String::has_offset_field()) { + __ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes())); + __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); + __ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } else { + __ movl (rax, Address(rsi, arrayOopDesc::length_offset_in_bytes())); + __ lea (rsi, Address(rsi, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } // rbx, may be NULL add_debug_info_for_null_check_here(info); __ load_heap_oop(rdi, Address(rbx, java_lang_String::value_offset_in_bytes())); - __ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes())); - __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + if (java_lang_String::has_offset_field()) { + __ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes())); + __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); + __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } else { + __ movl (rbx, Address(rdi, arrayOopDesc::length_offset_in_bytes())); + __ lea (rdi, Address(rdi, arrayOopDesc::base_offset_in_bytes(T_CHAR))); + } // compute minimum length (in rax) and difference of lengths (on top of stack) - __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); - __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); __ mov (rcx, rbx); __ subptr(rbx, rax); // subtract lengths __ push (rbx); // result @@ -1462,7 +1471,11 @@ break; case Bytecodes::_l2i: +#ifdef _LP64 + __ movl(dest->as_register(), src->as_register_lo()); +#else move_regs(src->as_register_lo(), dest->as_register()); +#endif break; case Bytecodes::_i2b:
--- a/src/cpu/x86/vm/x86_64.ad Wed May 23 20:37:54 2012 +0100 +++ b/src/cpu/x86/vm/x86_64.ad Fri Jun 08 17:13:09 2012 +0100 @@ -3361,15 +3361,6 @@ interface(CONST_INTER); %} -operand immP_poll() %{ - predicate(n->get_ptr() != 0 && n->get_ptr() == (intptr_t)os::get_polling_page()); - match(ConP); - - // formats are generated automatically for constants and base registers - format %{ %} - interface(CONST_INTER); -%} - // Pointer Immediate operand immN() %{ match(ConN); @@ -5718,16 +5709,6 @@ ins_pipe(ialu_reg); %} -instruct loadConP_poll(rRegP dst, immP_poll src) %{ - match(Set dst src); - format %{ "movq $dst, $src\t!ptr" %} - ins_encode %{ - AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_type); - __ lea($dst$$Register, polling_page); - %} - ins_pipe(ialu_reg_fat); -%} - instruct loadConP31(rRegP dst, immP31 src, rFlagsReg cr) %{ match(Set dst src);
--- a/src/os/bsd/vm/os_bsd.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/os/bsd/vm/os_bsd.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -2340,93 +2340,21 @@ #endif } +void os::print_os_info_brief(outputStream* st) { + st->print("Bsd"); + + os::Posix::print_uname_info(st); +} void os::print_os_info(outputStream* st) { st->print("OS:"); - - // Try to identify popular distros. - // Most Bsd distributions have /etc/XXX-release file, which contains - // the OS version string. Some have more than one /etc/XXX-release file - // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.), - // so the order is important. - if (!_print_ascii_file("/etc/mandrake-release", st) && - !_print_ascii_file("/etc/sun-release", st) && - !_print_ascii_file("/etc/redhat-release", st) && - !_print_ascii_file("/etc/SuSE-release", st) && - !_print_ascii_file("/etc/turbobsd-release", st) && - !_print_ascii_file("/etc/gentoo-release", st) && - !_print_ascii_file("/etc/debian_version", st) && - !_print_ascii_file("/etc/ltib-release", st) && - !_print_ascii_file("/etc/angstrom-version", st)) { - st->print("Bsd"); - } - st->cr(); - - // kernel - st->print("uname:"); - struct utsname name; - uname(&name); - st->print(name.sysname); st->print(" "); - st->print(name.release); st->print(" "); - st->print(name.version); st->print(" "); - st->print(name.machine); - st->cr(); - -#ifndef _ALLBSD_SOURCE - // Print warning if unsafe chroot environment detected - if (unsafe_chroot_detected) { - st->print("WARNING!! "); - st->print_cr(unstable_chroot_error); - } - - // libc, pthread - st->print("libc:"); - st->print(os::Bsd::glibc_version()); st->print(" "); - st->print(os::Bsd::libpthread_version()); st->print(" "); - if (os::Bsd::is_BsdThreads()) { - st->print("(%s stack)", os::Bsd::is_floating_stack() ? "floating" : "fixed"); - } - st->cr(); -#endif - - // rlimit - st->print("rlimit:"); - struct rlimit rlim; - - st->print(" STACK "); - getrlimit(RLIMIT_STACK, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - - st->print(", CORE "); - getrlimit(RLIMIT_CORE, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - - st->print(", NPROC "); - getrlimit(RLIMIT_NPROC, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%d", rlim.rlim_cur); - - st->print(", NOFILE "); - getrlimit(RLIMIT_NOFILE, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%d", rlim.rlim_cur); - -#ifndef _ALLBSD_SOURCE - st->print(", AS "); - getrlimit(RLIMIT_AS, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - st->cr(); - - // load average - st->print("load average:"); - double loadavg[3]; - os::loadavg(loadavg, 3); - st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); - st->cr(); -#endif + st->print("Bsd"); + + os::Posix::print_uname_info(st); + + os::Posix::print_rlimit_info(st); + + os::Posix::print_load_average(st); } void os::pd_print_cpu_info(outputStream* st) {
--- a/src/os/linux/vm/os_linux.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/os/linux/vm/os_linux.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -2054,15 +2054,43 @@ } } +void os::print_os_info_brief(outputStream* st) { + os::Linux::print_distro_info(st); + + os::Posix::print_uname_info(st); + + os::Linux::print_libversion_info(st); + +} void os::print_os_info(outputStream* st) { st->print("OS:"); - // Try to identify popular distros. - // Most Linux distributions have /etc/XXX-release file, which contains - // the OS version string. Some have more than one /etc/XXX-release file - // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.), - // so the order is important. + os::Linux::print_distro_info(st); + + os::Posix::print_uname_info(st); + + // Print warning if unsafe chroot environment detected + if (unsafe_chroot_detected) { + st->print("WARNING!! "); + st->print_cr(unstable_chroot_error); + } + + os::Linux::print_libversion_info(st); + + os::Posix::print_rlimit_info(st); + + os::Posix::print_load_average(st); + + os::Linux::print_full_memory_info(st); +} + +// Try to identify popular distros. +// Most Linux distributions have /etc/XXX-release file, which contains +// the OS version string. Some have more than one /etc/XXX-release file +// (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.), +// so the order is important. +void os::Linux::print_distro_info(outputStream* st) { if (!_print_ascii_file("/etc/mandrake-release", st) && !_print_ascii_file("/etc/sun-release", st) && !_print_ascii_file("/etc/redhat-release", st) && @@ -2076,23 +2104,9 @@ st->print("Linux"); } st->cr(); - - // kernel - st->print("uname:"); - struct utsname name; - uname(&name); - st->print(name.sysname); st->print(" "); - st->print(name.release); st->print(" "); - st->print(name.version); st->print(" "); - st->print(name.machine); - st->cr(); - - // Print warning if unsafe chroot environment detected - if (unsafe_chroot_detected) { - st->print("WARNING!! "); - st->print_cr(unstable_chroot_error); - } - +} + +void os::Linux::print_libversion_info(outputStream* st) { // libc, pthread st->print("libc:"); st->print(os::Linux::glibc_version()); st->print(" "); @@ -2101,56 +2115,12 @@ st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed"); } st->cr(); - - // rlimit - st->print("rlimit:"); - struct rlimit rlim; - - st->print(" STACK "); - getrlimit(RLIMIT_STACK, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - - st->print(", CORE "); - getrlimit(RLIMIT_CORE, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - - st->print(", NPROC "); - getrlimit(RLIMIT_NPROC, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%d", rlim.rlim_cur); - - st->print(", NOFILE "); - getrlimit(RLIMIT_NOFILE, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%d", rlim.rlim_cur); - - st->print(", AS "); - getrlimit(RLIMIT_AS, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - st->cr(); - - // load average - st->print("load average:"); - double loadavg[3]; - os::loadavg(loadavg, 3); - st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); - st->cr(); - - // meminfo - st->print("\n/proc/meminfo:\n"); - _print_ascii_file("/proc/meminfo", st); - st->cr(); -} - -void os::pd_print_cpu_info(outputStream* st) { - st->print("\n/proc/cpuinfo:\n"); - if (!_print_ascii_file("/proc/cpuinfo", st)) { - st->print(" <Not Available>"); - } - st->cr(); +} + +void os::Linux::print_full_memory_info(outputStream* st) { + st->print("\n/proc/meminfo:\n"); + _print_ascii_file("/proc/meminfo", st); + st->cr(); } void os::print_memory_info(outputStream* st) { @@ -2173,6 +2143,14 @@ st->cr(); } +void os::pd_print_cpu_info(outputStream* st) { + st->print("\n/proc/cpuinfo:\n"); + if (!_print_ascii_file("/proc/cpuinfo", st)) { + st->print(" <Not Available>"); + } + st->cr(); +} + // Taken from /usr/include/bits/siginfo.h Supposed to be architecture specific // but they're the same for all the linux arch that we support // and they're the same for solaris but there's no common place to put this.
--- a/src/os/linux/vm/os_linux.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/os/linux/vm/os_linux.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -89,6 +89,10 @@ static bool hugetlbfs_sanity_check(bool warn, size_t page_size); + static void print_full_memory_info(outputStream* st); + static void print_distro_info(outputStream* st); + static void print_libversion_info(outputStream* st); + public: static void init_thread_fpu_state(); static int get_fpu_control_word();
--- a/src/os/posix/vm/os_posix.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/os/posix/vm/os_posix.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -28,6 +28,8 @@ #include <unistd.h> #include <sys/resource.h> +#include <sys/utsname.h> + // Check core dump limit and report possible place where core can be found void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { @@ -72,3 +74,59 @@ // don't do anything on posix platforms return; } + +void os::Posix::print_load_average(outputStream* st) { + st->print("load average:"); + double loadavg[3]; + os::loadavg(loadavg, 3); + st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); + st->cr(); +} + +void os::Posix::print_rlimit_info(outputStream* st) { + st->print("rlimit:"); + struct rlimit rlim; + + st->print(" STACK "); + getrlimit(RLIMIT_STACK, &rlim); + if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); + else st->print("%uk", rlim.rlim_cur >> 10); + + st->print(", CORE "); + getrlimit(RLIMIT_CORE, &rlim); + if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); + else st->print("%uk", rlim.rlim_cur >> 10); + + //Isn't there on solaris +#ifndef TARGET_OS_FAMILY_solaris + st->print(", NPROC "); + getrlimit(RLIMIT_NPROC, &rlim); + if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); + else st->print("%d", rlim.rlim_cur); +#endif + + st->print(", NOFILE "); + getrlimit(RLIMIT_NOFILE, &rlim); + if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); + else st->print("%d", rlim.rlim_cur); + + st->print(", AS "); + getrlimit(RLIMIT_AS, &rlim); + if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); + else st->print("%uk", rlim.rlim_cur >> 10); + st->cr(); +} + +void os::Posix::print_uname_info(outputStream* st) { + // kernel + st->print("uname:"); + struct utsname name; + uname(&name); + st->print(name.sysname); st->print(" "); + st->print(name.release); st->print(" "); + st->print(name.version); st->print(" "); + st->print(name.machine); + st->cr(); +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/os/posix/vm/os_posix.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef OS_POSIX_VM_OS_POSIX_HPP +#define OS_POSIX_VM_OS_POSIX_HPP +class Posix { + friend class os; + +protected: + static void print_distro_info(outputStream* st); + static void print_rlimit_info(outputStream* st); + static void print_uname_info(outputStream* st); + static void print_libversion_info(outputStream* st); + static void print_load_average(outputStream* st); + + +}; + + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c Fri Jun 08 17:13:09 2012 +0100 @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/* + * Name: add_gnu_debuglink.c + * + * Description: Add a ".gnu_debuglink" section that refers to the specified + * debug_info_path to the specified ELF object. + * + * This program is adapted from the example program shown on the + * elf(3elf) man page and from code from the Solaris compiler + * driver. + */ + +/* + * needed to define SHF_EXCLUDE + */ +#define ELF_TARGET_ALL + +#include <fcntl.h> +#include <stdio.h> +#include <libelf.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +static void failure(void); +static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, + size_t len); + +void +main(int argc, char ** argv) { + /* new ELF section name */ + static char SEC_NAME[] = ".gnu_debuglink"; + + unsigned char buffer[8 * 1024]; /* I/O buffer */ + int buffer_len; /* buffer length */ + char * debug_info_path; /* debug info path */ + void * ehdr; /* ELF header */ + Elf * elf; /* ELF descriptor */ + char * elf_ident; /* ELF identity string */ + char * elf_obj; /* elf_obj file */ + int fd; /* descriptor for files */ + unsigned int file_crc = 0; /* CRC for debug info file */ + int is_elfclass64; /* is an ELFCLASS64 file? */ + Elf_Data * link_dat; /* ELF data for new debug info link */ + Elf_Data * name_dat; /* ELF data for new section name */ + Elf_Scn * new_scn; /* new ELF section descriptor */ + void * new_shdr; /* new ELF section header */ + Elf_Scn * scn; /* ELF section descriptor */ + void * shdr; /* ELF section header */ + + if (argc != 3) { + (void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]); + exit(2); + } + + debug_info_path = argv[1]; /* save for later */ + if ((fd = open(debug_info_path, O_RDONLY)) == -1) { + (void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path); + exit(3); + } + + (void) printf("Computing CRC for '%s'\n", debug_info_path); + (void) fflush(stdout); + /* compute CRC for the debug info file */ + for (;;) { + int len = read(fd, buffer, sizeof buffer); + if (len <= 0) { + break; + } + file_crc = gnu_debuglink_crc32(file_crc, buffer, len); + } + (void) close(fd); + + /* open the elf_obj */ + elf_obj = argv[2]; + if ((fd = open(elf_obj, O_RDWR)) == -1) { + (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj); + exit(4); + } + + (void) printf("Opening '%s' for update\n", elf_obj); + (void) fflush(stdout); + (void) elf_version(EV_CURRENT); /* coordinate ELF versions */ + + /* obtain the ELF descriptors from the input file */ + if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) { + failure(); + } + + /* determine if ELFCLASS64 or not? */ + elf_ident = elf_getident(elf, NULL); + is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64); + + /* get the ELF header */ + if (is_elfclass64) { + ehdr = elf64_getehdr(elf); + } else { + ehdr = elf32_getehdr(elf); + } + if (ehdr == NULL) { + failure(); + } + + /* get the ELF section descriptor */ + if (is_elfclass64) { + scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx); + } else { + scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx); + } + if (scn == NULL) { + failure(); + } + + /* get the section header */ + if (is_elfclass64) { + shdr = elf64_getshdr(scn); + } else { + shdr = elf32_getshdr(scn); + } + if (shdr == NULL) { + failure(); + } + + (void) printf("Adding ELF data for new section name\n"); + (void) fflush(stdout); + name_dat = elf_newdata(scn); + name_dat->d_buf = (void *) SEC_NAME; + if (is_elfclass64) { + name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1; + } else { + name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1; + } + name_dat->d_align = 1; + name_dat->d_size = strlen(SEC_NAME) + 1; + + new_scn = elf_newscn(elf); + + if (is_elfclass64) { + new_shdr = elf64_getshdr(new_scn); + ((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE; + ((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS; + ((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size; + ((Elf64_Shdr *) new_shdr)->sh_addralign = 1; + ((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1); + } else { + new_shdr = elf32_getshdr(new_scn); + ((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE; + ((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS; + ((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size; + ((Elf32_Shdr *) new_shdr)->sh_addralign = 1; + ((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1); + } + + (void) printf("Adding ELF data for debug_info_path value\n"); + (void) fflush(stdout); + (void) memset(buffer, 0, sizeof buffer); + buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */ + (void) strncpy((char *) buffer, debug_info_path, buffer_len); + if (buffer_len % 4 != 0) { + /* not on a 4 byte boundary so pad to the next one */ + buffer_len += (4 - buffer_len % 4); + } + /* save the CRC */ + (void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc); + buffer_len += sizeof file_crc; + + link_dat = elf_newdata(new_scn); + link_dat->d_type = ELF_T_BYTE; + link_dat->d_size = buffer_len; + link_dat->d_buf = buffer; + link_dat->d_align = 1; + + (void) printf("Saving updates to '%s'\n", elf_obj); + (void) fflush(stdout); + (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */ + (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */ + (void) elf_end(elf); /* done with ELF obj */ + (void) close(fd); + + (void) printf("Done updating '%s'\n", elf_obj); + (void) fflush(stdout); + exit(0); +} /* end main */ + + +static void +failure() { + (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno())); + exit(5); +} + + +/* + * The CRC used in gnu_debuglink, retrieved from + * http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files. + */ + +static unsigned int +gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) { + static const unsigned int crc32_table[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d + }; + + unsigned char *end; + + crc = ~crc & 0xffffffff; + for (end = buf + len; buf < end; ++buf) { + crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8); + } + return ~crc & 0xffffffff; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c Fri Jun 08 17:13:09 2012 +0100 @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/* + * Name: fix_empty_sec_hdr_flags.c + * + * Description: Remove the SHF_ALLOC flag from "empty" section headers. + * An "empty" section header has sh_addr == 0 and sh_size == 0. + * + * This program is adapted from the example program shown on the + * elf(3elf) man page and from code from the Solaris compiler + * driver. + */ + +#include <fcntl.h> +#include <stdio.h> +#include <libelf.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +static void failure(void); + +void +main(int argc, char ** argv) { + void * ehdr; /* ELF header */ + unsigned int i; /* section counter */ + int fd; /* descriptor for file */ + Elf * elf; /* ELF descriptor */ + char * elf_ident; /* ELF identity string */ + char * elf_obj; /* elf_obj file */ + int fix_count; /* number of flags fixed */ + int is_elfclass64; /* is an ELFCLASS64 file? */ + Elf_Scn * scn; /* ELF section descriptor */ + void * shdr; /* ELF section header */ + Elf_Data * shstrtab; /* ELF section header string table */ + + if (argc != 2) { + (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]); + exit(2); + } + + /* open the elf_obj */ + elf_obj = argv[1]; + if ((fd = open(elf_obj, O_RDWR)) == -1) { + (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj); + exit(3); + } + + (void) printf("Opening '%s' for update\n", elf_obj); + (void) fflush(stdout); + (void) elf_version(EV_CURRENT); /* coordinate ELF versions */ + + /* obtain the ELF descriptors from the input file */ + if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) { + failure(); + } + + /* determine if ELFCLASS64 or not? */ + elf_ident = elf_getident(elf, NULL); + is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64); + + /* get the ELF header */ + if (is_elfclass64) { + ehdr = elf64_getehdr(elf); + } else { + ehdr = elf32_getehdr(elf); + } + if (ehdr == NULL) { + failure(); + } + + /* get the ELF section descriptor */ + if (is_elfclass64) { + scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx); + } else { + scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx); + } + if (scn == NULL) { + failure(); + } + + /* get the section header string table */ + shstrtab = elf_getdata(scn, NULL); + if (shstrtab == NULL) { + failure(); + } + + fix_count = 0; + + /* traverse the sections of the input file */ + for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) { + int has_flag_set; /* is SHF_ALLOC flag set? */ + int is_empty; /* is section empty? */ + char * name; /* short hand pointer */ + + /* get the section header */ + if (is_elfclass64) { + shdr = elf64_getshdr(scn); + } else { + shdr = elf32_getshdr(scn); + } + if (shdr == NULL) { + failure(); + } + + if (is_elfclass64) { + name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name; + } else { + name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name; + } + + if (is_elfclass64) { + has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC; + is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 && + ((Elf64_Shdr *) shdr)->sh_size == 0; + } else { + has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC; + is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 && + ((Elf32_Shdr *) shdr)->sh_size == 0; + } + + if (is_empty && has_flag_set) { + (void) printf("section[%u] '%s' is empty, " + "but SHF_ALLOC flag is set.\n", i, name); + (void) printf("Clearing the SHF_ALLOC flag.\n"); + + if (is_elfclass64) { + ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC; + } else { + ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC; + } + fix_count++; + } + } /* end for each ELF section */ + + if (fix_count > 0) { + (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj); + (void) fflush(stdout); + (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */ + (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */ + } else { + (void) printf("No SHF_ALLOC flags needed to be cleared.\n"); + } + + (void) elf_end(elf); /* done with ELF obj */ + (void) close(fd); + + (void) printf("Done %s '%s'\n", + (fix_count > 0) ? "updating" : "with", elf_obj); + (void) fflush(stdout); + exit(0); +} /* end main */ + + +static void +failure() { + (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno())); + exit(6); +}
--- a/src/os/solaris/vm/os_solaris.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/os/solaris/vm/os_solaris.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -2251,61 +2251,44 @@ return true; } +void os::print_os_info_brief(outputStream* st) { + os::Solaris::print_distro_info(st); + + os::Posix::print_uname_info(st); + + os::Solaris::print_libversion_info(st); +} + void os::print_os_info(outputStream* st) { st->print("OS:"); + os::Solaris::print_distro_info(st); + + os::Posix::print_uname_info(st); + + os::Solaris::print_libversion_info(st); + + os::Posix::print_rlimit_info(st); + + os::Posix::print_load_average(st); +} + +void os::Solaris::print_distro_info(outputStream* st) { if (!_print_ascii_file("/etc/release", st)) { - st->print("Solaris"); + st->print("Solaris"); + } + st->cr(); +} + +void os::Solaris::print_libversion_info(outputStream* st) { + if (os::Solaris::T2_libthread()) { + st->print(" (T2 libthread)"); + } + else { + st->print(" (T1 libthread)"); } st->cr(); - - // kernel - st->print("uname:"); - struct utsname name; - uname(&name); - st->print(name.sysname); st->print(" "); - st->print(name.release); st->print(" "); - st->print(name.version); st->print(" "); - st->print(name.machine); - - // libthread - if (os::Solaris::T2_libthread()) st->print(" (T2 libthread)"); - else st->print(" (T1 libthread)"); - st->cr(); - - // rlimit - st->print("rlimit:"); - struct rlimit rlim; - - st->print(" STACK "); - getrlimit(RLIMIT_STACK, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - - st->print(", CORE "); - getrlimit(RLIMIT_CORE, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - - st->print(", NOFILE "); - getrlimit(RLIMIT_NOFILE, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%d", rlim.rlim_cur); - - st->print(", AS "); - getrlimit(RLIMIT_AS, &rlim); - if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); - st->cr(); - - // load average - st->print("load average:"); - double loadavg[3]; - os::loadavg(loadavg, 3); - st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); - st->cr(); -} - +} static bool check_addr0(outputStream* st) { jboolean status = false;
--- a/src/os/solaris/vm/os_solaris.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/os/solaris/vm/os_solaris.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -180,6 +180,9 @@ // proc_t structure (note that this is a system struct). static address _main_stack_base; + static void print_distro_info(outputStream* st); + static void print_libversion_info(outputStream* st); + public: static void libthread_init(); static void synchronization_init();
--- a/src/os/windows/vm/os_windows.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/os/windows/vm/os_windows.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -1572,9 +1572,17 @@ enumerate_modules(pid, _print_module, (void *)st); } +void os::print_os_info_brief(outputStream* st) { + os::print_os_info(st); +} + void os::print_os_info(outputStream* st) { st->print("OS:"); + os::win32::print_windows_version(st); +} + +void os::win32::print_windows_version(outputStream* st) { OSVERSIONINFOEX osvi; ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
--- a/src/os/windows/vm/os_windows.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/os/windows/vm/os_windows.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -27,6 +27,7 @@ // Win32_OS defines the interface to windows operating systems class win32 { + friend class os; protected: static int _vm_page_size; @@ -39,6 +40,8 @@ static bool _is_windows_2003; static bool _is_windows_server; + static void print_windows_version(outputStream* st); + public: // Windows-specific interface: static void initialize_system_info();
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -522,11 +522,12 @@ if ((sig == SIGSEGV || sig == SIGBUS) && os::is_poll_address((address)info->si_addr)) { stub = SharedRuntime::get_poll_stub(pc); -#if defined(__APPLE__) && !defined(AMD64) +#if defined(__APPLE__) // 32-bit Darwin reports a SIGBUS for nearly all memory access exceptions. + // 64-bit Darwin may also use a SIGBUS (seen with compressed oops). // Catching SIGBUS here prevents the implicit SIGBUS NULL check below from // being called, so only do so if the implicit NULL check is not necessary. - } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((int)info->si_addr)) { + } else if (sig == SIGBUS && MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) { #else } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { #endif
--- a/src/share/vm/classfile/javaClasses.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/classfile/javaClasses.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,7 +143,27 @@ } +int java_lang_String::value_offset = 0; +int java_lang_String::offset_offset = 0; +int java_lang_String::count_offset = 0; +int java_lang_String::hash_offset = 0; + +bool java_lang_String::initialized = false; + +void java_lang_String::compute_offsets() { + assert(!initialized, "offsets should be initialized only once"); + + klassOop k = SystemDictionary::String_klass(); + compute_offset(value_offset, k, vmSymbols::value_name(), vmSymbols::char_array_signature()); + compute_optional_offset(offset_offset, k, vmSymbols::offset_name(), vmSymbols::int_signature()); + compute_optional_offset(count_offset, k, vmSymbols::count_name(), vmSymbols::int_signature()); + compute_optional_offset(hash_offset, k, vmSymbols::hash_name(), vmSymbols::int_signature()); + + initialized = true; +} + Handle java_lang_String::basic_create(int length, bool tenured, TRAPS) { + assert(initialized, "Must be initialized"); // Create the String object first, so there's a chance that the String // and the char array it points to end up in the same cache line. oop obj; @@ -2837,10 +2857,6 @@ -int java_lang_String::value_offset; -int java_lang_String::offset_offset; -int java_lang_String::count_offset; -int java_lang_String::hash_offset; int java_lang_Class::_klass_offset; int java_lang_Class::_array_klass_offset; int java_lang_Class::_resolved_constructor_offset; @@ -3000,12 +3016,6 @@ const int x = heapOopSize; const int header = instanceOopDesc::base_offset_in_bytes(); - // Do the String Class - java_lang_String::value_offset = java_lang_String::hc_value_offset * x + header; - java_lang_String::offset_offset = java_lang_String::hc_offset_offset * x + header; - java_lang_String::count_offset = java_lang_String::offset_offset + sizeof (jint); - java_lang_String::hash_offset = java_lang_String::count_offset + sizeof (jint); - // Throwable Class java_lang_Throwable::backtrace_offset = java_lang_Throwable::hc_backtrace_offset * x + header; java_lang_Throwable::detailMessage_offset = java_lang_Throwable::hc_detailMessage_offset * x + header; @@ -3200,9 +3210,13 @@ // java.lang.String CHECK_OFFSET("java/lang/String", java_lang_String, value, "[C"); - CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I"); - CHECK_OFFSET("java/lang/String", java_lang_String, count, "I"); - CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I"); + if (java_lang_String::has_offset_field()) { + CHECK_OFFSET("java/lang/String", java_lang_String, offset, "I"); + CHECK_OFFSET("java/lang/String", java_lang_String, count, "I"); + } + if (java_lang_String::has_hash_field()) { + CHECK_OFFSET("java/lang/String", java_lang_String, hash, "I"); + } // java.lang.Class
--- a/src/share/vm/classfile/javaClasses.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/classfile/javaClasses.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,26 +52,36 @@ class java_lang_String : AllStatic { private: - enum { - hc_value_offset = 0, - hc_offset_offset = 1 - //hc_count_offset = 2 -- not a word-scaled offset - //hc_hash_offset = 3 -- not a word-scaled offset - }; - static int value_offset; static int offset_offset; static int count_offset; static int hash_offset; + static bool initialized; + static Handle basic_create(int length, bool tenured, TRAPS); static Handle basic_create_from_unicode(jchar* unicode, int length, bool tenured, TRAPS); - static void set_value( oop string, typeArrayOop buffer) { string->obj_field_put(value_offset, (oop)buffer); } - static void set_offset(oop string, int offset) { string->int_field_put(offset_offset, offset); } - static void set_count( oop string, int count) { string->int_field_put(count_offset, count); } + static void set_value( oop string, typeArrayOop buffer) { + assert(initialized, "Must be initialized"); + string->obj_field_put(value_offset, (oop)buffer); + } + static void set_offset(oop string, int offset) { + assert(initialized, "Must be initialized"); + if (offset_offset > 0) { + string->int_field_put(offset_offset, offset); + } + } + static void set_count( oop string, int count) { + assert(initialized, "Must be initialized"); + if (count_offset > 0) { + string->int_field_put(count_offset, count); + } + } public: + static void compute_offsets(); + // Instance creation static Handle create_from_unicode(jchar* unicode, int len, TRAPS); static Handle create_tenured_from_unicode(jchar* unicode, int len, TRAPS); @@ -82,23 +92,61 @@ static Handle create_from_platform_dependent_str(const char* str, TRAPS); static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS); - static int value_offset_in_bytes() { return value_offset; } - static int count_offset_in_bytes() { return count_offset; } - static int offset_offset_in_bytes() { return offset_offset; } - static int hash_offset_in_bytes() { return hash_offset; } + static bool has_offset_field() { + assert(initialized, "Must be initialized"); + return (offset_offset > 0); + } + + static bool has_count_field() { + assert(initialized, "Must be initialized"); + return (count_offset > 0); + } + + static bool has_hash_field() { + assert(initialized, "Must be initialized"); + return (hash_offset > 0); + } + + static int value_offset_in_bytes() { + assert(initialized && (value_offset > 0), "Must be initialized"); + return value_offset; + } + static int count_offset_in_bytes() { + assert(initialized && (count_offset > 0), "Must be initialized"); + return count_offset; + } + static int offset_offset_in_bytes() { + assert(initialized && (offset_offset > 0), "Must be initialized"); + return offset_offset; + } + static int hash_offset_in_bytes() { + assert(initialized && (hash_offset > 0), "Must be initialized"); + return hash_offset; + } // Accessors static typeArrayOop value(oop java_string) { + assert(initialized && (value_offset > 0), "Must be initialized"); assert(is_instance(java_string), "must be java_string"); return (typeArrayOop) java_string->obj_field(value_offset); } static int offset(oop java_string) { + assert(initialized, "Must be initialized"); assert(is_instance(java_string), "must be java_string"); - return java_string->int_field(offset_offset); + if (offset_offset > 0) { + return java_string->int_field(offset_offset); + } else { + return 0; + } } static int length(oop java_string) { + assert(initialized, "Must be initialized"); assert(is_instance(java_string), "must be java_string"); - return java_string->int_field(count_offset); + if (count_offset > 0) { + return java_string->int_field(count_offset); + } else { + return ((typeArrayOop)java_string->obj_field(value_offset))->length(); + } } static int utf8_length(oop java_string);
--- a/src/share/vm/classfile/systemDictionary.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/classfile/systemDictionary.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -1971,6 +1971,9 @@ // first do Object, String, Class initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK); + // Calculate offsets for String and Class classes since they are loaded and + // can be used after this point. + java_lang_String::compute_offsets(); java_lang_Class::compute_offsets(); // Fixup mirrors for classes loaded before java.lang.Class.
--- a/src/share/vm/classfile/vmSymbols.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/classfile/vmSymbols.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -339,6 +339,9 @@ template(park_event_name, "nativeParkEventPointer") \ template(cache_field_name, "cache") \ template(value_name, "value") \ + template(offset_name, "offset") \ + template(count_name, "count") \ + template(hash_name, "hash") \ template(frontCacheEnabled_name, "frontCacheEnabled") \ template(stringCacheEnabled_name, "stringCacheEnabled") \ template(numberOfLeadingZeros_name, "numberOfLeadingZeros") \
--- a/src/share/vm/gc_implementation/shared/gcUtil.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/gc_implementation/shared/gcUtil.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -31,9 +31,15 @@ float average) { // We smooth the samples by not using weight() directly until we've // had enough data to make it meaningful. We'd like the first weight - // used to be 1, the second to be 1/2, etc until we have 100/weight - // samples. - unsigned count_weight = 100/count(); + // used to be 1, the second to be 1/2, etc until we have + // OLD_THRESHOLD/weight samples. + unsigned count_weight = 0; + + // Avoid division by zero if the counter wraps (7158457) + if (!is_old()) { + count_weight = OLD_THRESHOLD/count(); + } + unsigned adaptive_weight = (MAX2(weight(), count_weight)); float new_avg = exp_avg(average, new_sample, adaptive_weight); @@ -43,8 +49,6 @@ void AdaptiveWeightedAverage::sample(float new_sample) { increment_count(); - assert(count() != 0, - "Wraparound -- history would be incorrectly discarded"); // Compute the new weighted average float new_avg = compute_adaptive_average(new_sample, average());
--- a/src/share/vm/gc_implementation/shared/gcUtil.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/gc_implementation/shared/gcUtil.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -50,11 +50,20 @@ unsigned _weight; // The weight used to smooth the averages // A higher weight favors the most // recent data. + bool _is_old; // Has enough historical data + + const static unsigned OLD_THRESHOLD = 100; protected: float _last_sample; // The last value sampled. - void increment_count() { _sample_count++; } + void increment_count() { + _sample_count++; + if (!_is_old && _sample_count > OLD_THRESHOLD) { + _is_old = true; + } + } + void set_average(float avg) { _average = avg; } // Helper function, computes an adaptive weighted average @@ -64,13 +73,15 @@ public: // Input weight must be between 0 and 100 AdaptiveWeightedAverage(unsigned weight, float avg = 0.0) : - _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0) { + _average(avg), _sample_count(0), _weight(weight), _last_sample(0.0), + _is_old(false) { } void clear() { _average = 0; _sample_count = 0; _last_sample = 0; + _is_old = false; } // Useful for modifying static structures after startup. @@ -84,7 +95,8 @@ float average() const { return _average; } unsigned weight() const { return _weight; } unsigned count() const { return _sample_count; } - float last_sample() const { return _last_sample; } + float last_sample() const { return _last_sample; } + bool is_old() const { return _is_old; } // Update data with a new sample. void sample(float new_sample);
--- a/src/share/vm/memory/barrierSet.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/memory/barrierSet.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -181,6 +181,8 @@ // within the heap, this function tells whether they are met. virtual bool is_aligned(HeapWord* addr) = 0; + // Print a description of the memory for the barrier set + virtual void print_on(outputStream* st) const = 0; }; #endif // SHARE_VM_MEMORY_BARRIERSET_HPP
--- a/src/share/vm/memory/cardTableModRefBS.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/memory/cardTableModRefBS.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -711,6 +711,11 @@ } #endif +void CardTableModRefBS::print_on(outputStream* st) const { + st->print_cr("Card table byte_map: [" INTPTR_FORMAT "," INTPTR_FORMAT "] byte_map_base: " INTPTR_FORMAT, + _byte_map, _byte_map + _byte_map_size, byte_map_base); +} + bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) { return CardTableModRefBS::card_will_be_scanned(cv) ||
--- a/src/share/vm/memory/cardTableModRefBS.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/memory/cardTableModRefBS.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -469,6 +469,9 @@ return _byte_map + card_index; } + // Print a description of the memory for the barrier set + virtual void print_on(outputStream* st) const; + void verify(); void verify_guard();
--- a/src/share/vm/memory/dump.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/memory/dump.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -78,8 +78,8 @@ void do_oop(oop* p) { if (p != NULL) { oop obj = *p; - if (obj->klass() == SystemDictionary::String_klass()) { - + if (obj->klass() == SystemDictionary::String_klass() && + java_lang_String::has_hash_field()) { int hash = java_lang_String::hash_string(obj); obj->int_field_put(hash_offset, hash); }
--- a/src/share/vm/opto/graphKit.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/opto/graphKit.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3748,3 +3748,81 @@ final_sync(ideal); } #undef __ + + + +Node* GraphKit::load_String_offset(Node* ctrl, Node* str) { + if (java_lang_String::has_offset_field()) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* offset_field_type = string_type->add_offset(offset_offset); + int offset_field_idx = C->get_alias_index(offset_field_type); + return make_load(ctrl, + basic_plus_adr(str, str, offset_offset), + TypeInt::INT, T_INT, offset_field_idx); + } else { + return intcon(0); + } +} + +Node* GraphKit::load_String_length(Node* ctrl, Node* str) { + if (java_lang_String::has_count_field()) { + int count_offset = java_lang_String::count_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* count_field_type = string_type->add_offset(count_offset); + int count_field_idx = C->get_alias_index(count_field_type); + return make_load(ctrl, + basic_plus_adr(str, str, count_offset), + TypeInt::INT, T_INT, count_field_idx); + } else { + return load_array_length(load_String_value(ctrl, str)); + } +} + +Node* GraphKit::load_String_value(Node* ctrl, Node* str) { + int value_offset = java_lang_String::value_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* value_field_type = string_type->add_offset(value_offset); + const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, + TypeAry::make(TypeInt::CHAR,TypeInt::POS), + ciTypeArrayKlass::make(T_CHAR), true, 0); + int value_field_idx = C->get_alias_index(value_field_type); + return make_load(ctrl, basic_plus_adr(str, str, value_offset), + value_type, T_OBJECT, value_field_idx); +} + +void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) { + int offset_offset = java_lang_String::offset_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* offset_field_type = string_type->add_offset(offset_offset); + int offset_field_idx = C->get_alias_index(offset_field_type); + store_to_memory(ctrl, basic_plus_adr(str, offset_offset), + value, T_INT, offset_field_idx); +} + +void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) { + int value_offset = java_lang_String::value_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* value_field_type = string_type->add_offset(value_offset); + const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, + TypeAry::make(TypeInt::CHAR,TypeInt::POS), + ciTypeArrayKlass::make(T_CHAR), true, 0); + int value_field_idx = C->get_alias_index(value_field_type); + store_to_memory(ctrl, basic_plus_adr(str, value_offset), + value, T_OBJECT, value_field_idx); +} + +void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) { + int count_offset = java_lang_String::count_offset_in_bytes(); + const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), + false, NULL, 0); + const TypePtr* count_field_type = string_type->add_offset(count_offset); + int count_field_idx = C->get_alias_index(count_field_type); + store_to_memory(ctrl, basic_plus_adr(str, count_offset), + value, T_INT, count_field_idx); +}
--- a/src/share/vm/opto/graphKit.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/opto/graphKit.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -781,6 +781,14 @@ Node* new_array(Node* klass_node, Node* count_val, int nargs, Node* *return_size_val = NULL); + // java.lang.String helpers + Node* load_String_offset(Node* ctrl, Node* str); + Node* load_String_length(Node* ctrl, Node* str); + Node* load_String_value(Node* ctrl, Node* str); + void store_String_offset(Node* ctrl, Node* str, Node* value); + void store_String_length(Node* ctrl, Node* str, Node* value); + void store_String_value(Node* ctrl, Node* str, Node* value); + // Handy for making control flow IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) { IfNode* iff = new (C, 2) IfNode(ctrl, tst, prob, cnt);// New IfNode's
--- a/src/share/vm/opto/library_call.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/opto/library_call.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -147,7 +147,8 @@ return generate_method_call(method_id, true, false); } - Node* make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2); + Node* make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2); + Node* make_string_method_node(int opcode, Node* str1, Node* str2); bool inline_string_compareTo(); bool inline_string_indexOf(); Node* string_indexOf(Node* string_object, ciTypeArray* target_array, jint offset, jint cache_i, jint md2_i); @@ -844,48 +845,76 @@ //------------------------------make_string_method_node------------------------ -// Helper method for String intrinsic finctions. -Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* cnt1, Node* str2, Node* cnt2) { - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - +// Helper method for String intrinsic functions. This version is called +// with str1 and str2 pointing to String object nodes. +// +Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* str2) { Node* no_ctrl = NULL; - ciInstanceKlass* klass = env()->String_klass(); - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - - const TypeAryPtr* value_type = - TypeAryPtr::make(TypePtr::NotNull, - TypeAry::make(TypeInt::CHAR,TypeInt::POS), - ciTypeArrayKlass::make(T_CHAR), true, 0); - - // Get start addr of string and substring - Node* str1_valuea = basic_plus_adr(str1, str1, value_offset); - Node* str1_value = make_load(no_ctrl, str1_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); - Node* str1_offseta = basic_plus_adr(str1, str1, offset_offset); - Node* str1_offset = make_load(no_ctrl, str1_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); + // Get start addr of string + Node* str1_value = load_String_value(no_ctrl, str1); + Node* str1_offset = load_String_offset(no_ctrl, str1); Node* str1_start = array_element_address(str1_value, str1_offset, T_CHAR); - Node* str2_valuea = basic_plus_adr(str2, str2, value_offset); - Node* str2_value = make_load(no_ctrl, str2_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); - Node* str2_offseta = basic_plus_adr(str2, str2, offset_offset); - Node* str2_offset = make_load(no_ctrl, str2_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); + // Get length of string 1 + Node* str1_len = load_String_length(no_ctrl, str1); + + Node* str2_value = load_String_value(no_ctrl, str2); + Node* str2_offset = load_String_offset(no_ctrl, str2); Node* str2_start = array_element_address(str2_value, str2_offset, T_CHAR); + Node* str2_len = NULL; + Node* result = NULL; + + switch (opcode) { + case Op_StrIndexOf: + // Get length of string 2 + str2_len = load_String_length(no_ctrl, str2); + + result = new (C, 6) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str1_len, str2_start, str2_len); + break; + case Op_StrComp: + // Get length of string 2 + str2_len = load_String_length(no_ctrl, str2); + + result = new (C, 6) StrCompNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str1_len, str2_start, str2_len); + break; + case Op_StrEquals: + result = new (C, 5) StrEqualsNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str2_start, str1_len); + break; + default: + ShouldNotReachHere(); + return NULL; + } + + // All these intrinsics have checks. + C->set_has_split_ifs(true); // Has chance for split-if optimization + + return _gvn.transform(result); +} + +// Helper method for String intrinsic functions. This version is called +// with str1 and str2 pointing to char[] nodes, with cnt1 and cnt2 pointing +// to Int nodes containing the lenghts of str1 and str2. +// +Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1_start, Node* cnt1, Node* str2_start, Node* cnt2) { + Node* result = NULL; switch (opcode) { case Op_StrIndexOf: result = new (C, 6) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), - str1_start, cnt1, str2_start, cnt2); + str1_start, cnt1, str2_start, cnt2); break; case Op_StrComp: result = new (C, 6) StrCompNode(control(), memory(TypeAryPtr::CHARS), - str1_start, cnt1, str2_start, cnt2); + str1_start, cnt1, str2_start, cnt2); break; case Op_StrEquals: result = new (C, 5) StrEqualsNode(control(), memory(TypeAryPtr::CHARS), - str1_start, str2_start, cnt1); + str1_start, str2_start, cnt1); break; default: ShouldNotReachHere(); @@ -903,10 +932,6 @@ if (!Matcher::has_match_rule(Op_StrComp)) return false; - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - _sp += 2; Node *argument = pop(); // pop non-receiver first: it was pushed second Node *receiver = pop(); @@ -923,18 +948,7 @@ return true; } - ciInstanceKlass* klass = env()->String_klass(); - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - Node* no_ctrl = NULL; - - // Get counts for string and argument - Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); - Node* receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - - Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); - Node* argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - - Node* compare = make_string_method_node(Op_StrComp, receiver, receiver_cnt, argument, argument_cnt); + Node* compare = make_string_method_node(Op_StrComp, receiver, argument); push(compare); return true; } @@ -944,10 +958,6 @@ if (!Matcher::has_match_rule(Op_StrEquals)) return false; - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - int nargs = 2; _sp += nargs; Node* argument = pop(); // pop non-receiver first: it was pushed second @@ -1001,24 +1011,31 @@ } } - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - - Node* no_ctrl = NULL; - Node* receiver_cnt; - Node* argument_cnt; - if (!stopped()) { + const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); + // Properly cast the argument to String argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type)); // This path is taken only when argument's type is String:NotNull. argument = cast_not_null(argument, false); - // Get counts for string and argument - Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); - receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - - Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); - argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + Node* no_ctrl = NULL; + + // Get start addr of receiver + Node* receiver_val = load_String_value(no_ctrl, receiver); + Node* receiver_offset = load_String_offset(no_ctrl, receiver); + Node* receiver_start = array_element_address(receiver_val, receiver_offset, T_CHAR); + + // Get length of receiver + Node* receiver_cnt = load_String_length(no_ctrl, receiver); + + // Get start addr of argument + Node* argument_val = load_String_value(no_ctrl, argument); + Node* argument_offset = load_String_offset(no_ctrl, argument); + Node* argument_start = array_element_address(argument_val, argument_offset, T_CHAR); + + // Get length of argument + Node* argument_cnt = load_String_length(no_ctrl, argument); // Check for receiver count != argument count Node* cmp = _gvn.transform( new(C, 3) CmpINode(receiver_cnt, argument_cnt) ); @@ -1028,14 +1045,14 @@ phi->init_req(4, intcon(0)); region->init_req(4, if_ne); } - } - - // Check for count == 0 is done by mach node StrEquals. - - if (!stopped()) { - Node* equals = make_string_method_node(Op_StrEquals, receiver, receiver_cnt, argument, argument_cnt); - phi->init_req(1, equals); - region->init_req(1, control()); + + // Check for count == 0 is done by assembler code for StrEquals. + + if (!stopped()) { + Node* equals = make_string_method_node(Op_StrEquals, receiver_start, receiver_cnt, argument_start, argument_cnt); + phi->init_req(1, equals); + region->init_req(1, control()); + } } // post merge @@ -1133,20 +1150,9 @@ const int nargs = 2; // number of arguments to push back for uncommon trap in predicate - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - - ciInstanceKlass* klass = env()->String_klass(); - const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); - const TypeAryPtr* source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0); - - Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset); - Node* sourceOffset = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); - Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset); - Node* sourceCount = make_load(no_ctrl, sourceCounta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - Node* sourcea = basic_plus_adr(string_object, string_object, value_offset); - Node* source = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset)); + Node* source = load_String_value(no_ctrl, string_object); + Node* sourceOffset = load_String_offset(no_ctrl, string_object); + Node* sourceCount = load_String_length(no_ctrl, string_object); Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) ); jint target_length = target_array->length(); @@ -1214,10 +1220,6 @@ //------------------------------inline_string_indexOf------------------------ bool LibraryCallKit::inline_string_indexOf() { - const int value_offset = java_lang_String::value_offset_in_bytes(); - const int count_offset = java_lang_String::count_offset_in_bytes(); - const int offset_offset = java_lang_String::offset_offset_in_bytes(); - _sp += 2; Node *argument = pop(); // pop non-receiver first: it was pushed second Node *receiver = pop(); @@ -1251,12 +1253,21 @@ Node* result_phi = new (C, 4) PhiNode(result_rgn, TypeInt::INT); Node* no_ctrl = NULL; - // Get counts for string and substr - Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset); - Node* source_cnt = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); - - Node* substr_cnta = basic_plus_adr(argument, argument, count_offset); - Node* substr_cnt = make_load(no_ctrl, substr_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); + // Get start addr of source string + Node* source = load_String_value(no_ctrl, receiver); + Node* source_offset = load_String_offset(no_ctrl, receiver); + Node* source_start = array_element_address(source, source_offset, T_CHAR); + + // Get length of source string + Node* source_cnt = load_String_length(no_ctrl, receiver); + + // Get start addr of substring + Node* substr = load_String_value(no_ctrl, argument); + Node* substr_offset = load_String_offset(no_ctrl, argument); + Node* substr_start = array_element_address(substr, substr_offset, T_CHAR); + + // Get length of source string + Node* substr_cnt = load_String_length(no_ctrl, argument); // Check for substr count > string count Node* cmp = _gvn.transform( new(C, 3) CmpINode(substr_cnt, source_cnt) ); @@ -1279,7 +1290,7 @@ } if (!stopped()) { - result = make_string_method_node(Op_StrIndexOf, receiver, source_cnt, argument, substr_cnt); + result = make_string_method_node(Op_StrIndexOf, source_start, source_cnt, substr_start, substr_cnt); result_phi->init_req(1, result); result_rgn->init_req(1, control()); } @@ -1304,11 +1315,19 @@ ciInstance* str = str_const->as_instance(); assert(str != NULL, "must be instance"); - ciObject* v = str->field_value_by_offset(value_offset).as_object(); - int o = str->field_value_by_offset(offset_offset).as_int(); - int c = str->field_value_by_offset(count_offset).as_int(); + ciObject* v = str->field_value_by_offset(java_lang_String::value_offset_in_bytes()).as_object(); ciTypeArray* pat = v->as_type_array(); // pattern (argument) character array + int o; + int c; + if (java_lang_String::has_offset_field()) { + o = str->field_value_by_offset(java_lang_String::offset_offset_in_bytes()).as_int(); + c = str->field_value_by_offset(java_lang_String::count_offset_in_bytes()).as_int(); + } else { + o = 0; + c = pat->length(); + } + // constant strings have no offset and count == length which // simplifies the resulting code somewhat so lets optimize for that. if (o != 0 || c != pat->length()) {
--- a/src/share/vm/opto/stringopts.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/opto/stringopts.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -528,16 +528,6 @@ } // Collect the types needed to talk about the various slices of memory - const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), - false, NULL, 0); - - const TypePtr* value_field_type = string_type->add_offset(java_lang_String::value_offset_in_bytes()); - const TypePtr* offset_field_type = string_type->add_offset(java_lang_String::offset_offset_in_bytes()); - const TypePtr* count_field_type = string_type->add_offset(java_lang_String::count_offset_in_bytes()); - - value_field_idx = C->get_alias_index(value_field_type); - count_field_idx = C->get_alias_index(count_field_type); - offset_field_idx = C->get_alias_index(offset_field_type); char_adr_idx = C->get_alias_index(TypeAryPtr::CHARS); // For each locally allocated StringBuffer see if the usages can be @@ -1173,18 +1163,9 @@ Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start) { Node* string = str; - Node* offset = kit.make_load(kit.control(), - kit.basic_plus_adr(string, string, java_lang_String::offset_offset_in_bytes()), - TypeInt::INT, T_INT, offset_field_idx); - Node* count = kit.make_load(kit.control(), - kit.basic_plus_adr(string, string, java_lang_String::count_offset_in_bytes()), - TypeInt::INT, T_INT, count_field_idx); - const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, - TypeAry::make(TypeInt::CHAR,TypeInt::POS), - ciTypeArrayKlass::make(T_CHAR), true, 0); - Node* value = kit.make_load(kit.control(), - kit.basic_plus_adr(string, string, java_lang_String::value_offset_in_bytes()), - value_type, T_OBJECT, value_field_idx); + Node* offset = kit.load_String_offset(kit.control(), string); + Node* count = kit.load_String_length(kit.control(), string); + Node* value = kit.load_String_value (kit.control(), string); // copy the contents if (offset->is_Con() && count->is_Con() && value->is_Con() && count->get_int() < unroll_string_copy_length) { @@ -1341,10 +1322,9 @@ arg = phi; sc->set_argument(argi, arg); } - // Node* offset = kit.make_load(NULL, kit.basic_plus_adr(arg, arg, offset_offset), - // TypeInt::INT, T_INT, offset_field_idx); - Node* count = kit.make_load(kit.control(), kit.basic_plus_adr(arg, arg, java_lang_String::count_offset_in_bytes()), - TypeInt::INT, T_INT, count_field_idx); + + Node* count = kit.load_String_length(kit.control(), arg); + length = __ AddI(length, count); string_sizes->init_req(argi, NULL); break; @@ -1435,12 +1415,11 @@ } // Intialize the string - kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::offset_offset_in_bytes()), - __ intcon(0), T_INT, offset_field_idx); - kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::count_offset_in_bytes()), - length, T_INT, count_field_idx); - kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::value_offset_in_bytes()), - char_array, T_OBJECT, value_field_idx); + if (java_lang_String::has_offset_field()) { + kit.store_String_offset(kit.control(), result, __ intcon(0)); + kit.store_String_length(kit.control(), result, length); + } + kit.store_String_value(kit.control(), result, char_array); // hook up the outgoing control and result kit.replace_call(sc->end(), result);
--- a/src/share/vm/opto/stringopts.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/opto/stringopts.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,9 +41,6 @@ // Memory slices needed for code gen int char_adr_idx; - int value_field_idx; - int count_field_idx; - int offset_field_idx; // Integer.sizeTable - used for int to String conversion ciField* size_table_field;
--- a/src/share/vm/runtime/arguments.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/runtime/arguments.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -3022,7 +3022,7 @@ return result; } -#ifdef JAVASE_EMBEDDED +#if (defined JAVASE_EMBEDDED || defined ARM) UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); #endif
--- a/src/share/vm/runtime/os.hpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/runtime/os.hpp Fri Jun 08 17:13:09 2012 +0100 @@ -490,6 +490,7 @@ // Print out system information; they are called by fatal error handler. // Output format may be different on different platforms. static void print_os_info(outputStream* st); + static void print_os_info_brief(outputStream* st); static void print_cpu_info(outputStream* st); static void pd_print_cpu_info(outputStream* st); static void print_memory_info(outputStream* st); @@ -683,14 +684,17 @@ // Platform dependent stuff #ifdef TARGET_OS_FAMILY_linux # include "os_linux.hpp" +# include "os_posix.hpp" #endif #ifdef TARGET_OS_FAMILY_solaris # include "os_solaris.hpp" +# include "os_posix.hpp" #endif #ifdef TARGET_OS_FAMILY_windows # include "os_windows.hpp" #endif #ifdef TARGET_OS_FAMILY_bsd +# include "os_posix.hpp" # include "os_bsd.hpp" #endif #ifdef TARGET_OS_ARCH_linux_x86
--- a/src/share/vm/utilities/vmError.cpp Wed May 23 20:37:54 2012 +0100 +++ b/src/share/vm/utilities/vmError.cpp Fri Jun 08 17:13:09 2012 +0100 @@ -692,6 +692,12 @@ // extended (i.e., more detailed) version. Universe::print_on(st, true /* extended */); st->cr(); + + Universe::heap()->barrier_set()->print_on(st); + st->cr(); + + st->print_cr("Polling page: " INTPTR_FORMAT, os::get_polling_page()); + st->cr(); } STEP(195, "(printing code cache information)" )