Thu, 06 Nov 2014 09:39:49 -0800
Merge
1.1 --- a/.hgtags Fri Oct 31 17:09:14 2014 -0700 1.2 +++ b/.hgtags Thu Nov 06 09:39:49 2014 -0800 1.3 @@ -553,7 +553,13 @@ 1.4 401cbaa475b4efe53153119ab87a82b217980a7f jdk8u31-b03 1.5 060cdf93040c1bfa5fdf580da5e9999042632cc8 jdk8u31-b04 1.6 6e56d7f1634f6c4cd4196e699c06e6ca2e6d6efb jdk8u31-b05 1.7 +271a32147391d08b0f338d9353330e2b5584d580 jdk8u31-b06 1.8 +e9f815c3f21cf2febd8e3c185917c1519aa52d9a jdk8u31-b07 1.9 1b3abbeee961dee49780c0e4af5337feb918c555 jdk8u40-b10 1.10 f10fe402dfb1543723b4b117a7cba3ea3d4159f1 hs25.40-b15 1.11 99372b2fee0eb8b3452f47230e84aa6e97003184 jdk8u40-b11 1.12 +8b9ec2da541a74ac698560b6a2bc45fccb789919 hs25.40-b16 1.13 +6b93bf9ea3ea57ed0fe53cfedb2f9ab912c324e5 jdk8u40-b12 1.14 +521e269ae1daa9df1cb0835b97aa76bdf340fcb2 hs25.40-b17 1.15 +86307d47790785398d0695acc361bccaefe25f94 jdk8u40-b13 1.16 b95f13f05f553309cd74d6ccf8fcedb259c6716c jdk8u45-b00
2.1 --- a/make/excludeSrc.make Fri Oct 31 17:09:14 2014 -0700 2.2 +++ b/make/excludeSrc.make Thu Nov 06 09:39:49 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/jprt.properties Fri Oct 31 17:09:14 2014 -0700 3.2 +++ b/make/jprt.properties Thu Nov 06 09:39:49 2014 -0800 3.3 @@ -374,21 +374,25 @@ 3.4 ${jprt.my.windows.i586}-fastdebug-c2-internalvmtests, \ 3.5 ${jprt.my.windows.x64}-fastdebug-c2-internalvmtests 3.6 3.7 -jprt.make.rule.test.targets.standard.wbapi = \ 3.8 - ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-wbapitest, \ 3.9 - ${jprt.my.solaris.x64}-{product|fastdebug}-c2-wbapitest, \ 3.10 - ${jprt.my.linux.i586}-{product|fastdebug}-c2-wbapitest, \ 3.11 - ${jprt.my.linux.x64}-{product|fastdebug}-c2-wbapitest, \ 3.12 - ${jprt.my.windows.i586}-{product|fastdebug}-c2-wbapitest, \ 3.13 - ${jprt.my.windows.x64}-{product|fastdebug}-c2-wbapitest, \ 3.14 - ${jprt.my.linux.i586}-{product|fastdebug}-c1-wbapitest, \ 3.15 - ${jprt.my.windows.i586}-{product|fastdebug}-c1-wbapitest 3.16 +jprt.make.rule.test.targets.standard.reg.group = \ 3.17 + ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GROUP, \ 3.18 + ${jprt.my.solaris.x64}-{product|fastdebug}-c2-GROUP, \ 3.19 + ${jprt.my.linux.i586}-{product|fastdebug}-c2-GROUP, \ 3.20 + ${jprt.my.linux.x64}-{product|fastdebug}-c2-GROUP, \ 3.21 + ${jprt.my.windows.i586}-{product|fastdebug}-c2-GROUP, \ 3.22 + ${jprt.my.windows.x64}-{product|fastdebug}-c2-GROUP, \ 3.23 + ${jprt.my.linux.i586}-{product|fastdebug}-c1-GROUP, \ 3.24 + ${jprt.my.windows.i586}-{product|fastdebug}-c1-GROUP 3.25 3.26 jprt.make.rule.test.targets.standard = \ 3.27 ${jprt.make.rule.test.targets.standard.client}, \ 3.28 ${jprt.make.rule.test.targets.standard.server}, \ 3.29 ${jprt.make.rule.test.targets.standard.internalvmtests}, \ 3.30 - ${jprt.make.rule.test.targets.standard.wbapi} 3.31 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_wbapitest}, \ 3.32 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_compiler}, \ 3.33 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_gc}, \ 3.34 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_runtime}, \ 3.35 + ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_serviceability} 3.36 3.37 jprt.make.rule.test.targets.embedded = \ 3.38 ${jprt.make.rule.test.targets.standard.client}
4.1 --- a/make/solaris/makefiles/vm.make Fri Oct 31 17:09:14 2014 -0700 4.2 +++ b/make/solaris/makefiles/vm.make Thu Nov 06 09:39:49 2014 -0800 4.3 @@ -141,7 +141,7 @@ 4.4 LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc -ldemangle 4.5 endif # sparcWorks 4.6 4.7 -LIBS += -lkstat -lpicl 4.8 +LIBS += -lkstat 4.9 4.10 # By default, link the *.o into the library, not the executable. 4.11 LINK_INTO$(LINK_INTO) = LIBJVM
5.1 --- a/src/cpu/x86/vm/vm_version_x86.cpp Fri Oct 31 17:09:14 2014 -0700 5.2 +++ b/src/cpu/x86/vm/vm_version_x86.cpp Thu Nov 06 09:39:49 2014 -0800 5.3 @@ -873,14 +873,19 @@ 5.4 if (supports_bmi1()) { 5.5 // tzcnt does not require VEX prefix 5.6 if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction)) { 5.7 - UseCountTrailingZerosInstruction = true; 5.8 + if (!UseBMI1Instructions && !FLAG_IS_DEFAULT(UseBMI1Instructions)) { 5.9 + // Don't use tzcnt if BMI1 is switched off on command line. 5.10 + UseCountTrailingZerosInstruction = false; 5.11 + } else { 5.12 + UseCountTrailingZerosInstruction = true; 5.13 + } 5.14 } 5.15 } else if (UseCountTrailingZerosInstruction) { 5.16 warning("tzcnt instruction is not available on this CPU"); 5.17 FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, false); 5.18 } 5.19 5.20 - // BMI instructions use an encoding with VEX prefix. 5.21 + // BMI instructions (except tzcnt) use an encoding with VEX prefix. 5.22 // VEX prefix is generated only when AVX > 0. 5.23 if (supports_bmi1() && supports_avx()) { 5.24 if (FLAG_IS_DEFAULT(UseBMI1Instructions)) {
6.1 --- a/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp Fri Oct 31 17:09:14 2014 -0700 6.2 +++ b/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp Thu Nov 06 09:39:49 2014 -0800 6.3 @@ -31,18 +31,51 @@ 6.4 #include <sys/systeminfo.h> 6.5 #include <kstat.h> 6.6 #include <picl.h> 6.7 +#include <dlfcn.h> 6.8 +#include <link.h> 6.9 6.10 extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result); 6.11 extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result); 6.12 6.13 +// Functions from the library we need (signatures should match those in picl.h) 6.14 +extern "C" { 6.15 + typedef int (*picl_initialize_func_t)(void); 6.16 + typedef int (*picl_shutdown_func_t)(void); 6.17 + typedef int (*picl_get_root_func_t)(picl_nodehdl_t *nodehandle); 6.18 + typedef int (*picl_walk_tree_by_class_func_t)(picl_nodehdl_t rooth, 6.19 + const char *classname, void *c_args, 6.20 + int (*callback_fn)(picl_nodehdl_t hdl, void *args)); 6.21 + typedef int (*picl_get_prop_by_name_func_t)(picl_nodehdl_t nodeh, const char *nm, 6.22 + picl_prophdl_t *ph); 6.23 + typedef int (*picl_get_propval_func_t)(picl_prophdl_t proph, void *valbuf, size_t sz); 6.24 + typedef int (*picl_get_propinfo_func_t)(picl_prophdl_t proph, picl_propinfo_t *pi); 6.25 +} 6.26 + 6.27 class PICL { 6.28 + // Pointers to functions in the library 6.29 + picl_initialize_func_t _picl_initialize; 6.30 + picl_shutdown_func_t _picl_shutdown; 6.31 + picl_get_root_func_t _picl_get_root; 6.32 + picl_walk_tree_by_class_func_t _picl_walk_tree_by_class; 6.33 + picl_get_prop_by_name_func_t _picl_get_prop_by_name; 6.34 + picl_get_propval_func_t _picl_get_propval; 6.35 + picl_get_propinfo_func_t _picl_get_propinfo; 6.36 + // Handle to the library that is returned by dlopen 6.37 + void *_dl_handle; 6.38 + 6.39 + bool open_library(); 6.40 + void close_library(); 6.41 + 6.42 + template<typename FuncType> bool bind(FuncType& func, const char* name); 6.43 + bool bind_library_functions(); 6.44 + 6.45 // Get a value of the integer property. The value in the tree can be either 32 or 64 bit 6.46 // depending on the platform. The result is converted to int. 6.47 - static int get_int_property(picl_nodehdl_t nodeh, const char* name, int* result) { 6.48 + int get_int_property(picl_nodehdl_t nodeh, const char* name, int* result) { 6.49 picl_propinfo_t pinfo; 6.50 picl_prophdl_t proph; 6.51 - if (picl_get_prop_by_name(nodeh, name, &proph) != PICL_SUCCESS || 6.52 - picl_get_propinfo(proph, &pinfo) != PICL_SUCCESS) { 6.53 + if (_picl_get_prop_by_name(nodeh, name, &proph) != PICL_SUCCESS || 6.54 + _picl_get_propinfo(proph, &pinfo) != PICL_SUCCESS) { 6.55 return PICL_FAILURE; 6.56 } 6.57 6.58 @@ -52,13 +85,13 @@ 6.59 } 6.60 if (pinfo.size == sizeof(int64_t)) { 6.61 int64_t val; 6.62 - if (picl_get_propval(proph, &val, sizeof(int64_t)) != PICL_SUCCESS) { 6.63 + if (_picl_get_propval(proph, &val, sizeof(int64_t)) != PICL_SUCCESS) { 6.64 return PICL_FAILURE; 6.65 } 6.66 *result = static_cast<int>(val); 6.67 } else if (pinfo.size == sizeof(int32_t)) { 6.68 int32_t val; 6.69 - if (picl_get_propval(proph, &val, sizeof(int32_t)) != PICL_SUCCESS) { 6.70 + if (_picl_get_propval(proph, &val, sizeof(int32_t)) != PICL_SUCCESS) { 6.71 return PICL_FAILURE; 6.72 } 6.73 *result = static_cast<int>(val); 6.74 @@ -72,6 +105,7 @@ 6.75 // Visitor and a state machine that visits integer properties and verifies that the 6.76 // values are the same. Stores the unique value observed. 6.77 class UniqueValueVisitor { 6.78 + PICL *_picl; 6.79 enum { 6.80 INITIAL, // Start state, no assignments happened 6.81 ASSIGNED, // Assigned a value 6.82 @@ -79,7 +113,7 @@ 6.83 } _state; 6.84 int _value; 6.85 public: 6.86 - UniqueValueVisitor() : _state(INITIAL) { } 6.87 + UniqueValueVisitor(PICL* picl) : _picl(picl), _state(INITIAL) { } 6.88 int value() { 6.89 assert(_state == ASSIGNED, "Precondition"); 6.90 return _value; 6.91 @@ -96,9 +130,10 @@ 6.92 6.93 static int visit(picl_nodehdl_t nodeh, const char* name, void *arg) { 6.94 UniqueValueVisitor *state = static_cast<UniqueValueVisitor*>(arg); 6.95 + PICL* picl = state->_picl; 6.96 assert(!state->is_inconsistent(), "Precondition"); 6.97 int curr; 6.98 - if (PICL::get_int_property(nodeh, name, &curr) == PICL_SUCCESS) { 6.99 + if (picl->get_int_property(nodeh, name, &curr) == PICL_SUCCESS) { 6.100 if (!state->is_assigned()) { // first iteration 6.101 state->set_value(curr); 6.102 } else if (curr != state->value()) { // following iterations 6.103 @@ -122,32 +157,36 @@ 6.104 return UniqueValueVisitor::visit(nodeh, "l2-cache-line-size", state); 6.105 } 6.106 6.107 - PICL() : _L1_data_cache_line_size(0), _L2_cache_line_size(0) { 6.108 - if (picl_initialize() == PICL_SUCCESS) { 6.109 + PICL() : _L1_data_cache_line_size(0), _L2_cache_line_size(0), _dl_handle(NULL) { 6.110 + if (!open_library()) { 6.111 + return; 6.112 + } 6.113 + if (_picl_initialize() == PICL_SUCCESS) { 6.114 picl_nodehdl_t rooth; 6.115 - if (picl_get_root(&rooth) == PICL_SUCCESS) { 6.116 - UniqueValueVisitor L1_state; 6.117 + if (_picl_get_root(&rooth) == PICL_SUCCESS) { 6.118 + UniqueValueVisitor L1_state(this); 6.119 // Visit all "cpu" class instances 6.120 - picl_walk_tree_by_class(rooth, "cpu", &L1_state, PICL_get_l1_data_cache_line_size_helper); 6.121 + _picl_walk_tree_by_class(rooth, "cpu", &L1_state, PICL_get_l1_data_cache_line_size_helper); 6.122 if (L1_state.is_initial()) { // Still initial, iteration found no values 6.123 // Try walk all "core" class instances, it might be a Fujitsu machine 6.124 - picl_walk_tree_by_class(rooth, "core", &L1_state, PICL_get_l1_data_cache_line_size_helper); 6.125 + _picl_walk_tree_by_class(rooth, "core", &L1_state, PICL_get_l1_data_cache_line_size_helper); 6.126 } 6.127 if (L1_state.is_assigned()) { // Is there a value? 6.128 _L1_data_cache_line_size = L1_state.value(); 6.129 } 6.130 6.131 - UniqueValueVisitor L2_state; 6.132 - picl_walk_tree_by_class(rooth, "cpu", &L2_state, PICL_get_l2_cache_line_size_helper); 6.133 + UniqueValueVisitor L2_state(this); 6.134 + _picl_walk_tree_by_class(rooth, "cpu", &L2_state, PICL_get_l2_cache_line_size_helper); 6.135 if (L2_state.is_initial()) { 6.136 - picl_walk_tree_by_class(rooth, "core", &L2_state, PICL_get_l2_cache_line_size_helper); 6.137 + _picl_walk_tree_by_class(rooth, "core", &L2_state, PICL_get_l2_cache_line_size_helper); 6.138 } 6.139 if (L2_state.is_assigned()) { 6.140 _L2_cache_line_size = L2_state.value(); 6.141 } 6.142 } 6.143 - picl_shutdown(); 6.144 + _picl_shutdown(); 6.145 } 6.146 + close_library(); 6.147 } 6.148 6.149 unsigned int L1_data_cache_line_size() const { return _L1_data_cache_line_size; } 6.150 @@ -161,6 +200,43 @@ 6.151 return PICL::get_l2_cache_line_size(nodeh, result); 6.152 } 6.153 6.154 +template<typename FuncType> 6.155 +bool PICL::bind(FuncType& func, const char* name) { 6.156 + func = reinterpret_cast<FuncType>(dlsym(_dl_handle, name)); 6.157 + return func != NULL; 6.158 +} 6.159 + 6.160 +bool PICL::bind_library_functions() { 6.161 + assert(_dl_handle != NULL, "library should be open"); 6.162 + return bind(_picl_initialize, "picl_initialize" ) && 6.163 + bind(_picl_shutdown, "picl_shutdown" ) && 6.164 + bind(_picl_get_root, "picl_get_root" ) && 6.165 + bind(_picl_walk_tree_by_class, "picl_walk_tree_by_class") && 6.166 + bind(_picl_get_prop_by_name, "picl_get_prop_by_name" ) && 6.167 + bind(_picl_get_propval, "picl_get_propval" ) && 6.168 + bind(_picl_get_propinfo, "picl_get_propinfo" ); 6.169 +} 6.170 + 6.171 +bool PICL::open_library() { 6.172 + _dl_handle = dlopen("libpicl.so.1", RTLD_LAZY); 6.173 + if (_dl_handle == NULL) { 6.174 + warning("PICL (libpicl.so.1) is missing. Performance will not be optimal."); 6.175 + return false; 6.176 + } 6.177 + if (!bind_library_functions()) { 6.178 + assert(false, "unexpected PICL API change"); 6.179 + close_library(); 6.180 + return false; 6.181 + } 6.182 + return true; 6.183 +} 6.184 + 6.185 +void PICL::close_library() { 6.186 + assert(_dl_handle != NULL, "library should be open"); 6.187 + dlclose(_dl_handle); 6.188 + _dl_handle = NULL; 6.189 +} 6.190 + 6.191 // We need to keep these here as long as we have to build on Solaris 6.192 // versions before 10. 6.193 #ifndef SI_ARCHITECTURE_32
7.1 --- a/src/share/vm/c1/c1_globals.hpp Fri Oct 31 17:09:14 2014 -0700 7.2 +++ b/src/share/vm/c1/c1_globals.hpp Thu Nov 06 09:39:49 2014 -0800 7.3 @@ -287,9 +287,6 @@ 7.4 develop(bool, InstallMethods, true, \ 7.5 "Install methods at the end of successful compilations") \ 7.6 \ 7.7 - product(intx, CompilationRepeat, 0, \ 7.8 - "Number of times to recompile method before returning result") \ 7.9 - \ 7.10 develop(intx, NMethodSizeLimit, (64*K)*wordSize, \ 7.11 "Maximum size of a compiled method.") \ 7.12 \
8.1 --- a/src/share/vm/ci/ciEnv.cpp Fri Oct 31 17:09:14 2014 -0700 8.2 +++ b/src/share/vm/ci/ciEnv.cpp Thu Nov 06 09:39:49 2014 -0800 8.3 @@ -559,7 +559,12 @@ 8.4 oop obj = cpool->resolved_references()->obj_at(cache_index); 8.5 if (obj != NULL) { 8.6 ciObject* ciobj = get_object(obj); 8.7 - return ciConstant(T_OBJECT, ciobj); 8.8 + if (ciobj->is_array()) { 8.9 + return ciConstant(T_ARRAY, ciobj); 8.10 + } else { 8.11 + assert(ciobj->is_instance(), "should be an instance"); 8.12 + return ciConstant(T_OBJECT, ciobj); 8.13 + } 8.14 } 8.15 index = cpool->object_to_cp_index(cache_index); 8.16 } 8.17 @@ -586,8 +591,12 @@ 8.18 } 8.19 } 8.20 ciObject* constant = get_object(string); 8.21 - assert (constant->is_instance(), "must be an instance, or not? "); 8.22 - return ciConstant(T_OBJECT, constant); 8.23 + if (constant->is_array()) { 8.24 + return ciConstant(T_ARRAY, constant); 8.25 + } else { 8.26 + assert (constant->is_instance(), "must be an instance, or not? "); 8.27 + return ciConstant(T_OBJECT, constant); 8.28 + } 8.29 } else if (tag.is_klass() || tag.is_unresolved_klass()) { 8.30 // 4881222: allow ldc to take a class type 8.31 ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore_will_link, accessor);
9.1 --- a/src/share/vm/ci/ciTypeFlow.cpp Fri Oct 31 17:09:14 2014 -0700 9.2 +++ b/src/share/vm/ci/ciTypeFlow.cpp Thu Nov 06 09:39:49 2014 -0800 9.3 @@ -730,7 +730,7 @@ 9.4 if (obj->is_null_object()) { 9.5 push_null(); 9.6 } else { 9.7 - assert(obj->is_instance(), "must be java_mirror of klass"); 9.8 + assert(obj->is_instance() || obj->is_array(), "must be java_mirror of klass"); 9.9 push_object(obj->klass()); 9.10 } 9.11 } else {
10.1 --- a/src/share/vm/classfile/classFileParser.cpp Fri Oct 31 17:09:14 2014 -0700 10.2 +++ b/src/share/vm/classfile/classFileParser.cpp Thu Nov 06 09:39:49 2014 -0800 10.3 @@ -2529,7 +2529,7 @@ 10.4 Array<Method*>* ClassFileParser::parse_methods(bool is_interface, 10.5 AccessFlags* promoted_flags, 10.6 bool* has_final_method, 10.7 - bool* has_default_methods, 10.8 + bool* declares_default_methods, 10.9 TRAPS) { 10.10 ClassFileStream* cfs = stream(); 10.11 cfs->guarantee_more(2, CHECK_NULL); // length 10.12 @@ -2548,11 +2548,11 @@ 10.13 if (method->is_final()) { 10.14 *has_final_method = true; 10.15 } 10.16 - if (is_interface && !(*has_default_methods) 10.17 - && !method->is_abstract() && !method->is_static() 10.18 - && !method->is_private()) { 10.19 - // default method 10.20 - *has_default_methods = true; 10.21 + // declares_default_methods: declares concrete instance methods, any access flags 10.22 + // used for interface initialization, and default method inheritance analysis 10.23 + if (is_interface && !(*declares_default_methods) 10.24 + && !method->is_abstract() && !method->is_static()) { 10.25 + *declares_default_methods = true; 10.26 } 10.27 _methods->at_put(index, method()); 10.28 } 10.29 @@ -3691,6 +3691,7 @@ 10.30 JvmtiCachedClassFileData *cached_class_file = NULL; 10.31 Handle class_loader(THREAD, loader_data->class_loader()); 10.32 bool has_default_methods = false; 10.33 + bool declares_default_methods = false; 10.34 ResourceMark rm(THREAD); 10.35 10.36 ClassFileStream* cfs = stream(); 10.37 @@ -3928,8 +3929,11 @@ 10.38 Array<Method*>* methods = parse_methods(access_flags.is_interface(), 10.39 &promoted_flags, 10.40 &has_final_method, 10.41 - &has_default_methods, 10.42 + &declares_default_methods, 10.43 CHECK_(nullHandle)); 10.44 + if (declares_default_methods) { 10.45 + has_default_methods = true; 10.46 + } 10.47 10.48 // Additional attributes 10.49 ClassAnnotationCollector parsed_annotations; 10.50 @@ -4072,6 +4076,7 @@ 10.51 this_klass->set_minor_version(minor_version); 10.52 this_klass->set_major_version(major_version); 10.53 this_klass->set_has_default_methods(has_default_methods); 10.54 + this_klass->set_declares_default_methods(declares_default_methods); 10.55 10.56 if (!host_klass.is_null()) { 10.57 assert (this_klass->is_anonymous(), "should be the same"); 10.58 @@ -4165,8 +4170,12 @@ 10.59 tty->print("[Loaded %s from %s]\n", this_klass->external_name(), 10.60 cfs->source()); 10.61 } else if (class_loader.is_null()) { 10.62 - if (THREAD->is_Java_thread()) { 10.63 - Klass* caller = ((JavaThread*)THREAD)->security_get_caller_class(1); 10.64 + Klass* caller = 10.65 + THREAD->is_Java_thread() 10.66 + ? ((JavaThread*)THREAD)->security_get_caller_class(1) 10.67 + : NULL; 10.68 + // caller can be NULL, for example, during a JVMTI VM_Init hook 10.69 + if (caller != NULL) { 10.70 tty->print("[Loaded %s by instance of %s]\n", 10.71 this_klass->external_name(), 10.72 InstanceKlass::cast(caller)->external_name());
11.1 --- a/src/share/vm/classfile/classFileParser.hpp Fri Oct 31 17:09:14 2014 -0700 11.2 +++ b/src/share/vm/classfile/classFileParser.hpp Thu Nov 06 09:39:49 2014 -0800 11.3 @@ -247,7 +247,7 @@ 11.4 Array<Method*>* parse_methods(bool is_interface, 11.5 AccessFlags* promoted_flags, 11.6 bool* has_final_method, 11.7 - bool* has_default_method, 11.8 + bool* declares_default_methods, 11.9 TRAPS); 11.10 intArray* sort_methods(Array<Method*>* methods); 11.11
12.1 --- a/src/share/vm/compiler/compileBroker.cpp Fri Oct 31 17:09:14 2014 -0700 12.2 +++ b/src/share/vm/compiler/compileBroker.cpp Thu Nov 06 09:39:49 2014 -0800 12.3 @@ -183,9 +183,8 @@ 12.4 12.5 long CompileBroker::_peak_compilation_time = 0; 12.6 12.7 -CompileQueue* CompileBroker::_c2_method_queue = NULL; 12.8 -CompileQueue* CompileBroker::_c1_method_queue = NULL; 12.9 -CompileTask* CompileBroker::_task_free_list = NULL; 12.10 +CompileQueue* CompileBroker::_c2_compile_queue = NULL; 12.11 +CompileQueue* CompileBroker::_c1_compile_queue = NULL; 12.12 12.13 GrowableArray<CompilerThread*>* CompileBroker::_compiler_threads = NULL; 12.14 12.15 @@ -253,13 +252,56 @@ 12.16 12.17 // By convention, the compiling thread is responsible for 12.18 // recycling a non-blocking CompileTask. 12.19 - CompileBroker::free_task(task); 12.20 + CompileTask::free(task); 12.21 } 12.22 } 12.23 12.24 12.25 -// ------------------------------------------------------------------ 12.26 -// CompileTask::initialize 12.27 +CompileTask* CompileTask::_task_free_list = NULL; 12.28 +#ifdef ASSERT 12.29 +int CompileTask::_num_allocated_tasks = 0; 12.30 +#endif 12.31 +/** 12.32 + * Allocate a CompileTask, from the free list if possible. 12.33 + */ 12.34 +CompileTask* CompileTask::allocate() { 12.35 + MutexLocker locker(CompileTaskAlloc_lock); 12.36 + CompileTask* task = NULL; 12.37 + 12.38 + if (_task_free_list != NULL) { 12.39 + task = _task_free_list; 12.40 + _task_free_list = task->next(); 12.41 + task->set_next(NULL); 12.42 + } else { 12.43 + task = new CompileTask(); 12.44 + DEBUG_ONLY(_num_allocated_tasks++;) 12.45 + assert (_num_allocated_tasks < 10000, "Leaking compilation tasks?"); 12.46 + task->set_next(NULL); 12.47 + task->set_is_free(true); 12.48 + } 12.49 + assert(task->is_free(), "Task must be free."); 12.50 + task->set_is_free(false); 12.51 + return task; 12.52 +} 12.53 + 12.54 + 12.55 +/** 12.56 + * Add a task to the free list. 12.57 + */ 12.58 +void CompileTask::free(CompileTask* task) { 12.59 + MutexLocker locker(CompileTaskAlloc_lock); 12.60 + if (!task->is_free()) { 12.61 + task->set_code(NULL); 12.62 + assert(!task->lock()->is_locked(), "Should not be locked when freed"); 12.63 + JNIHandles::destroy_global(task->_method_holder); 12.64 + JNIHandles::destroy_global(task->_hot_method_holder); 12.65 + 12.66 + task->set_is_free(true); 12.67 + task->set_next(_task_free_list); 12.68 + _task_free_list = task; 12.69 + } 12.70 +} 12.71 + 12.72 void CompileTask::initialize(int compile_id, 12.73 methodHandle method, 12.74 int osr_bci, 12.75 @@ -318,15 +360,6 @@ 12.76 if (nm == NULL) _code_handle = NULL; // drop the handle also 12.77 } 12.78 12.79 -// ------------------------------------------------------------------ 12.80 -// CompileTask::free 12.81 -void CompileTask::free() { 12.82 - set_code(NULL); 12.83 - assert(!_lock->is_locked(), "Should not be locked when freed"); 12.84 - JNIHandles::destroy_global(_method_holder); 12.85 - JNIHandles::destroy_global(_hot_method_holder); 12.86 -} 12.87 - 12.88 12.89 void CompileTask::mark_on_stack() { 12.90 // Mark these methods as something redefine classes cannot remove. 12.91 @@ -594,9 +627,12 @@ 12.92 12.93 12.94 12.95 -// Add a CompileTask to a CompileQueue 12.96 +/** 12.97 + * Add a CompileTask to a CompileQueue 12.98 + */ 12.99 void CompileQueue::add(CompileTask* task) { 12.100 assert(lock()->owned_by_self(), "must own lock"); 12.101 + assert(!CompileBroker::is_compilation_disabled_forever(), "Do not add task if compilation is turned off forever"); 12.102 12.103 task->set_next(NULL); 12.104 task->set_prev(NULL); 12.105 @@ -618,9 +654,7 @@ 12.106 // Mark the method as being in the compile queue. 12.107 task->method()->set_queued_for_compilation(); 12.108 12.109 - if (CIPrintCompileQueue) { 12.110 - print(); 12.111 - } 12.112 + NOT_PRODUCT(print();) 12.113 12.114 if (LogCompilation && xtty != NULL) { 12.115 task->log_task_queued(); 12.116 @@ -630,14 +664,32 @@ 12.117 lock()->notify_all(); 12.118 } 12.119 12.120 -void CompileQueue::delete_all() { 12.121 - assert(lock()->owned_by_self(), "must own lock"); 12.122 - if (_first != NULL) { 12.123 - for (CompileTask* task = _first; task != NULL; task = task->next()) { 12.124 - delete task; 12.125 +/** 12.126 + * Empties compilation queue by putting all compilation tasks onto 12.127 + * a freelist. Furthermore, the method wakes up all threads that are 12.128 + * waiting on a compilation task to finish. This can happen if background 12.129 + * compilation is disabled. 12.130 + */ 12.131 +void CompileQueue::free_all() { 12.132 + MutexLocker mu(lock()); 12.133 + CompileTask* next = _first; 12.134 + 12.135 + // Iterate over all tasks in the compile queue 12.136 + while (next != NULL) { 12.137 + CompileTask* current = next; 12.138 + next = current->next(); 12.139 + { 12.140 + // Wake up thread that blocks on the compile task. 12.141 + MutexLocker ct_lock(current->lock()); 12.142 + current->lock()->notify(); 12.143 } 12.144 - _first = NULL; 12.145 + // Put the task back on the freelist. 12.146 + CompileTask::free(current); 12.147 } 12.148 + _first = NULL; 12.149 + 12.150 + // Wake up all threads that block on the queue. 12.151 + lock()->notify_all(); 12.152 } 12.153 12.154 // ------------------------------------------------------------------ 12.155 @@ -767,18 +819,24 @@ 12.156 } 12.157 } 12.158 12.159 -// ------------------------------------------------------------------ 12.160 -// CompileQueue::print 12.161 +#ifndef PRODUCT 12.162 +/** 12.163 + * Print entire compilation queue. 12.164 + */ 12.165 void CompileQueue::print() { 12.166 - tty->print_cr("Contents of %s", name()); 12.167 - tty->print_cr("----------------------"); 12.168 - CompileTask* task = _first; 12.169 - while (task != NULL) { 12.170 - task->print_line(); 12.171 - task = task->next(); 12.172 + if (CIPrintCompileQueue) { 12.173 + ttyLocker ttyl; 12.174 + tty->print_cr("Contents of %s", name()); 12.175 + tty->print_cr("----------------------"); 12.176 + CompileTask* task = _first; 12.177 + while (task != NULL) { 12.178 + task->print_line(); 12.179 + task = task->next(); 12.180 + } 12.181 + tty->print_cr("----------------------"); 12.182 } 12.183 - tty->print_cr("----------------------"); 12.184 } 12.185 +#endif // PRODUCT 12.186 12.187 CompilerCounters::CompilerCounters(const char* thread_name, int instance, TRAPS) { 12.188 12.189 @@ -851,9 +909,6 @@ 12.190 _compilers[1] = new SharkCompiler(); 12.191 #endif // SHARK 12.192 12.193 - // Initialize the CompileTask free list 12.194 - _task_free_list = NULL; 12.195 - 12.196 // Start the CompilerThreads 12.197 init_compiler_threads(c1_count, c2_count); 12.198 // totalTime performance counter is always created as it is required 12.199 @@ -1046,11 +1101,11 @@ 12.200 #endif // !ZERO && !SHARK 12.201 // Initialize the compilation queue 12.202 if (c2_compiler_count > 0) { 12.203 - _c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock); 12.204 + _c2_compile_queue = new CompileQueue("C2 CompileQueue", MethodCompileQueue_lock); 12.205 _compilers[1]->set_num_compiler_threads(c2_compiler_count); 12.206 } 12.207 if (c1_compiler_count > 0) { 12.208 - _c1_method_queue = new CompileQueue("C1MethodQueue", MethodCompileQueue_lock); 12.209 + _c1_compile_queue = new CompileQueue("C1 CompileQueue", MethodCompileQueue_lock); 12.210 _compilers[0]->set_num_compiler_threads(c1_compiler_count); 12.211 } 12.212 12.213 @@ -1065,7 +1120,7 @@ 12.214 sprintf(name_buffer, "C2 CompilerThread%d", i); 12.215 CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK); 12.216 // Shark and C2 12.217 - CompilerThread* new_thread = make_compiler_thread(name_buffer, _c2_method_queue, counters, _compilers[1], CHECK); 12.218 + CompilerThread* new_thread = make_compiler_thread(name_buffer, _c2_compile_queue, counters, _compilers[1], CHECK); 12.219 _compiler_threads->append(new_thread); 12.220 } 12.221 12.222 @@ -1074,7 +1129,7 @@ 12.223 sprintf(name_buffer, "C1 CompilerThread%d", i); 12.224 CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK); 12.225 // C1 12.226 - CompilerThread* new_thread = make_compiler_thread(name_buffer, _c1_method_queue, counters, _compilers[0], CHECK); 12.227 + CompilerThread* new_thread = make_compiler_thread(name_buffer, _c1_compile_queue, counters, _compilers[0], CHECK); 12.228 _compiler_threads->append(new_thread); 12.229 } 12.230 12.231 @@ -1084,14 +1139,19 @@ 12.232 } 12.233 12.234 12.235 -// Set the methods on the stack as on_stack so that redefine classes doesn't 12.236 -// reclaim them 12.237 +/** 12.238 + * Set the methods on the stack as on_stack so that redefine classes doesn't 12.239 + * reclaim them. This method is executed at a safepoint. 12.240 + */ 12.241 void CompileBroker::mark_on_stack() { 12.242 - if (_c2_method_queue != NULL) { 12.243 - _c2_method_queue->mark_on_stack(); 12.244 + assert(SafepointSynchronize::is_at_safepoint(), "sanity check"); 12.245 + // Since we are at a safepoint, we do not need a lock to access 12.246 + // the compile queues. 12.247 + if (_c2_compile_queue != NULL) { 12.248 + _c2_compile_queue->mark_on_stack(); 12.249 } 12.250 - if (_c1_method_queue != NULL) { 12.251 - _c1_method_queue->mark_on_stack(); 12.252 + if (_c1_compile_queue != NULL) { 12.253 + _c1_compile_queue->mark_on_stack(); 12.254 } 12.255 } 12.256 12.257 @@ -1107,7 +1167,7 @@ 12.258 const char* comment, 12.259 Thread* thread) { 12.260 // do nothing if compiler thread(s) is not available 12.261 - if (!_initialized ) { 12.262 + if (!_initialized) { 12.263 return; 12.264 } 12.265 12.266 @@ -1154,7 +1214,7 @@ 12.267 12.268 // If this method is already in the compile queue, then 12.269 // we do not block the current thread. 12.270 - if (compilation_is_in_queue(method, osr_bci)) { 12.271 + if (compilation_is_in_queue(method)) { 12.272 // We may want to decay our counter a bit here to prevent 12.273 // multiple denied requests for compilation. This is an 12.274 // open compilation policy issue. Note: The other possibility, 12.275 @@ -1193,7 +1253,7 @@ 12.276 // Make sure the method has not slipped into the queues since 12.277 // last we checked; note that those checks were "fast bail-outs". 12.278 // Here we need to be more careful, see 14012000 below. 12.279 - if (compilation_is_in_queue(method, osr_bci)) { 12.280 + if (compilation_is_in_queue(method)) { 12.281 return; 12.282 } 12.283 12.284 @@ -1214,7 +1274,7 @@ 12.285 } 12.286 12.287 // Should this thread wait for completion of the compile? 12.288 - blocking = is_compile_blocking(method, osr_bci); 12.289 + blocking = is_compile_blocking(); 12.290 12.291 // We will enter the compilation in the queue. 12.292 // 14012000: Note that this sets the queued_for_compile bits in 12.293 @@ -1406,19 +1466,17 @@ 12.294 } 12.295 12.296 12.297 -// ------------------------------------------------------------------ 12.298 -// CompileBroker::compilation_is_in_queue 12.299 -// 12.300 -// See if this compilation is already requested. 12.301 -// 12.302 -// Implementation note: there is only a single "is in queue" bit 12.303 -// for each method. This means that the check below is overly 12.304 -// conservative in the sense that an osr compilation in the queue 12.305 -// will block a normal compilation from entering the queue (and vice 12.306 -// versa). This can be remedied by a full queue search to disambiguate 12.307 -// cases. If it is deemed profitible, this may be done. 12.308 -bool CompileBroker::compilation_is_in_queue(methodHandle method, 12.309 - int osr_bci) { 12.310 +/** 12.311 + * See if this compilation is already requested. 12.312 + * 12.313 + * Implementation note: there is only a single "is in queue" bit 12.314 + * for each method. This means that the check below is overly 12.315 + * conservative in the sense that an osr compilation in the queue 12.316 + * will block a normal compilation from entering the queue (and vice 12.317 + * versa). This can be remedied by a full queue search to disambiguate 12.318 + * cases. If it is deemed profitable, this may be done. 12.319 + */ 12.320 +bool CompileBroker::compilation_is_in_queue(methodHandle method) { 12.321 return method->queued_for_compilation(); 12.322 } 12.323 12.324 @@ -1498,13 +1556,11 @@ 12.325 #endif 12.326 } 12.327 12.328 - 12.329 -// ------------------------------------------------------------------ 12.330 -// CompileBroker::is_compile_blocking 12.331 -// 12.332 -// Should the current thread be blocked until this compilation request 12.333 -// has been fulfilled? 12.334 -bool CompileBroker::is_compile_blocking(methodHandle method, int osr_bci) { 12.335 +/** 12.336 + * Should the current thread block until this compilation request 12.337 + * has been fulfilled? 12.338 + */ 12.339 +bool CompileBroker::is_compile_blocking() { 12.340 assert(!InstanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock"); 12.341 return !BackgroundCompilation; 12.342 } 12.343 @@ -1532,7 +1588,7 @@ 12.344 int hot_count, 12.345 const char* comment, 12.346 bool blocking) { 12.347 - CompileTask* new_task = allocate_task(); 12.348 + CompileTask* new_task = CompileTask::allocate(); 12.349 new_task->initialize(compile_id, method, osr_bci, comp_level, 12.350 hot_method, hot_count, comment, 12.351 blocking); 12.352 @@ -1541,75 +1597,52 @@ 12.353 } 12.354 12.355 12.356 -// ------------------------------------------------------------------ 12.357 -// CompileBroker::allocate_task 12.358 -// 12.359 -// Allocate a CompileTask, from the free list if possible. 12.360 -CompileTask* CompileBroker::allocate_task() { 12.361 - MutexLocker locker(CompileTaskAlloc_lock); 12.362 - CompileTask* task = NULL; 12.363 - if (_task_free_list != NULL) { 12.364 - task = _task_free_list; 12.365 - _task_free_list = task->next(); 12.366 - task->set_next(NULL); 12.367 - } else { 12.368 - task = new CompileTask(); 12.369 - task->set_next(NULL); 12.370 - } 12.371 - return task; 12.372 -} 12.373 - 12.374 - 12.375 -// ------------------------------------------------------------------ 12.376 -// CompileBroker::free_task 12.377 -// 12.378 -// Add a task to the free list. 12.379 -void CompileBroker::free_task(CompileTask* task) { 12.380 - MutexLocker locker(CompileTaskAlloc_lock); 12.381 - task->free(); 12.382 - task->set_next(_task_free_list); 12.383 - _task_free_list = task; 12.384 -} 12.385 - 12.386 - 12.387 -// ------------------------------------------------------------------ 12.388 -// CompileBroker::wait_for_completion 12.389 -// 12.390 -// Wait for the given method CompileTask to complete. 12.391 +/** 12.392 + * Wait for the compilation task to complete. 12.393 + */ 12.394 void CompileBroker::wait_for_completion(CompileTask* task) { 12.395 if (CIPrintCompileQueue) { 12.396 + ttyLocker ttyl; 12.397 tty->print_cr("BLOCKING FOR COMPILE"); 12.398 } 12.399 12.400 assert(task->is_blocking(), "can only wait on blocking task"); 12.401 12.402 - JavaThread *thread = JavaThread::current(); 12.403 + JavaThread* thread = JavaThread::current(); 12.404 thread->set_blocked_on_compilation(true); 12.405 12.406 methodHandle method(thread, task->method()); 12.407 { 12.408 MutexLocker waiter(task->lock(), thread); 12.409 12.410 - while (!task->is_complete()) 12.411 + while (!task->is_complete() && !is_compilation_disabled_forever()) { 12.412 task->lock()->wait(); 12.413 + } 12.414 } 12.415 + 12.416 + thread->set_blocked_on_compilation(false); 12.417 + if (is_compilation_disabled_forever()) { 12.418 + CompileTask::free(task); 12.419 + return; 12.420 + } 12.421 + 12.422 // It is harmless to check this status without the lock, because 12.423 // completion is a stable property (until the task object is recycled). 12.424 assert(task->is_complete(), "Compilation should have completed"); 12.425 assert(task->code_handle() == NULL, "must be reset"); 12.426 12.427 - thread->set_blocked_on_compilation(false); 12.428 - 12.429 // By convention, the waiter is responsible for recycling a 12.430 // blocking CompileTask. Since there is only one waiter ever 12.431 // waiting on a CompileTask, we know that no one else will 12.432 // be using this CompileTask; we can free it. 12.433 - free_task(task); 12.434 + CompileTask::free(task); 12.435 } 12.436 12.437 -// Initialize compiler thread(s) + compiler object(s). The postcondition 12.438 -// of this function is that the compiler runtimes are initialized and that 12.439 -//compiler threads can start compiling. 12.440 +/** 12.441 + * Initialize compiler thread(s) + compiler object(s). The postcondition 12.442 + * of this function is that the compiler runtimes are initialized and that 12.443 + * compiler threads can start compiling. 12.444 + */ 12.445 bool CompileBroker::init_compiler_runtime() { 12.446 CompilerThread* thread = CompilerThread::current(); 12.447 AbstractCompiler* comp = thread->compiler(); 12.448 @@ -1646,7 +1679,6 @@ 12.449 disable_compilation_forever(); 12.450 // If compiler initialization failed, no compiler thread that is specific to a 12.451 // particular compiler runtime will ever start to compile methods. 12.452 - 12.453 shutdown_compiler_runtime(comp, thread); 12.454 return false; 12.455 } 12.456 @@ -1660,9 +1692,11 @@ 12.457 return true; 12.458 } 12.459 12.460 -// If C1 and/or C2 initialization failed, we shut down all compilation. 12.461 -// We do this to keep things simple. This can be changed if it ever turns out to be 12.462 -// a problem. 12.463 +/** 12.464 + * If C1 and/or C2 initialization failed, we shut down all compilation. 12.465 + * We do this to keep things simple. This can be changed if it ever turns 12.466 + * out to be a problem. 12.467 + */ 12.468 void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) { 12.469 // Free buffer blob, if allocated 12.470 if (thread->get_buffer_blob() != NULL) { 12.471 @@ -1674,28 +1708,25 @@ 12.472 // There are two reasons for shutting down the compiler 12.473 // 1) compiler runtime initialization failed 12.474 // 2) The code cache is full and the following flag is set: -XX:-UseCodeCacheFlushing 12.475 - warning("Shutting down compiler %s (no space to run compilers)", comp->name()); 12.476 + warning("%s initialization failed. Shutting down all compilers", comp->name()); 12.477 12.478 // Only one thread per compiler runtime object enters here 12.479 // Set state to shut down 12.480 comp->set_shut_down(); 12.481 12.482 - MutexLocker mu(MethodCompileQueue_lock, thread); 12.483 - CompileQueue* queue; 12.484 - if (_c1_method_queue != NULL) { 12.485 - _c1_method_queue->delete_all(); 12.486 - queue = _c1_method_queue; 12.487 - _c1_method_queue = NULL; 12.488 - delete _c1_method_queue; 12.489 + // Delete all queued compilation tasks to make compiler threads exit faster. 12.490 + if (_c1_compile_queue != NULL) { 12.491 + _c1_compile_queue->free_all(); 12.492 } 12.493 12.494 - if (_c2_method_queue != NULL) { 12.495 - _c2_method_queue->delete_all(); 12.496 - queue = _c2_method_queue; 12.497 - _c2_method_queue = NULL; 12.498 - delete _c2_method_queue; 12.499 + if (_c2_compile_queue != NULL) { 12.500 + _c2_compile_queue->free_all(); 12.501 } 12.502 12.503 + // Set flags so that we continue execution with using interpreter only. 12.504 + UseCompiler = false; 12.505 + UseInterpreter = true; 12.506 + 12.507 // We could delete compiler runtimes also. However, there are references to 12.508 // the compiler runtime(s) (e.g., nmethod::is_compiled_by_c1()) which then 12.509 // fail. This can be done later if necessary. 12.510 @@ -1781,22 +1812,6 @@ 12.511 if (method()->number_of_breakpoints() == 0) { 12.512 // Compile the method. 12.513 if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) { 12.514 -#ifdef COMPILER1 12.515 - // Allow repeating compilations for the purpose of benchmarking 12.516 - // compile speed. This is not useful for customers. 12.517 - if (CompilationRepeat != 0) { 12.518 - int compile_count = CompilationRepeat; 12.519 - while (compile_count > 0) { 12.520 - invoke_compiler_on_method(task); 12.521 - nmethod* nm = method->code(); 12.522 - if (nm != NULL) { 12.523 - nm->make_zombie(); 12.524 - method->clear_code(); 12.525 - } 12.526 - compile_count--; 12.527 - } 12.528 - } 12.529 -#endif /* COMPILER1 */ 12.530 invoke_compiler_on_method(task); 12.531 } else { 12.532 // After compilation is disabled, remove remaining methods from queue
13.1 --- a/src/share/vm/compiler/compileBroker.hpp Fri Oct 31 17:09:14 2014 -0700 13.2 +++ b/src/share/vm/compiler/compileBroker.hpp Thu Nov 06 09:39:49 2014 -0800 13.3 @@ -40,6 +40,11 @@ 13.4 friend class VMStructs; 13.5 13.6 private: 13.7 + static CompileTask* _task_free_list; 13.8 +#ifdef ASSERT 13.9 + static int _num_allocated_tasks; 13.10 +#endif 13.11 + 13.12 Monitor* _lock; 13.13 uint _compile_id; 13.14 Method* _method; 13.15 @@ -52,7 +57,7 @@ 13.16 int _num_inlined_bytecodes; 13.17 nmethodLocker* _code_handle; // holder of eventual result 13.18 CompileTask* _next, *_prev; 13.19 - 13.20 + bool _is_free; 13.21 // Fields used for logging why the compilation was initiated: 13.22 jlong _time_queued; // in units of os::elapsed_counter() 13.23 Method* _hot_method; // which method actually triggered this task 13.24 @@ -70,7 +75,8 @@ 13.25 methodHandle hot_method, int hot_count, const char* comment, 13.26 bool is_blocking); 13.27 13.28 - void free(); 13.29 + static CompileTask* allocate(); 13.30 + static void free(CompileTask* task); 13.31 13.32 int compile_id() const { return _compile_id; } 13.33 Method* method() const { return _method; } 13.34 @@ -99,6 +105,8 @@ 13.35 void set_next(CompileTask* next) { _next = next; } 13.36 CompileTask* prev() const { return _prev; } 13.37 void set_prev(CompileTask* prev) { _prev = prev; } 13.38 + bool is_free() const { return _is_free; } 13.39 + void set_is_free(bool val) { _is_free = val; } 13.40 13.41 private: 13.42 static void print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level, 13.43 @@ -225,8 +233,8 @@ 13.44 13.45 // Redefine Classes support 13.46 void mark_on_stack(); 13.47 - void delete_all(); 13.48 - void print(); 13.49 + void free_all(); 13.50 + NOT_PRODUCT (void print();) 13.51 13.52 ~CompileQueue() { 13.53 assert (is_empty(), " Compile Queue must be empty"); 13.54 @@ -279,9 +287,8 @@ 13.55 static int _last_compile_level; 13.56 static char _last_method_compiled[name_buffer_length]; 13.57 13.58 - static CompileQueue* _c2_method_queue; 13.59 - static CompileQueue* _c1_method_queue; 13.60 - static CompileTask* _task_free_list; 13.61 + static CompileQueue* _c2_compile_queue; 13.62 + static CompileQueue* _c1_compile_queue; 13.63 13.64 static GrowableArray<CompilerThread*>* _compiler_threads; 13.65 13.66 @@ -334,7 +341,7 @@ 13.67 static void init_compiler_threads(int c1_compiler_count, int c2_compiler_count); 13.68 static bool compilation_is_complete (methodHandle method, int osr_bci, int comp_level); 13.69 static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level); 13.70 - static bool is_compile_blocking (methodHandle method, int osr_bci); 13.71 + static bool is_compile_blocking (); 13.72 static void preload_classes (methodHandle method, TRAPS); 13.73 13.74 static CompileTask* create_compile_task(CompileQueue* queue, 13.75 @@ -346,8 +353,6 @@ 13.76 int hot_count, 13.77 const char* comment, 13.78 bool blocking); 13.79 - static CompileTask* allocate_task(); 13.80 - static void free_task(CompileTask* task); 13.81 static void wait_for_completion(CompileTask* task); 13.82 13.83 static void invoke_compiler_on_method(CompileTask* task); 13.84 @@ -365,8 +370,8 @@ 13.85 const char* comment, 13.86 Thread* thread); 13.87 static CompileQueue* compile_queue(int comp_level) { 13.88 - if (is_c2_compile(comp_level)) return _c2_method_queue; 13.89 - if (is_c1_compile(comp_level)) return _c1_method_queue; 13.90 + if (is_c2_compile(comp_level)) return _c2_compile_queue; 13.91 + if (is_c1_compile(comp_level)) return _c1_compile_queue; 13.92 return NULL; 13.93 } 13.94 static bool init_compiler_runtime(); 13.95 @@ -384,7 +389,7 @@ 13.96 return NULL; 13.97 } 13.98 13.99 - static bool compilation_is_in_queue(methodHandle method, int osr_bci); 13.100 + static bool compilation_is_in_queue(methodHandle method); 13.101 static int queue_size(int comp_level) { 13.102 CompileQueue *q = compile_queue(comp_level); 13.103 return q != NULL ? q->size() : 0;
14.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Oct 31 17:09:14 2014 -0700 14.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Nov 06 09:39:49 2014 -0800 14.3 @@ -2478,6 +2478,7 @@ 14.4 14.5 unsigned int gc_count_before; 14.6 unsigned int old_marking_count_before; 14.7 + unsigned int full_gc_count_before; 14.8 bool retry_gc; 14.9 14.10 do { 14.11 @@ -2488,6 +2489,7 @@ 14.12 14.13 // Read the GC count while holding the Heap_lock 14.14 gc_count_before = total_collections(); 14.15 + full_gc_count_before = total_full_collections(); 14.16 old_marking_count_before = _old_marking_cycles_started; 14.17 } 14.18 14.19 @@ -2532,7 +2534,7 @@ 14.20 VMThread::execute(&op); 14.21 } else { 14.22 // Schedule a Full GC. 14.23 - VM_G1CollectFull op(gc_count_before, old_marking_count_before, cause); 14.24 + VM_G1CollectFull op(gc_count_before, full_gc_count_before, cause); 14.25 VMThread::execute(&op); 14.26 } 14.27 }
15.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Oct 31 17:09:14 2014 -0700 15.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Nov 06 09:39:49 2014 -0800 15.3 @@ -1249,7 +1249,7 @@ 15.4 // The same as above but assume that the caller holds the Heap_lock. 15.5 void collect_locked(GCCause::Cause cause); 15.6 15.7 - virtual void copy_allocation_context_stats(const jint* contexts, 15.8 + virtual bool copy_allocation_context_stats(const jint* contexts, 15.9 jlong* totals, 15.10 jbyte* accuracy, 15.11 jint len);
16.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp Fri Oct 31 17:09:14 2014 -0700 16.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp Thu Nov 06 09:39:49 2014 -0800 16.3 @@ -25,8 +25,9 @@ 16.4 #include "precompiled.hpp" 16.5 #include "gc_implementation/g1/g1CollectedHeap.hpp" 16.6 16.7 -void G1CollectedHeap::copy_allocation_context_stats(const jint* contexts, 16.8 +bool G1CollectedHeap::copy_allocation_context_stats(const jint* contexts, 16.9 jlong* totals, 16.10 jbyte* accuracy, 16.11 jint len) { 16.12 + return false; 16.13 }
17.1 --- a/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp Fri Oct 31 17:09:14 2014 -0700 17.2 +++ b/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp Thu Nov 06 09:39:49 2014 -0800 17.3 @@ -60,7 +60,7 @@ 17.4 VM_G1CollectFull(unsigned int gc_count_before, 17.5 unsigned int full_gc_count_before, 17.6 GCCause::Cause cause) 17.7 - : VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { } 17.8 + : VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { } 17.9 virtual VMOp_Type type() const { return VMOp_G1CollectFull; } 17.10 virtual void doit(); 17.11 virtual const char* name() const {
18.1 --- a/src/share/vm/gc_interface/collectedHeap.hpp Fri Oct 31 17:09:14 2014 -0700 18.2 +++ b/src/share/vm/gc_interface/collectedHeap.hpp Thu Nov 06 09:39:49 2014 -0800 18.3 @@ -641,10 +641,13 @@ 18.4 // For each context in contexts, set the corresponding entries in the totals 18.5 // and accuracy arrays to the current values held by the statistics. Each 18.6 // array should be of length len. 18.7 - virtual void copy_allocation_context_stats(const jint* contexts, 18.8 + // Returns true if there are more stats available. 18.9 + virtual bool copy_allocation_context_stats(const jint* contexts, 18.10 jlong* totals, 18.11 jbyte* accuracy, 18.12 - jint len) { } 18.13 + jint len) { 18.14 + return false; 18.15 + } 18.16 18.17 /////////////// Unit tests /////////////// 18.18
19.1 --- a/src/share/vm/memory/collectorPolicy.cpp Fri Oct 31 17:09:14 2014 -0700 19.2 +++ b/src/share/vm/memory/collectorPolicy.cpp Thu Nov 06 09:39:49 2014 -0800 19.3 @@ -183,13 +183,9 @@ 19.4 // Requirements of any new remembered set implementations must be added here. 19.5 size_t alignment = GenRemSet::max_alignment_constraint(GenRemSet::CardTable); 19.6 19.7 - // Parallel GC does its own alignment of the generations to avoid requiring a 19.8 - // large page (256M on some platforms) for the permanent generation. The 19.9 - // other collectors should also be updated to do their own alignment and then 19.10 - // this use of lcm() should be removed. 19.11 - if (UseLargePages && !UseParallelGC) { 19.12 - // in presence of large pages we have to make sure that our 19.13 - // alignment is large page aware 19.14 + if (UseLargePages) { 19.15 + // In presence of large pages we have to make sure that our 19.16 + // alignment is large page aware. 19.17 alignment = lcm(os::large_page_size(), alignment); 19.18 } 19.19
20.1 --- a/src/share/vm/memory/metaspace.cpp Fri Oct 31 17:09:14 2014 -0700 20.2 +++ b/src/share/vm/memory/metaspace.cpp Thu Nov 06 09:39:49 2014 -0800 20.3 @@ -3141,7 +3141,7 @@ 20.4 MetaspaceGC::initialize(); 20.5 20.6 // Initialize the alignment for shared spaces. 20.7 - int max_alignment = os::vm_page_size(); 20.8 + int max_alignment = os::vm_allocation_granularity(); 20.9 size_t cds_total = 0; 20.10 20.11 MetaspaceShared::set_max_alignment(max_alignment); 20.12 @@ -3155,6 +3155,16 @@ 20.13 SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment); 20.14 SharedMiscCodeSize = align_size_up(SharedMiscCodeSize, max_alignment); 20.15 20.16 + // the min_misc_code_size estimate is based on MetaspaceShared::generate_vtable_methods() 20.17 + uintx min_misc_code_size = align_size_up( 20.18 + (MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size) * 20.19 + (sizeof(void*) + MetaspaceShared::vtbl_method_size) + MetaspaceShared::vtbl_common_code_size, 20.20 + max_alignment); 20.21 + 20.22 + if (SharedMiscCodeSize < min_misc_code_size) { 20.23 + report_out_of_shared_space(SharedMiscCode); 20.24 + } 20.25 + 20.26 // Initialize with the sum of the shared space sizes. The read-only 20.27 // and read write metaspace chunks will be allocated out of this and the 20.28 // remainder is the misc code and data chunks.
21.1 --- a/src/share/vm/memory/metaspaceShared.hpp Fri Oct 31 17:09:14 2014 -0700 21.2 +++ b/src/share/vm/memory/metaspaceShared.hpp Thu Nov 06 09:39:49 2014 -0800 21.3 @@ -57,11 +57,16 @@ 21.4 static bool _archive_loading_failed; 21.5 public: 21.6 enum { 21.7 - vtbl_list_size = 17, // number of entries in the shared space vtable list. 21.8 - num_virtuals = 200 // maximum number of virtual functions 21.9 - // If virtual functions are added to Metadata, 21.10 - // this number needs to be increased. Also, 21.11 - // SharedMiscCodeSize will need to be increased. 21.12 + vtbl_list_size = 17, // number of entries in the shared space vtable list. 21.13 + num_virtuals = 200, // maximum number of virtual functions 21.14 + // If virtual functions are added to Metadata, 21.15 + // this number needs to be increased. Also, 21.16 + // SharedMiscCodeSize will need to be increased. 21.17 + // The following 2 sizes were based on 21.18 + // MetaspaceShared::generate_vtable_methods() 21.19 + vtbl_method_size = 16, // conservative size of the mov1 and jmp instructions 21.20 + // for the x64 platform 21.21 + vtbl_common_code_size = (1*K) // conservative size of the "common_code" for the x64 platform 21.22 }; 21.23 21.24 enum {
22.1 --- a/src/share/vm/oops/instanceKlass.cpp Fri Oct 31 17:09:14 2014 -0700 22.2 +++ b/src/share/vm/oops/instanceKlass.cpp Thu Nov 06 09:39:49 2014 -0800 22.3 @@ -780,6 +780,41 @@ 22.4 } 22.5 } 22.6 22.7 +// Eagerly initialize superinterfaces that declare default methods (concrete instance: any access) 22.8 +void InstanceKlass::initialize_super_interfaces(instanceKlassHandle this_oop, TRAPS) { 22.9 + if (this_oop->has_default_methods()) { 22.10 + for (int i = 0; i < this_oop->local_interfaces()->length(); ++i) { 22.11 + Klass* iface = this_oop->local_interfaces()->at(i); 22.12 + InstanceKlass* ik = InstanceKlass::cast(iface); 22.13 + if (ik->should_be_initialized()) { 22.14 + if (ik->has_default_methods()) { 22.15 + ik->initialize_super_interfaces(ik, THREAD); 22.16 + } 22.17 + // Only initialize() interfaces that "declare" concrete methods. 22.18 + // has_default_methods drives searching superinterfaces since it 22.19 + // means has_default_methods in its superinterface hierarchy 22.20 + if (!HAS_PENDING_EXCEPTION && ik->declares_default_methods()) { 22.21 + ik->initialize(THREAD); 22.22 + } 22.23 + if (HAS_PENDING_EXCEPTION) { 22.24 + Handle e(THREAD, PENDING_EXCEPTION); 22.25 + CLEAR_PENDING_EXCEPTION; 22.26 + { 22.27 + EXCEPTION_MARK; 22.28 + // Locks object, set state, and notify all waiting threads 22.29 + this_oop->set_initialization_state_and_notify( 22.30 + initialization_error, THREAD); 22.31 + 22.32 + // ignore any exception thrown, superclass initialization error is 22.33 + // thrown below 22.34 + CLEAR_PENDING_EXCEPTION; 22.35 + } 22.36 + THROW_OOP(e()); 22.37 + } 22.38 + } 22.39 + } 22.40 + } 22.41 +} 22.42 22.43 void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) { 22.44 // Make sure klass is linked (verified) before initialization 22.45 @@ -859,33 +894,11 @@ 22.46 } 22.47 } 22.48 22.49 + // Recursively initialize any superinterfaces that declare default methods 22.50 + // Only need to recurse if has_default_methods which includes declaring and 22.51 + // inheriting default methods 22.52 if (this_oop->has_default_methods()) { 22.53 - // Step 7.5: initialize any interfaces which have default methods 22.54 - for (int i = 0; i < this_oop->local_interfaces()->length(); ++i) { 22.55 - Klass* iface = this_oop->local_interfaces()->at(i); 22.56 - InstanceKlass* ik = InstanceKlass::cast(iface); 22.57 - if (ik->has_default_methods() && ik->should_be_initialized()) { 22.58 - ik->initialize(THREAD); 22.59 - 22.60 - if (HAS_PENDING_EXCEPTION) { 22.61 - Handle e(THREAD, PENDING_EXCEPTION); 22.62 - CLEAR_PENDING_EXCEPTION; 22.63 - { 22.64 - EXCEPTION_MARK; 22.65 - // Locks object, set state, and notify all waiting threads 22.66 - this_oop->set_initialization_state_and_notify( 22.67 - initialization_error, THREAD); 22.68 - 22.69 - // ignore any exception thrown, superclass initialization error is 22.70 - // thrown below 22.71 - CLEAR_PENDING_EXCEPTION; 22.72 - } 22.73 - DTRACE_CLASSINIT_PROBE_WAIT( 22.74 - super__failed, InstanceKlass::cast(this_oop()), -1, wait); 22.75 - THROW_OOP(e()); 22.76 - } 22.77 - } 22.78 - } 22.79 + this_oop->initialize_super_interfaces(this_oop, CHECK); 22.80 } 22.81 22.82 // Step 8
23.1 --- a/src/share/vm/oops/instanceKlass.hpp Fri Oct 31 17:09:14 2014 -0700 23.2 +++ b/src/share/vm/oops/instanceKlass.hpp Thu Nov 06 09:39:49 2014 -0800 23.3 @@ -229,12 +229,13 @@ 23.4 bool _has_unloaded_dependent; 23.5 23.6 enum { 23.7 - _misc_rewritten = 1 << 0, // methods rewritten. 23.8 - _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops 23.9 - _misc_should_verify_class = 1 << 2, // allow caching of preverification 23.10 - _misc_is_anonymous = 1 << 3, // has embedded _host_klass field 23.11 - _misc_is_contended = 1 << 4, // marked with contended annotation 23.12 - _misc_has_default_methods = 1 << 5 // class/superclass/implemented interfaces has default methods 23.13 + _misc_rewritten = 1 << 0, // methods rewritten. 23.14 + _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops 23.15 + _misc_should_verify_class = 1 << 2, // allow caching of preverification 23.16 + _misc_is_anonymous = 1 << 3, // has embedded _host_klass field 23.17 + _misc_is_contended = 1 << 4, // marked with contended annotation 23.18 + _misc_has_default_methods = 1 << 5, // class/superclass/implemented interfaces has default methods 23.19 + _misc_declares_default_methods = 1 << 6 // directly declares default methods (any access) 23.20 }; 23.21 u2 _misc_flags; 23.22 u2 _minor_version; // minor version number of class file 23.23 @@ -680,6 +681,17 @@ 23.24 } 23.25 } 23.26 23.27 + bool declares_default_methods() const { 23.28 + return (_misc_flags & _misc_declares_default_methods) != 0; 23.29 + } 23.30 + void set_declares_default_methods(bool b) { 23.31 + if (b) { 23.32 + _misc_flags |= _misc_declares_default_methods; 23.33 + } else { 23.34 + _misc_flags &= ~_misc_declares_default_methods; 23.35 + } 23.36 + } 23.37 + 23.38 // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available 23.39 inline u2 next_method_idnum(); 23.40 void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; } 23.41 @@ -1046,6 +1058,7 @@ 23.42 static bool link_class_impl (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS); 23.43 static bool verify_code (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS); 23.44 static void initialize_impl (instanceKlassHandle this_oop, TRAPS); 23.45 + static void initialize_super_interfaces (instanceKlassHandle this_oop, TRAPS); 23.46 static void eager_initialize_impl (instanceKlassHandle this_oop); 23.47 static void set_initialization_state_and_notify_impl (instanceKlassHandle this_oop, ClassState state, TRAPS); 23.48 static void call_class_initializer_impl (instanceKlassHandle this_oop, TRAPS);
24.1 --- a/src/share/vm/oops/objArrayOop.hpp Fri Oct 31 17:09:14 2014 -0700 24.2 +++ b/src/share/vm/oops/objArrayOop.hpp Thu Nov 06 09:39:49 2014 -0800 24.3 @@ -45,9 +45,10 @@ 24.4 private: 24.5 // Give size of objArrayOop in HeapWords minus the header 24.6 static int array_size(int length) { 24.7 - const int OopsPerHeapWord = HeapWordSize/heapOopSize; 24.8 + const uint OopsPerHeapWord = HeapWordSize/heapOopSize; 24.9 assert(OopsPerHeapWord >= 1 && (HeapWordSize % heapOopSize == 0), 24.10 "Else the following (new) computation would be in error"); 24.11 + uint res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord; 24.12 #ifdef ASSERT 24.13 // The old code is left in for sanity-checking; it'll 24.14 // go away pretty soon. XXX 24.15 @@ -55,16 +56,15 @@ 24.16 // oop->length() * HeapWordsPerOop; 24.17 // With narrowOops, HeapWordsPerOop is 1/2 or equal 0 as an integer. 24.18 // The oop elements are aligned up to wordSize 24.19 - const int HeapWordsPerOop = heapOopSize/HeapWordSize; 24.20 - int old_res; 24.21 + const uint HeapWordsPerOop = heapOopSize/HeapWordSize; 24.22 + uint old_res; 24.23 if (HeapWordsPerOop > 0) { 24.24 old_res = length * HeapWordsPerOop; 24.25 } else { 24.26 - old_res = align_size_up(length, OopsPerHeapWord)/OopsPerHeapWord; 24.27 + old_res = align_size_up((uint)length, OopsPerHeapWord)/OopsPerHeapWord; 24.28 } 24.29 + assert(res == old_res, "Inconsistency between old and new."); 24.30 #endif // ASSERT 24.31 - int res = ((uint)length + OopsPerHeapWord - 1)/OopsPerHeapWord; 24.32 - assert(res == old_res, "Inconsistency between old and new."); 24.33 return res; 24.34 } 24.35
25.1 --- a/src/share/vm/oops/typeArrayOop.hpp Fri Oct 31 17:09:14 2014 -0700 25.2 +++ b/src/share/vm/oops/typeArrayOop.hpp Thu Nov 06 09:39:49 2014 -0800 25.3 @@ -150,7 +150,7 @@ 25.4 DEBUG_ONLY(BasicType etype = Klass::layout_helper_element_type(lh)); 25.5 assert(length <= arrayOopDesc::max_array_length(etype), "no overflow"); 25.6 25.7 - julong size_in_bytes = length; 25.8 + julong size_in_bytes = (juint)length; 25.9 size_in_bytes <<= element_shift; 25.10 size_in_bytes += instance_header_size; 25.11 julong size_in_words = ((size_in_bytes + (HeapWordSize-1)) >> LogHeapWordSize);
26.1 --- a/src/share/vm/opto/c2_globals.hpp Fri Oct 31 17:09:14 2014 -0700 26.2 +++ b/src/share/vm/opto/c2_globals.hpp Thu Nov 06 09:39:49 2014 -0800 26.3 @@ -473,6 +473,9 @@ 26.4 product(bool, DoEscapeAnalysis, true, \ 26.5 "Perform escape analysis") \ 26.6 \ 26.7 + product(double, EscapeAnalysisTimeout, 20. DEBUG_ONLY(+40.), \ 26.8 + "Abort EA when it reaches time limit (in sec)") \ 26.9 + \ 26.10 develop(bool, ExitEscapeAnalysisOnTimeout, true, \ 26.11 "Exit or throw assert in EA when it reaches time limit") \ 26.12 \
27.1 --- a/src/share/vm/opto/callGenerator.cpp Fri Oct 31 17:09:14 2014 -0700 27.2 +++ b/src/share/vm/opto/callGenerator.cpp Thu Nov 06 09:39:49 2014 -0800 27.3 @@ -862,7 +862,7 @@ 27.4 call_does_dispatch, vtable_index); // out-parameters 27.5 // We lack profiling at this call but type speculation may 27.6 // provide us with a type 27.7 - speculative_receiver_type = receiver_type->speculative_type(); 27.8 + speculative_receiver_type = (receiver_type != NULL) ? receiver_type->speculative_type() : NULL; 27.9 } 27.10 27.11 CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, true, true);
28.1 --- a/src/share/vm/opto/coalesce.cpp Fri Oct 31 17:09:14 2014 -0700 28.2 +++ b/src/share/vm/opto/coalesce.cpp Thu Nov 06 09:39:49 2014 -0800 28.3 @@ -281,9 +281,11 @@ 28.4 Block *pred = _phc._cfg.get_block_for_node(b->pred(j)); 28.5 Node *copy; 28.6 assert(!m->is_Con() || m->is_Mach(), "all Con must be Mach"); 28.7 - // Rematerialize constants instead of copying them 28.8 - if( m->is_Mach() && m->as_Mach()->is_Con() && 28.9 - m->as_Mach()->rematerialize() ) { 28.10 + // Rematerialize constants instead of copying them. 28.11 + // We do this only for immediate constants, we avoid constant table loads 28.12 + // because that will unsafely extend the live range of the constant table base. 28.13 + if (m->is_Mach() && m->as_Mach()->is_Con() && !m->as_Mach()->is_MachConstant() && 28.14 + m->as_Mach()->rematerialize()) { 28.15 copy = m->clone(); 28.16 // Insert the copy in the predecessor basic block 28.17 pred->add_inst(copy); 28.18 @@ -317,8 +319,8 @@ 28.19 assert(!m->is_Con() || m->is_Mach(), "all Con must be Mach"); 28.20 // At this point it is unsafe to extend live ranges (6550579). 28.21 // Rematerialize only constants as we do for Phi above. 28.22 - if(m->is_Mach() && m->as_Mach()->is_Con() && 28.23 - m->as_Mach()->rematerialize()) { 28.24 + if (m->is_Mach() && m->as_Mach()->is_Con() && !m->as_Mach()->is_MachConstant() && 28.25 + m->as_Mach()->rematerialize()) { 28.26 copy = m->clone(); 28.27 // Insert the copy in the basic block, just before us 28.28 b->insert_node(copy, l++);
29.1 --- a/src/share/vm/opto/doCall.cpp Fri Oct 31 17:09:14 2014 -0700 29.2 +++ b/src/share/vm/opto/doCall.cpp Thu Nov 06 09:39:49 2014 -0800 29.3 @@ -799,10 +799,16 @@ 29.4 // each arm of the Phi. If I know something clever about the exceptions 29.5 // I'm loading the class from, I can replace the LoadKlass with the 29.6 // klass constant for the exception oop. 29.7 - if( ex_node->is_Phi() ) { 29.8 - ex_klass_node = new (C) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); 29.9 - for( uint i = 1; i < ex_node->req(); i++ ) { 29.10 - Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() ); 29.11 + if (ex_node->is_Phi()) { 29.12 + ex_klass_node = new (C) PhiNode(ex_node->in(0), TypeKlassPtr::OBJECT); 29.13 + for (uint i = 1; i < ex_node->req(); i++) { 29.14 + Node* ex_in = ex_node->in(i); 29.15 + if (ex_in == top() || ex_in == NULL) { 29.16 + // This path was not taken. 29.17 + ex_klass_node->init_req(i, top()); 29.18 + continue; 29.19 + } 29.20 + Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes()); 29.21 Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); 29.22 ex_klass_node->init_req( i, k ); 29.23 }
30.1 --- a/src/share/vm/opto/escape.cpp Fri Oct 31 17:09:14 2014 -0700 30.2 +++ b/src/share/vm/opto/escape.cpp Thu Nov 06 09:39:49 2014 -0800 30.3 @@ -37,6 +37,8 @@ 30.4 30.5 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) : 30.6 _nodes(C->comp_arena(), C->unique(), C->unique(), NULL), 30.7 + _in_worklist(C->comp_arena()), 30.8 + _next_pidx(0), 30.9 _collecting(true), 30.10 _verify(false), 30.11 _compile(C), 30.12 @@ -124,13 +126,19 @@ 30.13 if (C->root() != NULL) { 30.14 ideal_nodes.push(C->root()); 30.15 } 30.16 + // Processed ideal nodes are unique on ideal_nodes list 30.17 + // but several ideal nodes are mapped to the phantom_obj. 30.18 + // To avoid duplicated entries on the following worklists 30.19 + // add the phantom_obj only once to them. 30.20 + ptnodes_worklist.append(phantom_obj); 30.21 + java_objects_worklist.append(phantom_obj); 30.22 for( uint next = 0; next < ideal_nodes.size(); ++next ) { 30.23 Node* n = ideal_nodes.at(next); 30.24 // Create PointsTo nodes and add them to Connection Graph. Called 30.25 // only once per ideal node since ideal_nodes is Unique_Node list. 30.26 add_node_to_connection_graph(n, &delayed_worklist); 30.27 PointsToNode* ptn = ptnode_adr(n->_idx); 30.28 - if (ptn != NULL) { 30.29 + if (ptn != NULL && ptn != phantom_obj) { 30.30 ptnodes_worklist.append(ptn); 30.31 if (ptn->is_JavaObject()) { 30.32 java_objects_worklist.append(ptn->as_JavaObject()); 30.33 @@ -414,7 +422,7 @@ 30.34 } 30.35 case Op_CreateEx: { 30.36 // assume that all exception objects globally escape 30.37 - add_java_object(n, PointsToNode::GlobalEscape); 30.38 + map_ideal_node(n, phantom_obj); 30.39 break; 30.40 } 30.41 case Op_LoadKlass: 30.42 @@ -1065,13 +1073,8 @@ 30.43 // on graph complexity. Observed 8 passes in jvm2008 compiler.compiler. 30.44 // Set limit to 20 to catch situation when something did go wrong and 30.45 // bailout Escape Analysis. 30.46 - // Also limit build time to 30 sec (60 in debug VM). 30.47 + // Also limit build time to 20 sec (60 in debug VM), EscapeAnalysisTimeout flag. 30.48 #define CG_BUILD_ITER_LIMIT 20 30.49 -#ifdef ASSERT 30.50 -#define CG_BUILD_TIME_LIMIT 60.0 30.51 -#else 30.52 -#define CG_BUILD_TIME_LIMIT 30.0 30.53 -#endif 30.54 30.55 // Propagate GlobalEscape and ArgEscape escape states and check that 30.56 // we still have non-escaping objects. The method pushs on _worklist 30.57 @@ -1082,12 +1085,13 @@ 30.58 // Now propagate references to all JavaObject nodes. 30.59 int java_objects_length = java_objects_worklist.length(); 30.60 elapsedTimer time; 30.61 + bool timeout = false; 30.62 int new_edges = 1; 30.63 int iterations = 0; 30.64 do { 30.65 while ((new_edges > 0) && 30.66 - (iterations++ < CG_BUILD_ITER_LIMIT) && 30.67 - (time.seconds() < CG_BUILD_TIME_LIMIT)) { 30.68 + (iterations++ < CG_BUILD_ITER_LIMIT)) { 30.69 + double start_time = time.seconds(); 30.70 time.start(); 30.71 new_edges = 0; 30.72 // Propagate references to phantom_object for nodes pushed on _worklist 30.73 @@ -1096,7 +1100,26 @@ 30.74 for (int next = 0; next < java_objects_length; ++next) { 30.75 JavaObjectNode* ptn = java_objects_worklist.at(next); 30.76 new_edges += add_java_object_edges(ptn, true); 30.77 + 30.78 +#define SAMPLE_SIZE 4 30.79 + if ((next % SAMPLE_SIZE) == 0) { 30.80 + // Each 4 iterations calculate how much time it will take 30.81 + // to complete graph construction. 30.82 + time.stop(); 30.83 + double stop_time = time.seconds(); 30.84 + double time_per_iter = (stop_time - start_time) / (double)SAMPLE_SIZE; 30.85 + double time_until_end = time_per_iter * (double)(java_objects_length - next); 30.86 + if ((start_time + time_until_end) >= EscapeAnalysisTimeout) { 30.87 + timeout = true; 30.88 + break; // Timeout 30.89 + } 30.90 + start_time = stop_time; 30.91 + time.start(); 30.92 + } 30.93 +#undef SAMPLE_SIZE 30.94 + 30.95 } 30.96 + if (timeout) break; 30.97 if (new_edges > 0) { 30.98 // Update escape states on each iteration if graph was updated. 30.99 if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { 30.100 @@ -1104,9 +1127,12 @@ 30.101 } 30.102 } 30.103 time.stop(); 30.104 + if (time.seconds() >= EscapeAnalysisTimeout) { 30.105 + timeout = true; 30.106 + break; 30.107 + } 30.108 } 30.109 - if ((iterations < CG_BUILD_ITER_LIMIT) && 30.110 - (time.seconds() < CG_BUILD_TIME_LIMIT)) { 30.111 + if ((iterations < CG_BUILD_ITER_LIMIT) && !timeout) { 30.112 time.start(); 30.113 // Find fields which have unknown value. 30.114 int fields_length = oop_fields_worklist.length(); 30.115 @@ -1119,18 +1145,21 @@ 30.116 } 30.117 } 30.118 time.stop(); 30.119 + if (time.seconds() >= EscapeAnalysisTimeout) { 30.120 + timeout = true; 30.121 + break; 30.122 + } 30.123 } else { 30.124 new_edges = 0; // Bailout 30.125 } 30.126 } while (new_edges > 0); 30.127 30.128 // Bailout if passed limits. 30.129 - if ((iterations >= CG_BUILD_ITER_LIMIT) || 30.130 - (time.seconds() >= CG_BUILD_TIME_LIMIT)) { 30.131 + if ((iterations >= CG_BUILD_ITER_LIMIT) || timeout) { 30.132 Compile* C = _compile; 30.133 if (C->log() != NULL) { 30.134 C->log()->begin_elem("connectionGraph_bailout reason='reached "); 30.135 - C->log()->text("%s", (iterations >= CG_BUILD_ITER_LIMIT) ? "iterations" : "time"); 30.136 + C->log()->text("%s", timeout ? "time" : "iterations"); 30.137 C->log()->end_elem(" limit'"); 30.138 } 30.139 assert(ExitEscapeAnalysisOnTimeout, err_msg_res("infinite EA connection graph build (%f sec, %d iterations) with %d nodes and worklist size %d", 30.140 @@ -1147,7 +1176,6 @@ 30.141 #endif 30.142 30.143 #undef CG_BUILD_ITER_LIMIT 30.144 -#undef CG_BUILD_TIME_LIMIT 30.145 30.146 // Find fields initialized by NULL for non-escaping Allocations. 30.147 int non_escaped_length = non_escaped_worklist.length(); 30.148 @@ -1271,8 +1299,8 @@ 30.149 } 30.150 } 30.151 } 30.152 - while(_worklist.length() > 0) { 30.153 - PointsToNode* use = _worklist.pop(); 30.154 + for (int l = 0; l < _worklist.length(); l++) { 30.155 + PointsToNode* use = _worklist.at(l); 30.156 if (PointsToNode::is_base_use(use)) { 30.157 // Add reference from jobj to field and from field to jobj (field's base). 30.158 use = PointsToNode::get_use_node(use)->as_Field(); 30.159 @@ -1319,6 +1347,8 @@ 30.160 add_field_uses_to_worklist(use->as_Field()); 30.161 } 30.162 } 30.163 + _worklist.clear(); 30.164 + _in_worklist.Reset(); 30.165 return new_edges; 30.166 } 30.167 30.168 @@ -1898,7 +1928,7 @@ 30.169 return; 30.170 } 30.171 Compile* C = _compile; 30.172 - ptadr = new (C->comp_arena()) LocalVarNode(C, n, es); 30.173 + ptadr = new (C->comp_arena()) LocalVarNode(this, n, es); 30.174 _nodes.at_put(n->_idx, ptadr); 30.175 } 30.176 30.177 @@ -1909,7 +1939,7 @@ 30.178 return; 30.179 } 30.180 Compile* C = _compile; 30.181 - ptadr = new (C->comp_arena()) JavaObjectNode(C, n, es); 30.182 + ptadr = new (C->comp_arena()) JavaObjectNode(this, n, es); 30.183 _nodes.at_put(n->_idx, ptadr); 30.184 } 30.185 30.186 @@ -1925,7 +1955,7 @@ 30.187 es = PointsToNode::GlobalEscape; 30.188 } 30.189 Compile* C = _compile; 30.190 - FieldNode* field = new (C->comp_arena()) FieldNode(C, n, es, offset, is_oop); 30.191 + FieldNode* field = new (C->comp_arena()) FieldNode(this, n, es, offset, is_oop); 30.192 _nodes.at_put(n->_idx, field); 30.193 } 30.194 30.195 @@ -1939,7 +1969,7 @@ 30.196 return; 30.197 } 30.198 Compile* C = _compile; 30.199 - ptadr = new (C->comp_arena()) ArraycopyNode(C, n, es); 30.200 + ptadr = new (C->comp_arena()) ArraycopyNode(this, n, es); 30.201 _nodes.at_put(n->_idx, ptadr); 30.202 // Add edge from arraycopy node to source object. 30.203 (void)add_edge(ptadr, src); 30.204 @@ -2839,6 +2869,13 @@ 30.205 continue; 30.206 } 30.207 } 30.208 + 30.209 + const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); 30.210 + if (t == NULL) 30.211 + continue; // not a TypeOopPtr 30.212 + if (!t->klass_is_exact()) 30.213 + continue; // not an unique type 30.214 + 30.215 if (alloc->is_Allocate()) { 30.216 // Set the scalar_replaceable flag for allocation 30.217 // so it could be eliminated. 30.218 @@ -2857,10 +2894,7 @@ 30.219 // - not determined to be ineligible by escape analysis 30.220 set_map(alloc, n); 30.221 set_map(n, alloc); 30.222 - const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); 30.223 - if (t == NULL) 30.224 - continue; // not a TypeOopPtr 30.225 - const TypeOopPtr* tinst = t->cast_to_exactness(true)->is_oopptr()->cast_to_instance_id(ni); 30.226 + const TypeOopPtr* tinst = t->cast_to_instance_id(ni); 30.227 igvn->hash_delete(n); 30.228 igvn->set_type(n, tinst); 30.229 n->raise_bottom_type(tinst);
31.1 --- a/src/share/vm/opto/escape.hpp Fri Oct 31 17:09:14 2014 -0700 31.2 +++ b/src/share/vm/opto/escape.hpp Thu Nov 06 09:39:49 2014 -0800 31.3 @@ -125,6 +125,8 @@ 31.4 class FieldNode; 31.5 class ArraycopyNode; 31.6 31.7 +class ConnectionGraph; 31.8 + 31.9 // ConnectionGraph nodes 31.10 class PointsToNode : public ResourceObj { 31.11 GrowableArray<PointsToNode*> _edges; // List of nodes this node points to 31.12 @@ -137,6 +139,7 @@ 31.13 31.14 Node* const _node; // Ideal node corresponding to this PointsTo node. 31.15 const int _idx; // Cached ideal node's _idx 31.16 + const uint _pidx; // Index of this node 31.17 31.18 public: 31.19 typedef enum { 31.20 @@ -165,17 +168,9 @@ 31.21 } NodeFlags; 31.22 31.23 31.24 - PointsToNode(Compile *C, Node* n, EscapeState es, NodeType type): 31.25 - _edges(C->comp_arena(), 2, 0, NULL), 31.26 - _uses (C->comp_arena(), 2, 0, NULL), 31.27 - _node(n), 31.28 - _idx(n->_idx), 31.29 - _type((u1)type), 31.30 - _escape((u1)es), 31.31 - _fields_escape((u1)es), 31.32 - _flags(ScalarReplaceable) { 31.33 - assert(n != NULL && es != UnknownEscape, "sanity"); 31.34 - } 31.35 + inline PointsToNode(ConnectionGraph* CG, Node* n, EscapeState es, NodeType type); 31.36 + 31.37 + uint pidx() const { return _pidx; } 31.38 31.39 Node* ideal_node() const { return _node; } 31.40 int idx() const { return _idx; } 31.41 @@ -243,14 +238,14 @@ 31.42 31.43 class LocalVarNode: public PointsToNode { 31.44 public: 31.45 - LocalVarNode(Compile *C, Node* n, EscapeState es): 31.46 - PointsToNode(C, n, es, LocalVar) {} 31.47 + LocalVarNode(ConnectionGraph *CG, Node* n, EscapeState es): 31.48 + PointsToNode(CG, n, es, LocalVar) {} 31.49 }; 31.50 31.51 class JavaObjectNode: public PointsToNode { 31.52 public: 31.53 - JavaObjectNode(Compile *C, Node* n, EscapeState es): 31.54 - PointsToNode(C, n, es, JavaObject) { 31.55 + JavaObjectNode(ConnectionGraph *CG, Node* n, EscapeState es): 31.56 + PointsToNode(CG, n, es, JavaObject) { 31.57 if (es > NoEscape) 31.58 set_scalar_replaceable(false); 31.59 } 31.60 @@ -262,8 +257,8 @@ 31.61 const bool _is_oop; // Field points to object 31.62 bool _has_unknown_base; // Has phantom_object base 31.63 public: 31.64 - FieldNode(Compile *C, Node* n, EscapeState es, int offs, bool is_oop): 31.65 - PointsToNode(C, n, es, Field), 31.66 + FieldNode(ConnectionGraph *CG, Node* n, EscapeState es, int offs, bool is_oop): 31.67 + PointsToNode(CG, n, es, Field), 31.68 _offset(offs), _is_oop(is_oop), 31.69 _has_unknown_base(false) {} 31.70 31.71 @@ -284,8 +279,8 @@ 31.72 31.73 class ArraycopyNode: public PointsToNode { 31.74 public: 31.75 - ArraycopyNode(Compile *C, Node* n, EscapeState es): 31.76 - PointsToNode(C, n, es, Arraycopy) {} 31.77 + ArraycopyNode(ConnectionGraph *CG, Node* n, EscapeState es): 31.78 + PointsToNode(CG, n, es, Arraycopy) {} 31.79 }; 31.80 31.81 // Iterators for PointsTo node's edges: 31.82 @@ -323,11 +318,14 @@ 31.83 31.84 31.85 class ConnectionGraph: public ResourceObj { 31.86 + friend class PointsToNode; 31.87 private: 31.88 GrowableArray<PointsToNode*> _nodes; // Map from ideal nodes to 31.89 // ConnectionGraph nodes. 31.90 31.91 GrowableArray<PointsToNode*> _worklist; // Nodes to be processed 31.92 + VectorSet _in_worklist; 31.93 + uint _next_pidx; 31.94 31.95 bool _collecting; // Indicates whether escape information 31.96 // is still being collected. If false, 31.97 @@ -353,6 +351,8 @@ 31.98 } 31.99 uint nodes_size() const { return _nodes.length(); } 31.100 31.101 + uint next_pidx() { return _next_pidx++; } 31.102 + 31.103 // Add nodes to ConnectionGraph. 31.104 void add_local_var(Node* n, PointsToNode::EscapeState es); 31.105 void add_java_object(Node* n, PointsToNode::EscapeState es); 31.106 @@ -396,15 +396,26 @@ 31.107 int add_java_object_edges(JavaObjectNode* jobj, bool populate_worklist); 31.108 31.109 // Put node on worklist if it is (or was) not there. 31.110 - void add_to_worklist(PointsToNode* pt) { 31.111 - _worklist.push(pt); 31.112 - return; 31.113 + inline void add_to_worklist(PointsToNode* pt) { 31.114 + PointsToNode* ptf = pt; 31.115 + uint pidx_bias = 0; 31.116 + if (PointsToNode::is_base_use(pt)) { 31.117 + // Create a separate entry in _in_worklist for a marked base edge 31.118 + // because _worklist may have an entry for a normal edge pointing 31.119 + // to the same node. To separate them use _next_pidx as bias. 31.120 + ptf = PointsToNode::get_use_node(pt)->as_Field(); 31.121 + pidx_bias = _next_pidx; 31.122 + } 31.123 + if (!_in_worklist.test_set(ptf->pidx() + pidx_bias)) { 31.124 + _worklist.append(pt); 31.125 + } 31.126 } 31.127 31.128 // Put on worklist all uses of this node. 31.129 - void add_uses_to_worklist(PointsToNode* pt) { 31.130 - for (UseIterator i(pt); i.has_next(); i.next()) 31.131 - _worklist.push(i.get()); 31.132 + inline void add_uses_to_worklist(PointsToNode* pt) { 31.133 + for (UseIterator i(pt); i.has_next(); i.next()) { 31.134 + add_to_worklist(i.get()); 31.135 + } 31.136 } 31.137 31.138 // Put on worklist all field's uses and related field nodes. 31.139 @@ -517,8 +528,8 @@ 31.140 } 31.141 // Helper functions 31.142 bool is_oop_field(Node* n, int offset, bool* unsafe); 31.143 - static Node* get_addp_base(Node *addp); 31.144 - static Node* find_second_addp(Node* addp, Node* n); 31.145 + static Node* get_addp_base(Node *addp); 31.146 + static Node* find_second_addp(Node* addp, Node* n); 31.147 // offset of a field reference 31.148 int address_offset(Node* adr, PhaseTransform *phase); 31.149 31.150 @@ -587,4 +598,17 @@ 31.151 #endif 31.152 }; 31.153 31.154 +inline PointsToNode::PointsToNode(ConnectionGraph *CG, Node* n, EscapeState es, NodeType type): 31.155 + _edges(CG->_compile->comp_arena(), 2, 0, NULL), 31.156 + _uses (CG->_compile->comp_arena(), 2, 0, NULL), 31.157 + _node(n), 31.158 + _idx(n->_idx), 31.159 + _pidx(CG->next_pidx()), 31.160 + _type((u1)type), 31.161 + _escape((u1)es), 31.162 + _fields_escape((u1)es), 31.163 + _flags(ScalarReplaceable) { 31.164 + assert(n != NULL && es != UnknownEscape, "sanity"); 31.165 +} 31.166 + 31.167 #endif // SHARE_VM_OPTO_ESCAPE_HPP
32.1 --- a/src/share/vm/prims/whitebox.cpp Fri Oct 31 17:09:14 2014 -0700 32.2 +++ b/src/share/vm/prims/whitebox.cpp Thu Nov 06 09:39:49 2014 -0800 32.3 @@ -331,7 +331,36 @@ 32.4 } 32.5 WB_END 32.6 32.7 +WB_ENTRY(jboolean, WB_NMTChangeTrackingLevel(JNIEnv* env)) 32.8 + // Test that we can downgrade NMT levels but not upgrade them. 32.9 + if (MemTracker::tracking_level() == NMT_off) { 32.10 + MemTracker::transition_to(NMT_off); 32.11 + return MemTracker::tracking_level() == NMT_off; 32.12 + } else { 32.13 + assert(MemTracker::tracking_level() == NMT_detail, "Should start out as detail tracking"); 32.14 + MemTracker::transition_to(NMT_summary); 32.15 + assert(MemTracker::tracking_level() == NMT_summary, "Should be summary now"); 32.16 32.17 + // Can't go to detail once NMT is set to summary. 32.18 + MemTracker::transition_to(NMT_detail); 32.19 + assert(MemTracker::tracking_level() == NMT_summary, "Should still be summary now"); 32.20 + 32.21 + // Shutdown sets tracking level to minimal. 32.22 + MemTracker::shutdown(); 32.23 + assert(MemTracker::tracking_level() == NMT_minimal, "Should be minimal now"); 32.24 + 32.25 + // Once the tracking level is minimal, we cannot increase to summary. 32.26 + // The code ignores this request instead of asserting because if the malloc site 32.27 + // table overflows in another thread, it tries to change the code to summary. 32.28 + MemTracker::transition_to(NMT_summary); 32.29 + assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now"); 32.30 + 32.31 + // Really can never go up to detail, verify that the code would never do this. 32.32 + MemTracker::transition_to(NMT_detail); 32.33 + assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now"); 32.34 + return MemTracker::tracking_level() == NMT_minimal; 32.35 + } 32.36 +WB_END 32.37 #endif // INCLUDE_NMT 32.38 32.39 static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) { 32.40 @@ -936,6 +965,7 @@ 32.41 {CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory }, 32.42 {CC"NMTOverflowHashBucket", CC"(J)V", (void*)&WB_NMTOverflowHashBucket}, 32.43 {CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported}, 32.44 + {CC"NMTChangeTrackingLevel", CC"()Z", (void*)&WB_NMTChangeTrackingLevel}, 32.45 #endif // INCLUDE_NMT 32.46 {CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll }, 32.47 {CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Executable;Z)I",
33.1 --- a/src/share/vm/runtime/advancedThresholdPolicy.cpp Fri Oct 31 17:09:14 2014 -0700 33.2 +++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp Thu Nov 06 09:39:49 2014 -0800 33.3 @@ -451,7 +451,7 @@ 33.4 if (should_create_mdo(mh(), level)) { 33.5 create_mdo(mh, thread); 33.6 } 33.7 - if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) { 33.8 + if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) { 33.9 CompLevel next_level = call_event(mh(), level); 33.10 if (next_level != level) { 33.11 compile(mh, InvocationEntryBci, next_level, thread); 33.12 @@ -475,7 +475,7 @@ 33.13 CompLevel next_osr_level = loop_event(imh(), level); 33.14 CompLevel max_osr_level = (CompLevel)imh->highest_osr_comp_level(); 33.15 // At the very least compile the OSR version 33.16 - if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_osr_level != level) { 33.17 + if (!CompileBroker::compilation_is_in_queue(imh) && (next_osr_level != level)) { 33.18 compile(imh, bci, next_osr_level, thread); 33.19 } 33.20 33.21 @@ -509,7 +509,7 @@ 33.22 nm->make_not_entrant(); 33.23 } 33.24 } 33.25 - if (!CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) { 33.26 + if (!CompileBroker::compilation_is_in_queue(mh)) { 33.27 // Fix up next_level if necessary to avoid deopts 33.28 if (next_level == CompLevel_limited_profile && max_osr_level == CompLevel_full_profile) { 33.29 next_level = CompLevel_full_profile; 33.30 @@ -521,7 +521,7 @@ 33.31 } else { 33.32 cur_level = comp_level(imh()); 33.33 next_level = call_event(imh(), cur_level); 33.34 - if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_level != cur_level) { 33.35 + if (!CompileBroker::compilation_is_in_queue(imh) && (next_level != cur_level)) { 33.36 compile(imh, InvocationEntryBci, next_level, thread); 33.37 } 33.38 }
34.1 --- a/src/share/vm/runtime/arguments.cpp Fri Oct 31 17:09:14 2014 -0700 34.2 +++ b/src/share/vm/runtime/arguments.cpp Thu Nov 06 09:39:49 2014 -0800 34.3 @@ -66,7 +66,7 @@ 34.4 #endif // INCLUDE_ALL_GCS 34.5 34.6 // Note: This is a special bug reporting site for the JVM 34.7 -#define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" 34.8 +#define DEFAULT_VENDOR_URL_BUG "http://bugreport.java.com/bugreport/crash.jsp" 34.9 #define DEFAULT_JAVA_LAUNCHER "generic" 34.10 34.11 // Disable options not supported in this release, with a warning if they 34.12 @@ -300,6 +300,7 @@ 34.13 { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 34.14 { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) }, 34.15 { "AutoShutdownNMT", JDK_Version::jdk(9), JDK_Version::jdk(10) }, 34.16 + { "CompilationRepeat", JDK_Version::jdk(8), JDK_Version::jdk(9) }, 34.17 #ifdef PRODUCT 34.18 { "DesiredMethodLimit", 34.19 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, 34.20 @@ -1144,6 +1145,32 @@ 34.21 } 34.22 } 34.23 34.24 +/** 34.25 + * Returns the minimum number of compiler threads needed to run the JVM. The following 34.26 + * configurations are possible. 34.27 + * 34.28 + * 1) The JVM is build using an interpreter only. As a result, the minimum number of 34.29 + * compiler threads is 0. 34.30 + * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As 34.31 + * a result, either C1 or C2 is used, so the minimum number of compiler threads is 1. 34.32 + * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However, 34.33 + * the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only 34.34 + * C1 can be used, so the minimum number of compiler threads is 1. 34.35 + * 4) The JVM is build using the compilers and tiered compilation is enabled. The option 34.36 + * 'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result, 34.37 + * the minimum number of compiler threads is 2. 34.38 + */ 34.39 +int Arguments::get_min_number_of_compiler_threads() { 34.40 +#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) 34.41 + return 0; // case 1 34.42 +#else 34.43 + if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) { 34.44 + return 1; // case 2 or case 3 34.45 + } 34.46 + return 2; // case 4 (tiered) 34.47 +#endif 34.48 +} 34.49 + 34.50 #if INCLUDE_ALL_GCS 34.51 static void disable_adaptive_size_policy(const char* collector_name) { 34.52 if (UseAdaptiveSizePolicy) { 34.53 @@ -2461,6 +2488,12 @@ 34.54 status &= verify_interval(SafepointPollOffset, 0, os::vm_page_size() - BytesPerWord, "SafepointPollOffset"); 34.55 #endif 34.56 34.57 + int min_number_of_compiler_threads = get_min_number_of_compiler_threads(); 34.58 + // The default CICompilerCount's value is CI_COMPILER_COUNT. 34.59 + assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number"); 34.60 + // Check the minimum number of compiler threads 34.61 + status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount"); 34.62 + 34.63 return status; 34.64 } 34.65 34.66 @@ -3617,6 +3650,8 @@ 34.67 bool settings_file_specified = false; 34.68 bool needs_hotspotrc_warning = false; 34.69 34.70 + ArgumentsExt::process_options(args); 34.71 + 34.72 const char* flags_file; 34.73 int index; 34.74 for (index = 0; index < args->nOptions; index++) {
35.1 --- a/src/share/vm/runtime/arguments.hpp Fri Oct 31 17:09:14 2014 -0700 35.2 +++ b/src/share/vm/runtime/arguments.hpp Thu Nov 06 09:39:49 2014 -0800 35.3 @@ -327,6 +327,7 @@ 35.4 35.5 // Tiered 35.6 static void set_tiered_flags(); 35.7 + static int get_min_number_of_compiler_threads(); 35.8 // CMS/ParNew garbage collectors 35.9 static void set_parnew_gc_flags(); 35.10 static void set_cms_and_parnew_gc_flags();
36.1 --- a/src/share/vm/runtime/arguments_ext.hpp Fri Oct 31 17:09:14 2014 -0700 36.2 +++ b/src/share/vm/runtime/arguments_ext.hpp Thu Nov 06 09:39:49 2014 -0800 36.3 @@ -34,6 +34,7 @@ 36.4 static inline bool check_gc_consistency_user(); 36.5 static inline bool check_gc_consistency_ergo(); 36.6 static inline bool check_vm_args_consistency(); 36.7 + static void process_options(const JavaVMInitArgs* args) {} 36.8 }; 36.9 36.10 void ArgumentsExt::select_gc_ergonomically() {
37.1 --- a/src/share/vm/runtime/globals.cpp Fri Oct 31 17:09:14 2014 -0700 37.2 +++ b/src/share/vm/runtime/globals.cpp Thu Nov 06 09:39:49 2014 -0800 37.3 @@ -243,6 +243,11 @@ 37.4 return is_unlocked_ext(); 37.5 } 37.6 37.7 +void Flag::unlock_diagnostic() { 37.8 + assert(is_diagnostic(), "sanity"); 37.9 + _flags = Flags(_flags & ~KIND_DIAGNOSTIC); 37.10 +} 37.11 + 37.12 // Get custom message for this locked flag, or return NULL if 37.13 // none is available. 37.14 void Flag::get_locked_message(char* buf, int buflen) const {
38.1 --- a/src/share/vm/runtime/globals.hpp Fri Oct 31 17:09:14 2014 -0700 38.2 +++ b/src/share/vm/runtime/globals.hpp Thu Nov 06 09:39:49 2014 -0800 38.3 @@ -313,6 +313,8 @@ 38.4 bool is_writeable_ext() const; 38.5 bool is_external_ext() const; 38.6 38.7 + void unlock_diagnostic(); 38.8 + 38.9 void get_locked_message(char*, int) const; 38.10 void get_locked_message_ext(char*, int) const; 38.11
39.1 --- a/src/share/vm/runtime/os.hpp Fri Oct 31 17:09:14 2014 -0700 39.2 +++ b/src/share/vm/runtime/os.hpp Thu Nov 06 09:39:49 2014 -0800 39.3 @@ -214,13 +214,14 @@ 39.4 39.5 // Interface for detecting multiprocessor system 39.6 static inline bool is_MP() { 39.7 -#if !INCLUDE_NMT 39.8 - assert(_processor_count > 0, "invalid processor count"); 39.9 - return _processor_count > 1 || AssumeMP; 39.10 -#else 39.11 - // NMT needs atomic operations before this initialization. 39.12 - return true; 39.13 -#endif 39.14 + // During bootstrap if _processor_count is not yet initialized 39.15 + // we claim to be MP as that is safest. If any platform has a 39.16 + // stub generator that might be triggered in this phase and for 39.17 + // which being declared MP when in fact not, is a problem - then 39.18 + // the bootstrap routine for the stub generator needs to check 39.19 + // the processor count directly and leave the bootstrap routine 39.20 + // in place until called after initialization has ocurred. 39.21 + return (_processor_count != 1) || AssumeMP; 39.22 } 39.23 static julong available_memory(); 39.24 static julong physical_memory();
40.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp Fri Oct 31 17:09:14 2014 -0700 40.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp Thu Nov 06 09:39:49 2014 -0800 40.3 @@ -239,7 +239,7 @@ 40.4 if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) { 40.5 return; 40.6 } 40.7 - if (!CompileBroker::compilation_is_in_queue(mh, bci)) { 40.8 + if (!CompileBroker::compilation_is_in_queue(mh)) { 40.9 if (PrintTieredEvents) { 40.10 print_event(COMPILE, mh, mh, bci, level); 40.11 } 40.12 @@ -378,7 +378,7 @@ 40.13 // Handle the invocation event. 40.14 void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh, 40.15 CompLevel level, nmethod* nm, JavaThread* thread) { 40.16 - if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) { 40.17 + if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) { 40.18 CompLevel next_level = call_event(mh(), level); 40.19 if (next_level != level) { 40.20 compile(mh, InvocationEntryBci, next_level, thread); 40.21 @@ -391,8 +391,8 @@ 40.22 void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh, 40.23 int bci, CompLevel level, nmethod* nm, JavaThread* thread) { 40.24 // If the method is already compiling, quickly bail out. 40.25 - if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, bci)) { 40.26 - // Use loop event as an opportinity to also check there's been 40.27 + if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) { 40.28 + // Use loop event as an opportunity to also check there's been 40.29 // enough calls. 40.30 CompLevel cur_level = comp_level(mh()); 40.31 CompLevel next_level = call_event(mh(), cur_level);
41.1 --- a/src/share/vm/services/mallocTracker.cpp Fri Oct 31 17:09:14 2014 -0700 41.2 +++ b/src/share/vm/services/mallocTracker.cpp Thu Nov 06 09:39:49 2014 -0800 41.3 @@ -51,14 +51,6 @@ 41.4 return amount; 41.5 } 41.6 41.7 - 41.8 -void MallocMemorySnapshot::reset() { 41.9 - _tracking_header.reset(); 41.10 - for (int index = 0; index < mt_number_of_types; index ++) { 41.11 - _malloc[index].reset(); 41.12 - } 41.13 -} 41.14 - 41.15 // Make adjustment by subtracting chunks used by arenas 41.16 // from total chunks to get total free chunck size 41.17 void MallocMemorySnapshot::make_adjustment() { 41.18 @@ -116,14 +108,9 @@ 41.19 bool MallocTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) { 41.20 assert(from != NMT_off, "Can not transition from off state"); 41.21 assert(to != NMT_off, "Can not transition to off state"); 41.22 - if (from == NMT_minimal) { 41.23 - MallocMemorySummary::reset(); 41.24 - } 41.25 + assert (from != NMT_minimal, "cannot transition from minimal state"); 41.26 41.27 - if (to == NMT_detail) { 41.28 - assert(from == NMT_minimal || from == NMT_summary, "Just check"); 41.29 - return MallocSiteTable::initialize(); 41.30 - } else if (from == NMT_detail) { 41.31 + if (from == NMT_detail) { 41.32 assert(to == NMT_minimal || to == NMT_summary, "Just check"); 41.33 MallocSiteTable::shutdown(); 41.34 }
42.1 --- a/src/share/vm/services/mallocTracker.hpp Fri Oct 31 17:09:14 2014 -0700 42.2 +++ b/src/share/vm/services/mallocTracker.hpp Thu Nov 06 09:39:49 2014 -0800 42.3 @@ -51,14 +51,6 @@ 42.4 DEBUG_ONLY(_peak_size = 0;) 42.5 } 42.6 42.7 - // Reset counters 42.8 - void reset() { 42.9 - _size = 0; 42.10 - _count = 0; 42.11 - DEBUG_ONLY(_peak_size = 0;) 42.12 - DEBUG_ONLY(_peak_count = 0;) 42.13 - } 42.14 - 42.15 inline void allocate(size_t sz) { 42.16 Atomic::add(1, (volatile MemoryCounterType*)&_count); 42.17 if (sz > 0) { 42.18 @@ -124,11 +116,6 @@ 42.19 _arena.resize(sz); 42.20 } 42.21 42.22 - void reset() { 42.23 - _malloc.reset(); 42.24 - _arena.reset(); 42.25 - } 42.26 - 42.27 inline size_t malloc_size() const { return _malloc.size(); } 42.28 inline size_t malloc_count() const { return _malloc.count();} 42.29 inline size_t arena_size() const { return _arena.size(); } 42.30 @@ -176,8 +163,6 @@ 42.31 return s->by_type(mtThreadStack)->malloc_count(); 42.32 } 42.33 42.34 - void reset(); 42.35 - 42.36 void copy_to(MallocMemorySnapshot* s) { 42.37 s->_tracking_header = _tracking_header; 42.38 for (int index = 0; index < mt_number_of_types; index ++) { 42.39 @@ -240,11 +225,6 @@ 42.40 return as_snapshot()->malloc_overhead()->size(); 42.41 } 42.42 42.43 - // Reset all counters to zero 42.44 - static void reset() { 42.45 - as_snapshot()->reset(); 42.46 - } 42.47 - 42.48 static MallocMemorySnapshot* as_snapshot() { 42.49 return (MallocMemorySnapshot*)_snapshot; 42.50 }
43.1 --- a/src/share/vm/services/memBaseline.hpp Fri Oct 31 17:09:14 2014 -0700 43.2 +++ b/src/share/vm/services/memBaseline.hpp Thu Nov 06 09:39:49 2014 -0800 43.3 @@ -90,10 +90,6 @@ 43.4 _class_count(0) { 43.5 } 43.6 43.7 - ~MemBaseline() { 43.8 - reset(); 43.9 - } 43.10 - 43.11 bool baseline(bool summaryOnly = true); 43.12 43.13 BaselineType baseline_type() const { return _baseline_type; } 43.14 @@ -169,8 +165,7 @@ 43.15 // reset the baseline for reuse 43.16 void reset() { 43.17 _baseline_type = Not_baselined; 43.18 - _malloc_memory_snapshot.reset(); 43.19 - _virtual_memory_snapshot.reset(); 43.20 + // _malloc_memory_snapshot and _virtual_memory_snapshot are copied over. 43.21 _class_count = 0; 43.22 43.23 _malloc_sites.clear();
44.1 --- a/src/share/vm/services/memReporter.hpp Fri Oct 31 17:09:14 2014 -0700 44.2 +++ b/src/share/vm/services/memReporter.hpp Thu Nov 06 09:39:49 2014 -0800 44.3 @@ -96,20 +96,6 @@ 44.4 size_t _class_count; 44.5 44.6 public: 44.7 - // Report summary tracking data from global snapshots directly. 44.8 - // This constructor is used for final reporting and hs_err reporting. 44.9 - MemSummaryReporter(MallocMemorySnapshot* malloc_snapshot, 44.10 - VirtualMemorySnapshot* vm_snapshot, outputStream* output, 44.11 - size_t class_count = 0, size_t scale = K) : 44.12 - MemReporterBase(output, scale), 44.13 - _malloc_snapshot(malloc_snapshot), 44.14 - _vm_snapshot(vm_snapshot) { 44.15 - if (class_count == 0) { 44.16 - _class_count = InstanceKlass::number_of_instance_classes(); 44.17 - } else { 44.18 - _class_count = class_count; 44.19 - } 44.20 - } 44.21 // This constructor is for normal reporting from a recent baseline. 44.22 MemSummaryReporter(MemBaseline& baseline, outputStream* output, 44.23 size_t scale = K) : MemReporterBase(output, scale),
45.1 --- a/src/share/vm/services/memTracker.cpp Fri Oct 31 17:09:14 2014 -0700 45.2 +++ b/src/share/vm/services/memTracker.cpp Thu Nov 06 09:39:49 2014 -0800 45.3 @@ -144,11 +144,9 @@ 45.4 } 45.5 45.6 45.7 -// Shutdown can only be issued via JCmd, and NMT JCmd is serialized 45.8 -// by lock 45.9 +// Shutdown can only be issued via JCmd, and NMT JCmd is serialized by lock 45.10 void MemTracker::shutdown() { 45.11 - // We can only shutdown NMT to minimal tracking level if it is 45.12 - // ever on. 45.13 + // We can only shutdown NMT to minimal tracking level if it is ever on. 45.14 if (tracking_level () > NMT_minimal) { 45.15 transition_to(NMT_minimal); 45.16 } 45.17 @@ -157,45 +155,36 @@ 45.18 bool MemTracker::transition_to(NMT_TrackingLevel level) { 45.19 NMT_TrackingLevel current_level = tracking_level(); 45.20 45.21 + assert(level != NMT_off || current_level == NMT_off, "Cannot transition NMT to off"); 45.22 + 45.23 if (current_level == level) { 45.24 return true; 45.25 } else if (current_level > level) { 45.26 - // Downgrade tracking level, we want to lower the tracking 45.27 - // level first 45.28 + // Downgrade tracking level, we want to lower the tracking level first 45.29 _tracking_level = level; 45.30 // Make _tracking_level visible immediately. 45.31 OrderAccess::fence(); 45.32 VirtualMemoryTracker::transition(current_level, level); 45.33 MallocTracker::transition(current_level, level); 45.34 - 45.35 - if (level == NMT_minimal) _baseline.reset(); 45.36 } else { 45.37 - VirtualMemoryTracker::transition(current_level, level); 45.38 - MallocTracker::transition(current_level, level); 45.39 - 45.40 - _tracking_level = level; 45.41 - // Make _tracking_level visible immediately. 45.42 - OrderAccess::fence(); 45.43 + // Upgrading tracking level is not supported and has never been supported. 45.44 + // Allocating and deallocating malloc tracking structures is not thread safe and 45.45 + // leads to inconsistencies unless a lot coarser locks are added. 45.46 } 45.47 - 45.48 return true; 45.49 } 45.50 45.51 -void MemTracker::final_report(outputStream* output) { 45.52 - assert(output != NULL, "No output stream"); 45.53 - if (tracking_level() >= NMT_summary) { 45.54 - MallocMemorySnapshot* malloc_memory_snapshot = 45.55 - MallocMemorySummary::as_snapshot(); 45.56 - malloc_memory_snapshot->make_adjustment(); 45.57 - 45.58 - VirtualMemorySnapshot* virtual_memory_snapshot = 45.59 - VirtualMemorySummary::as_snapshot(); 45.60 - 45.61 - MemSummaryReporter rptr(malloc_memory_snapshot, 45.62 - virtual_memory_snapshot, output); 45.63 - rptr.report(); 45.64 - // shutdown NMT, the data no longer accurate 45.65 - shutdown(); 45.66 +void MemTracker::report(bool summary_only, outputStream* output) { 45.67 + assert(output != NULL, "No output stream"); 45.68 + MemBaseline baseline; 45.69 + if (baseline.baseline(summary_only)) { 45.70 + if (summary_only) { 45.71 + MemSummaryReporter rpt(baseline, output); 45.72 + rpt.report(); 45.73 + } else { 45.74 + MemDetailReporter rpt(baseline, output); 45.75 + rpt.report(); 45.76 + } 45.77 } 45.78 } 45.79
46.1 --- a/src/share/vm/services/memTracker.hpp Fri Oct 31 17:09:14 2014 -0700 46.2 +++ b/src/share/vm/services/memTracker.hpp Thu Nov 06 09:39:49 2014 -0800 46.3 @@ -70,6 +70,7 @@ 46.4 static inline void release_thread_stack(void* addr, size_t size) { } 46.5 46.6 static void final_report(outputStream*) { } 46.7 + static void error_report(outputStream*) { } 46.8 }; 46.9 46.10 #else 46.11 @@ -270,13 +271,20 @@ 46.12 // other tools. 46.13 static inline Mutex* query_lock() { return _query_lock; } 46.14 46.15 - // Make a final report and shutdown. 46.16 - // This function generates summary report without creating snapshots, 46.17 - // to avoid additional memory allocation. It uses native memory summary 46.18 - // counters, and makes adjustment to them, once the adjustment is made, 46.19 - // the counters are no longer accurate. As the result, this function 46.20 - // should only be used for final reporting before shutting down. 46.21 - static void final_report(outputStream*); 46.22 + // Make a final report or report for hs_err file. 46.23 + static void error_report(outputStream* output) { 46.24 + if (tracking_level() >= NMT_summary) { 46.25 + report(true, output); // just print summary for error case. 46.26 + } 46.27 + } 46.28 + 46.29 + static void final_report(outputStream* output) { 46.30 + NMT_TrackingLevel level = tracking_level(); 46.31 + if (level >= NMT_summary) { 46.32 + report(level == NMT_summary, output); 46.33 + } 46.34 + } 46.35 + 46.36 46.37 // Stored baseline 46.38 static inline MemBaseline& get_baseline() { 46.39 @@ -291,6 +299,7 @@ 46.40 46.41 private: 46.42 static NMT_TrackingLevel init_tracking_level(); 46.43 + static void report(bool summary_only, outputStream* output); 46.44 46.45 private: 46.46 // Tracking level
47.1 --- a/src/share/vm/services/virtualMemoryTracker.cpp Fri Oct 31 17:09:14 2014 -0700 47.2 +++ b/src/share/vm/services/virtualMemoryTracker.cpp Thu Nov 06 09:39:49 2014 -0800 47.3 @@ -443,26 +443,28 @@ 47.4 bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) { 47.5 assert(_reserved_regions != NULL, "Sanity check"); 47.6 ThreadCritical tc; 47.7 - LinkedListNode<ReservedMemoryRegion>* head = _reserved_regions->head(); 47.8 - while (head != NULL) { 47.9 - const ReservedMemoryRegion* rgn = head->peek(); 47.10 - if (!walker->do_allocation_site(rgn)) { 47.11 - return false; 47.12 + // Check that the _reserved_regions haven't been deleted. 47.13 + if (_reserved_regions != NULL) { 47.14 + LinkedListNode<ReservedMemoryRegion>* head = _reserved_regions->head(); 47.15 + while (head != NULL) { 47.16 + const ReservedMemoryRegion* rgn = head->peek(); 47.17 + if (!walker->do_allocation_site(rgn)) { 47.18 + return false; 47.19 + } 47.20 + head = head->next(); 47.21 } 47.22 - head = head->next(); 47.23 - } 47.24 + } 47.25 return true; 47.26 } 47.27 47.28 // Transition virtual memory tracking level. 47.29 bool VirtualMemoryTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) { 47.30 - if (from == NMT_minimal) { 47.31 - assert(to == NMT_summary || to == NMT_detail, "Just check"); 47.32 - VirtualMemorySummary::reset(); 47.33 - } else if (to == NMT_minimal) { 47.34 + assert (from != NMT_minimal, "cannot convert from the lowest tracking level to anything"); 47.35 + if (to == NMT_minimal) { 47.36 assert(from == NMT_summary || from == NMT_detail, "Just check"); 47.37 // Clean up virtual memory tracking data structures. 47.38 ThreadCritical tc; 47.39 + // Check for potential race with other thread calling transition 47.40 if (_reserved_regions != NULL) { 47.41 delete _reserved_regions; 47.42 _reserved_regions = NULL;
48.1 --- a/src/share/vm/services/virtualMemoryTracker.hpp Fri Oct 31 17:09:14 2014 -0700 48.2 +++ b/src/share/vm/services/virtualMemoryTracker.hpp Thu Nov 06 09:39:49 2014 -0800 48.3 @@ -62,11 +62,6 @@ 48.4 _committed -= sz; 48.5 } 48.6 48.7 - void reset() { 48.8 - _reserved = 0; 48.9 - _committed = 0; 48.10 - } 48.11 - 48.12 inline size_t reserved() const { return _reserved; } 48.13 inline size_t committed() const { return _committed; } 48.14 }; 48.15 @@ -123,12 +118,6 @@ 48.16 return amount; 48.17 } 48.18 48.19 - inline void reset() { 48.20 - for (int index = 0; index < mt_number_of_types; index ++) { 48.21 - _virtual_memory[index].reset(); 48.22 - } 48.23 - } 48.24 - 48.25 void copy_to(VirtualMemorySnapshot* s) { 48.26 for (int index = 0; index < mt_number_of_types; index ++) { 48.27 s->_virtual_memory[index] = _virtual_memory[index]; 48.28 @@ -174,10 +163,6 @@ 48.29 as_snapshot()->copy_to(s); 48.30 } 48.31 48.32 - static inline void reset() { 48.33 - as_snapshot()->reset(); 48.34 - } 48.35 - 48.36 static VirtualMemorySnapshot* as_snapshot() { 48.37 return (VirtualMemorySnapshot*)_snapshot; 48.38 }
49.1 --- a/src/share/vm/utilities/debug.cpp Fri Oct 31 17:09:14 2014 -0700 49.2 +++ b/src/share/vm/utilities/debug.cpp Thu Nov 06 09:39:49 2014 -0800 49.3 @@ -266,17 +266,19 @@ 49.4 "native memory for metadata", 49.5 "shared read only space", 49.6 "shared read write space", 49.7 - "shared miscellaneous data space" 49.8 + "shared miscellaneous data space", 49.9 + "shared miscellaneous code space" 49.10 }; 49.11 static const char* flag[] = { 49.12 "Metaspace", 49.13 "SharedReadOnlySize", 49.14 "SharedReadWriteSize", 49.15 - "SharedMiscDataSize" 49.16 + "SharedMiscDataSize", 49.17 + "SharedMiscCodeSize" 49.18 }; 49.19 49.20 warning("\nThe %s is not large enough\n" 49.21 - "to preload requested classes. Use -XX:%s=\n" 49.22 + "to preload requested classes. Use -XX:%s=<size>\n" 49.23 "to increase the initial size of %s.\n", 49.24 name[shared_space], flag[shared_space], name[shared_space]); 49.25 exit(2);
50.1 --- a/src/share/vm/utilities/debug.hpp Fri Oct 31 17:09:14 2014 -0700 50.2 +++ b/src/share/vm/utilities/debug.hpp Thu Nov 06 09:39:49 2014 -0800 50.3 @@ -246,7 +246,8 @@ 50.4 SharedPermGen, 50.5 SharedReadOnly, 50.6 SharedReadWrite, 50.7 - SharedMiscData 50.8 + SharedMiscData, 50.9 + SharedMiscCode 50.10 }; 50.11 50.12 void report_out_of_shared_space(SharedSpaceType space_type);
51.1 --- a/src/share/vm/utilities/vmError.cpp Fri Oct 31 17:09:14 2014 -0700 51.2 +++ b/src/share/vm/utilities/vmError.cpp Thu Nov 06 09:39:49 2014 -0800 51.3 @@ -775,7 +775,7 @@ 51.4 51.5 STEP(228, "(Native Memory Tracking)" ) 51.6 if (_verbose) { 51.7 - MemTracker::final_report(st); 51.8 + MemTracker::error_report(st); 51.9 } 51.10 51.11 STEP(230, "" )
52.1 --- a/test/Makefile Fri Oct 31 17:09:14 2014 -0700 52.2 +++ b/test/Makefile Thu Nov 06 09:39:49 2014 -0800 52.3 @@ -1,5 +1,5 @@ 52.4 # 52.5 -# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. 52.6 +# Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. 52.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 52.8 # 52.9 # This code is free software; you can redistribute it and/or modify it 52.10 @@ -23,14 +23,36 @@ 52.11 # 52.12 52.13 # 52.14 -# Makefile to run various jdk tests 52.15 +# Makefile to run various hotspot tests 52.16 # 52.17 52.18 GETMIXEDPATH=echo 52.19 52.20 -# Get OS/ARCH specifics 52.21 -OSNAME = $(shell uname -s) 52.22 -ifeq ($(OSNAME), SunOS) 52.23 +# Utilities used 52.24 +AWK = awk 52.25 +CAT = cat 52.26 +CD = cd 52.27 +CHMOD = chmod 52.28 +CP = cp 52.29 +CUT = cut 52.30 +DIRNAME = dirname 52.31 +ECHO = echo 52.32 +EGREP = egrep 52.33 +EXPAND = expand 52.34 +FIND = find 52.35 +MKDIR = mkdir 52.36 +PWD = pwd 52.37 +SED = sed 52.38 +SORT = sort 52.39 +TEE = tee 52.40 +UNAME = uname 52.41 +UNIQ = uniq 52.42 +WC = wc 52.43 +ZIP = zip 52.44 + 52.45 +# Get OS name from uname (Cygwin inexplicably adds _NT-5.1) 52.46 +UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_) 52.47 +ifeq ($(UNAME_S), SunOS) 52.48 PLATFORM = solaris 52.49 SLASH_JAVA = /java 52.50 ARCH = $(shell uname -p) 52.51 @@ -38,7 +60,7 @@ 52.52 ARCH=i586 52.53 endif 52.54 endif 52.55 -ifeq ($(OSNAME), Linux) 52.56 +ifeq ($(UNAME_S), Linux) 52.57 PLATFORM = linux 52.58 SLASH_JAVA = /java 52.59 ARCH = $(shell uname -m) 52.60 @@ -46,7 +68,7 @@ 52.61 ARCH = i586 52.62 endif 52.63 endif 52.64 -ifeq ($(OSNAME), Darwin) 52.65 +ifeq ($(UNAME_S), Darwin) 52.66 PLATFORM = bsd 52.67 SLASH_JAVA = /java 52.68 ARCH = $(shell uname -m) 52.69 @@ -54,7 +76,7 @@ 52.70 ARCH = i586 52.71 endif 52.72 endif 52.73 -ifeq ($(findstring BSD,$(OSNAME)), BSD) 52.74 +ifeq ($(findstring BSD,$(UNAME_S)), BSD) 52.75 PLATFORM = bsd 52.76 SLASH_JAVA = /java 52.77 ARCH = $(shell uname -m) 52.78 @@ -63,12 +85,12 @@ 52.79 endif 52.80 endif 52.81 ifeq ($(PLATFORM),) 52.82 - # detect wether we're running in MKS or cygwin 52.83 - ifeq ($(OSNAME), Windows_NT) # MKS 52.84 + # detect whether we're running in MKS or cygwin 52.85 + ifeq ($(UNAME_S), Windows_NT) # MKS 52.86 GETMIXEDPATH=dosname -s 52.87 endif 52.88 - ifeq ($(findstring CYGWIN,$(OSNAME)), CYGWIN) 52.89 - GETMIXEDPATH=cygpath -m -s 52.90 + ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN) 52.91 + GETMIXEDPATH=cygpath -m 52.92 endif 52.93 PLATFORM = windows 52.94 SLASH_JAVA = J: 52.95 @@ -92,13 +114,6 @@ 52.96 SLASH_JAVA = $(ALT_SLASH_JAVA) 52.97 endif 52.98 52.99 -# Utilities used 52.100 -CD = cd 52.101 -CP = cp 52.102 -ECHO = echo 52.103 -MKDIR = mkdir 52.104 -ZIP = zip 52.105 - 52.106 # Root of this test area (important to use full paths in some places) 52.107 TEST_ROOT := $(shell pwd) 52.108 52.109 @@ -136,21 +151,82 @@ 52.110 endif 52.111 52.112 # How to create the test bundle (pass or fail, we want to create this) 52.113 -BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \ 52.114 - && $(CD) $(ABS_TEST_OUTPUT_DIR) \ 52.115 - && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) 52.116 -BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) 52.117 +# Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed. 52.118 +ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \ 52.119 + && $(CD) $(ABS_TEST_OUTPUT_DIR) \ 52.120 + && $(CHMOD) -R a+r . \ 52.121 + && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) 52.122 + 52.123 +# important results files 52.124 +SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt") 52.125 +STATS_TXT_NAME = Stats.txt 52.126 +STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)") 52.127 +RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt") 52.128 +PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt") 52.129 +FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt") 52.130 +EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt") 52.131 + 52.132 +TESTEXIT = \ 52.133 + if [ ! -s $(EXITCODE) ] ; then \ 52.134 + $(ECHO) "ERROR: EXITCODE file not filled in."; \ 52.135 + $(ECHO) "1" > $(EXITCODE); \ 52.136 + fi ; \ 52.137 + testExitCode=`$(CAT) $(EXITCODE)`; \ 52.138 + $(ECHO) "EXIT CODE: $${testExitCode}"; \ 52.139 + exit $${testExitCode} 52.140 + 52.141 +BUNDLE_UP_AND_EXIT = \ 52.142 +( \ 52.143 + jtregExitCode=$$? && \ 52.144 + _summary="$(SUMMARY_TXT)"; \ 52.145 + $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \ 52.146 + $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \ 52.147 + if [ -r "$${_summary}" ] ; then \ 52.148 + $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \ 52.149 + $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \ 52.150 + $(EGREP) ' Passed\.' $(RUNLIST) \ 52.151 + | $(EGREP) -v ' Error\.' \ 52.152 + | $(EGREP) -v ' Failed\.' > $(PASSLIST); \ 52.153 + ( $(EGREP) ' Failed\.' $(RUNLIST); \ 52.154 + $(EGREP) ' Error\.' $(RUNLIST); \ 52.155 + $(EGREP) -v ' Passed\.' $(RUNLIST) ) \ 52.156 + | $(SORT) | $(UNIQ) > $(FAILLIST); \ 52.157 + if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \ 52.158 + $(EXPAND) $(FAILLIST) \ 52.159 + | $(CUT) -d' ' -f1 \ 52.160 + | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \ 52.161 + if [ $${jtregExitCode} = 0 ] ; then \ 52.162 + jtregExitCode=1; \ 52.163 + fi; \ 52.164 + fi; \ 52.165 + runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ 52.166 + passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ 52.167 + failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ 52.168 + exclc="FIXME CODETOOLS-7900176"; \ 52.169 + $(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc}" \ 52.170 + >> $(STATS_TXT); \ 52.171 + else \ 52.172 + $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \ 52.173 + fi; \ 52.174 + if [ -f $(STATS_TXT) ] ; then \ 52.175 + $(CAT) $(STATS_TXT); \ 52.176 + fi; \ 52.177 + $(ZIP_UP_RESULTS) ; \ 52.178 + $(TESTEXIT) \ 52.179 +) 52.180 52.181 ################################################################ 52.182 52.183 # Default make rule (runs jtreg_tests) 52.184 -all: jtreg_tests 52.185 +all: hotspot_all 52.186 @$(ECHO) "Testing completed successfully" 52.187 52.188 -# Support "hotspot_" prefixed test make targets too 52.189 -# The hotspot_% targets are for example invoked by the top level Makefile 52.190 +# Support "hotspot_" prefixed test make targets (too) 52.191 +# The hotspot_% targets are used by the top level Makefile 52.192 +# Unless explicitly defined below, hotspot_<x> is interpreted as a jtreg test group name 52.193 hotspot_%: 52.194 - $(MAKE) $* 52.195 + $(ECHO) "Running tests: $@" 52.196 + $(MAKE) -j 1 TEST_SELECTION=":$@" UNIQUE_DIR=$@ jtreg_tests; 52.197 52.198 # Prep for output 52.199 prep: clean 52.200 @@ -168,41 +244,64 @@ 52.201 52.202 # Expect JT_HOME to be set for jtreg tests. (home for jtreg) 52.203 ifndef JT_HOME 52.204 - JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg 52.205 -endif 52.206 -ifdef JPRT_JTREG_HOME 52.207 - JT_HOME = $(JPRT_JTREG_HOME) 52.208 + JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg 52.209 + ifdef JPRT_JTREG_HOME 52.210 + JT_HOME = $(JPRT_JTREG_HOME) 52.211 + endif 52.212 endif 52.213 52.214 -# Expect JPRT to set TESTDIRS to the jtreg test dirs 52.215 -JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof 52.216 +# When called from JPRT the TESTDIRS variable is set to the jtreg tests to run 52.217 ifdef TESTDIRS 52.218 - JTREG_TESTDIRS = $(TESTDIRS) 52.219 + TEST_SELECTION = $(TESTDIRS) 52.220 +endif 52.221 + 52.222 +ifdef CONCURRENCY 52.223 + EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY) 52.224 endif 52.225 52.226 # Default JTREG to run 52.227 JTREG = $(JT_HOME)/bin/jtreg 52.228 52.229 +# Only run automatic tests 52.230 +JTREG_BASIC_OPTIONS += -a 52.231 +# Report details on all failed or error tests, times too 52.232 +JTREG_BASIC_OPTIONS += -v:fail,error,time 52.233 +# Retain all files for failing tests 52.234 +JTREG_BASIC_OPTIONS += -retain:fail,error 52.235 +# Ignore tests are not run and completely silent about it 52.236 +JTREG_IGNORE_OPTION = -ignore:quiet 52.237 +JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION) 52.238 +# Add any extra options 52.239 +JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) 52.240 +# Set other vm and test options 52.241 +JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_OPTIONS:%=-vmoption:%) $(JAVA_VM_ARGS:%=-vmoption:%) 52.242 + 52.243 # Option to tell jtreg to not run tests marked with "ignore" 52.244 ifeq ($(PLATFORM), windows) 52.245 JTREG_KEY_OPTION = -k:!ignore 52.246 else 52.247 JTREG_KEY_OPTION = -k:\!ignore 52.248 endif 52.249 +JTREG_BASIC_OPTIONS += $(JTREG_KEY_OPTION) 52.250 + 52.251 +# Make sure jtreg exists 52.252 +$(JTREG): $(JT_HOME) 52.253 52.254 -#EXTRA_JTREG_OPTIONS = 52.255 - 52.256 -jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 52.257 - $(JTREG) -a -v:fail,error \ 52.258 - $(JTREG_KEY_OPTION) \ 52.259 - $(EXTRA_JTREG_OPTIONS) \ 52.260 - -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ 52.261 - -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ 52.262 - -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ 52.263 - $(JAVA_OPTIONS:%=-vmoption:%) \ 52.264 - $(JTREG_TESTDIRS) \ 52.265 - || $(BUNDLE_UP_FAILED) 52.266 - $(BUNDLE_UP) 52.267 +jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) 52.268 + ( \ 52.269 + ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \ 52.270 + export JT_HOME; \ 52.271 + $(shell $(GETMIXEDPATH) "$(JTREG)") \ 52.272 + $(JTREG_BASIC_OPTIONS) \ 52.273 + -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \ 52.274 + -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \ 52.275 + -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ 52.276 + $(JTREG_EXCLUSIONS) \ 52.277 + $(JTREG_TEST_OPTIONS) \ 52.278 + $(TEST_SELECTION) \ 52.279 + ) ; \ 52.280 + $(BUNDLE_UP_AND_EXIT) \ 52.281 + ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT) 52.282 52.283 PHONY_LIST += jtreg_tests 52.284 52.285 @@ -210,7 +309,7 @@ 52.286 52.287 # clienttest (make sure various basic java client options work) 52.288 52.289 -clienttest: prep $(PRODUCT_HOME) 52.290 +hotspot_clienttest clienttest: prep $(PRODUCT_HOME) 52.291 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 52.292 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 52.293 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 52.294 @@ -218,73 +317,38 @@ 52.295 $(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa 52.296 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump 52.297 52.298 -PHONY_LIST += clienttest 52.299 +PHONY_LIST += hotspot_clienttest clienttest 52.300 + 52.301 +################################################################ 52.302 + 52.303 +# minimaltest (make sure various basic java minimal options work) 52.304 + 52.305 +hotspot_minimaltest minimaltest: prep $(PRODUCT_HOME) 52.306 + $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 52.307 + $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 52.308 + $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 52.309 + 52.310 +PHONY_LIST += hotspot_minimaltest minimaltest 52.311 52.312 ################################################################ 52.313 52.314 # servertest (make sure various basic java server options work) 52.315 52.316 -servertest: prep $(PRODUCT_HOME) 52.317 +hotspot_servertest servertest: prep $(PRODUCT_HOME) 52.318 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version 52.319 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help 52.320 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X 52.321 52.322 -PHONY_LIST += servertest 52.323 +PHONY_LIST += hotspot_servertest servertest 52.324 52.325 ################################################################ 52.326 52.327 # internalvmtests (run internal unit tests inside the VM) 52.328 52.329 -internalvmtests: prep $(PRODUCT_HOME) 52.330 +hotspot_internalvmtests internalvmtests: prep $(PRODUCT_HOME) 52.331 $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -XX:+ExecuteInternalVMTests -version 52.332 52.333 -PHONY_LIST += internalvmtests 52.334 - 52.335 -################################################################ 52.336 - 52.337 -# wbapitest (make sure the whitebox testing api classes work 52.338 - 52.339 -wbapitest: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) 52.340 - $(JTREG) -a -v:fail,error \ 52.341 - $(JTREG_KEY_OPTION) \ 52.342 - $(EXTRA_JTREG_OPTIONS) \ 52.343 - -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ 52.344 - -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ 52.345 - -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ 52.346 - $(JAVA_OPTIONS:%=-vmoption:%) \ 52.347 - $(shell $(GETMIXEDPATH) "$(TEST_ROOT)")/sanity \ 52.348 - || $(BUNDLE_UP_FAILED) 52.349 - $(BUNDLE_UP) 52.350 - 52.351 -PHONY_LIST += wbapitest 52.352 - 52.353 -################################################################ 52.354 - 52.355 -# packtest 52.356 - 52.357 -# Expect JPRT to set JPRT_PACKTEST_HOME. 52.358 -PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest 52.359 -ifdef JPRT_PACKTEST_HOME 52.360 - PACKTEST_HOME = $(JPRT_PACKTEST_HOME) 52.361 -endif 52.362 - 52.363 -#EXTRA_PACKTEST_OPTIONS = 52.364 - 52.365 -packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME) 52.366 - ( $(CD) $(PACKTEST_HOME) && \ 52.367 - $(PACKTEST_HOME)/ptest \ 52.368 - -t "$(PRODUCT_HOME)" \ 52.369 - $(PACKTEST_STRESS_OPTION) \ 52.370 - $(EXTRA_PACKTEST_OPTIONS) \ 52.371 - -W $(ABS_TEST_OUTPUT_DIR) \ 52.372 - $(JAVA_OPTIONS:%=-J %) \ 52.373 - ) || $(BUNDLE_UP_FAILED) 52.374 - $(BUNDLE_UP) 52.375 - 52.376 -packtest_stress: PACKTEST_STRESS_OPTION=-s 52.377 -packtest_stress: packtest 52.378 - 52.379 -PHONY_LIST += packtest packtest_stress 52.380 +PHONY_LIST += hotspot_internalvmtests internalvmtests 52.381 52.382 ################################################################ 52.383 52.384 @@ -292,4 +356,3 @@ 52.385 .PHONY: all clean prep $(PHONY_LIST) 52.386 52.387 ################################################################ 52.388 -
53.1 --- a/test/TEST.groups Fri Oct 31 17:09:14 2014 -0700 53.2 +++ b/test/TEST.groups Thu Nov 06 09:39:49 2014 -0800 53.3 @@ -125,6 +125,27 @@ 53.4 -:needs_jdk 53.5 53.6 53.7 +# When called from top level the test suites use the hotspot_ prefix 53.8 +hotspot_wbapitest = \ 53.9 + sanity/ 53.10 + 53.11 +hotspot_compiler = \ 53.12 + sanity/ExecuteInternalVMTests.java 53.13 + 53.14 +hotspot_gc = \ 53.15 + sanity/ExecuteInternalVMTests.java 53.16 + 53.17 +hotspot_runtime = \ 53.18 + sanity/ExecuteInternalVMTests.java 53.19 + 53.20 +hotspot_serviceability = \ 53.21 + sanity/ExecuteInternalVMTests.java 53.22 + 53.23 +hotspot_all = \ 53.24 + :hotspot_compiler \ 53.25 + :hotspot_gc \ 53.26 + :hotspot_runtime \ 53.27 + :hotspot_serviceability 53.28 # Tests that require compact3 API's 53.29 # 53.30 needs_compact3 = \
54.1 --- a/test/compiler/ciReplay/common.sh Fri Oct 31 17:09:14 2014 -0700 54.2 +++ b/test/compiler/ciReplay/common.sh Thu Nov 06 09:39:49 2014 -0800 54.3 @@ -213,7 +213,7 @@ 54.4 -XX:VMThreadStackSize=512 \ 54.5 -XX:CompilerThreadStackSize=512 \ 54.6 -XX:ParallelGCThreads=1 \ 54.7 - -XX:CICompilerCount=1 \ 54.8 + -XX:CICompilerCount=2 \ 54.9 -Xcomp \ 54.10 -XX:CICrashAt=1 \ 54.11 -XX:+CreateMinidumpOnCrash \
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 55.2 +++ b/test/compiler/exceptions/CatchInlineExceptions.java Thu Nov 06 09:39:49 2014 -0800 55.3 @@ -0,0 +1,81 @@ 55.4 +/* 55.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 55.7 + * 55.8 + * This code is free software; you can redistribute it and/or modify it 55.9 + * under the terms of the GNU General Public License version 2 only, as 55.10 + * published by the Free Software Foundation. 55.11 + * 55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 55.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 55.15 + * version 2 for more details (a copy is included in the LICENSE file that 55.16 + * accompanied this code). 55.17 + * 55.18 + * You should have received a copy of the GNU General Public License version 55.19 + * 2 along with this work; if not, write to the Free Software Foundation, 55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 55.21 + * 55.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 55.23 + * or visit www.oracle.com if you need additional information or have any 55.24 + * questions. 55.25 + */ 55.26 + 55.27 +/** 55.28 + * @test 55.29 + * @bug 8059299 55.30 + * @summary assert(adr_type != NULL) failed: expecting TypeKlassPtr 55.31 + * @run main/othervm -Xbatch CatchInlineExceptions 55.32 + */ 55.33 + 55.34 +class Exception1 extends Exception {}; 55.35 +class Exception2 extends Exception {}; 55.36 + 55.37 +public class CatchInlineExceptions { 55.38 + private static int counter0; 55.39 + private static int counter1; 55.40 + private static int counter2; 55.41 + private static int counter; 55.42 + 55.43 + static void foo(int i) throws Exception { 55.44 + if ((i & 1023) == 2) { 55.45 + counter0++; 55.46 + throw new Exception2(); 55.47 + } 55.48 + } 55.49 + 55.50 + static void test(int i) throws Exception { 55.51 + try { 55.52 + foo(i); 55.53 + } 55.54 + catch (Exception e) { 55.55 + if (e instanceof Exception1) { 55.56 + counter1++; 55.57 + } else if (e instanceof Exception2) { 55.58 + counter2++; 55.59 + } 55.60 + counter++; 55.61 + throw e; 55.62 + } 55.63 + } 55.64 + 55.65 + public static void main(String[] args) throws Throwable { 55.66 + for (int i = 0; i < 15000; i++) { 55.67 + try { 55.68 + test(i); 55.69 + } catch (Exception e) { 55.70 + // expected 55.71 + } 55.72 + } 55.73 + if (counter1 != 0) { 55.74 + throw new RuntimeException("Failed: counter1(" + counter1 + ") != 0"); 55.75 + } 55.76 + if (counter2 != counter0) { 55.77 + throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter0(" + counter0 + ")"); 55.78 + } 55.79 + if (counter2 != counter) { 55.80 + throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter(" + counter + ")"); 55.81 + } 55.82 + System.out.println("TEST PASSED"); 55.83 + } 55.84 +}
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 56.2 +++ b/test/compiler/jsr292/NullConstantReceiver.java Thu Nov 06 09:39:49 2014 -0800 56.3 @@ -0,0 +1,62 @@ 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 8059556 56.30 + * @run main/othervm -Xbatch NullConstantReceiver 56.31 + */ 56.32 + 56.33 +import java.lang.invoke.MethodHandle; 56.34 +import java.lang.invoke.MethodHandles; 56.35 +import java.lang.invoke.MethodType; 56.36 + 56.37 +public class NullConstantReceiver { 56.38 + static final MethodHandle target; 56.39 + static { 56.40 + try { 56.41 + target = MethodHandles.lookup().findVirtual(NullConstantReceiver.class, "test", MethodType.methodType(void.class)); 56.42 + } catch (ReflectiveOperationException e) { 56.43 + throw new Error(e); 56.44 + } 56.45 + } 56.46 + 56.47 + public void test() {} 56.48 + 56.49 + static void run() throws Throwable { 56.50 + target.invokeExact((NullConstantReceiver) null); 56.51 + } 56.52 + 56.53 + public static void main(String[] args) throws Throwable { 56.54 + for (int i = 0; i<15000; i++) { 56.55 + try { 56.56 + run(); 56.57 + } catch (NullPointerException e) { 56.58 + // expected 56.59 + continue; 56.60 + } 56.61 + throw new AssertionError("NPE wasn't thrown"); 56.62 + } 56.63 + System.out.println("TEST PASSED"); 56.64 + } 56.65 +}
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 57.2 +++ b/test/compiler/jsr292/VMAnonymousClasses.java Thu Nov 06 09:39:49 2014 -0800 57.3 @@ -0,0 +1,125 @@ 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 8058828 57.30 + * @run main/bootclasspath -Xbatch VMAnonymousClasses 57.31 + */ 57.32 + 57.33 +import jdk.internal.org.objectweb.asm.ClassWriter; 57.34 +import jdk.internal.org.objectweb.asm.MethodVisitor; 57.35 +import jdk.internal.org.objectweb.asm.Opcodes; 57.36 +import sun.misc.Unsafe; 57.37 + 57.38 +import java.lang.invoke.ConstantCallSite; 57.39 +import java.lang.invoke.MethodHandle; 57.40 +import java.lang.invoke.MethodHandles; 57.41 +import java.lang.invoke.MethodType; 57.42 +import java.lang.invoke.MutableCallSite; 57.43 +import java.lang.invoke.VolatileCallSite; 57.44 + 57.45 +public class VMAnonymousClasses { 57.46 + static final String TEST_METHOD_NAME = "constant"; 57.47 + 57.48 + static final Unsafe UNSAFE = Unsafe.getUnsafe(); 57.49 + 57.50 + static int getConstantPoolSize(byte[] classFile) { 57.51 + // The first few bytes: 57.52 + // u4 magic; 57.53 + // u2 minor_version; 57.54 + // u2 major_version; 57.55 + // u2 constant_pool_count; 57.56 + return ((classFile[8] & 0xFF) << 8) | (classFile[9] & 0xFF); 57.57 + } 57.58 + 57.59 + static void test(Object value) throws ReflectiveOperationException { 57.60 + System.out.printf("Test: %s", value != null ? value.getClass() : "null"); 57.61 + 57.62 + ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); 57.63 + cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, "Test", null, "java/lang/Object", null); 57.64 + 57.65 + MethodVisitor mv = cw.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC, TEST_METHOD_NAME, "()Ljava/lang/Object;", null, null); 57.66 + 57.67 + String placeholder = "CONSTANT"; 57.68 + int index = cw.newConst(placeholder); 57.69 + mv.visitLdcInsn(placeholder); 57.70 + mv.visitInsn(Opcodes.ARETURN); 57.71 + 57.72 + mv.visitMaxs(0, 0); 57.73 + mv.visitEnd(); 57.74 + 57.75 + byte[] classFile = cw.toByteArray(); 57.76 + 57.77 + Object[] cpPatches = new Object[getConstantPoolSize(classFile)]; 57.78 + cpPatches[index] = value; 57.79 + 57.80 + Class<?> test = UNSAFE.defineAnonymousClass(VMAnonymousClasses.class, classFile, cpPatches); 57.81 + 57.82 + Object expectedResult = (value != null) ? value : placeholder; 57.83 + for (int i = 0; i<15000; i++) { 57.84 + Object result = test.getMethod(TEST_METHOD_NAME).invoke(null); 57.85 + if (result != expectedResult) { 57.86 + throw new AssertionError(String.format("Wrong value returned: %s != %s", value, result)); 57.87 + } 57.88 + } 57.89 + System.out.println(" PASSED"); 57.90 + } 57.91 + 57.92 + public static void main(String[] args) throws ReflectiveOperationException { 57.93 + // Objects 57.94 + test(new Object()); 57.95 + test("TEST"); 57.96 + test(new VMAnonymousClasses()); 57.97 + test(null); 57.98 + 57.99 + // Class 57.100 + test(String.class); 57.101 + 57.102 + // Arrays 57.103 + test(new boolean[0]); 57.104 + test(new byte[0]); 57.105 + test(new char[0]); 57.106 + test(new short[0]); 57.107 + test(new int[0]); 57.108 + test(new long[0]); 57.109 + test(new float[0]); 57.110 + test(new double[0]); 57.111 + test(new Object[0]); 57.112 + 57.113 + // Multi-dimensional arrays 57.114 + test(new byte[0][0]); 57.115 + test(new Object[0][0]); 57.116 + 57.117 + // MethodHandle-related 57.118 + MethodType mt = MethodType.methodType(void.class, String[].class); 57.119 + MethodHandle mh = MethodHandles.lookup().findStatic(VMAnonymousClasses.class, "main", mt); 57.120 + test(mt); 57.121 + test(mh); 57.122 + test(new ConstantCallSite(mh)); 57.123 + test(new MutableCallSite(MethodType.methodType(void.class))); 57.124 + test(new VolatileCallSite(MethodType.methodType(void.class))); 57.125 + 57.126 + System.out.println("TEST PASSED"); 57.127 + } 57.128 +}
58.1 --- a/test/compiler/membars/DekkerTest.java Fri Oct 31 17:09:14 2014 -0700 58.2 +++ b/test/compiler/membars/DekkerTest.java Thu Nov 06 09:39:49 2014 -0800 58.3 @@ -25,9 +25,9 @@ 58.4 * @test 58.5 * @bug 8007898 58.6 * @summary Incorrect optimization of Memory Barriers in Matcher::post_store_load_barrier(). 58.7 - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest 58.8 - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest 58.9 - * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:+StressGCM -XX:+StressLCM DekkerTest 58.10 + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:-TieredCompilation -XX:+StressGCM -XX:+StressLCM DekkerTest 58.11 + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:-TieredCompilation -XX:+StressGCM -XX:+StressLCM DekkerTest 58.12 + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CICompilerCount=1 -XX:-TieredCompilation -XX:+StressGCM -XX:+StressLCM DekkerTest 58.13 * @author Martin Doerr martin DOT doerr AT sap DOT com 58.14 * 58.15 * Run 3 times since the failure is intermittent.
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 59.2 +++ b/test/compiler/startup/NumCompilerThreadsCheck.java Thu Nov 06 09:39:49 2014 -0800 59.3 @@ -0,0 +1,57 @@ 59.4 +/* 59.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 59.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 59.7 + * 59.8 + * This code is free software; you can redistribute it and/or modify it 59.9 + * under the terms of the GNU General Public License version 2 only, as 59.10 + * published by the Free Software Foundation. 59.11 + * 59.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 59.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 59.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 59.15 + * version 2 for more details (a copy is included in the LICENSE file that 59.16 + * accompanied this code). 59.17 + * 59.18 + * You should have received a copy of the GNU General Public License version 59.19 + * 2 along with this work; if not, write to the Free Software Foundation, 59.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 59.21 + * 59.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 59.23 + * or visit www.oracle.com if you need additional information or have any 59.24 + * questions. 59.25 + */ 59.26 + 59.27 +/* 59.28 + * @test 59.29 + * @bug 8034775 59.30 + * @summary Ensures correct minimal number of compiler threads (provided by -XX:CICompilerCount=) 59.31 + * @library /testlibrary 59.32 + */ 59.33 +import com.oracle.java.testlibrary.*; 59.34 + 59.35 +public class NumCompilerThreadsCheck { 59.36 + 59.37 + public static void main(String[] args) throws Exception { 59.38 + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:CICompilerCount=-1"); 59.39 + OutputAnalyzer out = new OutputAnalyzer(pb.start()); 59.40 + 59.41 + String expectedOutput = "CICompilerCount of -1 is invalid"; 59.42 + out.shouldContain(expectedOutput); 59.43 + 59.44 + if (isZeroVm()) { 59.45 + String expectedLowWaterMarkText = "must be at least 0"; 59.46 + out.shouldContain(expectedLowWaterMarkText); 59.47 + } 59.48 + } 59.49 + 59.50 + private static boolean isZeroVm() { 59.51 + String vmName = System.getProperty("java.vm.name"); 59.52 + if (vmName == null) { 59.53 + throw new RuntimeException("No VM name"); 59.54 + } 59.55 + if (vmName.toLowerCase().contains("zero")) { 59.56 + return true; 59.57 + } 59.58 + return false; 59.59 + } 59.60 +}
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 60.2 +++ b/test/runtime/NMT/ChangeTrackingLevel.java Thu Nov 06 09:39:49 2014 -0800 60.3 @@ -0,0 +1,51 @@ 60.4 +/* 60.5 + * Copyright (c) 2013, 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 8059100 60.30 + * @summary Test that you can decrease NMT tracking level but not increase it. 60.31 + * @key nmt 60.32 + * @library /testlibrary /testlibrary/whitebox 60.33 + * @build ChangeTrackingLevel 60.34 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 60.35 + * sun.hotspot.WhiteBox$WhiteBoxPermission 60.36 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ChangeTrackingLevel 60.37 + */ 60.38 + 60.39 +import com.oracle.java.testlibrary.*; 60.40 +import sun.hotspot.WhiteBox; 60.41 + 60.42 +public class ChangeTrackingLevel { 60.43 + 60.44 + public static WhiteBox wb = WhiteBox.getWhiteBox(); 60.45 + public static void main(String args[]) throws Exception { 60.46 + boolean testChangeLevel = wb.NMTChangeTrackingLevel(); 60.47 + if (testChangeLevel) { 60.48 + System.out.println("NMT level change test passed."); 60.49 + } else { 60.50 + // it also fails if the VM asserts. 60.51 + throw new RuntimeException("NMT level change test failed"); 60.52 + } 60.53 + } 60.54 +};
61.1 --- a/test/runtime/NMT/PrintNMTStatistics.java Fri Oct 31 17:09:14 2014 -0700 61.2 +++ b/test/runtime/NMT/PrintNMTStatistics.java Thu Nov 06 09:39:49 2014 -0800 61.3 @@ -1,5 +1,5 @@ 61.4 /* 61.5 - * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. 61.6 + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 61.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.8 * 61.9 * This code is free software; you can redistribute it and/or modify it 61.10 @@ -24,42 +24,40 @@ 61.11 /* 61.12 * @test 61.13 * @key nmt regression 61.14 - * @bug 8005936 61.15 - * @summary Make sure PrintNMTStatistics works on normal JVM exit 61.16 - * @library /testlibrary /testlibrary/whitebox 61.17 - * @build PrintNMTStatistics 61.18 - * @run main ClassFileInstaller sun.hotspot.WhiteBox 61.19 - * @run main PrintNMTStatistics 61.20 + * @bug 8005936 8058606 61.21 + * @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level 61.22 + * @library /testlibrary 61.23 */ 61.24 61.25 import com.oracle.java.testlibrary.*; 61.26 61.27 -import java.util.regex.Matcher; 61.28 -import java.util.regex.Pattern; 61.29 -import sun.hotspot.WhiteBox; 61.30 - 61.31 public class PrintNMTStatistics { 61.32 61.33 - public static void main(String args[]) throws Exception { 61.34 - 61.35 - // We start a new java process running with an argument and use WB API to ensure 61.36 - // we have data for NMT on VM exit 61.37 - if (args.length > 0) { 61.38 - return; 61.39 - } 61.40 + public static void main(String args[]) throws Exception { 61.41 61.42 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( 61.43 - "-XX:+UnlockDiagnosticVMOptions", 61.44 - "-Xbootclasspath/a:.", 61.45 - "-XX:+WhiteBoxAPI", 61.46 - "-XX:NativeMemoryTracking=summary", 61.47 - "-XX:+PrintNMTStatistics", 61.48 - "PrintNMTStatistics", 61.49 - "test"); 61.50 + "-XX:+UnlockDiagnosticVMOptions", 61.51 + "-XX:+PrintNMTStatistics", 61.52 + "-XX:NativeMemoryTracking=detail", 61.53 + "-version"); 61.54 61.55 - OutputAnalyzer output = new OutputAnalyzer(pb.start()); 61.56 - output.shouldContain("Java Heap (reserved="); 61.57 - output.shouldNotContain("error"); 61.58 - output.shouldHaveExitValue(0); 61.59 - } 61.60 + OutputAnalyzer output_detail = new OutputAnalyzer(pb.start()); 61.61 + output_detail.shouldContain("Virtual memory map:"); 61.62 + output_detail.shouldContain("Details:"); 61.63 + output_detail.shouldNotContain("error"); 61.64 + output_detail.shouldHaveExitValue(0); 61.65 + 61.66 + ProcessBuilder pb1 = ProcessTools.createJavaProcessBuilder( 61.67 + "-XX:+UnlockDiagnosticVMOptions", 61.68 + "-XX:+PrintNMTStatistics", 61.69 + "-XX:NativeMemoryTracking=summary", 61.70 + "-version"); 61.71 + 61.72 + OutputAnalyzer output_summary = new OutputAnalyzer(pb1.start()); 61.73 + output_summary.shouldContain("Java Heap (reserved="); 61.74 + output_summary.shouldNotContain("Virtual memory map:"); 61.75 + output_summary.shouldNotContain("Details:"); 61.76 + output_summary.shouldNotContain("error"); 61.77 + output_summary.shouldHaveExitValue(0); 61.78 + } 61.79 }
62.1 --- a/test/runtime/SharedArchiveFile/LimitSharedSizes.java Fri Oct 31 17:09:14 2014 -0700 62.2 +++ b/test/runtime/SharedArchiveFile/LimitSharedSizes.java Thu Nov 06 09:39:49 2014 -0800 62.3 @@ -51,9 +51,12 @@ 62.4 // Known issue, JDK-8038422 (assert() on Windows) 62.5 // new SharedSizeTestData("-XX:SharedMiscDataSize", "500k", "miscellaneous data"), 62.6 62.7 - // This will cause a VM crash; commenting out for now; see bug JDK-8038268 62.8 - // @ignore JDK-8038268 62.9 - // new SharedSizeTestData("-XX:SharedMiscCodeSize", "20k", "miscellaneous code"), 62.10 + // Too small of a misc code size should not cause a vm crash. 62.11 + // It should result in the following error message: 62.12 + // The shared miscellaneous code space is not large enough 62.13 + // to preload requested classes. Use -XX:SharedMiscCodeSize= 62.14 + // to increase the initial size of shared miscellaneous code space. 62.15 + new SharedSizeTestData("-XX:SharedMiscCodeSize", "20k", "miscellaneous code"), 62.16 62.17 // these values are larger than default ones, but should 62.18 // be acceptable and not cause failure
63.1 --- a/test/runtime/lambda-features/InvokespecialInterface.java Fri Oct 31 17:09:14 2014 -0700 63.2 +++ b/test/runtime/lambda-features/InvokespecialInterface.java Thu Nov 06 09:39:49 2014 -0800 63.3 @@ -33,11 +33,12 @@ 63.4 import java.util.function.*; 63.5 import java.util.*; 63.6 63.7 +public class InvokespecialInterface { 63.8 interface I { 63.9 default void imethod() { System.out.println("I::imethod"); } 63.10 } 63.11 63.12 -class C implements I { 63.13 +static class C implements I { 63.14 public void foo() { I.super.imethod(); } // invokespecial InterfaceMethod 63.15 public void bar() { I i = this; i.imethod(); } // invokeinterface same 63.16 public void doSomeInvokedynamic() { 63.17 @@ -48,7 +49,6 @@ 63.18 } 63.19 } 63.20 63.21 -public class InvokespecialInterface { 63.22 public static void main(java.lang.String[] unused) { 63.23 // need to create C and call I::foo() 63.24 C c = new C();
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 64.2 +++ b/test/runtime/lambda-features/TestInterfaceInit.java Thu Nov 06 09:39:49 2014 -0800 64.3 @@ -0,0 +1,87 @@ 64.4 +/* 64.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 64.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 64.7 + * 64.8 + * This code is free software; you can redistribute it and/or modify it 64.9 + * under the terms of the GNU General Public License version 2 only, as 64.10 + * published by the Free Software Foundation. 64.11 + * 64.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 64.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 64.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 64.15 + * version 2 for more details (a copy is included in the LICENSE file that 64.16 + * accompanied this code). 64.17 + * 64.18 + * You should have received a copy of the GNU General Public License version 64.19 + * 2 along with this work; if not, write to the Free Software Foundation, 64.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 64.21 + * 64.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 64.23 + * or visit www.oracle.com if you need additional information or have any 64.24 + * questions. 64.25 + * 64.26 + */ 64.27 + 64.28 +/* 64.29 + * @test 64.30 + * @bug 8034275 64.31 + * @summary [JDK 8u40] Test interface initialization: only for interfaces declaring default methods 64.32 + * @run main TestInterfaceInit 64.33 + */ 64.34 +import java.util.List; 64.35 +import java.util.Arrays; 64.36 +import java.util.ArrayList; 64.37 + 64.38 +public class TestInterfaceInit { 64.39 + 64.40 + static List<Class<?>> cInitOrder = new ArrayList<>(); 64.41 + 64.42 + // Declares a default method and initializes 64.43 + interface I { 64.44 + boolean v = TestInterfaceInit.out(I.class); 64.45 + default void x() {} 64.46 + } 64.47 + 64.48 + // Declares a default method and initializes 64.49 + interface J extends I { 64.50 + boolean v = TestInterfaceInit.out(J.class); 64.51 + default void x() {} 64.52 + } 64.53 + // No default method, does not initialize 64.54 + interface JN extends J { 64.55 + boolean v = TestInterfaceInit.out(JN.class); 64.56 + } 64.57 + 64.58 + // Declares a default method and initializes 64.59 + interface K extends I { 64.60 + boolean v = TestInterfaceInit.out(K.class); 64.61 + default void x() {} 64.62 + } 64.63 + 64.64 + // No default method, does not initialize 64.65 + interface KN extends K { 64.66 + boolean v = TestInterfaceInit.out(KN.class); 64.67 + } 64.68 + 64.69 + interface L extends JN, KN { 64.70 + boolean v = TestInterfaceInit.out(L.class); 64.71 + default void x() {} 64.72 + } 64.73 + 64.74 + public static void main(String[] args) { 64.75 + // Trigger initialization 64.76 + boolean v = L.v; 64.77 + 64.78 + List<Class<?>> expectedCInitOrder = Arrays.asList(I.class,J.class,K.class,L.class); 64.79 + if (!cInitOrder.equals(expectedCInitOrder)) { 64.80 + throw new RuntimeException(String.format("Class initialization array %s not equal to expected array %s", cInitOrder, expectedCInitOrder)); 64.81 + } 64.82 + } 64.83 + 64.84 + static boolean out(Class c) { 64.85 + System.out.println("#: initializing " + c.getName()); 64.86 + cInitOrder.add(c); 64.87 + return true; 64.88 + } 64.89 + 64.90 +}
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 65.2 +++ b/test/runtime/lambda-features/TestInterfaceOrder.java Thu Nov 06 09:39:49 2014 -0800 65.3 @@ -0,0 +1,88 @@ 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 order 65.32 + * @run main TestInterfaceOrder 65.33 + */ 65.34 + 65.35 +import java.util.List; 65.36 +import java.util.Arrays; 65.37 +import java.util.ArrayList; 65.38 + 65.39 +public class TestInterfaceOrder { 65.40 + static List<Class<?>> cInitOrder = new ArrayList<>(); 65.41 + 65.42 + public static void main(java.lang.String[] args) { 65.43 + //Trigger initialization 65.44 + C c = new C(); 65.45 + 65.46 + List<Class<?>> expectedCInitOrder = Arrays.asList(I.class, J.class, A.class, K.class, B.class, L.class, C.class); 65.47 + if (!cInitOrder.equals(expectedCInitOrder)) { 65.48 + throw new RuntimeException(String.format("Class initialization order %s not equal to expected order %s", cInitOrder, expectedCInitOrder)); 65.49 + } 65.50 + } 65.51 + 65.52 + interface I { 65.53 + boolean v = TestInterfaceOrder.out(I.class); 65.54 + default void i() {} 65.55 + } 65.56 + 65.57 + interface J extends I { 65.58 + boolean v = TestInterfaceOrder.out(J.class); 65.59 + default void j() {} 65.60 + } 65.61 + 65.62 + static class A implements J { 65.63 + static boolean v = TestInterfaceOrder.out(A.class); 65.64 + } 65.65 + 65.66 + interface K extends I { 65.67 + boolean v = TestInterfaceOrder.out(K.class); 65.68 + default void k() {} 65.69 + } 65.70 + 65.71 + static class B extends A implements K { 65.72 + static boolean v = TestInterfaceOrder.out(B.class); 65.73 + } 65.74 + 65.75 + interface L { 65.76 + boolean v = TestInterfaceOrder.out(L.class); 65.77 + default void l() {} 65.78 + } 65.79 + 65.80 + static class C extends B implements L { 65.81 + static boolean v = TestInterfaceOrder.out(C.class); 65.82 + } 65.83 + 65.84 + 65.85 + static boolean out(Class c) { 65.86 + System.out.println("#: initializing " + c.getName()); 65.87 + cInitOrder.add(c); 65.88 + return true; 65.89 + } 65.90 + 65.91 +}
66.1 --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Fri Oct 31 17:09:14 2014 -0700 66.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Thu Nov 06 09:39:49 2014 -0800 66.3 @@ -101,6 +101,7 @@ 66.4 public native void NMTOverflowHashBucket(long num); 66.5 public native long NMTMallocWithPseudoStack(long size, int index); 66.6 public native boolean NMTIsDetailSupported(); 66.7 + public native boolean NMTChangeTrackingLevel(); 66.8 66.9 // Compiler 66.10 public native void deoptimizeAll();