Fri, 02 Aug 2013 11:10:39 +0100
Merge
src/share/vm/classfile/classFileParser.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Thu Jul 25 17:35:33 2013 +0100 1.2 +++ b/.hgtags Fri Aug 02 11:10:39 2013 +0100 1.3 @@ -362,3 +362,5 @@ 1.4 81b6cb70717c66375846b78bb174594ec3aa998e jdk8-b99 1.5 9f71e36a471ae4a668e08827d33035963ed10c08 hs25-b42 1.6 5787fac72e760c6a5fd9efa113b0c75caf554136 jdk8-b100 1.7 +46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43 1.8 +f6921c876db192bba389cec062855a66372da01c jdk8-b101
2.1 --- a/make/hotspot_version Thu Jul 25 17:35:33 2013 +0100 2.2 +++ b/make/hotspot_version Fri Aug 02 11:10:39 2013 +0100 2.3 @@ -35,7 +35,7 @@ 2.4 2.5 HS_MAJOR_VER=25 2.6 HS_MINOR_VER=0 2.7 -HS_BUILD_NUMBER=42 2.8 +HS_BUILD_NUMBER=43 2.9 2.10 JDK_MAJOR_VER=1 2.11 JDK_MINOR_VER=8
3.1 --- a/make/linux/makefiles/vm.make Thu Jul 25 17:35:33 2013 +0100 3.2 +++ b/make/linux/makefiles/vm.make Fri Aug 02 11:10:39 2013 +0100 3.3 @@ -212,6 +212,12 @@ 3.4 Src_Files_EXCLUDE += \*x86_32\* 3.5 endif 3.6 3.7 +# Alternate vm.make 3.8 +# This has to be included here to allow changes to the source 3.9 +# directories and excluded files before they are expanded 3.10 +# by the definition of Src_Files. 3.11 +-include $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/vm.make 3.12 + 3.13 # Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE. 3.14 define findsrc 3.15 $(notdir $(shell find $(1)/. ! -name . -prune \ 3.16 @@ -381,4 +387,4 @@ 3.17 3.18 install: install_jvm install_jsig install_saproc 3.19 3.20 -.PHONY: default build install install_jvm $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make 3.21 +.PHONY: default build install install_jvm $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/vm.make
4.1 --- a/make/windows/makefiles/compile.make Thu Jul 25 17:35:33 2013 +0100 4.2 +++ b/make/windows/makefiles/compile.make Fri Aug 02 11:10:39 2013 +0100 4.3 @@ -1,5 +1,5 @@ 4.4 # 4.5 -# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 4.6 +# Copyright (c) 1997, 2013, 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 @@ -110,6 +110,7 @@ 4.11 # 1400 is for VS2005 4.12 # 1500 is for VS2008 4.13 # 1600 is for VS2010 4.14 +# 1700 is for VS2012 4.15 # Do not confuse this MSC_VER with the predefined macro _MSC_VER that the 4.16 # compiler provides, when MSC_VER==1399, _MSC_VER will be 1400. 4.17 # Normally they are the same, but a pre-release of the VS2005 compilers 4.18 @@ -142,6 +143,9 @@ 4.19 !if "$(MSC_VER)" == "1600" 4.20 COMPILER_NAME=VS2010 4.21 !endif 4.22 +!if "$(MSC_VER)" == "1700" 4.23 +COMPILER_NAME=VS2012 4.24 +!endif 4.25 !endif 4.26 4.27 # By default, we do not want to use the debug version of the msvcrt.dll file 4.28 @@ -151,9 +155,13 @@ 4.29 MS_RUNTIME_OPTION = /MTd /D "_DEBUG" 4.30 !endif 4.31 4.32 +# VS2012 and later won't work with: 4.33 +# /D _STATIC_CPPLIB /D _DISABLE_DEPRECATE_STATIC_CPPLIB 4.34 +!if "$(MSC_VER)" < "1700" 4.35 # Always add the _STATIC_CPPLIB flag 4.36 STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB /D _DISABLE_DEPRECATE_STATIC_CPPLIB 4.37 MS_RUNTIME_OPTION = $(MS_RUNTIME_OPTION) $(STATIC_CPPLIB_OPTION) 4.38 +!endif 4.39 CXX_FLAGS=$(CXX_FLAGS) $(MS_RUNTIME_OPTION) 4.40 4.41 # How /GX option is spelled 4.42 @@ -221,6 +229,22 @@ 4.43 !endif 4.44 !endif 4.45 4.46 +!if "$(COMPILER_NAME)" == "VS2012" 4.47 +PRODUCT_OPT_OPTION = /O2 /Oy- 4.48 +FASTDEBUG_OPT_OPTION = /O2 /Oy- 4.49 +DEBUG_OPT_OPTION = /Od 4.50 +GX_OPTION = /EHsc 4.51 +LD_FLAGS = /manifest $(LD_FLAGS) 4.52 +# Manifest Tool - used in VS2005 and later to adjust manifests stored 4.53 +# as resources inside build artifacts. 4.54 +!if "x$(MT)" == "x" 4.55 +MT=mt.exe 4.56 +!endif 4.57 +!if "$(BUILDARCH)" == "i486" 4.58 +LD_FLAGS = /SAFESEH $(LD_FLAGS) 4.59 +!endif 4.60 +!endif 4.61 + 4.62 # If NO_OPTIMIZATIONS is defined in the environment, turn everything off 4.63 !ifdef NO_OPTIMIZATIONS 4.64 PRODUCT_OPT_OPTION = $(DEBUG_OPT_OPTION)
5.1 --- a/make/windows/makefiles/sanity.make Thu Jul 25 17:35:33 2013 +0100 5.2 +++ b/make/windows/makefiles/sanity.make Fri Aug 02 11:10:39 2013 +0100 5.3 @@ -1,5 +1,5 @@ 5.4 # 5.5 -# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. 5.6 +# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 5.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 # 5.9 # This code is free software; you can redistribute it and/or modify it 5.10 @@ -27,9 +27,9 @@ 5.11 all: checkCL checkLink 5.12 5.13 checkCL: 5.14 - @ if "$(MSC_VER)" NEQ "1310" if "$(MSC_VER)" NEQ "1399" if "$(MSC_VER)" NEQ "1400" if "$(MSC_VER)" NEQ "1500" if "$(MSC_VER)" NEQ "1600" \ 5.15 + @ if "$(MSC_VER)" NEQ "1310" if "$(MSC_VER)" NEQ "1399" if "$(MSC_VER)" NEQ "1400" if "$(MSC_VER)" NEQ "1500" if "$(MSC_VER)" NEQ "1600" if "$(MSC_VER)" NEQ "1700" \ 5.16 echo *** WARNING *** unrecognized cl.exe version $(MSC_VER) ($(RAW_MSC_VER)). Use FORCE_MSC_VER to override automatic detection. 5.17 5.18 checkLink: 5.19 - @ if "$(LD_VER)" NEQ "710" if "$(LD_VER)" NEQ "800" if "$(LD_VER)" NEQ "900" if "$(LD_VER)" NEQ "1000" \ 5.20 + @ if "$(LD_VER)" NEQ "710" if "$(LD_VER)" NEQ "800" if "$(LD_VER)" NEQ "900" if "$(LD_VER)" NEQ "1000" if "$(LD_VER)" NEQ "1100" \ 5.21 echo *** WARNING *** unrecognized link.exe version $(LD_VER) ($(RAW_LD_VER)). Use FORCE_LD_VER to override automatic detection.
6.1 --- a/make/windows/makefiles/vm.make Thu Jul 25 17:35:33 2013 +0100 6.2 +++ b/make/windows/makefiles/vm.make Fri Aug 02 11:10:39 2013 +0100 6.3 @@ -132,6 +132,10 @@ 6.4 6.5 !if "$(USE_PRECOMPILED_HEADER)" != "0" 6.6 CXX_USE_PCH=/Fp"vm.pch" /Yu"precompiled.hpp" 6.7 +!if "$(COMPILER_NAME)" == "VS2012" 6.8 +# VS2012 requires this object file to be listed: 6.9 +LD_FLAGS=$(LD_FLAGS) _build_pch_file.obj 6.10 +!endif 6.11 !else 6.12 CXX_USE_PCH=$(CXX_DONT_USE_PCH) 6.13 !endif
7.1 --- a/src/cpu/sparc/vm/frame_sparc.inline.hpp Thu Jul 25 17:35:33 2013 +0100 7.2 +++ b/src/cpu/sparc/vm/frame_sparc.inline.hpp Fri Aug 02 11:10:39 2013 +0100 7.3 @@ -240,10 +240,10 @@ 7.4 #endif // CC_INTERP 7.5 7.6 7.7 -inline JavaCallWrapper* frame::entry_frame_call_wrapper() const { 7.8 +inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const { 7.9 // note: adjust this code if the link argument in StubGenerator::call_stub() changes! 7.10 const Argument link = Argument(0, false); 7.11 - return (JavaCallWrapper*)sp()[link.as_in().as_register()->sp_offset_in_saved_window()]; 7.12 + return (JavaCallWrapper**)&sp()[link.as_in().as_register()->sp_offset_in_saved_window()]; 7.13 } 7.14 7.15
8.1 --- a/src/cpu/x86/vm/frame_x86.inline.hpp Thu Jul 25 17:35:33 2013 +0100 8.2 +++ b/src/cpu/x86/vm/frame_x86.inline.hpp Fri Aug 02 11:10:39 2013 +0100 8.3 @@ -272,11 +272,10 @@ 8.4 8.5 // Entry frames 8.6 8.7 -inline JavaCallWrapper* frame::entry_frame_call_wrapper() const { 8.8 - return (JavaCallWrapper*)at(entry_frame_call_wrapper_offset); 8.9 +inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const { 8.10 + return (JavaCallWrapper**)addr_at(entry_frame_call_wrapper_offset); 8.11 } 8.12 8.13 - 8.14 // Compiled frames 8.15 8.16 inline int frame::local_offset_for_compiler(int local_index, int nof_args, int max_nof_locals, int max_nof_monitors) {
9.1 --- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp Thu Jul 25 17:35:33 2013 +0100 9.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp Fri Aug 02 11:10:39 2013 +0100 9.3 @@ -279,7 +279,7 @@ 9.4 __ stmxcsr(mxcsr_save); 9.5 __ movl(rax, mxcsr_save); 9.6 __ andl(rax, MXCSR_MASK); // Only check control and mask bits 9.7 - ExternalAddress mxcsr_std(StubRoutines::x86::mxcsr_std()); 9.8 + ExternalAddress mxcsr_std(StubRoutines::addr_mxcsr_std()); 9.9 __ cmp32(rax, mxcsr_std); 9.10 __ jcc(Assembler::equal, skip_ldmx); 9.11 __ ldmxcsr(mxcsr_std); 9.12 @@ -729,17 +729,18 @@ 9.13 9.14 if (CheckJNICalls) { 9.15 Label ok_ret; 9.16 + ExternalAddress mxcsr_std(StubRoutines::addr_mxcsr_std()); 9.17 __ push(rax); 9.18 __ subptr(rsp, wordSize); // allocate a temp location 9.19 __ stmxcsr(mxcsr_save); 9.20 __ movl(rax, mxcsr_save); 9.21 __ andl(rax, MXCSR_MASK); // Only check control and mask bits 9.22 - __ cmpl(rax, *(int *)(StubRoutines::x86::mxcsr_std())); 9.23 + __ cmp32(rax, mxcsr_std); 9.24 __ jcc(Assembler::equal, ok_ret); 9.25 9.26 __ warn("MXCSR changed by native JNI code, use -XX:+RestoreMXCSROnJNICall"); 9.27 9.28 - __ ldmxcsr(ExternalAddress(StubRoutines::x86::mxcsr_std())); 9.29 + __ ldmxcsr(mxcsr_std); 9.30 9.31 __ bind(ok_ret); 9.32 __ addptr(rsp, wordSize); 9.33 @@ -3767,12 +3768,35 @@ 9.34 return stub->entry_point(); 9.35 } 9.36 9.37 + void create_control_words() { 9.38 + // Round to nearest, 53-bit mode, exceptions masked 9.39 + StubRoutines::_fpu_cntrl_wrd_std = 0x027F; 9.40 + // Round to zero, 53-bit mode, exception mased 9.41 + StubRoutines::_fpu_cntrl_wrd_trunc = 0x0D7F; 9.42 + // Round to nearest, 24-bit mode, exceptions masked 9.43 + StubRoutines::_fpu_cntrl_wrd_24 = 0x007F; 9.44 + // Round to nearest, 64-bit mode, exceptions masked 9.45 + StubRoutines::_fpu_cntrl_wrd_64 = 0x037F; 9.46 + // Round to nearest, 64-bit mode, exceptions masked 9.47 + StubRoutines::_mxcsr_std = 0x1F80; 9.48 + // Note: the following two constants are 80-bit values 9.49 + // layout is critical for correct loading by FPU. 9.50 + // Bias for strict fp multiply/divide 9.51 + StubRoutines::_fpu_subnormal_bias1[0]= 0x00000000; // 2^(-15360) == 0x03ff 8000 0000 0000 0000 9.52 + StubRoutines::_fpu_subnormal_bias1[1]= 0x80000000; 9.53 + StubRoutines::_fpu_subnormal_bias1[2]= 0x03ff; 9.54 + // Un-Bias for strict fp multiply/divide 9.55 + StubRoutines::_fpu_subnormal_bias2[0]= 0x00000000; // 2^(+15360) == 0x7bff 8000 0000 0000 0000 9.56 + StubRoutines::_fpu_subnormal_bias2[1]= 0x80000000; 9.57 + StubRoutines::_fpu_subnormal_bias2[2]= 0x7bff; 9.58 + } 9.59 + 9.60 // Initialization 9.61 void generate_initial() { 9.62 // Generates all stubs and initializes the entry points 9.63 9.64 - // This platform-specific stub is needed by generate_call_stub() 9.65 - StubRoutines::x86::_mxcsr_std = generate_fp_mask("mxcsr_std", 0x0000000000001F80); 9.66 + // This platform-specific settings are needed by generate_call_stub() 9.67 + create_control_words(); 9.68 9.69 // entry points that exist in all platforms Note: This is code 9.70 // that could be shared among different platforms - however the
10.1 --- a/src/cpu/x86/vm/stubRoutines_x86_64.cpp Thu Jul 25 17:35:33 2013 +0100 10.2 +++ b/src/cpu/x86/vm/stubRoutines_x86_64.cpp Fri Aug 02 11:10:39 2013 +0100 10.3 @@ -42,4 +42,3 @@ 10.4 address StubRoutines::x86::_float_sign_flip = NULL; 10.5 address StubRoutines::x86::_double_sign_mask = NULL; 10.6 address StubRoutines::x86::_double_sign_flip = NULL; 10.7 -address StubRoutines::x86::_mxcsr_std = NULL;
11.1 --- a/src/cpu/x86/vm/stubRoutines_x86_64.hpp Thu Jul 25 17:35:33 2013 +0100 11.2 +++ b/src/cpu/x86/vm/stubRoutines_x86_64.hpp Fri Aug 02 11:10:39 2013 +0100 11.3 @@ -52,7 +52,6 @@ 11.4 static address _float_sign_flip; 11.5 static address _double_sign_mask; 11.6 static address _double_sign_flip; 11.7 - static address _mxcsr_std; 11.8 11.9 public: 11.10 11.11 @@ -106,11 +105,6 @@ 11.12 return _double_sign_flip; 11.13 } 11.14 11.15 - static address mxcsr_std() 11.16 - { 11.17 - return _mxcsr_std; 11.18 - } 11.19 - 11.20 # include "stubRoutines_x86.hpp" 11.21 11.22 };
12.1 --- a/src/os/bsd/vm/attachListener_bsd.cpp Thu Jul 25 17:35:33 2013 +0100 12.2 +++ b/src/os/bsd/vm/attachListener_bsd.cpp Fri Aug 02 11:10:39 2013 +0100 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 12.6 + * Copyright (c) 2005, 2013, 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 @@ -437,6 +437,30 @@ 12.11 return op; 12.12 } 12.13 12.14 + 12.15 +// Performs initialization at vm startup 12.16 +// For BSD we remove any stale .java_pid file which could cause 12.17 +// an attaching process to think we are ready to receive on the 12.18 +// domain socket before we are properly initialized 12.19 + 12.20 +void AttachListener::vm_start() { 12.21 + char fn[UNIX_PATH_MAX]; 12.22 + struct stat64 st; 12.23 + int ret; 12.24 + 12.25 + int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d", 12.26 + os::get_temp_directory(), os::current_process_id()); 12.27 + assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow"); 12.28 + 12.29 + RESTARTABLE(::stat64(fn, &st), ret); 12.30 + if (ret == 0) { 12.31 + ret = ::unlink(fn); 12.32 + if (ret == -1) { 12.33 + debug_only(warning("failed to remove stale attach pid file at %s", fn)); 12.34 + } 12.35 + } 12.36 +} 12.37 + 12.38 int AttachListener::pd_init() { 12.39 JavaThread* thread = JavaThread::current(); 12.40 ThreadBlockInVM tbivm(thread);
13.1 --- a/src/os/linux/vm/attachListener_linux.cpp Thu Jul 25 17:35:33 2013 +0100 13.2 +++ b/src/os/linux/vm/attachListener_linux.cpp Fri Aug 02 11:10:39 2013 +0100 13.3 @@ -1,5 +1,5 @@ 13.4 /* 13.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 13.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 13.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.8 * 13.9 * This code is free software; you can redistribute it and/or modify it 13.10 @@ -432,6 +432,30 @@ 13.11 return op; 13.12 } 13.13 13.14 + 13.15 +// Performs initialization at vm startup 13.16 +// For Linux we remove any stale .java_pid file which could cause 13.17 +// an attaching process to think we are ready to receive on the 13.18 +// domain socket before we are properly initialized 13.19 + 13.20 +void AttachListener::vm_start() { 13.21 + char fn[UNIX_PATH_MAX]; 13.22 + struct stat64 st; 13.23 + int ret; 13.24 + 13.25 + int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d", 13.26 + os::get_temp_directory(), os::current_process_id()); 13.27 + assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow"); 13.28 + 13.29 + RESTARTABLE(::stat64(fn, &st), ret); 13.30 + if (ret == 0) { 13.31 + ret = ::unlink(fn); 13.32 + if (ret == -1) { 13.33 + debug_only(warning("failed to remove stale attach pid file at %s", fn)); 13.34 + } 13.35 + } 13.36 +} 13.37 + 13.38 int AttachListener::pd_init() { 13.39 JavaThread* thread = JavaThread::current(); 13.40 ThreadBlockInVM tbivm(thread);
14.1 --- a/src/os/linux/vm/jsig.c Thu Jul 25 17:35:33 2013 +0100 14.2 +++ b/src/os/linux/vm/jsig.c Fri Aug 02 11:10:39 2013 +0100 14.3 @@ -1,5 +1,5 @@ 14.4 /* 14.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 14.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 14.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.8 * 14.9 * This code is free software; you can redistribute it and/or modify it 14.10 @@ -107,7 +107,7 @@ 14.11 14.12 signal_lock(); 14.13 14.14 - sigused = (MASK(sig) & jvmsigs) != 0; 14.15 + sigused = (sig < MAXSIGNUM) && ((MASK(sig) & jvmsigs) != 0); 14.16 if (jvm_signal_installed && sigused) { 14.17 /* jvm has installed its signal handler for this signal. */ 14.18 /* Save the handler. Don't really install it. */ 14.19 @@ -116,7 +116,7 @@ 14.20 14.21 signal_unlock(); 14.22 return oldhandler; 14.23 - } else if (jvm_signal_installing) { 14.24 + } else if (sig < MAXSIGNUM && jvm_signal_installing) { 14.25 /* jvm is installing its signal handlers. Install the new 14.26 * handlers and save the old ones. jvm uses sigaction(). 14.27 * Leave the piece here just in case. */ 14.28 @@ -165,7 +165,7 @@ 14.29 14.30 signal_lock(); 14.31 14.32 - sigused = (MASK(sig) & jvmsigs) != 0; 14.33 + sigused = (sig < MAXSIGNUM) && ((MASK(sig) & jvmsigs) != 0); 14.34 if (jvm_signal_installed && sigused) { 14.35 /* jvm has installed its signal handler for this signal. */ 14.36 /* Save the handler. Don't really install it. */ 14.37 @@ -178,7 +178,7 @@ 14.38 14.39 signal_unlock(); 14.40 return 0; 14.41 - } else if (jvm_signal_installing) { 14.42 + } else if (sig < MAXSIGNUM && jvm_signal_installing) { 14.43 /* jvm is installing its signal handlers. Install the new 14.44 * handlers and save the old ones. */ 14.45 res = call_os_sigaction(sig, act, &oldAct);
15.1 --- a/src/os/posix/vm/os_posix.cpp Thu Jul 25 17:35:33 2013 +0100 15.2 +++ b/src/os/posix/vm/os_posix.cpp Fri Aug 02 11:10:39 2013 +0100 15.3 @@ -259,3 +259,52 @@ 15.4 FILE* os::open(int fd, const char* mode) { 15.5 return ::fdopen(fd, mode); 15.6 } 15.7 + 15.8 +os::WatcherThreadCrashProtection::WatcherThreadCrashProtection() { 15.9 + assert(Thread::current()->is_Watcher_thread(), "Must be WatcherThread"); 15.10 +} 15.11 + 15.12 +/* 15.13 + * See the caveats for this class in os_posix.hpp 15.14 + * Protects the callback call so that SIGSEGV / SIGBUS jumps back into this 15.15 + * method and returns false. If none of the signals are raised, returns true. 15.16 + * The callback is supposed to provide the method that should be protected. 15.17 + */ 15.18 +bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) { 15.19 + assert(Thread::current()->is_Watcher_thread(), "Only for WatcherThread"); 15.20 + assert(!WatcherThread::watcher_thread()->has_crash_protection(), 15.21 + "crash_protection already set?"); 15.22 + 15.23 + if (sigsetjmp(_jmpbuf, 1) == 0) { 15.24 + // make sure we can see in the signal handler that we have crash protection 15.25 + // installed 15.26 + WatcherThread::watcher_thread()->set_crash_protection(this); 15.27 + cb.call(); 15.28 + // and clear the crash protection 15.29 + WatcherThread::watcher_thread()->set_crash_protection(NULL); 15.30 + return true; 15.31 + } 15.32 + // this happens when we siglongjmp() back 15.33 + WatcherThread::watcher_thread()->set_crash_protection(NULL); 15.34 + return false; 15.35 +} 15.36 + 15.37 +void os::WatcherThreadCrashProtection::restore() { 15.38 + assert(WatcherThread::watcher_thread()->has_crash_protection(), 15.39 + "must have crash protection"); 15.40 + 15.41 + siglongjmp(_jmpbuf, 1); 15.42 +} 15.43 + 15.44 +void os::WatcherThreadCrashProtection::check_crash_protection(int sig, 15.45 + Thread* thread) { 15.46 + 15.47 + if (thread != NULL && 15.48 + thread->is_Watcher_thread() && 15.49 + WatcherThread::watcher_thread()->has_crash_protection()) { 15.50 + 15.51 + if (sig == SIGSEGV || sig == SIGBUS) { 15.52 + WatcherThread::watcher_thread()->crash_protection()->restore(); 15.53 + } 15.54 + } 15.55 +}
16.1 --- a/src/os/posix/vm/os_posix.hpp Thu Jul 25 17:35:33 2013 +0100 16.2 +++ b/src/os/posix/vm/os_posix.hpp Fri Aug 02 11:10:39 2013 +0100 16.3 @@ -37,5 +37,24 @@ 16.4 16.5 }; 16.6 16.7 +/* 16.8 + * Crash protection for the watcher thread. Wrap the callback 16.9 + * with a sigsetjmp and in case of a SIGSEGV/SIGBUS we siglongjmp 16.10 + * back. 16.11 + * To be able to use this - don't take locks, don't rely on destructors, 16.12 + * don't make OS library calls, don't allocate memory, don't print, 16.13 + * don't call code that could leave the heap / memory in an inconsistent state, 16.14 + * or anything else where we are not in control if we suddenly jump out. 16.15 + */ 16.16 +class WatcherThreadCrashProtection : public StackObj { 16.17 +public: 16.18 + WatcherThreadCrashProtection(); 16.19 + bool call(os::CrashProtectionCallback& cb); 16.20 + 16.21 + static void check_crash_protection(int signal, Thread* thread); 16.22 +private: 16.23 + void restore(); 16.24 + sigjmp_buf _jmpbuf; 16.25 +}; 16.26 16.27 #endif
17.1 --- a/src/os/solaris/vm/attachListener_solaris.cpp Thu Jul 25 17:35:33 2013 +0100 17.2 +++ b/src/os/solaris/vm/attachListener_solaris.cpp Fri Aug 02 11:10:39 2013 +0100 17.3 @@ -1,5 +1,5 @@ 17.4 /* 17.5 - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 17.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 * 17.9 * This code is free software; you can redistribute it and/or modify it 17.10 @@ -576,6 +576,30 @@ 17.11 return op; 17.12 } 17.13 17.14 + 17.15 +// Performs initialization at vm startup 17.16 +// For Solaris we remove any stale .java_pid file which could cause 17.17 +// an attaching process to think we are ready to receive a door_call 17.18 +// before we are properly initialized 17.19 + 17.20 +void AttachListener::vm_start() { 17.21 + char fn[PATH_MAX+1]; 17.22 + struct stat64 st; 17.23 + int ret; 17.24 + 17.25 + int n = snprintf(fn, sizeof(fn), "%s/.java_pid%d", 17.26 + os::get_temp_directory(), os::current_process_id()); 17.27 + assert(n < sizeof(fn), "java_pid file name buffer overflow"); 17.28 + 17.29 + RESTARTABLE(::stat64(fn, &st), ret); 17.30 + if (ret == 0) { 17.31 + ret = ::unlink(fn); 17.32 + if (ret == -1) { 17.33 + debug_only(warning("failed to remove stale attach pid file at %s", fn)); 17.34 + } 17.35 + } 17.36 +} 17.37 + 17.38 int AttachListener::pd_init() { 17.39 JavaThread* thread = JavaThread::current(); 17.40 ThreadBlockInVM tbivm(thread);
18.1 --- a/src/os/windows/vm/attachListener_windows.cpp Thu Jul 25 17:35:33 2013 +0100 18.2 +++ b/src/os/windows/vm/attachListener_windows.cpp Fri Aug 02 11:10:39 2013 +0100 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -358,6 +358,10 @@ 18.11 return op; 18.12 } 18.13 18.14 +void AttachListener::vm_start() { 18.15 + // nothing to do 18.16 +} 18.17 + 18.18 int AttachListener::pd_init() { 18.19 return Win32AttachListener::init(); 18.20 }
19.1 --- a/src/os/windows/vm/os_windows.cpp Thu Jul 25 17:35:33 2013 +0100 19.2 +++ b/src/os/windows/vm/os_windows.cpp Fri Aug 02 11:10:39 2013 +0100 19.3 @@ -4689,6 +4689,34 @@ 19.4 } 19.5 } 19.6 19.7 +os::WatcherThreadCrashProtection::WatcherThreadCrashProtection() { 19.8 + assert(Thread::current()->is_Watcher_thread(), "Must be WatcherThread"); 19.9 +} 19.10 + 19.11 +/* 19.12 + * See the caveats for this class in os_windows.hpp 19.13 + * Protects the callback call so that raised OS EXCEPTIONS causes a jump back 19.14 + * into this method and returns false. If no OS EXCEPTION was raised, returns 19.15 + * true. 19.16 + * The callback is supposed to provide the method that should be protected. 19.17 + */ 19.18 +bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) { 19.19 + assert(Thread::current()->is_Watcher_thread(), "Only for WatcherThread"); 19.20 + assert(!WatcherThread::watcher_thread()->has_crash_protection(), 19.21 + "crash_protection already set?"); 19.22 + 19.23 + bool success = true; 19.24 + __try { 19.25 + WatcherThread::watcher_thread()->set_crash_protection(this); 19.26 + cb.call(); 19.27 + } __except(EXCEPTION_EXECUTE_HANDLER) { 19.28 + // only for protection, nothing to do 19.29 + success = false; 19.30 + } 19.31 + WatcherThread::watcher_thread()->set_crash_protection(NULL); 19.32 + return success; 19.33 +} 19.34 + 19.35 // An Event wraps a win32 "CreateEvent" kernel handle. 19.36 // 19.37 // We have a number of choices regarding "CreateEvent" win32 handle leakage:
20.1 --- a/src/os/windows/vm/os_windows.hpp Thu Jul 25 17:35:33 2013 +0100 20.2 +++ b/src/os/windows/vm/os_windows.hpp Fri Aug 02 11:10:39 2013 +0100 20.3 @@ -102,6 +102,20 @@ 20.4 static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); 20.5 }; 20.6 20.7 +/* 20.8 + * Crash protection for the watcher thread. Wrap the callback 20.9 + * with a __try { call() } 20.10 + * To be able to use this - don't take locks, don't rely on destructors, 20.11 + * don't make OS library calls, don't allocate memory, don't print, 20.12 + * don't call code that could leave the heap / memory in an inconsistent state, 20.13 + * or anything else where we are not in control if we suddenly jump out. 20.14 + */ 20.15 +class WatcherThreadCrashProtection : public StackObj { 20.16 +public: 20.17 + WatcherThreadCrashProtection(); 20.18 + bool call(os::CrashProtectionCallback& cb); 20.19 +}; 20.20 + 20.21 class PlatformEvent : public CHeapObj<mtInternal> { 20.22 private: 20.23 double CachePad [4] ; // increase odds that _Event is sole occupant of cache line
21.1 --- a/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp Thu Jul 25 17:35:33 2013 +0100 21.2 +++ b/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp Fri Aug 02 11:10:39 2013 +0100 21.3 @@ -72,7 +72,7 @@ 21.4 inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; } 21.5 inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); } 21.6 inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; } 21.7 -inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; } 21.8 +inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); } 21.9 21.10 inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; } 21.11 inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; } 21.12 @@ -87,7 +87,7 @@ 21.13 inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; } 21.14 inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); } 21.15 inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; } 21.16 -inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; } 21.17 +inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong*)p, jlong_cast(v)); } 21.18 21.19 inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; } 21.20 inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; } 21.21 @@ -190,7 +190,7 @@ 21.22 inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store_fence((volatile jlong*)p, (jlong)v); } 21.23 21.24 inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); } 21.25 -inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); } 21.26 +inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { release_store_fence((volatile jlong*)p, jdouble_cast(v)); } 21.27 21.28 inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { 21.29 #ifdef AMD64
22.1 --- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Thu Jul 25 17:35:33 2013 +0100 22.2 +++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Fri Aug 02 11:10:39 2013 +0100 22.3 @@ -394,6 +394,10 @@ 22.4 22.5 Thread* t = ThreadLocalStorage::get_thread_slow(); 22.6 22.7 + // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away 22.8 + // (no destructors can be run) 22.9 + os::WatcherThreadCrashProtection::check_crash_protection(sig, t); 22.10 + 22.11 SignalHandlerMark shm(t); 22.12 22.13 // Note: it's not uncommon that JNI code uses signal/sigset to install
23.1 --- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Thu Jul 25 17:35:33 2013 +0100 23.2 +++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Fri Aug 02 11:10:39 2013 +0100 23.3 @@ -544,6 +544,10 @@ 23.4 23.5 Thread* t = ThreadLocalStorage::get_thread_slow(); 23.6 23.7 + // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away 23.8 + // (no destructors can be run) 23.9 + os::WatcherThreadCrashProtection::check_crash_protection(sig, t); 23.10 + 23.11 SignalHandlerMark shm(t); 23.12 23.13 // Note: it's not uncommon that JNI code uses signal/sigset to install
24.1 --- a/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp Thu Jul 25 17:35:33 2013 +0100 24.2 +++ b/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp Fri Aug 02 11:10:39 2013 +0100 24.3 @@ -72,7 +72,7 @@ 24.4 inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; } 24.5 inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); } 24.6 inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; } 24.7 -inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; } 24.8 +inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); } 24.9 24.10 inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; } 24.11 inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; } 24.12 @@ -87,7 +87,7 @@ 24.13 inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; } 24.14 inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); } 24.15 inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; } 24.16 -inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; } 24.17 +inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong *)p, jlong_cast(v)); } 24.18 24.19 inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; } 24.20 inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; } 24.21 @@ -129,7 +129,7 @@ 24.22 inline void OrderAccess::store_fence(juint* p, juint v) { store_fence((jint*)p, (jint)v); } 24.23 inline void OrderAccess::store_fence(julong* p, julong v) { store_fence((jlong*)p, (jlong)v); } 24.24 inline void OrderAccess::store_fence(jfloat* p, jfloat v) { *p = v; fence(); } 24.25 -inline void OrderAccess::store_fence(jdouble* p, jdouble v) { *p = v; fence(); } 24.26 +inline void OrderAccess::store_fence(jdouble* p, jdouble v) { store_fence((jlong*)p, jlong_cast(v)); } 24.27 24.28 inline void OrderAccess::store_ptr_fence(intptr_t* p, intptr_t v) { 24.29 #ifdef AMD64 24.30 @@ -190,7 +190,7 @@ 24.31 inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store_fence((volatile jlong*)p, (jlong)v); } 24.32 24.33 inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); } 24.34 -inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); } 24.35 +inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { release_store_fence((volatile jlong*)p, jlong_cast(v)); } 24.36 24.37 inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { 24.38 #ifdef AMD64
25.1 --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Thu Jul 25 17:35:33 2013 +0100 25.2 +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Fri Aug 02 11:10:39 2013 +0100 25.3 @@ -218,6 +218,10 @@ 25.4 25.5 Thread* t = ThreadLocalStorage::get_thread_slow(); 25.6 25.7 + // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away 25.8 + // (no destructors can be run) 25.9 + os::WatcherThreadCrashProtection::check_crash_protection(sig, t); 25.10 + 25.11 SignalHandlerMark shm(t); 25.12 25.13 // Note: it's not uncommon that JNI code uses signal/sigset to install
26.1 --- a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp Thu Jul 25 17:35:33 2013 +0100 26.2 +++ b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp Fri Aug 02 11:10:39 2013 +0100 26.3 @@ -310,6 +310,10 @@ 26.4 26.5 Thread* t = ThreadLocalStorage::get_thread_slow(); 26.6 26.7 + // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away 26.8 + // (no destructors can be run) 26.9 + os::WatcherThreadCrashProtection::check_crash_protection(sig, t); 26.10 + 26.11 SignalHandlerMark shm(t); 26.12 26.13 if(sig == SIGPIPE || sig == SIGXFSZ) {
27.1 --- a/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp Thu Jul 25 17:35:33 2013 +0100 27.2 +++ b/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp Fri Aug 02 11:10:39 2013 +0100 27.3 @@ -88,7 +88,7 @@ 27.4 inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; } 27.5 inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); } 27.6 inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; } 27.7 -inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; } 27.8 +inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); } 27.9 27.10 inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; } 27.11 inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; } 27.12 @@ -103,7 +103,7 @@ 27.13 inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; } 27.14 inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); } 27.15 inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; } 27.16 -inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; } 27.17 +inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong*)p, jlong_cast(v)); } 27.18 27.19 inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; } 27.20 inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; } 27.21 @@ -129,9 +129,9 @@ 27.22 inline void OrderAccess::release_store_fence(volatile jubyte* p, jubyte v) { *p = v; fence(); } 27.23 inline void OrderAccess::release_store_fence(volatile jushort* p, jushort v) { *p = v; fence(); } 27.24 inline void OrderAccess::release_store_fence(volatile juint* p, juint v) { *p = v; fence(); } 27.25 -inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store(p, v); fence(); } 27.26 +inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store((jlong *)p, (jlong)v); fence(); } 27.27 inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); } 27.28 -inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); } 27.29 +inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { release_store_fence((volatile jlong*)p, jlong_cast(v)); } 27.30 27.31 inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { *p = v; fence(); } 27.32 inline void OrderAccess::release_store_ptr_fence(volatile void* p, void* v) { *(void* volatile *)p = v; fence(); }
28.1 --- a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Thu Jul 25 17:35:33 2013 +0100 28.2 +++ b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Fri Aug 02 11:10:39 2013 +0100 28.3 @@ -367,6 +367,10 @@ 28.4 28.5 Thread* t = ThreadLocalStorage::get_thread_slow(); // slow & steady 28.6 28.7 + // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away 28.8 + // (no destructors can be run) 28.9 + os::WatcherThreadCrashProtection::check_crash_protection(sig, t); 28.10 + 28.11 SignalHandlerMark shm(t); 28.12 28.13 if(sig == SIGPIPE || sig == SIGXFSZ) {
29.1 --- a/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp Thu Jul 25 17:35:33 2013 +0100 29.2 +++ b/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp Fri Aug 02 11:10:39 2013 +0100 29.3 @@ -71,7 +71,7 @@ 29.4 inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; } 29.5 inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); } 29.6 inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; } 29.7 -inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; } 29.8 +inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); } 29.9 29.10 inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; } 29.11 inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; } 29.12 @@ -86,7 +86,7 @@ 29.13 inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; } 29.14 inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); } 29.15 inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; } 29.16 -inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; } 29.17 +inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong*)p, jlong_cast(v)); } 29.18 29.19 inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; } 29.20 inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; } 29.21 @@ -195,7 +195,7 @@ 29.22 inline void OrderAccess::release_store_fence(volatile juint* p, juint v) { release_store_fence((volatile jint*)p, (jint)v); } 29.23 inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store_fence((volatile jlong*)p, (jlong)v); } 29.24 inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); } 29.25 -inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); } 29.26 +inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { release_store_fence((volatile jlong*)p, jlong_cast(v)); } 29.27 29.28 inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { 29.29 #ifdef AMD64
30.1 --- a/src/os_cpu/windows_x86/vm/unwind_windows_x86.hpp Thu Jul 25 17:35:33 2013 +0100 30.2 +++ b/src/os_cpu/windows_x86/vm/unwind_windows_x86.hpp Fri Aug 02 11:10:39 2013 +0100 30.3 @@ -1,5 +1,5 @@ 30.4 /* 30.5 - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 30.6 + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. 30.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.8 * 30.9 * This code is free software; you can redistribute it and/or modify it 30.10 @@ -29,10 +29,15 @@ 30.11 #ifdef AMD64 30.12 typedef unsigned char UBYTE; 30.13 30.14 +#if _MSC_VER < 1700 30.15 + 30.16 +/* Not needed for VS2012 compiler, comes from winnt.h. */ 30.17 #define UNW_FLAG_EHANDLER 0x01 30.18 #define UNW_FLAG_UHANDLER 0x02 30.19 #define UNW_FLAG_CHAININFO 0x04 30.20 30.21 +#endif 30.22 + 30.23 // This structure is used to define an UNWIND_INFO that 30.24 // only has an ExceptionHandler. There are no UnwindCodes 30.25 // declared. 30.26 @@ -59,6 +64,9 @@ 30.27 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; 30.28 */ 30.29 30.30 +#if _MSC_VER < 1700 30.31 + 30.32 +/* Not needed for VS2012 compiler, comes from winnt.h. */ 30.33 typedef struct _DISPATCHER_CONTEXT { 30.34 ULONG64 ControlPc; 30.35 ULONG64 ImageBase; 30.36 @@ -71,6 +79,8 @@ 30.37 PVOID HandlerData; 30.38 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; 30.39 30.40 +#endif 30.41 + 30.42 #if _MSC_VER < 1500 30.43 30.44 /* Not needed for VS2008 compiler, comes from winnt.h. */
31.1 --- a/src/share/vm/ci/bcEscapeAnalyzer.cpp Thu Jul 25 17:35:33 2013 +0100 31.2 +++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp Fri Aug 02 11:10:39 2013 +0100 31.3 @@ -138,6 +138,16 @@ 31.4 return false; 31.5 } 31.6 31.7 +// return true if all argument elements of vars are returned 31.8 +bool BCEscapeAnalyzer::returns_all(ArgumentMap vars) { 31.9 + for (int i = 0; i < _arg_size; i++) { 31.10 + if (vars.contains(i) && !_arg_returned.test(i)) { 31.11 + return false; 31.12 + } 31.13 + } 31.14 + return true; 31.15 +} 31.16 + 31.17 void BCEscapeAnalyzer::clear_bits(ArgumentMap vars, VectorSet &bm) { 31.18 for (int i = 0; i < _arg_size; i++) { 31.19 if (vars.contains(i)) { 31.20 @@ -166,6 +176,11 @@ 31.21 if (vars.contains_unknown() || vars.contains_vars()) { 31.22 _return_allocated = false; 31.23 } 31.24 + if (_return_local && vars.contains_vars() && !returns_all(vars)) { 31.25 + // Return result should be invalidated if args in new 31.26 + // state are not recorded in return state. 31.27 + _return_local = false; 31.28 + } 31.29 } 31.30 } 31.31
32.1 --- a/src/share/vm/ci/bcEscapeAnalyzer.hpp Thu Jul 25 17:35:33 2013 +0100 32.2 +++ b/src/share/vm/ci/bcEscapeAnalyzer.hpp Fri Aug 02 11:10:39 2013 +0100 32.3 @@ -80,6 +80,7 @@ 32.4 void set_returned(ArgumentMap vars); 32.5 bool is_argument(ArgumentMap vars); 32.6 bool is_arg_stack(ArgumentMap vars); 32.7 + bool returns_all(ArgumentMap vars); 32.8 void clear_bits(ArgumentMap vars, VectorSet &bs); 32.9 void set_method_escape(ArgumentMap vars); 32.10 void set_global_escape(ArgumentMap vars, bool merge = false);
33.1 --- a/src/share/vm/classfile/classFileParser.cpp Thu Jul 25 17:35:33 2013 +0100 33.2 +++ b/src/share/vm/classfile/classFileParser.cpp Fri Aug 02 11:10:39 2013 +0100 33.3 @@ -3647,8 +3647,7 @@ 33.4 // If RedefineClasses() was used before the retransformable 33.5 // agent attached, then the cached class bytes may not be the 33.6 // original class bytes. 33.7 - unsigned char *cached_class_file_bytes = NULL; 33.8 - jint cached_class_file_length; 33.9 + JvmtiCachedClassFileData *cached_class_file = NULL; 33.10 Handle class_loader(THREAD, loader_data->class_loader()); 33.11 bool has_default_methods = false; 33.12 ResourceMark rm(THREAD); 33.13 @@ -3680,10 +3679,7 @@ 33.14 if (h_class_being_redefined != NULL) { 33.15 instanceKlassHandle ikh_class_being_redefined = 33.16 instanceKlassHandle(THREAD, (*h_class_being_redefined)()); 33.17 - cached_class_file_bytes = 33.18 - ikh_class_being_redefined->get_cached_class_file_bytes(); 33.19 - cached_class_file_length = 33.20 - ikh_class_being_redefined->get_cached_class_file_len(); 33.21 + cached_class_file = ikh_class_being_redefined->get_cached_class_file(); 33.22 } 33.23 } 33.24 33.25 @@ -3691,9 +3687,7 @@ 33.26 unsigned char* end_ptr = cfs->buffer() + cfs->length(); 33.27 33.28 JvmtiExport::post_class_file_load_hook(name, class_loader(), protection_domain, 33.29 - &ptr, &end_ptr, 33.30 - &cached_class_file_bytes, 33.31 - &cached_class_file_length); 33.32 + &ptr, &end_ptr, &cached_class_file); 33.33 33.34 if (ptr != cfs->buffer()) { 33.35 // JVMTI agent has modified class file data. 33.36 @@ -4011,10 +4005,9 @@ 33.37 } 33.38 } 33.39 33.40 - if (cached_class_file_bytes != NULL) { 33.41 + if (cached_class_file != NULL) { 33.42 // JVMTI: we have an InstanceKlass now, tell it about the cached bytes 33.43 - this_klass->set_cached_class_file(cached_class_file_bytes, 33.44 - cached_class_file_length); 33.45 + this_klass->set_cached_class_file(cached_class_file); 33.46 } 33.47 33.48 // Fill in field values obtained by parse_classfile_attributes
34.1 --- a/src/share/vm/classfile/vmSymbols.hpp Thu Jul 25 17:35:33 2013 +0100 34.2 +++ b/src/share/vm/classfile/vmSymbols.hpp Fri Aug 02 11:10:39 2013 +0100 34.3 @@ -53,8 +53,6 @@ 34.4 template(java_lang_Object, "java/lang/Object") \ 34.5 template(java_lang_Class, "java/lang/Class") \ 34.6 template(java_lang_String, "java/lang/String") \ 34.7 - template(java_lang_StringValue, "java/lang/StringValue") \ 34.8 - template(java_lang_StringCache, "java/lang/StringValue$StringCache") \ 34.9 template(java_lang_Thread, "java/lang/Thread") \ 34.10 template(java_lang_ThreadGroup, "java/lang/ThreadGroup") \ 34.11 template(java_lang_Cloneable, "java/lang/Cloneable") \ 34.12 @@ -106,7 +104,6 @@ 34.13 template(java_util_Vector, "java/util/Vector") \ 34.14 template(java_util_AbstractList, "java/util/AbstractList") \ 34.15 template(java_util_Hashtable, "java/util/Hashtable") \ 34.16 - template(java_util_HashMap, "java/util/HashMap") \ 34.17 template(java_lang_Compiler, "java/lang/Compiler") \ 34.18 template(sun_misc_Signal, "sun/misc/Signal") \ 34.19 template(java_lang_AssertionStatusDirectives, "java/lang/AssertionStatusDirectives") \ 34.20 @@ -367,8 +364,6 @@ 34.21 template(offset_name, "offset") \ 34.22 template(count_name, "count") \ 34.23 template(hash_name, "hash") \ 34.24 - template(frontCacheEnabled_name, "frontCacheEnabled") \ 34.25 - template(stringCacheEnabled_name, "stringCacheEnabled") \ 34.26 template(numberOfLeadingZeros_name, "numberOfLeadingZeros") \ 34.27 template(numberOfTrailingZeros_name, "numberOfTrailingZeros") \ 34.28 template(bitCount_name, "bitCount") \
35.1 --- a/src/share/vm/memory/resourceArea.hpp Thu Jul 25 17:35:33 2013 +0100 35.2 +++ b/src/share/vm/memory/resourceArea.hpp Fri Aug 02 11:10:39 2013 +0100 35.3 @@ -1,5 +1,5 @@ 35.4 /* 35.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 35.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 35.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.8 * 35.9 * This code is free software; you can redistribute it and/or modify it 35.10 @@ -83,6 +83,10 @@ 35.11 Chunk *_chunk; // saved arena chunk 35.12 char *_hwm, *_max; 35.13 size_t _size_in_bytes; 35.14 +#ifdef ASSERT 35.15 + Thread* _thread; 35.16 + ResourceMark* _previous_resource_mark; 35.17 +#endif //ASSERT 35.18 35.19 void initialize(Thread *thread) { 35.20 _area = thread->resource_area(); 35.21 @@ -92,6 +96,11 @@ 35.22 _size_in_bytes = _area->size_in_bytes(); 35.23 debug_only(_area->_nesting++;) 35.24 assert( _area->_nesting > 0, "must stack allocate RMs" ); 35.25 +#ifdef ASSERT 35.26 + _thread = thread; 35.27 + _previous_resource_mark = thread->current_resource_mark(); 35.28 + thread->set_current_resource_mark(this); 35.29 +#endif // ASSERT 35.30 } 35.31 public: 35.32 35.33 @@ -111,6 +120,17 @@ 35.34 _size_in_bytes = r->_size_in_bytes; 35.35 debug_only(_area->_nesting++;) 35.36 assert( _area->_nesting > 0, "must stack allocate RMs" ); 35.37 +#ifdef ASSERT 35.38 + Thread* thread = ThreadLocalStorage::thread(); 35.39 + if (thread != NULL) { 35.40 + _thread = thread; 35.41 + _previous_resource_mark = thread->current_resource_mark(); 35.42 + thread->set_current_resource_mark(this); 35.43 + } else { 35.44 + _thread = NULL; 35.45 + _previous_resource_mark = NULL; 35.46 + } 35.47 +#endif // ASSERT 35.48 } 35.49 35.50 void reset_to_mark() { 35.51 @@ -137,6 +157,11 @@ 35.52 assert( _area->_nesting > 0, "must stack allocate RMs" ); 35.53 debug_only(_area->_nesting--;) 35.54 reset_to_mark(); 35.55 +#ifdef ASSERT 35.56 + if (_thread != NULL) { 35.57 + _thread->set_current_resource_mark(_previous_resource_mark); 35.58 + } 35.59 +#endif // ASSERT 35.60 } 35.61 35.62
36.1 --- a/src/share/vm/oops/cpCache.hpp Thu Jul 25 17:35:33 2013 +0100 36.2 +++ b/src/share/vm/oops/cpCache.hpp Fri Aug 02 11:10:39 2013 +0100 36.3 @@ -140,8 +140,15 @@ 36.4 _f1 = f1; 36.5 } 36.6 void release_set_f1(Metadata* f1); 36.7 - void set_f2(intx f2) { assert(_f2 == 0 || _f2 == f2, "illegal field change"); _f2 = f2; } 36.8 - void set_f2_as_vfinal_method(Method* f2) { assert(_f2 == 0 || _f2 == (intptr_t) f2, "illegal field change"); assert(is_vfinal(), "flags must be set"); _f2 = (intptr_t) f2; } 36.9 + void set_f2(intx f2) { 36.10 + intx existing_f2 = _f2; // read once 36.11 + assert(existing_f2 == 0 || existing_f2 == f2, "illegal field change"); 36.12 + _f2 = f2; 36.13 + } 36.14 + void set_f2_as_vfinal_method(Method* f2) { 36.15 + assert(is_vfinal(), "flags must be set"); 36.16 + set_f2((intx)f2); 36.17 + } 36.18 int make_flags(TosState state, int option_bits, int field_index_or_method_params); 36.19 void set_flags(intx flags) { _flags = flags; } 36.20 bool init_flags_atomic(intx flags);
37.1 --- a/src/share/vm/oops/instanceKlass.cpp Thu Jul 25 17:35:33 2013 +0100 37.2 +++ b/src/share/vm/oops/instanceKlass.cpp Fri Aug 02 11:10:39 2013 +0100 37.3 @@ -48,6 +48,7 @@ 37.4 #include "oops/symbol.hpp" 37.5 #include "prims/jvmtiExport.hpp" 37.6 #include "prims/jvmtiRedefineClassesTrace.hpp" 37.7 +#include "prims/jvmtiRedefineClasses.hpp" 37.8 #include "prims/methodComparator.hpp" 37.9 #include "runtime/fieldDescriptor.hpp" 37.10 #include "runtime/handles.inline.hpp" 37.11 @@ -291,7 +292,7 @@ 37.12 set_initial_method_idnum(0); 37.13 _dependencies = NULL; 37.14 set_jvmti_cached_class_field_map(NULL); 37.15 - set_cached_class_file(NULL, 0); 37.16 + set_cached_class_file(NULL); 37.17 set_initial_method_idnum(0); 37.18 set_minor_version(0); 37.19 set_major_version(0); 37.20 @@ -2357,10 +2358,9 @@ 37.21 } 37.22 37.23 // deallocate the cached class file 37.24 - if (_cached_class_file_bytes != NULL) { 37.25 - os::free(_cached_class_file_bytes, mtClass); 37.26 - _cached_class_file_bytes = NULL; 37.27 - _cached_class_file_len = 0; 37.28 + if (_cached_class_file != NULL) { 37.29 + os::free(_cached_class_file, mtClass); 37.30 + _cached_class_file = NULL; 37.31 } 37.32 37.33 // Decrement symbol reference counts associated with the unloaded class. 37.34 @@ -3530,6 +3530,14 @@ 37.35 return m; 37.36 } 37.37 37.38 +jint InstanceKlass::get_cached_class_file_len() { 37.39 + return VM_RedefineClasses::get_cached_class_file_len(_cached_class_file); 37.40 +} 37.41 + 37.42 +unsigned char * InstanceKlass::get_cached_class_file_bytes() { 37.43 + return VM_RedefineClasses::get_cached_class_file_bytes(_cached_class_file); 37.44 +} 37.45 + 37.46 37.47 // Construct a PreviousVersionNode entry for the array hung off 37.48 // the InstanceKlass.
38.1 --- a/src/share/vm/oops/instanceKlass.hpp Thu Jul 25 17:35:33 2013 +0100 38.2 +++ b/src/share/vm/oops/instanceKlass.hpp Fri Aug 02 11:10:39 2013 +0100 38.3 @@ -133,6 +133,8 @@ 38.4 uint _count; 38.5 }; 38.6 38.7 +struct JvmtiCachedClassFileData; 38.8 + 38.9 class InstanceKlass: public Klass { 38.10 friend class VMStructs; 38.11 friend class ClassFileParser; 38.12 @@ -249,8 +251,8 @@ 38.13 // InstanceKlass. See PreviousVersionWalker below. 38.14 GrowableArray<PreviousVersionNode *>* _previous_versions; 38.15 // JVMTI fields can be moved to their own structure - see 6315920 38.16 - unsigned char * _cached_class_file_bytes; // JVMTI: cached class file, before retransformable agent modified it in CFLH 38.17 - jint _cached_class_file_len; // JVMTI: length of above 38.18 + // JVMTI: cached class file, before retransformable agent modified it in CFLH 38.19 + JvmtiCachedClassFileData* _cached_class_file; 38.20 38.21 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change 38.22 38.23 @@ -615,11 +617,12 @@ 38.24 static void purge_previous_versions(InstanceKlass* ik); 38.25 38.26 // JVMTI: Support for caching a class file before it is modified by an agent that can do retransformation 38.27 - void set_cached_class_file(unsigned char *class_file_bytes, 38.28 - jint class_file_len) { _cached_class_file_len = class_file_len; 38.29 - _cached_class_file_bytes = class_file_bytes; } 38.30 - jint get_cached_class_file_len() { return _cached_class_file_len; } 38.31 - unsigned char * get_cached_class_file_bytes() { return _cached_class_file_bytes; } 38.32 + void set_cached_class_file(JvmtiCachedClassFileData *data) { 38.33 + _cached_class_file = data; 38.34 + } 38.35 + JvmtiCachedClassFileData * get_cached_class_file() { return _cached_class_file; } 38.36 + jint get_cached_class_file_len(); 38.37 + unsigned char * get_cached_class_file_bytes(); 38.38 38.39 // JVMTI: Support for caching of field indices, types, and offsets 38.40 void set_jvmti_cached_class_field_map(JvmtiCachedClassFieldMap* descriptor) {
39.1 --- a/src/share/vm/oops/method.cpp Thu Jul 25 17:35:33 2013 +0100 39.2 +++ b/src/share/vm/oops/method.cpp Fri Aug 02 11:10:39 2013 +0100 39.3 @@ -1163,6 +1163,7 @@ 39.4 newm->constMethod()->set_constMethod_size(new_const_method_size); 39.5 newm->set_method_size(new_method_size); 39.6 assert(newm->code_size() == new_code_length, "check"); 39.7 + assert(newm->method_parameters_length() == method_parameters_len, "check"); 39.8 assert(newm->checked_exceptions_length() == checked_exceptions_len, "check"); 39.9 assert(newm->exception_table_length() == exception_table_len, "check"); 39.10 assert(newm->localvariable_table_length() == localvariable_len, "check"); 39.11 @@ -1174,6 +1175,12 @@ 39.12 new_compressed_linenumber_table, 39.13 new_compressed_linenumber_size); 39.14 } 39.15 + // Copy method_parameters 39.16 + if (method_parameters_len > 0) { 39.17 + memcpy(newm->method_parameters_start(), 39.18 + m->method_parameters_start(), 39.19 + method_parameters_len * sizeof(MethodParametersElement)); 39.20 + } 39.21 // Copy checked_exceptions 39.22 if (checked_exceptions_len > 0) { 39.23 memcpy(newm->checked_exceptions_start(),
40.1 --- a/src/share/vm/opto/bytecodeInfo.cpp Thu Jul 25 17:35:33 2013 +0100 40.2 +++ b/src/share/vm/opto/bytecodeInfo.cpp Fri Aug 02 11:10:39 2013 +0100 40.3 @@ -297,15 +297,6 @@ 40.4 } 40.5 } 40.6 40.7 - if (UseStringCache) { 40.8 - // Do not inline StringCache::profile() method used only at the beginning. 40.9 - if (callee_method->name() == ciSymbol::profile_name() && 40.10 - callee_method->holder()->name() == ciSymbol::java_lang_StringCache()) { 40.11 - set_msg("profiling method"); 40.12 - return true; 40.13 - } 40.14 - } 40.15 - 40.16 // use frequency-based objections only for non-trivial methods 40.17 if (callee_method->code_size() <= MaxTrivialSize) { 40.18 return false;
41.1 --- a/src/share/vm/opto/matcher.cpp Thu Jul 25 17:35:33 2013 +0100 41.2 +++ b/src/share/vm/opto/matcher.cpp Fri Aug 02 11:10:39 2013 +0100 41.3 @@ -2305,26 +2305,26 @@ 41.4 // atomic instruction acting as a store_load barrier without any 41.5 // intervening volatile load, and thus we don't need a barrier here. 41.6 // We retain the Node to act as a compiler ordering barrier. 41.7 -bool Matcher::post_store_load_barrier(const Node *vmb) { 41.8 - Compile *C = Compile::current(); 41.9 - assert( vmb->is_MemBar(), "" ); 41.10 - assert( vmb->Opcode() != Op_MemBarAcquire, "" ); 41.11 - const MemBarNode *mem = (const MemBarNode*)vmb; 41.12 +bool Matcher::post_store_load_barrier(const Node* vmb) { 41.13 + Compile* C = Compile::current(); 41.14 + assert(vmb->is_MemBar(), ""); 41.15 + assert(vmb->Opcode() != Op_MemBarAcquire, ""); 41.16 + const MemBarNode* membar = vmb->as_MemBar(); 41.17 41.18 - // Get the Proj node, ctrl, that can be used to iterate forward 41.19 - Node *ctrl = NULL; 41.20 - DUIterator_Fast imax, i = mem->fast_outs(imax); 41.21 - while( true ) { 41.22 - ctrl = mem->fast_out(i); // Throw out-of-bounds if proj not found 41.23 - assert( ctrl->is_Proj(), "only projections here" ); 41.24 - ProjNode *proj = (ProjNode*)ctrl; 41.25 - if( proj->_con == TypeFunc::Control && 41.26 - !C->node_arena()->contains(ctrl) ) // Unmatched old-space only 41.27 + // Get the Ideal Proj node, ctrl, that can be used to iterate forward 41.28 + Node* ctrl = NULL; 41.29 + for (DUIterator_Fast imax, i = membar->fast_outs(imax); i < imax; i++) { 41.30 + Node* p = membar->fast_out(i); 41.31 + assert(p->is_Proj(), "only projections here"); 41.32 + if ((p->as_Proj()->_con == TypeFunc::Control) && 41.33 + !C->node_arena()->contains(p)) { // Unmatched old-space only 41.34 + ctrl = p; 41.35 break; 41.36 - i++; 41.37 + } 41.38 } 41.39 + assert((ctrl != NULL), "missing control projection"); 41.40 41.41 - for( DUIterator_Fast jmax, j = ctrl->fast_outs(jmax); j < jmax; j++ ) { 41.42 + for (DUIterator_Fast jmax, j = ctrl->fast_outs(jmax); j < jmax; j++) { 41.43 Node *x = ctrl->fast_out(j); 41.44 int xop = x->Opcode(); 41.45 41.46 @@ -2336,37 +2336,36 @@ 41.47 // that a monitor exit operation contains a serializing instruction. 41.48 41.49 if (xop == Op_MemBarVolatile || 41.50 - xop == Op_FastLock || 41.51 xop == Op_CompareAndSwapL || 41.52 xop == Op_CompareAndSwapP || 41.53 xop == Op_CompareAndSwapN || 41.54 - xop == Op_CompareAndSwapI) 41.55 + xop == Op_CompareAndSwapI) { 41.56 return true; 41.57 + } 41.58 + 41.59 + // Op_FastLock previously appeared in the Op_* list above. 41.60 + // With biased locking we're no longer guaranteed that a monitor 41.61 + // enter operation contains a serializing instruction. 41.62 + if ((xop == Op_FastLock) && !UseBiasedLocking) { 41.63 + return true; 41.64 + } 41.65 41.66 if (x->is_MemBar()) { 41.67 // We must retain this membar if there is an upcoming volatile 41.68 - // load, which will be preceded by acquire membar. 41.69 - if (xop == Op_MemBarAcquire) 41.70 + // load, which will be followed by acquire membar. 41.71 + if (xop == Op_MemBarAcquire) { 41.72 return false; 41.73 - // For other kinds of barriers, check by pretending we 41.74 - // are them, and seeing if we can be removed. 41.75 - else 41.76 - return post_store_load_barrier((const MemBarNode*)x); 41.77 + } else { 41.78 + // For other kinds of barriers, check by pretending we 41.79 + // are them, and seeing if we can be removed. 41.80 + return post_store_load_barrier(x->as_MemBar()); 41.81 + } 41.82 } 41.83 41.84 - // Delicate code to detect case of an upcoming fastlock block 41.85 - if( x->is_If() && x->req() > 1 && 41.86 - !C->node_arena()->contains(x) ) { // Unmatched old-space only 41.87 - Node *iff = x; 41.88 - Node *bol = iff->in(1); 41.89 - // The iff might be some random subclass of If or bol might be Con-Top 41.90 - if (!bol->is_Bool()) return false; 41.91 - assert( bol->req() > 1, "" ); 41.92 - return (bol->in(1)->Opcode() == Op_FastUnlock); 41.93 + // probably not necessary to check for these 41.94 + if (x->is_Call() || x->is_SafePoint() || x->is_block_proj()) { 41.95 + return false; 41.96 } 41.97 - // probably not necessary to check for these 41.98 - if (x->is_Call() || x->is_SafePoint() || x->is_block_proj()) 41.99 - return false; 41.100 } 41.101 return false; 41.102 }
42.1 --- a/src/share/vm/opto/parse3.cpp Thu Jul 25 17:35:33 2013 +0100 42.2 +++ b/src/share/vm/opto/parse3.cpp Fri Aug 02 11:10:39 2013 +0100 42.3 @@ -294,25 +294,7 @@ 42.4 // If reference is volatile, prevent following volatiles ops from 42.5 // floating up before the volatile write. 42.6 if (is_vol) { 42.7 - // First place the specific membar for THIS volatile index. This first 42.8 - // membar is dependent on the store, keeping any other membars generated 42.9 - // below from floating up past the store. 42.10 - int adr_idx = C->get_alias_index(adr_type); 42.11 - insert_mem_bar_volatile(Op_MemBarVolatile, adr_idx, store); 42.12 - 42.13 - // Now place a membar for AliasIdxBot for the unknown yet-to-be-parsed 42.14 - // volatile alias indices. Skip this if the membar is redundant. 42.15 - if (adr_idx != Compile::AliasIdxBot) { 42.16 - insert_mem_bar_volatile(Op_MemBarVolatile, Compile::AliasIdxBot, store); 42.17 - } 42.18 - 42.19 - // Finally, place alias-index-specific membars for each volatile index 42.20 - // that isn't the adr_idx membar. Typically there's only 1 or 2. 42.21 - for( int i = Compile::AliasIdxRaw; i < C->num_alias_types(); i++ ) { 42.22 - if (i != adr_idx && C->alias_type(i)->is_volatile()) { 42.23 - insert_mem_bar_volatile(Op_MemBarVolatile, i, store); 42.24 - } 42.25 - } 42.26 + insert_mem_bar(Op_MemBarVolatile); // Use fat membar 42.27 } 42.28 42.29 // If the field is final, the rules of Java say we are in <init> or <clinit>.
43.1 --- a/src/share/vm/prims/forte.cpp Thu Jul 25 17:35:33 2013 +0100 43.2 +++ b/src/share/vm/prims/forte.cpp Fri Aug 02 11:10:39 2013 +0100 43.3 @@ -31,6 +31,7 @@ 43.4 #include "oops/oop.inline.hpp" 43.5 #include "oops/oop.inline2.hpp" 43.6 #include "prims/forte.hpp" 43.7 +#include "runtime/javaCalls.hpp" 43.8 #include "runtime/thread.hpp" 43.9 #include "runtime/vframe.hpp" 43.10 #include "runtime/vframeArray.hpp" 43.11 @@ -308,10 +309,14 @@ 43.12 43.13 for (loop_count = 0; loop_count < loop_max; loop_count++) { 43.14 43.15 - if (candidate.is_first_frame()) { 43.16 + if (candidate.is_entry_frame()) { 43.17 + // jcw is NULL if the java call wrapper couldn't be found 43.18 + JavaCallWrapper *jcw = candidate.entry_frame_call_wrapper_if_safe(thread); 43.19 // If initial frame is frame from StubGenerator and there is no 43.20 // previous anchor, there are no java frames associated with a method 43.21 - return false; 43.22 + if (jcw == NULL || jcw->is_first_frame()) { 43.23 + return false; 43.24 + } 43.25 } 43.26 43.27 if (candidate.is_interpreted_frame()) {
44.1 --- a/src/share/vm/prims/jniCheck.cpp Thu Jul 25 17:35:33 2013 +0100 44.2 +++ b/src/share/vm/prims/jniCheck.cpp Fri Aug 02 11:10:39 2013 +0100 44.3 @@ -126,6 +126,7 @@ 44.4 static const char * fatal_non_weak_method = "non-weak methodID passed to JNI call"; 44.5 static const char * fatal_unknown_array_object = "Unknown array object passed to JNI array operations"; 44.6 static const char * fatal_object_array_expected = "Object array expected but not received for JNI array operation"; 44.7 +static const char * fatal_prim_type_array_expected = "Primitive type array expected but not received for JNI array operation"; 44.8 static const char * fatal_non_array = "Non-array passed to JNI array operations"; 44.9 static const char * fatal_element_type_mismatch = "Array element type mismatch in JNI"; 44.10 static const char * fatal_should_be_static = "Non-static field ID passed to JNI"; 44.11 @@ -278,30 +279,49 @@ 44.12 ReportJNIFatalError(thr, fatal_non_string); 44.13 } 44.14 44.15 -static inline void 44.16 -checkArray(JavaThread* thr, jarray jArray, int elementType) 44.17 +static inline arrayOop 44.18 +check_is_array(JavaThread* thr, jarray jArray) 44.19 { 44.20 ASSERT_OOPS_ALLOWED; 44.21 arrayOop aOop; 44.22 44.23 aOop = (arrayOop)jniCheck::validate_object(thr, jArray); 44.24 - if (aOop == NULL || !aOop->is_array()) 44.25 + if (aOop == NULL || !aOop->is_array()) { 44.26 ReportJNIFatalError(thr, fatal_non_array); 44.27 + } 44.28 + return aOop; 44.29 +} 44.30 44.31 - if (elementType != -1) { 44.32 - if (aOop->is_typeArray()) { 44.33 - BasicType array_type = TypeArrayKlass::cast(aOop->klass())->element_type(); 44.34 - if (array_type != elementType) 44.35 - ReportJNIFatalError(thr, fatal_element_type_mismatch); 44.36 - } else if (aOop->is_objArray()) { 44.37 - if ( T_OBJECT != elementType) 44.38 - ReportJNIFatalError(thr, fatal_object_array_expected); 44.39 - } else { 44.40 - ReportJNIFatalError(thr, fatal_unknown_array_object); 44.41 - } 44.42 +static inline arrayOop 44.43 +check_is_primitive_array(JavaThread* thr, jarray jArray) { 44.44 + arrayOop aOop = check_is_array(thr, jArray); 44.45 + 44.46 + if (!aOop->is_typeArray()) { 44.47 + ReportJNIFatalError(thr, fatal_prim_type_array_expected); 44.48 + } 44.49 + return aOop; 44.50 +} 44.51 + 44.52 +static inline void 44.53 +check_primitive_array_type(JavaThread* thr, jarray jArray, BasicType elementType) 44.54 +{ 44.55 + BasicType array_type; 44.56 + arrayOop aOop; 44.57 + 44.58 + aOop = check_is_primitive_array(thr, jArray); 44.59 + array_type = TypeArrayKlass::cast(aOop->klass())->element_type(); 44.60 + if (array_type != elementType) { 44.61 + ReportJNIFatalError(thr, fatal_element_type_mismatch); 44.62 } 44.63 } 44.64 44.65 +static inline void 44.66 +check_is_obj_array(JavaThread* thr, jarray jArray) { 44.67 + arrayOop aOop = check_is_array(thr, jArray); 44.68 + if (!aOop->is_objArray()) { 44.69 + ReportJNIFatalError(thr, fatal_object_array_expected); 44.70 + } 44.71 +} 44.72 44.73 oop jniCheck::validate_handle(JavaThread* thr, jobject obj) { 44.74 if (JNIHandles::is_frame_handle(thr, obj) || 44.75 @@ -1417,7 +1437,7 @@ 44.76 jarray array)) 44.77 functionEnter(thr); 44.78 IN_VM( 44.79 - checkArray(thr, array, -1); 44.80 + check_is_array(thr, array); 44.81 ) 44.82 jsize result = UNCHECKED()->GetArrayLength(env,array); 44.83 functionExit(env); 44.84 @@ -1441,7 +1461,7 @@ 44.85 jsize index)) 44.86 functionEnter(thr); 44.87 IN_VM( 44.88 - checkArray(thr, array, T_OBJECT); 44.89 + check_is_obj_array(thr, array); 44.90 ) 44.91 jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index); 44.92 functionExit(env); 44.93 @@ -1455,7 +1475,7 @@ 44.94 jobject val)) 44.95 functionEnter(thr); 44.96 IN_VM( 44.97 - checkArray(thr, array, T_OBJECT); 44.98 + check_is_obj_array(thr, array); 44.99 ) 44.100 UNCHECKED()->SetObjectArrayElement(env,array,index,val); 44.101 functionExit(env); 44.102 @@ -1487,7 +1507,7 @@ 44.103 jboolean *isCopy)) \ 44.104 functionEnter(thr); \ 44.105 IN_VM( \ 44.106 - checkArray(thr, array, ElementTag); \ 44.107 + check_primitive_array_type(thr, array, ElementTag); \ 44.108 ) \ 44.109 ElementType *result = UNCHECKED()->Get##Result##ArrayElements(env, \ 44.110 array, \ 44.111 @@ -1513,7 +1533,7 @@ 44.112 jint mode)) \ 44.113 functionEnterExceptionAllowed(thr); \ 44.114 IN_VM( \ 44.115 - checkArray(thr, array, ElementTag); \ 44.116 + check_primitive_array_type(thr, array, ElementTag); \ 44.117 ASSERT_OOPS_ALLOWED; \ 44.118 typeArrayOop a = typeArrayOop(JNIHandles::resolve_non_null(array)); \ 44.119 /* cannot check validity of copy, unless every request is logged by 44.120 @@ -1543,7 +1563,7 @@ 44.121 ElementType *buf)) \ 44.122 functionEnter(thr); \ 44.123 IN_VM( \ 44.124 - checkArray(thr, array, ElementTag); \ 44.125 + check_primitive_array_type(thr, array, ElementTag); \ 44.126 ) \ 44.127 UNCHECKED()->Get##Result##ArrayRegion(env,array,start,len,buf); \ 44.128 functionExit(env); \ 44.129 @@ -1567,7 +1587,7 @@ 44.130 const ElementType *buf)) \ 44.131 functionEnter(thr); \ 44.132 IN_VM( \ 44.133 - checkArray(thr, array, ElementTag); \ 44.134 + check_primitive_array_type(thr, array, ElementTag); \ 44.135 ) \ 44.136 UNCHECKED()->Set##Result##ArrayRegion(env,array,start,len,buf); \ 44.137 functionExit(env); \ 44.138 @@ -1669,7 +1689,7 @@ 44.139 jboolean *isCopy)) 44.140 functionEnterCritical(thr); 44.141 IN_VM( 44.142 - checkArray(thr, array, -1); 44.143 + check_is_primitive_array(thr, array); 44.144 ) 44.145 void *result = UNCHECKED()->GetPrimitiveArrayCritical(env, array, isCopy); 44.146 functionExit(env); 44.147 @@ -1683,7 +1703,7 @@ 44.148 jint mode)) 44.149 functionEnterCriticalExceptionAllowed(thr); 44.150 IN_VM( 44.151 - checkArray(thr, array, -1); 44.152 + check_is_primitive_array(thr, array); 44.153 ) 44.154 /* The Hotspot JNI code does not use the parameters, so just check the 44.155 * array parameter as a minor sanity check
45.1 --- a/src/share/vm/prims/jvmtiExport.cpp Thu Jul 25 17:35:33 2013 +0100 45.2 +++ b/src/share/vm/prims/jvmtiExport.cpp Fri Aug 02 11:10:39 2013 +0100 45.3 @@ -41,6 +41,7 @@ 45.4 #include "prims/jvmtiRawMonitor.hpp" 45.5 #include "prims/jvmtiTagMap.hpp" 45.6 #include "prims/jvmtiThreadState.inline.hpp" 45.7 +#include "prims/jvmtiRedefineClasses.hpp" 45.8 #include "runtime/arguments.hpp" 45.9 #include "runtime/handles.hpp" 45.10 #include "runtime/interfaceSupport.hpp" 45.11 @@ -516,8 +517,7 @@ 45.12 jint _curr_len; 45.13 unsigned char * _curr_data; 45.14 JvmtiEnv * _curr_env; 45.15 - jint * _cached_length_ptr; 45.16 - unsigned char ** _cached_data_ptr; 45.17 + JvmtiCachedClassFileData ** _cached_class_file_ptr; 45.18 JvmtiThreadState * _state; 45.19 KlassHandle * _h_class_being_redefined; 45.20 JvmtiClassLoadKind _load_kind; 45.21 @@ -526,8 +526,7 @@ 45.22 inline JvmtiClassFileLoadHookPoster(Symbol* h_name, Handle class_loader, 45.23 Handle h_protection_domain, 45.24 unsigned char **data_ptr, unsigned char **end_ptr, 45.25 - unsigned char **cached_data_ptr, 45.26 - jint *cached_length_ptr) { 45.27 + JvmtiCachedClassFileData **cache_ptr) { 45.28 _h_name = h_name; 45.29 _class_loader = class_loader; 45.30 _h_protection_domain = h_protection_domain; 45.31 @@ -537,8 +536,7 @@ 45.32 _curr_len = *end_ptr - *data_ptr; 45.33 _curr_data = *data_ptr; 45.34 _curr_env = NULL; 45.35 - _cached_length_ptr = cached_length_ptr; 45.36 - _cached_data_ptr = cached_data_ptr; 45.37 + _cached_class_file_ptr = cache_ptr; 45.38 45.39 _state = _thread->jvmti_thread_state(); 45.40 if (_state != NULL) { 45.41 @@ -615,15 +613,20 @@ 45.42 } 45.43 if (new_data != NULL) { 45.44 // this agent has modified class data. 45.45 - if (caching_needed && *_cached_data_ptr == NULL) { 45.46 + if (caching_needed && *_cached_class_file_ptr == NULL) { 45.47 // data has been changed by the new retransformable agent 45.48 // and it hasn't already been cached, cache it 45.49 - *_cached_data_ptr = (unsigned char *)os::malloc(_curr_len, mtInternal); 45.50 - if (*_cached_data_ptr == NULL) { 45.51 - vm_exit_out_of_memory(_curr_len, OOM_MALLOC_ERROR, "unable to allocate cached copy of original class bytes"); 45.52 + JvmtiCachedClassFileData *p; 45.53 + p = (JvmtiCachedClassFileData *)os::malloc( 45.54 + offset_of(JvmtiCachedClassFileData, data) + _curr_len, mtInternal); 45.55 + if (p == NULL) { 45.56 + vm_exit_out_of_memory(offset_of(JvmtiCachedClassFileData, data) + _curr_len, 45.57 + OOM_MALLOC_ERROR, 45.58 + "unable to allocate cached copy of original class bytes"); 45.59 } 45.60 - memcpy(*_cached_data_ptr, _curr_data, _curr_len); 45.61 - *_cached_length_ptr = _curr_len; 45.62 + p->length = _curr_len; 45.63 + memcpy(p->data, _curr_data, _curr_len); 45.64 + *_cached_class_file_ptr = p; 45.65 } 45.66 45.67 if (_curr_data != *_data_ptr) { 45.68 @@ -662,13 +665,11 @@ 45.69 Handle h_protection_domain, 45.70 unsigned char **data_ptr, 45.71 unsigned char **end_ptr, 45.72 - unsigned char **cached_data_ptr, 45.73 - jint *cached_length_ptr) { 45.74 + JvmtiCachedClassFileData **cache_ptr) { 45.75 JvmtiClassFileLoadHookPoster poster(h_name, class_loader, 45.76 h_protection_domain, 45.77 data_ptr, end_ptr, 45.78 - cached_data_ptr, 45.79 - cached_length_ptr); 45.80 + cache_ptr); 45.81 poster.post(); 45.82 } 45.83
46.1 --- a/src/share/vm/prims/jvmtiExport.hpp Thu Jul 25 17:35:33 2013 +0100 46.2 +++ b/src/share/vm/prims/jvmtiExport.hpp Fri Aug 02 11:10:39 2013 +0100 46.3 @@ -323,8 +323,7 @@ 46.4 static void post_class_file_load_hook(Symbol* h_name, Handle class_loader, 46.5 Handle h_protection_domain, 46.6 unsigned char **data_ptr, unsigned char **end_ptr, 46.7 - unsigned char **cached_data_ptr, 46.8 - jint *cached_length_ptr) NOT_JVMTI_RETURN; 46.9 + JvmtiCachedClassFileData **cache_ptr) NOT_JVMTI_RETURN; 46.10 static void post_native_method_bind(Method* method, address* function_ptr) NOT_JVMTI_RETURN; 46.11 static void post_compiled_method_load(nmethod *nm) NOT_JVMTI_RETURN; 46.12 static void post_dynamic_code_generated(const char *name, const void *code_begin, const void *code_end) NOT_JVMTI_RETURN;
47.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp Thu Jul 25 17:35:33 2013 +0100 47.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp Fri Aug 02 11:10:39 2013 +0100 47.3 @@ -3342,9 +3342,7 @@ 47.4 // should get cleared in the_class too. 47.5 if (the_class->get_cached_class_file_bytes() == 0) { 47.6 // the_class doesn't have a cache yet so copy it 47.7 - the_class->set_cached_class_file( 47.8 - scratch_class->get_cached_class_file_bytes(), 47.9 - scratch_class->get_cached_class_file_len()); 47.10 + the_class->set_cached_class_file(scratch_class->get_cached_class_file()); 47.11 } 47.12 #ifndef PRODUCT 47.13 else { 47.14 @@ -3357,7 +3355,7 @@ 47.15 47.16 // NULL out in scratch class to not delete twice. The class to be redefined 47.17 // always owns these bytes. 47.18 - scratch_class->set_cached_class_file(NULL, 0); 47.19 + scratch_class->set_cached_class_file(NULL); 47.20 47.21 // Replace inner_classes 47.22 Array<u2>* old_inner_classes = the_class->inner_classes();
48.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.hpp Thu Jul 25 17:35:33 2013 +0100 48.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.hpp Fri Aug 02 11:10:39 2013 +0100 48.3 @@ -331,6 +331,11 @@ 48.4 // coordinate a cleanup of these constants with Runtime. 48.5 // 48.6 48.7 +struct JvmtiCachedClassFileData { 48.8 + jint length; 48.9 + unsigned char data[1]; 48.10 +}; 48.11 + 48.12 class VM_RedefineClasses: public VM_Operation { 48.13 private: 48.14 // These static fields are needed by ClassLoaderDataGraph::classes_do() 48.15 @@ -509,5 +514,12 @@ 48.16 // Modifiable test must be shared between IsModifiableClass query 48.17 // and redefine implementation 48.18 static bool is_modifiable_class(oop klass_mirror); 48.19 + 48.20 + static jint get_cached_class_file_len(JvmtiCachedClassFileData *cache) { 48.21 + return cache == NULL ? 0 : cache->length; 48.22 + } 48.23 + static unsigned char * get_cached_class_file_bytes(JvmtiCachedClassFileData *cache) { 48.24 + return cache == NULL ? NULL : cache->data; 48.25 + } 48.26 }; 48.27 #endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSES_HPP
49.1 --- a/src/share/vm/runtime/arguments.cpp Thu Jul 25 17:35:33 2013 +0100 49.2 +++ b/src/share/vm/runtime/arguments.cpp Fri Aug 02 11:10:39 2013 +0100 49.3 @@ -263,6 +263,7 @@ 49.4 { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 49.5 { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 49.6 { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 49.7 + { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 49.8 #ifdef PRODUCT 49.9 { "DesiredMethodLimit", 49.10 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
50.1 --- a/src/share/vm/runtime/frame.cpp Thu Jul 25 17:35:33 2013 +0100 50.2 +++ b/src/share/vm/runtime/frame.cpp Fri Aug 02 11:10:39 2013 +0100 50.3 @@ -221,9 +221,20 @@ 50.4 50.5 50.6 bool frame::entry_frame_is_first() const { 50.7 - return entry_frame_call_wrapper()->anchor()->last_Java_sp() == NULL; 50.8 + return entry_frame_call_wrapper()->is_first_frame(); 50.9 } 50.10 50.11 +JavaCallWrapper* frame::entry_frame_call_wrapper_if_safe(JavaThread* thread) const { 50.12 + JavaCallWrapper** jcw = entry_frame_call_wrapper_addr(); 50.13 + address addr = (address) jcw; 50.14 + 50.15 + // addr must be within the usable part of the stack 50.16 + if (thread->is_in_usable_stack(addr)) { 50.17 + return *jcw; 50.18 + } 50.19 + 50.20 + return NULL; 50.21 +} 50.22 50.23 bool frame::should_be_deoptimized() const { 50.24 if (_deopt_state == is_deoptimized ||
51.1 --- a/src/share/vm/runtime/frame.hpp Thu Jul 25 17:35:33 2013 +0100 51.2 +++ b/src/share/vm/runtime/frame.hpp Fri Aug 02 11:10:39 2013 +0100 51.3 @@ -353,7 +353,9 @@ 51.4 51.5 public: 51.6 // Entry frames 51.7 - JavaCallWrapper* entry_frame_call_wrapper() const; 51.8 + JavaCallWrapper* entry_frame_call_wrapper() const { return *entry_frame_call_wrapper_addr(); } 51.9 + JavaCallWrapper* entry_frame_call_wrapper_if_safe(JavaThread* thread) const; 51.10 + JavaCallWrapper** entry_frame_call_wrapper_addr() const; 51.11 intptr_t* entry_frame_argument_at(int offset) const; 51.12 51.13 // tells whether there is another chunk of Delta stack above
52.1 --- a/src/share/vm/runtime/globals.hpp Thu Jul 25 17:35:33 2013 +0100 52.2 +++ b/src/share/vm/runtime/globals.hpp Fri Aug 02 11:10:39 2013 +0100 52.3 @@ -2589,9 +2589,6 @@ 52.4 product(bool, AggressiveOpts, false, \ 52.5 "Enable aggressive optimizations - see arguments.cpp") \ 52.6 \ 52.7 - product(bool, UseStringCache, false, \ 52.8 - "Enable String cache capabilities on String.java") \ 52.9 - \ 52.10 /* statistics */ \ 52.11 develop(bool, CountCompiledCalls, false, \ 52.12 "counts method invocations") \
53.1 --- a/src/share/vm/runtime/javaCalls.hpp Thu Jul 25 17:35:33 2013 +0100 53.2 +++ b/src/share/vm/runtime/javaCalls.hpp Fri Aug 02 11:10:39 2013 +0100 53.3 @@ -80,6 +80,8 @@ 53.4 oop receiver() { return _receiver; } 53.5 void oops_do(OopClosure* f); 53.6 53.7 + bool is_first_frame() const { return _anchor.last_Java_sp() == NULL; } 53.8 + 53.9 }; 53.10 53.11
54.1 --- a/src/share/vm/runtime/mutex.cpp Thu Jul 25 17:35:33 2013 +0100 54.2 +++ b/src/share/vm/runtime/mutex.cpp Fri Aug 02 11:10:39 2013 +0100 54.3 @@ -1370,6 +1370,10 @@ 54.4 debug_only(if (rank() != Mutex::special) \ 54.5 thread->check_for_valid_safepoint_state(false);) 54.6 } 54.7 + if (thread->is_Watcher_thread()) { 54.8 + assert(!WatcherThread::watcher_thread()->has_crash_protection(), 54.9 + "locking not allowed when crash protection is set"); 54.10 + } 54.11 } 54.12 54.13 void Monitor::check_block_state(Thread *thread) {
55.1 --- a/src/share/vm/runtime/os.cpp Thu Jul 25 17:35:33 2013 +0100 55.2 +++ b/src/share/vm/runtime/os.cpp Fri Aug 02 11:10:39 2013 +0100 55.3 @@ -595,6 +595,22 @@ 55.4 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1)); 55.5 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size)); 55.6 55.7 +#ifdef ASSERT 55.8 + // checking for the WatcherThread and crash_protection first 55.9 + // since os::malloc can be called when the libjvm.{dll,so} is 55.10 + // first loaded and we don't have a thread yet. 55.11 + // try to find the thread after we see that the watcher thread 55.12 + // exists and has crash protection. 55.13 + WatcherThread *wt = WatcherThread::watcher_thread(); 55.14 + if (wt != NULL && wt->has_crash_protection()) { 55.15 + Thread* thread = ThreadLocalStorage::get_thread_slow(); 55.16 + if (thread == wt) { 55.17 + assert(!wt->has_crash_protection(), 55.18 + "Can't malloc with crash protection from WatcherThread"); 55.19 + } 55.20 + } 55.21 +#endif 55.22 + 55.23 if (size == 0) { 55.24 // return a valid pointer if size is zero 55.25 // if NULL is returned the calling functions assume out of memory.
56.1 --- a/src/share/vm/runtime/os.hpp Thu Jul 25 17:35:33 2013 +0100 56.2 +++ b/src/share/vm/runtime/os.hpp Fri Aug 02 11:10:39 2013 +0100 56.3 @@ -32,15 +32,18 @@ 56.4 #include "utilities/top.hpp" 56.5 #ifdef TARGET_OS_FAMILY_linux 56.6 # include "jvm_linux.h" 56.7 +# include <setjmp.h> 56.8 #endif 56.9 #ifdef TARGET_OS_FAMILY_solaris 56.10 # include "jvm_solaris.h" 56.11 +# include <setjmp.h> 56.12 #endif 56.13 #ifdef TARGET_OS_FAMILY_windows 56.14 # include "jvm_windows.h" 56.15 #endif 56.16 #ifdef TARGET_OS_FAMILY_bsd 56.17 # include "jvm_bsd.h" 56.18 +# include <setjmp.h> 56.19 #endif 56.20 56.21 // os defines the interface to operating system; this includes traditional 56.22 @@ -730,6 +733,10 @@ 56.23 #include "runtime/os_ext.hpp" 56.24 56.25 public: 56.26 + class CrashProtectionCallback : public StackObj { 56.27 + public: 56.28 + virtual void call() = 0; 56.29 + }; 56.30 56.31 // Platform dependent stuff 56.32 #ifdef TARGET_OS_FAMILY_linux 56.33 @@ -908,6 +915,7 @@ 56.34 char pathSep); 56.35 static bool set_boot_path(char fileSep, char pathSep); 56.36 static char** split_path(const char* path, int* n); 56.37 + 56.38 }; 56.39 56.40 // Note that "PAUSE" is almost always used with synchronization
57.1 --- a/src/share/vm/runtime/thread.cpp Thu Jul 25 17:35:33 2013 +0100 57.2 +++ b/src/share/vm/runtime/thread.cpp Fri Aug 02 11:10:39 2013 +0100 57.3 @@ -218,6 +218,7 @@ 57.4 // allocated data structures 57.5 set_osthread(NULL); 57.6 set_resource_area(new (mtThread)ResourceArea()); 57.7 + DEBUG_ONLY(_current_resource_mark = NULL;) 57.8 set_handle_area(new (mtThread) HandleArea(NULL)); 57.9 set_metadata_handles(new (ResourceObj::C_HEAP, mtClass) GrowableArray<Metadata*>(30, true)); 57.10 set_active_handles(NULL); 57.11 @@ -953,6 +954,14 @@ 57.12 } 57.13 57.14 57.15 +bool Thread::is_in_usable_stack(address adr) const { 57.16 + size_t stack_guard_size = os::uses_stack_guard_pages() ? (StackYellowPages + StackRedPages) * os::vm_page_size() : 0; 57.17 + size_t usable_stack_size = _stack_size - stack_guard_size; 57.18 + 57.19 + return ((adr < stack_base()) && (adr >= stack_base() - usable_stack_size)); 57.20 +} 57.21 + 57.22 + 57.23 // We had to move these methods here, because vm threads get into ObjectSynchronizer::enter 57.24 // However, there is a note in JavaThread::is_lock_owned() about the VM threads not being 57.25 // used for compilation in the future. If that change is made, the need for these methods 57.26 @@ -1217,7 +1226,7 @@ 57.27 bool WatcherThread::_startable = false; 57.28 volatile bool WatcherThread::_should_terminate = false; 57.29 57.30 -WatcherThread::WatcherThread() : Thread() { 57.31 +WatcherThread::WatcherThread() : Thread(), _crash_protection(NULL) { 57.32 assert(watcher_thread() == NULL, "we can only allocate one WatcherThread"); 57.33 if (os::create_thread(this, os::watcher_thread)) { 57.34 _watcher_thread = this; 57.35 @@ -3481,44 +3490,6 @@ 57.36 57.37 initialize_class(vmSymbols::java_lang_String(), CHECK_0); 57.38 57.39 - if (AggressiveOpts) { 57.40 - { 57.41 - // Forcibly initialize java/util/HashMap and mutate the private 57.42 - // static final "frontCacheEnabled" field before we start creating instances 57.43 -#ifdef ASSERT 57.44 - Klass* tmp_k = SystemDictionary::find(vmSymbols::java_util_HashMap(), Handle(), Handle(), CHECK_0); 57.45 - assert(tmp_k == NULL, "java/util/HashMap should not be loaded yet"); 57.46 -#endif 57.47 - Klass* k_o = SystemDictionary::resolve_or_null(vmSymbols::java_util_HashMap(), Handle(), Handle(), CHECK_0); 57.48 - KlassHandle k = KlassHandle(THREAD, k_o); 57.49 - guarantee(k.not_null(), "Must find java/util/HashMap"); 57.50 - instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); 57.51 - ik->initialize(CHECK_0); 57.52 - fieldDescriptor fd; 57.53 - // Possible we might not find this field; if so, don't break 57.54 - if (ik->find_local_field(vmSymbols::frontCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) { 57.55 - k()->java_mirror()->bool_field_put(fd.offset(), true); 57.56 - } 57.57 - } 57.58 - 57.59 - if (UseStringCache) { 57.60 - // Forcibly initialize java/lang/StringValue and mutate the private 57.61 - // static final "stringCacheEnabled" field before we start creating instances 57.62 - Klass* k_o = SystemDictionary::resolve_or_null(vmSymbols::java_lang_StringValue(), Handle(), Handle(), CHECK_0); 57.63 - // Possible that StringValue isn't present: if so, silently don't break 57.64 - if (k_o != NULL) { 57.65 - KlassHandle k = KlassHandle(THREAD, k_o); 57.66 - instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); 57.67 - ik->initialize(CHECK_0); 57.68 - fieldDescriptor fd; 57.69 - // Possible we might not find this field: if so, silently don't break 57.70 - if (ik->find_local_field(vmSymbols::stringCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) { 57.71 - k()->java_mirror()->bool_field_put(fd.offset(), true); 57.72 - } 57.73 - } 57.74 - } 57.75 - } 57.76 - 57.77 // Initialize java_lang.System (needed before creating the thread) 57.78 initialize_class(vmSymbols::java_lang_System(), CHECK_0); 57.79 initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0); 57.80 @@ -3636,6 +3607,7 @@ 57.81 57.82 // Start Attach Listener if +StartAttachListener or it can't be started lazily 57.83 if (!DisableAttachMechanism) { 57.84 + AttachListener::vm_start(); 57.85 if (StartAttachListener || AttachListener::init_at_startup()) { 57.86 AttachListener::init(); 57.87 }
58.1 --- a/src/share/vm/runtime/thread.hpp Thu Jul 25 17:35:33 2013 +0100 58.2 +++ b/src/share/vm/runtime/thread.hpp Fri Aug 02 11:10:39 2013 +0100 58.3 @@ -86,6 +86,8 @@ 58.4 class ThreadClosure; 58.5 class IdealGraphPrinter; 58.6 58.7 +DEBUG_ONLY(class ResourceMark;) 58.8 + 58.9 class WorkerThread; 58.10 58.11 // Class hierarchy 58.12 @@ -519,6 +521,9 @@ 58.13 // Check if address is in the stack of the thread (not just for locks). 58.14 // Warning: the method can only be used on the running thread 58.15 bool is_in_stack(address adr) const; 58.16 + // Check if address is in the usable part of the stack (excludes protected 58.17 + // guard pages) 58.18 + bool is_in_usable_stack(address adr) const; 58.19 58.20 // Sets this thread as starting thread. Returns failure if thread 58.21 // creation fails due to lack of memory, too many threads etc. 58.22 @@ -531,6 +536,8 @@ 58.23 // Thread local resource area for temporary allocation within the VM 58.24 ResourceArea* _resource_area; 58.25 58.26 + DEBUG_ONLY(ResourceMark* _current_resource_mark;) 58.27 + 58.28 // Thread local handle area for allocation of handles within the VM 58.29 HandleArea* _handle_area; 58.30 GrowableArray<Metadata*>* _metadata_handles; 58.31 @@ -585,6 +592,8 @@ 58.32 58.33 // Deadlock detection 58.34 bool allow_allocation() { return _allow_allocation_count == 0; } 58.35 + ResourceMark* current_resource_mark() { return _current_resource_mark; } 58.36 + void set_current_resource_mark(ResourceMark* rm) { _current_resource_mark = rm; } 58.37 #endif 58.38 58.39 void check_for_valid_safepoint_state(bool potential_vm_operation) PRODUCT_RETURN; 58.40 @@ -724,6 +733,8 @@ 58.41 58.42 static bool _startable; 58.43 volatile static bool _should_terminate; // updated without holding lock 58.44 + 58.45 + os::WatcherThreadCrashProtection* _crash_protection; 58.46 public: 58.47 enum SomeConstants { 58.48 delay_interval = 10 // interrupt delay in milliseconds 58.49 @@ -751,6 +762,14 @@ 58.50 // Otherwise the first task to enroll will trigger the start 58.51 static void make_startable(); 58.52 58.53 + void set_crash_protection(os::WatcherThreadCrashProtection* crash_protection) { 58.54 + assert(Thread::current()->is_Watcher_thread(), "Can only be set by WatcherThread"); 58.55 + _crash_protection = crash_protection; 58.56 + } 58.57 + 58.58 + bool has_crash_protection() const { return _crash_protection != NULL; } 58.59 + os::WatcherThreadCrashProtection* crash_protection() const { return _crash_protection; } 58.60 + 58.61 private: 58.62 int sleep() const; 58.63 };
59.1 --- a/src/share/vm/services/attachListener.hpp Thu Jul 25 17:35:33 2013 +0100 59.2 +++ b/src/share/vm/services/attachListener.hpp Fri Aug 02 11:10:39 2013 +0100 59.3 @@ -50,6 +50,7 @@ 59.4 59.5 class AttachListener: AllStatic { 59.6 public: 59.7 + static void vm_start() NOT_SERVICES_RETURN; 59.8 static void init() NOT_SERVICES_RETURN; 59.9 static void abort() NOT_SERVICES_RETURN; 59.10
60.1 --- a/src/share/vm/services/memTracker.cpp Thu Jul 25 17:35:33 2013 +0100 60.2 +++ b/src/share/vm/services/memTracker.cpp Fri Aug 02 11:10:39 2013 +0100 60.3 @@ -385,6 +385,7 @@ 60.4 #define SAFE_SEQUENCE_THRESHOLD 30 60.5 #define HIGH_GENERATION_THRESHOLD 60 60.6 #define MAX_RECORDER_THREAD_RATIO 30 60.7 +#define MAX_RECORDER_PER_THREAD 100 60.8 60.9 void MemTracker::sync() { 60.10 assert(_tracking_level > NMT_off, "NMT is not enabled"); 60.11 @@ -437,6 +438,11 @@ 60.12 // means that worker thread is lagging behind in processing them. 60.13 if (!AutoShutdownNMT) { 60.14 _slowdown_calling_thread = (MemRecorder::_instance_count > MAX_RECORDER_THREAD_RATIO * _thread_count); 60.15 + } else { 60.16 + // If auto shutdown is on, enforce MAX_RECORDER_PER_THREAD threshold to prevent OOM 60.17 + if (MemRecorder::_instance_count >= _thread_count * MAX_RECORDER_PER_THREAD) { 60.18 + shutdown(NMT_out_of_memory); 60.19 + } 60.20 } 60.21 60.22 // check _worker_thread with lock to avoid racing condition
61.1 --- a/src/share/vm/trace/traceDataTypes.hpp Thu Jul 25 17:35:33 2013 +0100 61.2 +++ b/src/share/vm/trace/traceDataTypes.hpp Fri Aug 02 11:10:39 2013 +0100 61.3 @@ -63,5 +63,7 @@ 61.4 typedef u8 methodid; 61.5 typedef u8 fieldid; 61.6 61.7 +class TraceUnicodeString; 61.8 + 61.9 #endif // SHARE_VM_TRACE_TRACEDATATYPES_HPP 61.10
62.1 --- a/src/share/vm/trace/tracetypes.xml Thu Jul 25 17:35:33 2013 +0100 62.2 +++ b/src/share/vm/trace/tracetypes.xml Fri Aug 02 11:10:39 2013 +0100 62.3 @@ -55,18 +55,6 @@ 62.4 type="u8" sizeop="sizeof(u1)"/> 62.5 62.6 Now we can use the content + data type in declaring event fields. 62.7 -Remember however, that for us to be able to resolve the value later we must also add 62.8 -creating the constant pool data in VM_JFRCheckpoint::write_checkpoint 62.9 - 62.10 - ... 62.11 - //CGMODE 62.12 - w->be_uint(CONTENT_TYPE_GCMODE); 62.13 - w->be_uint(MM_GC_MODE_UNINITIALIZED); 62.14 - for (i = 0; i < MM_GC_MODE_UNINITIALIZED; i++) { 62.15 - w->uchar(i); 62.16 - w->write_utf8(gcModeGetName(i)); 62.17 - } 62.18 - 62.19 --> 62.20 62.21 <types> 62.22 @@ -81,10 +69,6 @@ 62.23 <value type="OSTHREAD" field="thread" label="VM Thread"/> 62.24 </content_type> 62.25 62.26 - <!-- The first argument ("JavaThread") is misleading, it's really a 62.27 - java.lang.Thread id (long), but Mission Control depends on the name 62.28 - being "JavaThread" so it shouldn't be changed. 62.29 - --> 62.30 <content_type id="JavaThread" hr_name="Java thread" 62.31 type="U8" builtin_type="JAVALANGTHREAD"> 62.32 <value type="OSTHREAD" field="thread" label="OS Thread ID"/> 62.33 @@ -285,6 +269,10 @@ 62.34 <primary_type symbol="UTF8" datatype="UTF8" contenttype="NONE" 62.35 type="const char *" sizeop="sizeof_utf(%)"/> 62.36 62.37 + <!-- UTF-16 encoded (Unicode) string, max length maxjuint --> 62.38 + <primary_type symbol="STRING" datatype="STRING" contenttype="NONE" 62.39 + type="TraceUnicodeString*" sizeop="sizeof_unicode(%)"/> 62.40 + 62.41 <!-- Symbol* constant. Note that this may currently ONLY be used by 62.42 classes, methods fields. This restriction might be lifted. --> 62.43 <primary_type symbol="SYMBOL" datatype="U8" contenttype="SYMBOL"
63.1 --- a/src/share/vm/trace/xinclude.mod Thu Jul 25 17:35:33 2013 +0100 63.2 +++ b/src/share/vm/trace/xinclude.mod Fri Aug 02 11:10:39 2013 +0100 63.3 @@ -22,30 +22,6 @@ 63.4 questions. 63.5 63.6 --> 63.7 - 63.8 -<!-- 63.9 - Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 63.10 - DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 63.11 - 63.12 - This code is free software; you can redistribute it and/or modify it 63.13 - under the terms of the GNU General Public License version 2 only, as 63.14 - published by the Free Software Foundation. 63.15 - 63.16 - This code is distributed in the hope that it will be useful, but WITHOUT 63.17 - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 63.18 - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 63.19 - version 2 for more details (a copy is included in the LICENSE file that 63.20 - accompanied this code). 63.21 - 63.22 - You should have received a copy of the GNU General Public License version 63.23 - 2 along with this work; if not, write to the Free Software Foundation, 63.24 - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 63.25 - 63.26 - Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 63.27 - or visit www.oracle.com if you need additional information or have any 63.28 - questions. 63.29 - 63.30 ---> 63.31 <!ELEMENT xi:include (xi:fallback?) > 63.32 <!ATTLIST xi:include 63.33 xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
64.1 --- a/src/share/vm/utilities/ostream.cpp Thu Jul 25 17:35:33 2013 +0100 64.2 +++ b/src/share/vm/utilities/ostream.cpp Fri Aug 02 11:10:39 2013 +0100 64.3 @@ -296,6 +296,7 @@ 64.4 buffer = NEW_RESOURCE_ARRAY(char, buffer_length); 64.5 buffer_pos = 0; 64.6 buffer_fixed = false; 64.7 + DEBUG_ONLY(rm = Thread::current()->current_resource_mark();) 64.8 } 64.9 64.10 // useful for output to fixed chunks of memory, such as performance counters 64.11 @@ -321,6 +322,8 @@ 64.12 end = buffer_length * 2; 64.13 } 64.14 char* oldbuf = buffer; 64.15 + assert(rm == NULL || Thread::current()->current_resource_mark() == rm, 64.16 + "stringStream is re-allocated with a different ResourceMark"); 64.17 buffer = NEW_RESOURCE_ARRAY(char, end); 64.18 strncpy(buffer, oldbuf, buffer_pos); 64.19 buffer_length = end;
65.1 --- a/src/share/vm/utilities/ostream.hpp Thu Jul 25 17:35:33 2013 +0100 65.2 +++ b/src/share/vm/utilities/ostream.hpp Fri Aug 02 11:10:39 2013 +0100 65.3 @@ -28,6 +28,8 @@ 65.4 #include "memory/allocation.hpp" 65.5 #include "runtime/timer.hpp" 65.6 65.7 +DEBUG_ONLY(class ResourceMark;) 65.8 + 65.9 // Output streams for printing 65.10 // 65.11 // Printing guidelines: 65.12 @@ -177,6 +179,7 @@ 65.13 size_t buffer_pos; 65.14 size_t buffer_length; 65.15 bool buffer_fixed; 65.16 + DEBUG_ONLY(ResourceMark* rm;) 65.17 public: 65.18 stringStream(size_t initial_bufsize = 256); 65.19 stringStream(char* fixed_buffer, size_t fixed_buffer_size);
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 66.2 +++ b/test/compiler/EscapeAnalysis/Test8020215.java Fri Aug 02 11:10:39 2013 +0100 66.3 @@ -0,0 +1,82 @@ 66.4 +/* 66.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 66.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 66.7 + * 66.8 + * This code is free software; you can redistribute it and/or modify it 66.9 + * under the terms of the GNU General Public License version 2 only, as 66.10 + * published by the Free Software Foundation. 66.11 + * 66.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 66.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 66.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 66.15 + * version 2 for more details (a copy is included in the LICENSE file that 66.16 + * accompanied this code). 66.17 + * 66.18 + * You should have received a copy of the GNU General Public License version 66.19 + * 2 along with this work; if not, write to the Free Software Foundation, 66.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 66.21 + * 66.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 66.23 + * or visit www.oracle.com if you need additional information or have any 66.24 + * questions. 66.25 + */ 66.26 + 66.27 +/* 66.28 + * @test 66.29 + * @bug 8020215 66.30 + * @summary Different execution plan when using JIT vs interpreter 66.31 + * @run main Test8020215 66.32 + */ 66.33 + 66.34 +import java.util.ArrayList; 66.35 +import java.util.List; 66.36 + 66.37 +public class Test8020215 { 66.38 + public static class NamedObject { 66.39 + public int id; 66.40 + public String name; 66.41 + public NamedObject(int id, String name) { 66.42 + this.id = id; 66.43 + this.name = name; 66.44 + } 66.45 + } 66.46 + 66.47 + public static class NamedObjectList { 66.48 + public List<NamedObject> namedObjectList = new ArrayList<NamedObject>(); 66.49 + 66.50 + public NamedObject getBest(int id) { 66.51 + NamedObject bestObject = null; 66.52 + for (NamedObject o : namedObjectList) { 66.53 + bestObject = id==o.id ? getBetter(bestObject, o) : bestObject; 66.54 + } 66.55 + return (bestObject != null) ? bestObject : null; 66.56 + } 66.57 + 66.58 + private static NamedObject getBetter(NamedObject p1, NamedObject p2) { 66.59 + return (p1 == null) ? p2 : (p2 == null) ? p1 : (p2.name.compareTo(p1.name) >= 0) ? p2 : p1; 66.60 + } 66.61 + } 66.62 + 66.63 + static void test(NamedObjectList b, int i) { 66.64 + NamedObject x = b.getBest(2); 66.65 + // test 66.66 + if (x == null) { 66.67 + throw new RuntimeException("x should never be null here! (i=" + i + ")"); 66.68 + } 66.69 + } 66.70 + 66.71 + public static void main(String[] args) { 66.72 + // setup 66.73 + NamedObjectList b = new NamedObjectList(); 66.74 + for (int i = 0; i < 10000; i++) { 66.75 + b.namedObjectList.add(new NamedObject(1, "2012-12-31")); 66.76 + } 66.77 + b.namedObjectList.add(new NamedObject(2, "2013-12-31")); 66.78 + 66.79 + // execution 66.80 + for (int i = 0; i < 12000; i++) { 66.81 + test(b, i); 66.82 + } 66.83 + System.out.println("PASSED"); 66.84 + } 66.85 +}
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 67.2 +++ b/test/compiler/cpuflags/RestoreMXCSR.java Fri Aug 02 11:10:39 2013 +0100 67.3 @@ -0,0 +1,42 @@ 67.4 +/* 67.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 67.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 67.7 + * 67.8 + * This code is free software; you can redistribute it and/or modify it 67.9 + * under the terms of the GNU General Public License version 2 only, as 67.10 + * published by the Free Software Foundation. 67.11 + * 67.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 67.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 67.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 67.15 + * version 2 for more details (a copy is included in the LICENSE file that 67.16 + * accompanied this code). 67.17 + * 67.18 + * You should have received a copy of the GNU General Public License version 67.19 + * 2 along with this work; if not, write to the Free Software Foundation, 67.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 67.21 + * 67.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 67.23 + * or visit www.oracle.com if you need additional information or have any 67.24 + * questions. 67.25 + */ 67.26 + 67.27 +/* 67.28 + * @test 67.29 + * @bug 8020433 67.30 + * @summary Crash when using -XX:+RestoreMXCSROnJNICalls 67.31 + * @library /testlibrary 67.32 + * 67.33 + */ 67.34 +import com.oracle.java.testlibrary.*; 67.35 + 67.36 +public class RestoreMXCSR { 67.37 + public static void main(String[] args) throws Exception { 67.38 + ProcessBuilder pb; 67.39 + OutputAnalyzer out; 67.40 + 67.41 + pb = ProcessTools.createJavaProcessBuilder("-XX:+RestoreMXCSROnJNICalls", "-version"); 67.42 + out = new OutputAnalyzer(pb.start()); 67.43 + out.shouldHaveExitValue(0); 67.44 + } 67.45 +}
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 68.2 +++ b/test/compiler/membars/DekkerTest.java Fri Aug 02 11:10:39 2013 +0100 68.3 @@ -0,0 +1,163 @@ 68.4 +/* 68.5 + * Copyright 2013 SAP AG. All Rights Reserved. 68.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 68.7 + * 68.8 + * This code is free software; you can redistribute it and/or modify it 68.9 + * under the terms of the GNU General Public License version 2 only, as 68.10 + * published by the Free Software Foundation. 68.11 + * 68.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 68.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 68.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 68.15 + * version 2 for more details (a copy is included in the LICENSE file that 68.16 + * accompanied this code). 68.17 + * 68.18 + * You should have received a copy of the GNU General Public License version 68.19 + * 2 along with this work; if not, write to the Free Software Foundation, 68.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 68.21 + * 68.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 68.23 + * or visit www.oracle.com if you need additional information or have any 68.24 + * questions. 68.25 + */ 68.26 + 68.27 +/** 68.28 + * @test 68.29 + * @bug 8007898 68.30 + * @summary Incorrect optimization of Memory Barriers in Matcher::post_store_load_barrier(). 68.31 + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest 68.32 + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest 68.33 + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest 68.34 + * @author Martin Doerr martin DOT doerr AT sap DOT com 68.35 + * 68.36 + * Run 3 times since the failure is intermittent. 68.37 + */ 68.38 + 68.39 +public class DekkerTest { 68.40 + 68.41 + /* 68.42 + Read After Write Test (basically a simple Dekker test with volatile variables) 68.43 + Derived from the original jcstress test, available at: 68.44 + http://hg.openjdk.java.net/code-tools/jcstress/file/6c339a5aa00d/ 68.45 + tests-custom/src/main/java/org/openjdk/jcstress/tests/volatiles/DekkerTest.java 68.46 + */ 68.47 + 68.48 + static final int ITERATIONS = 1000000; 68.49 + 68.50 + static class TestData { 68.51 + public volatile int a; 68.52 + public volatile int b; 68.53 + } 68.54 + 68.55 + static class ResultData { 68.56 + public int a; 68.57 + public int b; 68.58 + } 68.59 + 68.60 + TestData[] testDataArray; 68.61 + ResultData[] results; 68.62 + 68.63 + volatile boolean start; 68.64 + 68.65 + public DekkerTest() { 68.66 + testDataArray = new TestData[ITERATIONS]; 68.67 + results = new ResultData[ITERATIONS]; 68.68 + for (int i = 0; i < ITERATIONS; ++i) { 68.69 + testDataArray[i] = new TestData(); 68.70 + results[i] = new ResultData(); 68.71 + } 68.72 + start = false; 68.73 + } 68.74 + 68.75 + public void reset() { 68.76 + for (int i = 0; i < ITERATIONS; ++i) { 68.77 + testDataArray[i].a = 0; 68.78 + testDataArray[i].b = 0; 68.79 + results[i].a = 0; 68.80 + results[i].b = 0; 68.81 + } 68.82 + start = false; 68.83 + } 68.84 + 68.85 + int actor1(TestData t) { 68.86 + t.a = 1; 68.87 + return t.b; 68.88 + } 68.89 + 68.90 + int actor2(TestData t) { 68.91 + t.b = 1; 68.92 + return t.a; 68.93 + } 68.94 + 68.95 + class Runner1 extends Thread { 68.96 + public void run() { 68.97 + do {} while (!start); 68.98 + for (int i = 0; i < ITERATIONS; ++i) { 68.99 + results[i].a = actor1(testDataArray[i]); 68.100 + } 68.101 + } 68.102 + } 68.103 + 68.104 + class Runner2 extends Thread { 68.105 + public void run() { 68.106 + do {} while (!start); 68.107 + for (int i = 0; i < ITERATIONS; ++i) { 68.108 + results[i].b = actor2(testDataArray[i]); 68.109 + } 68.110 + } 68.111 + } 68.112 + 68.113 + void testRunner() { 68.114 + Thread thread1 = new Runner1(); 68.115 + Thread thread2 = new Runner2(); 68.116 + thread1.start(); 68.117 + thread2.start(); 68.118 + do {} while (!thread1.isAlive()); 68.119 + do {} while (!thread2.isAlive()); 68.120 + start = true; 68.121 + Thread.yield(); 68.122 + try { 68.123 + thread1.join(); 68.124 + thread2.join(); 68.125 + } catch (InterruptedException e) { 68.126 + System.out.println("interrupted!"); 68.127 + System.exit(1); 68.128 + } 68.129 + } 68.130 + 68.131 + boolean printResult() { 68.132 + int[] count = new int[4]; 68.133 + for (int i = 0; i < ITERATIONS; ++i) { 68.134 + int event_kind = (results[i].a << 1) + results[i].b; 68.135 + ++count[event_kind]; 68.136 + } 68.137 + if (count[0] == 0 && count[3] == 0) { 68.138 + System.out.println("[not interesting]"); 68.139 + return false; // not interesting 68.140 + } 68.141 + String error = (count[0] == 0) ? " ok" : " disallowed!"; 68.142 + System.out.println("[0,0] " + count[0] + error); 68.143 + System.out.println("[0,1] " + count[1]); 68.144 + System.out.println("[1,0] " + count[2]); 68.145 + System.out.println("[1,1] " + count[3]); 68.146 + return (count[0] != 0); 68.147 + } 68.148 + 68.149 + public static void main(String args[]) { 68.150 + DekkerTest test = new DekkerTest(); 68.151 + final int runs = 30; 68.152 + int failed = 0; 68.153 + for (int c = 0; c < runs; ++c) { 68.154 + test.testRunner(); 68.155 + if (test.printResult()) { 68.156 + failed++; 68.157 + } 68.158 + test.reset(); 68.159 + } 68.160 + if (failed > 0) { 68.161 + throw new InternalError("FAILED. Got " + failed + " failed ITERATIONS"); 68.162 + } 68.163 + System.out.println("PASSED."); 68.164 + } 68.165 + 68.166 +}
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 69.2 +++ b/test/runtime/jsig/Test8017498.sh Fri Aug 02 11:10:39 2013 +0100 69.3 @@ -0,0 +1,92 @@ 69.4 +#!/bin/sh 69.5 + 69.6 +# 69.7 +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 69.8 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 69.9 +# 69.10 +# This code is free software; you can redistribute it and/or modify it 69.11 +# under the terms of the GNU General Public License version 2 only, as 69.12 +# published by the Free Software Foundation. 69.13 +# 69.14 +# This code is distributed in the hope that it will be useful, but WITHOUT 69.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 69.16 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 69.17 +# version 2 for more details (a copy is included in the LICENSE file that 69.18 +# accompanied this code). 69.19 +# 69.20 +# You should have received a copy of the GNU General Public License version 69.21 +# 2 along with this work; if not, write to the Free Software Foundation, 69.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 69.23 +# 69.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 69.25 +# or visit www.oracle.com if you need additional information or have any 69.26 +# questions. 69.27 +# 69.28 + 69.29 +## 69.30 +## @test Test8017498.sh 69.31 +## @bug 8017498 69.32 +## @bug 8020791 69.33 +## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX 69.34 +## @run shell/timeout=30 Test8017498.sh 69.35 +## 69.36 + 69.37 +if [ "${TESTSRC}" = "" ] 69.38 +then 69.39 + TESTSRC=${PWD} 69.40 + echo "TESTSRC not set. Using "${TESTSRC}" as default" 69.41 +fi 69.42 +echo "TESTSRC=${TESTSRC}" 69.43 +## Adding common setup Variables for running shell tests. 69.44 +. ${TESTSRC}/../../test_env.sh 69.45 + 69.46 +# set platform-dependent variables 69.47 +OS=`uname -s` 69.48 +case "$OS" in 69.49 + Linux) 69.50 + echo "Testing on Linux" 69.51 + if [ "$VM_BITS" = "64" ] 69.52 + then 69.53 + MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so 69.54 + else 69.55 + MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}i386${FS}libjsig.so 69.56 + fi 69.57 + echo MY_LD_PRELOAD = ${MY_LD_PRELOAD} 69.58 + ;; 69.59 + *) 69.60 + echo "Test passed; only valid for Linux" 69.61 + exit 0; 69.62 + ;; 69.63 +esac 69.64 + 69.65 +THIS_DIR=. 69.66 + 69.67 +cp ${TESTSRC}${FS}*.java ${THIS_DIR} 69.68 +${TESTJAVA}${FS}bin${FS}javac *.java 69.69 + 69.70 +gcc -DLINUX -fPIC -shared \ 69.71 + -o ${TESTSRC}${FS}libTestJNI.so \ 69.72 + -I${TESTJAVA}${FS}include \ 69.73 + -I${TESTJAVA}${FS}include${FS}linux \ 69.74 + ${TESTSRC}${FS}TestJNI.c 69.75 +if [ $? != 0 ] 69.76 +then 69.77 + echo "WARNING: the gcc command failed." 2>&1 69.78 +fi 69.79 + 69.80 +# run the java test in the background 69.81 +cmd="LD_PRELOAD=$MY_LD_PRELOAD \ 69.82 + ${TESTJAVA}${FS}bin${FS}java \ 69.83 + -Djava.library.path=${TESTSRC}${FS} -server TestJNI 100" 69.84 +echo "$cmd > test.out 2>&1" 69.85 +eval $cmd > test.out 2>&1 69.86 + 69.87 +grep "old handler" test.out > ${NULL} 69.88 +if [ $? = 0 ] 69.89 +then 69.90 + echo "Test Passed" 69.91 + exit 0 69.92 +fi 69.93 + 69.94 +echo "Test Failed" 69.95 +exit 1
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 70.2 +++ b/test/runtime/jsig/TestJNI.c Fri Aug 02 11:10:39 2013 +0100 70.3 @@ -0,0 +1,59 @@ 70.4 +/* 70.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 70.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 70.7 + * 70.8 + * This code is free software; you can redistribute it and/or modify it 70.9 + * under the terms of the GNU General Public License version 2 only, as 70.10 + * published by the Free Software Foundation. 70.11 + * 70.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 70.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 70.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 70.15 + * version 2 for more details (a copy is included in the LICENSE file that 70.16 + * accompanied this code). 70.17 + * 70.18 + * You should have received a copy of the GNU General Public License version 70.19 + * 2 along with this work; if not, write to the Free Software Foundation, 70.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 70.21 + * 70.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 70.23 + * or visit www.oracle.com if you need additional information or have any 70.24 + * questions. 70.25 + */ 70.26 + 70.27 +#define _GNU_SOURCE // for the definition of REG_RIP in ucontext.h 70.28 +#include <stdio.h> 70.29 +#include <jni.h> 70.30 +#include <signal.h> 70.31 +#include <sys/ucontext.h> 70.32 + 70.33 +#ifdef __cplusplus 70.34 +extern "C" { 70.35 +#endif 70.36 + 70.37 +void sig_handler(int sig, siginfo_t *info, ucontext_t *context) { 70.38 + int thrNum; 70.39 + 70.40 + printf( " HANDLER (1) " ); 70.41 + // Move forward RIP to skip failing instruction 70.42 + context->uc_mcontext.gregs[REG_RIP] += 6; 70.43 +} 70.44 + 70.45 +JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) { 70.46 + struct sigaction act; 70.47 + struct sigaction oact; 70.48 + 70.49 + act.sa_flags = SA_ONSTACK|SA_RESTART|SA_SIGINFO; 70.50 + sigfillset(&act.sa_mask); 70.51 + act.sa_handler = SIG_DFL; 70.52 + act.sa_sigaction = (void (*)())sig_handler; 70.53 + sigaction(0x20+val, &act, &oact); 70.54 + 70.55 + printf( " doSomething(%d) " , val); 70.56 + printf( " old handler = %p " , oact.sa_handler); 70.57 +} 70.58 + 70.59 +#ifdef __cplusplus 70.60 +} 70.61 +#endif 70.62 +
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 71.2 +++ b/test/runtime/jsig/TestJNI.java Fri Aug 02 11:10:39 2013 +0100 71.3 @@ -0,0 +1,42 @@ 71.4 +/* 71.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 71.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 71.7 + * 71.8 + * This code is free software; you can redistribute it and/or modify it 71.9 + * under the terms of the GNU General Public License version 2 only, as 71.10 + * published by the Free Software Foundation. 71.11 + * 71.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 71.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 71.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 71.15 + * version 2 for more details (a copy is included in the LICENSE file that 71.16 + * accompanied this code). 71.17 + * 71.18 + * You should have received a copy of the GNU General Public License version 71.19 + * 2 along with this work; if not, write to the Free Software Foundation, 71.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 71.21 + * 71.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 71.23 + * or visit www.oracle.com if you need additional information or have any 71.24 + * questions. 71.25 + */ 71.26 + 71.27 +public class TestJNI { 71.28 + static { 71.29 + System.loadLibrary("TestJNI"); 71.30 + } 71.31 + public static native void doSomething(int val); 71.32 + public static void main(String[] args) { 71.33 + int intArg = 43; 71.34 + if (args.length > 0) { 71.35 + try { 71.36 + intArg = Integer.parseInt(args[0]); 71.37 + } catch (NumberFormatException e) { 71.38 + System.err.println("arg " + args[0] + " must be an integer"); 71.39 + System.exit(1); 71.40 + } 71.41 + } 71.42 + TestJNI.doSomething(intArg); 71.43 + } 71.44 +} 71.45 +
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 72.2 +++ b/test/serviceability/attach/AttachWithStalePidFile.java Fri Aug 02 11:10:39 2013 +0100 72.3 @@ -0,0 +1,139 @@ 72.4 +/* 72.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 72.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 72.7 + * 72.8 + * This code is free software; you can redistribute it and/or modify it 72.9 + * under the terms of the GNU General Public License version 2 only, as 72.10 + * published by the Free Software Foundation. 72.11 + * 72.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 72.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 72.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 72.15 + * version 2 for more details (a copy is included in the LICENSE file that 72.16 + * accompanied this code). 72.17 + * 72.18 + * You should have received a copy of the GNU General Public License version 72.19 + * 2 along with this work; if not, write to the Free Software Foundation, 72.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 72.21 + * 72.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 72.23 + * or visit www.oracle.com if you need additional information or have any 72.24 + * questions. 72.25 + */ 72.26 + 72.27 +/* 72.28 + * @test 72.29 + * @bug 7162400 72.30 + * @key regression 72.31 + * @summary Regression test for attach issue where stale pid files in /tmp lead to connection issues 72.32 + * @library /testlibrary 72.33 + * @compile AttachWithStalePidFileTarget.java 72.34 + * @run main AttachWithStalePidFile 72.35 + */ 72.36 + 72.37 +import com.oracle.java.testlibrary.*; 72.38 +import com.sun.tools.attach.VirtualMachine; 72.39 +import sun.tools.attach.HotSpotVirtualMachine; 72.40 +import java.lang.reflect.Field; 72.41 +import java.nio.file.*; 72.42 +import java.nio.file.attribute.*; 72.43 +import java.io.*; 72.44 + 72.45 +public class AttachWithStalePidFile { 72.46 + public static void main(String... args) throws Exception { 72.47 + 72.48 + // this test is only valid on non-Windows platforms 72.49 + if(Platform.isWindows()) { 72.50 + System.out.println("This test is only valid on non-Windows platforms."); 72.51 + return; 72.52 + } 72.53 + 72.54 + // Since there might be stale pid-files owned by different 72.55 + // users on the system we may need to retry the test in case we 72.56 + // are unable to remove the existing file. 72.57 + int retries = 5; 72.58 + while(!runTest() && --retries > 0); 72.59 + 72.60 + if(retries == 0) { 72.61 + throw new RuntimeException("Test failed after 5 retries. " + 72.62 + "Remove any /tmp/.java_pid* files and retry."); 72.63 + } 72.64 + } 72.65 + 72.66 + public static boolean runTest() throws Exception { 72.67 + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( 72.68 + "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); 72.69 + Process target = pb.start(); 72.70 + Path pidFile = null; 72.71 + 72.72 + try { 72.73 + int pid = getUnixProcessId(target); 72.74 + 72.75 + // create the stale .java_pid file. use hard-coded /tmp path as in th VM 72.76 + pidFile = createJavaPidFile(pid); 72.77 + if(pidFile == null) { 72.78 + return false; 72.79 + } 72.80 + 72.81 + // wait for vm.paused file to be created and delete it once we find it. 72.82 + waitForAndResumeVM(pid); 72.83 + 72.84 + // unfortunately there's no reliable way to know the VM is ready to receive the 72.85 + // attach request so we have to do an arbitrary sleep. 72.86 + Thread.sleep(5000); 72.87 + 72.88 + HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString()); 72.89 + BufferedReader remoteDataReader = new BufferedReader(new InputStreamReader(vm.remoteDataDump())); 72.90 + String line = null; 72.91 + while((line = remoteDataReader.readLine()) != null); 72.92 + 72.93 + vm.detach(); 72.94 + return true; 72.95 + } 72.96 + finally { 72.97 + target.destroy(); 72.98 + target.waitFor(); 72.99 + 72.100 + if(pidFile != null && Files.exists(pidFile)) { 72.101 + Files.delete(pidFile); 72.102 + } 72.103 + } 72.104 + } 72.105 + 72.106 + private static Path createJavaPidFile(int pid) throws Exception { 72.107 + Path pidFile = Paths.get("/tmp/.java_pid" + pid); 72.108 + if(Files.exists(pidFile)) { 72.109 + try { 72.110 + Files.delete(pidFile); 72.111 + } 72.112 + catch(FileSystemException e) { 72.113 + if(e.getReason().equals("Operation not permitted")) { 72.114 + System.out.println("Unable to remove exisiting stale PID file" + pidFile); 72.115 + return null; 72.116 + } 72.117 + throw e; 72.118 + } 72.119 + } 72.120 + return Files.createFile(pidFile, 72.121 + PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-------"))); 72.122 + } 72.123 + 72.124 + private static void waitForAndResumeVM(int pid) throws Exception { 72.125 + Path pauseFile = Paths.get("vm.paused." + pid); 72.126 + int retries = 60; 72.127 + while(!Files.exists(pauseFile) && --retries > 0) { 72.128 + Thread.sleep(1000); 72.129 + } 72.130 + if(retries == 0) { 72.131 + throw new RuntimeException("Timeout waiting for VM to start. " + 72.132 + "vm.paused file not created within 60 seconds."); 72.133 + } 72.134 + Files.delete(pauseFile); 72.135 + } 72.136 + 72.137 + private static int getUnixProcessId(Process unixProcess) throws Exception { 72.138 + Field pidField = unixProcess.getClass().getDeclaredField("pid"); 72.139 + pidField.setAccessible(true); 72.140 + return (Integer)pidField.get(unixProcess); 72.141 + } 72.142 +}
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 73.2 +++ b/test/serviceability/attach/AttachWithStalePidFileTarget.java Fri Aug 02 11:10:39 2013 +0100 73.3 @@ -0,0 +1,27 @@ 73.4 +/* 73.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 73.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 73.7 + * 73.8 + * This code is free software; you can redistribute it and/or modify it 73.9 + * under the terms of the GNU General Public License version 2 only, as 73.10 + * published by the Free Software Foundation. 73.11 + * 73.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 73.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 73.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 73.15 + * version 2 for more details (a copy is included in the LICENSE file that 73.16 + * accompanied this code). 73.17 + * 73.18 + * You should have received a copy of the GNU General Public License version 73.19 + * 2 along with this work; if not, write to the Free Software Foundation, 73.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 73.21 + * 73.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 73.23 + * or visit www.oracle.com if you need additional information or have any 73.24 + * questions. 73.25 + */ 73.26 +public class AttachWithStalePidFileTarget { 73.27 + public static void main(String... args) throws Exception { 73.28 + Thread.sleep(2*60*1000); 73.29 + } 73.30 +}