Mon, 01 Dec 2014 11:29:12 -0800
Merge
1.1 --- a/.hgtags Wed Nov 19 15:02:01 2014 -0800 1.2 +++ b/.hgtags Mon Dec 01 11:29:12 2014 -0800 1.3 @@ -555,6 +555,9 @@ 1.4 6e56d7f1634f6c4cd4196e699c06e6ca2e6d6efb jdk8u31-b05 1.5 271a32147391d08b0f338d9353330e2b5584d580 jdk8u31-b06 1.6 e9f815c3f21cf2febd8e3c185917c1519aa52d9a jdk8u31-b07 1.7 +cc74ca22516644867be3b8db6c1f8d05ab4f6c27 jdk8u31-b08 1.8 +245d29ed5db5ad6914eb0c9fe78b9ba26122c478 jdk8u31-b09 1.9 +d7b6bdd51abe68b16411d5b292fb830a43c5bc09 jdk8u31-b10 1.10 1b3abbeee961dee49780c0e4af5337feb918c555 jdk8u40-b10 1.11 f10fe402dfb1543723b4b117a7cba3ea3d4159f1 hs25.40-b15 1.12 99372b2fee0eb8b3452f47230e84aa6e97003184 jdk8u40-b11 1.13 @@ -565,4 +568,7 @@ 1.14 4d5dc0d0f8799fafa1135d51d85edd4edd566501 hs25.40-b18 1.15 b8ca8ec1daea70f7c0d519e866f9f147ec247055 jdk8u40-b14 1.16 eb16b24e2eba9bdf04a9b377bebc2db9f713ff5e jdk8u40-b15 1.17 +3a8a0fd171c5876023112941b1c7254262f9adfc hs25.40-b19 1.18 +aa2442f89230dc46147c721812f3b3bd4c612e83 hs25.40-b20 1.19 +5ea68fb91139081304357f9b937f32c5fdfeca6d jdk8u40-b16 1.20 b95f13f05f553309cd74d6ccf8fcedb259c6716c jdk8u45-b00
2.1 --- a/make/solaris/makefiles/add_gnu_debuglink.make Wed Nov 19 15:02:01 2014 -0800 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,54 +0,0 @@ 2.4 -# 2.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 2.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 -# 2.8 -# This code is free software; you can redistribute it and/or modify it 2.9 -# under the terms of the GNU General Public License version 2 only, as 2.10 -# published by the Free Software Foundation. 2.11 -# 2.12 -# This code is distributed in the hope that it will be useful, but WITHOUT 2.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.14 -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.15 -# version 2 for more details (a copy is included in the LICENSE file that 2.16 -# accompanied this code). 2.17 -# 2.18 -# You should have received a copy of the GNU General Public License version 2.19 -# 2 along with this work; if not, write to the Free Software Foundation, 2.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.21 -# 2.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.23 -# or visit www.oracle.com if you need additional information or have any 2.24 -# questions. 2.25 -# 2.26 -# 2.27 - 2.28 -# Rules to build add_gnu_debuglink, used by vm.make on Solaris 2.29 - 2.30 -# Allow $(ADD_GNU_DEBUGLINK) to be called from any directory. 2.31 -# We don't set or use the GENERATED macro to avoid affecting 2.32 -# other HotSpot Makefiles. 2.33 -TOPDIR = $(shell echo `pwd`) 2.34 -ADD_GNU_DEBUGLINK = $(TOPDIR)/../generated/add_gnu_debuglink 2.35 - 2.36 -ADD_GNU_DEBUGLINK_DIR = $(GAMMADIR)/src/os/solaris/add_gnu_debuglink 2.37 -ADD_GNU_DEBUGLINK_SRC = $(ADD_GNU_DEBUGLINK_DIR)/add_gnu_debuglink.c 2.38 -ADD_GNU_DEBUGLINK_FLAGS = 2.39 -LIBS_ADD_GNU_DEBUGLINK += -lelf 2.40 - 2.41 -ifeq ("${Platform_compiler}", "sparcWorks") 2.42 -# Enable the following ADD_GNU_DEBUGLINK_FLAGS addition if you need to 2.43 -# compare the built ELF objects. 2.44 -# 2.45 -# The -g option makes static data global and the "-W0,-noglobal" 2.46 -# option tells the compiler to not globalize static data using a unique 2.47 -# globalization prefix. Instead force the use of a static globalization 2.48 -# prefix based on the source filepath so the objects from two identical 2.49 -# compilations are the same. 2.50 -# 2.51 -# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't 2.52 -# seem to work. I got "-W0,-noglobal" from Kelly and that works. 2.53 -#ADD_GNU_DEBUGLINK_FLAGS += -W0,-noglobal 2.54 -endif # Platform_compiler == sparcWorks 2.55 - 2.56 -$(ADD_GNU_DEBUGLINK): $(ADD_GNU_DEBUGLINK_SRC) 2.57 - $(CC) -g -o $@ $< $(ADD_GNU_DEBUGLINK_FLAGS) $(LIBS_ADD_GNU_DEBUGLINK)
3.1 --- a/make/solaris/makefiles/defs.make Wed Nov 19 15:02:01 2014 -0800 3.2 +++ b/make/solaris/makefiles/defs.make Mon Dec 01 11:29:12 2014 -0800 3.3 @@ -1,5 +1,5 @@ 3.4 # 3.5 -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 3.6 +# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. 3.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 # 3.9 # This code is free software; you can redistribute it and/or modify it 3.10 @@ -133,6 +133,55 @@ 3.11 OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) 3.12 endif 3.13 3.14 + ifneq ($(OBJCOPY),) 3.15 + # OBJCOPY version check: 3.16 + # - version number is last blank separate word on first line 3.17 + # - version number formats that have been seen: 3.18 + # - <major>.<minor> 3.19 + # - <major>.<minor>.<micro> 3.20 + # 3.21 + # Full Debug Symbols on Solaris needs version 2.21.1 or newer. 3.22 + # 3.23 + OBJCOPY_VERS_CHK := $(shell \ 3.24 + $(OBJCOPY) --version \ 3.25 + | sed -n \ 3.26 + -e 's/.* //' \ 3.27 + -e '/^[01]\./b bad' \ 3.28 + -e '/^2\./{' \ 3.29 + -e ' s/^2\.//' \ 3.30 + -e ' /^[0-9]$$/b bad' \ 3.31 + -e ' /^[0-9]\./b bad' \ 3.32 + -e ' /^1[0-9]$$/b bad' \ 3.33 + -e ' /^1[0-9]\./b bad' \ 3.34 + -e ' /^20\./b bad' \ 3.35 + -e ' /^21\.0$$/b bad' \ 3.36 + -e ' /^21\.0\./b bad' \ 3.37 + -e '}' \ 3.38 + -e ':good' \ 3.39 + -e 's/.*/VALID_VERSION/p' \ 3.40 + -e 'q' \ 3.41 + -e ':bad' \ 3.42 + -e 's/.*/BAD_VERSION/p' \ 3.43 + -e 'q' \ 3.44 + ) 3.45 + ifeq ($(OBJCOPY_VERS_CHK),BAD_VERSION) 3.46 + _JUNK_ := $(shell \ 3.47 + echo >&2 "WARNING: $(OBJCOPY) --version info:"; \ 3.48 + $(OBJCOPY) --version | sed -n -e 's/^/WARNING: /p' -e 'q' >&2; \ 3.49 + echo >&2 "WARNING: an objcopy version of 2.21.1 or newer" \ 3.50 + "is needed to create valid .debuginfo files."; \ 3.51 + echo >&2 "WARNING: ignoring above objcopy command."; \ 3.52 + echo >&2 "WARNING: patch 149063-01 or newer contains the" \ 3.53 + "correct Solaris 10 SPARC version."; \ 3.54 + echo >&2 "WARNING: patch 149064-01 or newer contains the" \ 3.55 + "correct Solaris 10 X86 version."; \ 3.56 + echo >&2 "WARNING: Solaris 11 Update 1 contains the" \ 3.57 + "correct version."; \ 3.58 + ) 3.59 + OBJCOPY= 3.60 + endif 3.61 + endif 3.62 + 3.63 ifeq ($(OBJCOPY),) 3.64 _JUNK_ := $(shell \ 3.65 echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.")
4.1 --- a/make/solaris/makefiles/dtrace.make Wed Nov 19 15:02:01 2014 -0800 4.2 +++ b/make/solaris/makefiles/dtrace.make Mon Dec 01 11:29:12 2014 -0800 4.3 @@ -1,5 +1,5 @@ 4.4 # 4.5 -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 4.6 +# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. 4.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 # 4.9 # This code is free software; you can redistribute it and/or modify it 4.10 @@ -96,25 +96,16 @@ 4.11 XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO) 4.12 XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ) 4.13 4.14 -$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) 4.15 +$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) 4.16 @echo Making $@ 4.17 $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ 4.18 $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ 4.19 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc 4.20 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 4.21 -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. 4.22 -# Clear the SHF_ALLOC flag (if set) from empty section headers. 4.23 -# An empty section header has sh_addr == 0 and sh_size == 0. 4.24 -# This problem has only been seen on Solaris X64, but we call this tool 4.25 -# on all Solaris builds just in case. 4.26 - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ 4.27 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO) 4.28 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. 4.29 -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. 4.30 -# $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ; 4.31 # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not 4.32 # in the link name: 4.33 - ( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ) 4.34 + ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ) 4.35 ifeq ($(STRIP_POLICY),all_strip) 4.36 $(QUIETLY) $(STRIP) $@ 4.37 else 4.38 @@ -131,20 +122,16 @@ 4.39 endif 4.40 endif 4.41 4.42 -$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) 4.43 +$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) 4.44 @echo Making $@ 4.45 $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ 4.46 $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \ 4.47 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor 4.48 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 4.49 -# Clear the SHF_ALLOC flag (if set) from empty section headers. 4.50 - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ 4.51 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO) 4.52 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. 4.53 -# $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ; 4.54 # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not 4.55 # in the link name: 4.56 - ( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ) 4.57 + ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ) 4.58 ifeq ($(STRIP_POLICY),all_strip) 4.59 $(QUIETLY) $(STRIP) $@ 4.60 else 4.61 @@ -201,17 +188,13 @@ 4.62 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp 4.63 $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp 4.64 4.65 -$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) 4.66 +$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) 4.67 @echo Making $@ 4.68 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ 4.69 $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc 4.70 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 4.71 -# Clear the SHF_ALLOC flag (if set) from empty section headers. 4.72 - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ 4.73 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO) 4.74 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. 4.75 -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ 4.76 - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@ 4.77 + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ 4.78 ifeq ($(STRIP_POLICY),all_strip) 4.79 $(QUIETLY) $(STRIP) $@ 4.80 else 4.81 @@ -226,17 +209,13 @@ 4.82 endif 4.83 endif 4.84 4.85 -$(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) 4.86 +$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) 4.87 @echo Making $@ 4.88 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ 4.89 $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor 4.90 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 4.91 -# Clear the SHF_ALLOC flag (if set) from empty section headers. 4.92 - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ 4.93 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO) 4.94 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. 4.95 -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ 4.96 - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@ 4.97 + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ 4.98 ifeq ($(STRIP_POLICY),all_strip) 4.99 $(QUIETLY) $(STRIP) $@ 4.100 else
5.1 --- a/make/solaris/makefiles/fix_empty_sec_hdr_flags.make Wed Nov 19 15:02:01 2014 -0800 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,54 +0,0 @@ 5.4 -# 5.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 5.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 -# 5.8 -# This code is free software; you can redistribute it and/or modify it 5.9 -# under the terms of the GNU General Public License version 2 only, as 5.10 -# published by the Free Software Foundation. 5.11 -# 5.12 -# This code is distributed in the hope that it will be useful, but WITHOUT 5.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.14 -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.15 -# version 2 for more details (a copy is included in the LICENSE file that 5.16 -# accompanied this code). 5.17 -# 5.18 -# You should have received a copy of the GNU General Public License version 5.19 -# 2 along with this work; if not, write to the Free Software Foundation, 5.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.21 -# 5.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.23 -# or visit www.oracle.com if you need additional information or have any 5.24 -# questions. 5.25 -# 5.26 -# 5.27 - 5.28 -# Rules to build fix_empty_sec_hdr_flags, used by vm.make on Solaris 5.29 - 5.30 -# Allow $(FIX_EMPTY_SEC_HDR_FLAGS) to be called from any directory. 5.31 -# We don't set or use the GENERATED macro to avoid affecting 5.32 -# other HotSpot Makefiles. 5.33 -TOPDIR = $(shell echo `pwd`) 5.34 -FIX_EMPTY_SEC_HDR_FLAGS = $(TOPDIR)/../generated/fix_empty_sec_hdr_flags 5.35 - 5.36 -FIX_EMPTY_SEC_HDR_FLAGS_DIR = $(GAMMADIR)/src/os/solaris/fix_empty_sec_hdr_flags 5.37 -FIX_EMPTY_SEC_HDR_FLAGS_SRC = $(FIX_EMPTY_SEC_HDR_FLAGS_DIR)/fix_empty_sec_hdr_flags.c 5.38 -FIX_EMPTY_SEC_HDR_FLAGS_FLAGS = 5.39 -LIBS_FIX_EMPTY_SEC_HDR_FLAGS += -lelf 5.40 - 5.41 -ifeq ("${Platform_compiler}", "sparcWorks") 5.42 -# Enable the following FIX_EMPTY_SEC_HDR_FLAGS_FLAGS addition if you need to 5.43 -# compare the built ELF objects. 5.44 -# 5.45 -# The -g option makes static data global and the "-W0,-noglobal" 5.46 -# option tells the compiler to not globalize static data using a unique 5.47 -# globalization prefix. Instead force the use of a static globalization 5.48 -# prefix based on the source filepath so the objects from two identical 5.49 -# compilations are the same. 5.50 -# 5.51 -# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't 5.52 -# seem to work. I got "-W0,-noglobal" from Kelly and that works. 5.53 -#FIX_EMPTY_SEC_HDR_FLAGS_FLAGS += -W0,-noglobal 5.54 -endif # Platform_compiler == sparcWorks 5.55 - 5.56 -$(FIX_EMPTY_SEC_HDR_FLAGS): $(FIX_EMPTY_SEC_HDR_FLAGS_SRC) 5.57 - $(CC) -g -o $@ $< $(FIX_EMPTY_SEC_HDR_FLAGS_FLAGS) $(LIBS_FIX_EMPTY_SEC_HDR_FLAGS)
6.1 --- a/make/solaris/makefiles/jsig.make Wed Nov 19 15:02:01 2014 -0800 6.2 +++ b/make/solaris/makefiles/jsig.make Mon Dec 01 11:29:12 2014 -0800 6.3 @@ -1,5 +1,5 @@ 6.4 # 6.5 -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 6.6 +# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. 6.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 # 6.9 # This code is free software; you can redistribute it and/or modify it 6.10 @@ -47,22 +47,13 @@ 6.11 LFLAGS_JSIG += -mt -xnolib 6.12 endif 6.13 6.14 -$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) 6.15 +$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) 6.16 @echo Making signal interposition lib... 6.17 $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ 6.18 $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl 6.19 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 6.20 -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. 6.21 -# Clear the SHF_ALLOC flag (if set) from empty section headers. 6.22 -# An empty section header has sh_addr == 0 and sh_size == 0. 6.23 -# This problem has only been seen on Solaris X64, but we call this tool 6.24 -# on all Solaris builds just in case. 6.25 - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ 6.26 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) 6.27 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. 6.28 -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. 6.29 -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ 6.30 - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJSIG_DEBUGINFO) $@ 6.31 + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ 6.32 ifeq ($(STRIP_POLICY),all_strip) 6.33 $(QUIETLY) $(STRIP) $@ 6.34 else
7.1 --- a/make/solaris/makefiles/saproc.make Wed Nov 19 15:02:01 2014 -0800 7.2 +++ b/make/solaris/makefiles/saproc.make Mon Dec 01 11:29:12 2014 -0800 7.3 @@ -1,5 +1,5 @@ 7.4 # 7.5 -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 7.6 +# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. 7.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 # 7.9 # This code is free software; you can redistribute it and/or modify it 7.10 @@ -90,7 +90,7 @@ 7.11 #SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER 7.12 7.13 7.14 -$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE) 7.15 +$(LIBSAPROC): $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE) 7.16 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ 7.17 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ 7.18 exit 1; \ 7.19 @@ -121,17 +121,8 @@ 7.20 -c -o $(SADISOBJ) 7.21 7.22 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 7.23 -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. 7.24 -# Clear the SHF_ALLOC flag (if set) from empty section headers. 7.25 -# An empty section header has sh_addr == 0 and sh_size == 0. 7.26 -# This problem has only been seen on Solaris X64, but we call this tool 7.27 -# on all Solaris builds just in case. 7.28 - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ 7.29 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO) 7.30 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. 7.31 -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. 7.32 -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ 7.33 - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBSAPROC_DEBUGINFO) $@ 7.34 + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ 7.35 ifeq ($(STRIP_POLICY),all_strip) 7.36 $(QUIETLY) $(STRIP) $@ 7.37 else
8.1 --- a/make/solaris/makefiles/vm.make Wed Nov 19 15:02:01 2014 -0800 8.2 +++ b/make/solaris/makefiles/vm.make Mon Dec 01 11:29:12 2014 -0800 8.3 @@ -1,5 +1,5 @@ 8.4 # 8.5 -# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 8.6 +# Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. 8.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 # 8.9 # This code is free software; you can redistribute it and/or modify it 8.10 @@ -153,14 +153,6 @@ 8.11 include $(MAKEFILES_DIR)/dtrace.make 8.12 8.13 #---------------------------------------------------------------------- 8.14 -# add_gnu_debuglink tool 8.15 -include $(MAKEFILES_DIR)/add_gnu_debuglink.make 8.16 - 8.17 -#---------------------------------------------------------------------- 8.18 -# fix_empty_sec_hdr_flags tool 8.19 -include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make 8.20 - 8.21 -#---------------------------------------------------------------------- 8.22 # JVM 8.23 8.24 JVM = jvm 8.25 @@ -299,7 +291,7 @@ 8.26 LINK_VM = $(LINK_LIB.CXX) 8.27 endif 8.28 # making the library: 8.29 -$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE) 8.30 +$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) 8.31 ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) 8.32 @echo Linking vm... 8.33 $(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK) 8.34 @@ -307,17 +299,8 @@ 8.35 $(QUIETLY) $(LINK_LIB.CXX/POST_HOOK) 8.36 $(QUIETLY) rm -f $@.1 && ln -s $@ $@.1 8.37 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 8.38 -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. 8.39 -# Clear the SHF_ALLOC flag (if set) from empty section headers. 8.40 -# An empty section header has sh_addr == 0 and sh_size == 0. 8.41 -# This problem has only been seen on Solaris X64, but we call this tool 8.42 -# on all Solaris builds just in case. 8.43 - $(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@ 8.44 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) 8.45 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. 8.46 -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. 8.47 -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ 8.48 - $(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@ 8.49 + $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ 8.50 ifeq ($(STRIP_POLICY),all_strip) 8.51 $(QUIETLY) $(STRIP) $@ 8.52 else
9.1 --- a/make/windows/makefiles/compile.make Wed Nov 19 15:02:01 2014 -0800 9.2 +++ b/make/windows/makefiles/compile.make Mon Dec 01 11:29:12 2014 -0800 9.3 @@ -268,7 +268,7 @@ 9.4 !endif 9.5 LD_FLAGS= $(LD_FLAGS) kernel32.lib user32.lib gdi32.lib winspool.lib \ 9.6 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \ 9.7 - uuid.lib Wsock32.lib winmm.lib /nologo /machine:$(MACHINE) /opt:REF \ 9.8 + uuid.lib Wsock32.lib winmm.lib version.lib /nologo /machine:$(MACHINE) /opt:REF \ 9.9 /opt:ICF,8 9.10 !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" 9.11 LD_FLAGS= $(LD_FLAGS) /map /debug
10.1 --- a/make/windows/makefiles/sa.make Wed Nov 19 15:02:01 2014 -0800 10.2 +++ b/make/windows/makefiles/sa.make Mon Dec 01 11:29:12 2014 -0800 10.3 @@ -111,7 +111,7 @@ 10.4 SA_LFLAGS = $(SA_LFLAGS) -map -debug 10.5 !endif 10.6 !if "$(BUILDARCH)" == "i486" 10.7 -SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS) 10.8 +SA_LFLAGS = /SAFESEH $(SA_LFLAGS) 10.9 !endif 10.10 10.11 SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG)
11.1 --- a/src/cpu/ppc/vm/assembler_ppc.cpp Wed Nov 19 15:02:01 2014 -0800 11.2 +++ b/src/cpu/ppc/vm/assembler_ppc.cpp Mon Dec 01 11:29:12 2014 -0800 11.3 @@ -1,5 +1,5 @@ 11.4 /* 11.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 11.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 11.7 * Copyright 2012, 2014 SAP AG. All rights reserved. 11.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.9 * 11.10 @@ -693,7 +693,7 @@ 11.11 // PPC 1, section 4.6.7 Floating-Point Compare Instructions 11.12 fcmpu( CCR7, F24, F25); 11.13 11.14 - tty->print_cr("\ntest_asm disassembly (0x%lx 0x%lx):", code()->insts_begin(), code()->insts_end()); 11.15 + tty->print_cr("\ntest_asm disassembly (0x%lx 0x%lx):", p2i(code()->insts_begin()), p2i(code()->insts_end())); 11.16 code()->decode(); 11.17 } 11.18
12.1 --- a/src/cpu/ppc/vm/compiledIC_ppc.cpp Wed Nov 19 15:02:01 2014 -0800 12.2 +++ b/src/cpu/ppc/vm/compiledIC_ppc.cpp Mon Dec 01 11:29:12 2014 -0800 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 12.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 12.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.8 * 12.9 * This code is free software; you can redistribute it and/or modify it 12.10 @@ -175,7 +175,7 @@ 12.11 if (TraceICs) { 12.12 ResourceMark rm; 12.13 tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", 12.14 - instruction_address(), 12.15 + p2i(instruction_address()), 12.16 callee->name_and_sig_as_C_string()); 12.17 } 12.18
13.1 --- a/src/cpu/ppc/vm/frame_ppc.cpp Wed Nov 19 15:02:01 2014 -0800 13.2 +++ b/src/cpu/ppc/vm/frame_ppc.cpp Mon Dec 01 11:29:12 2014 -0800 13.3 @@ -1,5 +1,5 @@ 13.4 /* 13.5 - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 13.6 + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 13.7 * Copyright 2012, 2014 SAP AG. All rights reserved. 13.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.9 * 13.10 @@ -140,7 +140,7 @@ 13.11 void frame::patch_pc(Thread* thread, address pc) { 13.12 if (TracePcPatching) { 13.13 tty->print_cr("patch_pc at address " PTR_FORMAT " [" PTR_FORMAT " -> " PTR_FORMAT "]", 13.14 - &((address*) _sp)[-1], ((address*) _sp)[-1], pc); 13.15 + p2i(&((address*) _sp)[-1]), p2i(((address*) _sp)[-1]), p2i(pc)); 13.16 } 13.17 own_abi()->lr = (uint64_t)pc; 13.18 _cb = CodeCache::find_blob(pc);
14.1 --- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp Wed Nov 19 15:02:01 2014 -0800 14.2 +++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp Mon Dec 01 11:29:12 2014 -0800 14.3 @@ -1,5 +1,5 @@ 14.4 /* 14.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 14.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 14.7 * Copyright 2012, 2014 SAP AG. All rights reserved. 14.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.9 * 14.10 @@ -3097,7 +3097,7 @@ 14.11 }; 14.12 14.13 static void stop_on_request(int tp, const char* msg) { 14.14 - tty->print("PPC assembly code requires stop: (%s) %s\n", (void *)stop_types[tp%/*stop_end*/4], msg); 14.15 + tty->print("PPC assembly code requires stop: (%s) %s\n", stop_types[tp%/*stop_end*/4], msg); 14.16 guarantee(false, err_msg("PPC assembly code requires stop: %s", msg)); 14.17 } 14.18
15.1 --- a/src/cpu/ppc/vm/methodHandles_ppc.cpp Wed Nov 19 15:02:01 2014 -0800 15.2 +++ b/src/cpu/ppc/vm/methodHandles_ppc.cpp Mon Dec 01 11:29:12 2014 -0800 15.3 @@ -1,5 +1,5 @@ 15.4 /* 15.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 15.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 15.7 * Copyright 2012, 2014 SAP AG. All rights reserved. 15.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.9 * 15.10 @@ -464,7 +464,7 @@ 15.11 strstr(adaptername, "linkTo") == NULL); // static linkers don't have MH 15.12 const char* mh_reg_name = has_mh ? "R23_method_handle" : "G23"; 15.13 tty->print_cr("MH %s %s="INTPTR_FORMAT " sp=" INTPTR_FORMAT, 15.14 - adaptername, mh_reg_name, (intptr_t) mh, entry_sp); 15.15 + adaptername, mh_reg_name, (intptr_t) mh, (intptr_t) entry_sp); 15.16 15.17 if (Verbose) { 15.18 tty->print_cr("Registers:");
16.1 --- a/src/cpu/ppc/vm/nativeInst_ppc.cpp Wed Nov 19 15:02:01 2014 -0800 16.2 +++ b/src/cpu/ppc/vm/nativeInst_ppc.cpp Mon Dec 01 11:29:12 2014 -0800 16.3 @@ -1,6 +1,6 @@ 16.4 /* 16.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 16.6 - * Copyright 2012, 2013 SAP AG. All rights reserved. 16.7 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 16.8 + * Copyright 2012, 2014 SAP AG. All rights reserved. 16.9 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.10 * 16.11 * This code is free software; you can redistribute it and/or modify it 16.12 @@ -147,9 +147,9 @@ 16.13 address addr = addr_at(0); 16.14 16.15 if (!NativeCall::is_call_at(addr)) { 16.16 - tty->print_cr("not a NativeCall at " PTR_FORMAT, addr); 16.17 + tty->print_cr("not a NativeCall at " PTR_FORMAT, p2i(addr)); 16.18 // TODO: PPC port: Disassembler::decode(addr - 20, addr + 20, tty); 16.19 - fatal(err_msg("not a NativeCall at " PTR_FORMAT, addr)); 16.20 + fatal(err_msg("not a NativeCall at " PTR_FORMAT, p2i(addr))); 16.21 } 16.22 } 16.23 #endif // ASSERT 16.24 @@ -160,9 +160,9 @@ 16.25 16.26 NativeInstruction::verify(); 16.27 if (!NativeFarCall::is_far_call_at(addr)) { 16.28 - tty->print_cr("not a NativeFarCall at " PTR_FORMAT, addr); 16.29 + tty->print_cr("not a NativeFarCall at " PTR_FORMAT, p2i(addr)); 16.30 // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); 16.31 - fatal(err_msg("not a NativeFarCall at " PTR_FORMAT, addr)); 16.32 + fatal(err_msg("not a NativeFarCall at " PTR_FORMAT, p2i(addr))); 16.33 } 16.34 } 16.35 #endif // ASSERT 16.36 @@ -306,9 +306,9 @@ 16.37 if (! (cb != NULL && MacroAssembler::is_calculate_address_from_global_toc_at(addr, cb->content_begin())) && 16.38 ! (cb != NULL && MacroAssembler::is_set_narrow_oop(addr, cb->content_begin())) && 16.39 ! MacroAssembler::is_bl(*((int*) addr))) { 16.40 - tty->print_cr("not a NativeMovConstReg at " PTR_FORMAT, addr); 16.41 + tty->print_cr("not a NativeMovConstReg at " PTR_FORMAT, p2i(addr)); 16.42 // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); 16.43 - fatal(err_msg("not a NativeMovConstReg at " PTR_FORMAT, addr)); 16.44 + fatal(err_msg("not a NativeMovConstReg at " PTR_FORMAT, p2i(addr))); 16.45 } 16.46 } 16.47 } 16.48 @@ -344,9 +344,9 @@ 16.49 16.50 NativeInstruction::verify(); 16.51 if (!NativeJump::is_jump_at(addr)) { 16.52 - tty->print_cr("not a NativeJump at " PTR_FORMAT, addr); 16.53 + tty->print_cr("not a NativeJump at " PTR_FORMAT, p2i(addr)); 16.54 // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); 16.55 - fatal(err_msg("not a NativeJump at " PTR_FORMAT, addr)); 16.56 + fatal(err_msg("not a NativeJump at " PTR_FORMAT, p2i(addr))); 16.57 } 16.58 } 16.59 #endif // ASSERT
17.1 --- a/src/cpu/ppc/vm/ppc.ad Wed Nov 19 15:02:01 2014 -0800 17.2 +++ b/src/cpu/ppc/vm/ppc.ad Mon Dec 01 11:29:12 2014 -0800 17.3 @@ -1330,7 +1330,7 @@ 17.4 17.5 if (!false /* TODO: PPC port C->is_frameless_method()*/) { 17.6 st->print("save return pc\n\t"); 17.7 - st->print("push frame %d\n\t", -framesize); 17.8 + st->print("push frame %ld\n\t", -framesize); 17.9 } 17.10 } 17.11 #endif
18.1 --- a/src/cpu/ppc/vm/vm_version_ppc.cpp Wed Nov 19 15:02:01 2014 -0800 18.2 +++ b/src/cpu/ppc/vm/vm_version_ppc.cpp Mon Dec 01 11:29:12 2014 -0800 18.3 @@ -352,7 +352,7 @@ 18.4 18.5 if (PrintAssembly) { 18.6 ttyLocker ttyl; 18.7 - tty->print_cr("Decoding section size detection stub at " INTPTR_FORMAT " before execution:", code); 18.8 + tty->print_cr("Decoding section size detection stub at " INTPTR_FORMAT " before execution:", p2i(code)); 18.9 Disassembler::decode((u_char*)code, (u_char*)code_end, tty); 18.10 tty->print_cr("Time loop1 :%f", loop1_seconds); 18.11 tty->print_cr("Time loop2 :%f", loop2_seconds); 18.12 @@ -435,7 +435,7 @@ 18.13 // Print the detection code. 18.14 if (PrintAssembly) { 18.15 ttyLocker ttyl; 18.16 - tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " before execution:", code); 18.17 + tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " before execution:", p2i(code)); 18.18 Disassembler::decode((u_char*)code, (u_char*)code_end, tty); 18.19 } 18.20 18.21 @@ -468,7 +468,7 @@ 18.22 // Print the detection code. 18.23 if (PrintAssembly) { 18.24 ttyLocker ttyl; 18.25 - tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " after execution:", code); 18.26 + tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " after execution:", p2i(code)); 18.27 Disassembler::decode((u_char*)code, (u_char*)code_end, tty); 18.28 } 18.29
19.1 --- a/src/cpu/x86/vm/macroAssembler_x86.cpp Wed Nov 19 15:02:01 2014 -0800 19.2 +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp Mon Dec 01 11:29:12 2014 -0800 19.3 @@ -1769,7 +1769,7 @@ 19.4 // at [FETCH], below, will never observe a biased encoding (*101b). 19.5 // If this invariant is not held we risk exclusion (safety) failure. 19.6 if (UseBiasedLocking && !UseOptoBiasInlining) { 19.7 - biased_locking_enter(boxReg, objReg, tmpReg, scrReg, true, DONE_LABEL, NULL, counters); 19.8 + biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, counters); 19.9 } 19.10 19.11 #if INCLUDE_RTM_OPT
20.1 --- a/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c Wed Nov 19 15:02:01 2014 -0800 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,285 +0,0 @@ 20.4 -/* 20.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 20.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 - * 20.8 - * This code is free software; you can redistribute it and/or modify it 20.9 - * under the terms of the GNU General Public License version 2 only, as 20.10 - * published by the Free Software Foundation. 20.11 - * 20.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 20.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.15 - * version 2 for more details (a copy is included in the LICENSE file that 20.16 - * accompanied this code). 20.17 - * 20.18 - * You should have received a copy of the GNU General Public License version 20.19 - * 2 along with this work; if not, write to the Free Software Foundation, 20.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.21 - * 20.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20.23 - * or visit www.oracle.com if you need additional information or have any 20.24 - * questions. 20.25 - * 20.26 - */ 20.27 - 20.28 -/* 20.29 - * Name: add_gnu_debuglink.c 20.30 - * 20.31 - * Description: Add a ".gnu_debuglink" section that refers to the specified 20.32 - * debug_info_path to the specified ELF object. 20.33 - * 20.34 - * This program is adapted from the example program shown on the 20.35 - * elf(3elf) man page and from code from the Solaris compiler 20.36 - * driver. 20.37 - */ 20.38 - 20.39 -/* 20.40 - * needed to define SHF_EXCLUDE 20.41 - */ 20.42 -#define ELF_TARGET_ALL 20.43 - 20.44 -#include <fcntl.h> 20.45 -#include <stdio.h> 20.46 -#include <libelf.h> 20.47 -#include <stdlib.h> 20.48 -#include <string.h> 20.49 -#include <unistd.h> 20.50 - 20.51 -static void failure(void); 20.52 -static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, 20.53 - size_t len); 20.54 - 20.55 -void 20.56 -main(int argc, char ** argv) { 20.57 - /* new ELF section name */ 20.58 - static char SEC_NAME[] = ".gnu_debuglink"; 20.59 - 20.60 - unsigned char buffer[8 * 1024]; /* I/O buffer */ 20.61 - int buffer_len; /* buffer length */ 20.62 - char * debug_info_path; /* debug info path */ 20.63 - void * ehdr; /* ELF header */ 20.64 - Elf * elf; /* ELF descriptor */ 20.65 - char * elf_ident; /* ELF identity string */ 20.66 - char * elf_obj; /* elf_obj file */ 20.67 - int fd; /* descriptor for files */ 20.68 - unsigned int file_crc = 0; /* CRC for debug info file */ 20.69 - int is_elfclass64; /* is an ELFCLASS64 file? */ 20.70 - Elf_Data * link_dat; /* ELF data for new debug info link */ 20.71 - Elf_Data * name_dat; /* ELF data for new section name */ 20.72 - Elf_Scn * new_scn; /* new ELF section descriptor */ 20.73 - void * new_shdr; /* new ELF section header */ 20.74 - Elf_Scn * scn; /* ELF section descriptor */ 20.75 - void * shdr; /* ELF section header */ 20.76 - 20.77 - if (argc != 3) { 20.78 - (void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]); 20.79 - exit(2); 20.80 - } 20.81 - 20.82 - debug_info_path = argv[1]; /* save for later */ 20.83 - if ((fd = open(debug_info_path, O_RDONLY)) == -1) { 20.84 - (void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path); 20.85 - exit(3); 20.86 - } 20.87 - 20.88 - (void) printf("Computing CRC for '%s'\n", debug_info_path); 20.89 - (void) fflush(stdout); 20.90 - /* compute CRC for the debug info file */ 20.91 - for (;;) { 20.92 - int len = read(fd, buffer, sizeof buffer); 20.93 - if (len <= 0) { 20.94 - break; 20.95 - } 20.96 - file_crc = gnu_debuglink_crc32(file_crc, buffer, len); 20.97 - } 20.98 - (void) close(fd); 20.99 - 20.100 - /* open the elf_obj */ 20.101 - elf_obj = argv[2]; 20.102 - if ((fd = open(elf_obj, O_RDWR)) == -1) { 20.103 - (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj); 20.104 - exit(4); 20.105 - } 20.106 - 20.107 - (void) printf("Opening '%s' for update\n", elf_obj); 20.108 - (void) fflush(stdout); 20.109 - (void) elf_version(EV_CURRENT); /* coordinate ELF versions */ 20.110 - 20.111 - /* obtain the ELF descriptors from the input file */ 20.112 - if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) { 20.113 - failure(); 20.114 - } 20.115 - 20.116 - /* determine if ELFCLASS64 or not? */ 20.117 - elf_ident = elf_getident(elf, NULL); 20.118 - is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64); 20.119 - 20.120 - /* get the ELF header */ 20.121 - if (is_elfclass64) { 20.122 - ehdr = elf64_getehdr(elf); 20.123 - } else { 20.124 - ehdr = elf32_getehdr(elf); 20.125 - } 20.126 - if (ehdr == NULL) { 20.127 - failure(); 20.128 - } 20.129 - 20.130 - /* get the ELF section descriptor */ 20.131 - if (is_elfclass64) { 20.132 - scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx); 20.133 - } else { 20.134 - scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx); 20.135 - } 20.136 - if (scn == NULL) { 20.137 - failure(); 20.138 - } 20.139 - 20.140 - /* get the section header */ 20.141 - if (is_elfclass64) { 20.142 - shdr = elf64_getshdr(scn); 20.143 - } else { 20.144 - shdr = elf32_getshdr(scn); 20.145 - } 20.146 - if (shdr == NULL) { 20.147 - failure(); 20.148 - } 20.149 - 20.150 - (void) printf("Adding ELF data for new section name\n"); 20.151 - (void) fflush(stdout); 20.152 - name_dat = elf_newdata(scn); 20.153 - name_dat->d_buf = (void *) SEC_NAME; 20.154 - if (is_elfclass64) { 20.155 - name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1; 20.156 - } else { 20.157 - name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1; 20.158 - } 20.159 - name_dat->d_align = 1; 20.160 - name_dat->d_size = strlen(SEC_NAME) + 1; 20.161 - 20.162 - new_scn = elf_newscn(elf); 20.163 - 20.164 - if (is_elfclass64) { 20.165 - new_shdr = elf64_getshdr(new_scn); 20.166 - ((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE; 20.167 - ((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS; 20.168 - ((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size; 20.169 - ((Elf64_Shdr *) new_shdr)->sh_addralign = 1; 20.170 - ((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1); 20.171 - } else { 20.172 - new_shdr = elf32_getshdr(new_scn); 20.173 - ((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE; 20.174 - ((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS; 20.175 - ((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size; 20.176 - ((Elf32_Shdr *) new_shdr)->sh_addralign = 1; 20.177 - ((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1); 20.178 - } 20.179 - 20.180 - (void) printf("Adding ELF data for debug_info_path value\n"); 20.181 - (void) fflush(stdout); 20.182 - (void) memset(buffer, 0, sizeof buffer); 20.183 - buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */ 20.184 - (void) strncpy((char *) buffer, debug_info_path, buffer_len); 20.185 - if (buffer_len % 4 != 0) { 20.186 - /* not on a 4 byte boundary so pad to the next one */ 20.187 - buffer_len += (4 - buffer_len % 4); 20.188 - } 20.189 - /* save the CRC */ 20.190 - (void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc); 20.191 - buffer_len += sizeof file_crc; 20.192 - 20.193 - link_dat = elf_newdata(new_scn); 20.194 - link_dat->d_type = ELF_T_BYTE; 20.195 - link_dat->d_size = buffer_len; 20.196 - link_dat->d_buf = buffer; 20.197 - link_dat->d_align = 1; 20.198 - 20.199 - (void) printf("Saving updates to '%s'\n", elf_obj); 20.200 - (void) fflush(stdout); 20.201 - (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */ 20.202 - (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */ 20.203 - (void) elf_end(elf); /* done with ELF obj */ 20.204 - (void) close(fd); 20.205 - 20.206 - (void) printf("Done updating '%s'\n", elf_obj); 20.207 - (void) fflush(stdout); 20.208 - exit(0); 20.209 -} /* end main */ 20.210 - 20.211 - 20.212 -static void 20.213 -failure() { 20.214 - (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno())); 20.215 - exit(5); 20.216 -} 20.217 - 20.218 - 20.219 -/* 20.220 - * The CRC used in gnu_debuglink, retrieved from 20.221 - * http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files. 20.222 - */ 20.223 - 20.224 -static unsigned int 20.225 -gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) { 20.226 - static const unsigned int crc32_table[256] = { 20.227 - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 20.228 - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 20.229 - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 20.230 - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 20.231 - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 20.232 - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 20.233 - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 20.234 - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 20.235 - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 20.236 - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 20.237 - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 20.238 - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 20.239 - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 20.240 - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 20.241 - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 20.242 - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 20.243 - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 20.244 - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 20.245 - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 20.246 - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 20.247 - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 20.248 - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 20.249 - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 20.250 - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 20.251 - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 20.252 - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 20.253 - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 20.254 - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 20.255 - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 20.256 - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 20.257 - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 20.258 - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 20.259 - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 20.260 - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 20.261 - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 20.262 - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 20.263 - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 20.264 - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 20.265 - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 20.266 - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 20.267 - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 20.268 - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 20.269 - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 20.270 - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 20.271 - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 20.272 - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 20.273 - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 20.274 - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 20.275 - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 20.276 - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 20.277 - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 20.278 - 0x2d02ef8d 20.279 - }; 20.280 - 20.281 - unsigned char *end; 20.282 - 20.283 - crc = ~crc & 0xffffffff; 20.284 - for (end = buf + len; buf < end; ++buf) { 20.285 - crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8); 20.286 - } 20.287 - return ~crc & 0xffffffff; 20.288 -}
21.1 --- a/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c Wed Nov 19 15:02:01 2014 -0800 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,181 +0,0 @@ 21.4 -/* 21.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 21.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.7 - * 21.8 - * This code is free software; you can redistribute it and/or modify it 21.9 - * under the terms of the GNU General Public License version 2 only, as 21.10 - * published by the Free Software Foundation. 21.11 - * 21.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 21.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.15 - * version 2 for more details (a copy is included in the LICENSE file that 21.16 - * accompanied this code). 21.17 - * 21.18 - * You should have received a copy of the GNU General Public License version 21.19 - * 2 along with this work; if not, write to the Free Software Foundation, 21.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.21 - * 21.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21.23 - * or visit www.oracle.com if you need additional information or have any 21.24 - * questions. 21.25 - * 21.26 - */ 21.27 - 21.28 -/* 21.29 - * Name: fix_empty_sec_hdr_flags.c 21.30 - * 21.31 - * Description: Remove the SHF_ALLOC flag from "empty" section headers. 21.32 - * An "empty" section header has sh_addr == 0 and sh_size == 0. 21.33 - * 21.34 - * This program is adapted from the example program shown on the 21.35 - * elf(3elf) man page and from code from the Solaris compiler 21.36 - * driver. 21.37 - */ 21.38 - 21.39 -#include <fcntl.h> 21.40 -#include <stdio.h> 21.41 -#include <libelf.h> 21.42 -#include <stdlib.h> 21.43 -#include <string.h> 21.44 -#include <unistd.h> 21.45 - 21.46 -static void failure(void); 21.47 - 21.48 -void 21.49 -main(int argc, char ** argv) { 21.50 - void * ehdr; /* ELF header */ 21.51 - unsigned int i; /* section counter */ 21.52 - int fd; /* descriptor for file */ 21.53 - Elf * elf; /* ELF descriptor */ 21.54 - char * elf_ident; /* ELF identity string */ 21.55 - char * elf_obj; /* elf_obj file */ 21.56 - int fix_count; /* number of flags fixed */ 21.57 - int is_elfclass64; /* is an ELFCLASS64 file? */ 21.58 - Elf_Scn * scn; /* ELF section descriptor */ 21.59 - void * shdr; /* ELF section header */ 21.60 - Elf_Data * shstrtab; /* ELF section header string table */ 21.61 - 21.62 - if (argc != 2) { 21.63 - (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]); 21.64 - exit(2); 21.65 - } 21.66 - 21.67 - /* open the elf_obj */ 21.68 - elf_obj = argv[1]; 21.69 - if ((fd = open(elf_obj, O_RDWR)) == -1) { 21.70 - (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj); 21.71 - exit(3); 21.72 - } 21.73 - 21.74 - (void) printf("Opening '%s' for update\n", elf_obj); 21.75 - (void) fflush(stdout); 21.76 - (void) elf_version(EV_CURRENT); /* coordinate ELF versions */ 21.77 - 21.78 - /* obtain the ELF descriptors from the input file */ 21.79 - if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) { 21.80 - failure(); 21.81 - } 21.82 - 21.83 - /* determine if ELFCLASS64 or not? */ 21.84 - elf_ident = elf_getident(elf, NULL); 21.85 - is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64); 21.86 - 21.87 - /* get the ELF header */ 21.88 - if (is_elfclass64) { 21.89 - ehdr = elf64_getehdr(elf); 21.90 - } else { 21.91 - ehdr = elf32_getehdr(elf); 21.92 - } 21.93 - if (ehdr == NULL) { 21.94 - failure(); 21.95 - } 21.96 - 21.97 - /* get the ELF section descriptor */ 21.98 - if (is_elfclass64) { 21.99 - scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx); 21.100 - } else { 21.101 - scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx); 21.102 - } 21.103 - if (scn == NULL) { 21.104 - failure(); 21.105 - } 21.106 - 21.107 - /* get the section header string table */ 21.108 - shstrtab = elf_getdata(scn, NULL); 21.109 - if (shstrtab == NULL) { 21.110 - failure(); 21.111 - } 21.112 - 21.113 - fix_count = 0; 21.114 - 21.115 - /* traverse the sections of the input file */ 21.116 - for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) { 21.117 - int has_flag_set; /* is SHF_ALLOC flag set? */ 21.118 - int is_empty; /* is section empty? */ 21.119 - char * name; /* short hand pointer */ 21.120 - 21.121 - /* get the section header */ 21.122 - if (is_elfclass64) { 21.123 - shdr = elf64_getshdr(scn); 21.124 - } else { 21.125 - shdr = elf32_getshdr(scn); 21.126 - } 21.127 - if (shdr == NULL) { 21.128 - failure(); 21.129 - } 21.130 - 21.131 - if (is_elfclass64) { 21.132 - name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name; 21.133 - } else { 21.134 - name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name; 21.135 - } 21.136 - 21.137 - if (is_elfclass64) { 21.138 - has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC; 21.139 - is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 && 21.140 - ((Elf64_Shdr *) shdr)->sh_size == 0; 21.141 - } else { 21.142 - has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC; 21.143 - is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 && 21.144 - ((Elf32_Shdr *) shdr)->sh_size == 0; 21.145 - } 21.146 - 21.147 - if (is_empty && has_flag_set) { 21.148 - (void) printf("section[%u] '%s' is empty, " 21.149 - "but SHF_ALLOC flag is set.\n", i, name); 21.150 - (void) printf("Clearing the SHF_ALLOC flag.\n"); 21.151 - 21.152 - if (is_elfclass64) { 21.153 - ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC; 21.154 - } else { 21.155 - ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC; 21.156 - } 21.157 - fix_count++; 21.158 - } 21.159 - } /* end for each ELF section */ 21.160 - 21.161 - if (fix_count > 0) { 21.162 - (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj); 21.163 - (void) fflush(stdout); 21.164 - (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */ 21.165 - (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */ 21.166 - } else { 21.167 - (void) printf("No SHF_ALLOC flags needed to be cleared.\n"); 21.168 - } 21.169 - 21.170 - (void) elf_end(elf); /* done with ELF obj */ 21.171 - (void) close(fd); 21.172 - 21.173 - (void) printf("Done %s '%s'\n", 21.174 - (fix_count > 0) ? "updating" : "with", elf_obj); 21.175 - (void) fflush(stdout); 21.176 - exit(0); 21.177 -} /* end main */ 21.178 - 21.179 - 21.180 -static void 21.181 -failure() { 21.182 - (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno())); 21.183 - exit(6); 21.184 -}
22.1 --- a/src/os/windows/vm/os_windows.cpp Wed Nov 19 15:02:01 2014 -0800 22.2 +++ b/src/os/windows/vm/os_windows.cpp Mon Dec 01 11:29:12 2014 -0800 22.3 @@ -1650,96 +1650,123 @@ 22.4 22.5 void os::win32::print_windows_version(outputStream* st) { 22.6 OSVERSIONINFOEX osvi; 22.7 - SYSTEM_INFO si; 22.8 - 22.9 + VS_FIXEDFILEINFO *file_info; 22.10 + TCHAR kernel32_path[MAX_PATH]; 22.11 + UINT len, ret; 22.12 + 22.13 + // Use the GetVersionEx information to see if we're on a server or 22.14 + // workstation edition of Windows. Starting with Windows 8.1 we can't 22.15 + // trust the OS version information returned by this API. 22.16 ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); 22.17 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); 22.18 - 22.19 if (!GetVersionEx((OSVERSIONINFO *)&osvi)) { 22.20 - st->print_cr("N/A"); 22.21 + st->print_cr("Call to GetVersionEx failed"); 22.22 return; 22.23 } 22.24 - 22.25 - int os_vers = osvi.dwMajorVersion * 1000 + osvi.dwMinorVersion; 22.26 - 22.27 + bool is_workstation = (osvi.wProductType == VER_NT_WORKSTATION); 22.28 + 22.29 + // Get the full path to \Windows\System32\kernel32.dll and use that for 22.30 + // determining what version of Windows we're running on. 22.31 + len = MAX_PATH - (UINT)strlen("\\kernel32.dll") - 1; 22.32 + ret = GetSystemDirectory(kernel32_path, len); 22.33 + if (ret == 0 || ret > len) { 22.34 + st->print_cr("Call to GetSystemDirectory failed"); 22.35 + return; 22.36 + } 22.37 + strncat(kernel32_path, "\\kernel32.dll", MAX_PATH - ret); 22.38 + 22.39 + DWORD version_size = GetFileVersionInfoSize(kernel32_path, NULL); 22.40 + if (version_size == 0) { 22.41 + st->print_cr("Call to GetFileVersionInfoSize failed"); 22.42 + return; 22.43 + } 22.44 + 22.45 + LPTSTR version_info = (LPTSTR)os::malloc(version_size, mtInternal); 22.46 + if (version_info == NULL) { 22.47 + st->print_cr("Failed to allocate version_info"); 22.48 + return; 22.49 + } 22.50 + 22.51 + if (!GetFileVersionInfo(kernel32_path, NULL, version_size, version_info)) { 22.52 + os::free(version_info); 22.53 + st->print_cr("Call to GetFileVersionInfo failed"); 22.54 + return; 22.55 + } 22.56 + 22.57 + if (!VerQueryValue(version_info, TEXT("\\"), (LPVOID*)&file_info, &len)) { 22.58 + os::free(version_info); 22.59 + st->print_cr("Call to VerQueryValue failed"); 22.60 + return; 22.61 + } 22.62 + 22.63 + int major_version = HIWORD(file_info->dwProductVersionMS); 22.64 + int minor_version = LOWORD(file_info->dwProductVersionMS); 22.65 + int build_number = HIWORD(file_info->dwProductVersionLS); 22.66 + int build_minor = LOWORD(file_info->dwProductVersionLS); 22.67 + int os_vers = major_version * 1000 + minor_version; 22.68 + os::free(version_info); 22.69 + 22.70 + st->print(" Windows "); 22.71 + switch (os_vers) { 22.72 + 22.73 + case 6000: 22.74 + if (is_workstation) { 22.75 + st->print("Vista"); 22.76 + } else { 22.77 + st->print("Server 2008"); 22.78 + } 22.79 + break; 22.80 + 22.81 + case 6001: 22.82 + if (is_workstation) { 22.83 + st->print("7"); 22.84 + } else { 22.85 + st->print("Server 2008 R2"); 22.86 + } 22.87 + break; 22.88 + 22.89 + case 6002: 22.90 + if (is_workstation) { 22.91 + st->print("8"); 22.92 + } else { 22.93 + st->print("Server 2012"); 22.94 + } 22.95 + break; 22.96 + 22.97 + case 6003: 22.98 + if (is_workstation) { 22.99 + st->print("8.1"); 22.100 + } else { 22.101 + st->print("Server 2012 R2"); 22.102 + } 22.103 + break; 22.104 + 22.105 + case 6004: 22.106 + if (is_workstation) { 22.107 + st->print("10"); 22.108 + } else { 22.109 + // The server version name of Windows 10 is not known at this time 22.110 + st->print("%d.%d", major_version, minor_version); 22.111 + } 22.112 + break; 22.113 + 22.114 + default: 22.115 + // Unrecognized windows, print out its major and minor versions 22.116 + st->print("%d.%d", major_version, minor_version); 22.117 + break; 22.118 + } 22.119 + 22.120 + // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could 22.121 + // find out whether we are running on 64 bit processor or not 22.122 + SYSTEM_INFO si; 22.123 ZeroMemory(&si, sizeof(SYSTEM_INFO)); 22.124 - if (os_vers >= 5002) { 22.125 - // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could 22.126 - // find out whether we are running on 64 bit processor or not. 22.127 - if (os::Kernel32Dll::GetNativeSystemInfoAvailable()) { 22.128 - os::Kernel32Dll::GetNativeSystemInfo(&si); 22.129 - } else { 22.130 - GetSystemInfo(&si); 22.131 - } 22.132 - } 22.133 - 22.134 - if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { 22.135 - switch (os_vers) { 22.136 - case 3051: st->print(" Windows NT 3.51"); break; 22.137 - case 4000: st->print(" Windows NT 4.0"); break; 22.138 - case 5000: st->print(" Windows 2000"); break; 22.139 - case 5001: st->print(" Windows XP"); break; 22.140 - case 5002: 22.141 - if (osvi.wProductType == VER_NT_WORKSTATION && 22.142 - si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { 22.143 - st->print(" Windows XP x64 Edition"); 22.144 - } else { 22.145 - st->print(" Windows Server 2003 family"); 22.146 - } 22.147 - break; 22.148 - 22.149 - case 6000: 22.150 - if (osvi.wProductType == VER_NT_WORKSTATION) { 22.151 - st->print(" Windows Vista"); 22.152 - } else { 22.153 - st->print(" Windows Server 2008"); 22.154 - } 22.155 - break; 22.156 - 22.157 - case 6001: 22.158 - if (osvi.wProductType == VER_NT_WORKSTATION) { 22.159 - st->print(" Windows 7"); 22.160 - } else { 22.161 - st->print(" Windows Server 2008 R2"); 22.162 - } 22.163 - break; 22.164 - 22.165 - case 6002: 22.166 - if (osvi.wProductType == VER_NT_WORKSTATION) { 22.167 - st->print(" Windows 8"); 22.168 - } else { 22.169 - st->print(" Windows Server 2012"); 22.170 - } 22.171 - break; 22.172 - 22.173 - case 6003: 22.174 - if (osvi.wProductType == VER_NT_WORKSTATION) { 22.175 - st->print(" Windows 8.1"); 22.176 - } else { 22.177 - st->print(" Windows Server 2012 R2"); 22.178 - } 22.179 - break; 22.180 - 22.181 - default: // future os 22.182 - // Unrecognized windows, print out its major and minor versions 22.183 - st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); 22.184 - } 22.185 - } else { 22.186 - switch (os_vers) { 22.187 - case 4000: st->print(" Windows 95"); break; 22.188 - case 4010: st->print(" Windows 98"); break; 22.189 - case 4090: st->print(" Windows Me"); break; 22.190 - default: // future windows, print out its major and minor versions 22.191 - st->print(" Windows %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); 22.192 - } 22.193 - } 22.194 - 22.195 - if (os_vers >= 6000 && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { 22.196 + os::Kernel32Dll::GetNativeSystemInfo(&si); 22.197 + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { 22.198 st->print(" , 64 bit"); 22.199 } 22.200 22.201 - st->print(" Build %d", osvi.dwBuildNumber); 22.202 - st->print(" %s", osvi.szCSDVersion); // service pack 22.203 + st->print(" Build %d", build_number); 22.204 + st->print(" (%d.%d.%d.%d)", major_version, minor_version, build_number, build_minor); 22.205 st->cr(); 22.206 } 22.207 22.208 @@ -5350,11 +5377,6 @@ 22.209 return ::Module32Next(hSnapshot, lpme); 22.210 } 22.211 22.212 - 22.213 -inline BOOL os::Kernel32Dll::GetNativeSystemInfoAvailable() { 22.214 - return true; 22.215 -} 22.216 - 22.217 inline void os::Kernel32Dll::GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo) { 22.218 ::GetNativeSystemInfo(lpSystemInfo); 22.219 }
23.1 --- a/src/os/windows/vm/os_windows.hpp Wed Nov 19 15:02:01 2014 -0800 23.2 +++ b/src/os/windows/vm/os_windows.hpp Mon Dec 01 11:29:12 2014 -0800 23.3 @@ -192,7 +192,6 @@ 23.4 static BOOL Module32First(HANDLE,LPMODULEENTRY32); 23.5 static BOOL Module32Next(HANDLE,LPMODULEENTRY32); 23.6 23.7 - static BOOL GetNativeSystemInfoAvailable(); 23.8 static void GetNativeSystemInfo(LPSYSTEM_INFO); 23.9 23.10 // NUMA calls
24.1 --- a/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp Wed Nov 19 15:02:01 2014 -0800 24.2 +++ b/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp Mon Dec 01 11:29:12 2014 -0800 24.3 @@ -1,6 +1,6 @@ 24.4 /* 24.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 24.6 - * Copyright 2012, 2013 SAP AG. All rights reserved. 24.7 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 24.8 + * Copyright 2012, 2014 SAP AG. All rights reserved. 24.9 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.10 * 24.11 * This code is free software; you can redistribute it and/or modify it 24.12 @@ -307,7 +307,7 @@ 24.13 // doesn't work for us. We use: 24.14 ((NativeInstruction*)pc)->is_safepoint_poll()) { 24.15 if (TraceTraps) { 24.16 - tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", pc); 24.17 + tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc)); 24.18 } 24.19 stub = SharedRuntime::get_poll_stub(pc); 24.20 } 24.21 @@ -316,7 +316,7 @@ 24.22 else if (sig == SIGTRAP && TrapBasedICMissChecks && 24.23 nativeInstruction_at(pc)->is_sigtrap_ic_miss_check()) { 24.24 if (TraceTraps) { 24.25 - tty->print_cr("trap: ic_miss_check at " INTPTR_FORMAT " (SIGTRAP)", pc); 24.26 + tty->print_cr("trap: ic_miss_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc)); 24.27 } 24.28 stub = SharedRuntime::get_ic_miss_stub(); 24.29 } 24.30 @@ -325,7 +325,7 @@ 24.31 else if (sig == SIGTRAP && TrapBasedNullChecks && 24.32 nativeInstruction_at(pc)->is_sigtrap_null_check()) { 24.33 if (TraceTraps) { 24.34 - tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGTRAP)", pc); 24.35 + tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc)); 24.36 } 24.37 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); 24.38 } 24.39 @@ -335,7 +335,7 @@ 24.40 CodeCache::contains((void*) pc) && 24.41 !MacroAssembler::needs_explicit_null_check((intptr_t) info->si_addr)) { 24.42 if (TraceTraps) { 24.43 - tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", pc); 24.44 + tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc)); 24.45 } 24.46 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); 24.47 } 24.48 @@ -345,7 +345,7 @@ 24.49 else if (sig == SIGTRAP && TrapBasedRangeChecks && 24.50 nativeInstruction_at(pc)->is_sigtrap_range_check()) { 24.51 if (TraceTraps) { 24.52 - tty->print_cr("trap: range_check at " INTPTR_FORMAT " (SIGTRAP)", pc); 24.53 + tty->print_cr("trap: range_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc)); 24.54 } 24.55 stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); 24.56 } 24.57 @@ -572,7 +572,7 @@ 24.58 st->cr(); 24.59 24.60 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); 24.61 - st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); 24.62 + st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp)); 24.63 print_hex_dump(st, (address)sp, (address)(sp + 128), sizeof(intptr_t)); 24.64 st->cr(); 24.65 24.66 @@ -580,7 +580,7 @@ 24.67 // point to garbage if entry point in an nmethod is corrupted. Leave 24.68 // this at the end, and hope for the best. 24.69 address pc = os::Linux::ucontext_get_pc(uc); 24.70 - st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); 24.71 + st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc)); 24.72 print_hex_dump(st, pc - 64, pc + 64, /*instrsize=*/4); 24.73 st->cr(); 24.74 }
25.1 --- a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Wed Nov 19 15:02:01 2014 -0800 25.2 +++ b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Mon Dec 01 11:29:12 2014 -0800 25.3 @@ -635,7 +635,11 @@ 25.4 #ifndef PRODUCT 25.5 void os::verify_stack_alignment() { 25.6 #ifdef AMD64 25.7 - assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment"); 25.8 + // The current_stack_pointer() calls generated get_previous_sp stub routine. 25.9 + // Only enable the assert after the routine becomes available. 25.10 + if (StubRoutines::code1() != NULL) { 25.11 + assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment"); 25.12 + } 25.13 #endif 25.14 } 25.15 #endif
26.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java Wed Nov 19 15:02:01 2014 -0800 26.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java Mon Dec 01 11:29:12 2014 -0800 26.3 @@ -398,7 +398,7 @@ 26.4 "/export:JVM_GetThreadStateNames "+ 26.5 "/export:JVM_GetThreadStateValues "+ 26.6 "/export:JVM_InitAgentProperties"); 26.7 - addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib;psapi.lib"); 26.8 + addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib;psapi.lib;version.lib"); 26.9 addAttr(rv, "OutputFile", outDll); 26.10 addAttr(rv, "SuppressStartupBanner", "true"); 26.11 addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def");
27.1 --- a/src/share/vm/classfile/classLoader.cpp Wed Nov 19 15:02:01 2014 -0800 27.2 +++ b/src/share/vm/classfile/classLoader.cpp Mon Dec 01 11:29:12 2014 -0800 27.3 @@ -1137,7 +1137,7 @@ 27.4 h = context.record_result(classpath_index, e, result, THREAD); 27.5 } else { 27.6 if (DumpSharedSpaces) { 27.7 - tty->print_cr("Preload Error: Cannot find %s", class_name); 27.8 + tty->print_cr("Preload Warning: Cannot find %s", class_name); 27.9 } 27.10 } 27.11
28.1 --- a/src/share/vm/classfile/classLoaderData.cpp Wed Nov 19 15:02:01 2014 -0800 28.2 +++ b/src/share/vm/classfile/classLoaderData.cpp Mon Dec 01 11:29:12 2014 -0800 28.3 @@ -64,9 +64,8 @@ 28.4 #include "utilities/growableArray.hpp" 28.5 #include "utilities/macros.hpp" 28.6 #include "utilities/ostream.hpp" 28.7 - 28.8 #if INCLUDE_TRACE 28.9 - #include "trace/tracing.hpp" 28.10 +#include "trace/tracing.hpp" 28.11 #endif 28.12 28.13 ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL; 28.14 @@ -984,4 +983,4 @@ 28.15 event.commit(); 28.16 } 28.17 28.18 -#endif /* INCLUDE_TRACE */ 28.19 +#endif // INCLUDE_TRACE
29.1 --- a/src/share/vm/classfile/classLoaderData.hpp Wed Nov 19 15:02:01 2014 -0800 29.2 +++ b/src/share/vm/classfile/classLoaderData.hpp Mon Dec 01 11:29:12 2014 -0800 29.3 @@ -31,8 +31,9 @@ 29.4 #include "memory/metaspaceCounters.hpp" 29.5 #include "runtime/mutex.hpp" 29.6 #include "utilities/growableArray.hpp" 29.7 +#include "utilities/macros.hpp" 29.8 #if INCLUDE_TRACE 29.9 -# include "utilities/ticks.hpp" 29.10 +#include "utilities/ticks.hpp" 29.11 #endif 29.12 29.13 //
30.1 --- a/src/share/vm/classfile/dictionary.cpp Wed Nov 19 15:02:01 2014 -0800 30.2 +++ b/src/share/vm/classfile/dictionary.cpp Mon Dec 01 11:29:12 2014 -0800 30.3 @@ -223,7 +223,7 @@ 30.4 } 30.5 free_entry(probe); 30.6 ResourceMark rm; 30.7 - tty->print_cr("Removed error class: %s", ik->external_name()); 30.8 + tty->print_cr("Preload Warning: Removed error class: %s", ik->external_name()); 30.9 continue; 30.10 } 30.11
31.1 --- a/src/share/vm/classfile/systemDictionary.cpp Wed Nov 19 15:02:01 2014 -0800 31.2 +++ b/src/share/vm/classfile/systemDictionary.cpp Mon Dec 01 11:29:12 2014 -0800 31.3 @@ -64,9 +64,8 @@ 31.4 #include "services/threadService.hpp" 31.5 #include "utilities/macros.hpp" 31.6 #include "utilities/ticks.hpp" 31.7 - 31.8 #if INCLUDE_TRACE 31.9 - #include "trace/tracing.hpp" 31.10 +#include "trace/tracing.hpp" 31.11 #endif 31.12 31.13 Dictionary* SystemDictionary::_dictionary = NULL; 31.14 @@ -2665,7 +2664,7 @@ 31.15 class_loader->klass() : (Klass*)NULL); 31.16 event.commit(); 31.17 } 31.18 -#endif /* INCLUDE_TRACE */ 31.19 +#endif // INCLUDE_TRACE 31.20 } 31.21 31.22 #ifndef PRODUCT
32.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Wed Nov 19 15:02:01 2014 -0800 32.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Mon Dec 01 11:29:12 2014 -0800 32.3 @@ -2641,7 +2641,7 @@ 32.4 // Get the #blocks we want to claim 32.5 size_t n_blks = (size_t)_blocks_to_claim[word_sz].average(); 32.6 assert(n_blks > 0, "Error"); 32.7 - assert(ResizePLAB || n_blks == OldPLABSize, "Error"); 32.8 + assert(ResizeOldPLAB || n_blks == OldPLABSize, "Error"); 32.9 // In some cases, when the application has a phase change, 32.10 // there may be a sudden and sharp shift in the object survival 32.11 // profile, and updating the counts at the end of a scavenge
33.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp Wed Nov 19 15:02:01 2014 -0800 33.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp Mon Dec 01 11:29:12 2014 -0800 33.3 @@ -50,8 +50,12 @@ 33.4 void VM_CMS_Operation::acquire_pending_list_lock() { 33.5 // The caller may block while communicating 33.6 // with the SLT thread in order to acquire/release the PLL. 33.7 - ConcurrentMarkSweepThread::slt()-> 33.8 - manipulatePLL(SurrogateLockerThread::acquirePLL); 33.9 + SurrogateLockerThread* slt = ConcurrentMarkSweepThread::slt(); 33.10 + if (slt != NULL) { 33.11 + slt->manipulatePLL(SurrogateLockerThread::acquirePLL); 33.12 + } else { 33.13 + SurrogateLockerThread::report_missing_slt(); 33.14 + } 33.15 } 33.16 33.17 void VM_CMS_Operation::release_and_notify_pending_list_lock() {
34.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Nov 19 15:02:01 2014 -0800 34.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp Mon Dec 01 11:29:12 2014 -0800 34.3 @@ -2175,6 +2175,7 @@ 34.4 // We reclaimed old regions so we should calculate the sizes to make 34.5 // sure we update the old gen/space data. 34.6 g1h->g1mm()->update_sizes(); 34.7 + g1h->allocation_context_stats().update_after_mark(); 34.8 34.9 g1h->trace_heap_after_concurrent_cycle(); 34.10 } 34.11 @@ -3346,7 +3347,6 @@ 34.12 } else { 34.13 g1_par_agg_task.work(0); 34.14 } 34.15 - _g1h->allocation_context_stats().update_at_remark(); 34.16 } 34.17 34.18 // Clear the per-worker arrays used to store the per-region counting data
35.1 --- a/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp Wed Nov 19 15:02:01 2014 -0800 35.2 +++ b/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp Mon Dec 01 11:29:12 2014 -0800 35.3 @@ -45,7 +45,7 @@ 35.4 public: 35.5 inline void clear() { } 35.6 inline void update(bool full_gc) { } 35.7 - inline void update_at_remark() { } 35.8 + inline void update_after_mark() { } 35.9 inline bool available() { return false; } 35.10 }; 35.11
36.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Nov 19 15:02:01 2014 -0800 36.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Mon Dec 01 11:29:12 2014 -0800 36.3 @@ -5228,7 +5228,9 @@ 36.4 } 36.5 36.6 void pre_work_verification() { 36.7 - assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty"); 36.8 + // The VM Thread will have registered Metadata during the single-threaded phase of MetadataStackOnMark. 36.9 + assert(Thread::current()->is_VM_thread() 36.10 + || !MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty"); 36.11 } 36.12 36.13 void post_work_verification() {
37.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Nov 19 15:02:01 2014 -0800 37.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Mon Dec 01 11:29:12 2014 -0800 37.3 @@ -1425,6 +1425,18 @@ 37.4 #endif // PRODUCT 37.5 } 37.6 37.7 +bool G1CollectorPolicy::is_young_list_full() { 37.8 + uint young_list_length = _g1->young_list()->length(); 37.9 + uint young_list_target_length = _young_list_target_length; 37.10 + return young_list_length >= young_list_target_length; 37.11 +} 37.12 + 37.13 +bool G1CollectorPolicy::can_expand_young_list() { 37.14 + uint young_list_length = _g1->young_list()->length(); 37.15 + uint young_list_max_length = _young_list_max_length; 37.16 + return young_list_length < young_list_max_length; 37.17 +} 37.18 + 37.19 uint G1CollectorPolicy::max_regions(int purpose) { 37.20 switch (purpose) { 37.21 case GCAllocForSurvived:
38.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Wed Nov 19 15:02:01 2014 -0800 38.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Mon Dec 01 11:29:12 2014 -0800 38.3 @@ -26,6 +26,7 @@ 38.4 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP 38.5 38.6 #include "gc_implementation/g1/collectionSetChooser.hpp" 38.7 +#include "gc_implementation/g1/g1Allocator.hpp" 38.8 #include "gc_implementation/g1/g1MMUTracker.hpp" 38.9 #include "memory/collectorPolicy.hpp" 38.10 38.11 @@ -803,7 +804,7 @@ 38.12 38.13 // If an expansion would be appropriate, because recent GC overhead had 38.14 // exceeded the desired limit, return an amount to expand by. 38.15 - size_t expansion_amount(); 38.16 + virtual size_t expansion_amount(); 38.17 38.18 // Print tracing information. 38.19 void print_tracing_info() const; 38.20 @@ -822,17 +823,9 @@ 38.21 38.22 size_t young_list_target_length() const { return _young_list_target_length; } 38.23 38.24 - bool is_young_list_full() { 38.25 - uint young_list_length = _g1->young_list()->length(); 38.26 - uint young_list_target_length = _young_list_target_length; 38.27 - return young_list_length >= young_list_target_length; 38.28 - } 38.29 + bool is_young_list_full(); 38.30 38.31 - bool can_expand_young_list() { 38.32 - uint young_list_length = _g1->young_list()->length(); 38.33 - uint young_list_max_length = _young_list_max_length; 38.34 - return young_list_length < young_list_max_length; 38.35 - } 38.36 + bool can_expand_young_list(); 38.37 38.38 uint young_list_max_length() { 38.39 return _young_list_max_length;
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp Mon Dec 01 11:29:12 2014 -0800 39.3 @@ -0,0 +1,32 @@ 39.4 +/* 39.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 39.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.7 + * 39.8 + * This code is free software; you can redistribute it and/or modify it 39.9 + * under the terms of the GNU General Public License version 2 only, as 39.10 + * published by the Free Software Foundation. 39.11 + * 39.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 39.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 39.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 39.15 + * version 2 for more details (a copy is included in the LICENSE file that 39.16 + * accompanied this code). 39.17 + * 39.18 + * You should have received a copy of the GNU General Public License version 39.19 + * 2 along with this work; if not, write to the Free Software Foundation, 39.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 39.21 + * 39.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 39.23 + * or visit www.oracle.com if you need additional information or have any 39.24 + * questions. 39.25 + * 39.26 + */ 39.27 + 39.28 +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP 39.29 +#define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP 39.30 + 39.31 +#include "gc_implementation/g1/g1CollectorPolicy.hpp" 39.32 + 39.33 +class G1CollectorPolicyExt : public G1CollectorPolicy { }; 39.34 + 39.35 +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP
40.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp Wed Nov 19 15:02:01 2014 -0800 40.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp Mon Dec 01 11:29:12 2014 -0800 40.3 @@ -1015,10 +1015,13 @@ 40.4 HeapWord* G1OffsetTableContigSpace::saved_mark_word() const { 40.5 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 40.6 assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" ); 40.7 - if (_gc_time_stamp < g1h->get_gc_time_stamp()) 40.8 - return top(); 40.9 - else 40.10 + HeapWord* local_top = top(); 40.11 + OrderAccess::loadload(); 40.12 + if (_gc_time_stamp < g1h->get_gc_time_stamp()) { 40.13 + return local_top; 40.14 + } else { 40.15 return Space::saved_mark_word(); 40.16 + } 40.17 } 40.18 40.19 void G1OffsetTableContigSpace::record_top_and_timestamp() {
41.1 --- a/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp Wed Nov 19 15:02:01 2014 -0800 41.2 +++ b/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp Mon Dec 01 11:29:12 2014 -0800 41.3 @@ -213,8 +213,12 @@ 41.4 assert(_needs_pll, "don't call this otherwise"); 41.5 // The caller may block while communicating 41.6 // with the SLT thread in order to acquire/release the PLL. 41.7 - ConcurrentMarkThread::slt()-> 41.8 - manipulatePLL(SurrogateLockerThread::acquirePLL); 41.9 + SurrogateLockerThread* slt = ConcurrentMarkThread::slt(); 41.10 + if (slt != NULL) { 41.11 + slt->manipulatePLL(SurrogateLockerThread::acquirePLL); 41.12 + } else { 41.13 + SurrogateLockerThread::report_missing_slt(); 41.14 + } 41.15 } 41.16 41.17 void VM_CGC_Operation::release_and_notify_pending_list_lock() {
42.1 --- a/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp Wed Nov 19 15:02:01 2014 -0800 42.2 +++ b/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp Mon Dec 01 11:29:12 2014 -0800 42.3 @@ -137,6 +137,13 @@ 42.4 return res; 42.5 } 42.6 42.7 +void SurrogateLockerThread::report_missing_slt() { 42.8 + vm_exit_during_initialization( 42.9 + "GC before GC support fully initialized: " 42.10 + "SLT is needed but has not yet been created."); 42.11 + ShouldNotReachHere(); 42.12 +} 42.13 + 42.14 void SurrogateLockerThread::manipulatePLL(SLT_msg_type msg) { 42.15 MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag); 42.16 assert(_buffer == empty, "Should be empty");
43.1 --- a/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp Wed Nov 19 15:02:01 2014 -0800 43.2 +++ b/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp Mon Dec 01 11:29:12 2014 -0800 43.3 @@ -93,6 +93,9 @@ 43.4 public: 43.5 static SurrogateLockerThread* make(TRAPS); 43.6 43.7 + // Terminate VM with error message that SLT needed but not yet created. 43.8 + static void report_missing_slt(); 43.9 + 43.10 SurrogateLockerThread(); 43.11 43.12 bool is_hidden_from_external_view() const { return true; }
44.1 --- a/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp Wed Nov 19 15:02:01 2014 -0800 44.2 +++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp Mon Dec 01 11:29:12 2014 -0800 44.3 @@ -29,8 +29,8 @@ 44.4 #include "memory/heapInspection.hpp" 44.5 #include "trace/tracing.hpp" 44.6 #include "utilities/globalDefinitions.hpp" 44.7 +#include "utilities/macros.hpp" 44.8 #include "utilities/ticks.hpp" 44.9 - 44.10 #if INCLUDE_SERVICES 44.11 44.12 void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, const Ticks& timestamp) {
45.1 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp Wed Nov 19 15:02:01 2014 -0800 45.2 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp Mon Dec 01 11:29:12 2014 -0800 45.3 @@ -1,5 +1,5 @@ 45.4 /* 45.5 - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 45.6 + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. 45.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 45.8 * 45.9 * This code is free software; you can redistribute it and/or modify it 45.10 @@ -2813,11 +2813,11 @@ 45.11 if (TraceExceptions) { 45.12 ttyLocker ttyl; 45.13 ResourceMark rm; 45.14 - tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), (void*)except_oop()); 45.15 + tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), p2i(except_oop())); 45.16 tty->print_cr(" thrown in interpreter method <%s>", METHOD->print_value_string()); 45.17 tty->print_cr(" at bci %d, continuing at %d for thread " INTPTR_FORMAT, 45.18 - istate->bcp() - (intptr_t)METHOD->code_base(), 45.19 - continuation_bci, THREAD); 45.20 + (int)(istate->bcp() - METHOD->code_base()), 45.21 + (int)continuation_bci, p2i(THREAD)); 45.22 } 45.23 // for AbortVMOnException flag 45.24 NOT_PRODUCT(Exceptions::debug_check_abort(except_oop)); 45.25 @@ -2829,11 +2829,11 @@ 45.26 if (TraceExceptions) { 45.27 ttyLocker ttyl; 45.28 ResourceMark rm; 45.29 - tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), (void*)except_oop()); 45.30 + tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), p2i(except_oop())); 45.31 tty->print_cr(" thrown in interpreter method <%s>", METHOD->print_value_string()); 45.32 tty->print_cr(" at bci %d, unwinding for thread " INTPTR_FORMAT, 45.33 - istate->bcp() - (intptr_t)METHOD->code_base(), 45.34 - THREAD); 45.35 + (int)(istate->bcp() - METHOD->code_base()), 45.36 + p2i(THREAD)); 45.37 } 45.38 // for AbortVMOnException flag 45.39 NOT_PRODUCT(Exceptions::debug_check_abort(except_oop)); 45.40 @@ -3432,7 +3432,7 @@ 45.41 tty->print_cr("osr._osr_buf: " INTPTR_FORMAT, (uintptr_t) this->_result._osr._osr_buf); 45.42 tty->print_cr("osr._osr_entry: " INTPTR_FORMAT, (uintptr_t) this->_result._osr._osr_entry); 45.43 tty->print_cr("prev_link: " INTPTR_FORMAT, (uintptr_t) this->_prev_link); 45.44 - tty->print_cr("native_mirror: " INTPTR_FORMAT, (void*) this->_oop_temp); 45.45 + tty->print_cr("native_mirror: " INTPTR_FORMAT, (uintptr_t) this->_oop_temp); 45.46 tty->print_cr("stack_base: " INTPTR_FORMAT, (uintptr_t) this->_stack_base); 45.47 tty->print_cr("stack_limit: " INTPTR_FORMAT, (uintptr_t) this->_stack_limit); 45.48 tty->print_cr("monitor_base: " INTPTR_FORMAT, (uintptr_t) this->_monitor_base);
46.1 --- a/src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp Wed Nov 19 15:02:01 2014 -0800 46.2 +++ b/src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp Mon Dec 01 11:29:12 2014 -0800 46.3 @@ -1,6 +1,6 @@ 46.4 /* 46.5 - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 46.6 - * Copyright 2012, 2013 SAP AG. All rights reserved. 46.7 + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. 46.8 + * Copyright 2012, 2014 SAP AG. All rights reserved. 46.9 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 46.10 * 46.11 * This code is free software; you can redistribute it and/or modify it 46.12 @@ -86,11 +86,11 @@ 46.13 " \t-> " PTR_FORMAT "(%d)", \ 46.14 (int) THREAD->osthread()->thread_id(), \ 46.15 BCI(), \ 46.16 - MDX(), \ 46.17 + p2i(MDX()), \ 46.18 (MDX() == NULL \ 46.19 ? 0 \ 46.20 : istate->method()->method_data()->dp_to_di((address)MDX())), \ 46.21 - mdx, \ 46.22 + p2i(mdx), \ 46.23 istate->method()->method_data()->dp_to_di((address)mdx) \ 46.24 ); \ 46.25 }; \ 46.26 @@ -107,7 +107,7 @@ 46.27 MethodData *md = istate->method()->method_data(); \ 46.28 tty->cr(); \ 46.29 tty->print("method data at mdx " PTR_FORMAT "(0) for", \ 46.30 - md->data_layout_at(md->bci_to_di(0))); \ 46.31 + p2i(md->data_layout_at(md->bci_to_di(0)))); \ 46.32 istate->method()->print_short_name(tty); \ 46.33 tty->cr(); \ 46.34 if (md != NULL) { \ 46.35 @@ -115,7 +115,7 @@ 46.36 address mdx = (address) MDX(); \ 46.37 if (mdx != NULL) { \ 46.38 tty->print_cr("current mdx " PTR_FORMAT "(%d)", \ 46.39 - mdx, \ 46.40 + p2i(mdx), \ 46.41 istate->method()->method_data()->dp_to_di(mdx)); \ 46.42 } \ 46.43 } else { \
47.1 --- a/src/share/vm/interpreter/bytecodes.hpp Wed Nov 19 15:02:01 2014 -0800 47.2 +++ b/src/share/vm/interpreter/bytecodes.hpp Mon Dec 01 11:29:12 2014 -0800 47.3 @@ -420,8 +420,10 @@ 47.4 static bool is_astore (Code code) { return (code == _astore || code == _astore_0 || code == _astore_1 47.5 || code == _astore_2 || code == _astore_3); } 47.6 47.7 + static bool is_const (Code code) { return (_aconst_null <= code && code <= _ldc2_w); } 47.8 static bool is_zero_const (Code code) { return (code == _aconst_null || code == _iconst_0 47.9 || code == _fconst_0 || code == _dconst_0); } 47.10 + static bool is_return (Code code) { return (_ireturn <= code && code <= _return); } 47.11 static bool is_invoke (Code code) { return (_invokevirtual <= code && code <= _invokedynamic); } 47.12 static bool has_receiver (Code code) { assert(is_invoke(code), ""); return code == _invokevirtual || 47.13 code == _invokespecial ||
48.1 --- a/src/share/vm/memory/metaspaceShared.cpp Wed Nov 19 15:02:01 2014 -0800 48.2 +++ b/src/share/vm/memory/metaspaceShared.cpp Mon Dec 01 11:29:12 2014 -0800 48.3 @@ -851,7 +851,7 @@ 48.4 ik->link_class(THREAD); 48.5 if (HAS_PENDING_EXCEPTION) { 48.6 ResourceMark rm; 48.7 - tty->print_cr("Preload Error: Verification failed for %s", 48.8 + tty->print_cr("Preload Warning: Verification failed for %s", 48.9 ik->external_name()); 48.10 CLEAR_PENDING_EXCEPTION; 48.11 ik->set_in_error_state();
49.1 --- a/src/share/vm/memory/universe.cpp Wed Nov 19 15:02:01 2014 -0800 49.2 +++ b/src/share/vm/memory/universe.cpp Mon Dec 01 11:29:12 2014 -0800 49.3 @@ -78,7 +78,7 @@ 49.4 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp" 49.5 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp" 49.6 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 49.7 -#include "gc_implementation/g1/g1CollectorPolicy.hpp" 49.8 +#include "gc_implementation/g1/g1CollectorPolicy_ext.hpp" 49.9 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" 49.10 #endif // INCLUDE_ALL_GCS 49.11 49.12 @@ -798,7 +798,7 @@ 49.13 49.14 } else if (UseG1GC) { 49.15 #if INCLUDE_ALL_GCS 49.16 - G1CollectorPolicy* g1p = new G1CollectorPolicy(); 49.17 + G1CollectorPolicyExt* g1p = new G1CollectorPolicyExt(); 49.18 g1p->initialize_all(); 49.19 G1CollectedHeap* g1h = new G1CollectedHeap(g1p); 49.20 Universe::_collectedHeap = g1h;
50.1 --- a/src/share/vm/oops/method.cpp Wed Nov 19 15:02:01 2014 -0800 50.2 +++ b/src/share/vm/oops/method.cpp Mon Dec 01 11:29:12 2014 -0800 50.3 @@ -558,6 +558,15 @@ 50.4 return true; 50.5 } 50.6 50.7 +bool Method::is_constant_getter() const { 50.8 + int last_index = code_size() - 1; 50.9 + // Check if the first 1-3 bytecodes are a constant push 50.10 + // and the last bytecode is a return. 50.11 + return (2 <= code_size() && code_size() <= 4 && 50.12 + Bytecodes::is_const(java_code_at(0)) && 50.13 + Bytecodes::length_for(java_code_at(0)) == last_index && 50.14 + Bytecodes::is_return(java_code_at(last_index))); 50.15 +} 50.16 50.17 bool Method::is_initializer() const { 50.18 return name() == vmSymbols::object_initializer_name() || is_static_initializer();
51.1 --- a/src/share/vm/oops/method.hpp Wed Nov 19 15:02:01 2014 -0800 51.2 +++ b/src/share/vm/oops/method.hpp Mon Dec 01 11:29:12 2014 -0800 51.3 @@ -619,6 +619,9 @@ 51.4 // returns true if the method is an accessor function (setter/getter). 51.5 bool is_accessor() const; 51.6 51.7 + // returns true if the method does nothing but return a constant of primitive type 51.8 + bool is_constant_getter() const; 51.9 + 51.10 // returns true if the method is an initializer (<init> or <clinit>). 51.11 bool is_initializer() const; 51.12
52.1 --- a/src/share/vm/oops/methodData.cpp Wed Nov 19 15:02:01 2014 -0800 52.2 +++ b/src/share/vm/oops/methodData.cpp Mon Dec 01 11:29:12 2014 -0800 52.3 @@ -1153,7 +1153,7 @@ 52.4 _backedge_counter_start = 0; 52.5 _num_loops = 0; 52.6 _num_blocks = 0; 52.7 - _would_profile = true; 52.8 + _would_profile = unknown; 52.9 52.10 #if INCLUDE_RTM_OPT 52.11 _rtm_state = NoRTM; // No RTM lock eliding by default
53.1 --- a/src/share/vm/oops/methodData.hpp Wed Nov 19 15:02:01 2014 -0800 53.2 +++ b/src/share/vm/oops/methodData.hpp Mon Dec 01 11:29:12 2014 -0800 53.3 @@ -2099,7 +2099,8 @@ 53.4 short _num_loops; 53.5 short _num_blocks; 53.6 // Does this method contain anything worth profiling? 53.7 - bool _would_profile; 53.8 + enum WouldProfile {unknown, no_profile, profile}; 53.9 + WouldProfile _would_profile; 53.10 53.11 // Size of _data array in bytes. (Excludes header and extra_data fields.) 53.12 int _data_size; 53.13 @@ -2268,8 +2269,8 @@ 53.14 } 53.15 #endif 53.16 53.17 - void set_would_profile(bool p) { _would_profile = p; } 53.18 - bool would_profile() const { return _would_profile; } 53.19 + void set_would_profile(bool p) { _would_profile = p ? profile : no_profile; } 53.20 + bool would_profile() const { return _would_profile != no_profile; } 53.21 53.22 int num_loops() const { return _num_loops; } 53.23 void set_num_loops(int n) { _num_loops = n; }
54.1 --- a/src/share/vm/opto/doCall.cpp Wed Nov 19 15:02:01 2014 -0800 54.2 +++ b/src/share/vm/opto/doCall.cpp Mon Dec 01 11:29:12 2014 -0800 54.3 @@ -791,7 +791,7 @@ 54.4 Node* ex_klass_node = NULL; 54.5 if (has_ex_handler() && !ex_type->klass_is_exact()) { 54.6 Node* p = basic_plus_adr( ex_node, ex_node, oopDesc::klass_offset_in_bytes()); 54.7 - ex_klass_node = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); 54.8 + ex_klass_node = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT)); 54.9 54.10 // Compute the exception klass a little more cleverly. 54.11 // Obvious solution is to simple do a LoadKlass from the 'ex_node'. 54.12 @@ -809,7 +809,7 @@ 54.13 continue; 54.14 } 54.15 Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes()); 54.16 - Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); 54.17 + Node* k = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT)); 54.18 ex_klass_node->init_req( i, k ); 54.19 } 54.20 _gvn.set_type(ex_klass_node, TypeKlassPtr::OBJECT);
55.1 --- a/src/share/vm/opto/graphKit.cpp Wed Nov 19 15:02:01 2014 -0800 55.2 +++ b/src/share/vm/opto/graphKit.cpp Mon Dec 01 11:29:12 2014 -0800 55.3 @@ -1150,7 +1150,7 @@ 55.4 Node* akls = AllocateNode::Ideal_klass(obj, &_gvn); 55.5 if (akls != NULL) return akls; 55.6 Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes()); 55.7 - return _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), k_adr, TypeInstPtr::KLASS) ); 55.8 + return _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), k_adr, TypeInstPtr::KLASS)); 55.9 } 55.10 55.11 //-------------------------load_array_length----------------------------------- 55.12 @@ -2542,7 +2542,7 @@ 55.13 // cache which is mutable so can't use immutable memory. Other 55.14 // types load from the super-class display table which is immutable. 55.15 Node *kmem = might_be_cache ? memory(p2) : immutable_memory(); 55.16 - Node *nkls = _gvn.transform( LoadKlassNode::make( _gvn, kmem, p2, _gvn.type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL ) ); 55.17 + Node* nkls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, kmem, p2, _gvn.type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL)); 55.18 55.19 // Compile speed common case: ARE a subtype and we canNOT fail 55.20 if( superklass == nkls )
56.1 --- a/src/share/vm/opto/library_call.cpp Wed Nov 19 15:02:01 2014 -0800 56.2 +++ b/src/share/vm/opto/library_call.cpp Mon Dec 01 11:29:12 2014 -0800 56.3 @@ -3398,7 +3398,7 @@ 56.4 if (region == NULL) never_see_null = true; 56.5 Node* p = basic_plus_adr(mirror, offset); 56.6 const TypeKlassPtr* kls_type = TypeKlassPtr::OBJECT_OR_NULL; 56.7 - Node* kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type)); 56.8 + Node* kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type)); 56.9 Node* null_ctl = top(); 56.10 kls = null_check_oop(kls, &null_ctl, never_see_null); 56.11 if (region != NULL) { 56.12 @@ -3574,7 +3574,7 @@ 56.13 phi->add_req(makecon(TypeInstPtr::make(env()->Object_klass()->java_mirror()))); 56.14 // If we fall through, it's a plain class. Get its _super. 56.15 p = basic_plus_adr(kls, in_bytes(Klass::super_offset())); 56.16 - kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL)); 56.17 + kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL)); 56.18 null_ctl = top(); 56.19 kls = null_check_oop(kls, &null_ctl); 56.20 if (null_ctl != top()) { 56.21 @@ -3656,7 +3656,7 @@ 56.22 args[which_arg] = arg; 56.23 56.24 Node* p = basic_plus_adr(arg, class_klass_offset); 56.25 - Node* kls = LoadKlassNode::make(_gvn, immutable_memory(), p, adr_type, kls_type); 56.26 + Node* kls = LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, adr_type, kls_type); 56.27 klasses[which_arg] = _gvn.transform(kls); 56.28 } 56.29 56.30 @@ -5172,7 +5172,7 @@ 56.31 // (At this point we can assume disjoint_bases, since types differ.) 56.32 int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset()); 56.33 Node* p1 = basic_plus_adr(dest_klass, ek_offset); 56.34 - Node* n1 = LoadKlassNode::make(_gvn, immutable_memory(), p1, TypeRawPtr::BOTTOM); 56.35 + Node* n1 = LoadKlassNode::make(_gvn, NULL, immutable_memory(), p1, TypeRawPtr::BOTTOM); 56.36 Node* dest_elem_klass = _gvn.transform(n1); 56.37 Node* cv = generate_checkcast_arraycopy(adr_type, 56.38 dest_elem_klass,
57.1 --- a/src/share/vm/opto/macro.cpp Wed Nov 19 15:02:01 2014 -0800 57.2 +++ b/src/share/vm/opto/macro.cpp Mon Dec 01 11:29:12 2014 -0800 57.3 @@ -2194,7 +2194,7 @@ 57.4 Node* klass_node = AllocateNode::Ideal_klass(obj, &_igvn); 57.5 if (klass_node == NULL) { 57.6 Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes()); 57.7 - klass_node = transform_later( LoadKlassNode::make(_igvn, mem, k_adr, _igvn.type(k_adr)->is_ptr()) ); 57.8 + klass_node = transform_later(LoadKlassNode::make(_igvn, NULL, mem, k_adr, _igvn.type(k_adr)->is_ptr())); 57.9 #ifdef _LP64 57.10 if (UseCompressedClassPointers && klass_node->is_DecodeNKlass()) { 57.11 assert(klass_node->in(1)->Opcode() == Op_LoadNKlass, "sanity");
58.1 --- a/src/share/vm/opto/memnode.cpp Wed Nov 19 15:02:01 2014 -0800 58.2 +++ b/src/share/vm/opto/memnode.cpp Mon Dec 01 11:29:12 2014 -0800 58.3 @@ -859,6 +859,10 @@ 58.4 58.5 58.6 //============================================================================= 58.7 +// Should LoadNode::Ideal() attempt to remove control edges? 58.8 +bool LoadNode::can_remove_control() const { 58.9 + return true; 58.10 +} 58.11 uint LoadNode::size_of() const { return sizeof(*this); } 58.12 uint LoadNode::cmp( const Node &n ) const 58.13 { return !Type::cmp( _type, ((LoadNode&)n)._type ); } 58.14 @@ -1455,7 +1459,7 @@ 58.15 } 58.16 58.17 //------------------------------Ideal------------------------------------------ 58.18 -// If the load is from Field memory and the pointer is non-null, we can 58.19 +// If the load is from Field memory and the pointer is non-null, it might be possible to 58.20 // zero out the control input. 58.21 // If the offset is constant and the base is an object allocation, 58.22 // try to hook me up to the exact initializing store. 58.23 @@ -1480,6 +1484,7 @@ 58.24 && phase->C->get_alias_index(phase->type(address)->is_ptr()) != Compile::AliasIdxRaw) { 58.25 // Check for useless control edge in some common special cases 58.26 if (in(MemNode::Control) != NULL 58.27 + && can_remove_control() 58.28 && phase->type(base)->higher_equal(TypePtr::NOTNULL) 58.29 && all_controls_dominate(base, phase->C->start())) { 58.30 // A method-invariant, non-null address (constant or 'this' argument). 58.31 @@ -2007,9 +2012,8 @@ 58.32 //============================================================================= 58.33 //----------------------------LoadKlassNode::make------------------------------ 58.34 // Polymorphic factory method: 58.35 -Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, const TypeKlassPtr *tk ) { 58.36 +Node* LoadKlassNode::make(PhaseGVN& gvn, Node* ctl, Node *mem, Node *adr, const TypePtr* at, const TypeKlassPtr *tk) { 58.37 Compile* C = gvn.C; 58.38 - Node *ctl = NULL; 58.39 // sanity check the alias category against the created node type 58.40 const TypePtr *adr_type = adr->bottom_type()->isa_ptr(); 58.41 assert(adr_type != NULL, "expecting TypeKlassPtr"); 58.42 @@ -2029,6 +2033,12 @@ 58.43 return klass_value_common(phase); 58.44 } 58.45 58.46 +// In most cases, LoadKlassNode does not have the control input set. If the control 58.47 +// input is set, it must not be removed (by LoadNode::Ideal()). 58.48 +bool LoadKlassNode::can_remove_control() const { 58.49 + return false; 58.50 +} 58.51 + 58.52 const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const { 58.53 // Either input is TOP ==> the result is TOP 58.54 const Type *t1 = phase->type( in(MemNode::Memory) );
59.1 --- a/src/share/vm/opto/memnode.hpp Wed Nov 19 15:02:01 2014 -0800 59.2 +++ b/src/share/vm/opto/memnode.hpp Mon Dec 01 11:29:12 2014 -0800 59.3 @@ -148,6 +148,8 @@ 59.4 protected: 59.5 virtual uint cmp(const Node &n) const; 59.6 virtual uint size_of() const; // Size is bigger 59.7 + // Should LoadNode::Ideal() attempt to remove control edges? 59.8 + virtual bool can_remove_control() const; 59.9 const Type* const _type; // What kind of value is loaded? 59.10 public: 59.11 59.12 @@ -171,8 +173,10 @@ 59.13 // we are equivalent to. We look for Load of a Store. 59.14 virtual Node *Identity( PhaseTransform *phase ); 59.15 59.16 - // If the load is from Field memory and the pointer is non-null, we can 59.17 + // If the load is from Field memory and the pointer is non-null, it might be possible to 59.18 // zero out the control input. 59.19 + // If the offset is constant and the base is an object allocation, 59.20 + // try to hook me up to the exact initializing store. 59.21 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 59.22 59.23 // Split instance field load through Phi. 59.24 @@ -413,6 +417,10 @@ 59.25 //------------------------------LoadKlassNode---------------------------------- 59.26 // Load a Klass from an object 59.27 class LoadKlassNode : public LoadPNode { 59.28 +protected: 59.29 + // In most cases, LoadKlassNode does not have the control input set. If the control 59.30 + // input is set, it must not be removed (by LoadNode::Ideal()). 59.31 + virtual bool can_remove_control() const; 59.32 public: 59.33 LoadKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeKlassPtr *tk, MemOrd mo) 59.34 : LoadPNode(c, mem, adr, at, tk, mo) {} 59.35 @@ -422,8 +430,8 @@ 59.36 virtual bool depends_only_on_test() const { return true; } 59.37 59.38 // Polymorphic factory method: 59.39 - static Node* make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, 59.40 - const TypeKlassPtr *tk = TypeKlassPtr::OBJECT ); 59.41 + static Node* make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at, 59.42 + const TypeKlassPtr* tk = TypeKlassPtr::OBJECT); 59.43 }; 59.44 59.45 //------------------------------LoadNKlassNode---------------------------------
60.1 --- a/src/share/vm/opto/parse1.cpp Wed Nov 19 15:02:01 2014 -0800 60.2 +++ b/src/share/vm/opto/parse1.cpp Mon Dec 01 11:29:12 2014 -0800 60.3 @@ -1958,7 +1958,7 @@ 60.4 // finalization. In general this will fold up since the concrete 60.5 // class is often visible so the access flags are constant. 60.6 Node* klass_addr = basic_plus_adr( receiver, receiver, oopDesc::klass_offset_in_bytes() ); 60.7 - Node* klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), klass_addr, TypeInstPtr::KLASS) ); 60.8 + Node* klass = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), klass_addr, TypeInstPtr::KLASS)); 60.9 60.10 Node* access_flags_addr = basic_plus_adr(klass, klass, in_bytes(Klass::access_flags_offset())); 60.11 Node* access_flags = make_load(NULL, access_flags_addr, TypeInt::INT, T_INT, MemNode::unordered);
61.1 --- a/src/share/vm/opto/parseHelper.cpp Wed Nov 19 15:02:01 2014 -0800 61.2 +++ b/src/share/vm/opto/parseHelper.cpp Mon Dec 01 11:29:12 2014 -0800 61.3 @@ -156,22 +156,43 @@ 61.4 int klass_offset = oopDesc::klass_offset_in_bytes(); 61.5 Node* p = basic_plus_adr( ary, ary, klass_offset ); 61.6 // p's type is array-of-OOPS plus klass_offset 61.7 - Node* array_klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS) ); 61.8 + Node* array_klass = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS)); 61.9 // Get the array klass 61.10 const TypeKlassPtr *tak = _gvn.type(array_klass)->is_klassptr(); 61.11 61.12 - // array_klass's type is generally INexact array-of-oop. Heroically 61.13 - // cast the array klass to EXACT array and uncommon-trap if the cast 61.14 - // fails. 61.15 + // The type of array_klass is usually INexact array-of-oop. Heroically 61.16 + // cast array_klass to EXACT array and uncommon-trap if the cast fails. 61.17 + // Make constant out of the inexact array klass, but use it only if the cast 61.18 + // succeeds. 61.19 bool always_see_exact_class = false; 61.20 if (MonomorphicArrayCheck 61.21 - && !too_many_traps(Deoptimization::Reason_array_check)) { 61.22 + && !too_many_traps(Deoptimization::Reason_array_check) 61.23 + && !tak->klass_is_exact() 61.24 + && tak != TypeKlassPtr::OBJECT) { 61.25 + // Regarding the fourth condition in the if-statement from above: 61.26 + // 61.27 + // If the compiler has determined that the type of array 'ary' (represented 61.28 + // by 'array_klass') is java/lang/Object, the compiler must not assume that 61.29 + // the array 'ary' is monomorphic. 61.30 + // 61.31 + // If 'ary' were of type java/lang/Object, this arraystore would have to fail, 61.32 + // because it is not possible to perform a arraystore into an object that is not 61.33 + // a "proper" array. 61.34 + // 61.35 + // Therefore, let's obtain at runtime the type of 'ary' and check if we can still 61.36 + // successfully perform the store. 61.37 + // 61.38 + // The implementation reasons for the condition are the following: 61.39 + // 61.40 + // java/lang/Object is the superclass of all arrays, but it is represented by the VM 61.41 + // as an InstanceKlass. The checks generated by gen_checkcast() (see below) expect 61.42 + // 'array_klass' to be ObjArrayKlass, which can result in invalid memory accesses. 61.43 + // 61.44 + // See issue JDK-8057622 for details. 61.45 + 61.46 always_see_exact_class = true; 61.47 // (If no MDO at all, hope for the best, until a trap actually occurs.) 61.48 - } 61.49 61.50 - // Is the array klass is exactly its defined type? 61.51 - if (always_see_exact_class && !tak->klass_is_exact()) { 61.52 // Make a constant out of the inexact array klass 61.53 const TypeKlassPtr *extak = tak->cast_to_exactness(true)->is_klassptr(); 61.54 Node* con = makecon(extak); 61.55 @@ -202,11 +223,15 @@ 61.56 // Extract the array element class 61.57 int element_klass_offset = in_bytes(ObjArrayKlass::element_klass_offset()); 61.58 Node *p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset); 61.59 - Node *a_e_klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p2, tak) ); 61.60 + // We are allowed to use the constant type only if cast succeeded. If always_see_exact_class is true, 61.61 + // we must set a control edge from the IfTrue node created by the uncommon_trap above to the 61.62 + // LoadKlassNode. 61.63 + Node* a_e_klass = _gvn.transform(LoadKlassNode::make(_gvn, always_see_exact_class ? control() : NULL, 61.64 + immutable_memory(), p2, tak)); 61.65 61.66 // Check (the hard way) and throw if not a subklass. 61.67 // Result is ignored, we just need the CFG effects. 61.68 - gen_checkcast( obj, a_e_klass ); 61.69 + gen_checkcast(obj, a_e_klass); 61.70 } 61.71 61.72
62.1 --- a/src/share/vm/prims/whitebox.cpp Wed Nov 19 15:02:01 2014 -0800 62.2 +++ b/src/share/vm/prims/whitebox.cpp Mon Dec 01 11:29:12 2014 -0800 62.3 @@ -300,7 +300,7 @@ 62.4 // NMT picks it up correctly 62.5 WB_ENTRY(jlong, WB_NMTMalloc(JNIEnv* env, jobject o, jlong size)) 62.6 jlong addr = 0; 62.7 - addr = (jlong)(uintptr_t)os::malloc(size, mtTest); 62.8 + addr = (jlong)(uintptr_t)os::malloc(size, mtTest); 62.9 return addr; 62.10 WB_END 62.11 62.12 @@ -309,7 +309,7 @@ 62.13 WB_ENTRY(jlong, WB_NMTMallocWithPseudoStack(JNIEnv* env, jobject o, jlong size, jint pseudo_stack)) 62.14 address pc = (address)(size_t)pseudo_stack; 62.15 NativeCallStack stack(&pc, 1); 62.16 - return (jlong)os::malloc(size, mtTest, stack); 62.17 + return (jlong)(uintptr_t)os::malloc(size, mtTest, stack); 62.18 WB_END 62.19 62.20 // Free the memory allocated by NMTAllocTest 62.21 @@ -344,15 +344,6 @@ 62.22 return MemTracker::tracking_level() == NMT_detail; 62.23 WB_END 62.24 62.25 -WB_ENTRY(void, WB_NMTOverflowHashBucket(JNIEnv* env, jobject o, jlong num)) 62.26 - address pc = (address)1; 62.27 - for (jlong index = 0; index < num; index ++) { 62.28 - NativeCallStack stack(&pc, 1); 62.29 - os::malloc(0, mtTest, stack); 62.30 - pc += MallocSiteTable::hash_buckets(); 62.31 - } 62.32 -WB_END 62.33 - 62.34 WB_ENTRY(jboolean, WB_NMTChangeTrackingLevel(JNIEnv* env)) 62.35 // Test that we can downgrade NMT levels but not upgrade them. 62.36 if (MemTracker::tracking_level() == NMT_off) { 62.37 @@ -383,6 +374,12 @@ 62.38 return MemTracker::tracking_level() == NMT_minimal; 62.39 } 62.40 WB_END 62.41 + 62.42 +WB_ENTRY(jint, WB_NMTGetHashSize(JNIEnv* env, jobject o)) 62.43 + int hash_size = MallocSiteTable::hash_buckets(); 62.44 + assert(hash_size > 0, "NMT hash_size should be > 0"); 62.45 + return (jint)hash_size; 62.46 +WB_END 62.47 #endif // INCLUDE_NMT 62.48 62.49 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) { 62.50 @@ -981,9 +978,9 @@ 62.51 {CC"NMTCommitMemory", CC"(JJ)V", (void*)&WB_NMTCommitMemory }, 62.52 {CC"NMTUncommitMemory", CC"(JJ)V", (void*)&WB_NMTUncommitMemory }, 62.53 {CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory }, 62.54 - {CC"NMTOverflowHashBucket", CC"(J)V", (void*)&WB_NMTOverflowHashBucket}, 62.55 {CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported}, 62.56 {CC"NMTChangeTrackingLevel", CC"()Z", (void*)&WB_NMTChangeTrackingLevel}, 62.57 + {CC"NMTGetHashSize", CC"()I", (void*)&WB_NMTGetHashSize }, 62.58 #endif // INCLUDE_NMT 62.59 {CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll }, 62.60 {CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Executable;Z)I",
63.1 --- a/src/share/vm/runtime/advancedThresholdPolicy.cpp Wed Nov 19 15:02:01 2014 -0800 63.2 +++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp Mon Dec 01 11:29:12 2014 -0800 63.3 @@ -316,8 +316,8 @@ 63.4 * c. 0 -> (3->2) -> 4. 63.5 * In this case we enqueue a method for compilation at level 3, but the C1 queue is long enough 63.6 * to enable the profiling to fully occur at level 0. In this case we change the compilation level 63.7 - * of the method to 2, because it'll allow it to run much faster without full profiling while c2 63.8 - * is compiling. 63.9 + * of the method to 2 while the request is still in-queue, because it'll allow it to run much faster 63.10 + * without full profiling while c2 is compiling. 63.11 * 63.12 * d. 0 -> 3 -> 1 or 0 -> 2 -> 1. 63.13 * After a method was once compiled with C1 it can be identified as trivial and be compiled to
64.1 --- a/src/share/vm/runtime/arguments.cpp Wed Nov 19 15:02:01 2014 -0800 64.2 +++ b/src/share/vm/runtime/arguments.cpp Mon Dec 01 11:29:12 2014 -0800 64.3 @@ -2233,7 +2233,7 @@ 64.4 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); 64.5 } 64.6 64.7 - status = status && ArgumentsExt::check_gc_consistency_user(); 64.8 + status = status && check_gc_consistency_user(); 64.9 status = status && check_stack_pages(); 64.10 64.11 if (CMSIncrementalMode) { 64.12 @@ -2962,6 +2962,23 @@ 64.13 #endif 64.14 // -D 64.15 } else if (match_option(option, "-D", &tail)) { 64.16 + if (CheckEndorsedAndExtDirs) { 64.17 + if (match_option(option, "-Djava.endorsed.dirs=", &tail)) { 64.18 + // abort if -Djava.endorsed.dirs is set 64.19 + jio_fprintf(defaultStream::output_stream(), 64.20 + "-Djava.endorsed.dirs will not be supported in a future release.\n" 64.21 + "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n"); 64.22 + return JNI_EINVAL; 64.23 + } 64.24 + if (match_option(option, "-Djava.ext.dirs=", &tail)) { 64.25 + // abort if -Djava.ext.dirs is set 64.26 + jio_fprintf(defaultStream::output_stream(), 64.27 + "-Djava.ext.dirs will not be supported in a future release.\n" 64.28 + "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n"); 64.29 + return JNI_EINVAL; 64.30 + } 64.31 + } 64.32 + 64.33 if (!add_property(tail)) { 64.34 return JNI_ENOMEM; 64.35 } 64.36 @@ -3395,6 +3412,146 @@ 64.37 } 64.38 } 64.39 64.40 +static bool has_jar_files(const char* directory) { 64.41 + DIR* dir = os::opendir(directory); 64.42 + if (dir == NULL) return false; 64.43 + 64.44 + struct dirent *entry; 64.45 + char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal); 64.46 + bool hasJarFile = false; 64.47 + while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) { 64.48 + const char* name = entry->d_name; 64.49 + const char* ext = name + strlen(name) - 4; 64.50 + hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0); 64.51 + } 64.52 + FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); 64.53 + os::closedir(dir); 64.54 + return hasJarFile ; 64.55 +} 64.56 + 64.57 +// returns the number of directories in the given path containing JAR files 64.58 +// If the skip argument is not NULL, it will skip that directory 64.59 +static int check_non_empty_dirs(const char* path, const char* type, const char* skip) { 64.60 + const char separator = *os::path_separator(); 64.61 + const char* const end = path + strlen(path); 64.62 + int nonEmptyDirs = 0; 64.63 + while (path < end) { 64.64 + const char* tmp_end = strchr(path, separator); 64.65 + if (tmp_end == NULL) { 64.66 + if ((skip == NULL || strcmp(path, skip) != 0) && has_jar_files(path)) { 64.67 + nonEmptyDirs++; 64.68 + jio_fprintf(defaultStream::output_stream(), 64.69 + "Non-empty %s directory: %s\n", type, path); 64.70 + } 64.71 + path = end; 64.72 + } else { 64.73 + char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal); 64.74 + memcpy(dirpath, path, tmp_end - path); 64.75 + dirpath[tmp_end - path] = '\0'; 64.76 + if ((skip == NULL || strcmp(dirpath, skip) != 0) && has_jar_files(dirpath)) { 64.77 + nonEmptyDirs++; 64.78 + jio_fprintf(defaultStream::output_stream(), 64.79 + "Non-empty %s directory: %s\n", type, dirpath); 64.80 + } 64.81 + FREE_C_HEAP_ARRAY(char, dirpath, mtInternal); 64.82 + path = tmp_end + 1; 64.83 + } 64.84 + } 64.85 + return nonEmptyDirs; 64.86 +} 64.87 + 64.88 +// Returns true if endorsed standards override mechanism and extension mechanism 64.89 +// are not used. 64.90 +static bool check_endorsed_and_ext_dirs() { 64.91 + if (!CheckEndorsedAndExtDirs) 64.92 + return true; 64.93 + 64.94 + char endorsedDir[JVM_MAXPATHLEN]; 64.95 + char extDir[JVM_MAXPATHLEN]; 64.96 + const char* fileSep = os::file_separator(); 64.97 + jio_snprintf(endorsedDir, sizeof(endorsedDir), "%s%slib%sendorsed", 64.98 + Arguments::get_java_home(), fileSep, fileSep); 64.99 + jio_snprintf(extDir, sizeof(extDir), "%s%slib%sext", 64.100 + Arguments::get_java_home(), fileSep, fileSep); 64.101 + 64.102 + // check endorsed directory 64.103 + int nonEmptyDirs = check_non_empty_dirs(Arguments::get_endorsed_dir(), "endorsed", NULL); 64.104 + 64.105 + // check the extension directories but skip the default lib/ext directory 64.106 + nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs(), "extension", extDir); 64.107 + 64.108 + // List of JAR files installed in the default lib/ext directory. 64.109 + // -XX:+CheckEndorsedAndExtDirs checks if any non-JDK file installed 64.110 + static const char* jdk_ext_jars[] = { 64.111 + "access-bridge-32.jar", 64.112 + "access-bridge-64.jar", 64.113 + "access-bridge.jar", 64.114 + "cldrdata.jar", 64.115 + "dnsns.jar", 64.116 + "jaccess.jar", 64.117 + "jfxrt.jar", 64.118 + "localedata.jar", 64.119 + "nashorn.jar", 64.120 + "sunec.jar", 64.121 + "sunjce_provider.jar", 64.122 + "sunmscapi.jar", 64.123 + "sunpkcs11.jar", 64.124 + "ucrypto.jar", 64.125 + "zipfs.jar", 64.126 + NULL 64.127 + }; 64.128 + 64.129 + // check if the default lib/ext directory has any non-JDK jar files; if so, error 64.130 + DIR* dir = os::opendir(extDir); 64.131 + if (dir != NULL) { 64.132 + int num_ext_jars = 0; 64.133 + struct dirent *entry; 64.134 + char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(extDir), mtInternal); 64.135 + while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) { 64.136 + const char* name = entry->d_name; 64.137 + const char* ext = name + strlen(name) - 4; 64.138 + if (ext > name && (os::file_name_strcmp(ext, ".jar") == 0)) { 64.139 + bool is_jdk_jar = false; 64.140 + const char* jarfile = NULL; 64.141 + for (int i=0; (jarfile = jdk_ext_jars[i]) != NULL; i++) { 64.142 + if (os::file_name_strcmp(name, jarfile) == 0) { 64.143 + is_jdk_jar = true; 64.144 + break; 64.145 + } 64.146 + } 64.147 + if (!is_jdk_jar) { 64.148 + jio_fprintf(defaultStream::output_stream(), 64.149 + "%s installed in <JAVA_HOME>/lib/ext\n", name); 64.150 + num_ext_jars++; 64.151 + } 64.152 + } 64.153 + } 64.154 + FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); 64.155 + os::closedir(dir); 64.156 + if (num_ext_jars > 0) { 64.157 + nonEmptyDirs += 1; 64.158 + } 64.159 + } 64.160 + 64.161 + // check if the default lib/endorsed directory exists; if so, error 64.162 + dir = os::opendir(endorsedDir); 64.163 + if (dir != NULL) { 64.164 + jio_fprintf(defaultStream::output_stream(), "<JAVA_HOME>/lib/endorsed exists\n"); 64.165 + os::closedir(dir); 64.166 + nonEmptyDirs += 1; 64.167 + } 64.168 + 64.169 + if (nonEmptyDirs > 0) { 64.170 + jio_fprintf(defaultStream::output_stream(), 64.171 + "Endorsed standards override mechanism and extension mechanism" 64.172 + "will not be supported in a future release.\n" 64.173 + "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n"); 64.174 + return false; 64.175 + } 64.176 + 64.177 + return true; 64.178 +} 64.179 + 64.180 jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) { 64.181 // This must be done after all -D arguments have been processed. 64.182 scp_p->expand_endorsed(); 64.183 @@ -3404,6 +3561,10 @@ 64.184 Arguments::set_sysclasspath(scp_p->combined_path()); 64.185 } 64.186 64.187 + if (!check_endorsed_and_ext_dirs()) { 64.188 + return JNI_ERR; 64.189 + } 64.190 + 64.191 // This must be done after all arguments have been processed. 64.192 // java_compiler() true means set to "NONE" or empty. 64.193 if (java_compiler() && !xdebug_mode()) { 64.194 @@ -3464,7 +3625,7 @@ 64.195 } 64.196 } 64.197 64.198 - if (!ArgumentsExt::check_vm_args_consistency()) { 64.199 + if (!check_vm_args_consistency()) { 64.200 return JNI_ERR; 64.201 } 64.202 64.203 @@ -3867,7 +4028,7 @@ 64.204 // Set heap size based on available physical memory 64.205 set_heap_size(); 64.206 64.207 - set_gc_specific_flags(); 64.208 + ArgumentsExt::set_gc_specific_flags(); 64.209 64.210 // Initialize Metaspace flags and alignments. 64.211 Metaspace::ergo_initialize();
65.1 --- a/src/share/vm/runtime/arguments.hpp Wed Nov 19 15:02:01 2014 -0800 65.2 +++ b/src/share/vm/runtime/arguments.hpp Mon Dec 01 11:29:12 2014 -0800 65.3 @@ -342,7 +342,6 @@ 65.4 static void select_gc(); 65.5 static void set_ergonomics_flags(); 65.6 static void set_shared_spaces_flags(); 65.7 - static void set_gc_specific_flags(); 65.8 // limits the given memory size by the maximum amount of memory this process is 65.9 // currently allowed to allocate or reserve. 65.10 static julong limit_by_allocatable_memory(julong size); 65.11 @@ -454,6 +453,7 @@ 65.12 // Adjusts the arguments after the OS have adjusted the arguments 65.13 static jint adjust_after_os(); 65.14 65.15 + static void set_gc_specific_flags(); 65.16 static inline bool gc_selected(); // whether a gc has been selected 65.17 static void select_gc_ergonomically(); 65.18
66.1 --- a/src/share/vm/runtime/arguments_ext.hpp Wed Nov 19 15:02:01 2014 -0800 66.2 +++ b/src/share/vm/runtime/arguments_ext.hpp Mon Dec 01 11:29:12 2014 -0800 66.3 @@ -31,9 +31,8 @@ 66.4 class ArgumentsExt: AllStatic { 66.5 public: 66.6 static inline void select_gc_ergonomically(); 66.7 - static inline bool check_gc_consistency_user(); 66.8 + static inline void set_gc_specific_flags(); 66.9 static inline bool check_gc_consistency_ergo(); 66.10 - static inline bool check_vm_args_consistency(); 66.11 static void process_options(const JavaVMInitArgs* args) {} 66.12 }; 66.13 66.14 @@ -41,16 +40,12 @@ 66.15 Arguments::select_gc_ergonomically(); 66.16 } 66.17 66.18 -bool ArgumentsExt::check_gc_consistency_user() { 66.19 - return Arguments::check_gc_consistency_user(); 66.20 +void ArgumentsExt::set_gc_specific_flags() { 66.21 + Arguments::set_gc_specific_flags(); 66.22 } 66.23 66.24 bool ArgumentsExt::check_gc_consistency_ergo() { 66.25 return Arguments::check_gc_consistency_ergo(); 66.26 } 66.27 66.28 -bool ArgumentsExt::check_vm_args_consistency() { 66.29 - return Arguments::check_vm_args_consistency(); 66.30 -} 66.31 - 66.32 #endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP
67.1 --- a/src/share/vm/runtime/globals.hpp Wed Nov 19 15:02:01 2014 -0800 67.2 +++ b/src/share/vm/runtime/globals.hpp Mon Dec 01 11:29:12 2014 -0800 67.3 @@ -1210,6 +1210,9 @@ 67.4 product(bool, CheckJNICalls, false, \ 67.5 "Verify all arguments to JNI calls") \ 67.6 \ 67.7 + product(bool, CheckEndorsedAndExtDirs, false, \ 67.8 + "Verify the endorsed and extension directories are not used") \ 67.9 + \ 67.10 product(bool, UseFastJNIAccessors, true, \ 67.11 "Use optimized versions of Get<Primitive>Field") \ 67.12 \
68.1 --- a/src/share/vm/runtime/interfaceSupport.cpp Wed Nov 19 15:02:01 2014 -0800 68.2 +++ b/src/share/vm/runtime/interfaceSupport.cpp Mon Dec 01 11:29:12 2014 -0800 68.3 @@ -85,7 +85,7 @@ 68.4 // Short-circuit any possible re-entrant gc-a-lot attempt 68.5 if (thread->skip_gcalot()) return; 68.6 68.7 - if (is_init_completed()) { 68.8 + if (Threads::is_vm_complete()) { 68.9 68.10 if (++_fullgc_alot_invocation < FullGCALotStart) { 68.11 return;
69.1 --- a/src/share/vm/runtime/os.cpp Wed Nov 19 15:02:01 2014 -0800 69.2 +++ b/src/share/vm/runtime/os.cpp Mon Dec 01 11:29:12 2014 -0800 69.3 @@ -571,17 +571,6 @@ 69.4 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1)); 69.5 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size)); 69.6 69.7 -#if INCLUDE_NMT 69.8 - // NMT can not track malloc allocation size > MAX_MALLOC_SIZE, which is 69.9 - // (1GB - 1) on 32-bit system. It is not an issue on 64-bit system, where 69.10 - // MAX_MALLOC_SIZE = ((1 << 62) - 1). 69.11 - // VM code does not have such large malloc allocation. However, it can come 69.12 - // Unsafe call. 69.13 - if (MemTracker::tracking_level() >= NMT_summary && size > MAX_MALLOC_SIZE) { 69.14 - return NULL; 69.15 - } 69.16 -#endif 69.17 - 69.18 #ifdef ASSERT 69.19 // checking for the WatcherThread and crash_protection first 69.20 // since os::malloc can be called when the libjvm.{dll,so} is 69.21 @@ -652,12 +641,6 @@ 69.22 } 69.23 69.24 void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCallStack& stack) { 69.25 -#if INCLUDE_NMT 69.26 - // See comments in os::malloc() above 69.27 - if (MemTracker::tracking_level() >= NMT_summary && size > MAX_MALLOC_SIZE) { 69.28 - return NULL; 69.29 - } 69.30 -#endif 69.31 69.32 #ifndef ASSERT 69.33 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1));
70.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp Wed Nov 19 15:02:01 2014 -0800 70.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp Mon Dec 01 11:29:12 2014 -0800 70.3 @@ -54,13 +54,17 @@ 70.4 // Simple methods are as good being compiled with C1 as C2. 70.5 // Determine if a given method is such a case. 70.6 bool SimpleThresholdPolicy::is_trivial(Method* method) { 70.7 - if (method->is_accessor()) return true; 70.8 - if (method->code() != NULL) { 70.9 - MethodData* mdo = method->method_data(); 70.10 - if (mdo != NULL && mdo->num_loops() == 0 && 70.11 - (method->code_size() < 5 || (mdo->num_blocks() < 4) && (method->code_size() < 15))) { 70.12 - return !mdo->would_profile(); 70.13 - } 70.14 + if (method->is_accessor() || 70.15 + method->is_constant_getter()) { 70.16 + return true; 70.17 + } 70.18 + if (method->has_loops() || method->code_size() >= 15) { 70.19 + return false; 70.20 + } 70.21 + MethodData* mdo = method->method_data(); 70.22 + if (mdo != NULL && !mdo->would_profile() && 70.23 + (method->code_size() < 5 || (mdo->num_blocks() < 4))) { 70.24 + return true; 70.25 } 70.26 return false; 70.27 }
71.1 --- a/src/share/vm/services/mallocTracker.cpp Wed Nov 19 15:02:01 2014 -0800 71.2 +++ b/src/share/vm/services/mallocTracker.cpp Mon Dec 01 11:29:12 2014 -0800 71.3 @@ -72,7 +72,7 @@ 71.4 71.5 MallocMemorySummary::record_free(size(), flags()); 71.6 MallocMemorySummary::record_free_malloc_header(sizeof(MallocHeader)); 71.7 - if (tracking_level() == NMT_detail) { 71.8 + if (MemTracker::tracking_level() == NMT_detail) { 71.9 MallocSiteTable::deallocation_at(size(), _bucket_idx, _pos_idx); 71.10 } 71.11 } 71.12 @@ -128,36 +128,18 @@ 71.13 } 71.14 71.15 // Uses placement global new operator to initialize malloc header 71.16 - switch(level) { 71.17 - case NMT_off: 71.18 - return malloc_base; 71.19 - case NMT_minimal: { 71.20 - MallocHeader* hdr = ::new (malloc_base) MallocHeader(); 71.21 - break; 71.22 - } 71.23 - case NMT_summary: { 71.24 - assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT"); 71.25 - header = ::new (malloc_base) MallocHeader(size, flags); 71.26 - break; 71.27 - } 71.28 - case NMT_detail: { 71.29 - assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT"); 71.30 - header = ::new (malloc_base) MallocHeader(size, flags, stack); 71.31 - break; 71.32 - } 71.33 - default: 71.34 - ShouldNotReachHere(); 71.35 + 71.36 + if (level == NMT_off) { 71.37 + return malloc_base; 71.38 } 71.39 + 71.40 + header = ::new (malloc_base)MallocHeader(size, flags, stack, level); 71.41 memblock = (void*)((char*)malloc_base + sizeof(MallocHeader)); 71.42 71.43 // The alignment check: 8 bytes alignment for 32 bit systems. 71.44 // 16 bytes alignment for 64-bit systems. 71.45 assert(((size_t)memblock & (sizeof(size_t) * 2 - 1)) == 0, "Alignment check"); 71.46 71.47 - // Sanity check 71.48 - assert(get_memory_tracking_level(memblock) == level, 71.49 - "Wrong tracking level"); 71.50 - 71.51 #ifdef ASSERT 71.52 if (level > NMT_minimal) { 71.53 // Read back
72.1 --- a/src/share/vm/services/mallocTracker.hpp Wed Nov 19 15:02:01 2014 -0800 72.2 +++ b/src/share/vm/services/mallocTracker.hpp Mon Dec 01 11:29:12 2014 -0800 72.3 @@ -239,68 +239,46 @@ 72.4 72.5 class MallocHeader VALUE_OBJ_CLASS_SPEC { 72.6 #ifdef _LP64 72.7 - size_t _size : 62; 72.8 - size_t _level : 2; 72.9 + size_t _size : 64; 72.10 size_t _flags : 8; 72.11 size_t _pos_idx : 16; 72.12 size_t _bucket_idx: 40; 72.13 -#define MAX_MALLOCSITE_TABLE_SIZE ((size_t)1 << 40) 72.14 -#define MAX_BUCKET_LENGTH ((size_t)(1 << 16)) 72.15 -#define MAX_MALLOC_SIZE (((size_t)1 << 62) - 1) 72.16 +#define MAX_MALLOCSITE_TABLE_SIZE right_n_bits(40) 72.17 +#define MAX_BUCKET_LENGTH right_n_bits(16) 72.18 #else 72.19 - size_t _size : 30; 72.20 - size_t _level : 2; 72.21 + size_t _size : 32; 72.22 size_t _flags : 8; 72.23 size_t _pos_idx : 8; 72.24 size_t _bucket_idx: 16; 72.25 -#define MAX_MALLOCSITE_TABLE_SIZE ((size_t)(1 << 16)) 72.26 -#define MAX_BUCKET_LENGTH ((size_t)(1 << 8)) 72.27 -// Max malloc size = 1GB - 1 on 32 bit system, such has total 4GB memory 72.28 -#define MAX_MALLOC_SIZE ((size_t)(1 << 30) - 1) 72.29 +#define MAX_MALLOCSITE_TABLE_SIZE right_n_bits(16) 72.30 +#define MAX_BUCKET_LENGTH right_n_bits(8) 72.31 #endif // _LP64 72.32 72.33 public: 72.34 - // Summary tracking header 72.35 - MallocHeader(size_t size, MEMFLAGS flags) { 72.36 + MallocHeader(size_t size, MEMFLAGS flags, const NativeCallStack& stack, NMT_TrackingLevel level) { 72.37 assert(sizeof(MallocHeader) == sizeof(void*) * 2, 72.38 "Wrong header size"); 72.39 72.40 - _level = NMT_summary; 72.41 + if (level == NMT_minimal) { 72.42 + return; 72.43 + } 72.44 + 72.45 _flags = flags; 72.46 set_size(size); 72.47 + if (level == NMT_detail) { 72.48 + size_t bucket_idx; 72.49 + size_t pos_idx; 72.50 + if (record_malloc_site(stack, size, &bucket_idx, &pos_idx)) { 72.51 + assert(bucket_idx <= MAX_MALLOCSITE_TABLE_SIZE, "Overflow bucket index"); 72.52 + assert(pos_idx <= MAX_BUCKET_LENGTH, "Overflow bucket position index"); 72.53 + _bucket_idx = bucket_idx; 72.54 + _pos_idx = pos_idx; 72.55 + } 72.56 + } 72.57 + 72.58 MallocMemorySummary::record_malloc(size, flags); 72.59 MallocMemorySummary::record_new_malloc_header(sizeof(MallocHeader)); 72.60 } 72.61 - // Detail tracking header 72.62 - MallocHeader(size_t size, MEMFLAGS flags, const NativeCallStack& stack) { 72.63 - assert(sizeof(MallocHeader) == sizeof(void*) * 2, 72.64 - "Wrong header size"); 72.65 - 72.66 - _level = NMT_detail; 72.67 - _flags = flags; 72.68 - set_size(size); 72.69 - size_t bucket_idx; 72.70 - size_t pos_idx; 72.71 - if (record_malloc_site(stack, size, &bucket_idx, &pos_idx)) { 72.72 - assert(bucket_idx <= MAX_MALLOCSITE_TABLE_SIZE, "Overflow bucket index"); 72.73 - assert(pos_idx <= MAX_BUCKET_LENGTH, "Overflow bucket position index"); 72.74 - _bucket_idx = bucket_idx; 72.75 - _pos_idx = pos_idx; 72.76 - } 72.77 - MallocMemorySummary::record_malloc(size, flags); 72.78 - MallocMemorySummary::record_new_malloc_header(sizeof(MallocHeader)); 72.79 - } 72.80 - // Minimal tracking header 72.81 - MallocHeader() { 72.82 - assert(sizeof(MallocHeader) == sizeof(void*) * 2, 72.83 - "Wrong header size"); 72.84 - 72.85 - _level = (unsigned short)NMT_minimal; 72.86 - } 72.87 - 72.88 - inline NMT_TrackingLevel tracking_level() const { 72.89 - return (NMT_TrackingLevel)_level; 72.90 - } 72.91 72.92 inline size_t size() const { return _size; } 72.93 inline MEMFLAGS flags() const { return (MEMFLAGS)_flags; } 72.94 @@ -311,7 +289,6 @@ 72.95 72.96 private: 72.97 inline void set_size(size_t size) { 72.98 - assert(size <= MAX_MALLOC_SIZE, "Malloc size too large, should use virtual memory?"); 72.99 _size = size; 72.100 } 72.101 bool record_malloc_site(const NativeCallStack& stack, size_t size, 72.102 @@ -347,10 +324,6 @@ 72.103 // Record free on specified memory block 72.104 static void* record_free(void* memblock); 72.105 72.106 - // Get tracking level of specified memory block 72.107 - static inline NMT_TrackingLevel get_memory_tracking_level(void* memblock); 72.108 - 72.109 - 72.110 // Offset memory address to header address 72.111 static inline void* get_base(void* memblock); 72.112 static inline void* get_base(void* memblock, NMT_TrackingLevel level) { 72.113 @@ -361,16 +334,12 @@ 72.114 // Get memory size 72.115 static inline size_t get_size(void* memblock) { 72.116 MallocHeader* header = malloc_header(memblock); 72.117 - assert(header->tracking_level() >= NMT_summary, 72.118 - "Wrong tracking level"); 72.119 return header->size(); 72.120 } 72.121 72.122 // Get memory type 72.123 static inline MEMFLAGS get_flags(void* memblock) { 72.124 MallocHeader* header = malloc_header(memblock); 72.125 - assert(header->tracking_level() >= NMT_summary, 72.126 - "Wrong tracking level"); 72.127 return header->flags(); 72.128 } 72.129 72.130 @@ -394,7 +363,6 @@ 72.131 static inline MallocHeader* malloc_header(void *memblock) { 72.132 assert(memblock != NULL, "NULL pointer"); 72.133 MallocHeader* header = (MallocHeader*)((char*)memblock - sizeof(MallocHeader)); 72.134 - assert(header->tracking_level() >= NMT_minimal, "Bad header"); 72.135 return header; 72.136 } 72.137 };
73.1 --- a/src/share/vm/services/mallocTracker.inline.hpp Wed Nov 19 15:02:01 2014 -0800 73.2 +++ b/src/share/vm/services/mallocTracker.inline.hpp Mon Dec 01 11:29:12 2014 -0800 73.3 @@ -28,13 +28,6 @@ 73.4 #include "services/mallocTracker.hpp" 73.5 #include "services/memTracker.hpp" 73.6 73.7 -inline NMT_TrackingLevel MallocTracker::get_memory_tracking_level(void* memblock) { 73.8 - assert(memblock != NULL, "Sanity check"); 73.9 - if (MemTracker::tracking_level() == NMT_off) return NMT_off; 73.10 - MallocHeader* header = malloc_header(memblock); 73.11 - return header->tracking_level(); 73.12 -} 73.13 - 73.14 inline void* MallocTracker::get_base(void* memblock){ 73.15 return get_base(memblock, MemTracker::tracking_level()); 73.16 }
74.1 --- a/src/share/vm/trace/noTraceBackend.hpp Wed Nov 19 15:02:01 2014 -0800 74.2 +++ b/src/share/vm/trace/noTraceBackend.hpp Mon Dec 01 11:29:12 2014 -0800 74.3 @@ -41,4 +41,4 @@ 74.4 74.5 typedef NoTraceBackend Tracing; 74.6 74.7 -#endif 74.8 +#endif // SHARE_VM_TRACE_NOTRACEBACKEND_HPP
75.1 --- a/src/share/vm/trace/traceBackend.hpp Wed Nov 19 15:02:01 2014 -0800 75.2 +++ b/src/share/vm/trace/traceBackend.hpp Mon Dec 01 11:29:12 2014 -0800 75.3 @@ -25,9 +25,7 @@ 75.4 #define SHARE_VM_TRACE_TRACEBACKEND_HPP 75.5 75.6 #include "utilities/macros.hpp" 75.7 - 75.8 #if INCLUDE_TRACE 75.9 - 75.10 #include "runtime/globals.hpp" 75.11 #include "runtime/os.hpp" 75.12 #include "trace/traceTime.hpp" 75.13 @@ -58,9 +56,7 @@ 75.14 75.15 typedef TraceBackend Tracing; 75.16 75.17 -#else /* INCLUDE_TRACE */ 75.18 - 75.19 +#else // !INCLUDE_TRACE 75.20 #include "trace/noTraceBackend.hpp" 75.21 - 75.22 -#endif /* INCLUDE_TRACE */ 75.23 -#endif /* SHARE_VM_TRACE_TRACEBACKEND_HPP */ 75.24 +#endif // INCLUDE_TRACE 75.25 +#endif // SHARE_VM_TRACE_TRACEBACKEND_HPP
76.1 --- a/src/share/vm/trace/traceEvent.hpp Wed Nov 19 15:02:01 2014 -0800 76.2 +++ b/src/share/vm/trace/traceEvent.hpp Mon Dec 01 11:29:12 2014 -0800 76.3 @@ -33,7 +33,6 @@ 76.4 }; 76.5 76.6 #if INCLUDE_TRACE 76.7 - 76.8 #include "trace/traceBackend.hpp" 76.9 #include "trace/tracing.hpp" 76.10 #include "tracefiles/traceEventIds.hpp" 76.11 @@ -154,6 +153,5 @@ 76.12 } 76.13 }; 76.14 76.15 -#endif /* INCLUDE_TRACE */ 76.16 - 76.17 -#endif /* SHARE_VM_TRACE_TRACEEVENT_HPP */ 76.18 +#endif // INCLUDE_TRACE 76.19 +#endif // SHARE_VM_TRACE_TRACEEVENT_HPP
77.1 --- a/src/share/vm/trace/traceEventClasses.xsl Wed Nov 19 15:02:01 2014 -0800 77.2 +++ b/src/share/vm/trace/traceEventClasses.xsl Mon Dec 01 11:29:12 2014 -0800 77.3 @@ -41,17 +41,14 @@ 77.4 #include "trace/traceEvent.hpp" 77.5 #include "utilities/macros.hpp" 77.6 #include "utilities/ticks.hpp" 77.7 - 77.8 #if INCLUDE_TRACE 77.9 - 77.10 - 77.11 #include "trace/traceStream.hpp" 77.12 #include "utilities/ostream.hpp" 77.13 77.14 <xsl:apply-templates select="trace/events/struct" mode="trace"/> 77.15 <xsl:apply-templates select="trace/events/event" mode="trace"/> 77.16 77.17 -#else 77.18 +#else // !INCLUDE_TRACE 77.19 77.20 class TraceEvent { 77.21 public: 77.22 @@ -65,9 +62,8 @@ 77.23 <xsl:apply-templates select="trace/events/struct" mode="empty"/> 77.24 <xsl:apply-templates select="trace/events/event" mode="empty"/> 77.25 77.26 -#endif 77.27 - 77.28 -#endif 77.29 +#endif // INCLUDE_TRACE 77.30 +#endif // TRACEFILES_TRACEEVENTCLASSES_HPP 77.31 </xsl:template> 77.32 77.33 <xsl:template match="struct" mode="trace">
78.1 --- a/src/share/vm/trace/traceEventIds.xsl Wed Nov 19 15:02:01 2014 -0800 78.2 +++ b/src/share/vm/trace/traceEventIds.xsl Mon Dec 01 11:29:12 2014 -0800 78.3 @@ -29,13 +29,11 @@ 78.4 <xsl:template match="/"> 78.5 <xsl:call-template name="file-header"/> 78.6 78.7 -#ifndef TRACEFILES_JFREVENTIDS_HPP 78.8 -#define TRACEFILES_JFREVENTIDS_HPP 78.9 +#ifndef TRACEFILES_TRACEEVENTIDS_HPP 78.10 +#define TRACEFILES_TRACEEVENTIDS_HPP 78.11 78.12 #include "utilities/macros.hpp" 78.13 - 78.14 #if INCLUDE_TRACE 78.15 - 78.16 #include "trace/traceDataTypes.hpp" 78.17 78.18 /** 78.19 @@ -67,8 +65,8 @@ 78.20 typedef enum TraceEventId TraceEventId; 78.21 typedef enum TraceStructId TraceStructId; 78.22 78.23 -#endif 78.24 -#endif 78.25 +#endif // INCLUDE_TRACE 78.26 +#endif // TRACEFILES_TRACEEVENTIDS_HPP 78.27 </xsl:template> 78.28 78.29 </xsl:stylesheet>
79.1 --- a/src/share/vm/trace/traceMacros.hpp Wed Nov 19 15:02:01 2014 -0800 79.2 +++ b/src/share/vm/trace/traceMacros.hpp Mon Dec 01 11:29:12 2014 -0800 79.3 @@ -22,8 +22,8 @@ 79.4 * 79.5 */ 79.6 79.7 -#ifndef SHARE_VM_TRACE_TRACE_MACRO_HPP 79.8 -#define SHARE_VM_TRACE_TRACE_MACRO_HPP 79.9 +#ifndef SHARE_VM_TRACE_TRACEMACROS_HPP 79.10 +#define SHARE_VM_TRACE_TRACEMACROS_HPP 79.11 79.12 #define EVENT_THREAD_EXIT(thread) 79.13 #define EVENT_THREAD_DESTRUCT(thread) 79.14 @@ -41,4 +41,4 @@ 79.15 #define TRACE_TEMPLATES(template) 79.16 #define TRACE_INTRINSICS(do_intrinsic, do_class, do_name, do_signature, do_alias) 79.17 79.18 -#endif 79.19 +#endif // SHARE_VM_TRACE_TRACEMACROS_HPP
80.1 --- a/src/share/vm/trace/traceStream.hpp Wed Nov 19 15:02:01 2014 -0800 80.2 +++ b/src/share/vm/trace/traceStream.hpp Mon Dec 01 11:29:12 2014 -0800 80.3 @@ -26,9 +26,7 @@ 80.4 #define SHARE_VM_TRACE_TRACESTREAM_HPP 80.5 80.6 #include "utilities/macros.hpp" 80.7 - 80.8 #if INCLUDE_TRACE 80.9 - 80.10 #include "oops/klass.hpp" 80.11 #include "oops/method.hpp" 80.12 #include "oops/symbol.hpp" 80.13 @@ -117,5 +115,5 @@ 80.14 } 80.15 }; 80.16 80.17 -#endif /* INCLUDE_TRACE */ 80.18 -#endif /* SHARE_VM_TRACE_TRACESTREAM_HPP */ 80.19 +#endif // INCLUDE_TRACE 80.20 +#endif // SHARE_VM_TRACE_TRACESTREAM_HPP
81.1 --- a/src/share/vm/trace/traceTypes.xsl Wed Nov 19 15:02:01 2014 -0800 81.2 +++ b/src/share/vm/trace/traceTypes.xsl Mon Dec 01 11:29:12 2014 -0800 81.3 @@ -29,15 +29,14 @@ 81.4 <xsl:template match="/"> 81.5 <xsl:call-template name="file-header"/> 81.6 81.7 -#ifndef TRACEFILES_JFRTYPES_HPP 81.8 -#define TRACEFILES_JFRTYPES_HPP 81.9 +#ifndef TRACEFILES_TRACETYPES_HPP 81.10 +#define TRACEFILES_TRACETYPES_HPP 81.11 81.12 #include "oops/symbol.hpp" 81.13 #include "trace/traceDataTypes.hpp" 81.14 #include "utilities/globalDefinitions.hpp" 81.15 #include "utilities/ticks.hpp" 81.16 81.17 - 81.18 enum JVMContentType { 81.19 _not_a_content_type = (JVM_CONTENT_TYPES_START - 1), 81.20 81.21 @@ -58,7 +57,7 @@ 81.22 }; 81.23 81.24 /** 81.25 - * Create typedefs for the JRA types: 81.26 + * Create typedefs for the TRACE types: 81.27 * typedef s8 TYPE_LONG; 81.28 * typedef s4 TYPE_INTEGER; 81.29 * typedef const char * TYPE_STRING; 81.30 @@ -68,7 +67,7 @@ 81.31 typedef <xsl:value-of select="@type"/> TYPE_<xsl:value-of select="@symbol"/>; 81.32 </xsl:for-each> 81.33 81.34 -#endif // JFRFILES_JFRTYPES_HPP 81.35 +#endif // TRACEFILES_TRACETYPES_HPP 81.36 </xsl:template> 81.37 81.38 </xsl:stylesheet>
82.1 --- a/src/share/vm/trace/tracing.hpp Wed Nov 19 15:02:01 2014 -0800 82.2 +++ b/src/share/vm/trace/tracing.hpp Mon Dec 01 11:29:12 2014 -0800 82.3 @@ -28,4 +28,4 @@ 82.4 #include "tracefiles/traceEventClasses.hpp" 82.5 #include "tracefiles/traceEventIds.hpp" 82.6 82.7 -#endif 82.8 +#endif // SHARE_VM_TRACE_TRACING_HPP
83.1 --- a/test/TEST.ROOT Wed Nov 19 15:02:01 2014 -0800 83.2 +++ b/test/TEST.ROOT Mon Dec 01 11:29:12 2014 -0800 83.3 @@ -30,3 +30,4 @@ 83.4 keys=cte_test jcmd nmt regression gc stress 83.5 83.6 groups=TEST.groups [closed/TEST.groups] 83.7 +requires.properties=sun.arch.data.model
84.1 --- a/test/TEST.groups Wed Nov 19 15:02:01 2014 -0800 84.2 +++ b/test/TEST.groups Mon Dec 01 11:29:12 2014 -0800 84.3 @@ -90,7 +90,6 @@ 84.4 runtime/NMT/SummarySanityCheck.java \ 84.5 runtime/NMT/ThreadedMallocTestType.java \ 84.6 runtime/NMT/ThreadedVirtualAllocTestType.java \ 84.7 - runtime/NMT/UnsafeMallocLimit.java \ 84.8 runtime/NMT/VirtualAllocCommitUncommitRecommit.java \ 84.9 runtime/NMT/VirtualAllocTestType.java \ 84.10 runtime/RedefineObject/TestRedefineObject.java \
85.1 --- a/test/compiler/whitebox/IsMethodCompilableTest.java Wed Nov 19 15:02:01 2014 -0800 85.2 +++ b/test/compiler/whitebox/IsMethodCompilableTest.java Mon Dec 01 11:29:12 2014 -0800 85.3 @@ -28,7 +28,7 @@ 85.4 * @build IsMethodCompilableTest 85.5 * @run main ClassFileInstaller sun.hotspot.WhiteBox 85.6 * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform 85.7 - * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest 85.8 + * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest 85.9 * @summary testing of WB::isMethodCompilable() 85.10 * @author igor.ignatyev@oracle.com 85.11 */
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 86.2 +++ b/test/gc/concurrentMarkSweep/DisableResizePLAB.java Mon Dec 01 11:29:12 2014 -0800 86.3 @@ -0,0 +1,44 @@ 86.4 +/* 86.5 +* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 86.6 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 86.7 +* 86.8 +* This code is free software; you can redistribute it and/or modify it 86.9 +* under the terms of the GNU General Public License version 2 only, as 86.10 +* published by the Free Software Foundation. 86.11 +* 86.12 +* This code is distributed in the hope that it will be useful, but WITHOUT 86.13 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 86.14 +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 86.15 +* version 2 for more details (a copy is included in the LICENSE file that 86.16 +* accompanied this code). 86.17 +* 86.18 +* You should have received a copy of the GNU General Public License version 86.19 +* 2 along with this work; if not, write to the Free Software Foundation, 86.20 +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 86.21 +* 86.22 +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 86.23 +* or visit www.oracle.com if you need additional information or have any 86.24 +* questions. 86.25 +*/ 86.26 + 86.27 +/* 86.28 + * @test DisableResizePLAB 86.29 + * @key gc 86.30 + * @bug 8060467 86.31 + * @author filipp.zhinkin@oracle.com, john.coomes@oracle.com 86.32 + * @summary Run CMS with PLAB resizing disabled and a small OldPLABSize 86.33 + * @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -XX:+PrintGCDetails DisableResizePLAB 86.34 + */ 86.35 + 86.36 +public class DisableResizePLAB { 86.37 + public static void main(String args[]) throws Exception { 86.38 + Object garbage[] = new Object[1_000]; 86.39 + for (int i = 0; i < garbage.length; i++) { 86.40 + garbage[i] = new byte[0]; 86.41 + } 86.42 + long startTime = System.currentTimeMillis(); 86.43 + while (System.currentTimeMillis() - startTime < 10_000) { 86.44 + Object o = new byte[1024]; 86.45 + } 86.46 + } 86.47 +}
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/test/runtime/CheckEndorsedAndExtDirs/EndorsedExtDirs.java Mon Dec 01 11:29:12 2014 -0800 87.3 @@ -0,0 +1,60 @@ 87.4 +/* 87.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 87.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 87.7 + * 87.8 + * This code is free software; you can redistribute it and/or modify it 87.9 + * under the terms of the GNU General Public License version 2 only, as 87.10 + * published by the Free Software Foundation. 87.11 + * 87.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 87.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 87.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 87.15 + * version 2 for more details (a copy is included in the LICENSE file that 87.16 + * accompanied this code). 87.17 + * 87.18 + * You should have received a copy of the GNU General Public License version 87.19 + * 2 along with this work; if not, write to the Free Software Foundation, 87.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 87.21 + * 87.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 87.23 + * or visit www.oracle.com if you need additional information or have any 87.24 + * questions. 87.25 + */ 87.26 + 87.27 +/* 87.28 + * @test 87.29 + * @bug 8064667 87.30 + * @summary Sanity test for -XX:+CheckEndorsedAndExtDirs 87.31 + * @library /testlibrary 87.32 + * @run main/othervm -XX:+CheckEndorsedAndExtDirs EndorsedExtDirs 87.33 + */ 87.34 + 87.35 +import com.oracle.java.testlibrary.*; 87.36 +import java.util.ArrayList; 87.37 +import java.util.List; 87.38 + 87.39 +public class EndorsedExtDirs { 87.40 + static final String cpath = System.getProperty("test.classes", "."); 87.41 + public static void main(String arg[]) throws Exception { 87.42 + fatalError("-XX:+CheckEndorsedAndExtDirs", "-Djava.endorsed.dirs=foo"); 87.43 + fatalError("-XX:+CheckEndorsedAndExtDirs", "-Djava.ext.dirs=bar"); 87.44 + } 87.45 + 87.46 + static void fatalError(String... args) throws Exception { 87.47 + List<String> commands = new ArrayList<>(); 87.48 + String java = System.getProperty("java.home") + "/bin/java"; 87.49 + commands.add(java); 87.50 + for (String s : args) { 87.51 + commands.add(s); 87.52 + } 87.53 + commands.add("-cp"); 87.54 + commands.add(cpath); 87.55 + commands.add("EndorsedExtDirs"); 87.56 + 87.57 + System.out.println("Launching " + commands); 87.58 + ProcessBuilder pb = new ProcessBuilder(commands); 87.59 + OutputAnalyzer output = new OutputAnalyzer(pb.start()); 87.60 + output.shouldContain("Could not create the Java Virtual Machine"); 87.61 + output.shouldHaveExitValue(1); 87.62 + } 87.63 +}
88.1 --- a/test/runtime/NMT/MallocSiteHashOverflow.java Wed Nov 19 15:02:01 2014 -0800 88.2 +++ b/test/runtime/NMT/MallocSiteHashOverflow.java Mon Dec 01 11:29:12 2014 -0800 88.3 @@ -24,41 +24,55 @@ 88.4 /* 88.5 * @test 88.6 * @summary Test corner case that overflows malloc site hashtable bucket 88.7 + * @requires sun.arch.data.model == "32" 88.8 * @key nmt jcmd stress 88.9 * @library /testlibrary /testlibrary/whitebox 88.10 - * @ignore - This test is disabled since it will stress NMT and timeout during normal testing 88.11 * @build MallocSiteHashOverflow 88.12 * @run main ClassFileInstaller sun.hotspot.WhiteBox 88.13 - * @run main/othervm/timeout=480 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow 88.14 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow 88.15 */ 88.16 88.17 import com.oracle.java.testlibrary.*; 88.18 import sun.hotspot.WhiteBox; 88.19 88.20 public class MallocSiteHashOverflow { 88.21 - private static long K = 1024; 88.22 + 88.23 public static void main(String args[]) throws Exception { 88.24 - String vm_name = System.getProperty("java.vm.name"); 88.25 88.26 + // Size of entries based on malloc tracking header defined in mallocTracker.hpp 88.27 // For 32-bit systems, create 257 malloc sites with the same hash bucket to overflow a hash bucket 88.28 - // For 64-bit systems, create 64K + 1 malloc sites with the same hash bucket to overflow a hash bucket 88.29 long entries = 257; 88.30 - if (Platform.is64bit()) { 88.31 - entries = 64 * K + 1; 88.32 - } 88.33 88.34 OutputAnalyzer output; 88.35 WhiteBox wb = WhiteBox.getWhiteBox(); 88.36 + int MAX_HASH_SIZE = wb.NMTGetHashSize(); 88.37 88.38 // Grab my own PID 88.39 String pid = Integer.toString(ProcessTools.getProcessId()); 88.40 ProcessBuilder pb = new ProcessBuilder(); 88.41 88.42 - wb.NMTOverflowHashBucket(entries); 88.43 - 88.44 - // Run 'jcmd <pid> VM.native_memory summary' 88.45 + // Verify that current tracking level is "detail" 88.46 pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "statistics"}); 88.47 output = new OutputAnalyzer(pb.start()); 88.48 - output.shouldContain("Tracking level has been downgraded due to lack of resources"); 88.49 + output.shouldContain("Native Memory Tracking Statistics"); 88.50 + 88.51 + // Attempt to cause NMT to downgrade tracking level by allocating small amounts 88.52 + // of memory with random pseudo call stack 88.53 + int pc = 1; 88.54 + for (int i = 0; i < entries; i++) { 88.55 + long addr = wb.NMTMallocWithPseudoStack(1, pc); 88.56 + if (addr == 0) { 88.57 + throw new RuntimeException("NMTMallocWithPseudoStack: out of memory"); 88.58 + } 88.59 + // We free memory here since it doesn't affect pseudo malloc alloc site hash table entries 88.60 + wb.NMTFree(addr); 88.61 + pc += MAX_HASH_SIZE; 88.62 + if (i == entries) { 88.63 + // Verify that tracking has been downgraded 88.64 + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "statistics"}); 88.65 + output = new OutputAnalyzer(pb.start()); 88.66 + output.shouldContain("Tracking level has been downgraded due to lack of resources"); 88.67 + } 88.68 + } 88.69 } 88.70 }
89.1 --- a/test/runtime/NMT/UnsafeMallocLimit.java Wed Nov 19 15:02:01 2014 -0800 89.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 89.3 @@ -1,50 +0,0 @@ 89.4 -/* 89.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 89.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 89.7 - * 89.8 - * This code is free software; you can redistribute it and/or modify it 89.9 - * under the terms of the GNU General Public License version 2 only, as 89.10 - * published by the Free Software Foundation. 89.11 - * 89.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 89.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 89.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 89.15 - * version 2 for more details (a copy is included in the LICENSE file that 89.16 - * accompanied this code). 89.17 - * 89.18 - * You should have received a copy of the GNU General Public License version 89.19 - * 2 along with this work; if not, write to the Free Software Foundation, 89.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 89.21 - * 89.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 89.23 - * or visit www.oracle.com if you need additional information or have any 89.24 - * questions. 89.25 - */ 89.26 - 89.27 -/* 89.28 - * @test 89.29 - * @bug 8055289 89.30 - * @library /testlibrary 89.31 - * @build UnsafeMallocLimit 89.32 - * @run main/othervm -Xmx32m -XX:NativeMemoryTracking=summary UnsafeMallocLimit 89.33 - */ 89.34 - 89.35 -import com.oracle.java.testlibrary.*; 89.36 -import sun.misc.Unsafe; 89.37 - 89.38 -public class UnsafeMallocLimit { 89.39 - 89.40 - public static void main(String args[]) throws Exception { 89.41 - if (Platform.is32bit()) { 89.42 - Unsafe unsafe = Utils.getUnsafe(); 89.43 - try { 89.44 - unsafe.allocateMemory(1 << 30); 89.45 - throw new RuntimeException("Did not get expected OOME"); 89.46 - } catch (OutOfMemoryError e) { 89.47 - // Expected exception 89.48 - } 89.49 - } else { 89.50 - System.out.println("Test only valid on 32-bit platforms"); 89.51 - } 89.52 - } 89.53 -}
90.1 --- a/test/runtime/NMT/UnsafeMallocLimit2.java Wed Nov 19 15:02:01 2014 -0800 90.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 90.3 @@ -1,54 +0,0 @@ 90.4 -/* 90.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 90.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 90.7 - * 90.8 - * This code is free software; you can redistribute it and/or modify it 90.9 - * under the terms of the GNU General Public License version 2 only, as 90.10 - * published by the Free Software Foundation. 90.11 - * 90.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 90.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 90.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 90.15 - * version 2 for more details (a copy is included in the LICENSE file that 90.16 - * accompanied this code). 90.17 - * 90.18 - * You should have received a copy of the GNU General Public License version 90.19 - * 2 along with this work; if not, write to the Free Software Foundation, 90.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 90.21 - * 90.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 90.23 - * or visit www.oracle.com if you need additional information or have any 90.24 - * questions. 90.25 - */ 90.26 - 90.27 -/* 90.28 - * @test 90.29 - * @bug 8058818 90.30 - * @library /testlibrary 90.31 - * @build UnsafeMallocLimit2 90.32 - * @run main/othervm -Xmx32m -XX:NativeMemoryTracking=off UnsafeMallocLimit2 90.33 - */ 90.34 - 90.35 -import com.oracle.java.testlibrary.*; 90.36 -import sun.misc.Unsafe; 90.37 - 90.38 -public class UnsafeMallocLimit2 { 90.39 - 90.40 - public static void main(String args[]) throws Exception { 90.41 - if (Platform.is32bit()) { 90.42 - Unsafe unsafe = Utils.getUnsafe(); 90.43 - try { 90.44 - // Allocate greater than MALLOC_MAX and likely won't fail to allocate, 90.45 - // so it hits the NMT code that asserted. 90.46 - // Test that this doesn't cause an assertion with NMT off. 90.47 - // The option above overrides if all the tests are run with NMT on. 90.48 - unsafe.allocateMemory(0x40000000); 90.49 - System.out.println("Allocation succeeded"); 90.50 - } catch (OutOfMemoryError e) { 90.51 - System.out.println("Allocation failed"); 90.52 - } 90.53 - } else { 90.54 - System.out.println("Test only valid on 32-bit platforms"); 90.55 - } 90.56 - } 90.57 -}
91.1 --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Wed Nov 19 15:02:01 2014 -0800 91.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Mon Dec 01 11:29:12 2014 -0800 91.3 @@ -104,10 +104,10 @@ 91.4 public native void NMTCommitMemory(long addr, long size); 91.5 public native void NMTUncommitMemory(long addr, long size); 91.6 public native void NMTReleaseMemory(long addr, long size); 91.7 - public native void NMTOverflowHashBucket(long num); 91.8 public native long NMTMallocWithPseudoStack(long size, int index); 91.9 public native boolean NMTIsDetailSupported(); 91.10 public native boolean NMTChangeTrackingLevel(); 91.11 + public native int NMTGetHashSize(); 91.12 91.13 // Compiler 91.14 public native void deoptimizeAll(); 91.15 @@ -208,4 +208,13 @@ 91.16 .findAny() 91.17 .orElse(null); 91.18 } 91.19 + public native int getOffsetForName0(String name); 91.20 + public int getOffsetForName(String name) throws Exception { 91.21 + int offset = getOffsetForName0(name); 91.22 + if (offset == -1) { 91.23 + throw new RuntimeException(name + " not found"); 91.24 + } 91.25 + return offset; 91.26 + } 91.27 + 91.28 }