Wed, 05 Nov 2014 15:35:11 -0800
Merge
1.1 --- a/.hgtags Fri Oct 31 15:22:44 2014 -0700 1.2 +++ b/.hgtags Wed Nov 05 15:35:11 2014 -0800 1.3 @@ -557,3 +557,7 @@ 1.4 1b3abbeee961dee49780c0e4af5337feb918c555 jdk8u40-b10 1.5 f10fe402dfb1543723b4b117a7cba3ea3d4159f1 hs25.40-b15 1.6 99372b2fee0eb8b3452f47230e84aa6e97003184 jdk8u40-b11 1.7 +8b9ec2da541a74ac698560b6a2bc45fccb789919 hs25.40-b16 1.8 +6b93bf9ea3ea57ed0fe53cfedb2f9ab912c324e5 jdk8u40-b12 1.9 +521e269ae1daa9df1cb0835b97aa76bdf340fcb2 hs25.40-b17 1.10 +86307d47790785398d0695acc361bccaefe25f94 jdk8u40-b13
2.1 --- a/make/excludeSrc.make Fri Oct 31 15:22:44 2014 -0700 2.2 +++ b/make/excludeSrc.make Wed Nov 05 15:35:11 2014 -0800 2.3 @@ -97,6 +97,7 @@ 2.4 ageTable.cpp \ 2.5 collectorCounters.cpp \ 2.6 cSpaceCounters.cpp \ 2.7 + gcId.cpp \ 2.8 gcPolicyCounters.cpp \ 2.9 gcStats.cpp \ 2.10 gcTimer.cpp \
3.1 --- a/make/hotspot_version Fri Oct 31 15:22:44 2014 -0700 3.2 +++ b/make/hotspot_version Wed Nov 05 15:35:11 2014 -0800 3.3 @@ -35,7 +35,7 @@ 3.4 3.5 HS_MAJOR_VER=25 3.6 HS_MINOR_VER=40 3.7 -HS_BUILD_NUMBER=15 3.8 +HS_BUILD_NUMBER=17 3.9 3.10 JDK_MAJOR_VER=1 3.11 JDK_MINOR_VER=8
4.1 --- a/make/jprt.properties Fri Oct 31 15:22:44 2014 -0700 4.2 +++ b/make/jprt.properties Wed Nov 05 15:35:11 2014 -0800 4.3 @@ -374,21 +374,25 @@ 4.4 ${jprt.my.windows.i586}-fastdebug-c2-internalvmtests, \ 4.5 ${jprt.my.windows.x64}-fastdebug-c2-internalvmtests 4.6 4.7 -jprt.make.rule.test.targets.standard.wbapi = \ 4.8 - ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-wbapitest, \ 4.9 - ${jprt.my.solaris.x64}-{product|fastdebug}-c2-wbapitest, \ 4.10 - ${jprt.my.linux.i586}-{product|fastdebug}-c2-wbapitest, \ 4.11 - ${jprt.my.linux.x64}-{product|fastdebug}-c2-wbapitest, \ 4.12 - ${jprt.my.windows.i586}-{product|fastdebug}-c2-wbapitest, \ 4.13 - ${jprt.my.windows.x64}-{product|fastdebug}-c2-wbapitest, \ 4.14 - ${jprt.my.linux.i586}-{product|fastdebug}-c1-wbapitest, \ 4.15 - ${jprt.my.windows.i586}-{product|fastdebug}-c1-wbapitest 4.16 +jprt.make.rule.test.targets.standard.reg.group = \ 4.17 + ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GROUP, \ 4.18 + ${jprt.my.solaris.x64}-{product|fastdebug}-c2-GROUP, \ 4.19 + ${jprt.my.linux.i586}-{product|fastdebug}-c2-GROUP, \ 4.20 + ${jprt.my.linux.x64}-{product|fastdebug}-c2-GROUP, \ 4.21 + ${jprt.my.windows.i586}-{product|fastdebug}-c2-GROUP, \ 4.22 + ${jprt.my.windows.x64}-{product|fastdebug}-c2-GROUP, \ 4.23 + ${jprt.my.linux.i586}-{product|fastdebug}-c1-GROUP, \ 4.24 + ${jprt.my.windows.i586}-{product|fastdebug}-c1-GROUP 4.25 4.26 jprt.make.rule.test.targets.standard = \ 4.27 ${jprt.make.rule.test.targets.standard.client}, \ 4.28 ${jprt.make.rule.test.targets.standard.server}, \ 4.29 ${jprt.make.rule.test.targets.standard.internalvmtests}, \ 4.30 - ${jprt.make.rule.test.targets.standard.wbapi} 4.31 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_wbapitest}, \ 4.32 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_compiler}, \ 4.33 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_gc}, \ 4.34 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_runtime}, \ 4.35 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_serviceability} 4.36 4.37 jprt.make.rule.test.targets.embedded = \ 4.38 ${jprt.make.rule.test.targets.standard.client}
5.1 --- a/make/solaris/makefiles/vm.make Fri Oct 31 15:22:44 2014 -0700 5.2 +++ b/make/solaris/makefiles/vm.make Wed Nov 05 15:35:11 2014 -0800 5.3 @@ -141,7 +141,7 @@ 5.4 LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc -ldemangle 5.5 endif # sparcWorks 5.6 5.7 -LIBS += -lkstat -lpicl 5.8 +LIBS += -lkstat 5.9 5.10 # By default, link the *.o into the library, not the executable. 5.11 LINK_INTO$(LINK_INTO) = LIBJVM
6.1 --- a/src/cpu/x86/vm/vm_version_x86.cpp Fri Oct 31 15:22:44 2014 -0700 6.2 +++ b/src/cpu/x86/vm/vm_version_x86.cpp Wed Nov 05 15:35:11 2014 -0800 6.3 @@ -873,14 +873,19 @@ 6.4 if (supports_bmi1()) { 6.5 // tzcnt does not require VEX prefix 6.6 if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction)) { 6.7 - UseCountTrailingZerosInstruction = true; 6.8 + if (!UseBMI1Instructions && !FLAG_IS_DEFAULT(UseBMI1Instructions)) { 6.9 + // Don't use tzcnt if BMI1 is switched off on command line. 6.10 + UseCountTrailingZerosInstruction = false; 6.11 + } else { 6.12 + UseCountTrailingZerosInstruction = true; 6.13 + } 6.14 } 6.15 } else if (UseCountTrailingZerosInstruction) { 6.16 warning("tzcnt instruction is not available on this CPU"); 6.17 FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, false); 6.18 } 6.19 6.20 - // BMI instructions use an encoding with VEX prefix. 6.21 + // BMI instructions (except tzcnt) use an encoding with VEX prefix. 6.22 // VEX prefix is generated only when AVX > 0. 6.23 if (supports_bmi1() && supports_avx()) { 6.24 if (FLAG_IS_DEFAULT(UseBMI1Instructions)) {
7.1 --- a/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp Fri Oct 31 15:22:44 2014 -0700 7.2 +++ b/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp Wed Nov 05 15:35:11 2014 -0800 7.3 @@ -31,18 +31,51 @@ 7.4 #include <sys/systeminfo.h> 7.5 #include <kstat.h> 7.6 #include <picl.h> 7.7 +#include <dlfcn.h> 7.8 +#include <link.h> 7.9 7.10 extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result); 7.11 extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result); 7.12 7.13 +// Functions from the library we need (signatures should match those in picl.h) 7.14 +extern "C" { 7.15 + typedef int (*picl_initialize_func_t)(void); 7.16 + typedef int (*picl_shutdown_func_t)(void); 7.17 + typedef int (*picl_get_root_func_t)(picl_nodehdl_t *nodehandle); 7.18 + typedef int (*picl_walk_tree_by_class_func_t)(picl_nodehdl_t rooth, 7.19 + const char *classname, void *c_args, 7.20 + int (*callback_fn)(picl_nodehdl_t hdl, void *args)); 7.21 + typedef int (*picl_get_prop_by_name_func_t)(picl_nodehdl_t nodeh, const char *nm, 7.22 + picl_prophdl_t *ph); 7.23 + typedef int (*picl_get_propval_func_t)(picl_prophdl_t proph, void *valbuf, size_t sz); 7.24 + typedef int (*picl_get_propinfo_func_t)(picl_prophdl_t proph, picl_propinfo_t *pi); 7.25 +} 7.26 + 7.27 class PICL { 7.28 + // Pointers to functions in the library 7.29 + picl_initialize_func_t _picl_initialize; 7.30 + picl_shutdown_func_t _picl_shutdown; 7.31 + picl_get_root_func_t _picl_get_root; 7.32 + picl_walk_tree_by_class_func_t _picl_walk_tree_by_class; 7.33 + picl_get_prop_by_name_func_t _picl_get_prop_by_name; 7.34 + picl_get_propval_func_t _picl_get_propval; 7.35 + picl_get_propinfo_func_t _picl_get_propinfo; 7.36 + // Handle to the library that is returned by dlopen 7.37 + void *_dl_handle; 7.38 + 7.39 + bool open_library(); 7.40 + void close_library(); 7.41 + 7.42 + template<typename FuncType> bool bind(FuncType& func, const char* name); 7.43 + bool bind_library_functions(); 7.44 + 7.45 // Get a value of the integer property. The value in the tree can be either 32 or 64 bit 7.46 // depending on the platform. The result is converted to int. 7.47 - static int get_int_property(picl_nodehdl_t nodeh, const char* name, int* result) { 7.48 + int get_int_property(picl_nodehdl_t nodeh, const char* name, int* result) { 7.49 picl_propinfo_t pinfo; 7.50 picl_prophdl_t proph; 7.51 - if (picl_get_prop_by_name(nodeh, name, &proph) != PICL_SUCCESS || 7.52 - picl_get_propinfo(proph, &pinfo) != PICL_SUCCESS) { 7.53 + if (_picl_get_prop_by_name(nodeh, name, &proph) != PICL_SUCCESS || 7.54 + _picl_get_propinfo(proph, &pinfo) != PICL_SUCCESS) { 7.55 return PICL_FAILURE; 7.56 } 7.57 7.58 @@ -52,13 +85,13 @@ 7.59 } 7.60 if (pinfo.size == sizeof(int64_t)) { 7.61 int64_t val; 7.62 - if (picl_get_propval(proph, &val, sizeof(int64_t)) != PICL_SUCCESS) { 7.63 + if (_picl_get_propval(proph, &val, sizeof(int64_t)) != PICL_SUCCESS) { 7.64 return PICL_FAILURE; 7.65 } 7.66 *result = static_cast<int>(val); 7.67 } else if (pinfo.size == sizeof(int32_t)) { 7.68 int32_t val; 7.69 - if (picl_get_propval(proph, &val, sizeof(int32_t)) != PICL_SUCCESS) { 7.70 + if (_picl_get_propval(proph, &val, sizeof(int32_t)) != PICL_SUCCESS) { 7.71 return PICL_FAILURE; 7.72 } 7.73 *result = static_cast<int>(val); 7.74 @@ -72,6 +105,7 @@ 7.75 // Visitor and a state machine that visits integer properties and verifies that the 7.76 // values are the same. Stores the unique value observed. 7.77 class UniqueValueVisitor { 7.78 + PICL *_picl; 7.79 enum { 7.80 INITIAL, // Start state, no assignments happened 7.81 ASSIGNED, // Assigned a value 7.82 @@ -79,7 +113,7 @@ 7.83 } _state; 7.84 int _value; 7.85 public: 7.86 - UniqueValueVisitor() : _state(INITIAL) { } 7.87 + UniqueValueVisitor(PICL* picl) : _picl(picl), _state(INITIAL) { } 7.88 int value() { 7.89 assert(_state == ASSIGNED, "Precondition"); 7.90 return _value; 7.91 @@ -96,9 +130,10 @@ 7.92 7.93 static int visit(picl_nodehdl_t nodeh, const char* name, void *arg) { 7.94 UniqueValueVisitor *state = static_cast<UniqueValueVisitor*>(arg); 7.95 + PICL* picl = state->_picl; 7.96 assert(!state->is_inconsistent(), "Precondition"); 7.97 int curr; 7.98 - if (PICL::get_int_property(nodeh, name, &curr) == PICL_SUCCESS) { 7.99 + if (picl->get_int_property(nodeh, name, &curr) == PICL_SUCCESS) { 7.100 if (!state->is_assigned()) { // first iteration 7.101 state->set_value(curr); 7.102 } else if (curr != state->value()) { // following iterations 7.103 @@ -122,32 +157,36 @@ 7.104 return UniqueValueVisitor::visit(nodeh, "l2-cache-line-size", state); 7.105 } 7.106 7.107 - PICL() : _L1_data_cache_line_size(0), _L2_cache_line_size(0) { 7.108 - if (picl_initialize() == PICL_SUCCESS) { 7.109 + PICL() : _L1_data_cache_line_size(0), _L2_cache_line_size(0), _dl_handle(NULL) { 7.110 + if (!open_library()) { 7.111 + return; 7.112 + } 7.113 + if (_picl_initialize() == PICL_SUCCESS) { 7.114 picl_nodehdl_t rooth; 7.115 - if (picl_get_root(&rooth) == PICL_SUCCESS) { 7.116 - UniqueValueVisitor L1_state; 7.117 + if (_picl_get_root(&rooth) == PICL_SUCCESS) { 7.118 + UniqueValueVisitor L1_state(this); 7.119 // Visit all "cpu" class instances 7.120 - picl_walk_tree_by_class(rooth, "cpu", &L1_state, PICL_get_l1_data_cache_line_size_helper); 7.121 + _picl_walk_tree_by_class(rooth, "cpu", &L1_state, PICL_get_l1_data_cache_line_size_helper); 7.122 if (L1_state.is_initial()) { // Still initial, iteration found no values 7.123 // Try walk all "core" class instances, it might be a Fujitsu machine 7.124 - picl_walk_tree_by_class(rooth, "core", &L1_state, PICL_get_l1_data_cache_line_size_helper); 7.125 + _picl_walk_tree_by_class(rooth, "core", &L1_state, PICL_get_l1_data_cache_line_size_helper); 7.126 } 7.127 if (L1_state.is_assigned()) { // Is there a value? 7.128 _L1_data_cache_line_size = L1_state.value(); 7.129 } 7.130 7.131 - UniqueValueVisitor L2_state; 7.132 - picl_walk_tree_by_class(rooth, "cpu", &L2_state, PICL_get_l2_cache_line_size_helper); 7.133 + UniqueValueVisitor L2_state(this); 7.134 + _picl_walk_tree_by_class(rooth, "cpu", &L2_state, PICL_get_l2_cache_line_size_helper); 7.135 if (L2_state.is_initial()) { 7.136 - picl_walk_tree_by_class(rooth, "core", &L2_state, PICL_get_l2_cache_line_size_helper); 7.137 + _picl_walk_tree_by_class(rooth, "core", &L2_state, PICL_get_l2_cache_line_size_helper); 7.138 } 7.139 if (L2_state.is_assigned()) { 7.140 _L2_cache_line_size = L2_state.value(); 7.141 } 7.142 } 7.143 - picl_shutdown(); 7.144 + _picl_shutdown(); 7.145 } 7.146 + close_library(); 7.147 } 7.148 7.149 unsigned int L1_data_cache_line_size() const { return _L1_data_cache_line_size; } 7.150 @@ -161,6 +200,43 @@ 7.151 return PICL::get_l2_cache_line_size(nodeh, result); 7.152 } 7.153 7.154 +template<typename FuncType> 7.155 +bool PICL::bind(FuncType& func, const char* name) { 7.156 + func = reinterpret_cast<FuncType>(dlsym(_dl_handle, name)); 7.157 + return func != NULL; 7.158 +} 7.159 + 7.160 +bool PICL::bind_library_functions() { 7.161 + assert(_dl_handle != NULL, "library should be open"); 7.162 + return bind(_picl_initialize, "picl_initialize" ) && 7.163 + bind(_picl_shutdown, "picl_shutdown" ) && 7.164 + bind(_picl_get_root, "picl_get_root" ) && 7.165 + bind(_picl_walk_tree_by_class, "picl_walk_tree_by_class") && 7.166 + bind(_picl_get_prop_by_name, "picl_get_prop_by_name" ) && 7.167 + bind(_picl_get_propval, "picl_get_propval" ) && 7.168 + bind(_picl_get_propinfo, "picl_get_propinfo" ); 7.169 +} 7.170 + 7.171 +bool PICL::open_library() { 7.172 + _dl_handle = dlopen("libpicl.so.1", RTLD_LAZY); 7.173 + if (_dl_handle == NULL) { 7.174 + warning("PICL (libpicl.so.1) is missing. Performance will not be optimal."); 7.175 + return false; 7.176 + } 7.177 + if (!bind_library_functions()) { 7.178 + assert(false, "unexpected PICL API change"); 7.179 + close_library(); 7.180 + return false; 7.181 + } 7.182 + return true; 7.183 +} 7.184 + 7.185 +void PICL::close_library() { 7.186 + assert(_dl_handle != NULL, "library should be open"); 7.187 + dlclose(_dl_handle); 7.188 + _dl_handle = NULL; 7.189 +} 7.190 + 7.191 // We need to keep these here as long as we have to build on Solaris 7.192 // versions before 10. 7.193 #ifndef SI_ARCHITECTURE_32
8.1 --- a/src/share/vm/c1/c1_globals.hpp Fri Oct 31 15:22:44 2014 -0700 8.2 +++ b/src/share/vm/c1/c1_globals.hpp Wed Nov 05 15:35:11 2014 -0800 8.3 @@ -287,9 +287,6 @@ 8.4 develop(bool, InstallMethods, true, \ 8.5 "Install methods at the end of successful compilations") \ 8.6 \ 8.7 - product(intx, CompilationRepeat, 0, \ 8.8 - "Number of times to recompile method before returning result") \ 8.9 - \ 8.10 develop(intx, NMethodSizeLimit, (64*K)*wordSize, \ 8.11 "Maximum size of a compiled method.") \ 8.12 \
9.1 --- a/src/share/vm/ci/ciEnv.cpp Fri Oct 31 15:22:44 2014 -0700 9.2 +++ b/src/share/vm/ci/ciEnv.cpp Wed Nov 05 15:35:11 2014 -0800 9.3 @@ -559,7 +559,12 @@ 9.4 oop obj = cpool->resolved_references()->obj_at(cache_index); 9.5 if (obj != NULL) { 9.6 ciObject* ciobj = get_object(obj); 9.7 - return ciConstant(T_OBJECT, ciobj); 9.8 + if (ciobj->is_array()) { 9.9 + return ciConstant(T_ARRAY, ciobj); 9.10 + } else { 9.11 + assert(ciobj->is_instance(), "should be an instance"); 9.12 + return ciConstant(T_OBJECT, ciobj); 9.13 + } 9.14 } 9.15 index = cpool->object_to_cp_index(cache_index); 9.16 } 9.17 @@ -586,8 +591,12 @@ 9.18 } 9.19 } 9.20 ciObject* constant = get_object(string); 9.21 - assert (constant->is_instance(), "must be an instance, or not? "); 9.22 - return ciConstant(T_OBJECT, constant); 9.23 + if (constant->is_array()) { 9.24 + return ciConstant(T_ARRAY, constant); 9.25 + } else { 9.26 + assert (constant->is_instance(), "must be an instance, or not? "); 9.27 + return ciConstant(T_OBJECT, constant); 9.28 + } 9.29 } else if (tag.is_klass() || tag.is_unresolved_klass()) { 9.30 // 4881222: allow ldc to take a class type 9.31 ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore_will_link, accessor);
10.1 --- a/src/share/vm/ci/ciTypeFlow.cpp Fri Oct 31 15:22:44 2014 -0700 10.2 +++ b/src/share/vm/ci/ciTypeFlow.cpp Wed Nov 05 15:35:11 2014 -0800 10.3 @@ -730,7 +730,7 @@ 10.4 if (obj->is_null_object()) { 10.5 push_null(); 10.6 } else { 10.7 - assert(obj->is_instance(), "must be java_mirror of klass"); 10.8 + assert(obj->is_instance() || obj->is_array(), "must be java_mirror of klass"); 10.9 push_object(obj->klass()); 10.10 } 10.11 } else {
11.1 --- a/src/share/vm/classfile/classFileParser.cpp Fri Oct 31 15:22:44 2014 -0700 11.2 +++ b/src/share/vm/classfile/classFileParser.cpp Wed Nov 05 15:35:11 2014 -0800 11.3 @@ -2529,7 +2529,7 @@ 11.4 Array<Method*>* ClassFileParser::parse_methods(bool is_interface, 11.5 AccessFlags* promoted_flags, 11.6 bool* has_final_method, 11.7 - bool* has_default_methods, 11.8 + bool* declares_default_methods, 11.9 TRAPS) { 11.10 ClassFileStream* cfs = stream(); 11.11 cfs->guarantee_more(2, CHECK_NULL); // length 11.12 @@ -2548,11 +2548,11 @@ 11.13 if (method->is_final()) { 11.14 *has_final_method = true; 11.15 } 11.16 - if (is_interface && !(*has_default_methods) 11.17 - && !method->is_abstract() && !method->is_static() 11.18 - && !method->is_private()) { 11.19 - // default method 11.20 - *has_default_methods = true; 11.21 + // declares_default_methods: declares concrete instance methods, any access flags 11.22 + // used for interface initialization, and default method inheritance analysis 11.23 + if (is_interface && !(*declares_default_methods) 11.24 + && !method->is_abstract() && !method->is_static()) { 11.25 + *declares_default_methods = true; 11.26 } 11.27 _methods->at_put(index, method()); 11.28 } 11.29 @@ -3691,6 +3691,7 @@ 11.30 JvmtiCachedClassFileData *cached_class_file = NULL; 11.31 Handle class_loader(THREAD, loader_data->class_loader()); 11.32 bool has_default_methods = false; 11.33 + bool declares_default_methods = false; 11.34 ResourceMark rm(THREAD); 11.35 11.36 ClassFileStream* cfs = stream(); 11.37 @@ -3928,8 +3929,11 @@ 11.38 Array<Method*>* methods = parse_methods(access_flags.is_interface(), 11.39 &promoted_flags, 11.40 &has_final_method, 11.41 - &has_default_methods, 11.42 + &declares_default_methods, 11.43 CHECK_(nullHandle)); 11.44 + if (declares_default_methods) { 11.45 + has_default_methods = true; 11.46 + } 11.47 11.48 // Additional attributes 11.49 ClassAnnotationCollector parsed_annotations; 11.50 @@ -4072,6 +4076,7 @@ 11.51 this_klass->set_minor_version(minor_version); 11.52 this_klass->set_major_version(major_version); 11.53 this_klass->set_has_default_methods(has_default_methods); 11.54 + this_klass->set_declares_default_methods(declares_default_methods); 11.55 11.56 if (!host_klass.is_null()) { 11.57 assert (this_klass->is_anonymous(), "should be the same"); 11.58 @@ -4165,8 +4170,12 @@ 11.59 tty->print("[Loaded %s from %s]\n", this_klass->external_name(), 11.60 cfs->source()); 11.61 } else if (class_loader.is_null()) { 11.62 - if (THREAD->is_Java_thread()) { 11.63 - Klass* caller = ((JavaThread*)THREAD)->security_get_caller_class(1); 11.64 + Klass* caller = 11.65 + THREAD->is_Java_thread() 11.66 + ? ((JavaThread*)THREAD)->security_get_caller_class(1) 11.67 + : NULL; 11.68 + // caller can be NULL, for example, during a JVMTI VM_Init hook 11.69 + if (caller != NULL) { 11.70 tty->print("[Loaded %s by instance of %s]\n", 11.71 this_klass->external_name(), 11.72 InstanceKlass::cast(caller)->external_name());
12.1 --- a/src/share/vm/classfile/classFileParser.hpp Fri Oct 31 15:22:44 2014 -0700 12.2 +++ b/src/share/vm/classfile/classFileParser.hpp Wed Nov 05 15:35:11 2014 -0800 12.3 @@ -247,7 +247,7 @@ 12.4 Array<Method*>* parse_methods(bool is_interface, 12.5 AccessFlags* promoted_flags, 12.6 bool* has_final_method, 12.7 - bool* has_default_method, 12.8 + bool* declares_default_methods, 12.9 TRAPS); 12.10 intArray* sort_methods(Array<Method*>* methods); 12.11
13.1 --- a/src/share/vm/compiler/compileBroker.cpp Fri Oct 31 15:22:44 2014 -0700 13.2 +++ b/src/share/vm/compiler/compileBroker.cpp Wed Nov 05 15:35:11 2014 -0800 13.3 @@ -183,9 +183,8 @@ 13.4 13.5 long CompileBroker::_peak_compilation_time = 0; 13.6 13.7 -CompileQueue* CompileBroker::_c2_method_queue = NULL; 13.8 -CompileQueue* CompileBroker::_c1_method_queue = NULL; 13.9 -CompileTask* CompileBroker::_task_free_list = NULL; 13.10 +CompileQueue* CompileBroker::_c2_compile_queue = NULL; 13.11 +CompileQueue* CompileBroker::_c1_compile_queue = NULL; 13.12 13.13 GrowableArray<CompilerThread*>* CompileBroker::_compiler_threads = NULL; 13.14 13.15 @@ -253,13 +252,56 @@ 13.16 13.17 // By convention, the compiling thread is responsible for 13.18 // recycling a non-blocking CompileTask. 13.19 - CompileBroker::free_task(task); 13.20 + CompileTask::free(task); 13.21 } 13.22 } 13.23 13.24 13.25 -// ------------------------------------------------------------------ 13.26 -// CompileTask::initialize 13.27 +CompileTask* CompileTask::_task_free_list = NULL; 13.28 +#ifdef ASSERT 13.29 +int CompileTask::_num_allocated_tasks = 0; 13.30 +#endif 13.31 +/** 13.32 + * Allocate a CompileTask, from the free list if possible. 13.33 + */ 13.34 +CompileTask* CompileTask::allocate() { 13.35 + MutexLocker locker(CompileTaskAlloc_lock); 13.36 + CompileTask* task = NULL; 13.37 + 13.38 + if (_task_free_list != NULL) { 13.39 + task = _task_free_list; 13.40 + _task_free_list = task->next(); 13.41 + task->set_next(NULL); 13.42 + } else { 13.43 + task = new CompileTask(); 13.44 + DEBUG_ONLY(_num_allocated_tasks++;) 13.45 + assert (_num_allocated_tasks < 10000, "Leaking compilation tasks?"); 13.46 + task->set_next(NULL); 13.47 + task->set_is_free(true); 13.48 + } 13.49 + assert(task->is_free(), "Task must be free."); 13.50 + task->set_is_free(false); 13.51 + return task; 13.52 +} 13.53 + 13.54 + 13.55 +/** 13.56 + * Add a task to the free list. 13.57 + */ 13.58 +void CompileTask::free(CompileTask* task) { 13.59 + MutexLocker locker(CompileTaskAlloc_lock); 13.60 + if (!task->is_free()) { 13.61 + task->set_code(NULL); 13.62 + assert(!task->lock()->is_locked(), "Should not be locked when freed"); 13.63 + JNIHandles::destroy_global(task->_method_holder); 13.64 + JNIHandles::destroy_global(task->_hot_method_holder); 13.65 + 13.66 + task->set_is_free(true); 13.67 + task->set_next(_task_free_list); 13.68 + _task_free_list = task; 13.69 + } 13.70 +} 13.71 + 13.72 void CompileTask::initialize(int compile_id, 13.73 methodHandle method, 13.74 int osr_bci, 13.75 @@ -318,15 +360,6 @@ 13.76 if (nm == NULL) _code_handle = NULL; // drop the handle also 13.77 } 13.78 13.79 -// ------------------------------------------------------------------ 13.80 -// CompileTask::free 13.81 -void CompileTask::free() { 13.82 - set_code(NULL); 13.83 - assert(!_lock->is_locked(), "Should not be locked when freed"); 13.84 - JNIHandles::destroy_global(_method_holder); 13.85 - JNIHandles::destroy_global(_hot_method_holder); 13.86 -} 13.87 - 13.88 13.89 void CompileTask::mark_on_stack() { 13.90 // Mark these methods as something redefine classes cannot remove. 13.91 @@ -594,9 +627,12 @@ 13.92 13.93 13.94 13.95 -// Add a CompileTask to a CompileQueue 13.96 +/** 13.97 + * Add a CompileTask to a CompileQueue 13.98 + */ 13.99 void CompileQueue::add(CompileTask* task) { 13.100 assert(lock()->owned_by_self(), "must own lock"); 13.101 + assert(!CompileBroker::is_compilation_disabled_forever(), "Do not add task if compilation is turned off forever"); 13.102 13.103 task->set_next(NULL); 13.104 task->set_prev(NULL); 13.105 @@ -618,9 +654,7 @@ 13.106 // Mark the method as being in the compile queue. 13.107 task->method()->set_queued_for_compilation(); 13.108 13.109 - if (CIPrintCompileQueue) { 13.110 - print(); 13.111 - } 13.112 + NOT_PRODUCT(print();) 13.113 13.114 if (LogCompilation && xtty != NULL) { 13.115 task->log_task_queued(); 13.116 @@ -630,14 +664,32 @@ 13.117 lock()->notify_all(); 13.118 } 13.119 13.120 -void CompileQueue::delete_all() { 13.121 - assert(lock()->owned_by_self(), "must own lock"); 13.122 - if (_first != NULL) { 13.123 - for (CompileTask* task = _first; task != NULL; task = task->next()) { 13.124 - delete task; 13.125 +/** 13.126 + * Empties compilation queue by putting all compilation tasks onto 13.127 + * a freelist. Furthermore, the method wakes up all threads that are 13.128 + * waiting on a compilation task to finish. This can happen if background 13.129 + * compilation is disabled. 13.130 + */ 13.131 +void CompileQueue::free_all() { 13.132 + MutexLocker mu(lock()); 13.133 + CompileTask* next = _first; 13.134 + 13.135 + // Iterate over all tasks in the compile queue 13.136 + while (next != NULL) { 13.137 + CompileTask* current = next; 13.138 + next = current->next(); 13.139 + { 13.140 + // Wake up thread that blocks on the compile task. 13.141 + MutexLocker ct_lock(current->lock()); 13.142 + current->lock()->notify(); 13.143 } 13.144 - _first = NULL; 13.145 + // Put the task back on the freelist. 13.146 + CompileTask::free(current); 13.147 } 13.148 + _first = NULL; 13.149 + 13.150 + // Wake up all threads that block on the queue. 13.151 + lock()->notify_all(); 13.152 } 13.153 13.154 // ------------------------------------------------------------------ 13.155 @@ -767,18 +819,24 @@ 13.156 } 13.157 } 13.158 13.159 -// ------------------------------------------------------------------ 13.160 -// CompileQueue::print 13.161 +#ifndef PRODUCT 13.162 +/** 13.163 + * Print entire compilation queue. 13.164 + */ 13.165 void CompileQueue::print() { 13.166 - tty->print_cr("Contents of %s", name()); 13.167 - tty->print_cr("----------------------"); 13.168 - CompileTask* task = _first; 13.169 - while (task != NULL) { 13.170 - task->print_line(); 13.171 - task = task->next(); 13.172 + if (CIPrintCompileQueue) { 13.173 + ttyLocker ttyl; 13.174 + tty->print_cr("Contents of %s", name()); 13.175 + tty->print_cr("----------------------"); 13.176 + CompileTask* task = _first; 13.177 + while (task != NULL) { 13.178 + task->print_line(); 13.179 + task = task->next(); 13.180 + } 13.181 + tty->print_cr("----------------------"); 13.182 } 13.183 - tty->print_cr("----------------------"); 13.184 } 13.185 +#endif // PRODUCT 13.186 13.187 CompilerCounters::CompilerCounters(const char* thread_name, int instance, TRAPS) { 13.188 13.189 @@ -851,9 +909,6 @@ 13.190 _compilers[1] = new SharkCompiler(); 13.191 #endif // SHARK 13.192 13.193 - // Initialize the CompileTask free list 13.194 - _task_free_list = NULL; 13.195 - 13.196 // Start the CompilerThreads 13.197 init_compiler_threads(c1_count, c2_count); 13.198 // totalTime performance counter is always created as it is required 13.199 @@ -1046,11 +1101,11 @@ 13.200 #endif // !ZERO && !SHARK 13.201 // Initialize the compilation queue 13.202 if (c2_compiler_count > 0) { 13.203 - _c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock); 13.204 + _c2_compile_queue = new CompileQueue("C2 CompileQueue", MethodCompileQueue_lock); 13.205 _compilers[1]->set_num_compiler_threads(c2_compiler_count); 13.206 } 13.207 if (c1_compiler_count > 0) { 13.208 - _c1_method_queue = new CompileQueue("C1MethodQueue", MethodCompileQueue_lock); 13.209 + _c1_compile_queue = new CompileQueue("C1 CompileQueue", MethodCompileQueue_lock); 13.210 _compilers[0]->set_num_compiler_threads(c1_compiler_count); 13.211 } 13.212 13.213 @@ -1065,7 +1120,7 @@ 13.214 sprintf(name_buffer, "C2 CompilerThread%d", i); 13.215 CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK); 13.216 // Shark and C2 13.217 - CompilerThread* new_thread = make_compiler_thread(name_buffer, _c2_method_queue, counters, _compilers[1], CHECK); 13.218 + CompilerThread* new_thread = make_compiler_thread(name_buffer, _c2_compile_queue, counters, _compilers[1], CHECK); 13.219 _compiler_threads->append(new_thread); 13.220 } 13.221 13.222 @@ -1074,7 +1129,7 @@ 13.223 sprintf(name_buffer, "C1 CompilerThread%d", i); 13.224 CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK); 13.225 // C1 13.226 - CompilerThread* new_thread = make_compiler_thread(name_buffer, _c1_method_queue, counters, _compilers[0], CHECK); 13.227 + CompilerThread* new_thread = make_compiler_thread(name_buffer, _c1_compile_queue, counters, _compilers[0], CHECK); 13.228 _compiler_threads->append(new_thread); 13.229 } 13.230 13.231 @@ -1084,14 +1139,19 @@ 13.232 } 13.233 13.234 13.235 -// Set the methods on the stack as on_stack so that redefine classes doesn't 13.236 -// reclaim them 13.237 +/** 13.238 + * Set the methods on the stack as on_stack so that redefine classes doesn't 13.239 + * reclaim them. This method is executed at a safepoint. 13.240 + */ 13.241 void CompileBroker::mark_on_stack() { 13.242 - if (_c2_method_queue != NULL) { 13.243 - _c2_method_queue->mark_on_stack(); 13.244 + assert(SafepointSynchronize::is_at_safepoint(), "sanity check"); 13.245 + // Since we are at a safepoint, we do not need a lock to access 13.246 + // the compile queues. 13.247 + if (_c2_compile_queue != NULL) { 13.248 + _c2_compile_queue->mark_on_stack(); 13.249 } 13.250 - if (_c1_method_queue != NULL) { 13.251 - _c1_method_queue->mark_on_stack(); 13.252 + if (_c1_compile_queue != NULL) { 13.253 + _c1_compile_queue->mark_on_stack(); 13.254 } 13.255 } 13.256 13.257 @@ -1107,7 +1167,7 @@ 13.258 const char* comment, 13.259 Thread* thread) { 13.260 // do nothing if compiler thread(s) is not available 13.261 - if (!_initialized ) { 13.262 + if (!_initialized) { 13.263 return; 13.264 } 13.265 13.266 @@ -1154,7 +1214,7 @@ 13.267 13.268 // If this method is already in the compile queue, then 13.269 // we do not block the current thread. 13.270 - if (compilation_is_in_queue(method, osr_bci)) { 13.271 + if (compilation_is_in_queue(method)) { 13.272 // We may want to decay our counter a bit here to prevent 13.273 // multiple denied requests for compilation. This is an 13.274 // open compilation policy issue. Note: The other possibility, 13.275 @@ -1193,7 +1253,7 @@ 13.276 // Make sure the method has not slipped into the queues since 13.277 // last we checked; note that those checks were "fast bail-outs". 13.278 // Here we need to be more careful, see 14012000 below. 13.279 - if (compilation_is_in_queue(method, osr_bci)) { 13.280 + if (compilation_is_in_queue(method)) { 13.281 return; 13.282 } 13.283 13.284 @@ -1214,7 +1274,7 @@ 13.285 } 13.286 13.287 // Should this thread wait for completion of the compile? 13.288 - blocking = is_compile_blocking(method, osr_bci); 13.289 + blocking = is_compile_blocking(); 13.290 13.291 // We will enter the compilation in the queue. 13.292 // 14012000: Note that this sets the queued_for_compile bits in 13.293 @@ -1406,19 +1466,17 @@ 13.294 } 13.295 13.296 13.297 -// ------------------------------------------------------------------ 13.298 -// CompileBroker::compilation_is_in_queue 13.299 -// 13.300 -// See if this compilation is already requested. 13.301 -// 13.302 -// Implementation note: there is only a single "is in queue" bit 13.303 -// for each method. This means that the check below is overly 13.304 -// conservative in the sense that an osr compilation in the queue 13.305 -// will block a normal compilation from entering the queue (and vice 13.306 -// versa). This can be remedied by a full queue search to disambiguate 13.307 -// cases. If it is deemed profitible, this may be done. 13.308 -bool CompileBroker::compilation_is_in_queue(methodHandle method, 13.309 - int osr_bci) { 13.310 +/** 13.311 + * See if this compilation is already requested. 13.312 + * 13.313 + * Implementation note: there is only a single "is in queue" bit 13.314 + * for each method. This means that the check below is overly 13.315 + * conservative in the sense that an osr compilation in the queue 13.316 + * will block a normal compilation from entering the queue (and vice 13.317 + * versa). This can be remedied by a full queue search to disambiguate 13.318 + * cases. If it is deemed profitable, this may be done. 13.319 + */ 13.320 +bool CompileBroker::compilation_is_in_queue(methodHandle method) { 13.321 return method->queued_for_compilation(); 13.322 } 13.323 13.324 @@ -1498,13 +1556,11 @@ 13.325 #endif 13.326 } 13.327 13.328 - 13.329 -// ------------------------------------------------------------------ 13.330 -// CompileBroker::is_compile_blocking 13.331 -// 13.332 -// Should the current thread be blocked until this compilation request 13.333 -// has been fulfilled? 13.334 -bool CompileBroker::is_compile_blocking(methodHandle method, int osr_bci) { 13.335 +/** 13.336 + * Should the current thread block until this compilation request 13.337 + * has been fulfilled? 13.338 + */ 13.339 +bool CompileBroker::is_compile_blocking() { 13.340 assert(!InstanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock"); 13.341 return !BackgroundCompilation; 13.342 } 13.343 @@ -1532,7 +1588,7 @@ 13.344 int hot_count, 13.345 const char* comment, 13.346 bool blocking) { 13.347 - CompileTask* new_task = allocate_task(); 13.348 + CompileTask* new_task = CompileTask::allocate(); 13.349 new_task->initialize(compile_id, method, osr_bci, comp_level, 13.350 hot_method, hot_count, comment, 13.351 blocking); 13.352 @@ -1541,75 +1597,52 @@ 13.353 } 13.354 13.355 13.356 -// ------------------------------------------------------------------ 13.357 -// CompileBroker::allocate_task 13.358 -// 13.359 -// Allocate a CompileTask, from the free list if possible. 13.360 -CompileTask* CompileBroker::allocate_task() { 13.361 - MutexLocker locker(CompileTaskAlloc_lock); 13.362 - CompileTask* task = NULL; 13.363 - if (_task_free_list != NULL) { 13.364 - task = _task_free_list; 13.365 - _task_free_list = task->next(); 13.366 - task->set_next(NULL); 13.367 - } else { 13.368 - task = new CompileTask(); 13.369 - task->set_next(NULL); 13.370 - } 13.371 - return task; 13.372 -} 13.373 - 13.374 - 13.375 -// ------------------------------------------------------------------ 13.376 -// CompileBroker::free_task 13.377 -// 13.378 -// Add a task to the free list. 13.379 -void CompileBroker::free_task(CompileTask* task) { 13.380 - MutexLocker locker(CompileTaskAlloc_lock); 13.381 - task->free(); 13.382 - task->set_next(_task_free_list); 13.383 - _task_free_list = task; 13.384 -} 13.385 - 13.386 - 13.387 -// ------------------------------------------------------------------ 13.388 -// CompileBroker::wait_for_completion 13.389 -// 13.390 -// Wait for the given method CompileTask to complete. 13.391 +/** 13.392 + * Wait for the compilation task to complete. 13.393 + */ 13.394 void CompileBroker::wait_for_completion(CompileTask* task) { 13.395 if (CIPrintCompileQueue) { 13.396 + ttyLocker ttyl; 13.397 tty->print_cr("BLOCKING FOR COMPILE"); 13.398 } 13.399 13.400 assert(task->is_blocking(), "can only wait on blocking task"); 13.401 13.402 - JavaThread *thread = JavaThread::current(); 13.403 + JavaThread* thread = JavaThread::current(); 13.404 thread->set_blocked_on_compilation(true); 13.405 13.406 methodHandle method(thread, task->method()); 13.407 { 13.408 MutexLocker waiter(task->lock(), thread); 13.409 13.410 - while (!task->is_complete()) 13.411 + while (!task->is_complete() && !is_compilation_disabled_forever()) { 13.412 task->lock()->wait(); 13.413 + } 13.414 } 13.415 + 13.416 + thread->set_blocked_on_compilation(false); 13.417 + if (is_compilation_disabled_forever()) { 13.418 + CompileTask::free(task); 13.419 + return; 13.420 + } 13.421 + 13.422 // It is harmless to check this status without the lock, because 13.423 // completion is a stable property (until the task object is recycled). 13.424 assert(task->is_complete(), "Compilation should have completed"); 13.425 assert(task->code_handle() == NULL, "must be reset"); 13.426 13.427 - thread->set_blocked_on_compilation(false); 13.428 - 13.429 // By convention, the waiter is responsible for recycling a 13.430 // blocking CompileTask. Since there is only one waiter ever 13.431 // waiting on a CompileTask, we know that no one else will 13.432 // be using this CompileTask; we can free it. 13.433 - free_task(task); 13.434 + CompileTask::free(task); 13.435 } 13.436 13.437 -// Initialize compiler thread(s) + compiler object(s). The postcondition 13.438 -// of this function is that the compiler runtimes are initialized and that 13.439 -//compiler threads can start compiling. 13.440 +/** 13.441 + * Initialize compiler thread(s) + compiler object(s). The postcondition 13.442 + * of this function is that the compiler runtimes are initialized and that 13.443 + * compiler threads can start compiling. 13.444 + */ 13.445 bool CompileBroker::init_compiler_runtime() { 13.446 CompilerThread* thread = CompilerThread::current(); 13.447 AbstractCompiler* comp = thread->compiler(); 13.448 @@ -1646,7 +1679,6 @@ 13.449 disable_compilation_forever(); 13.450 // If compiler initialization failed, no compiler thread that is specific to a 13.451 // particular compiler runtime will ever start to compile methods. 13.452 - 13.453 shutdown_compiler_runtime(comp, thread); 13.454 return false; 13.455 } 13.456 @@ -1660,9 +1692,11 @@ 13.457 return true; 13.458 } 13.459 13.460 -// If C1 and/or C2 initialization failed, we shut down all compilation. 13.461 -// We do this to keep things simple. This can be changed if it ever turns out to be 13.462 -// a problem. 13.463 +/** 13.464 + * If C1 and/or C2 initialization failed, we shut down all compilation. 13.465 + * We do this to keep things simple. This can be changed if it ever turns 13.466 + * out to be a problem. 13.467 + */ 13.468 void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) { 13.469 // Free buffer blob, if allocated 13.470 if (thread->get_buffer_blob() != NULL) { 13.471 @@ -1674,28 +1708,25 @@ 13.472 // There are two reasons for shutting down the compiler 13.473 // 1) compiler runtime initialization failed 13.474 // 2) The code cache is full and the following flag is set: -XX:-UseCodeCacheFlushing 13.475 - warning("Shutting down compiler %s (no space to run compilers)", comp->name()); 13.476 + warning("%s initialization failed. Shutting down all compilers", comp->name()); 13.477 13.478 // Only one thread per compiler runtime object enters here 13.479 // Set state to shut down 13.480 comp->set_shut_down(); 13.481 13.482 - MutexLocker mu(MethodCompileQueue_lock, thread); 13.483 - CompileQueue* queue; 13.484 - if (_c1_method_queue != NULL) { 13.485 - _c1_method_queue->delete_all(); 13.486 - queue = _c1_method_queue; 13.487 - _c1_method_queue = NULL; 13.488 - delete _c1_method_queue; 13.489 + // Delete all queued compilation tasks to make compiler threads exit faster. 13.490 + if (_c1_compile_queue != NULL) { 13.491 + _c1_compile_queue->free_all(); 13.492 } 13.493 13.494 - if (_c2_method_queue != NULL) { 13.495 - _c2_method_queue->delete_all(); 13.496 - queue = _c2_method_queue; 13.497 - _c2_method_queue = NULL; 13.498 - delete _c2_method_queue; 13.499 + if (_c2_compile_queue != NULL) { 13.500 + _c2_compile_queue->free_all(); 13.501 } 13.502 13.503 + // Set flags so that we continue execution with using interpreter only. 13.504 + UseCompiler = false; 13.505 + UseInterpreter = true; 13.506 + 13.507 // We could delete compiler runtimes also. However, there are references to 13.508 // the compiler runtime(s) (e.g., nmethod::is_compiled_by_c1()) which then 13.509 // fail. This can be done later if necessary. 13.510 @@ -1781,22 +1812,6 @@ 13.511 if (method()->number_of_breakpoints() == 0) { 13.512 // Compile the method. 13.513 if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) { 13.514 -#ifdef COMPILER1 13.515 - // Allow repeating compilations for the purpose of benchmarking 13.516 - // compile speed. This is not useful for customers. 13.517 - if (CompilationRepeat != 0) { 13.518 - int compile_count = CompilationRepeat; 13.519 - while (compile_count > 0) { 13.520 - invoke_compiler_on_method(task); 13.521 - nmethod* nm = method->code(); 13.522 - if (nm != NULL) { 13.523 - nm->make_zombie(); 13.524 - method->clear_code(); 13.525 - } 13.526 - compile_count--; 13.527 - } 13.528 - } 13.529 -#endif /* COMPILER1 */ 13.530 invoke_compiler_on_method(task); 13.531 } else { 13.532 // After compilation is disabled, remove remaining methods from queue
14.1 --- a/src/share/vm/compiler/compileBroker.hpp Fri Oct 31 15:22:44 2014 -0700 14.2 +++ b/src/share/vm/compiler/compileBroker.hpp Wed Nov 05 15:35:11 2014 -0800 14.3 @@ -40,6 +40,11 @@ 14.4 friend class VMStructs; 14.5 14.6 private: 14.7 + static CompileTask* _task_free_list; 14.8 +#ifdef ASSERT 14.9 + static int _num_allocated_tasks; 14.10 +#endif 14.11 + 14.12 Monitor* _lock; 14.13 uint _compile_id; 14.14 Method* _method; 14.15 @@ -52,7 +57,7 @@ 14.16 int _num_inlined_bytecodes; 14.17 nmethodLocker* _code_handle; // holder of eventual result 14.18 CompileTask* _next, *_prev; 14.19 - 14.20 + bool _is_free; 14.21 // Fields used for logging why the compilation was initiated: 14.22 jlong _time_queued; // in units of os::elapsed_counter() 14.23 Method* _hot_method; // which method actually triggered this task 14.24 @@ -70,7 +75,8 @@ 14.25 methodHandle hot_method, int hot_count, const char* comment, 14.26 bool is_blocking); 14.27 14.28 - void free(); 14.29 + static CompileTask* allocate(); 14.30 + static void free(CompileTask* task); 14.31 14.32 int compile_id() const { return _compile_id; } 14.33 Method* method() const { return _method; } 14.34 @@ -99,6 +105,8 @@ 14.35 void set_next(CompileTask* next) { _next = next; } 14.36 CompileTask* prev() const { return _prev; } 14.37 void set_prev(CompileTask* prev) { _prev = prev; } 14.38 + bool is_free() const { return _is_free; } 14.39 + void set_is_free(bool val) { _is_free = val; } 14.40 14.41 private: 14.42 static void print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level, 14.43 @@ -225,8 +233,8 @@ 14.44 14.45 // Redefine Classes support 14.46 void mark_on_stack(); 14.47 - void delete_all(); 14.48 - void print(); 14.49 + void free_all(); 14.50 + NOT_PRODUCT (void print();) 14.51 14.52 ~CompileQueue() { 14.53 assert (is_empty(), " Compile Queue must be empty"); 14.54 @@ -279,9 +287,8 @@ 14.55 static int _last_compile_level; 14.56 static char _last_method_compiled[name_buffer_length]; 14.57 14.58 - static CompileQueue* _c2_method_queue; 14.59 - static CompileQueue* _c1_method_queue; 14.60 - static CompileTask* _task_free_list; 14.61 + static CompileQueue* _c2_compile_queue; 14.62 + static CompileQueue* _c1_compile_queue; 14.63 14.64 static GrowableArray<CompilerThread*>* _compiler_threads; 14.65 14.66 @@ -334,7 +341,7 @@ 14.67 static void init_compiler_threads(int c1_compiler_count, int c2_compiler_count); 14.68 static bool compilation_is_complete (methodHandle method, int osr_bci, int comp_level); 14.69 static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level); 14.70 - static bool is_compile_blocking (methodHandle method, int osr_bci); 14.71 + static bool is_compile_blocking (); 14.72 static void preload_classes (methodHandle method, TRAPS); 14.73 14.74 static CompileTask* create_compile_task(CompileQueue* queue, 14.75 @@ -346,8 +353,6 @@ 14.76 int hot_count, 14.77 const char* comment, 14.78 bool blocking); 14.79 - static CompileTask* allocate_task(); 14.80 - static void free_task(CompileTask* task); 14.81 static void wait_for_completion(CompileTask* task); 14.82 14.83 static void invoke_compiler_on_method(CompileTask* task); 14.84 @@ -365,8 +370,8 @@ 14.85 const char* comment, 14.86 Thread* thread); 14.87 static CompileQueue* compile_queue(int comp_level) { 14.88 - if (is_c2_compile(comp_level)) return _c2_method_queue; 14.89 - if (is_c1_compile(comp_level)) return _c1_method_queue; 14.90 + if (is_c2_compile(comp_level)) return _c2_compile_queue; 14.91 + if (is_c1_compile(comp_level)) return _c1_compile_queue; 14.92 return NULL; 14.93 } 14.94 static bool init_compiler_runtime(); 14.95 @@ -384,7 +389,7 @@ 14.96 return NULL; 14.97 } 14.98 14.99 - static bool compilation_is_in_queue(methodHandle method, int osr_bci); 14.100 + static bool compilation_is_in_queue(methodHandle method); 14.101 static int queue_size(int comp_level) { 14.102 CompileQueue *q = compile_queue(comp_level); 14.103 return q != NULL ? q->size() : 0;
15.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Oct 31 15:22:44 2014 -0700 15.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Nov 05 15:35:11 2014 -0800 15.3 @@ -2478,6 +2478,7 @@ 15.4 15.5 unsigned int gc_count_before; 15.6 unsigned int old_marking_count_before; 15.7 + unsigned int full_gc_count_before; 15.8 bool retry_gc; 15.9 15.10 do { 15.11 @@ -2488,6 +2489,7 @@ 15.12 15.13 // Read the GC count while holding the Heap_lock 15.14 gc_count_before = total_collections(); 15.15 + full_gc_count_before = total_full_collections(); 15.16 old_marking_count_before = _old_marking_cycles_started; 15.17 } 15.18 15.19 @@ -2532,7 +2534,7 @@ 15.20 VMThread::execute(&op); 15.21 } else { 15.22 // Schedule a Full GC. 15.23 - VM_G1CollectFull op(gc_count_before, old_marking_count_before, cause); 15.24 + VM_G1CollectFull op(gc_count_before, full_gc_count_before, cause); 15.25 VMThread::execute(&op); 15.26 } 15.27 }
16.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Oct 31 15:22:44 2014 -0700 16.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Wed Nov 05 15:35:11 2014 -0800 16.3 @@ -1249,7 +1249,7 @@ 16.4 // The same as above but assume that the caller holds the Heap_lock. 16.5 void collect_locked(GCCause::Cause cause); 16.6 16.7 - virtual void copy_allocation_context_stats(const jint* contexts, 16.8 + virtual bool copy_allocation_context_stats(const jint* contexts, 16.9 jlong* totals, 16.10 jbyte* accuracy, 16.11 jint len);
17.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp Fri Oct 31 15:22:44 2014 -0700 17.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp Wed Nov 05 15:35:11 2014 -0800 17.3 @@ -25,8 +25,9 @@ 17.4 #include "precompiled.hpp" 17.5 #include "gc_implementation/g1/g1CollectedHeap.hpp" 17.6 17.7 -void G1CollectedHeap::copy_allocation_context_stats(const jint* contexts, 17.8 +bool G1CollectedHeap::copy_allocation_context_stats(const jint* contexts, 17.9 jlong* totals, 17.10 jbyte* accuracy, 17.11 jint len) { 17.12 + return false; 17.13 }
18.1 --- a/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp Fri Oct 31 15:22:44 2014 -0700 18.2 +++ b/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp Wed Nov 05 15:35:11 2014 -0800 18.3 @@ -60,7 +60,7 @@ 18.4 VM_G1CollectFull(unsigned int gc_count_before, 18.5 unsigned int full_gc_count_before, 18.6 GCCause::Cause cause) 18.7 - : VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { } 18.8 + : VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { } 18.9 virtual VMOp_Type type() const { return VMOp_G1CollectFull; } 18.10 virtual void doit(); 18.11 virtual const char* name() const {
19.1 --- a/src/share/vm/gc_interface/collectedHeap.hpp Fri Oct 31 15:22:44 2014 -0700 19.2 +++ b/src/share/vm/gc_interface/collectedHeap.hpp Wed Nov 05 15:35:11 2014 -0800 19.3 @@ -641,10 +641,13 @@ 19.4 // For each context in contexts, set the corresponding entries in the totals 19.5 // and accuracy arrays to the current values held by the statistics. Each 19.6 // array should be of length len. 19.7 - virtual void copy_allocation_context_stats(const jint* contexts, 19.8 + // Returns true if there are more stats available. 19.9 + virtual bool copy_allocation_context_stats(const jint* contexts, 19.10 jlong* totals, 19.11 jbyte* accuracy, 19.12 - jint len) { } 19.13 + jint len) { 19.14 + return false; 19.15 + } 19.16 19.17 /////////////// Unit tests /////////////// 19.18
20.1 --- a/src/share/vm/memory/collectorPolicy.cpp Fri Oct 31 15:22:44 2014 -0700 20.2 +++ b/src/share/vm/memory/collectorPolicy.cpp Wed Nov 05 15:35:11 2014 -0800 20.3 @@ -183,13 +183,9 @@ 20.4 // Requirements of any new remembered set implementations must be added here. 20.5 size_t alignment = GenRemSet::max_alignment_constraint(GenRemSet::CardTable); 20.6 20.7 - // Parallel GC does its own alignment of the generations to avoid requiring a 20.8 - // large page (256M on some platforms) for the permanent generation. The 20.9 - // other collectors should also be updated to do their own alignment and then 20.10 - // this use of lcm() should be removed. 20.11 - if (UseLargePages && !UseParallelGC) { 20.12 - // in presence of large pages we have to make sure that our 20.13 - // alignment is large page aware 20.14 + if (UseLargePages) { 20.15 + // In presence of large pages we have to make sure that our 20.16 + // alignment is large page aware. 20.17 alignment = lcm(os::large_page_size(), alignment); 20.18 } 20.19
21.1 --- a/src/share/vm/memory/metaspace.cpp Fri Oct 31 15:22:44 2014 -0700 21.2 +++ b/src/share/vm/memory/metaspace.cpp Wed Nov 05 15:35:11 2014 -0800 21.3 @@ -3141,7 +3141,7 @@ 21.4 MetaspaceGC::initialize(); 21.5 21.6 // Initialize the alignment for shared spaces. 21.7 - int max_alignment = os::vm_page_size(); 21.8 + int max_alignment = os::vm_allocation_granularity(); 21.9 size_t cds_total = 0; 21.10 21.11 MetaspaceShared::set_max_alignment(max_alignment); 21.12 @@ -3155,6 +3155,16 @@ 21.13 SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment); 21.14 SharedMiscCodeSize = align_size_up(SharedMiscCodeSize, max_alignment); 21.15 21.16 + // the min_misc_code_size estimate is based on MetaspaceShared::generate_vtable_methods() 21.17 + uintx min_misc_code_size = align_size_up( 21.18 + (MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size) * 21.19 + (sizeof(void*) + MetaspaceShared::vtbl_method_size) + MetaspaceShared::vtbl_common_code_size, 21.20 + max_alignment); 21.21 + 21.22 + if (SharedMiscCodeSize < min_misc_code_size) { 21.23 + report_out_of_shared_space(SharedMiscCode); 21.24 + } 21.25 + 21.26 // Initialize with the sum of the shared space sizes. The read-only 21.27 // and read write metaspace chunks will be allocated out of this and the 21.28 // remainder is the misc code and data chunks.
22.1 --- a/src/share/vm/memory/metaspaceShared.hpp Fri Oct 31 15:22:44 2014 -0700 22.2 +++ b/src/share/vm/memory/metaspaceShared.hpp Wed Nov 05 15:35:11 2014 -0800 22.3 @@ -57,11 +57,16 @@ 22.4 static bool _archive_loading_failed; 22.5 public: 22.6 enum { 22.7 - vtbl_list_size = 17, // number of entries in the shared space vtable list. 22.8 - num_virtuals = 200 // maximum number of virtual functions 22.9 - // If virtual functions are added to Metadata, 22.10 - // this number needs to be increased. Also, 22.11 - // SharedMiscCodeSize will need to be increased. 22.12 + vtbl_list_size = 17, // number of entries in the shared space vtable list. 22.13 + num_virtuals = 200, // maximum number of virtual functions 22.14 + // If virtual functions are added to Metadata, 22.15 + // this number needs to be increased. Also, 22.16 + // SharedMiscCodeSize will need to be increased. 22.17 + // The following 2 sizes were based on 22.18 + // MetaspaceShared::generate_vtable_methods() 22.19 + vtbl_method_size = 16, // conservative size of the mov1 and jmp instructions 22.20 + // for the x64 platform 22.21 + vtbl_common_code_size = (1*K) // conservative size of the "common_code" for the x64 platform 22.22 }; 22.23 22.24 enum {
23.1 --- a/src/share/vm/oops/instanceKlass.cpp Fri Oct 31 15:22:44 2014 -0700 23.2 +++ b/src/share/vm/oops/instanceKlass.cpp Wed Nov 05 15:35:11 2014 -0800 23.3 @@ -780,6 +780,41 @@ 23.4 } 23.5 } 23.6 23.7 +// Eagerly initialize superinterfaces that declare default methods (concrete instance: any access) 23.8 +void InstanceKlass::initialize_super_interfaces(instanceKlassHandle this_oop, TRAPS) { 23.9 + if (this_oop->has_default_methods()) { 23.10 + for (int i = 0; i < this_oop->local_interfaces()->length(); ++i) { 23.11 + Klass* iface = this_oop->local_interfaces()->at(i); 23.12 + InstanceKlass* ik = InstanceKlass::cast(iface); 23.13 + if (ik->should_be_initialized()) { 23.14 + if (ik->has_default_methods()) { 23.15 + ik->initialize_super_interfaces(ik, THREAD); 23.16 + } 23.17 + // Only initialize() interfaces that "declare" concrete methods. 23.18 + // has_default_methods drives searching superinterfaces since it 23.19 + // means has_default_methods in its superinterface hierarchy 23.20 + if (!HAS_PENDING_EXCEPTION && ik->declares_default_methods()) { 23.21 + ik->initialize(THREAD); 23.22 + } 23.23 + if (HAS_PENDING_EXCEPTION) { 23.24 + Handle e(THREAD, PENDING_EXCEPTION); 23.25 + CLEAR_PENDING_EXCEPTION; 23.26 + { 23.27 + EXCEPTION_MARK; 23.28 + // Locks object, set state, and notify all waiting threads 23.29 + this_oop->set_initialization_state_and_notify( 23.30 + initialization_error, THREAD); 23.31 + 23.32 + // ignore any exception thrown, superclass initialization error is 23.33 + // thrown below 23.34 + CLEAR_PENDING_EXCEPTION; 23.35 + } 23.36 + THROW_OOP(e()); 23.37 + } 23.38 + } 23.39 + } 23.40 + } 23.41 +} 23.42 23.43 void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) { 23.44 // Make sure klass is linked (verified) before initialization 23.45 @@ -859,33 +894,11 @@ 23.46 } 23.47 } 23.48 23.49 + // Recursively initialize any superinterfaces that declare default methods 23.50 + // Only need to recurse if has_default_methods which includes declaring and 23.51 + // inheriting default methods 23.52 if (this_oop->has_default_methods()) { 23.53 - // Step 7.5: initialize any interfaces which have default methods 23.54 - for (int i = 0; i < this_oop->local_interfaces()->length(); ++i) { 23.55 - Klass* iface = this_oop->local_interfaces()->at(i); 23.56 - InstanceKlass* ik = InstanceKlass::cast(iface); 23.57 - if (ik->has_default_methods() && ik->should_be_initialized()) { 23.58 - ik->initialize(THREAD); 23.59 - 23.60 - if (HAS_PENDING_EXCEPTION) { 23.61 - Handle e(THREAD, PENDING_EXCEPTION); 23.62 - CLEAR_PENDING_EXCEPTION; 23.63 - { 23.64 - EXCEPTION_MARK; 23.65 - // Locks object, set state, and notify all waiting threads 23.66 - this_oop->set_initialization_state_and_notify( 23.67 - initialization_error, THREAD); 23.68 - 23.69 - // ignore any exception thrown, superclass initialization error is 23.70 - // thrown below 23.71 - CLEAR_PENDING_EXCEPTION; 23.72 - } 23.73 - DTRACE_CLASSINIT_PROBE_WAIT( 23.74 - super__failed, InstanceKlass::cast(this_oop()), -1, wait); 23.75 - THROW_OOP(e()); 23.76 - } 23.77 - } 23.78 - } 23.79 + this_oop->initialize_super_interfaces(this_oop, CHECK); 23.80 } 23.81 23.82 // Step 8
24.1 --- a/src/share/vm/oops/instanceKlass.hpp Fri Oct 31 15:22:44 2014 -0700 24.2 +++ b/src/share/vm/oops/instanceKlass.hpp Wed Nov 05 15:35:11 2014 -0800 24.3 @@ -229,12 +229,13 @@ 24.4 bool _has_unloaded_dependent; 24.5 24.6 enum { 24.7 - _misc_rewritten = 1 << 0, // methods rewritten. 24.8 - _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops 24.9 - _misc_should_verify_class = 1 << 2, // allow caching of preverification 24.10 - _misc_is_anonymous = 1 << 3, // has embedded _host_klass field 24.11 - _misc_is_contended = 1 << 4, // marked with contended annotation 24.12 - _misc_has_default_methods = 1 << 5 // class/superclass/implemented interfaces has default methods 24.13 + _misc_rewritten = 1 << 0, // methods rewritten. 24.14 + _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops 24.15 + _misc_should_verify_class = 1 << 2, // allow caching of preverification 24.16 + _misc_is_anonymous = 1 << 3, // has embedded _host_klass field 24.17 + _misc_is_contended = 1 << 4, // marked with contended annotation 24.18 + _misc_has_default_methods = 1 << 5, // class/superclass/implemented interfaces has default methods 24.19 + _misc_declares_default_methods = 1 << 6 // directly declares default methods (any access) 24.20 }; 24.21 u2 _misc_flags; 24.22 u2 _minor_version; // minor version number of class file 24.23 @@ -680,6 +681,17 @@ 24.24 } 24.25 } 24.26 24.27 + bool declares_default_methods() const { 24.28 + return (_misc_flags & _misc_declares_default_methods) != 0; 24.29 + } 24.30 + void set_declares_default_methods(bool b) { 24.31 + if (b) { 24.32 + _misc_flags |= _misc_declares_default_methods; 24.33 + } else { 24.34 + _misc_flags &= ~_misc_declares_default_methods; 24.35 + } 24.36 + } 24.37 + 24.38 // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available 24.39 inline u2 next_method_idnum(); 24.40 void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; } 24.41 @@ -1046,6 +1058,7 @@ 24.42 static bool link_class_impl (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS); 24.43 static bool verify_code (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS); 24.44 static void initialize_impl (instanceKlassHandle this_oop, TRAPS); 24.45 + static void initialize_super_interfaces (instanceKlassHandle this_oop, TRAPS); 24.46 static void eager_initialize_impl (instanceKlassHandle this_oop); 24.47 static void set_initialization_state_and_notify_impl (instanceKlassHandle this_oop, ClassState state, TRAPS); 24.48 static void call_class_initializer_impl (instanceKlassHandle this_oop, TRAPS);
25.1 --- a/src/share/vm/oops/objArrayOop.hpp Fri Oct 31 15:22:44 2014 -0700 25.2 +++ b/src/share/vm/oops/objArrayOop.hpp Wed Nov 05 15:35:11 2014 -0800 25.3 @@ -45,9 +45,10 @@ 25.4 private: 25.5 // Give size of objArrayOop in HeapWords minus the header 25.6 static int array_size(int length) { 25.7 - const int OopsPerHeapWord = HeapWordSize/heapOopSize; 25.8 + const uint OopsPerHeapWord = HeapWordSize/heapOopSize; 25.9 assert(OopsPerHeapWord >= 1 && (HeapWordSize % heapOopSize == 0), 25.10 "Else the following (new) computation would be in error"); 25.11 + uint res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord; 25.12 #ifdef ASSERT 25.13 // The old code is left in for sanity-checking; it'll 25.14 // go away pretty soon. XXX 25.15 @@ -55,16 +56,15 @@ 25.16 // oop->length() * HeapWordsPerOop; 25.17 // With narrowOops, HeapWordsPerOop is 1/2 or equal 0 as an integer. 25.18 // The oop elements are aligned up to wordSize 25.19 - const int HeapWordsPerOop = heapOopSize/HeapWordSize; 25.20 - int old_res; 25.21 + const uint HeapWordsPerOop = heapOopSize/HeapWordSize; 25.22 + uint old_res; 25.23 if (HeapWordsPerOop > 0) { 25.24 old_res = length * HeapWordsPerOop; 25.25 } else { 25.26 - old_res = align_size_up(length, OopsPerHeapWord)/OopsPerHeapWord; 25.27 + old_res = align_size_up((uint)length, OopsPerHeapWord)/OopsPerHeapWord; 25.28 } 25.29 + assert(res == old_res, "Inconsistency between old and new."); 25.30 #endif // ASSERT 25.31 - int res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord; 25.32 - assert(res == old_res, "Inconsistency between old and new."); 25.33 return res; 25.34 } 25.35
26.1 --- a/src/share/vm/oops/typeArrayOop.hpp Fri Oct 31 15:22:44 2014 -0700 26.2 +++ b/src/share/vm/oops/typeArrayOop.hpp Wed Nov 05 15:35:11 2014 -0800 26.3 @@ -150,7 +150,7 @@ 26.4 DEBUG_ONLY(BasicType etype = Klass::layout_helper_element_type(lh)); 26.5 assert(length <= arrayOopDesc::max_array_length(etype), "no overflow"); 26.6 26.7 - julong size_in_bytes = length; 26.8 + julong size_in_bytes = (juint)length; 26.9 size_in_bytes <<= element_shift; 26.10 size_in_bytes += instance_header_size; 26.11 julong size_in_words = ((size_in_bytes + (HeapWordSize-1)) >> LogHeapWordSize);
27.1 --- a/src/share/vm/opto/c2_globals.hpp Fri Oct 31 15:22:44 2014 -0700 27.2 +++ b/src/share/vm/opto/c2_globals.hpp Wed Nov 05 15:35:11 2014 -0800 27.3 @@ -473,6 +473,9 @@ 27.4 product(bool, DoEscapeAnalysis, true, \ 27.5 "Perform escape analysis") \ 27.6 \ 27.7 + product(double, EscapeAnalysisTimeout, 20. DEBUG_ONLY(+40.), \ 27.8 + "Abort EA when it reaches time limit (in sec)") \ 27.9 + \ 27.10 develop(bool, ExitEscapeAnalysisOnTimeout, true, \ 27.11 "Exit or throw assert in EA when it reaches time limit") \ 27.12 \
28.1 --- a/src/share/vm/opto/callGenerator.cpp Fri Oct 31 15:22:44 2014 -0700 28.2 +++ b/src/share/vm/opto/callGenerator.cpp Wed Nov 05 15:35:11 2014 -0800 28.3 @@ -862,7 +862,7 @@ 28.4 call_does_dispatch, vtable_index); // out-parameters 28.5 // We lack profiling at this call but type speculation may 28.6 // provide us with a type 28.7 - speculative_receiver_type = receiver_type->speculative_type(); 28.8 + speculative_receiver_type = (receiver_type != NULL) ? receiver_type->speculative_type() : NULL; 28.9 } 28.10 28.11 CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, true, true);
29.1 --- a/src/share/vm/opto/coalesce.cpp Fri Oct 31 15:22:44 2014 -0700 29.2 +++ b/src/share/vm/opto/coalesce.cpp Wed Nov 05 15:35:11 2014 -0800 29.3 @@ -281,9 +281,11 @@ 29.4 Block *pred = _phc._cfg.get_block_for_node(b->pred(j)); 29.5 Node *copy; 29.6 assert(!m->is_Con() || m->is_Mach(), "all Con must be Mach"); 29.7 - // Rematerialize constants instead of copying them 29.8 - if( m->is_Mach() && m->as_Mach()->is_Con() && 29.9 - m->as_Mach()->rematerialize() ) { 29.10 + // Rematerialize constants instead of copying them. 29.11 + // We do this only for immediate constants, we avoid constant table loads 29.12 + // because that will unsafely extend the live range of the constant table base. 29.13 + if (m->is_Mach() && m->as_Mach()->is_Con() && !m->as_Mach()->is_MachConstant() && 29.14 + m->as_Mach()->rematerialize()) { 29.15 copy = m->clone(); 29.16 // Insert the copy in the predecessor basic block 29.17 pred->add_inst(copy); 29.18 @@ -317,8 +319,8 @@ 29.19 assert(!m->is_Con() || m->is_Mach(), "all Con must be Mach"); 29.20 // At this point it is unsafe to extend live ranges (6550579). 29.21 // Rematerialize only constants as we do for Phi above. 29.22 - if(m->is_Mach() && m->as_Mach()->is_Con() && 29.23 - m->as_Mach()->rematerialize()) { 29.24 + if (m->is_Mach() && m->as_Mach()->is_Con() && !m->as_Mach()->is_MachConstant() && 29.25 + m->as_Mach()->rematerialize()) { 29.26 copy = m->clone(); 29.27 // Insert the copy in the basic block, just before us 29.28 b->insert_node(copy, l++);
30.1 --- a/src/share/vm/opto/doCall.cpp Fri Oct 31 15:22:44 2014 -0700 30.2 +++ b/src/share/vm/opto/doCall.cpp Wed Nov 05 15:35:11 2014 -0800 30.3 @@ -799,10 +799,16 @@ 30.4 // each arm of the Phi. If I know something clever about the exceptions 30.5 // I'm loading the class from, I can replace the LoadKlass with the 30.6 // klass constant for the exception oop. 30.7 - if( ex_node->is_Phi() ) { 30.8 - ex_klass_node = new (C) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); 30.9 - for( uint i = 1; i < ex_node->req(); i++ ) { 30.10 - Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() ); 30.11 + if (ex_node->is_Phi()) { 30.12 + ex_klass_node = new (C) PhiNode(ex_node->in(0), TypeKlassPtr::OBJECT); 30.13 + for (uint i = 1; i < ex_node->req(); i++) { 30.14 + Node* ex_in = ex_node->in(i); 30.15 + if (ex_in == top() || ex_in == NULL) { 30.16 + // This path was not taken. 30.17 + ex_klass_node->init_req(i, top()); 30.18 + continue; 30.19 + } 30.20 + Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes()); 30.21 Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); 30.22 ex_klass_node->init_req( i, k ); 30.23 }
31.1 --- a/src/share/vm/opto/escape.cpp Fri Oct 31 15:22:44 2014 -0700 31.2 +++ b/src/share/vm/opto/escape.cpp Wed Nov 05 15:35:11 2014 -0800 31.3 @@ -37,6 +37,8 @@ 31.4 31.5 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) : 31.6 _nodes(C->comp_arena(), C->unique(), C->unique(), NULL), 31.7 + _in_worklist(C->comp_arena()), 31.8 + _next_pidx(0), 31.9 _collecting(true), 31.10 _verify(false), 31.11 _compile(C), 31.12 @@ -124,13 +126,19 @@ 31.13 if (C->root() != NULL) { 31.14 ideal_nodes.push(C->root()); 31.15 } 31.16 + // Processed ideal nodes are unique on ideal_nodes list 31.17 + // but several ideal nodes are mapped to the phantom_obj. 31.18 + // To avoid duplicated entries on the following worklists 31.19 + // add the phantom_obj only once to them. 31.20 + ptnodes_worklist.append(phantom_obj); 31.21 + java_objects_worklist.append(phantom_obj); 31.22 for( uint next = 0; next < ideal_nodes.size(); ++next ) { 31.23 Node* n = ideal_nodes.at(next); 31.24 // Create PointsTo nodes and add them to Connection Graph. Called 31.25 // only once per ideal node since ideal_nodes is Unique_Node list. 31.26 add_node_to_connection_graph(n, &delayed_worklist); 31.27 PointsToNode* ptn = ptnode_adr(n->_idx); 31.28 - if (ptn != NULL) { 31.29 + if (ptn != NULL && ptn != phantom_obj) { 31.30 ptnodes_worklist.append(ptn); 31.31 if (ptn->is_JavaObject()) { 31.32 java_objects_worklist.append(ptn->as_JavaObject()); 31.33 @@ -414,7 +422,7 @@ 31.34 } 31.35 case Op_CreateEx: { 31.36 // assume that all exception objects globally escape 31.37 - add_java_object(n, PointsToNode::GlobalEscape); 31.38 + map_ideal_node(n, phantom_obj); 31.39 break; 31.40 } 31.41 case Op_LoadKlass: 31.42 @@ -1065,13 +1073,8 @@ 31.43 // on graph complexity. Observed 8 passes in jvm2008 compiler.compiler. 31.44 // Set limit to 20 to catch situation when something did go wrong and 31.45 // bailout Escape Analysis. 31.46 - // Also limit build time to 30 sec (60 in debug VM). 31.47 + // Also limit build time to 20 sec (60 in debug VM), EscapeAnalysisTimeout flag. 31.48 #define CG_BUILD_ITER_LIMIT 20 31.49 -#ifdef ASSERT 31.50 -#define CG_BUILD_TIME_LIMIT 60.0 31.51 -#else 31.52 -#define CG_BUILD_TIME_LIMIT 30.0 31.53 -#endif 31.54 31.55 // Propagate GlobalEscape and ArgEscape escape states and check that 31.56 // we still have non-escaping objects. The method pushs on _worklist 31.57 @@ -1082,12 +1085,13 @@ 31.58 // Now propagate references to all JavaObject nodes. 31.59 int java_objects_length = java_objects_worklist.length(); 31.60 elapsedTimer time; 31.61 + bool timeout = false; 31.62 int new_edges = 1; 31.63 int iterations = 0; 31.64 do { 31.65 while ((new_edges > 0) && 31.66 - (iterations++ < CG_BUILD_ITER_LIMIT) && 31.67 - (time.seconds() < CG_BUILD_TIME_LIMIT)) { 31.68 + (iterations++ < CG_BUILD_ITER_LIMIT)) { 31.69 + double start_time = time.seconds(); 31.70 time.start(); 31.71 new_edges = 0; 31.72 // Propagate references to phantom_object for nodes pushed on _worklist 31.73 @@ -1096,7 +1100,26 @@ 31.74 for (int next = 0; next < java_objects_length; ++next) { 31.75 JavaObjectNode* ptn = java_objects_worklist.at(next); 31.76 new_edges += add_java_object_edges(ptn, true); 31.77 + 31.78 +#define SAMPLE_SIZE 4 31.79 + if ((next % SAMPLE_SIZE) == 0) { 31.80 + // Each 4 iterations calculate how much time it will take 31.81 + // to complete graph construction. 31.82 + time.stop(); 31.83 + double stop_time = time.seconds(); 31.84 + double time_per_iter = (stop_time - start_time) / (double)SAMPLE_SIZE; 31.85 + double time_until_end = time_per_iter * (double)(java_objects_length - next); 31.86 + if ((start_time + time_until_end) >= EscapeAnalysisTimeout) { 31.87 + timeout = true; 31.88 + break; // Timeout 31.89 + } 31.90 + start_time = stop_time; 31.91 + time.start(); 31.92 + } 31.93 +#undef SAMPLE_SIZE 31.94 + 31.95 } 31.96 + if (timeout) break; 31.97 if (new_edges > 0) { 31.98 // Update escape states on each iteration if graph was updated. 31.99 if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { 31.100 @@ -1104,9 +1127,12 @@ 31.101 } 31.102 } 31.103 time.stop(); 31.104 + if (time.seconds() >= EscapeAnalysisTimeout) { 31.105 + timeout = true; 31.106 + break; 31.107 + } 31.108 } 31.109 - if ((iterations < CG_BUILD_ITER_LIMIT) && 31.110 - (time.seconds() < CG_BUILD_TIME_LIMIT)) { 31.111 + if ((iterations < CG_BUILD_ITER_LIMIT) && !timeout) { 31.112 time.start(); 31.113 // Find fields which have unknown value. 31.114 int fields_length = oop_fields_worklist.length(); 31.115 @@ -1119,18 +1145,21 @@ 31.116 } 31.117 } 31.118 time.stop(); 31.119 + if (time.seconds() >= EscapeAnalysisTimeout) { 31.120 + timeout = true; 31.121 + break; 31.122 + } 31.123 } else { 31.124 new_edges = 0; // Bailout 31.125 } 31.126 } while (new_edges > 0); 31.127 31.128 // Bailout if passed limits. 31.129 - if ((iterations >= CG_BUILD_ITER_LIMIT) || 31.130 - (time.seconds() >= CG_BUILD_TIME_LIMIT)) { 31.131 + if ((iterations >= CG_BUILD_ITER_LIMIT) || timeout) { 31.132 Compile* C = _compile; 31.133 if (C->log() != NULL) { 31.134 C->log()->begin_elem("connectionGraph_bailout reason='reached "); 31.135 - C->log()->text("%s", (iterations >= CG_BUILD_ITER_LIMIT) ? "iterations" : "time"); 31.136 + C->log()->text("%s", timeout ? "time" : "iterations"); 31.137 C->log()->end_elem(" limit'"); 31.138 } 31.139 assert(ExitEscapeAnalysisOnTimeout, err_msg_res("infinite EA connection graph build (%f sec, %d iterations) with %d nodes and worklist size %d", 31.140 @@ -1147,7 +1176,6 @@ 31.141 #endif 31.142 31.143 #undef CG_BUILD_ITER_LIMIT 31.144 -#undef CG_BUILD_TIME_LIMIT 31.145 31.146 // Find fields initialized by NULL for non-escaping Allocations. 31.147 int non_escaped_length = non_escaped_worklist.length(); 31.148 @@ -1271,8 +1299,8 @@ 31.149 } 31.150 } 31.151 } 31.152 - while(_worklist.length() > 0) { 31.153 - PointsToNode* use = _worklist.pop(); 31.154 + for (int l = 0; l < _worklist.length(); l++) { 31.155 + PointsToNode* use = _worklist.at(l); 31.156 if (PointsToNode::is_base_use(use)) { 31.157 // Add reference from jobj to field and from field to jobj (field's base). 31.158 use = PointsToNode::get_use_node(use)->as_Field(); 31.159 @@ -1319,6 +1347,8 @@ 31.160 add_field_uses_to_worklist(use->as_Field()); 31.161 } 31.162 } 31.163 + _worklist.clear(); 31.164 + _in_worklist.Reset(); 31.165 return new_edges; 31.166 } 31.167 31.168 @@ -1898,7 +1928,7 @@ 31.169 return; 31.170 } 31.171 Compile* C = _compile; 31.172 - ptadr = new (C->comp_arena()) LocalVarNode(C, n, es); 31.173 + ptadr = new (C->comp_arena()) LocalVarNode(this, n, es); 31.174 _nodes.at_put(n->_idx, ptadr); 31.175 } 31.176 31.177 @@ -1909,7 +1939,7 @@ 31.178 return; 31.179 } 31.180 Compile* C = _compile; 31.181 - ptadr = new (C->comp_arena()) JavaObjectNode(C, n, es); 31.182 + ptadr = new (C->comp_arena()) JavaObjectNode(this, n, es); 31.183 _nodes.at_put(n->_idx, ptadr); 31.184 } 31.185 31.186 @@ -1925,7 +1955,7 @@ 31.187 es = PointsToNode::GlobalEscape; 31.188 } 31.189 Compile* C = _compile; 31.190 - FieldNode* field = new (C->comp_arena()) FieldNode(C, n, es, offset, is_oop); 31.191 + FieldNode* field = new (C->comp_arena()) FieldNode(this, n, es, offset, is_oop); 31.192 _nodes.at_put(n->_idx, field); 31.193 } 31.194 31.195 @@ -1939,7 +1969,7 @@ 31.196 return; 31.197 } 31.198 Compile* C = _compile; 31.199 - ptadr = new (C->comp_arena()) ArraycopyNode(C, n, es); 31.200 + ptadr = new (C->comp_arena()) ArraycopyNode(this, n, es); 31.201 _nodes.at_put(n->_idx, ptadr); 31.202 // Add edge from arraycopy node to source object. 31.203 (void)add_edge(ptadr, src); 31.204 @@ -2839,6 +2869,13 @@ 31.205 continue; 31.206 } 31.207 } 31.208 + 31.209 + const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); 31.210 + if (t == NULL) 31.211 + continue; // not a TypeOopPtr 31.212 + if (!t->klass_is_exact()) 31.213 + continue; // not an unique type 31.214 + 31.215 if (alloc->is_Allocate()) { 31.216 // Set the scalar_replaceable flag for allocation 31.217 // so it could be eliminated. 31.218 @@ -2857,10 +2894,7 @@ 31.219 // - not determined to be ineligible by escape analysis 31.220 set_map(alloc, n); 31.221 set_map(n, alloc); 31.222 - const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); 31.223 - if (t == NULL) 31.224 - continue; // not a TypeOopPtr 31.225 - const TypeOopPtr* tinst = t->cast_to_exactness(true)->is_oopptr()->cast_to_instance_id(ni); 31.226 + const TypeOopPtr* tinst = t->cast_to_instance_id(ni); 31.227 igvn->hash_delete(n); 31.228 igvn->set_type(n, tinst); 31.229 n->raise_bottom_type(tinst);
32.1 --- a/src/share/vm/opto/escape.hpp Fri Oct 31 15:22:44 2014 -0700 32.2 +++ b/src/share/vm/opto/escape.hpp Wed Nov 05 15:35:11 2014 -0800 32.3 @@ -125,6 +125,8 @@ 32.4 class FieldNode; 32.5 class ArraycopyNode; 32.6 32.7 +class ConnectionGraph; 32.8 + 32.9 // ConnectionGraph nodes 32.10 class PointsToNode : public ResourceObj { 32.11 GrowableArray<PointsToNode*> _edges; // List of nodes this node points to 32.12 @@ -137,6 +139,7 @@ 32.13 32.14 Node* const _node; // Ideal node corresponding to this PointsTo node. 32.15 const int _idx; // Cached ideal node's _idx 32.16 + const uint _pidx; // Index of this node 32.17 32.18 public: 32.19 typedef enum { 32.20 @@ -165,17 +168,9 @@ 32.21 } NodeFlags; 32.22 32.23 32.24 - PointsToNode(Compile *C, Node* n, EscapeState es, NodeType type): 32.25 - _edges(C->comp_arena(), 2, 0, NULL), 32.26 - _uses (C->comp_arena(), 2, 0, NULL), 32.27 - _node(n), 32.28 - _idx(n->_idx), 32.29 - _type((u1)type), 32.30 - _escape((u1)es), 32.31 - _fields_escape((u1)es), 32.32 - _flags(ScalarReplaceable) { 32.33 - assert(n != NULL && es != UnknownEscape, "sanity"); 32.34 - } 32.35 + inline PointsToNode(ConnectionGraph* CG, Node* n, EscapeState es, NodeType type); 32.36 + 32.37 + uint pidx() const { return _pidx; } 32.38 32.39 Node* ideal_node() const { return _node; } 32.40 int idx() const { return _idx; } 32.41 @@ -243,14 +238,14 @@ 32.42 32.43 class LocalVarNode: public PointsToNode { 32.44 public: 32.45 - LocalVarNode(Compile *C, Node* n, EscapeState es): 32.46 - PointsToNode(C, n, es, LocalVar) {} 32.47 + LocalVarNode(ConnectionGraph *CG, Node* n, EscapeState es): 32.48 + PointsToNode(CG, n, es, LocalVar) {} 32.49 }; 32.50 32.51 class JavaObjectNode: public PointsToNode { 32.52 public: 32.53 - JavaObjectNode(Compile *C, Node* n, EscapeState es): 32.54 - PointsToNode(C, n, es, JavaObject) { 32.55 + JavaObjectNode(ConnectionGraph *CG, Node* n, EscapeState es): 32.56 + PointsToNode(CG, n, es, JavaObject) { 32.57 if (es > NoEscape) 32.58 set_scalar_replaceable(false); 32.59 } 32.60 @@ -262,8 +257,8 @@ 32.61 const bool _is_oop; // Field points to object 32.62 bool _has_unknown_base; // Has phantom_object base 32.63 public: 32.64 - FieldNode(Compile *C, Node* n, EscapeState es, int offs, bool is_oop): 32.65 - PointsToNode(C, n, es, Field), 32.66 + FieldNode(ConnectionGraph *CG, Node* n, EscapeState es, int offs, bool is_oop): 32.67 + PointsToNode(CG, n, es, Field), 32.68 _offset(offs), _is_oop(is_oop), 32.69 _has_unknown_base(false) {} 32.70 32.71 @@ -284,8 +279,8 @@ 32.72 32.73 class ArraycopyNode: public PointsToNode { 32.74 public: 32.75 - ArraycopyNode(Compile *C, Node* n, EscapeState es): 32.76 - PointsToNode(C, n, es, Arraycopy) {} 32.77 + ArraycopyNode(ConnectionGraph *CG, Node* n, EscapeState es): 32.78 + PointsToNode(CG, n, es, Arraycopy) {} 32.79 }; 32.80 32.81 // Iterators for PointsTo node's edges: 32.82 @@ -323,11 +318,14 @@ 32.83 32.84 32.85 class ConnectionGraph: public ResourceObj { 32.86 + friend class PointsToNode; 32.87 private: 32.88 GrowableArray<PointsToNode*> _nodes; // Map from ideal nodes to 32.89 // ConnectionGraph nodes. 32.90 32.91 GrowableArray<PointsToNode*> _worklist; // Nodes to be processed 32.92 + VectorSet _in_worklist; 32.93 + uint _next_pidx; 32.94 32.95 bool _collecting; // Indicates whether escape information 32.96 // is still being collected. If false, 32.97 @@ -353,6 +351,8 @@ 32.98 } 32.99 uint nodes_size() const { return _nodes.length(); } 32.100 32.101 + uint next_pidx() { return _next_pidx++; } 32.102 + 32.103 // Add nodes to ConnectionGraph. 32.104 void add_local_var(Node* n, PointsToNode::EscapeState es); 32.105 void add_java_object(Node* n, PointsToNode::EscapeState es); 32.106 @@ -396,15 +396,26 @@ 32.107 int add_java_object_edges(JavaObjectNode* jobj, bool populate_worklist); 32.108 32.109 // Put node on worklist if it is (or was) not there. 32.110 - void add_to_worklist(PointsToNode* pt) { 32.111 - _worklist.push(pt); 32.112 - return; 32.113 + inline void add_to_worklist(PointsToNode* pt) { 32.114 + PointsToNode* ptf = pt; 32.115 + uint pidx_bias = 0; 32.116 + if (PointsToNode::is_base_use(pt)) { 32.117 + // Create a separate entry in _in_worklist for a marked base edge 32.118 + // because _worklist may have an entry for a normal edge pointing 32.119 + // to the same node. To separate them use _next_pidx as bias. 32.120 + ptf = PointsToNode::get_use_node(pt)->as_Field(); 32.121 + pidx_bias = _next_pidx; 32.122 + } 32.123 + if (!_in_worklist.test_set(ptf->pidx() + pidx_bias)) { 32.124 + _worklist.append(pt); 32.125 + } 32.126 } 32.127 32.128 // Put on worklist all uses of this node. 32.129 - void add_uses_to_worklist(PointsToNode* pt) { 32.130 - for (UseIterator i(pt); i.has_next(); i.next()) 32.131 - _worklist.push(i.get()); 32.132 + inline void add_uses_to_worklist(PointsToNode* pt) { 32.133 + for (UseIterator i(pt); i.has_next(); i.next()) { 32.134 + add_to_worklist(i.get()); 32.135 + } 32.136 } 32.137 32.138 // Put on worklist all field's uses and related field nodes. 32.139 @@ -517,8 +528,8 @@ 32.140 } 32.141 // Helper functions 32.142 bool is_oop_field(Node* n, int offset, bool* unsafe); 32.143 - static Node* get_addp_base(Node *addp); 32.144 - static Node* find_second_addp(Node* addp, Node* n); 32.145 + static Node* get_addp_base(Node *addp); 32.146 + static Node* find_second_addp(Node* addp, Node* n); 32.147 // offset of a field reference 32.148 int address_offset(Node* adr, PhaseTransform *phase); 32.149 32.150 @@ -587,4 +598,17 @@ 32.151 #endif 32.152 }; 32.153 32.154 +inline PointsToNode::PointsToNode(ConnectionGraph *CG, Node* n, EscapeState es, NodeType type): 32.155 + _edges(CG->_compile->comp_arena(), 2, 0, NULL), 32.156 + _uses (CG->_compile->comp_arena(), 2, 0, NULL), 32.157 + _node(n), 32.158 + _idx(n->_idx), 32.159 + _pidx(CG->next_pidx()), 32.160 + _type((u1)type), 32.161 + _escape((u1)es), 32.162 + _fields_escape((u1)es), 32.163 + _flags(ScalarReplaceable) { 32.164 + assert(n != NULL && es != UnknownEscape, "sanity"); 32.165 +} 32.166 + 32.167 #endif // SHARE_VM_OPTO_ESCAPE_HPP
33.1 --- a/src/share/vm/prims/whitebox.cpp Fri Oct 31 15:22:44 2014 -0700 33.2 +++ b/src/share/vm/prims/whitebox.cpp Wed Nov 05 15:35:11 2014 -0800 33.3 @@ -331,7 +331,36 @@ 33.4 } 33.5 WB_END 33.6 33.7 +WB_ENTRY(jboolean, WB_NMTChangeTrackingLevel(JNIEnv* env)) 33.8 + // Test that we can downgrade NMT levels but not upgrade them. 33.9 + if (MemTracker::tracking_level() == NMT_off) { 33.10 + MemTracker::transition_to(NMT_off); 33.11 + return MemTracker::tracking_level() == NMT_off; 33.12 + } else { 33.13 + assert(MemTracker::tracking_level() == NMT_detail, "Should start out as detail tracking"); 33.14 + MemTracker::transition_to(NMT_summary); 33.15 + assert(MemTracker::tracking_level() == NMT_summary, "Should be summary now"); 33.16 33.17 + // Can't go to detail once NMT is set to summary. 33.18 + MemTracker::transition_to(NMT_detail); 33.19 + assert(MemTracker::tracking_level() == NMT_summary, "Should still be summary now"); 33.20 + 33.21 + // Shutdown sets tracking level to minimal. 33.22 + MemTracker::shutdown(); 33.23 + assert(MemTracker::tracking_level() == NMT_minimal, "Should be minimal now"); 33.24 + 33.25 + // Once the tracking level is minimal, we cannot increase to summary. 33.26 + // The code ignores this request instead of asserting because if the malloc site 33.27 + // table overflows in another thread, it tries to change the code to summary. 33.28 + MemTracker::transition_to(NMT_summary); 33.29 + assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now"); 33.30 + 33.31 + // Really can never go up to detail, verify that the code would never do this. 33.32 + MemTracker::transition_to(NMT_detail); 33.33 + assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now"); 33.34 + return MemTracker::tracking_level() == NMT_minimal; 33.35 + } 33.36 +WB_END 33.37 #endif // INCLUDE_NMT 33.38 33.39 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) { 33.40 @@ -936,6 +965,7 @@ 33.41 {CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory }, 33.42 {CC"NMTOverflowHashBucket", CC"(J)V", (void*)&WB_NMTOverflowHashBucket}, 33.43 {CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported}, 33.44 + {CC"NMTChangeTrackingLevel", CC"()Z", (void*)&WB_NMTChangeTrackingLevel}, 33.45 #endif // INCLUDE_NMT 33.46 {CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll }, 33.47 {CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Executable;Z)I",
34.1 --- a/src/share/vm/runtime/advancedThresholdPolicy.cpp Fri Oct 31 15:22:44 2014 -0700 34.2 +++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp Wed Nov 05 15:35:11 2014 -0800 34.3 @@ -451,7 +451,7 @@ 34.4 if (should_create_mdo(mh(), level)) { 34.5 create_mdo(mh, thread); 34.6 } 34.7 - if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) { 34.8 + if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) { 34.9 CompLevel next_level = call_event(mh(), level); 34.10 if (next_level != level) { 34.11 compile(mh, InvocationEntryBci, next_level, thread); 34.12 @@ -475,7 +475,7 @@ 34.13 CompLevel next_osr_level = loop_event(imh(), level); 34.14 CompLevel max_osr_level = (CompLevel)imh->highest_osr_comp_level(); 34.15 // At the very least compile the OSR version 34.16 - if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_osr_level != level) { 34.17 + if (!CompileBroker::compilation_is_in_queue(imh) && (next_osr_level != level)) { 34.18 compile(imh, bci, next_osr_level, thread); 34.19 } 34.20 34.21 @@ -509,7 +509,7 @@ 34.22 nm->make_not_entrant(); 34.23 } 34.24 } 34.25 - if (!CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) { 34.26 + if (!CompileBroker::compilation_is_in_queue(mh)) { 34.27 // Fix up next_level if necessary to avoid deopts 34.28 if (next_level == CompLevel_limited_profile && max_osr_level == CompLevel_full_profile) { 34.29 next_level = CompLevel_full_profile; 34.30 @@ -521,7 +521,7 @@ 34.31 } else { 34.32 cur_level = comp_level(imh()); 34.33 next_level = call_event(imh(), cur_level); 34.34 - if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_level != cur_level) { 34.35 + if (!CompileBroker::compilation_is_in_queue(imh) && (next_level != cur_level)) { 34.36 compile(imh, InvocationEntryBci, next_level, thread); 34.37 } 34.38 }
35.1 --- a/src/share/vm/runtime/arguments.cpp Fri Oct 31 15:22:44 2014 -0700 35.2 +++ b/src/share/vm/runtime/arguments.cpp Wed Nov 05 15:35:11 2014 -0800 35.3 @@ -66,7 +66,7 @@ 35.4 #endif // INCLUDE_ALL_GCS 35.5 35.6 // Note: This is a special bug reporting site for the JVM 35.7 -#define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" 35.8 +#define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp" 35.9 #define DEFAULT_JAVA_LAUNCHER "generic" 35.10 35.11 // Disable options not supported in this release, with a warning if they 35.12 @@ -300,6 +300,7 @@ 35.13 { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 35.14 { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) }, 35.15 { "AutoShutdownNMT", JDK_Version::jdk(9), JDK_Version::jdk(10) }, 35.16 + { "CompilationRepeat", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 35.17 #ifdef PRODUCT 35.18 { "DesiredMethodLimit", 35.19 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, 35.20 @@ -1144,6 +1145,32 @@ 35.21 } 35.22 } 35.23 35.24 +/** 35.25 + * Returns the minimum number of compiler threads needed to run the JVM. The following 35.26 + * configurations are possible. 35.27 + * 35.28 + * 1) The JVM is build using an interpreter only. As a result, the minimum number of 35.29 + * compiler threads is 0. 35.30 + * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As 35.31 + * a result, either C1 or C2 is used, so the minimum number of compiler threads is 1. 35.32 + * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However, 35.33 + * the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only 35.34 + * C1 can be used, so the minimum number of compiler threads is 1. 35.35 + * 4) The JVM is build using the compilers and tiered compilation is enabled. The option 35.36 + * 'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result, 35.37 + * the minimum number of compiler threads is 2. 35.38 + */ 35.39 +int Arguments::get_min_number_of_compiler_threads() { 35.40 +#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) 35.41 + return 0; // case 1 35.42 +#else 35.43 + if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) { 35.44 + return 1; // case 2 or case 3 35.45 + } 35.46 + return 2; // case 4 (tiered) 35.47 +#endif 35.48 +} 35.49 + 35.50 #if INCLUDE_ALL_GCS 35.51 static void disable_adaptive_size_policy(const char* collector_name) { 35.52 if (UseAdaptiveSizePolicy) { 35.53 @@ -2461,6 +2488,12 @@ 35.54 status &= verify_interval(SafepointPollOffset, 0, os::vm_page_size() - BytesPerWord, "SafepointPollOffset"); 35.55 #endif 35.56 35.57 + int min_number_of_compiler_threads = get_min_number_of_compiler_threads(); 35.58 + // The default CICompilerCount's value is CI_COMPILER_COUNT. 35.59 + assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number"); 35.60 + // Check the minimum number of compiler threads 35.61 + status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount"); 35.62 + 35.63 return status; 35.64 } 35.65 35.66 @@ -3617,6 +3650,8 @@ 35.67 bool settings_file_specified = false; 35.68 bool needs_hotspotrc_warning = false; 35.69 35.70 + ArgumentsExt::process_options(args); 35.71 + 35.72 const char* flags_file; 35.73 int index; 35.74 for (index = 0; index < args->nOptions; index++) {
36.1 --- a/src/share/vm/runtime/arguments.hpp Fri Oct 31 15:22:44 2014 -0700 36.2 +++ b/src/share/vm/runtime/arguments.hpp Wed Nov 05 15:35:11 2014 -0800 36.3 @@ -327,6 +327,7 @@ 36.4 36.5 // Tiered 36.6 static void set_tiered_flags(); 36.7 + static int get_min_number_of_compiler_threads(); 36.8 // CMS/ParNew garbage collectors 36.9 static void set_parnew_gc_flags(); 36.10 static void set_cms_and_parnew_gc_flags();
37.1 --- a/src/share/vm/runtime/arguments_ext.hpp Fri Oct 31 15:22:44 2014 -0700 37.2 +++ b/src/share/vm/runtime/arguments_ext.hpp Wed Nov 05 15:35:11 2014 -0800 37.3 @@ -34,6 +34,7 @@ 37.4 static inline bool check_gc_consistency_user(); 37.5 static inline bool check_gc_consistency_ergo(); 37.6 static inline bool check_vm_args_consistency(); 37.7 + static void process_options(const JavaVMInitArgs* args) {} 37.8 }; 37.9 37.10 void ArgumentsExt::select_gc_ergonomically() {
38.1 --- a/src/share/vm/runtime/globals.cpp Fri Oct 31 15:22:44 2014 -0700 38.2 +++ b/src/share/vm/runtime/globals.cpp Wed Nov 05 15:35:11 2014 -0800 38.3 @@ -243,6 +243,11 @@ 38.4 return is_unlocked_ext(); 38.5 } 38.6 38.7 +void Flag::unlock_diagnostic() { 38.8 + assert(is_diagnostic(), "sanity"); 38.9 + _flags = Flags(_flags & ~KIND_DIAGNOSTIC); 38.10 +} 38.11 + 38.12 // Get custom message for this locked flag, or return NULL if 38.13 // none is available. 38.14 void Flag::get_locked_message(char* buf, int buflen) const {
39.1 --- a/src/share/vm/runtime/globals.hpp Fri Oct 31 15:22:44 2014 -0700 39.2 +++ b/src/share/vm/runtime/globals.hpp Wed Nov 05 15:35:11 2014 -0800 39.3 @@ -313,6 +313,8 @@ 39.4 bool is_writeable_ext() const; 39.5 bool is_external_ext() const; 39.6 39.7 + void unlock_diagnostic(); 39.8 + 39.9 void get_locked_message(char*, int) const; 39.10 void get_locked_message_ext(char*, int) const; 39.11
40.1 --- a/src/share/vm/runtime/os.hpp Fri Oct 31 15:22:44 2014 -0700 40.2 +++ b/src/share/vm/runtime/os.hpp Wed Nov 05 15:35:11 2014 -0800 40.3 @@ -214,13 +214,14 @@ 40.4 40.5 // Interface for detecting multiprocessor system 40.6 static inline bool is_MP() { 40.7 -#if !INCLUDE_NMT 40.8 - assert(_processor_count > 0, "invalid processor count"); 40.9 - return _processor_count > 1 || AssumeMP; 40.10 -#else 40.11 - // NMT needs atomic operations before this initialization. 40.12 - return true; 40.13 -#endif 40.14 + // During bootstrap if _processor_count is not yet initialized 40.15 + // we claim to be MP as that is safest. If any platform has a 40.16 + // stub generator that might be triggered in this phase and for 40.17 + // which being declared MP when in fact not, is a problem - then 40.18 + // the bootstrap routine for the stub generator needs to check 40.19 + // the processor count directly and leave the bootstrap routine 40.20 + // in place until called after initialization has ocurred. 40.21 + return (_processor_count != 1) || AssumeMP; 40.22 } 40.23 static julong available_memory(); 40.24 static julong physical_memory();
41.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp Fri Oct 31 15:22:44 2014 -0700 41.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp Wed Nov 05 15:35:11 2014 -0800 41.3 @@ -239,7 +239,7 @@ 41.4 if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) { 41.5 return; 41.6 } 41.7 - if (!CompileBroker::compilation_is_in_queue(mh, bci)) { 41.8 + if (!CompileBroker::compilation_is_in_queue(mh)) { 41.9 if (PrintTieredEvents) { 41.10 print_event(COMPILE, mh, mh, bci, level); 41.11 } 41.12 @@ -378,7 +378,7 @@ 41.13 // Handle the invocation event. 41.14 void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh, 41.15 CompLevel level, nmethod* nm, JavaThread* thread) { 41.16 - if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) { 41.17 + if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) { 41.18 CompLevel next_level = call_event(mh(), level); 41.19 if (next_level != level) { 41.20 compile(mh, InvocationEntryBci, next_level, thread); 41.21 @@ -391,8 +391,8 @@ 41.22 void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh, 41.23 int bci, CompLevel level, nmethod* nm, JavaThread* thread) { 41.24 // If the method is already compiling, quickly bail out. 41.25 - if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, bci)) { 41.26 - // Use loop event as an opportinity to also check there's been 41.27 + if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) { 41.28 + // Use loop event as an opportunity to also check there's been 41.29 // enough calls. 41.30 CompLevel cur_level = comp_level(mh()); 41.31 CompLevel next_level = call_event(mh(), cur_level);
42.1 --- a/src/share/vm/services/mallocTracker.cpp Fri Oct 31 15:22:44 2014 -0700 42.2 +++ b/src/share/vm/services/mallocTracker.cpp Wed Nov 05 15:35:11 2014 -0800 42.3 @@ -51,14 +51,6 @@ 42.4 return amount; 42.5 } 42.6 42.7 - 42.8 -void MallocMemorySnapshot::reset() { 42.9 - _tracking_header.reset(); 42.10 - for (int index = 0; index < mt_number_of_types; index ++) { 42.11 - _malloc[index].reset(); 42.12 - } 42.13 -} 42.14 - 42.15 // Make adjustment by subtracting chunks used by arenas 42.16 // from total chunks to get total free chunck size 42.17 void MallocMemorySnapshot::make_adjustment() { 42.18 @@ -116,14 +108,9 @@ 42.19 bool MallocTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) { 42.20 assert(from != NMT_off, "Can not transition from off state"); 42.21 assert(to != NMT_off, "Can not transition to off state"); 42.22 - if (from == NMT_minimal) { 42.23 - MallocMemorySummary::reset(); 42.24 - } 42.25 + assert (from != NMT_minimal, "cannot transition from minimal state"); 42.26 42.27 - if (to == NMT_detail) { 42.28 - assert(from == NMT_minimal || from == NMT_summary, "Just check"); 42.29 - return MallocSiteTable::initialize(); 42.30 - } else if (from == NMT_detail) { 42.31 + if (from == NMT_detail) { 42.32 assert(to == NMT_minimal || to == NMT_summary, "Just check"); 42.33 MallocSiteTable::shutdown(); 42.34 }
43.1 --- a/src/share/vm/services/mallocTracker.hpp Fri Oct 31 15:22:44 2014 -0700 43.2 +++ b/src/share/vm/services/mallocTracker.hpp Wed Nov 05 15:35:11 2014 -0800 43.3 @@ -51,14 +51,6 @@ 43.4 DEBUG_ONLY(_peak_size = 0;) 43.5 } 43.6 43.7 - // Reset counters 43.8 - void reset() { 43.9 - _size = 0; 43.10 - _count = 0; 43.11 - DEBUG_ONLY(_peak_size = 0;) 43.12 - DEBUG_ONLY(_peak_count = 0;) 43.13 - } 43.14 - 43.15 inline void allocate(size_t sz) { 43.16 Atomic::add(1, (volatile MemoryCounterType*)&_count); 43.17 if (sz > 0) { 43.18 @@ -124,11 +116,6 @@ 43.19 _arena.resize(sz); 43.20 } 43.21 43.22 - void reset() { 43.23 - _malloc.reset(); 43.24 - _arena.reset(); 43.25 - } 43.26 - 43.27 inline size_t malloc_size() const { return _malloc.size(); } 43.28 inline size_t malloc_count() const { return _malloc.count();} 43.29 inline size_t arena_size() const { return _arena.size(); } 43.30 @@ -176,8 +163,6 @@ 43.31 return s->by_type(mtThreadStack)->malloc_count(); 43.32 } 43.33 43.34 - void reset(); 43.35 - 43.36 void copy_to(MallocMemorySnapshot* s) { 43.37 s->_tracking_header = _tracking_header; 43.38 for (int index = 0; index < mt_number_of_types; index ++) { 43.39 @@ -240,11 +225,6 @@ 43.40 return as_snapshot()->malloc_overhead()->size(); 43.41 } 43.42 43.43 - // Reset all counters to zero 43.44 - static void reset() { 43.45 - as_snapshot()->reset(); 43.46 - } 43.47 - 43.48 static MallocMemorySnapshot* as_snapshot() { 43.49 return (MallocMemorySnapshot*)_snapshot; 43.50 }
44.1 --- a/src/share/vm/services/memBaseline.hpp Fri Oct 31 15:22:44 2014 -0700 44.2 +++ b/src/share/vm/services/memBaseline.hpp Wed Nov 05 15:35:11 2014 -0800 44.3 @@ -90,10 +90,6 @@ 44.4 _class_count(0) { 44.5 } 44.6 44.7 - ~MemBaseline() { 44.8 - reset(); 44.9 - } 44.10 - 44.11 bool baseline(bool summaryOnly = true); 44.12 44.13 BaselineType baseline_type() const { return _baseline_type; } 44.14 @@ -169,8 +165,7 @@ 44.15 // reset the baseline for reuse 44.16 void reset() { 44.17 _baseline_type = Not_baselined; 44.18 - _malloc_memory_snapshot.reset(); 44.19 - _virtual_memory_snapshot.reset(); 44.20 + // _malloc_memory_snapshot and _virtual_memory_snapshot are copied over. 44.21 _class_count = 0; 44.22 44.23 _malloc_sites.clear();
45.1 --- a/src/share/vm/services/memReporter.hpp Fri Oct 31 15:22:44 2014 -0700 45.2 +++ b/src/share/vm/services/memReporter.hpp Wed Nov 05 15:35:11 2014 -0800 45.3 @@ -96,20 +96,6 @@ 45.4 size_t _class_count; 45.5 45.6 public: 45.7 - // Report summary tracking data from global snapshots directly. 45.8 - // This constructor is used for final reporting and hs_err reporting. 45.9 - MemSummaryReporter(MallocMemorySnapshot* malloc_snapshot, 45.10 - VirtualMemorySnapshot* vm_snapshot, outputStream* output, 45.11 - size_t class_count = 0, size_t scale = K) : 45.12 - MemReporterBase(output, scale), 45.13 - _malloc_snapshot(malloc_snapshot), 45.14 - _vm_snapshot(vm_snapshot) { 45.15 - if (class_count == 0) { 45.16 - _class_count = InstanceKlass::number_of_instance_classes(); 45.17 - } else { 45.18 - _class_count = class_count; 45.19 - } 45.20 - } 45.21 // This constructor is for normal reporting from a recent baseline. 45.22 MemSummaryReporter(MemBaseline& baseline, outputStream* output, 45.23 size_t scale = K) : MemReporterBase(output, scale),
46.1 --- a/src/share/vm/services/memTracker.cpp Fri Oct 31 15:22:44 2014 -0700 46.2 +++ b/src/share/vm/services/memTracker.cpp Wed Nov 05 15:35:11 2014 -0800 46.3 @@ -144,11 +144,9 @@ 46.4 } 46.5 46.6 46.7 -// Shutdown can only be issued via JCmd, and NMT JCmd is serialized 46.8 -// by lock 46.9 +// Shutdown can only be issued via JCmd, and NMT JCmd is serialized by lock 46.10 void MemTracker::shutdown() { 46.11 - // We can only shutdown NMT to minimal tracking level if it is 46.12 - // ever on. 46.13 + // We can only shutdown NMT to minimal tracking level if it is ever on. 46.14 if (tracking_level () > NMT_minimal) { 46.15 transition_to(NMT_minimal); 46.16 } 46.17 @@ -157,45 +155,36 @@ 46.18 bool MemTracker::transition_to(NMT_TrackingLevel level) { 46.19 NMT_TrackingLevel current_level = tracking_level(); 46.20 46.21 + assert(level != NMT_off || current_level == NMT_off, "Cannot transition NMT to off"); 46.22 + 46.23 if (current_level == level) { 46.24 return true; 46.25 } else if (current_level > level) { 46.26 - // Downgrade tracking level, we want to lower the tracking 46.27 - // level first 46.28 + // Downgrade tracking level, we want to lower the tracking level first 46.29 _tracking_level = level; 46.30 // Make _tracking_level visible immediately. 46.31 OrderAccess::fence(); 46.32 VirtualMemoryTracker::transition(current_level, level); 46.33 MallocTracker::transition(current_level, level); 46.34 - 46.35 - if (level == NMT_minimal) _baseline.reset(); 46.36 } else { 46.37 - VirtualMemoryTracker::transition(current_level, level); 46.38 - MallocTracker::transition(current_level, level); 46.39 - 46.40 - _tracking_level = level; 46.41 - // Make _tracking_level visible immediately. 46.42 - OrderAccess::fence(); 46.43 + // Upgrading tracking level is not supported and has never been supported. 46.44 + // Allocating and deallocating malloc tracking structures is not thread safe and 46.45 + // leads to inconsistencies unless a lot coarser locks are added. 46.46 } 46.47 - 46.48 return true; 46.49 } 46.50 46.51 -void MemTracker::final_report(outputStream* output) { 46.52 - assert(output != NULL, "No output stream"); 46.53 - if (tracking_level() >= NMT_summary) { 46.54 - MallocMemorySnapshot* malloc_memory_snapshot = 46.55 - MallocMemorySummary::as_snapshot(); 46.56 - malloc_memory_snapshot->make_adjustment(); 46.57 - 46.58 - VirtualMemorySnapshot* virtual_memory_snapshot = 46.59 - VirtualMemorySummary::as_snapshot(); 46.60 - 46.61 - MemSummaryReporter rptr(malloc_memory_snapshot, 46.62 - virtual_memory_snapshot, output); 46.63 - rptr.report(); 46.64 - // shutdown NMT, the data no longer accurate 46.65 - shutdown(); 46.66 +void MemTracker::report(bool summary_only, outputStream* output) { 46.67 + assert(output != NULL, "No output stream"); 46.68 + MemBaseline baseline; 46.69 + if (baseline.baseline(summary_only)) { 46.70 + if (summary_only) { 46.71 + MemSummaryReporter rpt(baseline, output); 46.72 + rpt.report(); 46.73 + } else { 46.74 + MemDetailReporter rpt(baseline, output); 46.75 + rpt.report(); 46.76 + } 46.77 } 46.78 } 46.79
47.1 --- a/src/share/vm/services/memTracker.hpp Fri Oct 31 15:22:44 2014 -0700 47.2 +++ b/src/share/vm/services/memTracker.hpp Wed Nov 05 15:35:11 2014 -0800 47.3 @@ -70,6 +70,7 @@ 47.4 static inline void release_thread_stack(void* addr, size_t size) { } 47.5 47.6 static void final_report(outputStream*) { } 47.7 + static void error_report(outputStream*) { } 47.8 }; 47.9 47.10 #else 47.11 @@ -270,13 +271,20 @@ 47.12 // other tools. 47.13 static inline Mutex* query_lock() { return _query_lock; } 47.14 47.15 - // Make a final report and shutdown. 47.16 - // This function generates summary report without creating snapshots, 47.17 - // to avoid additional memory allocation. It uses native memory summary 47.18 - // counters, and makes adjustment to them, once the adjustment is made, 47.19 - // the counters are no longer accurate. As the result, this function 47.20 - // should only be used for final reporting before shutting down. 47.21 - static void final_report(outputStream*); 47.22 + // Make a final report or report for hs_err file. 47.23 + static void error_report(outputStream* output) { 47.24 + if (tracking_level() >= NMT_summary) { 47.25 + report(true, output); // just print summary for error case. 47.26 + } 47.27 + } 47.28 + 47.29 + static void final_report(outputStream* output) { 47.30 + NMT_TrackingLevel level = tracking_level(); 47.31 + if (level >= NMT_summary) { 47.32 + report(level == NMT_summary, output); 47.33 + } 47.34 + } 47.35 + 47.36 47.37 // Stored baseline 47.38 static inline MemBaseline& get_baseline() { 47.39 @@ -291,6 +299,7 @@ 47.40 47.41 private: 47.42 static NMT_TrackingLevel init_tracking_level(); 47.43 + static void report(bool summary_only, outputStream* output); 47.44 47.45 private: 47.46 // Tracking level
48.1 --- a/src/share/vm/services/virtualMemoryTracker.cpp Fri Oct 31 15:22:44 2014 -0700 48.2 +++ b/src/share/vm/services/virtualMemoryTracker.cpp Wed Nov 05 15:35:11 2014 -0800 48.3 @@ -443,26 +443,28 @@ 48.4 bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) { 48.5 assert(_reserved_regions != NULL, "Sanity check"); 48.6 ThreadCritical tc; 48.7 - LinkedListNode<ReservedMemoryRegion>* head = _reserved_regions->head(); 48.8 - while (head != NULL) { 48.9 - const ReservedMemoryRegion* rgn = head->peek(); 48.10 - if (!walker->do_allocation_site(rgn)) { 48.11 - return false; 48.12 + // Check that the _reserved_regions haven't been deleted. 48.13 + if (_reserved_regions != NULL) { 48.14 + LinkedListNode<ReservedMemoryRegion>* head = _reserved_regions->head(); 48.15 + while (head != NULL) { 48.16 + const ReservedMemoryRegion* rgn = head->peek(); 48.17 + if (!walker->do_allocation_site(rgn)) { 48.18 + return false; 48.19 + } 48.20 + head = head->next(); 48.21 } 48.22 - head = head->next(); 48.23 - } 48.24 + } 48.25 return true; 48.26 } 48.27 48.28 // Transition virtual memory tracking level. 48.29 bool VirtualMemoryTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) { 48.30 - if (from == NMT_minimal) { 48.31 - assert(to == NMT_summary || to == NMT_detail, "Just check"); 48.32 - VirtualMemorySummary::reset(); 48.33 - } else if (to == NMT_minimal) { 48.34 + assert (from != NMT_minimal, "cannot convert from the lowest tracking level to anything"); 48.35 + if (to == NMT_minimal) { 48.36 assert(from == NMT_summary || from == NMT_detail, "Just check"); 48.37 // Clean up virtual memory tracking data structures. 48.38 ThreadCritical tc; 48.39 + // Check for potential race with other thread calling transition 48.40 if (_reserved_regions != NULL) { 48.41 delete _reserved_regions; 48.42 _reserved_regions = NULL;
49.1 --- a/src/share/vm/services/virtualMemoryTracker.hpp Fri Oct 31 15:22:44 2014 -0700 49.2 +++ b/src/share/vm/services/virtualMemoryTracker.hpp Wed Nov 05 15:35:11 2014 -0800 49.3 @@ -62,11 +62,6 @@ 49.4 _committed -= sz; 49.5 } 49.6 49.7 - void reset() { 49.8 - _reserved = 0; 49.9 - _committed = 0; 49.10 - } 49.11 - 49.12 inline size_t reserved() const { return _reserved; } 49.13 inline size_t committed() const { return _committed; } 49.14 }; 49.15 @@ -123,12 +118,6 @@ 49.16 return amount; 49.17 } 49.18 49.19 - inline void reset() { 49.20 - for (int index = 0; index < mt_number_of_types; index ++) { 49.21 - _virtual_memory[index].reset(); 49.22 - } 49.23 - } 49.24 - 49.25 void copy_to(VirtualMemorySnapshot* s) { 49.26 for (int index = 0; index < mt_number_of_types; index ++) { 49.27 s->_virtual_memory[index] = _virtual_memory[index]; 49.28 @@ -174,10 +163,6 @@ 49.29 as_snapshot()->copy_to(s); 49.30 } 49.31 49.32 - static inline void reset() { 49.33 - as_snapshot()->reset(); 49.34 - } 49.35 - 49.36 static VirtualMemorySnapshot* as_snapshot() { 49.37 return (VirtualMemorySnapshot*)_snapshot; 49.38 }
50.1 --- a/src/share/vm/utilities/debug.cpp Fri Oct 31 15:22:44 2014 -0700 50.2 +++ b/src/share/vm/utilities/debug.cpp Wed Nov 05 15:35:11 2014 -0800 50.3 @@ -266,17 +266,19 @@ 50.4 "native memory for metadata", 50.5 "shared read only space", 50.6 "shared read write space", 50.7 - "shared miscellaneous data space" 50.8 + "shared miscellaneous data space", 50.9 + "shared miscellaneous code space" 50.10 }; 50.11 static const char* flag[] = { 50.12 "Metaspace", 50.13 "SharedReadOnlySize", 50.14 "SharedReadWriteSize", 50.15 - "SharedMiscDataSize" 50.16 + "SharedMiscDataSize", 50.17 + "SharedMiscCodeSize" 50.18 }; 50.19 50.20 warning("\nThe %s is not large enough\n" 50.21 - "to preload requested classes. Use -XX:%s=\n" 50.22 + "to preload requested classes. Use -XX:%s=<size>\n" 50.23 "to increase the initial size of %s.\n", 50.24 name[shared_space], flag[shared_space], name[shared_space]); 50.25 exit(2);
51.1 --- a/src/share/vm/utilities/debug.hpp Fri Oct 31 15:22:44 2014 -0700 51.2 +++ b/src/share/vm/utilities/debug.hpp Wed Nov 05 15:35:11 2014 -0800 51.3 @@ -246,7 +246,8 @@ 51.4 SharedPermGen, 51.5 SharedReadOnly, 51.6 SharedReadWrite, 51.7 - SharedMiscData 51.8 + SharedMiscData, 51.9 + SharedMiscCode 51.10 }; 51.11 51.12 void report_out_of_shared_space(SharedSpaceType space_type);
52.1 --- a/src/share/vm/utilities/vmError.cpp Fri Oct 31 15:22:44 2014 -0700 52.2 +++ b/src/share/vm/utilities/vmError.cpp Wed Nov 05 15:35:11 2014 -0800 52.3 @@ -774,7 +774,7 @@ 52.4 52.5 STEP(228, "(Native Memory Tracking)" ) 52.6 if (_verbose) { 52.7 - MemTracker::final_report(st); 52.8 + MemTracker::error_report(st); 52.9 } 52.10 52.11 STEP(230, "" )
53.1 --- a/test/Makefile Fri Oct 31 15:22:44 2014 -0700 53.2 +++ b/test/Makefile Wed Nov 05 15:35:11 2014 -0800 53.3 @@ -1,5 +1,5 @@ 53.4 # 53.5 -# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. 53.6 +# Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. 53.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.8 # 53.9 # This code is free software; you can redistribute it and/or modify it 53.10 @@ -23,14 +23,36 @@ 53.11 # 53.12 53.13 # 53.14 -# Makefile to run various jdk tests 53.15 +# Makefile to run various hotspot tests 53.16 # 53.17 53.18 GETMIXEDPATH=echo 53.19 53.20 -# Get OS/ARCH specifics 53.21 -OSNAME = $(shell uname -s) 53.22 -ifeq ($(OSNAME), SunOS) 53.23 +# Utilities used 53.24 +AWK = awk 53.25 +CAT = cat 53.26 +CD = cd 53.27 +CHMOD = chmod 53.28 +CP = cp 53.29 +CUT = cut 53.30 +DIRNAME = dirname 53.31 +ECHO = echo 53.32 +EGREP = egrep 53.33 +EXPAND = expand 53.34 +FIND = find 53.35 +MKDIR = mkdir 53.36 +PWD = pwd 53.37 +SED = sed 53.38 +SORT = sort 53.39 +TEE = tee 53.40 +UNAME = uname 53.41 +UNIQ = uniq 53.42 +WC = wc 53.43 +ZIP = zip 53.44 + 53.45 +# Get OS name from uname (Cygwin inexplicably adds _NT-5.1) 53.46 +UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_) 53.47 +ifeq ($(UNAME_S), SunOS) 53.48 PLATFORM = solaris 53.49 SLASH_JAVA = /java 53.50 ARCH = $(shell uname -p) 53.51 @@ -38,7 +60,7 @@ 53.52 ARCH=i586 53.53 endif 53.54 endif 53.55 -ifeq ($(OSNAME), Linux) 53.56 +ifeq ($(UNAME_S), Linux) 53.57 PLATFORM = linux 53.58 SLASH_JAVA = /java 53.59 ARCH = $(shell uname -m) 53.60 @@ -46,7 +68,7 @@ 53.61 ARCH = i586 53.62 endif 53.63 endif 53.64 -ifeq ($(OSNAME), Darwin) 53.65 +ifeq ($(UNAME_S), Darwin) 53.66 PLATFORM = bsd 53.67 SLASH_JAVA = /java 53.68 ARCH = $(shell uname -m) 53.69 @@ -54,7 +76,7 @@ 53.70 ARCH = i586 53.71 endif 53.72 endif 53.73 -ifeq ($(findstring BSD,$(OSNAME)), BSD) 53.74 +ifeq ($(findstring BSD,$(UNAME_S)), BSD) 53.75 PLATFORM = bsd 53.76 SLASH_JAVA = /java 53.77 ARCH = $(shell uname -m) 53.78 @@ -63,12 +85,12 @@ 53.79 endif 53.80 endif 53.81 ifeq ($(PLATFORM),) 53.82 - # detect wether we're running in MKS or cygwin 53.83 - ifeq ($(OSNAME), Windows_NT) # MKS 53.84 + # detect whether we're running in MKS or cygwin 53.85 + ifeq ($(UNAME_S), Windows_NT) # MKS 53.86 GETMIXEDPATH=dosname -s 53.87 endif 53.88 - ifeq ($(findstring CYGWIN,$(OSNAME)), CYGWIN) 53.89 - GETMIXEDPATH=cygpath -m -s 53.90 + ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN) 53.91 + GETMIXEDPATH=cygpath -m 53.92 endif 53.93 PLATFORM = windows 53.94 SLASH_JAVA = J: 53.95 @@ -92,13 +114,6 @@ 53.96 SLASH_JAVA = $(ALT_SLASH_JAVA) 53.97 endif 53.98 53.99 -# Utilities used 53.100 -CD = cd 53.101 -CP = cp 53.102 -ECHO = echo 53.103 -MKDIR = mkdir 53.104 -ZIP = zip 53.105 - 53.106 # Root of this test area (important to use full paths in some places) 53.107 TEST_ROOT := $(shell pwd) 53.108 53.109 @@ -136,21 +151,82 @@ 53.110 endif 53.111 53.112 # How to create the test bundle (pass or fail, we want to create this) 53.113 -BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \ 53.114 - && $(CD) $(ABS_TEST_OUTPUT_DIR) \ 53.115 - && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) 53.116 -BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) 53.117 +# Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed. 53.118 +ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \ 53.119 + && $(CD) $(ABS_TEST_OUTPUT_DIR) \ 53.120 + && $(CHMOD) -R a+r . \ 53.121 + && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) 53.122 + 53.123 +# important results files 53.124 +SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt") 53.125 +STATS_TXT_NAME = Stats.txt 53.126 +STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)") 53.127 +RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt") 53.128 +PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt") 53.129 +FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt") 53.130 +EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt") 53.131 + 53.132 +TESTEXIT = \ 53.133 + if [ ! -s $(EXITCODE) ] ; then \ 53.134 + $(ECHO) "ERROR: EXITCODE file not filled in."; \ 53.135 + $(ECHO) "1" > $(EXITCODE); \ 53.136 + fi ; \ 53.137 + testExitCode=`$(CAT) $(EXITCODE)`; \ 53.138 + $(ECHO) "EXIT CODE: $${testExitCode}"; \ 53.139 + exit $${testExitCode} 53.140 + 53.141 +BUNDLE_UP_AND_EXIT = \ 53.142 +( \ 53.143 + jtregExitCode=$$? && \ 53.144 + _summary="$(SUMMARY_TXT)"; \ 53.145 + $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \ 53.146 + $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \ 53.147 + if [ -r "$${_summary}" ] ; then \ 53.148 + $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \ 53.149 + $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \ 53.150 + $(EGREP) ' Passed\.' $(RUNLIST) \ 53.151 + | $(EGREP) -v ' Error\.' \ 53.152 + | $(EGREP) -v ' Failed\.' > $(PASSLIST); \ 53.153 + ( $(EGREP) ' Failed\.' $(RUNLIST); \ 53.154 + $(EGREP) ' Error\.' $(RUNLIST); \ 53.155 + $(EGREP) -v ' Passed\.' $(RUNLIST) ) \ 53.156 + | $(SORT) | $(UNIQ) > $(FAILLIST); \ 53.157 + if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \ 53.158 + $(EXPAND) $(FAILLIST) \ 53.159 + | $(CUT) -d' ' -f1 \ 53.160 + | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \ 53.161 + if [ $${jtregExitCode} = 0 ] ; then \ 53.162 + jtregExitCode=1; \ 53.163 + fi; \ 53.164 + fi; \ 53.165 + runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ 53.166 + passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ 53.167 + failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ 53.168 + exclc="FIXME CODETOOLS-7900176"; \ 53.169 + $(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc}" \ 53.170 + >> $(STATS_TXT); \ 53.171 + else \ 53.172 + $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \ 53.173 + fi; \ 53.174 + if [ -f $(STATS_TXT) ] ; then \ 53.175 + $(CAT) $(STATS_TXT); \ 53.176 + fi; \ 53.177 + $(ZIP_UP_RESULTS) ; \ 53.178 + $(TESTEXIT) \ 53.179 +) 53.180 53.181 ################################################################ 53.182 53.183 # Default make rule (runs jtreg_tests) 53.184 -all: jtreg_tests 53.185 +all: hotspot_all 53.186 @$(ECHO) "Testing completed successfully" 53.187 53.188 -# Support "hotspot_" prefixed test make targets too 53.189 -# The hotspot_% targets are for example invoked by the top level Makefile 53.190 +# Support "hotspot_" prefixed test make targets (too) 53.191 +# The hotspot_% targets are used by the top level Makefile 53.192 +# Unless explicitly defined below, hotspot_<x> is interpreted as a jtreg test group name 53.193 hotspot_%: 53.194 - $(MAKE) $* 53.195 + $(ECHO) "Running tests: $@" 53.196 + $(MAKE) -j 1 TEST_SELECTION=":$@" UNIQUE_DIR=$@ jtreg_tests; 53.197 53.198 # Prep for output 53.199 prep: clean 53.200 @@ -168,41 +244,64 @@ 53.201 53.202 # Expect JT_HOME to be set for jtreg tests. (home for jtreg) 53.203 ifndef JT_HOME 53.204 - JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg 53.205 -endif 53.206 -ifdef JPRT_JTREG_HOME 53.207 - JT_HOME = $(JPRT_JTREG_HOME) 53.208 + JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg 53.209 + ifdef JPRT_JTREG_HOME 53.210 + JT_HOME = $(JPRT_JTREG_HOME) 53.211 + endif 53.212 endif 53.213 53.214 -# Expect JPRT to set TESTDIRS to the jtreg test dirs 53.215 -JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof 53.216 +# When called from JPRT the TESTDIRS variable is set to the jtreg tests to run 53.217 ifdef TESTDIRS 53.218 - JTREG_TESTDIRS = $(TESTDIRS) 53.219 + TEST_SELECTION = $(TESTDIRS) 53.220 +endif 53.221 + 53.222 +ifdef CONCURRENCY 53.223 + EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY) 53.224 endif 53.225 53.226 # Default JTREG to run 53.227 JTREG = $(JT_HOME)/bin/jtreg 53.228 53.229 +# Only run automatic tests 53.230 +JTREG_BASIC_OPTIONS += -a 53.231 +# Report details on all failed or error tests, times too 53.232 +JTREG_BASIC_OPTIONS += -v:fail,error,time 53.233 +# Retain all files for failing tests 53.234 +JTREG_BASIC_OPTIONS += -retain:fail,error 53.235 +# Ignore tests are not run and completely silent about it 53.236 +JTREG_IGNORE_OPTION = -ignore:quiet 53.237 +JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION) 53.238 +# Add any extra options 53.239 +JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) 53.240 +# Set other vm and test options 53.241 +JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_OPTIONS:%=-vmoption:%) $(JAVA_VM_ARGS:%=-vmoption:%) 53.242 + 53.243 # Option to tell jtreg to not run tests marked with "ignore" 53.244 ifeq ($(PLATFORM), windows) 53.245 JTREG_KEY_OPTION = -k:!ignore 53.246 else 53.247 JTREG_KEY_OPTION = -k:\!ignore 53.248 endif 53.249 +JTREG_BASIC_OPTIONS += $(JTREG_KEY_OPTION) 53.250 + 53.251 +# Make sure jtreg exists 53.252 +$(JTREG): $(JT_HOME) 53.253 53.254 -#EXTRA_JTREG_OPTIONS = 53.255 - 53.256 -jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 53.257 - $(JTREG) -a -v:fail,error \ 53.258 - $(JTREG_KEY_OPTION) \ 53.259 - $(EXTRA_JTREG_OPTIONS) \ 53.260 - -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ 53.261 - -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ 53.262 - -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ 53.263 - $(JAVA_OPTIONS:%=-vmoption:%) \ 53.264 - $(JTREG_TESTDIRS) \ 53.265 - || $(BUNDLE_UP_FAILED) 53.266 - $(BUNDLE_UP) 53.267 +jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) 53.268 + ( \ 53.269 + ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \ 53.270 + export JT_HOME; \ 53.271 + $(shell $(GETMIXEDPATH) "$(JTREG)") \ 53.272 + $(JTREG_BASIC_OPTIONS) \ 53.273 + -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \ 53.274 + -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \ 53.275 + -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ 53.276 + $(JTREG_EXCLUSIONS) \ 53.277 + $(JTREG_TEST_OPTIONS) \ 53.278 + $(TEST_SELECTION) \ 53.279 + ) ; \ 53.280 + $(BUNDLE_UP_AND_EXIT) \ 53.281 + ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT) 53.282 53.283 PHONY_LIST += jtreg_tests 53.284 53.285 @@ -210,7 +309,7 @@ 53.286 53.287 # clienttest (make sure various basic java client options work) 53.288 53.289 -clienttest: prep $(PRODUCT_HOME) 53.290 +hotspot_clienttest clienttest: prep $(PRODUCT_HOME) 53.291 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 53.292 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 53.293 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 53.294 @@ -218,73 +317,38 @@ 53.295 $(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa 53.296 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump 53.297 53.298 -PHONY_LIST += clienttest 53.299 +PHONY_LIST += hotspot_clienttest clienttest 53.300 + 53.301 +################################################################ 53.302 + 53.303 +# minimaltest (make sure various basic java minimal options work) 53.304 + 53.305 +hotspot_minimaltest minimaltest: prep $(PRODUCT_HOME) 53.306 + $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 53.307 + $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 53.308 + $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 53.309 + 53.310 +PHONY_LIST += hotspot_minimaltest minimaltest 53.311 53.312 ################################################################ 53.313 53.314 # servertest (make sure various basic java server options work) 53.315 53.316 -servertest: prep $(PRODUCT_HOME) 53.317 +hotspot_servertest servertest: prep $(PRODUCT_HOME) 53.318 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 53.319 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 53.320 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 53.321 53.322 -PHONY_LIST += servertest 53.323 +PHONY_LIST += hotspot_servertest servertest 53.324 53.325 ################################################################ 53.326 53.327 # internalvmtests (run internal unit tests inside the VM) 53.328 53.329 -internalvmtests: prep $(PRODUCT_HOME) 53.330 +hotspot_internalvmtests internalvmtests: prep $(PRODUCT_HOME) 53.331 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -XX:+ExecuteInternalVMTests -version 53.332 53.333 -PHONY_LIST += internalvmtests 53.334 - 53.335 -################################################################ 53.336 - 53.337 -# wbapitest (make sure the whitebox testing api classes work 53.338 - 53.339 -wbapitest: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 53.340 - $(JTREG) -a -v:fail,error \ 53.341 - $(JTREG_KEY_OPTION) \ 53.342 - $(EXTRA_JTREG_OPTIONS) \ 53.343 - -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ 53.344 - -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ 53.345 - -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ 53.346 - $(JAVA_OPTIONS:%=-vmoption:%) \ 53.347 - $(shell $(GETMIXEDPATH) "$(TEST_ROOT)")/sanity \ 53.348 - || $(BUNDLE_UP_FAILED) 53.349 - $(BUNDLE_UP) 53.350 - 53.351 -PHONY_LIST += wbapitest 53.352 - 53.353 -################################################################ 53.354 - 53.355 -# packtest 53.356 - 53.357 -# Expect JPRT to set JPRT_PACKTEST_HOME. 53.358 -PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest 53.359 -ifdef JPRT_PACKTEST_HOME 53.360 - PACKTEST_HOME = $(JPRT_PACKTEST_HOME) 53.361 -endif 53.362 - 53.363 -#EXTRA_PACKTEST_OPTIONS = 53.364 - 53.365 -packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME) 53.366 - ( $(CD) $(PACKTEST_HOME) && \ 53.367 - $(PACKTEST_HOME)/ptest \ 53.368 - -t "$(PRODUCT_HOME)" \ 53.369 - $(PACKTEST_STRESS_OPTION) \ 53.370 - $(EXTRA_PACKTEST_OPTIONS) \ 53.371 - -W $(ABS_TEST_OUTPUT_DIR) \ 53.372 - $(JAVA_OPTIONS:%=-J %) \ 53.373 - ) || $(BUNDLE_UP_FAILED) 53.374 - $(BUNDLE_UP) 53.375 - 53.376 -packtest_stress: PACKTEST_STRESS_OPTION=-s 53.377 -packtest_stress: packtest 53.378 - 53.379 -PHONY_LIST += packtest packtest_stress 53.380 +PHONY_LIST += hotspot_internalvmtests internalvmtests 53.381 53.382 ################################################################ 53.383 53.384 @@ -292,4 +356,3 @@ 53.385 .PHONY: all clean prep $(PHONY_LIST) 53.386 53.387 ################################################################ 53.388 -
54.1 --- a/test/TEST.groups Fri Oct 31 15:22:44 2014 -0700 54.2 +++ b/test/TEST.groups Wed Nov 05 15:35:11 2014 -0800 54.3 @@ -125,6 +125,27 @@ 54.4 -:needs_jdk 54.5 54.6 54.7 +# When called from top level the test suites use the hotspot_ prefix 54.8 +hotspot_wbapitest = \ 54.9 + sanity/ 54.10 + 54.11 +hotspot_compiler = \ 54.12 + sanity/ExecuteInternalVMTests.java 54.13 + 54.14 +hotspot_gc = \ 54.15 + sanity/ExecuteInternalVMTests.java 54.16 + 54.17 +hotspot_runtime = \ 54.18 + sanity/ExecuteInternalVMTests.java 54.19 + 54.20 +hotspot_serviceability = \ 54.21 + sanity/ExecuteInternalVMTests.java 54.22 + 54.23 +hotspot_all = \ 54.24 + :hotspot_compiler \ 54.25 + :hotspot_gc \ 54.26 + :hotspot_runtime \ 54.27 + :hotspot_serviceability 54.28 # Tests that require compact3 API's 54.29 # 54.30 needs_compact3 = \
55.1 --- a/test/compiler/ciReplay/common.sh Fri Oct 31 15:22:44 2014 -0700 55.2 +++ b/test/compiler/ciReplay/common.sh Wed Nov 05 15:35:11 2014 -0800 55.3 @@ -213,7 +213,7 @@ 55.4 -XX:VMThreadStackSize=512 \ 55.5 -XX:CompilerThreadStackSize=512 \ 55.6 -XX:ParallelGCThreads=1 \ 55.7 - -XX:CICompilerCount=1 \ 55.8 + -XX:CICompilerCount=2 \ 55.9 -Xcomp \ 55.10 -XX:CICrashAt=1 \ 55.11 -XX:+CreateMinidumpOnCrash \
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 56.2 +++ b/test/compiler/exceptions/CatchInlineExceptions.java Wed Nov 05 15:35:11 2014 -0800 56.3 @@ -0,0 +1,81 @@ 56.4 +/* 56.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 56.7 + * 56.8 + * This code is free software; you can redistribute it and/or modify it 56.9 + * under the terms of the GNU General Public License version 2 only, as 56.10 + * published by the Free Software Foundation. 56.11 + * 56.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 56.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 56.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 56.15 + * version 2 for more details (a copy is included in the LICENSE file that 56.16 + * accompanied this code). 56.17 + * 56.18 + * You should have received a copy of the GNU General Public License version 56.19 + * 2 along with this work; if not, write to the Free Software Foundation, 56.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 56.21 + * 56.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 56.23 + * or visit www.oracle.com if you need additional information or have any 56.24 + * questions. 56.25 + */ 56.26 + 56.27 +/** 56.28 + * @test 56.29 + * @bug 8059299 56.30 + * @summary assert(adr_type != NULL) failed: expecting TypeKlassPtr 56.31 + * @run main/othervm -Xbatch CatchInlineExceptions 56.32 + */ 56.33 + 56.34 +class Exception1 extends Exception {}; 56.35 +class Exception2 extends Exception {}; 56.36 + 56.37 +public class CatchInlineExceptions { 56.38 + private static int counter0; 56.39 + private static int counter1; 56.40 + private static int counter2; 56.41 + private static int counter; 56.42 + 56.43 + static void foo(int i) throws Exception { 56.44 + if ((i & 1023) == 2) { 56.45 + counter0++; 56.46 + throw new Exception2(); 56.47 + } 56.48 + } 56.49 + 56.50 + static void test(int i) throws Exception { 56.51 + try { 56.52 + foo(i); 56.53 + } 56.54 + catch (Exception e) { 56.55 + if (e instanceof Exception1) { 56.56 + counter1++; 56.57 + } else if (e instanceof Exception2) { 56.58 + counter2++; 56.59 + } 56.60 + counter++; 56.61 + throw e; 56.62 + } 56.63 + } 56.64 + 56.65 + public static void main(String[] args) throws Throwable { 56.66 + for (int i = 0; i < 15000; i++) { 56.67 + try { 56.68 + test(i); 56.69 + } catch (Exception e) { 56.70 + // expected 56.71 + } 56.72 + } 56.73 + if (counter1 != 0) { 56.74 + throw new RuntimeException("Failed: counter1(" + counter1 + ") != 0"); 56.75 + } 56.76 + if (counter2 != counter0) { 56.77 + throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter0(" + counter0 + ")"); 56.78 + } 56.79 + if (counter2 != counter) { 56.80 + throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter(" + counter + ")"); 56.81 + } 56.82 + System.out.println("TEST PASSED"); 56.83 + } 56.84 +}
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 57.2 +++ b/test/compiler/jsr292/NullConstantReceiver.java Wed Nov 05 15:35:11 2014 -0800 57.3 @@ -0,0 +1,62 @@ 57.4 +/* 57.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 57.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 57.7 + * 57.8 + * This code is free software; you can redistribute it and/or modify it 57.9 + * under the terms of the GNU General Public License version 2 only, as 57.10 + * published by the Free Software Foundation. 57.11 + * 57.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 57.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 57.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 57.15 + * version 2 for more details (a copy is included in the LICENSE file that 57.16 + * accompanied this code). 57.17 + * 57.18 + * You should have received a copy of the GNU General Public License version 57.19 + * 2 along with this work; if not, write to the Free Software Foundation, 57.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 57.21 + * 57.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 57.23 + * or visit www.oracle.com if you need additional information or have any 57.24 + * questions. 57.25 + */ 57.26 + 57.27 +/** 57.28 + * @test 57.29 + * @bug 8059556 57.30 + * @run main/othervm -Xbatch NullConstantReceiver 57.31 + */ 57.32 + 57.33 +import java.lang.invoke.MethodHandle; 57.34 +import java.lang.invoke.MethodHandles; 57.35 +import java.lang.invoke.MethodType; 57.36 + 57.37 +public class NullConstantReceiver { 57.38 + static final MethodHandle target; 57.39 + static { 57.40 + try { 57.41 + target = MethodHandles.lookup().findVirtual(NullConstantReceiver.class, "test", MethodType.methodType(void.class)); 57.42 + } catch (ReflectiveOperationException e) { 57.43 + throw new Error(e); 57.44 + } 57.45 + } 57.46 + 57.47 + public void test() {} 57.48 + 57.49 + static void run() throws Throwable { 57.50 + target.invokeExact((NullConstantReceiver) null); 57.51 + } 57.52 + 57.53 + public static void main(String[] args) throws Throwable { 57.54 + for (int i = 0; i<15000; i++) { 57.55 + try { 57.56 + run(); 57.57 + } catch (NullPointerException e) { 57.58 + // expected 57.59 + continue; 57.60 + } 57.61 + throw new AssertionError("NPE wasn't thrown"); 57.62 + } 57.63 + System.out.println("TEST PASSED"); 57.64 + } 57.65 +}
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 58.2 +++ b/test/compiler/jsr292/VMAnonymousClasses.java Wed Nov 05 15:35:11 2014 -0800 58.3 @@ -0,0 +1,125 @@ 58.4 +/* 58.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 58.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 58.7 + * 58.8 + * This code is free software; you can redistribute it and/or modify it 58.9 + * under the terms of the GNU General Public License version 2 only, as 58.10 + * published by the Free Software Foundation. 58.11 + * 58.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 58.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 58.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 58.15 + * version 2 for more details (a copy is included in the LICENSE file that 58.16 + * accompanied this code). 58.17 + * 58.18 + * You should have received a copy of the GNU General Public License version 58.19 + * 2 along with this work; if not, write to the Free Software Foundation, 58.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 58.21 + * 58.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 58.23 + * or visit www.oracle.com if you need additional information or have any 58.24 + * questions. 58.25 + */ 58.26 + 58.27 +/** 58.28 + * @test 58.29 + * @bug 8058828 58.30 + * @run main/bootclasspath -Xbatch VMAnonymousClasses 58.31 + */ 58.32 + 58.33 +import jdk.internal.org.objectweb.asm.ClassWriter; 58.34 +import jdk.internal.org.objectweb.asm.MethodVisitor; 58.35 +import jdk.internal.org.objectweb.asm.Opcodes; 58.36 +import sun.misc.Unsafe; 58.37 + 58.38 +import java.lang.invoke.ConstantCallSite; 58.39 +import java.lang.invoke.MethodHandle; 58.40 +import java.lang.invoke.MethodHandles; 58.41 +import java.lang.invoke.MethodType; 58.42 +import java.lang.invoke.MutableCallSite; 58.43 +import java.lang.invoke.VolatileCallSite; 58.44 + 58.45 +public class VMAnonymousClasses { 58.46 + static final String TEST_METHOD_NAME = "constant"; 58.47 + 58.48 + static final Unsafe UNSAFE = Unsafe.getUnsafe(); 58.49 + 58.50 + static int getConstantPoolSize(byte[] classFile) { 58.51 + // The first few bytes: 58.52 + // u4 magic; 58.53 + // u2 minor_version; 58.54 + // u2 major_version; 58.55 + // u2 constant_pool_count; 58.56 + return ((classFile[8] & 0xFF) << 8) | (classFile[9] & 0xFF); 58.57 + } 58.58 + 58.59 + static void test(Object value) throws ReflectiveOperationException { 58.60 + System.out.printf("Test: %s", value != null ? value.getClass() : "null"); 58.61 + 58.62 + ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); 58.63 + cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, "Test", null, "java/lang/Object", null); 58.64 + 58.65 + MethodVisitor mv = cw.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC, TEST_METHOD_NAME, "()Ljava/lang/Object;", null, null); 58.66 + 58.67 + String placeholder = "CONSTANT"; 58.68 + int index = cw.newConst(placeholder); 58.69 + mv.visitLdcInsn(placeholder); 58.70 + mv.visitInsn(Opcodes.ARETURN); 58.71 + 58.72 + mv.visitMaxs(0, 0); 58.73 + mv.visitEnd(); 58.74 + 58.75 + byte[] classFile = cw.toByteArray(); 58.76 + 58.77 + Object[] cpPatches = new Object[getConstantPoolSize(classFile)]; 58.78 + cpPatches[index] = value; 58.79 + 58.80 + Class<?> test = UNSAFE.defineAnonymousClass(VMAnonymousClasses.class, classFile, cpPatches); 58.81 + 58.82 + Object expectedResult = (value != null) ? value : placeholder; 58.83 + for (int i = 0; i<15000; i++) { 58.84 + Object result = test.getMethod(TEST_METHOD_NAME).invoke(null); 58.85 + if (result != expectedResult) { 58.86 + throw new AssertionError(String.format("Wrong value returned: %s != %s", value, result)); 58.87 + } 58.88 + } 58.89 + System.out.println(" PASSED"); 58.90 + } 58.91 + 58.92 + public static void main(String[] args) throws ReflectiveOperationException { 58.93 + // Objects 58.94 + test(new Object()); 58.95 + test("TEST"); 58.96 + test(new VMAnonymousClasses()); 58.97 + test(null); 58.98 + 58.99 + // Class 58.100 + test(String.class); 58.101 + 58.102 + // Arrays 58.103 + test(new boolean[0]); 58.104 + test(new byte[0]); 58.105 + test(new char[0]); 58.106 + test(new short[0]); 58.107 + test(new int[0]); 58.108 + test(new long[0]); 58.109 + test(new float[0]); 58.110 + test(new double[0]); 58.111 + test(new Object[0]); 58.112 + 58.113 + // Multi-dimensional arrays 58.114 + test(new byte[0][0]); 58.115 + test(new Object[0][0]); 58.116 + 58.117 + // MethodHandle-related 58.118 + MethodType mt = MethodType.methodType(void.class, String[].class); 58.119 + MethodHandle mh = MethodHandles.lookup().findStatic(VMAnonymousClasses.class, "main", mt); 58.120 + test(mt); 58.121 + test(mh); 58.122 + test(new ConstantCallSite(mh)); 58.123 + test(new MutableCallSite(MethodType.methodType(void.class))); 58.124 + test(new VolatileCallSite(MethodType.methodType(void.class))); 58.125 + 58.126 + System.out.println("TEST PASSED"); 58.127 + } 58.128 +}
59.1 --- a/test/compiler/membars/DekkerTest.java Fri Oct 31 15:22:44 2014 -0700 59.2 +++ b/test/compiler/membars/DekkerTest.java Wed Nov 05 15:35:11 2014 -0800 59.3 @@ -25,9 +25,9 @@ 59.4 * @test 59.5 * @bug 8007898 59.6 * @summary Incorrect optimization of Memory Barriers in Matcher::post_store_load_barrier(). 59.7 - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest 59.8 - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest 59.9 - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest 59.10 + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:-TieredCompilation -XX:+StressGCM -XX:+StressLCM DekkerTest 59.11 + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:-TieredCompilation -XX:+StressGCM -XX:+StressLCM DekkerTest 59.12 + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:-TieredCompilation -XX:+StressGCM -XX:+StressLCM DekkerTest 59.13 * @author Martin Doerr martin DOT doerr AT sap DOT com 59.14 * 59.15 * Run 3 times since the failure is intermittent.
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 60.2 +++ b/test/compiler/startup/NumCompilerThreadsCheck.java Wed Nov 05 15:35:11 2014 -0800 60.3 @@ -0,0 +1,57 @@ 60.4 +/* 60.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 60.7 + * 60.8 + * This code is free software; you can redistribute it and/or modify it 60.9 + * under the terms of the GNU General Public License version 2 only, as 60.10 + * published by the Free Software Foundation. 60.11 + * 60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 60.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 60.15 + * version 2 for more details (a copy is included in the LICENSE file that 60.16 + * accompanied this code). 60.17 + * 60.18 + * You should have received a copy of the GNU General Public License version 60.19 + * 2 along with this work; if not, write to the Free Software Foundation, 60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 60.21 + * 60.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 60.23 + * or visit www.oracle.com if you need additional information or have any 60.24 + * questions. 60.25 + */ 60.26 + 60.27 +/* 60.28 + * @test 60.29 + * @bug 8034775 60.30 + * @summary Ensures correct minimal number of compiler threads (provided by -XX:CICompilerCount=) 60.31 + * @library /testlibrary 60.32 + */ 60.33 +import com.oracle.java.testlibrary.*; 60.34 + 60.35 +public class NumCompilerThreadsCheck { 60.36 + 60.37 + public static void main(String[] args) throws Exception { 60.38 + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:CICompilerCount=-1"); 60.39 + OutputAnalyzer out = new OutputAnalyzer(pb.start()); 60.40 + 60.41 + String expectedOutput = "CICompilerCount of -1 is invalid"; 60.42 + out.shouldContain(expectedOutput); 60.43 + 60.44 + if (isZeroVm()) { 60.45 + String expectedLowWaterMarkText = "must be at least 0"; 60.46 + out.shouldContain(expectedLowWaterMarkText); 60.47 + } 60.48 + } 60.49 + 60.50 + private static boolean isZeroVm() { 60.51 + String vmName = System.getProperty("java.vm.name"); 60.52 + if (vmName == null) { 60.53 + throw new RuntimeException("No VM name"); 60.54 + } 60.55 + if (vmName.toLowerCase().contains("zero")) { 60.56 + return true; 60.57 + } 60.58 + return false; 60.59 + } 60.60 +}
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 61.2 +++ b/test/runtime/NMT/ChangeTrackingLevel.java Wed Nov 05 15:35:11 2014 -0800 61.3 @@ -0,0 +1,51 @@ 61.4 +/* 61.5 + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.7 + * 61.8 + * This code is free software; you can redistribute it and/or modify it 61.9 + * under the terms of the GNU General Public License version 2 only, as 61.10 + * published by the Free Software Foundation. 61.11 + * 61.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 61.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 61.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 61.15 + * version 2 for more details (a copy is included in the LICENSE file that 61.16 + * accompanied this code). 61.17 + * 61.18 + * You should have received a copy of the GNU General Public License version 61.19 + * 2 along with this work; if not, write to the Free Software Foundation, 61.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 61.21 + * 61.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 61.23 + * or visit www.oracle.com if you need additional information or have any 61.24 + * questions. 61.25 + */ 61.26 + 61.27 +/* 61.28 + * @test 61.29 + * @bug 8059100 61.30 + * @summary Test that you can decrease NMT tracking level but not increase it. 61.31 + * @key nmt 61.32 + * @library /testlibrary /testlibrary/whitebox 61.33 + * @build ChangeTrackingLevel 61.34 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 61.35 + * sun.hotspot.WhiteBox$WhiteBoxPermission 61.36 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ChangeTrackingLevel 61.37 + */ 61.38 + 61.39 +import com.oracle.java.testlibrary.*; 61.40 +import sun.hotspot.WhiteBox; 61.41 + 61.42 +public class ChangeTrackingLevel { 61.43 + 61.44 + public static WhiteBox wb = WhiteBox.getWhiteBox(); 61.45 + public static void main(String args[]) throws Exception { 61.46 + boolean testChangeLevel = wb.NMTChangeTrackingLevel(); 61.47 + if (testChangeLevel) { 61.48 + System.out.println("NMT level change test passed."); 61.49 + } else { 61.50 + // it also fails if the VM asserts. 61.51 + throw new RuntimeException("NMT level change test failed"); 61.52 + } 61.53 + } 61.54 +};
62.1 --- a/test/runtime/NMT/PrintNMTStatistics.java Fri Oct 31 15:22:44 2014 -0700 62.2 +++ b/test/runtime/NMT/PrintNMTStatistics.java Wed Nov 05 15:35:11 2014 -0800 62.3 @@ -1,5 +1,5 @@ 62.4 /* 62.5 - * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. 62.6 + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 62.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 62.8 * 62.9 * This code is free software; you can redistribute it and/or modify it 62.10 @@ -24,42 +24,40 @@ 62.11 /* 62.12 * @test 62.13 * @key nmt regression 62.14 - * @bug 8005936 62.15 - * @summary Make sure PrintNMTStatistics works on normal JVM exit 62.16 - * @library /testlibrary /testlibrary/whitebox 62.17 - * @build PrintNMTStatistics 62.18 - * @run main ClassFileInstaller sun.hotspot.WhiteBox 62.19 - * @run main PrintNMTStatistics 62.20 + * @bug 8005936 8058606 62.21 + * @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level 62.22 + * @library /testlibrary 62.23 */ 62.24 62.25 import com.oracle.java.testlibrary.*; 62.26 62.27 -import java.util.regex.Matcher; 62.28 -import java.util.regex.Pattern; 62.29 -import sun.hotspot.WhiteBox; 62.30 - 62.31 public class PrintNMTStatistics { 62.32 62.33 - public static void main(String args[]) throws Exception { 62.34 - 62.35 - // We start a new java process running with an argument and use WB API to ensure 62.36 - // we have data for NMT on VM exit 62.37 - if (args.length > 0) { 62.38 - return; 62.39 - } 62.40 + public static void main(String args[]) throws Exception { 62.41 62.42 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( 62.43 - "-XX:+UnlockDiagnosticVMOptions", 62.44 - "-Xbootclasspath/a:.", 62.45 - "-XX:+WhiteBoxAPI", 62.46 - "-XX:NativeMemoryTracking=summary", 62.47 - "-XX:+PrintNMTStatistics", 62.48 - "PrintNMTStatistics", 62.49 - "test"); 62.50 + "-XX:+UnlockDiagnosticVMOptions", 62.51 + "-XX:+PrintNMTStatistics", 62.52 + "-XX:NativeMemoryTracking=detail", 62.53 + "-version"); 62.54 62.55 - OutputAnalyzer output = new OutputAnalyzer(pb.start()); 62.56 - output.shouldContain("Java Heap (reserved="); 62.57 - output.shouldNotContain("error"); 62.58 - output.shouldHaveExitValue(0); 62.59 - } 62.60 + OutputAnalyzer output_detail = new OutputAnalyzer(pb.start()); 62.61 + output_detail.shouldContain("Virtual memory map:"); 62.62 + output_detail.shouldContain("Details:"); 62.63 + output_detail.shouldNotContain("error"); 62.64 + output_detail.shouldHaveExitValue(0); 62.65 + 62.66 + ProcessBuilder pb1 = ProcessTools.createJavaProcessBuilder( 62.67 + "-XX:+UnlockDiagnosticVMOptions", 62.68 + "-XX:+PrintNMTStatistics", 62.69 + "-XX:NativeMemoryTracking=summary", 62.70 + "-version"); 62.71 + 62.72 + OutputAnalyzer output_summary = new OutputAnalyzer(pb1.start()); 62.73 + output_summary.shouldContain("Java Heap (reserved="); 62.74 + output_summary.shouldNotContain("Virtual memory map:"); 62.75 + output_summary.shouldNotContain("Details:"); 62.76 + output_summary.shouldNotContain("error"); 62.77 + output_summary.shouldHaveExitValue(0); 62.78 + } 62.79 }
63.1 --- a/test/runtime/SharedArchiveFile/LimitSharedSizes.java Fri Oct 31 15:22:44 2014 -0700 63.2 +++ b/test/runtime/SharedArchiveFile/LimitSharedSizes.java Wed Nov 05 15:35:11 2014 -0800 63.3 @@ -51,9 +51,12 @@ 63.4 // Known issue, JDK-8038422 (assert() on Windows) 63.5 // new SharedSizeTestData("-XX:SharedMiscDataSize", "500k", "miscellaneous data"), 63.6 63.7 - // This will cause a VM crash; commenting out for now; see bug JDK-8038268 63.8 - // @ignore JDK-8038268 63.9 - // new SharedSizeTestData("-XX:SharedMiscCodeSize", "20k", "miscellaneous code"), 63.10 + // Too small of a misc code size should not cause a vm crash. 63.11 + // It should result in the following error message: 63.12 + // The shared miscellaneous code space is not large enough 63.13 + // to preload requested classes. Use -XX:SharedMiscCodeSize= 63.14 + // to increase the initial size of shared miscellaneous code space. 63.15 + new SharedSizeTestData("-XX:SharedMiscCodeSize", "20k", "miscellaneous code"), 63.16 63.17 // these values are larger than default ones, but should 63.18 // be acceptable and not cause failure
64.1 --- a/test/runtime/lambda-features/InvokespecialInterface.java Fri Oct 31 15:22:44 2014 -0700 64.2 +++ b/test/runtime/lambda-features/InvokespecialInterface.java Wed Nov 05 15:35:11 2014 -0800 64.3 @@ -33,11 +33,12 @@ 64.4 import java.util.function.*; 64.5 import java.util.*; 64.6 64.7 +public class InvokespecialInterface { 64.8 interface I { 64.9 default void imethod() { System.out.println("I::imethod"); } 64.10 } 64.11 64.12 -class C implements I { 64.13 +static class C implements I { 64.14 public void foo() { I.super.imethod(); } // invokespecial InterfaceMethod 64.15 public void bar() { I i = this; i.imethod(); } // invokeinterface same 64.16 public void doSomeInvokedynamic() { 64.17 @@ -48,7 +49,6 @@ 64.18 } 64.19 } 64.20 64.21 -public class InvokespecialInterface { 64.22 public static void main(java.lang.String[] unused) { 64.23 // need to create C and call I::foo() 64.24 C c = new C();
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 65.2 +++ b/test/runtime/lambda-features/TestInterfaceInit.java Wed Nov 05 15:35:11 2014 -0800 65.3 @@ -0,0 +1,87 @@ 65.4 +/* 65.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 65.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 65.7 + * 65.8 + * This code is free software; you can redistribute it and/or modify it 65.9 + * under the terms of the GNU General Public License version 2 only, as 65.10 + * published by the Free Software Foundation. 65.11 + * 65.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 65.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 65.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 65.15 + * version 2 for more details (a copy is included in the LICENSE file that 65.16 + * accompanied this code). 65.17 + * 65.18 + * You should have received a copy of the GNU General Public License version 65.19 + * 2 along with this work; if not, write to the Free Software Foundation, 65.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 65.21 + * 65.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 65.23 + * or visit www.oracle.com if you need additional information or have any 65.24 + * questions. 65.25 + * 65.26 + */ 65.27 + 65.28 +/* 65.29 + * @test 65.30 + * @bug 8034275 65.31 + * @summary [JDK 8u40] Test interface initialization: only for interfaces declaring default methods 65.32 + * @run main TestInterfaceInit 65.33 + */ 65.34 +import java.util.List; 65.35 +import java.util.Arrays; 65.36 +import java.util.ArrayList; 65.37 + 65.38 +public class TestInterfaceInit { 65.39 + 65.40 + static List<Class<?>> cInitOrder = new ArrayList<>(); 65.41 + 65.42 + // Declares a default method and initializes 65.43 + interface I { 65.44 + boolean v = TestInterfaceInit.out(I.class); 65.45 + default void x() {} 65.46 + } 65.47 + 65.48 + // Declares a default method and initializes 65.49 + interface J extends I { 65.50 + boolean v = TestInterfaceInit.out(J.class); 65.51 + default void x() {} 65.52 + } 65.53 + // No default method, does not initialize 65.54 + interface JN extends J { 65.55 + boolean v = TestInterfaceInit.out(JN.class); 65.56 + } 65.57 + 65.58 + // Declares a default method and initializes 65.59 + interface K extends I { 65.60 + boolean v = TestInterfaceInit.out(K.class); 65.61 + default void x() {} 65.62 + } 65.63 + 65.64 + // No default method, does not initialize 65.65 + interface KN extends K { 65.66 + boolean v = TestInterfaceInit.out(KN.class); 65.67 + } 65.68 + 65.69 + interface L extends JN, KN { 65.70 + boolean v = TestInterfaceInit.out(L.class); 65.71 + default void x() {} 65.72 + } 65.73 + 65.74 + public static void main(String[] args) { 65.75 + // Trigger initialization 65.76 + boolean v = L.v; 65.77 + 65.78 + List<Class<?>> expectedCInitOrder = Arrays.asList(I.class,J.class,K.class,L.class); 65.79 + if (!cInitOrder.equals(expectedCInitOrder)) { 65.80 + throw new RuntimeException(String.format("Class initialization array %s not equal to expected array %s", cInitOrder, expectedCInitOrder)); 65.81 + } 65.82 + } 65.83 + 65.84 + static boolean out(Class c) { 65.85 + System.out.println("#: initializing " + c.getName()); 65.86 + cInitOrder.add(c); 65.87 + return true; 65.88 + } 65.89 + 65.90 +}
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 66.2 +++ b/test/runtime/lambda-features/TestInterfaceOrder.java Wed Nov 05 15:35:11 2014 -0800 66.3 @@ -0,0 +1,88 @@ 66.4 +/* 66.5 + * Copyright (c) 2014, 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 +/* 66.29 + * @test 66.30 + * @bug 8034275 66.31 + * @summary [JDK 8u40] Test interface initialization order 66.32 + * @run main TestInterfaceOrder 66.33 + */ 66.34 + 66.35 +import java.util.List; 66.36 +import java.util.Arrays; 66.37 +import java.util.ArrayList; 66.38 + 66.39 +public class TestInterfaceOrder { 66.40 + static List<Class<?>> cInitOrder = new ArrayList<>(); 66.41 + 66.42 + public static void main(java.lang.String[] args) { 66.43 + //Trigger initialization 66.44 + C c = new C(); 66.45 + 66.46 + List<Class<?>> expectedCInitOrder = Arrays.asList(I.class, J.class, A.class, K.class, B.class, L.class, C.class); 66.47 + if (!cInitOrder.equals(expectedCInitOrder)) { 66.48 + throw new RuntimeException(String.format("Class initialization order %s not equal to expected order %s", cInitOrder, expectedCInitOrder)); 66.49 + } 66.50 + } 66.51 + 66.52 + interface I { 66.53 + boolean v = TestInterfaceOrder.out(I.class); 66.54 + default void i() {} 66.55 + } 66.56 + 66.57 + interface J extends I { 66.58 + boolean v = TestInterfaceOrder.out(J.class); 66.59 + default void j() {} 66.60 + } 66.61 + 66.62 + static class A implements J { 66.63 + static boolean v = TestInterfaceOrder.out(A.class); 66.64 + } 66.65 + 66.66 + interface K extends I { 66.67 + boolean v = TestInterfaceOrder.out(K.class); 66.68 + default void k() {} 66.69 + } 66.70 + 66.71 + static class B extends A implements K { 66.72 + static boolean v = TestInterfaceOrder.out(B.class); 66.73 + } 66.74 + 66.75 + interface L { 66.76 + boolean v = TestInterfaceOrder.out(L.class); 66.77 + default void l() {} 66.78 + } 66.79 + 66.80 + static class C extends B implements L { 66.81 + static boolean v = TestInterfaceOrder.out(C.class); 66.82 + } 66.83 + 66.84 + 66.85 + static boolean out(Class c) { 66.86 + System.out.println("#: initializing " + c.getName()); 66.87 + cInitOrder.add(c); 66.88 + return true; 66.89 + } 66.90 + 66.91 +}
67.1 --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Fri Oct 31 15:22:44 2014 -0700 67.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Wed Nov 05 15:35:11 2014 -0800 67.3 @@ -101,6 +101,7 @@ 67.4 public native void NMTOverflowHashBucket(long num); 67.5 public native long NMTMallocWithPseudoStack(long size, int index); 67.6 public native boolean NMTIsDetailSupported(); 67.7 + public native boolean NMTChangeTrackingLevel(); 67.8 67.9 // Compiler 67.10 public native void deoptimizeAll();