Wed, 17 Apr 2013 10:12:42 -0700
Merge
test/gc/6941923/test6941923.sh | file | annotate | diff | comparison | revisions | |
test/gc/TestVerifyBeforeGCDuringStartup.java | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Fri Apr 12 10:14:42 2013 +0100 1.2 +++ b/.hgtags Wed Apr 17 10:12:42 2013 -0700 1.3 @@ -332,3 +332,4 @@ 1.4 a947f40fb536e5b9e0aa210cf26abb430f80887a hs25-b26 1.5 42fe530cd478744a4d12a0cbf803f0fc804bab1a jdk8-b85 1.6 09b0d3e9ba6cdf7da07d4010d2d1df14596f6864 hs25-b27 1.7 +6d88a566d369f6a1f86912cad7d0912686b2fda1 hs25-b28
2.1 --- a/make/hotspot_version Fri Apr 12 10:14:42 2013 +0100 2.2 +++ b/make/hotspot_version Wed Apr 17 10:12:42 2013 -0700 2.3 @@ -35,7 +35,7 @@ 2.4 2.5 HS_MAJOR_VER=25 2.6 HS_MINOR_VER=0 2.7 -HS_BUILD_NUMBER=27 2.8 +HS_BUILD_NUMBER=28 2.9 2.10 JDK_MAJOR_VER=1 2.11 JDK_MINOR_VER=8
3.1 --- a/src/share/vm/adlc/output_c.cpp Fri Apr 12 10:14:42 2013 +0100 3.2 +++ b/src/share/vm/adlc/output_c.cpp Wed Apr 17 10:12:42 2013 -0700 3.3 @@ -63,11 +63,10 @@ 3.4 RegDef *reg_def = NULL; 3.5 RegDef *next = NULL; 3.6 registers->reset_RegDefs(); 3.7 - for( reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next ) { 3.8 + for (reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next) { 3.9 next = registers->iter_RegDefs(); 3.10 const char *comma = (next != NULL) ? "," : " // no trailing comma"; 3.11 - fprintf(fp," \"%s\"%s\n", 3.12 - reg_def->_regname, comma ); 3.13 + fprintf(fp," \"%s\"%s\n", reg_def->_regname, comma); 3.14 } 3.15 3.16 // Finish defining enumeration 3.17 @@ -79,10 +78,10 @@ 3.18 reg_def = NULL; 3.19 next = NULL; 3.20 registers->reset_RegDefs(); 3.21 - for( reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next ) { 3.22 + for (reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next) { 3.23 next = registers->iter_RegDefs(); 3.24 const char *comma = (next != NULL) ? "," : " // no trailing comma"; 3.25 - fprintf(fp,"\t%s%s\n", reg_def->_concrete, comma ); 3.26 + fprintf(fp,"\t%s%s\n", reg_def->_concrete, comma); 3.27 } 3.28 // Finish defining array 3.29 fprintf(fp,"\t};\n"); 3.30 @@ -104,19 +103,17 @@ 3.31 RegDef *reg_def = NULL; 3.32 RegDef *next = NULL; 3.33 registers->reset_RegDefs(); 3.34 - for( reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next ) { 3.35 + for (reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next) { 3.36 next = registers->iter_RegDefs(); 3.37 const char* register_encode = reg_def->register_encode(); 3.38 const char *comma = (next != NULL) ? "," : " // no trailing comma"; 3.39 int encval; 3.40 if (!ADLParser::is_int_token(register_encode, encval)) { 3.41 - fprintf(fp," %s%s // %s\n", 3.42 - register_encode, comma, reg_def->_regname ); 3.43 + fprintf(fp," %s%s // %s\n", register_encode, comma, reg_def->_regname); 3.44 } else { 3.45 // Output known constants in hex char format (backward compatibility). 3.46 assert(encval < 256, "Exceeded supported width for register encoding"); 3.47 - fprintf(fp," (unsigned char)'\\x%X'%s // %s\n", 3.48 - encval, comma, reg_def->_regname ); 3.49 + fprintf(fp," (unsigned char)'\\x%X'%s // %s\n", encval, comma, reg_def->_regname); 3.50 } 3.51 } 3.52 // Finish defining enumeration 3.53 @@ -133,9 +130,10 @@ 3.54 fprintf(fp,"// Enumeration of register class names\n"); 3.55 fprintf(fp, "enum machRegisterClass {\n"); 3.56 registers->_rclasses.reset(); 3.57 - for( const char *class_name = NULL; 3.58 - (class_name = registers->_rclasses.iter()) != NULL; ) { 3.59 - fprintf(fp," %s,\n", toUpper( class_name )); 3.60 + for (const char *class_name = NULL; (class_name = registers->_rclasses.iter()) != NULL;) { 3.61 + const char * class_name_to_upper = toUpper(class_name); 3.62 + fprintf(fp," %s,\n", class_name_to_upper); 3.63 + delete[] class_name_to_upper; 3.64 } 3.65 // Finish defining enumeration 3.66 fprintf(fp, " _last_Mach_Reg_Class\n"); 3.67 @@ -148,7 +146,7 @@ 3.68 void ArchDesc::declare_register_masks(FILE *fp_hpp) { 3.69 const char *rc_name; 3.70 3.71 - if( _register ) { 3.72 + if (_register) { 3.73 // Build enumeration of user-defined register classes. 3.74 defineRegClassEnum(fp_hpp, _register); 3.75 3.76 @@ -156,24 +154,27 @@ 3.77 fprintf(fp_hpp,"\n"); 3.78 fprintf(fp_hpp,"// Register masks, one for each register class.\n"); 3.79 _register->_rclasses.reset(); 3.80 - for( rc_name = NULL; 3.81 - (rc_name = _register->_rclasses.iter()) != NULL; ) { 3.82 - const char *prefix = ""; 3.83 - RegClass *reg_class = _register->getRegClass(rc_name); 3.84 - assert( reg_class, "Using an undefined register class"); 3.85 + for (rc_name = NULL; (rc_name = _register->_rclasses.iter()) != NULL;) { 3.86 + const char *prefix = ""; 3.87 + RegClass *reg_class = _register->getRegClass(rc_name); 3.88 + assert(reg_class, "Using an undefined register class"); 3.89 + 3.90 + const char* rc_name_to_upper = toUpper(rc_name); 3.91 3.92 if (reg_class->_user_defined == NULL) { 3.93 - fprintf(fp_hpp, "extern const RegMask _%s%s_mask;\n", prefix, toUpper( rc_name ) ); 3.94 - fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { return _%s%s_mask; }\n", prefix, toUpper( rc_name ), prefix, toUpper( rc_name )); 3.95 + fprintf(fp_hpp, "extern const RegMask _%s%s_mask;\n", prefix, rc_name_to_upper); 3.96 + fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { return _%s%s_mask; }\n", prefix, rc_name_to_upper, prefix, rc_name_to_upper); 3.97 } else { 3.98 - fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { %s }\n", prefix, toUpper( rc_name ), reg_class->_user_defined); 3.99 + fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { %s }\n", prefix, rc_name_to_upper, reg_class->_user_defined); 3.100 } 3.101 3.102 - if( reg_class->_stack_or_reg ) { 3.103 + if (reg_class->_stack_or_reg) { 3.104 assert(reg_class->_user_defined == NULL, "no user defined reg class here"); 3.105 - fprintf(fp_hpp, "extern const RegMask _%sSTACK_OR_%s_mask;\n", prefix, toUpper( rc_name ) ); 3.106 - fprintf(fp_hpp, "inline const RegMask &%sSTACK_OR_%s_mask() { return _%sSTACK_OR_%s_mask; }\n", prefix, toUpper( rc_name ), prefix, toUpper( rc_name ) ); 3.107 + fprintf(fp_hpp, "extern const RegMask _%sSTACK_OR_%s_mask;\n", prefix, rc_name_to_upper); 3.108 + fprintf(fp_hpp, "inline const RegMask &%sSTACK_OR_%s_mask() { return _%sSTACK_OR_%s_mask; }\n", prefix, rc_name_to_upper, prefix, rc_name_to_upper); 3.109 } 3.110 + delete[] rc_name_to_upper; 3.111 + 3.112 } 3.113 } 3.114 } 3.115 @@ -183,34 +184,41 @@ 3.116 void ArchDesc::build_register_masks(FILE *fp_cpp) { 3.117 const char *rc_name; 3.118 3.119 - if( _register ) { 3.120 + if (_register) { 3.121 // Generate a list of register masks, one for each class. 3.122 fprintf(fp_cpp,"\n"); 3.123 fprintf(fp_cpp,"// Register masks, one for each register class.\n"); 3.124 _register->_rclasses.reset(); 3.125 - for( rc_name = NULL; 3.126 - (rc_name = _register->_rclasses.iter()) != NULL; ) { 3.127 - const char *prefix = ""; 3.128 - RegClass *reg_class = _register->getRegClass(rc_name); 3.129 - assert( reg_class, "Using an undefined register class"); 3.130 - 3.131 - if (reg_class->_user_defined != NULL) continue; 3.132 + for (rc_name = NULL; (rc_name = _register->_rclasses.iter()) != NULL;) { 3.133 + const char *prefix = ""; 3.134 + RegClass *reg_class = _register->getRegClass(rc_name); 3.135 + assert(reg_class, "Using an undefined register class"); 3.136 + 3.137 + if (reg_class->_user_defined != NULL) { 3.138 + continue; 3.139 + } 3.140 3.141 int len = RegisterForm::RegMask_Size(); 3.142 - fprintf(fp_cpp, "const RegMask _%s%s_mask(", prefix, toUpper( rc_name ) ); 3.143 - { int i; 3.144 - for( i = 0; i < len-1; i++ ) 3.145 - fprintf(fp_cpp," 0x%x,",reg_class->regs_in_word(i,false)); 3.146 - fprintf(fp_cpp," 0x%x );\n",reg_class->regs_in_word(i,false)); 3.147 + const char* rc_name_to_upper = toUpper(rc_name); 3.148 + fprintf(fp_cpp, "const RegMask _%s%s_mask(", prefix, rc_name_to_upper); 3.149 + 3.150 + { 3.151 + int i; 3.152 + for(i = 0; i < len - 1; i++) { 3.153 + fprintf(fp_cpp," 0x%x,", reg_class->regs_in_word(i, false)); 3.154 + } 3.155 + fprintf(fp_cpp," 0x%x );\n", reg_class->regs_in_word(i, false)); 3.156 } 3.157 3.158 - if( reg_class->_stack_or_reg ) { 3.159 + if (reg_class->_stack_or_reg) { 3.160 int i; 3.161 - fprintf(fp_cpp, "const RegMask _%sSTACK_OR_%s_mask(", prefix, toUpper( rc_name ) ); 3.162 - for( i = 0; i < len-1; i++ ) 3.163 - fprintf(fp_cpp," 0x%x,",reg_class->regs_in_word(i,true)); 3.164 - fprintf(fp_cpp," 0x%x );\n",reg_class->regs_in_word(i,true)); 3.165 + fprintf(fp_cpp, "const RegMask _%sSTACK_OR_%s_mask(", prefix, rc_name_to_upper); 3.166 + for(i = 0; i < len - 1; i++) { 3.167 + fprintf(fp_cpp," 0x%x,",reg_class->regs_in_word(i, true)); 3.168 + } 3.169 + fprintf(fp_cpp," 0x%x );\n",reg_class->regs_in_word(i, true)); 3.170 } 3.171 + delete[] rc_name_to_upper; 3.172 } 3.173 } 3.174 } 3.175 @@ -2676,7 +2684,9 @@ 3.176 if (strcmp(first_reg_class, "stack_slots") == 0) { 3.177 fprintf(fp," return &(Compile::current()->FIRST_STACK_mask());\n"); 3.178 } else { 3.179 - fprintf(fp," return &%s_mask();\n", toUpper(first_reg_class)); 3.180 + const char* first_reg_class_to_upper = toUpper(first_reg_class); 3.181 + fprintf(fp," return &%s_mask();\n", first_reg_class_to_upper); 3.182 + delete[] first_reg_class_to_upper; 3.183 } 3.184 } else { 3.185 // Build a switch statement to return the desired mask. 3.186 @@ -2688,7 +2698,9 @@ 3.187 if( !strcmp(reg_class, "stack_slots") ) { 3.188 fprintf(fp, " case %d: return &(Compile::current()->FIRST_STACK_mask());\n", index); 3.189 } else { 3.190 - fprintf(fp, " case %d: return &%s_mask();\n", index, toUpper(reg_class)); 3.191 + const char* reg_class_to_upper = toUpper(reg_class); 3.192 + fprintf(fp, " case %d: return &%s_mask();\n", index, reg_class_to_upper); 3.193 + delete[] reg_class_to_upper; 3.194 } 3.195 } 3.196 fprintf(fp," }\n");
4.1 --- a/src/share/vm/adlc/output_h.cpp Fri Apr 12 10:14:42 2013 +0100 4.2 +++ b/src/share/vm/adlc/output_h.cpp Wed Apr 17 10:12:42 2013 -0700 4.3 @@ -2069,9 +2069,21 @@ 4.4 void closing() { fprintf(_cpp, " _LAST_MACH_OPER\n"); 4.5 OutputMap::closing(); 4.6 } 4.7 - void map(OpClassForm &opc) { fprintf(_cpp, " %s", _AD.machOperEnum(opc._ident) ); } 4.8 - void map(OperandForm &oper) { fprintf(_cpp, " %s", _AD.machOperEnum(oper._ident) ); } 4.9 - void map(char *name) { fprintf(_cpp, " %s", _AD.machOperEnum(name)); } 4.10 + void map(OpClassForm &opc) { 4.11 + const char* opc_ident_to_upper = _AD.machOperEnum(opc._ident); 4.12 + fprintf(_cpp, " %s", opc_ident_to_upper); 4.13 + delete[] opc_ident_to_upper; 4.14 + } 4.15 + void map(OperandForm &oper) { 4.16 + const char* oper_ident_to_upper = _AD.machOperEnum(oper._ident); 4.17 + fprintf(_cpp, " %s", oper_ident_to_upper); 4.18 + delete[] oper_ident_to_upper; 4.19 + } 4.20 + void map(char *name) { 4.21 + const char* name_to_upper = _AD.machOperEnum(name); 4.22 + fprintf(_cpp, " %s", name_to_upper); 4.23 + delete[] name_to_upper; 4.24 + } 4.25 4.26 bool do_instructions() { return false; } 4.27 void map(InstructForm &inst){ assert( false, "ShouldNotCallThis()"); }
5.1 --- a/src/share/vm/c1/c1_ValueMap.cpp Fri Apr 12 10:14:42 2013 +0100 5.2 +++ b/src/share/vm/c1/c1_ValueMap.cpp Wed Apr 17 10:12:42 2013 -0700 5.3 @@ -316,6 +316,7 @@ 5.4 ShortLoopOptimizer* _short_loop_optimizer; 5.5 Instruction* _insertion_point; 5.6 ValueStack * _state; 5.7 + bool _insert_is_pred; 5.8 5.9 void set_invariant(Value v) const { _gvn->set_processed(v); } 5.10 bool is_invariant(Value v) const { return _gvn->is_processed(v); } 5.11 @@ -339,6 +340,7 @@ 5.12 5.13 assert(insertion_block->end()->as_Base() == NULL, "cannot insert into entry block"); 5.14 _insertion_point = insertion_block->end()->prev(); 5.15 + _insert_is_pred = loop_header->is_predecessor(insertion_block); 5.16 5.17 BlockEnd *block_end = insertion_block->end(); 5.18 _state = block_end->state_before(); 5.19 @@ -379,13 +381,13 @@ 5.20 } else if (cur->as_LoadField() != NULL) { 5.21 LoadField* lf = (LoadField*)cur; 5.22 // deoptimizes on NullPointerException 5.23 - cur_invariant = !lf->needs_patching() && !lf->field()->is_volatile() && !_short_loop_optimizer->has_field_store(lf->field()->type()->basic_type()) && is_invariant(lf->obj()); 5.24 + cur_invariant = !lf->needs_patching() && !lf->field()->is_volatile() && !_short_loop_optimizer->has_field_store(lf->field()->type()->basic_type()) && is_invariant(lf->obj()) && _insert_is_pred; 5.25 } else if (cur->as_ArrayLength() != NULL) { 5.26 ArrayLength *length = cur->as_ArrayLength(); 5.27 cur_invariant = is_invariant(length->array()); 5.28 } else if (cur->as_LoadIndexed() != NULL) { 5.29 LoadIndexed *li = (LoadIndexed *)cur->as_LoadIndexed(); 5.30 - cur_invariant = !_short_loop_optimizer->has_indexed_store(as_BasicType(cur->type())) && is_invariant(li->array()) && is_invariant(li->index()); 5.31 + cur_invariant = !_short_loop_optimizer->has_indexed_store(as_BasicType(cur->type())) && is_invariant(li->array()) && is_invariant(li->index()) && _insert_is_pred; 5.32 } 5.33 5.34 if (cur_invariant) {
6.1 --- a/src/share/vm/classfile/classFileParser.cpp Fri Apr 12 10:14:42 2013 +0100 6.2 +++ b/src/share/vm/classfile/classFileParser.cpp Wed Apr 17 10:12:42 2013 -0700 6.3 @@ -1723,9 +1723,6 @@ 6.4 } else { 6.5 coll->set_contended_group(0); // default contended group 6.6 } 6.7 - coll->set_contended(true); 6.8 - } else { 6.9 - coll->set_contended(false); 6.10 } 6.11 } 6.12 }
7.1 --- a/src/share/vm/classfile/classFileParser.hpp Fri Apr 12 10:14:42 2013 +0100 7.2 +++ b/src/share/vm/classfile/classFileParser.hpp Wed Apr 17 10:12:42 2013 -0700 7.3 @@ -150,7 +150,6 @@ 7.4 void set_contended_group(u2 group) { _contended_group = group; } 7.5 u2 contended_group() { return _contended_group; } 7.6 7.7 - void set_contended(bool contended) { set_annotation(_sun_misc_Contended); } 7.8 bool is_contended() { return has_annotation(_sun_misc_Contended); } 7.9 }; 7.10
8.1 --- a/src/share/vm/classfile/classLoaderData.cpp Fri Apr 12 10:14:42 2013 +0100 8.2 +++ b/src/share/vm/classfile/classLoaderData.cpp Wed Apr 17 10:12:42 2013 -0700 8.3 @@ -70,15 +70,19 @@ 8.4 _is_anonymous(is_anonymous), _keep_alive(is_anonymous), // initially 8.5 _metaspace(NULL), _unloading(false), _klasses(NULL), 8.6 _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL), 8.7 - _next(NULL), _dependencies(NULL), 8.8 + _next(NULL), _dependencies(), 8.9 _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) { 8.10 // empty 8.11 } 8.12 8.13 void ClassLoaderData::init_dependencies(TRAPS) { 8.14 + _dependencies.init(CHECK); 8.15 +} 8.16 + 8.17 +void ClassLoaderData::Dependencies::init(TRAPS) { 8.18 // Create empty dependencies array to add to. CMS requires this to be 8.19 // an oop so that it can track additions via card marks. We think. 8.20 - _dependencies = (oop)oopFactory::new_objectArray(2, CHECK); 8.21 + _list_head = oopFactory::new_objectArray(2, CHECK); 8.22 } 8.23 8.24 bool ClassLoaderData::claim() { 8.25 @@ -95,13 +99,17 @@ 8.26 } 8.27 8.28 f->do_oop(&_class_loader); 8.29 - f->do_oop(&_dependencies); 8.30 + _dependencies.oops_do(f); 8.31 _handles->oops_do(f); 8.32 if (klass_closure != NULL) { 8.33 classes_do(klass_closure); 8.34 } 8.35 } 8.36 8.37 +void ClassLoaderData::Dependencies::oops_do(OopClosure* f) { 8.38 + f->do_oop((oop*)&_list_head); 8.39 +} 8.40 + 8.41 void ClassLoaderData::classes_do(KlassClosure* klass_closure) { 8.42 for (Klass* k = _klasses; k != NULL; k = k->next_link()) { 8.43 klass_closure->do_klass(k); 8.44 @@ -154,14 +162,14 @@ 8.45 // It's a dependency we won't find through GC, add it. This is relatively rare 8.46 // Must handle over GC point. 8.47 Handle dependency(THREAD, to); 8.48 - from_cld->add_dependency(dependency, CHECK); 8.49 + from_cld->_dependencies.add(dependency, CHECK); 8.50 } 8.51 8.52 8.53 -void ClassLoaderData::add_dependency(Handle dependency, TRAPS) { 8.54 +void ClassLoaderData::Dependencies::add(Handle dependency, TRAPS) { 8.55 // Check first if this dependency is already in the list. 8.56 // Save a pointer to the last to add to under the lock. 8.57 - objArrayOop ok = (objArrayOop)_dependencies; 8.58 + objArrayOop ok = _list_head; 8.59 objArrayOop last = NULL; 8.60 while (ok != NULL) { 8.61 last = ok; 8.62 @@ -184,16 +192,17 @@ 8.63 objArrayHandle new_dependency(THREAD, deps); 8.64 8.65 // Add the dependency under lock 8.66 - locked_add_dependency(last_handle, new_dependency); 8.67 + locked_add(last_handle, new_dependency, THREAD); 8.68 } 8.69 8.70 -void ClassLoaderData::locked_add_dependency(objArrayHandle last_handle, 8.71 - objArrayHandle new_dependency) { 8.72 +void ClassLoaderData::Dependencies::locked_add(objArrayHandle last_handle, 8.73 + objArrayHandle new_dependency, 8.74 + Thread* THREAD) { 8.75 8.76 // Have to lock and put the new dependency on the end of the dependency 8.77 // array so the card mark for CMS sees that this dependency is new. 8.78 // Can probably do this lock free with some effort. 8.79 - MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag); 8.80 + ObjectLocker ol(Handle(THREAD, _list_head), THREAD); 8.81 8.82 oop loader_or_mirror = new_dependency->obj_at(0); 8.83
9.1 --- a/src/share/vm/classfile/classLoaderData.hpp Fri Apr 12 10:14:42 2013 +0100 9.2 +++ b/src/share/vm/classfile/classLoaderData.hpp Wed Apr 17 10:12:42 2013 -0700 9.3 @@ -93,6 +93,18 @@ 9.4 class ClassLoaderData : public CHeapObj<mtClass> { 9.5 friend class VMStructs; 9.6 private: 9.7 + class Dependencies VALUE_OBJ_CLASS_SPEC { 9.8 + objArrayOop _list_head; 9.9 + void locked_add(objArrayHandle last, 9.10 + objArrayHandle new_dependency, 9.11 + Thread* THREAD); 9.12 + public: 9.13 + Dependencies() : _list_head(NULL) {} 9.14 + void add(Handle dependency, TRAPS); 9.15 + void init(TRAPS); 9.16 + void oops_do(OopClosure* f); 9.17 + }; 9.18 + 9.19 friend class ClassLoaderDataGraph; 9.20 friend class ClassLoaderDataGraphMetaspaceIterator; 9.21 friend class MetaDataFactory; 9.22 @@ -100,10 +112,11 @@ 9.23 9.24 static ClassLoaderData * _the_null_class_loader_data; 9.25 9.26 - oop _class_loader; // oop used to uniquely identify a class loader 9.27 - // class loader or a canonical class path 9.28 - oop _dependencies; // oop to hold dependencies from this class loader 9.29 - // data to others. 9.30 + oop _class_loader; // oop used to uniquely identify a class loader 9.31 + // class loader or a canonical class path 9.32 + Dependencies _dependencies; // holds dependencies from this class loader 9.33 + // data to others. 9.34 + 9.35 Metaspace * _metaspace; // Meta-space where meta-data defined by the 9.36 // classes in the class loader are allocated. 9.37 Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. 9.38 @@ -134,9 +147,6 @@ 9.39 static Metaspace* _ro_metaspace; 9.40 static Metaspace* _rw_metaspace; 9.41 9.42 - void add_dependency(Handle dependency, TRAPS); 9.43 - void locked_add_dependency(objArrayHandle last, objArrayHandle new_dependency); 9.44 - 9.45 void set_next(ClassLoaderData* next) { _next = next; } 9.46 ClassLoaderData* next() const { return _next; } 9.47
10.1 --- a/src/share/vm/classfile/systemDictionary.cpp Fri Apr 12 10:14:42 2013 +0100 10.2 +++ b/src/share/vm/classfile/systemDictionary.cpp Wed Apr 17 10:12:42 2013 -0700 10.3 @@ -1592,9 +1592,10 @@ 10.4 // Used for assertions and verification only 10.5 Klass* SystemDictionary::find_class(Symbol* class_name, ClassLoaderData* loader_data) { 10.6 #ifndef ASSERT 10.7 - guarantee(VerifyBeforeGC || 10.8 - VerifyDuringGC || 10.9 - VerifyBeforeExit || 10.10 + guarantee(VerifyBeforeGC || 10.11 + VerifyDuringGC || 10.12 + VerifyBeforeExit || 10.13 + VerifyDuringStartup || 10.14 VerifyAfterGC, "too expensive"); 10.15 #endif 10.16 assert_locked_or_safepoint(SystemDictionary_lock);
11.1 --- a/src/share/vm/compiler/compileBroker.cpp Fri Apr 12 10:14:42 2013 +0100 11.2 +++ b/src/share/vm/compiler/compileBroker.cpp Wed Apr 17 10:12:42 2013 -0700 11.3 @@ -1206,11 +1206,8 @@ 11.4 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 11.5 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); 11.6 assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); 11.7 - 11.8 - if (!TieredCompilation) { 11.9 - comp_level = CompLevel_highest_tier; 11.10 - } 11.11 - 11.12 + // allow any levels for WhiteBox 11.13 + assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); 11.14 // return quickly if possible 11.15 11.16 // lock, make sure that the compilation
12.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri Apr 12 10:14:42 2013 +0100 12.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Apr 17 10:12:42 2013 -0700 12.3 @@ -48,6 +48,7 @@ 12.4 #include "memory/iterator.hpp" 12.5 #include "memory/referencePolicy.hpp" 12.6 #include "memory/resourceArea.hpp" 12.7 +#include "memory/tenuredGeneration.hpp" 12.8 #include "oops/oop.inline.hpp" 12.9 #include "prims/jvmtiExport.hpp" 12.10 #include "runtime/globals_extension.hpp" 12.11 @@ -916,7 +917,31 @@ 12.12 return; 12.13 } 12.14 12.15 - size_t expand_bytes = 0; 12.16 + // Compute some numbers about the state of the heap. 12.17 + const size_t used_after_gc = used(); 12.18 + const size_t capacity_after_gc = capacity(); 12.19 + 12.20 + CardGeneration::compute_new_size(); 12.21 + 12.22 + // Reset again after a possible resizing 12.23 + cmsSpace()->reset_after_compaction(); 12.24 + 12.25 + assert(used() == used_after_gc && used_after_gc <= capacity(), 12.26 + err_msg("used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT 12.27 + " capacity: " SIZE_FORMAT, used(), used_after_gc, capacity())); 12.28 +} 12.29 + 12.30 +void ConcurrentMarkSweepGeneration::compute_new_size_free_list() { 12.31 + assert_locked_or_safepoint(Heap_lock); 12.32 + 12.33 + // If incremental collection failed, we just want to expand 12.34 + // to the limit. 12.35 + if (incremental_collection_failed()) { 12.36 + clear_incremental_collection_failed(); 12.37 + grow_to_reserved(); 12.38 + return; 12.39 + } 12.40 + 12.41 double free_percentage = ((double) free()) / capacity(); 12.42 double desired_free_percentage = (double) MinHeapFreeRatio / 100; 12.43 double maximum_free_percentage = (double) MaxHeapFreeRatio / 100; 12.44 @@ -925,9 +950,7 @@ 12.45 if (free_percentage < desired_free_percentage) { 12.46 size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); 12.47 assert(desired_capacity >= capacity(), "invalid expansion size"); 12.48 - expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes); 12.49 - } 12.50 - if (expand_bytes > 0) { 12.51 + size_t expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes); 12.52 if (PrintGCDetails && Verbose) { 12.53 size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); 12.54 gclog_or_tty->print_cr("\nFrom compute_new_size: "); 12.55 @@ -961,6 +984,14 @@ 12.56 gclog_or_tty->print_cr(" Expanded free fraction %f", 12.57 ((double) free()) / capacity()); 12.58 } 12.59 + } else { 12.60 + size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); 12.61 + assert(desired_capacity <= capacity(), "invalid expansion size"); 12.62 + size_t shrink_bytes = capacity() - desired_capacity; 12.63 + // Don't shrink unless the delta is greater than the minimum shrink we want 12.64 + if (shrink_bytes >= MinHeapDeltaBytes) { 12.65 + shrink_free_list_by(shrink_bytes); 12.66 + } 12.67 } 12.68 } 12.69 12.70 @@ -1872,7 +1903,7 @@ 12.71 assert_locked_or_safepoint(Heap_lock); 12.72 FreelistLocker z(this); 12.73 MetaspaceGC::compute_new_size(); 12.74 - _cmsGen->compute_new_size(); 12.75 + _cmsGen->compute_new_size_free_list(); 12.76 } 12.77 12.78 // A work method used by foreground collection to determine 12.79 @@ -2601,6 +2632,10 @@ 12.80 } 12.81 12.82 void ConcurrentMarkSweepGeneration::gc_prologue(bool full) { 12.83 + 12.84 + _capacity_at_prologue = capacity(); 12.85 + _used_at_prologue = used(); 12.86 + 12.87 // Delegate to CMScollector which knows how to coordinate between 12.88 // this and any other CMS generations that it is responsible for 12.89 // collecting. 12.90 @@ -2774,6 +2809,23 @@ 12.91 } 12.92 } 12.93 12.94 + 12.95 +void 12.96 +CMSCollector::print_on_error(outputStream* st) { 12.97 + CMSCollector* collector = ConcurrentMarkSweepGeneration::_collector; 12.98 + if (collector != NULL) { 12.99 + CMSBitMap* bitmap = &collector->_markBitMap; 12.100 + st->print_cr("Marking Bits: (CMSBitMap*) " PTR_FORMAT, bitmap); 12.101 + bitmap->print_on_error(st, " Bits: "); 12.102 + 12.103 + st->cr(); 12.104 + 12.105 + CMSBitMap* mut_bitmap = &collector->_modUnionTable; 12.106 + st->print_cr("Mod Union Table: (CMSBitMap*) " PTR_FORMAT, mut_bitmap); 12.107 + mut_bitmap->print_on_error(st, " Bits: "); 12.108 + } 12.109 +} 12.110 + 12.111 //////////////////////////////////////////////////////// 12.112 // CMS Verification Support 12.113 //////////////////////////////////////////////////////// 12.114 @@ -3300,6 +3352,26 @@ 12.115 } 12.116 12.117 12.118 +void ConcurrentMarkSweepGeneration::shrink_by(size_t bytes) { 12.119 + assert_locked_or_safepoint(ExpandHeap_lock); 12.120 + // Shrink committed space 12.121 + _virtual_space.shrink_by(bytes); 12.122 + // Shrink space; this also shrinks the space's BOT 12.123 + _cmsSpace->set_end((HeapWord*) _virtual_space.high()); 12.124 + size_t new_word_size = heap_word_size(_cmsSpace->capacity()); 12.125 + // Shrink the shared block offset array 12.126 + _bts->resize(new_word_size); 12.127 + MemRegion mr(_cmsSpace->bottom(), new_word_size); 12.128 + // Shrink the card table 12.129 + Universe::heap()->barrier_set()->resize_covered_region(mr); 12.130 + 12.131 + if (Verbose && PrintGC) { 12.132 + size_t new_mem_size = _virtual_space.committed_size(); 12.133 + size_t old_mem_size = new_mem_size + bytes; 12.134 + gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K", 12.135 + name(), old_mem_size/K, new_mem_size/K); 12.136 + } 12.137 +} 12.138 12.139 void ConcurrentMarkSweepGeneration::shrink(size_t bytes) { 12.140 assert_locked_or_safepoint(Heap_lock); 12.141 @@ -3351,7 +3423,7 @@ 12.142 return success; 12.143 } 12.144 12.145 -void ConcurrentMarkSweepGeneration::shrink_by(size_t bytes) { 12.146 +void ConcurrentMarkSweepGeneration::shrink_free_list_by(size_t bytes) { 12.147 assert_locked_or_safepoint(Heap_lock); 12.148 assert_lock_strong(freelistLock()); 12.149 // XXX Fix when compaction is implemented. 12.150 @@ -6476,6 +6548,10 @@ 12.151 } 12.152 } 12.153 12.154 +void CMSBitMap::print_on_error(outputStream* st, const char* prefix) const { 12.155 + _bm.print_on_error(st, prefix); 12.156 +} 12.157 + 12.158 #ifndef PRODUCT 12.159 void CMSBitMap::assert_locked() const { 12.160 CMSLockVerifier::assert_locked(lock()); 12.161 @@ -9074,51 +9150,6 @@ 12.162 } 12.163 } 12.164 12.165 -// The desired expansion delta is computed so that: 12.166 -// . desired free percentage or greater is used 12.167 -void ASConcurrentMarkSweepGeneration::compute_new_size() { 12.168 - assert_locked_or_safepoint(Heap_lock); 12.169 - 12.170 - GenCollectedHeap* gch = (GenCollectedHeap*) GenCollectedHeap::heap(); 12.171 - 12.172 - // If incremental collection failed, we just want to expand 12.173 - // to the limit. 12.174 - if (incremental_collection_failed()) { 12.175 - clear_incremental_collection_failed(); 12.176 - grow_to_reserved(); 12.177 - return; 12.178 - } 12.179 - 12.180 - assert(UseAdaptiveSizePolicy, "Should be using adaptive sizing"); 12.181 - 12.182 - assert(gch->kind() == CollectedHeap::GenCollectedHeap, 12.183 - "Wrong type of heap"); 12.184 - int prev_level = level() - 1; 12.185 - assert(prev_level >= 0, "The cms generation is the lowest generation"); 12.186 - Generation* prev_gen = gch->get_gen(prev_level); 12.187 - assert(prev_gen->kind() == Generation::ASParNew, 12.188 - "Wrong type of young generation"); 12.189 - ParNewGeneration* younger_gen = (ParNewGeneration*) prev_gen; 12.190 - size_t cur_eden = younger_gen->eden()->capacity(); 12.191 - CMSAdaptiveSizePolicy* size_policy = cms_size_policy(); 12.192 - size_t cur_promo = free(); 12.193 - size_policy->compute_tenured_generation_free_space(cur_promo, 12.194 - max_available(), 12.195 - cur_eden); 12.196 - resize(cur_promo, size_policy->promo_size()); 12.197 - 12.198 - // Record the new size of the space in the cms generation 12.199 - // that is available for promotions. This is temporary. 12.200 - // It should be the desired promo size. 12.201 - size_policy->avg_cms_promo()->sample(free()); 12.202 - size_policy->avg_old_live()->sample(used()); 12.203 - 12.204 - if (UsePerfData) { 12.205 - CMSGCAdaptivePolicyCounters* counters = gc_adaptive_policy_counters(); 12.206 - counters->update_cms_capacity_counter(capacity()); 12.207 - } 12.208 -} 12.209 - 12.210 void ASConcurrentMarkSweepGeneration::shrink_by(size_t desired_bytes) { 12.211 assert_locked_or_safepoint(Heap_lock); 12.212 assert_lock_strong(freelistLock());
13.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Fri Apr 12 10:14:42 2013 +0100 13.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Wed Apr 17 10:12:42 2013 -0700 13.3 @@ -60,6 +60,7 @@ 13.4 class FreeChunk; 13.5 class PromotionInfo; 13.6 class ScanMarkedObjectsAgainCarefullyClosure; 13.7 +class TenuredGeneration; 13.8 13.9 // A generic CMS bit map. It's the basis for both the CMS marking bit map 13.10 // as well as for the mod union table (in each case only a subset of the 13.11 @@ -150,6 +151,8 @@ 13.12 size_t heapWordToOffset(HeapWord* addr) const; 13.13 size_t heapWordDiffToOffsetDiff(size_t diff) const; 13.14 13.15 + void print_on_error(outputStream* st, const char* prefix) const; 13.16 + 13.17 // debugging 13.18 // is this address range covered by the bit-map? 13.19 NOT_PRODUCT( 13.20 @@ -810,9 +813,6 @@ 13.21 // used regions of each generation to limit the extent of sweep 13.22 void save_sweep_limits(); 13.23 13.24 - // Resize the generations included in the collector. 13.25 - void compute_new_size(); 13.26 - 13.27 // A work method used by foreground collection to determine 13.28 // what type of collection (compacting or not, continuing or fresh) 13.29 // it should do. 13.30 @@ -909,6 +909,9 @@ 13.31 void releaseFreelistLocks() const; 13.32 bool haveFreelistLocks() const; 13.33 13.34 + // Adjust size of underlying generation 13.35 + void compute_new_size(); 13.36 + 13.37 // GC prologue and epilogue 13.38 void gc_prologue(bool full); 13.39 void gc_epilogue(bool full); 13.40 @@ -983,6 +986,8 @@ 13.41 CMSAdaptiveSizePolicy* size_policy(); 13.42 CMSGCAdaptivePolicyCounters* gc_adaptive_policy_counters(); 13.43 13.44 + static void print_on_error(outputStream* st); 13.45 + 13.46 // debugging 13.47 void verify(); 13.48 bool verify_after_remark(); 13.49 @@ -1082,7 +1087,7 @@ 13.50 13.51 protected: 13.52 // Shrink generation by specified size (returns false if unable to shrink) 13.53 - virtual void shrink_by(size_t bytes); 13.54 + void shrink_free_list_by(size_t bytes); 13.55 13.56 // Update statistics for GC 13.57 virtual void update_gc_stats(int level, bool full); 13.58 @@ -1233,6 +1238,7 @@ 13.59 CMSExpansionCause::Cause cause); 13.60 virtual bool expand(size_t bytes, size_t expand_bytes); 13.61 void shrink(size_t bytes); 13.62 + void shrink_by(size_t bytes); 13.63 HeapWord* expand_and_par_lab_allocate(CMSParGCThreadState* ps, size_t word_sz); 13.64 bool expand_and_ensure_spooling_space(PromotionInfo* promo); 13.65 13.66 @@ -1293,7 +1299,13 @@ 13.67 bool must_be_youngest() const { return false; } 13.68 bool must_be_oldest() const { return true; } 13.69 13.70 - void compute_new_size(); 13.71 + // Resize the generation after a compacting GC. The 13.72 + // generation can be treated as a contiguous space 13.73 + // after the compaction. 13.74 + virtual void compute_new_size(); 13.75 + // Resize the generation after a non-compacting 13.76 + // collection. 13.77 + void compute_new_size_free_list(); 13.78 13.79 CollectionTypes debug_collection_type() { return _debug_collection_type; } 13.80 void rotate_debug_collection_type(); 13.81 @@ -1315,7 +1327,6 @@ 13.82 virtual void shrink_by(size_t bytes); 13.83 13.84 public: 13.85 - virtual void compute_new_size(); 13.86 ASConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size, 13.87 int level, CardTableRS* ct, 13.88 bool use_adaptive_freelists,
14.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri Apr 12 10:14:42 2013 +0100 14.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Apr 17 10:12:42 2013 -0700 14.3 @@ -101,6 +101,10 @@ 14.4 } 14.5 #endif 14.6 14.7 +void CMBitMapRO::print_on_error(outputStream* st, const char* prefix) const { 14.8 + _bm.print_on_error(st, prefix); 14.9 +} 14.10 + 14.11 bool CMBitMap::allocate(ReservedSpace heap_rs) { 14.12 _bmStartWord = (HeapWord*)(heap_rs.base()); 14.13 _bmWordSize = heap_rs.size()/HeapWordSize; // heap_rs.size() is in bytes 14.14 @@ -3277,6 +3281,13 @@ 14.15 } 14.16 } 14.17 14.18 +void ConcurrentMark::print_on_error(outputStream* st) const { 14.19 + st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT, 14.20 + _prevMarkBitMap, _nextMarkBitMap); 14.21 + _prevMarkBitMap->print_on_error(st, " Prev Bits: "); 14.22 + _nextMarkBitMap->print_on_error(st, " Next Bits: "); 14.23 +} 14.24 + 14.25 // We take a break if someone is trying to stop the world. 14.26 bool ConcurrentMark::do_yield_check(uint worker_id) { 14.27 if (should_yield()) {
15.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp Fri Apr 12 10:14:42 2013 +0100 15.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp Wed Apr 17 10:12:42 2013 -0700 15.3 @@ -113,6 +113,8 @@ 15.4 return res; 15.5 } 15.6 15.7 + void print_on_error(outputStream* st, const char* prefix) const; 15.8 + 15.9 // debugging 15.10 NOT_PRODUCT(bool covers(ReservedSpace rs) const;) 15.11 }; 15.12 @@ -829,6 +831,8 @@ 15.13 15.14 void print_worker_threads_on(outputStream* st) const; 15.15 15.16 + void print_on_error(outputStream* st) const; 15.17 + 15.18 // The following indicate whether a given verbose level has been 15.19 // set. Notice that anything above stats is conditional to 15.20 // _MARKING_VERBOSE_ having been set to 1
16.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Apr 12 10:14:42 2013 +0100 16.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Apr 17 10:12:42 2013 -0700 16.3 @@ -3427,6 +3427,15 @@ 16.4 heap_region_iterate(&blk); 16.5 } 16.6 16.7 +void G1CollectedHeap::print_on_error(outputStream* st) const { 16.8 + this->CollectedHeap::print_on_error(st); 16.9 + 16.10 + if (_cm != NULL) { 16.11 + st->cr(); 16.12 + _cm->print_on_error(st); 16.13 + } 16.14 +} 16.15 + 16.16 void G1CollectedHeap::print_gc_threads_on(outputStream* st) const { 16.17 if (G1CollectedHeap::use_parallel_gc_threads()) { 16.18 workers()->print_worker_threads_on(st);
17.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Apr 12 10:14:42 2013 +0100 17.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Wed Apr 17 10:12:42 2013 -0700 17.3 @@ -1575,6 +1575,7 @@ 17.4 virtual void verify(bool silent); 17.5 virtual void print_on(outputStream* st) const; 17.6 virtual void print_extended_on(outputStream* st) const; 17.7 + virtual void print_on_error(outputStream* st) const; 17.8 17.9 virtual void print_gc_threads_on(outputStream* st) const; 17.10 virtual void gc_threads_do(ThreadClosure* tc) const;
18.1 --- a/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp Fri Apr 12 10:14:42 2013 +0100 18.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp Wed Apr 17 10:12:42 2013 -0700 18.3 @@ -173,6 +173,12 @@ 18.4 void reset_counters(); 18.5 #endif // #ifndef PRODUCT 18.6 18.7 + void print_on_error(outputStream* st) const { 18.8 + st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, this); 18.9 + _beg_bits.print_on_error(st, " Begin Bits: "); 18.10 + _end_bits.print_on_error(st, " End Bits: "); 18.11 + } 18.12 + 18.13 #ifdef ASSERT 18.14 void verify_clear() const; 18.15 inline void verify_bit(idx_t bit) const;
19.1 --- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Fri Apr 12 10:14:42 2013 +0100 19.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Wed Apr 17 10:12:42 2013 -0700 19.3 @@ -648,6 +648,15 @@ 19.4 MetaspaceAux::print_on(st); 19.5 } 19.6 19.7 +void ParallelScavengeHeap::print_on_error(outputStream* st) const { 19.8 + this->CollectedHeap::print_on_error(st); 19.9 + 19.10 + if (UseParallelOldGC) { 19.11 + st->cr(); 19.12 + PSParallelCompact::print_on_error(st); 19.13 + } 19.14 +} 19.15 + 19.16 void ParallelScavengeHeap::gc_threads_do(ThreadClosure* tc) const { 19.17 PSScavenge::gc_task_manager()->threads_do(tc); 19.18 }
20.1 --- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp Fri Apr 12 10:14:42 2013 +0100 20.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp Wed Apr 17 10:12:42 2013 -0700 20.3 @@ -220,6 +220,7 @@ 20.4 20.5 void prepare_for_verify(); 20.6 virtual void print_on(outputStream* st) const; 20.7 + virtual void print_on_error(outputStream* st) const; 20.8 virtual void print_gc_threads_on(outputStream* st) const; 20.9 virtual void gc_threads_do(ThreadClosure* tc) const; 20.10 virtual void print_tracing_info() const;
21.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri Apr 12 10:14:42 2013 +0100 21.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Wed Apr 17 10:12:42 2013 -0700 21.3 @@ -165,6 +165,10 @@ 21.4 #endif // #ifdef ASSERT 21.5 21.6 21.7 +void PSParallelCompact::print_on_error(outputStream* st) { 21.8 + _mark_bitmap.print_on_error(st); 21.9 +} 21.10 + 21.11 #ifndef PRODUCT 21.12 const char* PSParallelCompact::space_names[] = { 21.13 "old ", "eden", "from", "to "
22.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp Fri Apr 12 10:14:42 2013 +0100 22.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp Wed Apr 17 10:12:42 2013 -0700 22.3 @@ -1163,6 +1163,8 @@ 22.4 // Time since last full gc (in milliseconds). 22.5 static jlong millis_since_last_gc(); 22.6 22.7 + static void print_on_error(outputStream* st); 22.8 + 22.9 #ifndef PRODUCT 22.10 // Debugging support. 22.11 static const char* space_names[last_space_id];
23.1 --- a/src/share/vm/gc_interface/collectedHeap.hpp Fri Apr 12 10:14:42 2013 +0100 23.2 +++ b/src/share/vm/gc_interface/collectedHeap.hpp Wed Apr 17 10:12:42 2013 -0700 23.3 @@ -567,6 +567,14 @@ 23.4 print_on(st); 23.5 } 23.6 23.7 + virtual void print_on_error(outputStream* st) const { 23.8 + st->print_cr("Heap:"); 23.9 + print_extended_on(st); 23.10 + st->cr(); 23.11 + 23.12 + _barrier_set->print_on(st); 23.13 + } 23.14 + 23.15 // Print all GC threads (other than the VM thread) 23.16 // used by this heap. 23.17 virtual void print_gc_threads_on(outputStream* st) const = 0;
24.1 --- a/src/share/vm/interpreter/linkResolver.cpp Fri Apr 12 10:14:42 2013 +0100 24.2 +++ b/src/share/vm/interpreter/linkResolver.cpp Wed Apr 17 10:12:42 2013 -0700 24.3 @@ -217,6 +217,7 @@ 24.4 TRAPS) { 24.5 vmIntrinsics::ID iid = MethodHandles::signature_polymorphic_name_id(name); 24.6 if (TraceMethodHandles) { 24.7 + ResourceMark rm(THREAD); 24.8 tty->print_cr("lookup_polymorphic_method iid=%s %s.%s%s", 24.9 vmIntrinsics::name_at(iid), klass->external_name(), 24.10 name->as_C_string(), full_signature->as_C_string()); 24.11 @@ -231,6 +232,7 @@ 24.12 TempNewSymbol basic_signature = 24.13 MethodHandles::lookup_basic_type_signature(full_signature, keep_last_arg, CHECK); 24.14 if (TraceMethodHandles) { 24.15 + ResourceMark rm(THREAD); 24.16 tty->print_cr("lookup_polymorphic_method %s %s => basic %s", 24.17 name->as_C_string(), 24.18 full_signature->as_C_string(), 24.19 @@ -283,6 +285,8 @@ 24.20 } 24.21 if (result.not_null()) { 24.22 #ifdef ASSERT 24.23 + ResourceMark rm(THREAD); 24.24 + 24.25 TempNewSymbol basic_signature = 24.26 MethodHandles::lookup_basic_type_signature(full_signature, CHECK); 24.27 int actual_size_of_params = result->size_of_parameters(); 24.28 @@ -1222,8 +1226,10 @@ 24.29 Symbol* method_signature = NULL; 24.30 KlassHandle current_klass; 24.31 resolve_pool(resolved_klass, method_name, method_signature, current_klass, pool, index, CHECK); 24.32 - if (TraceMethodHandles) 24.33 + if (TraceMethodHandles) { 24.34 + ResourceMark rm(THREAD); 24.35 tty->print_cr("resolve_invokehandle %s %s", method_name->as_C_string(), method_signature->as_C_string()); 24.36 + } 24.37 resolve_handle_call(result, resolved_klass, method_name, method_signature, current_klass, CHECK); 24.38 } 24.39
25.1 --- a/src/share/vm/memory/allocation.hpp Fri Apr 12 10:14:42 2013 +0100 25.2 +++ b/src/share/vm/memory/allocation.hpp Wed Apr 17 10:12:42 2013 -0700 25.3 @@ -611,4 +611,23 @@ 25.4 void check() PRODUCT_RETURN; 25.5 }; 25.6 25.7 +// Helper class to allocate arrays that may become large. 25.8 +// Uses the OS malloc for allocations smaller than ArrayAllocatorMallocLimit 25.9 +// and uses mapped memory for larger allocations. 25.10 +// Most OS mallocs do something similar but Solaris malloc does not revert 25.11 +// to mapped memory for large allocations. By default ArrayAllocatorMallocLimit 25.12 +// is set so that we always use malloc except for Solaris where we set the 25.13 +// limit to get mapped memory. 25.14 +template <class E, MEMFLAGS F> 25.15 +class ArrayAllocator : StackObj { 25.16 + char* _addr; 25.17 + bool _use_malloc; 25.18 + size_t _size; 25.19 + public: 25.20 + ArrayAllocator() : _addr(NULL), _use_malloc(false), _size(0) { } 25.21 + ~ArrayAllocator() { free(); } 25.22 + E* allocate(size_t length); 25.23 + void free(); 25.24 +}; 25.25 + 25.26 #endif // SHARE_VM_MEMORY_ALLOCATION_HPP
26.1 --- a/src/share/vm/memory/allocation.inline.hpp Fri Apr 12 10:14:42 2013 +0100 26.2 +++ b/src/share/vm/memory/allocation.inline.hpp Wed Apr 17 10:12:42 2013 -0700 26.3 @@ -108,5 +108,49 @@ 26.4 FreeHeap(p, F); 26.5 } 26.6 26.7 +template <class E, MEMFLAGS F> 26.8 +E* ArrayAllocator<E, F>::allocate(size_t length) { 26.9 + assert(_addr == NULL, "Already in use"); 26.10 + 26.11 + _size = sizeof(E) * length; 26.12 + _use_malloc = _size < ArrayAllocatorMallocLimit; 26.13 + 26.14 + if (_use_malloc) { 26.15 + _addr = AllocateHeap(_size, F); 26.16 + if (_addr == NULL && _size >= (size_t)os::vm_allocation_granularity()) { 26.17 + // malloc failed let's try with mmap instead 26.18 + _use_malloc = false; 26.19 + } else { 26.20 + return (E*)_addr; 26.21 + } 26.22 + } 26.23 + 26.24 + int alignment = os::vm_allocation_granularity(); 26.25 + _size = align_size_up(_size, alignment); 26.26 + 26.27 + _addr = os::reserve_memory(_size, NULL, alignment); 26.28 + if (_addr == NULL) { 26.29 + vm_exit_out_of_memory(_size, "Allocator (reserve)"); 26.30 + } 26.31 + 26.32 + bool success = os::commit_memory(_addr, _size, false /* executable */); 26.33 + if (!success) { 26.34 + vm_exit_out_of_memory(_size, "Allocator (commit)"); 26.35 + } 26.36 + 26.37 + return (E*)_addr; 26.38 +} 26.39 + 26.40 +template<class E, MEMFLAGS F> 26.41 +void ArrayAllocator<E, F>::free() { 26.42 + if (_addr != NULL) { 26.43 + if (_use_malloc) { 26.44 + FreeHeap(_addr, F); 26.45 + } else { 26.46 + os::release_memory(_addr, _size); 26.47 + } 26.48 + _addr = NULL; 26.49 + } 26.50 +} 26.51 26.52 #endif // SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP
27.1 --- a/src/share/vm/memory/genCollectedHeap.cpp Fri Apr 12 10:14:42 2013 +0100 27.2 +++ b/src/share/vm/memory/genCollectedHeap.cpp Wed Apr 17 10:12:42 2013 -0700 27.3 @@ -819,12 +819,13 @@ 27.4 // Returns "TRUE" iff "p" points into the committed areas of the heap. 27.5 bool GenCollectedHeap::is_in(const void* p) const { 27.6 #ifndef ASSERT 27.7 - guarantee(VerifyBeforeGC || 27.8 - VerifyDuringGC || 27.9 - VerifyBeforeExit || 27.10 - PrintAssembly || 27.11 - tty->count() != 0 || // already printing 27.12 - VerifyAfterGC || 27.13 + guarantee(VerifyBeforeGC || 27.14 + VerifyDuringGC || 27.15 + VerifyBeforeExit || 27.16 + VerifyDuringStartup || 27.17 + PrintAssembly || 27.18 + tty->count() != 0 || // already printing 27.19 + VerifyAfterGC || 27.20 VMError::fatal_error_in_progress(), "too expensive"); 27.21 27.22 #endif 27.23 @@ -1132,6 +1133,17 @@ 27.24 #endif // INCLUDE_ALL_GCS 27.25 } 27.26 27.27 +void GenCollectedHeap::print_on_error(outputStream* st) const { 27.28 + this->CollectedHeap::print_on_error(st); 27.29 + 27.30 +#if INCLUDE_ALL_GCS 27.31 + if (UseConcMarkSweepGC) { 27.32 + st->cr(); 27.33 + CMSCollector::print_on_error(st); 27.34 + } 27.35 +#endif // INCLUDE_ALL_GCS 27.36 +} 27.37 + 27.38 void GenCollectedHeap::print_tracing_info() const { 27.39 if (TraceGen0Time) { 27.40 get_gen(0)->print_summary_info();
28.1 --- a/src/share/vm/memory/genCollectedHeap.hpp Fri Apr 12 10:14:42 2013 +0100 28.2 +++ b/src/share/vm/memory/genCollectedHeap.hpp Wed Apr 17 10:12:42 2013 -0700 28.3 @@ -344,6 +344,7 @@ 28.4 virtual void print_gc_threads_on(outputStream* st) const; 28.5 virtual void gc_threads_do(ThreadClosure* tc) const; 28.6 virtual void print_tracing_info() const; 28.7 + virtual void print_on_error(outputStream* st) const; 28.8 28.9 // PrintGC, PrintGCDetails support 28.10 void print_heap_change(size_t prev_used) const;
29.1 --- a/src/share/vm/memory/generation.cpp Fri Apr 12 10:14:42 2013 +0100 29.2 +++ b/src/share/vm/memory/generation.cpp Wed Apr 17 10:12:42 2013 -0700 29.3 @@ -382,7 +382,9 @@ 29.4 CardGeneration::CardGeneration(ReservedSpace rs, size_t initial_byte_size, 29.5 int level, 29.6 GenRemSet* remset) : 29.7 - Generation(rs, initial_byte_size, level), _rs(remset) 29.8 + Generation(rs, initial_byte_size, level), _rs(remset), 29.9 + _shrink_factor(0), _min_heap_delta_bytes(), _capacity_at_prologue(), 29.10 + _used_at_prologue() 29.11 { 29.12 HeapWord* start = (HeapWord*)rs.base(); 29.13 size_t reserved_byte_size = rs.size(); 29.14 @@ -406,6 +408,9 @@ 29.15 // the end if we try. 29.16 guarantee(_rs->is_aligned(reserved_mr.end()), "generation must be card aligned"); 29.17 } 29.18 + _min_heap_delta_bytes = MinHeapDeltaBytes; 29.19 + _capacity_at_prologue = initial_byte_size; 29.20 + _used_at_prologue = 0; 29.21 } 29.22 29.23 bool CardGeneration::expand(size_t bytes, size_t expand_bytes) { 29.24 @@ -457,6 +462,160 @@ 29.25 } 29.26 29.27 29.28 +void CardGeneration::compute_new_size() { 29.29 + assert(_shrink_factor <= 100, "invalid shrink factor"); 29.30 + size_t current_shrink_factor = _shrink_factor; 29.31 + _shrink_factor = 0; 29.32 + 29.33 + // We don't have floating point command-line arguments 29.34 + // Note: argument processing ensures that MinHeapFreeRatio < 100. 29.35 + const double minimum_free_percentage = MinHeapFreeRatio / 100.0; 29.36 + const double maximum_used_percentage = 1.0 - minimum_free_percentage; 29.37 + 29.38 + // Compute some numbers about the state of the heap. 29.39 + const size_t used_after_gc = used(); 29.40 + const size_t capacity_after_gc = capacity(); 29.41 + 29.42 + const double min_tmp = used_after_gc / maximum_used_percentage; 29.43 + size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx)); 29.44 + // Don't shrink less than the initial generation size 29.45 + minimum_desired_capacity = MAX2(minimum_desired_capacity, 29.46 + spec()->init_size()); 29.47 + assert(used_after_gc <= minimum_desired_capacity, "sanity check"); 29.48 + 29.49 + if (PrintGC && Verbose) { 29.50 + const size_t free_after_gc = free(); 29.51 + const double free_percentage = ((double)free_after_gc) / capacity_after_gc; 29.52 + gclog_or_tty->print_cr("TenuredGeneration::compute_new_size: "); 29.53 + gclog_or_tty->print_cr(" " 29.54 + " minimum_free_percentage: %6.2f" 29.55 + " maximum_used_percentage: %6.2f", 29.56 + minimum_free_percentage, 29.57 + maximum_used_percentage); 29.58 + gclog_or_tty->print_cr(" " 29.59 + " free_after_gc : %6.1fK" 29.60 + " used_after_gc : %6.1fK" 29.61 + " capacity_after_gc : %6.1fK", 29.62 + free_after_gc / (double) K, 29.63 + used_after_gc / (double) K, 29.64 + capacity_after_gc / (double) K); 29.65 + gclog_or_tty->print_cr(" " 29.66 + " free_percentage: %6.2f", 29.67 + free_percentage); 29.68 + } 29.69 + 29.70 + if (capacity_after_gc < minimum_desired_capacity) { 29.71 + // If we have less free space than we want then expand 29.72 + size_t expand_bytes = minimum_desired_capacity - capacity_after_gc; 29.73 + // Don't expand unless it's significant 29.74 + if (expand_bytes >= _min_heap_delta_bytes) { 29.75 + expand(expand_bytes, 0); // safe if expansion fails 29.76 + } 29.77 + if (PrintGC && Verbose) { 29.78 + gclog_or_tty->print_cr(" expanding:" 29.79 + " minimum_desired_capacity: %6.1fK" 29.80 + " expand_bytes: %6.1fK" 29.81 + " _min_heap_delta_bytes: %6.1fK", 29.82 + minimum_desired_capacity / (double) K, 29.83 + expand_bytes / (double) K, 29.84 + _min_heap_delta_bytes / (double) K); 29.85 + } 29.86 + return; 29.87 + } 29.88 + 29.89 + // No expansion, now see if we want to shrink 29.90 + size_t shrink_bytes = 0; 29.91 + // We would never want to shrink more than this 29.92 + size_t max_shrink_bytes = capacity_after_gc - minimum_desired_capacity; 29.93 + 29.94 + if (MaxHeapFreeRatio < 100) { 29.95 + const double maximum_free_percentage = MaxHeapFreeRatio / 100.0; 29.96 + const double minimum_used_percentage = 1.0 - maximum_free_percentage; 29.97 + const double max_tmp = used_after_gc / minimum_used_percentage; 29.98 + size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx)); 29.99 + maximum_desired_capacity = MAX2(maximum_desired_capacity, 29.100 + spec()->init_size()); 29.101 + if (PrintGC && Verbose) { 29.102 + gclog_or_tty->print_cr(" " 29.103 + " maximum_free_percentage: %6.2f" 29.104 + " minimum_used_percentage: %6.2f", 29.105 + maximum_free_percentage, 29.106 + minimum_used_percentage); 29.107 + gclog_or_tty->print_cr(" " 29.108 + " _capacity_at_prologue: %6.1fK" 29.109 + " minimum_desired_capacity: %6.1fK" 29.110 + " maximum_desired_capacity: %6.1fK", 29.111 + _capacity_at_prologue / (double) K, 29.112 + minimum_desired_capacity / (double) K, 29.113 + maximum_desired_capacity / (double) K); 29.114 + } 29.115 + assert(minimum_desired_capacity <= maximum_desired_capacity, 29.116 + "sanity check"); 29.117 + 29.118 + if (capacity_after_gc > maximum_desired_capacity) { 29.119 + // Capacity too large, compute shrinking size 29.120 + shrink_bytes = capacity_after_gc - maximum_desired_capacity; 29.121 + // We don't want shrink all the way back to initSize if people call 29.122 + // System.gc(), because some programs do that between "phases" and then 29.123 + // we'd just have to grow the heap up again for the next phase. So we 29.124 + // damp the shrinking: 0% on the first call, 10% on the second call, 40% 29.125 + // on the third call, and 100% by the fourth call. But if we recompute 29.126 + // size without shrinking, it goes back to 0%. 29.127 + shrink_bytes = shrink_bytes / 100 * current_shrink_factor; 29.128 + assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size"); 29.129 + if (current_shrink_factor == 0) { 29.130 + _shrink_factor = 10; 29.131 + } else { 29.132 + _shrink_factor = MIN2(current_shrink_factor * 4, (size_t) 100); 29.133 + } 29.134 + if (PrintGC && Verbose) { 29.135 + gclog_or_tty->print_cr(" " 29.136 + " shrinking:" 29.137 + " initSize: %.1fK" 29.138 + " maximum_desired_capacity: %.1fK", 29.139 + spec()->init_size() / (double) K, 29.140 + maximum_desired_capacity / (double) K); 29.141 + gclog_or_tty->print_cr(" " 29.142 + " shrink_bytes: %.1fK" 29.143 + " current_shrink_factor: %d" 29.144 + " new shrink factor: %d" 29.145 + " _min_heap_delta_bytes: %.1fK", 29.146 + shrink_bytes / (double) K, 29.147 + current_shrink_factor, 29.148 + _shrink_factor, 29.149 + _min_heap_delta_bytes / (double) K); 29.150 + } 29.151 + } 29.152 + } 29.153 + 29.154 + if (capacity_after_gc > _capacity_at_prologue) { 29.155 + // We might have expanded for promotions, in which case we might want to 29.156 + // take back that expansion if there's room after GC. That keeps us from 29.157 + // stretching the heap with promotions when there's plenty of room. 29.158 + size_t expansion_for_promotion = capacity_after_gc - _capacity_at_prologue; 29.159 + expansion_for_promotion = MIN2(expansion_for_promotion, max_shrink_bytes); 29.160 + // We have two shrinking computations, take the largest 29.161 + shrink_bytes = MAX2(shrink_bytes, expansion_for_promotion); 29.162 + assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size"); 29.163 + if (PrintGC && Verbose) { 29.164 + gclog_or_tty->print_cr(" " 29.165 + " aggressive shrinking:" 29.166 + " _capacity_at_prologue: %.1fK" 29.167 + " capacity_after_gc: %.1fK" 29.168 + " expansion_for_promotion: %.1fK" 29.169 + " shrink_bytes: %.1fK", 29.170 + capacity_after_gc / (double) K, 29.171 + _capacity_at_prologue / (double) K, 29.172 + expansion_for_promotion / (double) K, 29.173 + shrink_bytes / (double) K); 29.174 + } 29.175 + } 29.176 + // Don't shrink unless it's significant 29.177 + if (shrink_bytes >= _min_heap_delta_bytes) { 29.178 + shrink(shrink_bytes); 29.179 + } 29.180 +} 29.181 + 29.182 // Currently nothing to do. 29.183 void CardGeneration::prepare_for_verify() {} 29.184
30.1 --- a/src/share/vm/memory/generation.hpp Fri Apr 12 10:14:42 2013 +0100 30.2 +++ b/src/share/vm/memory/generation.hpp Wed Apr 17 10:12:42 2013 -0700 30.3 @@ -634,6 +634,17 @@ 30.4 // This is local to this generation. 30.5 BlockOffsetSharedArray* _bts; 30.6 30.7 + // current shrinking effect: this damps shrinking when the heap gets empty. 30.8 + size_t _shrink_factor; 30.9 + 30.10 + size_t _min_heap_delta_bytes; // Minimum amount to expand. 30.11 + 30.12 + // Some statistics from before gc started. 30.13 + // These are gathered in the gc_prologue (and should_collect) 30.14 + // to control growing/shrinking policy in spite of promotions. 30.15 + size_t _capacity_at_prologue; 30.16 + size_t _used_at_prologue; 30.17 + 30.18 CardGeneration(ReservedSpace rs, size_t initial_byte_size, int level, 30.19 GenRemSet* remset); 30.20 30.21 @@ -644,6 +655,11 @@ 30.22 // necessarily the full "bytes") was done. 30.23 virtual bool expand(size_t bytes, size_t expand_bytes); 30.24 30.25 + // Shrink generation with specified size (returns false if unable to shrink) 30.26 + virtual void shrink(size_t bytes) = 0; 30.27 + 30.28 + virtual void compute_new_size(); 30.29 + 30.30 virtual void clear_remembered_set(); 30.31 30.32 virtual void invalidate_remembered_set(); 30.33 @@ -667,7 +683,6 @@ 30.34 friend class VM_PopulateDumpSharedSpace; 30.35 30.36 protected: 30.37 - size_t _min_heap_delta_bytes; // Minimum amount to expand. 30.38 ContiguousSpace* _the_space; // actual space holding objects 30.39 WaterMark _last_gc; // watermark between objects allocated before 30.40 // and after last GC. 30.41 @@ -688,11 +703,10 @@ 30.42 30.43 public: 30.44 OneContigSpaceCardGeneration(ReservedSpace rs, size_t initial_byte_size, 30.45 - size_t min_heap_delta_bytes, 30.46 int level, GenRemSet* remset, 30.47 ContiguousSpace* space) : 30.48 CardGeneration(rs, initial_byte_size, level, remset), 30.49 - _the_space(space), _min_heap_delta_bytes(min_heap_delta_bytes) 30.50 + _the_space(space) 30.51 {} 30.52 30.53 inline bool is_in(const void* p) const;
31.1 --- a/src/share/vm/memory/tenuredGeneration.cpp Fri Apr 12 10:14:42 2013 +0100 31.2 +++ b/src/share/vm/memory/tenuredGeneration.cpp Wed Apr 17 10:12:42 2013 -0700 31.3 @@ -39,7 +39,7 @@ 31.4 size_t initial_byte_size, int level, 31.5 GenRemSet* remset) : 31.6 OneContigSpaceCardGeneration(rs, initial_byte_size, 31.7 - MinHeapDeltaBytes, level, remset, NULL) 31.8 + level, remset, NULL) 31.9 { 31.10 HeapWord* bottom = (HeapWord*) _virtual_space.low(); 31.11 HeapWord* end = (HeapWord*) _virtual_space.high(); 31.12 @@ -86,162 +86,6 @@ 31.13 return "tenured generation"; 31.14 } 31.15 31.16 -void TenuredGeneration::compute_new_size() { 31.17 - assert(_shrink_factor <= 100, "invalid shrink factor"); 31.18 - size_t current_shrink_factor = _shrink_factor; 31.19 - _shrink_factor = 0; 31.20 - 31.21 - // We don't have floating point command-line arguments 31.22 - // Note: argument processing ensures that MinHeapFreeRatio < 100. 31.23 - const double minimum_free_percentage = MinHeapFreeRatio / 100.0; 31.24 - const double maximum_used_percentage = 1.0 - minimum_free_percentage; 31.25 - 31.26 - // Compute some numbers about the state of the heap. 31.27 - const size_t used_after_gc = used(); 31.28 - const size_t capacity_after_gc = capacity(); 31.29 - 31.30 - const double min_tmp = used_after_gc / maximum_used_percentage; 31.31 - size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx)); 31.32 - // Don't shrink less than the initial generation size 31.33 - minimum_desired_capacity = MAX2(minimum_desired_capacity, 31.34 - spec()->init_size()); 31.35 - assert(used_after_gc <= minimum_desired_capacity, "sanity check"); 31.36 - 31.37 - if (PrintGC && Verbose) { 31.38 - const size_t free_after_gc = free(); 31.39 - const double free_percentage = ((double)free_after_gc) / capacity_after_gc; 31.40 - gclog_or_tty->print_cr("TenuredGeneration::compute_new_size: "); 31.41 - gclog_or_tty->print_cr(" " 31.42 - " minimum_free_percentage: %6.2f" 31.43 - " maximum_used_percentage: %6.2f", 31.44 - minimum_free_percentage, 31.45 - maximum_used_percentage); 31.46 - gclog_or_tty->print_cr(" " 31.47 - " free_after_gc : %6.1fK" 31.48 - " used_after_gc : %6.1fK" 31.49 - " capacity_after_gc : %6.1fK", 31.50 - free_after_gc / (double) K, 31.51 - used_after_gc / (double) K, 31.52 - capacity_after_gc / (double) K); 31.53 - gclog_or_tty->print_cr(" " 31.54 - " free_percentage: %6.2f", 31.55 - free_percentage); 31.56 - } 31.57 - 31.58 - if (capacity_after_gc < minimum_desired_capacity) { 31.59 - // If we have less free space than we want then expand 31.60 - size_t expand_bytes = minimum_desired_capacity - capacity_after_gc; 31.61 - // Don't expand unless it's significant 31.62 - if (expand_bytes >= _min_heap_delta_bytes) { 31.63 - expand(expand_bytes, 0); // safe if expansion fails 31.64 - } 31.65 - if (PrintGC && Verbose) { 31.66 - gclog_or_tty->print_cr(" expanding:" 31.67 - " minimum_desired_capacity: %6.1fK" 31.68 - " expand_bytes: %6.1fK" 31.69 - " _min_heap_delta_bytes: %6.1fK", 31.70 - minimum_desired_capacity / (double) K, 31.71 - expand_bytes / (double) K, 31.72 - _min_heap_delta_bytes / (double) K); 31.73 - } 31.74 - return; 31.75 - } 31.76 - 31.77 - // No expansion, now see if we want to shrink 31.78 - size_t shrink_bytes = 0; 31.79 - // We would never want to shrink more than this 31.80 - size_t max_shrink_bytes = capacity_after_gc - minimum_desired_capacity; 31.81 - 31.82 - if (MaxHeapFreeRatio < 100) { 31.83 - const double maximum_free_percentage = MaxHeapFreeRatio / 100.0; 31.84 - const double minimum_used_percentage = 1.0 - maximum_free_percentage; 31.85 - const double max_tmp = used_after_gc / minimum_used_percentage; 31.86 - size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx)); 31.87 - maximum_desired_capacity = MAX2(maximum_desired_capacity, 31.88 - spec()->init_size()); 31.89 - if (PrintGC && Verbose) { 31.90 - gclog_or_tty->print_cr(" " 31.91 - " maximum_free_percentage: %6.2f" 31.92 - " minimum_used_percentage: %6.2f", 31.93 - maximum_free_percentage, 31.94 - minimum_used_percentage); 31.95 - gclog_or_tty->print_cr(" " 31.96 - " _capacity_at_prologue: %6.1fK" 31.97 - " minimum_desired_capacity: %6.1fK" 31.98 - " maximum_desired_capacity: %6.1fK", 31.99 - _capacity_at_prologue / (double) K, 31.100 - minimum_desired_capacity / (double) K, 31.101 - maximum_desired_capacity / (double) K); 31.102 - } 31.103 - assert(minimum_desired_capacity <= maximum_desired_capacity, 31.104 - "sanity check"); 31.105 - 31.106 - if (capacity_after_gc > maximum_desired_capacity) { 31.107 - // Capacity too large, compute shrinking size 31.108 - shrink_bytes = capacity_after_gc - maximum_desired_capacity; 31.109 - // We don't want shrink all the way back to initSize if people call 31.110 - // System.gc(), because some programs do that between "phases" and then 31.111 - // we'd just have to grow the heap up again for the next phase. So we 31.112 - // damp the shrinking: 0% on the first call, 10% on the second call, 40% 31.113 - // on the third call, and 100% by the fourth call. But if we recompute 31.114 - // size without shrinking, it goes back to 0%. 31.115 - shrink_bytes = shrink_bytes / 100 * current_shrink_factor; 31.116 - assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size"); 31.117 - if (current_shrink_factor == 0) { 31.118 - _shrink_factor = 10; 31.119 - } else { 31.120 - _shrink_factor = MIN2(current_shrink_factor * 4, (size_t) 100); 31.121 - } 31.122 - if (PrintGC && Verbose) { 31.123 - gclog_or_tty->print_cr(" " 31.124 - " shrinking:" 31.125 - " initSize: %.1fK" 31.126 - " maximum_desired_capacity: %.1fK", 31.127 - spec()->init_size() / (double) K, 31.128 - maximum_desired_capacity / (double) K); 31.129 - gclog_or_tty->print_cr(" " 31.130 - " shrink_bytes: %.1fK" 31.131 - " current_shrink_factor: %d" 31.132 - " new shrink factor: %d" 31.133 - " _min_heap_delta_bytes: %.1fK", 31.134 - shrink_bytes / (double) K, 31.135 - current_shrink_factor, 31.136 - _shrink_factor, 31.137 - _min_heap_delta_bytes / (double) K); 31.138 - } 31.139 - } 31.140 - } 31.141 - 31.142 - if (capacity_after_gc > _capacity_at_prologue) { 31.143 - // We might have expanded for promotions, in which case we might want to 31.144 - // take back that expansion if there's room after GC. That keeps us from 31.145 - // stretching the heap with promotions when there's plenty of room. 31.146 - size_t expansion_for_promotion = capacity_after_gc - _capacity_at_prologue; 31.147 - expansion_for_promotion = MIN2(expansion_for_promotion, max_shrink_bytes); 31.148 - // We have two shrinking computations, take the largest 31.149 - shrink_bytes = MAX2(shrink_bytes, expansion_for_promotion); 31.150 - assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size"); 31.151 - if (PrintGC && Verbose) { 31.152 - gclog_or_tty->print_cr(" " 31.153 - " aggressive shrinking:" 31.154 - " _capacity_at_prologue: %.1fK" 31.155 - " capacity_after_gc: %.1fK" 31.156 - " expansion_for_promotion: %.1fK" 31.157 - " shrink_bytes: %.1fK", 31.158 - capacity_after_gc / (double) K, 31.159 - _capacity_at_prologue / (double) K, 31.160 - expansion_for_promotion / (double) K, 31.161 - shrink_bytes / (double) K); 31.162 - } 31.163 - } 31.164 - // Don't shrink unless it's significant 31.165 - if (shrink_bytes >= _min_heap_delta_bytes) { 31.166 - shrink(shrink_bytes); 31.167 - } 31.168 - assert(used() == used_after_gc && used_after_gc <= capacity(), 31.169 - "sanity check"); 31.170 -} 31.171 - 31.172 void TenuredGeneration::gc_prologue(bool full) { 31.173 _capacity_at_prologue = capacity(); 31.174 _used_at_prologue = used(); 31.175 @@ -312,6 +156,19 @@ 31.176 size, is_tlab); 31.177 } 31.178 31.179 +void TenuredGeneration::compute_new_size() { 31.180 + assert_locked_or_safepoint(Heap_lock); 31.181 + 31.182 + // Compute some numbers about the state of the heap. 31.183 + const size_t used_after_gc = used(); 31.184 + const size_t capacity_after_gc = capacity(); 31.185 + 31.186 + CardGeneration::compute_new_size(); 31.187 + 31.188 + assert(used() == used_after_gc && used_after_gc <= capacity(), 31.189 + err_msg("used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT 31.190 + " capacity: " SIZE_FORMAT, used(), used_after_gc, capacity())); 31.191 +} 31.192 void TenuredGeneration::update_gc_stats(int current_level, 31.193 bool full) { 31.194 // If the next lower level(s) has been collected, gather any statistics
32.1 --- a/src/share/vm/memory/tenuredGeneration.hpp Fri Apr 12 10:14:42 2013 +0100 32.2 +++ b/src/share/vm/memory/tenuredGeneration.hpp Wed Apr 17 10:12:42 2013 -0700 32.3 @@ -38,13 +38,6 @@ 32.4 class TenuredGeneration: public OneContigSpaceCardGeneration { 32.5 friend class VMStructs; 32.6 protected: 32.7 - // current shrinking effect: this damps shrinking when the heap gets empty. 32.8 - size_t _shrink_factor; 32.9 - // Some statistics from before gc started. 32.10 - // These are gathered in the gc_prologue (and should_collect) 32.11 - // to control growing/shrinking policy in spite of promotions. 32.12 - size_t _capacity_at_prologue; 32.13 - size_t _used_at_prologue; 32.14 32.15 #if INCLUDE_ALL_GCS 32.16 // To support parallel promotion: an array of parallel allocation 32.17 @@ -80,9 +73,6 @@ 32.18 return !CollectGen0First; 32.19 } 32.20 32.21 - // Mark sweep support 32.22 - void compute_new_size(); 32.23 - 32.24 virtual void gc_prologue(bool full); 32.25 virtual void gc_epilogue(bool full); 32.26 bool should_collect(bool full, 32.27 @@ -93,6 +83,7 @@ 32.28 bool clear_all_soft_refs, 32.29 size_t size, 32.30 bool is_tlab); 32.31 + virtual void compute_new_size(); 32.32 32.33 #if INCLUDE_ALL_GCS 32.34 // Overrides.
33.1 --- a/src/share/vm/oops/method.hpp Fri Apr 12 10:14:42 2013 +0100 33.2 +++ b/src/share/vm/oops/method.hpp Wed Apr 17 10:12:42 2013 -0700 33.3 @@ -758,15 +758,19 @@ 33.4 void print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason); 33.5 33.6 public: 33.7 - bool is_not_c1_compilable() const { return access_flags().is_not_c1_compilable(); } 33.8 - void set_not_c1_compilable() { _access_flags.set_not_c1_compilable(); } 33.9 - bool is_not_c2_compilable() const { return access_flags().is_not_c2_compilable(); } 33.10 - void set_not_c2_compilable() { _access_flags.set_not_c2_compilable(); } 33.11 + bool is_not_c1_compilable() const { return access_flags().is_not_c1_compilable(); } 33.12 + void set_not_c1_compilable() { _access_flags.set_not_c1_compilable(); } 33.13 + void clear_not_c1_compilable() { _access_flags.clear_not_c1_compilable(); } 33.14 + bool is_not_c2_compilable() const { return access_flags().is_not_c2_compilable(); } 33.15 + void set_not_c2_compilable() { _access_flags.set_not_c2_compilable(); } 33.16 + void clear_not_c2_compilable() { _access_flags.clear_not_c2_compilable(); } 33.17 33.18 - bool is_not_c1_osr_compilable() const { return is_not_c1_compilable(); } // don't waste an accessFlags bit 33.19 - void set_not_c1_osr_compilable() { set_not_c1_compilable(); } // don't waste an accessFlags bit 33.20 - bool is_not_c2_osr_compilable() const { return access_flags().is_not_c2_osr_compilable(); } 33.21 - void set_not_c2_osr_compilable() { _access_flags.set_not_c2_osr_compilable(); } 33.22 + bool is_not_c1_osr_compilable() const { return is_not_c1_compilable(); } // don't waste an accessFlags bit 33.23 + void set_not_c1_osr_compilable() { set_not_c1_compilable(); } // don't waste an accessFlags bit 33.24 + void clear_not_c1_osr_compilable() { clear_not_c1_compilable(); } // don't waste an accessFlags bit 33.25 + bool is_not_c2_osr_compilable() const { return access_flags().is_not_c2_osr_compilable(); } 33.26 + void set_not_c2_osr_compilable() { _access_flags.set_not_c2_osr_compilable(); } 33.27 + void clear_not_c2_osr_compilable() { _access_flags.clear_not_c2_osr_compilable(); } 33.28 33.29 // Background compilation support 33.30 bool queued_for_compilation() const { return access_flags().queued_for_compilation(); }
34.1 --- a/src/share/vm/oops/methodData.cpp Fri Apr 12 10:14:42 2013 +0100 34.2 +++ b/src/share/vm/oops/methodData.cpp Wed Apr 17 10:12:42 2013 -0700 34.3 @@ -660,29 +660,9 @@ 34.4 // Set the method back-pointer. 34.5 _method = method(); 34.6 34.7 - _invocation_counter.init(); 34.8 - _backedge_counter.init(); 34.9 - _invocation_counter_start = 0; 34.10 - _backedge_counter_start = 0; 34.11 - _num_loops = 0; 34.12 - _num_blocks = 0; 34.13 - _highest_comp_level = 0; 34.14 - _highest_osr_comp_level = 0; 34.15 - _would_profile = true; 34.16 + init(); 34.17 set_creation_mileage(mileage_of(method())); 34.18 34.19 - // Initialize flags and trap history. 34.20 - _nof_decompiles = 0; 34.21 - _nof_overflow_recompiles = 0; 34.22 - _nof_overflow_traps = 0; 34.23 - _eflags = 0; 34.24 - _arg_local = 0; 34.25 - _arg_stack = 0; 34.26 - _arg_returned = 0; 34.27 - assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align"); 34.28 - Copy::zero_to_words((HeapWord*) &_trap_hist, 34.29 - sizeof(_trap_hist) / sizeof(HeapWord)); 34.30 - 34.31 // Go through the bytecodes and allocate and initialize the 34.32 // corresponding data cells. 34.33 int data_size = 0; 34.34 @@ -721,7 +701,27 @@ 34.35 post_initialize(&stream); 34.36 34.37 set_size(object_size); 34.38 +} 34.39 34.40 +void MethodData::init() { 34.41 + _invocation_counter.init(); 34.42 + _backedge_counter.init(); 34.43 + _invocation_counter_start = 0; 34.44 + _backedge_counter_start = 0; 34.45 + _num_loops = 0; 34.46 + _num_blocks = 0; 34.47 + _highest_comp_level = 0; 34.48 + _highest_osr_comp_level = 0; 34.49 + _would_profile = true; 34.50 + 34.51 + // Initialize flags and trap history. 34.52 + _nof_decompiles = 0; 34.53 + _nof_overflow_recompiles = 0; 34.54 + _nof_overflow_traps = 0; 34.55 + clear_escape_info(); 34.56 + assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align"); 34.57 + Copy::zero_to_words((HeapWord*) &_trap_hist, 34.58 + sizeof(_trap_hist) / sizeof(HeapWord)); 34.59 } 34.60 34.61 // Get a measure of how much mileage the method has on it.
35.1 --- a/src/share/vm/oops/methodData.hpp Fri Apr 12 10:14:42 2013 +0100 35.2 +++ b/src/share/vm/oops/methodData.hpp Wed Apr 17 10:12:42 2013 -0700 35.3 @@ -1284,8 +1284,8 @@ 35.4 return bytecode_cell_count(code) != no_profile_data; 35.5 } 35.6 35.7 - // Perform initialization of a new MethodData* 35.8 - void initialize(methodHandle method); 35.9 + // reset into original state 35.10 + void init(); 35.11 35.12 // My size 35.13 int size_in_bytes() const { return _size; } 35.14 @@ -1365,6 +1365,7 @@ 35.15 intx arg_stack() { return _arg_stack; } 35.16 intx arg_returned() { return _arg_returned; } 35.17 uint arg_modified(int a) { ArgInfoData *aid = arg_info(); 35.18 + assert(aid != NULL, "arg_info must be not null"); 35.19 assert(a >= 0 && a < aid->number_of_args(), "valid argument number"); 35.20 return aid->arg_modified(a); } 35.21 35.22 @@ -1373,8 +1374,8 @@ 35.23 void set_arg_stack(intx v) { _arg_stack = v; } 35.24 void set_arg_returned(intx v) { _arg_returned = v; } 35.25 void set_arg_modified(int a, uint v) { ArgInfoData *aid = arg_info(); 35.26 + assert(aid != NULL, "arg_info must be not null"); 35.27 assert(a >= 0 && a < aid->number_of_args(), "valid argument number"); 35.28 - 35.29 aid->set_arg_modified(a, v); } 35.30 35.31 void clear_escape_info() { _eflags = _arg_local = _arg_stack = _arg_returned = 0; }
36.1 --- a/src/share/vm/prims/whitebox.cpp Fri Apr 12 10:14:42 2013 +0100 36.2 +++ b/src/share/vm/prims/whitebox.cpp Wed Apr 17 10:12:42 2013 -0700 36.3 @@ -49,6 +49,7 @@ 36.4 #endif // INCLUDE_NMT 36.5 36.6 #include "compiler/compileBroker.hpp" 36.7 +#include "runtime/compilationPolicy.hpp" 36.8 36.9 bool WhiteBox::_used = false; 36.10 36.11 @@ -214,11 +215,11 @@ 36.12 return (code->is_alive() && !code->is_marked_for_deoptimization()); 36.13 WB_END 36.14 36.15 -WB_ENTRY(jboolean, WB_IsMethodCompilable(JNIEnv* env, jobject o, jobject method)) 36.16 +WB_ENTRY(jboolean, WB_IsMethodCompilable(JNIEnv* env, jobject o, jobject method, jint comp_level)) 36.17 jmethodID jmid = reflected_method_to_jmid(thread, env, method); 36.18 MutexLockerEx mu(Compile_lock); 36.19 methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); 36.20 - return !mh->is_not_compilable(); 36.21 + return CompilationPolicy::can_be_compiled(mh, comp_level); 36.22 WB_END 36.23 36.24 WB_ENTRY(jboolean, WB_IsMethodQueuedForCompilation(JNIEnv* env, jobject o, jobject method)) 36.25 @@ -242,7 +243,7 @@ 36.26 mh->set_not_compilable(); 36.27 WB_END 36.28 36.29 -WB_ENTRY(jboolean, WB_SetDontInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value)) 36.30 +WB_ENTRY(jboolean, WB_TestSetDontInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value)) 36.31 jmethodID jmid = reflected_method_to_jmid(thread, env, method); 36.32 methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); 36.33 bool result = mh->dont_inline(); 36.34 @@ -255,6 +256,54 @@ 36.35 CompileBroker::queue_size(CompLevel_full_profile) /* C1 */; 36.36 WB_END 36.37 36.38 + 36.39 +WB_ENTRY(jboolean, WB_TestSetForceInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value)) 36.40 + jmethodID jmid = reflected_method_to_jmid(thread, env, method); 36.41 + methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); 36.42 + bool result = mh->force_inline(); 36.43 + mh->set_force_inline(value == JNI_TRUE); 36.44 + return result; 36.45 +WB_END 36.46 + 36.47 +WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level)) 36.48 + jmethodID jmid = reflected_method_to_jmid(thread, env, method); 36.49 + methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); 36.50 + nmethod* nm = CompileBroker::compile_method(mh, InvocationEntryBci, comp_level, mh, mh->invocation_count(), "WhiteBox", THREAD); 36.51 + MutexLockerEx mu(Compile_lock); 36.52 + return (mh->queued_for_compilation() || nm != NULL); 36.53 +WB_END 36.54 + 36.55 +WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method)) 36.56 + jmethodID jmid = reflected_method_to_jmid(thread, env, method); 36.57 + methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); 36.58 + MutexLockerEx mu(Compile_lock); 36.59 + MethodData* mdo = mh->method_data(); 36.60 + 36.61 + if (mdo != NULL) { 36.62 + mdo->init(); 36.63 + ResourceMark rm; 36.64 + int arg_count = mdo->method()->size_of_parameters(); 36.65 + for (int i = 0; i < arg_count; i++) { 36.66 + mdo->set_arg_modified(i, 0); 36.67 + } 36.68 + } 36.69 + 36.70 + mh->backedge_counter()->init(); 36.71 + mh->invocation_counter()->init(); 36.72 + mh->set_interpreter_invocation_count(0); 36.73 + mh->set_interpreter_throwout_count(0); 36.74 + mh->clear_not_c1_compilable(); 36.75 + mh->clear_not_c2_compilable(); 36.76 + mh->clear_not_c2_osr_compilable(); 36.77 + NOT_PRODUCT(mh->set_compiled_invocation_count(0)); 36.78 + 36.79 +#ifdef TIERED 36.80 + mh->set_rate(0.0F); 36.81 + mh->set_prev_event_count(0); 36.82 + mh->set_prev_time(0); 36.83 +#endif 36.84 +WB_END 36.85 + 36.86 WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString)) 36.87 ResourceMark rm(THREAD); 36.88 int len; 36.89 @@ -272,7 +321,6 @@ 36.90 Universe::heap()->collect(GCCause::_last_ditch_collection); 36.91 WB_END 36.92 36.93 - 36.94 //Some convenience methods to deal with objects from java 36.95 int WhiteBox::offset_for_field(const char* field_name, oop object, 36.96 Symbol* signature_symbol) { 36.97 @@ -354,18 +402,24 @@ 36.98 (void*)&WB_DeoptimizeMethod }, 36.99 {CC"isMethodCompiled", CC"(Ljava/lang/reflect/Method;)Z", 36.100 (void*)&WB_IsMethodCompiled }, 36.101 - {CC"isMethodCompilable", CC"(Ljava/lang/reflect/Method;)Z", 36.102 + {CC"isMethodCompilable", CC"(Ljava/lang/reflect/Method;I)Z", 36.103 (void*)&WB_IsMethodCompilable}, 36.104 {CC"isMethodQueuedForCompilation", 36.105 CC"(Ljava/lang/reflect/Method;)Z", (void*)&WB_IsMethodQueuedForCompilation}, 36.106 {CC"makeMethodNotCompilable", 36.107 CC"(Ljava/lang/reflect/Method;)V", (void*)&WB_MakeMethodNotCompilable}, 36.108 - {CC"setDontInlineMethod", 36.109 - CC"(Ljava/lang/reflect/Method;Z)Z", (void*)&WB_SetDontInlineMethod}, 36.110 + {CC"testSetDontInlineMethod", 36.111 + CC"(Ljava/lang/reflect/Method;Z)Z", (void*)&WB_TestSetDontInlineMethod}, 36.112 {CC"getMethodCompilationLevel", 36.113 CC"(Ljava/lang/reflect/Method;)I", (void*)&WB_GetMethodCompilationLevel}, 36.114 {CC"getCompileQueuesSize", 36.115 CC"()I", (void*)&WB_GetCompileQueuesSize}, 36.116 + {CC"testSetForceInlineMethod", 36.117 + CC"(Ljava/lang/reflect/Method;Z)Z", (void*)&WB_TestSetForceInlineMethod}, 36.118 + {CC"enqueueMethodForCompilation", 36.119 + CC"(Ljava/lang/reflect/Method;I)Z", (void*)&WB_EnqueueMethodForCompilation}, 36.120 + {CC"clearMethodState", 36.121 + CC"(Ljava/lang/reflect/Method;)V", (void*)&WB_ClearMethodState}, 36.122 {CC"isInStringTable", CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable }, 36.123 {CC"fullGC", CC"()V", (void*)&WB_FullGC }, 36.124 };
37.1 --- a/src/share/vm/runtime/arguments.cpp Fri Apr 12 10:14:42 2013 +0100 37.2 +++ b/src/share/vm/runtime/arguments.cpp Wed Apr 17 10:12:42 2013 -0700 37.3 @@ -2010,11 +2010,12 @@ 37.4 // than just disable the lock verification. This will be fixed under 37.5 // bug 4788986. 37.6 if (UseConcMarkSweepGC && FLSVerifyAllHeapReferences) { 37.7 - if (VerifyGCStartAt == 0) { 37.8 + if (VerifyDuringStartup) { 37.9 warning("Heap verification at start-up disabled " 37.10 "(due to current incompatibility with FLSVerifyAllHeapReferences)"); 37.11 - VerifyGCStartAt = 1; // Disable verification at start-up 37.12 + VerifyDuringStartup = false; // Disable verification at start-up 37.13 } 37.14 + 37.15 if (VerifyBeforeExit) { 37.16 warning("Heap verification at shutdown disabled " 37.17 "(due to current incompatibility with FLSVerifyAllHeapReferences)");
38.1 --- a/src/share/vm/runtime/compilationPolicy.cpp Fri Apr 12 10:14:42 2013 +0100 38.2 +++ b/src/share/vm/runtime/compilationPolicy.cpp Wed Apr 17 10:12:42 2013 -0700 38.3 @@ -123,9 +123,10 @@ 38.4 } 38.5 if (comp_level == CompLevel_all) { 38.6 return !m->is_not_compilable(CompLevel_simple) && !m->is_not_compilable(CompLevel_full_optimization); 38.7 - } else { 38.8 + } else if (is_compile(comp_level)) { 38.9 return !m->is_not_compilable(comp_level); 38.10 } 38.11 + return false; 38.12 } 38.13 38.14 bool CompilationPolicy::is_compilation_enabled() {
39.1 --- a/src/share/vm/runtime/compilationPolicy.hpp Fri Apr 12 10:14:42 2013 +0100 39.2 +++ b/src/share/vm/runtime/compilationPolicy.hpp Wed Apr 17 10:12:42 2013 -0700 39.3 @@ -96,7 +96,7 @@ 39.4 void reset_counter_for_back_branch_event(methodHandle method); 39.5 public: 39.6 NonTieredCompPolicy() : _compiler_count(0) { } 39.7 - virtual CompLevel initial_compile_level() { return CompLevel_initial_compile; } 39.8 + virtual CompLevel initial_compile_level() { return CompLevel_highest_tier; } 39.9 virtual int compiler_count(CompLevel comp_level); 39.10 virtual void do_safepoint_work(); 39.11 virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
40.1 --- a/src/share/vm/runtime/globals.hpp Fri Apr 12 10:14:42 2013 +0100 40.2 +++ b/src/share/vm/runtime/globals.hpp Wed Apr 17 10:12:42 2013 -0700 40.3 @@ -2123,6 +2123,10 @@ 40.4 product(intx, PrefetchFieldsAhead, -1, \ 40.5 "How many fields ahead to prefetch in oop scan (<= 0 means off)") \ 40.6 \ 40.7 + diagnostic(bool, VerifyDuringStartup, false, \ 40.8 + "Verify memory system before executing any Java code " \ 40.9 + "during VM initialization") \ 40.10 + \ 40.11 diagnostic(bool, VerifyBeforeExit, trueInDebug, \ 40.12 "Verify system before exiting") \ 40.13 \ 40.14 @@ -3664,8 +3668,13 @@ 40.15 product(bool, PrintGCCause, true, \ 40.16 "Include GC cause in GC logging") \ 40.17 \ 40.18 - product(bool, AllowNonVirtualCalls, false, \ 40.19 - "Obey the ACC_SUPER flag and allow invokenonvirtual calls") 40.20 + product(bool , AllowNonVirtualCalls, false, \ 40.21 + "Obey the ACC_SUPER flag and allow invokenonvirtual calls") \ 40.22 + \ 40.23 + experimental(uintx, ArrayAllocatorMallocLimit, \ 40.24 + SOLARIS_ONLY(64*K) NOT_SOLARIS(max_uintx), \ 40.25 + "Allocation less than this value will be allocated " \ 40.26 + "using malloc. Larger allocations will use mmap.") 40.27 40.28 /* 40.29 * Macros for factoring of globals
41.1 --- a/src/share/vm/runtime/thread.cpp Fri Apr 12 10:14:42 2013 +0100 41.2 +++ b/src/share/vm/runtime/thread.cpp Wed Apr 17 10:12:42 2013 -0700 41.3 @@ -3446,9 +3446,9 @@ 41.4 } 41.5 41.6 assert (Universe::is_fully_initialized(), "not initialized"); 41.7 - if (VerifyBeforeGC && VerifyGCStartAt == 0) { 41.8 - Universe::heap()->prepare_for_verify(); 41.9 - Universe::verify(); // make sure we're starting with a clean slate 41.10 + if (VerifyDuringStartup) { 41.11 + VM_Verify verify_op(false /* silent */); // make sure we're starting with a clean slate 41.12 + VMThread::execute(&verify_op); 41.13 } 41.14 41.15 EXCEPTION_MARK;
42.1 --- a/src/share/vm/runtime/vmStructs.cpp Fri Apr 12 10:14:42 2013 +0100 42.2 +++ b/src/share/vm/runtime/vmStructs.cpp Wed Apr 17 10:12:42 2013 -0700 42.3 @@ -478,6 +478,9 @@ 42.4 \ 42.5 nonstatic_field(CardGeneration, _rs, GenRemSet*) \ 42.6 nonstatic_field(CardGeneration, _bts, BlockOffsetSharedArray*) \ 42.7 + nonstatic_field(CardGeneration, _shrink_factor, size_t) \ 42.8 + nonstatic_field(CardGeneration, _capacity_at_prologue, size_t) \ 42.9 + nonstatic_field(CardGeneration, _used_at_prologue, size_t) \ 42.10 \ 42.11 nonstatic_field(CardTableModRefBS, _whole_heap, const MemRegion) \ 42.12 nonstatic_field(CardTableModRefBS, _guard_index, const size_t) \ 42.13 @@ -548,8 +551,6 @@ 42.14 nonstatic_field(Space, _bottom, HeapWord*) \ 42.15 nonstatic_field(Space, _end, HeapWord*) \ 42.16 \ 42.17 - nonstatic_field(TenuredGeneration, _shrink_factor, size_t) \ 42.18 - nonstatic_field(TenuredGeneration, _capacity_at_prologue, size_t) \ 42.19 nonstatic_field(ThreadLocalAllocBuffer, _start, HeapWord*) \ 42.20 nonstatic_field(ThreadLocalAllocBuffer, _top, HeapWord*) \ 42.21 nonstatic_field(ThreadLocalAllocBuffer, _end, HeapWord*) \
43.1 --- a/src/share/vm/runtime/vm_operations.cpp Fri Apr 12 10:14:42 2013 +0100 43.2 +++ b/src/share/vm/runtime/vm_operations.cpp Wed Apr 17 10:12:42 2013 -0700 43.3 @@ -175,7 +175,8 @@ 43.4 } 43.5 43.6 void VM_Verify::doit() { 43.7 - Universe::verify(); 43.8 + Universe::heap()->prepare_for_verify(); 43.9 + Universe::verify(_silent); 43.10 } 43.11 43.12 bool VM_PrintThreads::doit_prologue() {
44.1 --- a/src/share/vm/runtime/vm_operations.hpp Fri Apr 12 10:14:42 2013 +0100 44.2 +++ b/src/share/vm/runtime/vm_operations.hpp Wed Apr 17 10:12:42 2013 -0700 44.3 @@ -300,9 +300,9 @@ 44.4 44.5 class VM_Verify: public VM_Operation { 44.6 private: 44.7 - KlassHandle _dependee; 44.8 + bool _silent; 44.9 public: 44.10 - VM_Verify() {} 44.11 + VM_Verify(bool silent) : _silent(silent) {} 44.12 VMOp_Type type() const { return VMOp_Verify; } 44.13 void doit(); 44.14 };
45.1 --- a/src/share/vm/utilities/accessFlags.hpp Fri Apr 12 10:14:42 2013 +0100 45.2 +++ b/src/share/vm/utilities/accessFlags.hpp Wed Apr 17 10:12:42 2013 -0700 45.3 @@ -194,6 +194,9 @@ 45.4 void set_is_obsolete() { atomic_set_bits(JVM_ACC_IS_OBSOLETE); } 45.5 void set_is_prefixed_native() { atomic_set_bits(JVM_ACC_IS_PREFIXED_NATIVE); } 45.6 45.7 + void clear_not_c1_compilable() { atomic_clear_bits(JVM_ACC_NOT_C1_COMPILABLE); } 45.8 + void clear_not_c2_compilable() { atomic_clear_bits(JVM_ACC_NOT_C2_COMPILABLE); } 45.9 + void clear_not_c2_osr_compilable() { atomic_clear_bits(JVM_ACC_NOT_C2_OSR_COMPILABLE); } 45.10 // Klass* flags 45.11 void set_has_vanilla_constructor() { atomic_set_bits(JVM_ACC_HAS_VANILLA_CONSTRUCTOR); } 45.12 void set_has_finalizer() { atomic_set_bits(JVM_ACC_HAS_FINALIZER); }
46.1 --- a/src/share/vm/utilities/bitMap.cpp Fri Apr 12 10:14:42 2013 +0100 46.2 +++ b/src/share/vm/utilities/bitMap.cpp Wed Apr 17 10:12:42 2013 -0700 46.3 @@ -516,6 +516,10 @@ 46.4 return sum; 46.5 } 46.6 46.7 +void BitMap::print_on_error(outputStream* st, const char* prefix) const { 46.8 + st->print_cr("%s[" PTR_FORMAT ", " PTR_FORMAT ")", 46.9 + prefix, map(), (char*)map() + (size() >> LogBitsPerByte)); 46.10 +} 46.11 46.12 #ifndef PRODUCT 46.13
47.1 --- a/src/share/vm/utilities/bitMap.hpp Fri Apr 12 10:14:42 2013 +0100 47.2 +++ b/src/share/vm/utilities/bitMap.hpp Wed Apr 17 10:12:42 2013 -0700 47.3 @@ -262,6 +262,7 @@ 47.4 bool is_full() const; 47.5 bool is_empty() const; 47.6 47.7 + void print_on_error(outputStream* st, const char* prefix) const; 47.8 47.9 #ifndef PRODUCT 47.10 public:
48.1 --- a/src/share/vm/utilities/globalDefinitions.hpp Fri Apr 12 10:14:42 2013 +0100 48.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp Wed Apr 17 10:12:42 2013 -0700 48.3 @@ -845,6 +845,10 @@ 48.4 return comp_level == CompLevel_highest_tier; 48.5 } 48.6 48.7 +inline bool is_compile(int comp_level) { 48.8 + return is_c1_compile(comp_level) || is_c2_compile(comp_level); 48.9 +} 48.10 + 48.11 //---------------------------------------------------------------------------------------------------- 48.12 // 'Forward' declarations of frequently used classes 48.13 // (in order to reduce interface dependencies & reduce
49.1 --- a/src/share/vm/utilities/taskqueue.hpp Fri Apr 12 10:14:42 2013 +0100 49.2 +++ b/src/share/vm/utilities/taskqueue.hpp Wed Apr 17 10:12:42 2013 -0700 49.3 @@ -253,6 +253,7 @@ 49.4 49.5 template <class E, MEMFLAGS F, unsigned int N = TASKQUEUE_SIZE> 49.6 class GenericTaskQueue: public TaskQueueSuper<N, F> { 49.7 + ArrayAllocator<E, F> _array_allocator; 49.8 protected: 49.9 typedef typename TaskQueueSuper<N, F>::Age Age; 49.10 typedef typename TaskQueueSuper<N, F>::idx_t idx_t; 49.11 @@ -314,7 +315,7 @@ 49.12 49.13 template<class E, MEMFLAGS F, unsigned int N> 49.14 void GenericTaskQueue<E, F, N>::initialize() { 49.15 - _elems = NEW_C_HEAP_ARRAY(E, N, F); 49.16 + _elems = _array_allocator.allocate(N); 49.17 } 49.18 49.19 template<class E, MEMFLAGS F, unsigned int N>
50.1 --- a/src/share/vm/utilities/vmError.cpp Fri Apr 12 10:14:42 2013 +0100 50.2 +++ b/src/share/vm/utilities/vmError.cpp Wed Apr 17 10:12:42 2013 -0700 50.3 @@ -685,13 +685,7 @@ 50.4 STEP(190, "(printing heap information)" ) 50.5 50.6 if (_verbose && Universe::is_fully_initialized()) { 50.7 - // Print heap information before vm abort. As we'd like as much 50.8 - // information as possible in the report we ask for the 50.9 - // extended (i.e., more detailed) version. 50.10 - Universe::print_on(st, true /* extended */); 50.11 - st->cr(); 50.12 - 50.13 - Universe::heap()->barrier_set()->print_on(st); 50.14 + Universe::heap()->print_on_error(st); 50.15 st->cr(); 50.16 50.17 st->print_cr("Polling page: " INTPTR_FORMAT, os::get_polling_page());
51.1 --- a/test/compiler/6863420/Test.java Fri Apr 12 10:14:42 2013 +0100 51.2 +++ b/test/compiler/6863420/Test.java Wed Apr 17 10:12:42 2013 -0700 51.3 @@ -27,17 +27,35 @@ 51.4 * @bug 6863420 51.5 * @summary os::javaTimeNanos() go backward on Solaris x86 51.6 * 51.7 - * @run main/othervm Test 51.8 + * Notice the internal timeout in timeout thread Test.TOT. 51.9 + * @run main/othervm/timeout=300 Test 51.10 */ 51.11 51.12 public class Test { 51.13 + 51.14 + static final int INTERNAL_TIMEOUT=240; 51.15 + static class TOT extends Thread { 51.16 + public void run() { 51.17 + try { 51.18 + Thread.sleep(INTERNAL_TIMEOUT*1000); 51.19 + } catch (InterruptedException ex) { 51.20 + } 51.21 + done = true; 51.22 + } 51.23 + } 51.24 + 51.25 static long value = 0; 51.26 static boolean got_backward_time = false; 51.27 + static volatile boolean done = false; 51.28 51.29 public static void main(String args[]) { 51.30 final int count = 100000; 51.31 51.32 - for (int numThreads = 1; numThreads <= 32; numThreads++) { 51.33 + TOT tot = new TOT(); 51.34 + tot.setDaemon(true); 51.35 + tot.start(); 51.36 + 51.37 + for (int numThreads = 1; !done && numThreads <= 32; numThreads++) { 51.38 final int numRuns = 1; 51.39 for (int t=1; t <= numRuns; t++) { 51.40 final int curRun = t; 51.41 @@ -48,7 +66,7 @@ 51.42 Runnable thread = 51.43 new Runnable() { 51.44 public void run() { 51.45 - for (long l = 0; l < 100000; l++) { 51.46 + for (long l = 0; !done && l < 100000; l++) { 51.47 final long start = System.nanoTime(); 51.48 if (value == 12345678) { 51.49 System.out.println("Wow!");
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 52.2 +++ b/test/compiler/8011706/Test8011706.java Wed Apr 17 10:12:42 2013 -0700 52.3 @@ -0,0 +1,65 @@ 52.4 +/* 52.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 52.7 + * 52.8 + * This code is free software; you can redistribute it and/or modify it 52.9 + * under the terms of the GNU General Public License version 2 only, as 52.10 + * published by the Free Software Foundation. 52.11 + * 52.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 52.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 52.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 52.15 + * version 2 for more details (a copy is included in the LICENSE file that 52.16 + * accompanied this code). 52.17 + * 52.18 + * You should have received a copy of the GNU General Public License version 52.19 + * 2 along with this work; if not, write to the Free Software Foundation, 52.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 52.21 + * 52.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 52.23 + * or visit www.oracle.com if you need additional information or have any 52.24 + * questions. 52.25 + */ 52.26 + 52.27 +/* 52.28 + * @test 52.29 + * @bug 8011706 52.30 + * @summary loop invariant code motion may move load before store to the same field 52.31 + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8011706 52.32 + * 52.33 + */ 52.34 + 52.35 +public class Test8011706 { 52.36 + int[] array; 52.37 + 52.38 + void m(boolean test, int[] array1, int[] array2) { 52.39 + int i = 0; 52.40 + if (test) { 52.41 + array = array1; 52.42 + } else { 52.43 + array = array2; 52.44 + } 52.45 + 52.46 + while(true) { 52.47 + int v = array[i]; 52.48 + i++; 52.49 + if (i >= 10) return; 52.50 + } 52.51 + } 52.52 + 52.53 + static public void main(String[] args) { 52.54 + int[] new_array = new int[10]; 52.55 + Test8011706 ti = new Test8011706(); 52.56 + boolean failed = false; 52.57 + try { 52.58 + for (int i = 0; i < 10000; i++) { 52.59 + ti.array = null; 52.60 + ti.m(true, new_array, new_array); 52.61 + } 52.62 + } catch(NullPointerException ex) { 52.63 + throw new RuntimeException("TEST FAILED", ex); 52.64 + } 52.65 + System.out.println("TEST PASSED"); 52.66 + } 52.67 + 52.68 +}
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 53.2 +++ b/test/compiler/whitebox/ClearMethodStateTest.java Wed Apr 17 10:12:42 2013 -0700 53.3 @@ -0,0 +1,71 @@ 53.4 +/* 53.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 53.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.7 + * 53.8 + * This code is free software; you can redistribute it and/or modify it 53.9 + * under the terms of the GNU General Public License version 2 only, as 53.10 + * published by the Free Software Foundation. 53.11 + * 53.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 53.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 53.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 53.15 + * version 2 for more details (a copy is included in the LICENSE file that 53.16 + * accompanied this code). 53.17 + * 53.18 + * You should have received a copy of the GNU General Public License version 53.19 + * 2 along with this work; if not, write to the Free Software Foundation, 53.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 53.21 + * 53.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 53.23 + * or visit www.oracle.com if you need additional information or have any 53.24 + * questions. 53.25 + */ 53.26 + 53.27 +/* 53.28 + * @test ClearMethodStateTest 53.29 + * @library /testlibrary /testlibrary/whitebox 53.30 + * @build ClearMethodStateTest 53.31 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 53.32 + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest 53.33 + * @author igor.ignatyev@oracle.com 53.34 + */ 53.35 +public class ClearMethodStateTest extends CompilerWhiteBoxTest { 53.36 + public static void main(String[] args) throws Exception { 53.37 + // to prevent inlining #method into #compile() and #test() 53.38 + WHITE_BOX.testSetDontInlineMethod(METHOD, true); 53.39 + new ClearMethodStateTest().runTest(); 53.40 + } 53.41 + 53.42 + protected void test() throws Exception { 53.43 + checkNotCompiled(METHOD); 53.44 + compile(); 53.45 + checkCompiled(METHOD); 53.46 + WHITE_BOX.clearMethodState(METHOD); 53.47 + WHITE_BOX.deoptimizeMethod(METHOD); 53.48 + checkNotCompiled(METHOD); 53.49 + 53.50 + 53.51 + if (!TIERED_COMPILATION) { 53.52 + WHITE_BOX.clearMethodState(METHOD); 53.53 + compile(COMPILE_THRESHOLD); 53.54 + checkCompiled(METHOD); 53.55 + 53.56 + WHITE_BOX.deoptimizeMethod(METHOD); 53.57 + checkNotCompiled(METHOD); 53.58 + WHITE_BOX.clearMethodState(METHOD); 53.59 + 53.60 + if (COMPILE_THRESHOLD > 1) { 53.61 + compile(COMPILE_THRESHOLD - 1); 53.62 + checkNotCompiled(METHOD); 53.63 + } else { 53.64 + System.err.println("Warning: 'CompileThreshold' <= 1"); 53.65 + } 53.66 + 53.67 + method(); 53.68 + checkCompiled(METHOD); 53.69 + } else { 53.70 + System.err.println( 53.71 + "Warning: part of test is not applicable in Tiered"); 53.72 + } 53.73 + } 53.74 +}
54.1 --- a/test/compiler/whitebox/CompilerWhiteBoxTest.java Fri Apr 12 10:14:42 2013 +0100 54.2 +++ b/test/compiler/whitebox/CompilerWhiteBoxTest.java Wed Apr 17 10:12:42 2013 -0700 54.3 @@ -37,6 +37,8 @@ 54.4 = Integer.parseInt(getVMOption("CompileThreshold", "10000")); 54.5 protected static final boolean BACKGROUND_COMPILATION 54.6 = Boolean.valueOf(getVMOption("BackgroundCompilation", "true")); 54.7 + protected static final boolean TIERED_COMPILATION 54.8 + = Boolean.valueOf(getVMOption("TieredCompilation", "false")); 54.9 54.10 protected static Method getMethod(String name) { 54.11 try { 54.12 @@ -81,6 +83,9 @@ 54.13 } 54.14 54.15 protected static void checkNotCompiled(Method method) { 54.16 + if (WHITE_BOX.isMethodQueuedForCompilation(method)) { 54.17 + throw new RuntimeException(method + " must not be in queue"); 54.18 + } 54.19 if (WHITE_BOX.isMethodCompiled(method)) { 54.20 throw new RuntimeException(method + " must be not compiled"); 54.21 } 54.22 @@ -139,8 +144,11 @@ 54.23 protected abstract void test() throws Exception; 54.24 54.25 protected final int compile() { 54.26 + return compile(Math.max(COMPILE_THRESHOLD, 150000)); 54.27 + } 54.28 + 54.29 + protected final int compile(int count) { 54.30 int result = 0; 54.31 - int count = Math.max(COMPILE_THRESHOLD, 150000); 54.32 for (int i = 0; i < count; ++i) { 54.33 result += method(); 54.34 }
55.1 --- a/test/compiler/whitebox/DeoptimizeAllTest.java Fri Apr 12 10:14:42 2013 +0100 55.2 +++ b/test/compiler/whitebox/DeoptimizeAllTest.java Wed Apr 17 10:12:42 2013 -0700 55.3 @@ -33,7 +33,7 @@ 55.4 55.5 public static void main(String[] args) throws Exception { 55.6 // to prevent inlining #method into #compile() 55.7 - WHITE_BOX.setDontInlineMethod(METHOD, true); 55.8 + WHITE_BOX.testSetDontInlineMethod(METHOD, true); 55.9 new DeoptimizeAllTest().runTest(); 55.10 } 55.11
56.1 --- a/test/compiler/whitebox/DeoptimizeMethodTest.java Fri Apr 12 10:14:42 2013 +0100 56.2 +++ b/test/compiler/whitebox/DeoptimizeMethodTest.java Wed Apr 17 10:12:42 2013 -0700 56.3 @@ -33,7 +33,7 @@ 56.4 56.5 public static void main(String[] args) throws Exception { 56.6 // to prevent inlining #method into #compile() 56.7 - WHITE_BOX.setDontInlineMethod(METHOD, true); 56.8 + WHITE_BOX.testSetDontInlineMethod(METHOD, true); 56.9 new DeoptimizeMethodTest().runTest(); 56.10 } 56.11
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 57.2 +++ b/test/compiler/whitebox/EnqueueMethodForCompilationTest.java Wed Apr 17 10:12:42 2013 -0700 57.3 @@ -0,0 +1,74 @@ 57.4 +/* 57.5 + * Copyright (c) 2013, 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 EnqueueMethodForCompilationTest 57.29 + * @library /testlibrary /testlibrary/whitebox 57.30 + * @build EnqueueMethodForCompilationTest 57.31 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 57.32 + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI EnqueueMethodForCompilationTest 57.33 + * @author igor.ignatyev@oracle.com 57.34 + */ 57.35 +public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest { 57.36 + public static void main(String[] args) throws Exception { 57.37 + // to prevent inlining #method into #compile() 57.38 + WHITE_BOX.testSetDontInlineMethod(METHOD, true); 57.39 + new EnqueueMethodForCompilationTest().runTest(); 57.40 + } 57.41 + 57.42 + protected void test() throws Exception { 57.43 + checkNotCompiled(METHOD); 57.44 + 57.45 + WHITE_BOX.enqueueMethodForCompilation(METHOD, 0); 57.46 + if (WHITE_BOX.isMethodCompilable(METHOD, 0)) { 57.47 + throw new RuntimeException(METHOD + " is compilable at level 0"); 57.48 + } 57.49 + checkNotCompiled(METHOD); 57.50 + 57.51 + WHITE_BOX.enqueueMethodForCompilation(METHOD, -1); 57.52 + checkNotCompiled(METHOD); 57.53 + 57.54 + WHITE_BOX.enqueueMethodForCompilation(METHOD, 5); 57.55 + if (!WHITE_BOX.isMethodCompilable(METHOD, 5)) { 57.56 + checkNotCompiled(METHOD); 57.57 + compile(); 57.58 + checkCompiled(METHOD); 57.59 + } else { 57.60 + checkCompiled(METHOD); 57.61 + } 57.62 + 57.63 + int compLevel = WHITE_BOX.getMethodCompilationLevel(METHOD); 57.64 + WHITE_BOX.deoptimizeMethod(METHOD); 57.65 + checkNotCompiled(METHOD); 57.66 + 57.67 + WHITE_BOX.enqueueMethodForCompilation(METHOD, compLevel); 57.68 + checkCompiled(METHOD); 57.69 + WHITE_BOX.deoptimizeMethod(METHOD); 57.70 + checkNotCompiled(METHOD); 57.71 + 57.72 + compile(); 57.73 + checkCompiled(METHOD); 57.74 + WHITE_BOX.deoptimizeMethod(METHOD); 57.75 + checkNotCompiled(METHOD); 57.76 + } 57.77 +}
58.1 --- a/test/compiler/whitebox/IsMethodCompilableTest.java Fri Apr 12 10:14:42 2013 +0100 58.2 +++ b/test/compiler/whitebox/IsMethodCompilableTest.java Wed Apr 17 10:12:42 2013 -0700 58.3 @@ -45,7 +45,7 @@ 58.4 58.5 public static void main(String[] args) throws Exception { 58.6 // to prevent inlining #method into #compile() 58.7 - WHITE_BOX.setDontInlineMethod(METHOD, true); 58.8 + WHITE_BOX.testSetDontInlineMethod(METHOD, true); 58.9 new IsMethodCompilableTest().runTest(); 58.10 } 58.11 58.12 @@ -60,26 +60,47 @@ 58.13 "Warning: test is not applicable if PerMethodRecompilationCutoff == Inf"); 58.14 return; 58.15 } 58.16 - boolean madeNotCompilable = false; 58.17 58.18 - for (long i = 0; i < PER_METHOD_RECOMPILATION_CUTOFF; ++i) { 58.19 - compile(); 58.20 - waitBackgroundCompilation(METHOD); 58.21 - WHITE_BOX.deoptimizeMethod(METHOD); 58.22 - if (!WHITE_BOX.isMethodCompilable(METHOD)) { 58.23 - madeNotCompilable = true; 58.24 - break; 58.25 - } 58.26 + // deoptimze 'PerMethodRecompilationCutoff' times and clear state 58.27 + for (long i = 0L, n = PER_METHOD_RECOMPILATION_CUTOFF - 1; i < n; ++i) { 58.28 + compileAndDeoptimaze(); 58.29 } 58.30 - if (!madeNotCompilable) { 58.31 + if (!WHITE_BOX.isMethodCompilable(METHOD)) { 58.32 + throw new RuntimeException(METHOD + " is not compilable after " 58.33 + + (PER_METHOD_RECOMPILATION_CUTOFF - 1) + " iterations"); 58.34 + } 58.35 + WHITE_BOX.clearMethodState(METHOD); 58.36 + 58.37 + // deoptimze 'PerMethodRecompilationCutoff' + 1 times 58.38 + long i; 58.39 + for (i = 0L; i < PER_METHOD_RECOMPILATION_CUTOFF 58.40 + && WHITE_BOX.isMethodCompilable(METHOD); ++i) { 58.41 + compileAndDeoptimaze(); 58.42 + } 58.43 + if (i != PER_METHOD_RECOMPILATION_CUTOFF) { 58.44 + throw new RuntimeException(METHOD + " is not compilable after " 58.45 + + i + " iterations, but must only after " 58.46 + + PER_METHOD_RECOMPILATION_CUTOFF); 58.47 + } 58.48 + if (WHITE_BOX.isMethodCompilable(METHOD)) { 58.49 throw new RuntimeException(METHOD + " is still compilable after " 58.50 + PER_METHOD_RECOMPILATION_CUTOFF + " iterations"); 58.51 } 58.52 compile(); 58.53 - if (WHITE_BOX.isMethodCompiled(METHOD)) { 58.54 - printInfo(METHOD); 58.55 - throw new RuntimeException( 58.56 - METHOD + " is not compilable but compiled"); 58.57 + checkNotCompiled(METHOD); 58.58 + 58.59 + WHITE_BOX.clearMethodState(METHOD); 58.60 + if (!WHITE_BOX.isMethodCompilable(METHOD)) { 58.61 + throw new RuntimeException(METHOD 58.62 + + " is compilable after clearMethodState()"); 58.63 } 58.64 + compile(); 58.65 + checkCompiled(METHOD); 58.66 + } 58.67 + 58.68 + private void compileAndDeoptimaze() throws Exception { 58.69 + compile(); 58.70 + waitBackgroundCompilation(METHOD); 58.71 + WHITE_BOX.deoptimizeMethod(METHOD); 58.72 } 58.73 }
59.1 --- a/test/compiler/whitebox/MakeMethodNotCompilableTest.java Fri Apr 12 10:14:42 2013 +0100 59.2 +++ b/test/compiler/whitebox/MakeMethodNotCompilableTest.java Wed Apr 17 10:12:42 2013 -0700 59.3 @@ -33,7 +33,7 @@ 59.4 59.5 public static void main(String[] args) throws Exception { 59.6 // to prevent inlining #method into #compile() 59.7 - WHITE_BOX.setDontInlineMethod(METHOD, true); 59.8 + WHITE_BOX.testSetDontInlineMethod(METHOD, true); 59.9 new MakeMethodNotCompilableTest().runTest(); 59.10 } 59.11 59.12 @@ -46,9 +46,6 @@ 59.13 throw new RuntimeException(METHOD + " must be not compilable"); 59.14 } 59.15 compile(); 59.16 - if (WHITE_BOX.isMethodQueuedForCompilation(METHOD)) { 59.17 - throw new RuntimeException(METHOD + " must not be in queue"); 59.18 - } 59.19 checkNotCompiled(METHOD); 59.20 if (WHITE_BOX.isMethodCompilable(METHOD)) { 59.21 throw new RuntimeException(METHOD + " must be not compilable");
60.1 --- a/test/compiler/whitebox/SetDontInlineMethodTest.java Fri Apr 12 10:14:42 2013 +0100 60.2 +++ b/test/compiler/whitebox/SetDontInlineMethodTest.java Wed Apr 17 10:12:42 2013 -0700 60.3 @@ -36,23 +36,23 @@ 60.4 } 60.5 60.6 protected void test() throws Exception { 60.7 - if (WHITE_BOX.setDontInlineMethod(METHOD, true)) { 60.8 + if (WHITE_BOX.testSetDontInlineMethod(METHOD, true)) { 60.9 throw new RuntimeException("on start " + METHOD 60.10 + " must be inlineable"); 60.11 } 60.12 - if (!WHITE_BOX.setDontInlineMethod(METHOD, true)) { 60.13 + if (!WHITE_BOX.testSetDontInlineMethod(METHOD, true)) { 60.14 throw new RuntimeException("after first change to true " + METHOD 60.15 + " must be not inlineable"); 60.16 } 60.17 - if (!WHITE_BOX.setDontInlineMethod(METHOD, false)) { 60.18 + if (!WHITE_BOX.testSetDontInlineMethod(METHOD, false)) { 60.19 throw new RuntimeException("after second change to true " + METHOD 60.20 + " must be still not inlineable"); 60.21 } 60.22 - if (WHITE_BOX.setDontInlineMethod(METHOD, false)) { 60.23 + if (WHITE_BOX.testSetDontInlineMethod(METHOD, false)) { 60.24 throw new RuntimeException("after first change to false" + METHOD 60.25 + " must be inlineable"); 60.26 } 60.27 - if (WHITE_BOX.setDontInlineMethod(METHOD, false)) { 60.28 + if (WHITE_BOX.testSetDontInlineMethod(METHOD, false)) { 60.29 throw new RuntimeException("after second change to false " + METHOD 60.30 + " must be inlineable"); 60.31 }
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 61.2 +++ b/test/compiler/whitebox/SetForceInlineMethodTest.java Wed Apr 17 10:12:42 2013 -0700 61.3 @@ -0,0 +1,60 @@ 61.4 +/* 61.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.7 + * 61.8 + * This code is free software; you can redistribute it and/or modify it 61.9 + * under the terms of the GNU General Public License version 2 only, as 61.10 + * published by the Free Software Foundation. 61.11 + * 61.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 61.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 61.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 61.15 + * version 2 for more details (a copy is included in the LICENSE file that 61.16 + * accompanied this code). 61.17 + * 61.18 + * You should have received a copy of the GNU General Public License version 61.19 + * 2 along with this work; if not, write to the Free Software Foundation, 61.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 61.21 + * 61.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 61.23 + * or visit www.oracle.com if you need additional information or have any 61.24 + * questions. 61.25 + */ 61.26 + 61.27 +/* 61.28 + * @test SetForceInlineMethodTest 61.29 + * @library /testlibrary /testlibrary/whitebox 61.30 + * @build SetForceInlineMethodTest 61.31 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 61.32 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetForceInlineMethodTest 61.33 + * @author igor.ignatyev@oracle.com 61.34 + */ 61.35 +public class SetForceInlineMethodTest extends CompilerWhiteBoxTest { 61.36 + 61.37 + public static void main(String[] args) throws Exception { 61.38 + new SetForceInlineMethodTest().runTest(); 61.39 + } 61.40 + 61.41 + protected void test() throws Exception { 61.42 + if (WHITE_BOX.testSetForceInlineMethod(METHOD, true)) { 61.43 + throw new RuntimeException("on start " + METHOD 61.44 + + " must be not force inlineable"); 61.45 + } 61.46 + if (!WHITE_BOX.testSetForceInlineMethod(METHOD, true)) { 61.47 + throw new RuntimeException("after first change to true " + METHOD 61.48 + + " must be force inlineable"); 61.49 + } 61.50 + if (!WHITE_BOX.testSetForceInlineMethod(METHOD, false)) { 61.51 + throw new RuntimeException("after second change to true " + METHOD 61.52 + + " must be still force inlineable"); 61.53 + } 61.54 + if (WHITE_BOX.testSetForceInlineMethod(METHOD, false)) { 61.55 + throw new RuntimeException("after first change to false" + METHOD 61.56 + + " must be not force inlineable"); 61.57 + } 61.58 + if (WHITE_BOX.testSetForceInlineMethod(METHOD, false)) { 61.59 + throw new RuntimeException("after second change to false " + METHOD 61.60 + + " must be not force inlineable"); 61.61 + } 61.62 + } 61.63 +}
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 62.2 +++ b/test/gc/6941923/Test6941923.java Wed Apr 17 10:12:42 2013 -0700 62.3 @@ -0,0 +1,121 @@ 62.4 +/* 62.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 62.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 62.7 + * 62.8 + * This code is free software; you can redistribute it and/or modify it 62.9 + * under the terms of the GNU General Public License version 2 only, as 62.10 + * published by the Free Software Foundation. 62.11 + * 62.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 62.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 62.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 62.15 + * version 2 for more details (a copy is included in the LICENSE file that 62.16 + * accompanied this code). 62.17 + * 62.18 + * You should have received a copy of the GNU General Public License version 62.19 + * 2 along with this work; if not, write to the Free Software Foundation, 62.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 62.21 + * 62.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 62.23 + * or visit www.oracle.com if you need additional information or have any 62.24 + * questions. 62.25 + */ 62.26 + 62.27 +/* 62.28 + * @test Test6941923.java 62.29 + * @bug 6941923 62.30 + * @summary test flags for gc log rotation 62.31 + * @library /testlibrary 62.32 + * @run main/othervm/timeout=600 Test6941923 62.33 + * 62.34 + */ 62.35 +import com.oracle.java.testlibrary.*; 62.36 +import java.io.File; 62.37 +import java.io.FilenameFilter; 62.38 +import java.util.ArrayList; 62.39 +import java.util.Arrays; 62.40 + 62.41 +class GCLoggingGenerator { 62.42 + 62.43 + public static void main(String[] args) throws Exception { 62.44 + 62.45 + long sizeOfLog = Long.parseLong(args[0]); 62.46 + long lines = sizeOfLog / 80; 62.47 + // full.GC generates ad least 1-line which is not shorter then 80 chars 62.48 + // for some GC 2 shorter lines are generated 62.49 + for (long i = 0; i < lines; i++) { 62.50 + System.gc(); 62.51 + } 62.52 + } 62.53 +} 62.54 + 62.55 +public class Test6941923 { 62.56 + 62.57 + static final File currentDirectory = new File("."); 62.58 + static final String logFileName = "test.log"; 62.59 + static final int logFileSizeK = 16; 62.60 + static FilenameFilter logFilter = new FilenameFilter() { 62.61 + @Override 62.62 + public boolean accept(File dir, String name) { 62.63 + return name.startsWith(logFileName); 62.64 + } 62.65 + }; 62.66 + 62.67 + public static void cleanLogs() { 62.68 + for (File log : currentDirectory.listFiles(logFilter)) { 62.69 + if (!log.delete()) { 62.70 + throw new Error("Unable to delete " + log.getAbsolutePath()); 62.71 + } 62.72 + } 62.73 + } 62.74 + 62.75 + public static void runTest(int numberOfFiles) throws Exception { 62.76 + 62.77 + ArrayList<String> args = new ArrayList(); 62.78 + String[] logOpts = new String[]{ 62.79 + "-cp", System.getProperty("java.class.path"), 62.80 + "-Xloggc:" + logFileName, 62.81 + "-XX:-DisableExplicitGC", // to sure that System.gc() works 62.82 + "-XX:+PrintGC", "-XX:+PrintGCDetails", "-XX:+UseGCLogFileRotation", 62.83 + "-XX:NumberOfGCLogFiles=" + numberOfFiles, 62.84 + "-XX:GCLogFileSize=" + logFileSizeK + "K", "-Xmx128M"}; 62.85 + // System.getProperty("test.java.opts") is '' if no options is set 62.86 + // need to skip such empty 62.87 + String[] externalVMopts = System.getProperty("test.java.opts").length() == 0 62.88 + ? new String[0] 62.89 + : System.getProperty("test.java.opts").split(" "); 62.90 + args.addAll(Arrays.asList(externalVMopts)); 62.91 + args.addAll(Arrays.asList(logOpts)); 62.92 + args.add(GCLoggingGenerator.class.getName()); 62.93 + args.add(String.valueOf(numberOfFiles * logFileSizeK * 1024)); 62.94 + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args.toArray(new String[0])); 62.95 + pb.redirectErrorStream(true); 62.96 + pb.redirectOutput(new File(GCLoggingGenerator.class.getName() + ".log")); 62.97 + Process process = pb.start(); 62.98 + int result = process.waitFor(); 62.99 + if (result != 0) { 62.100 + throw new Error("Unexpected exit code = " + result); 62.101 + } 62.102 + File[] logs = currentDirectory.listFiles(logFilter); 62.103 + int smallFilesNumber = 0; 62.104 + for (File log : logs) { 62.105 + if (log.length() < logFileSizeK * 1024) { 62.106 + smallFilesNumber++; 62.107 + } 62.108 + } 62.109 + if (logs.length != numberOfFiles) { 62.110 + throw new Error("There are only " + logs.length + " logs instead " + numberOfFiles); 62.111 + } 62.112 + if (smallFilesNumber > 1) { 62.113 + throw new Error("There should maximum one log with size < " + logFileSizeK + "K"); 62.114 + } 62.115 + } 62.116 + 62.117 + public static void main(String[] args) throws Exception { 62.118 + cleanLogs(); 62.119 + runTest(1); 62.120 + cleanLogs(); 62.121 + runTest(3); 62.122 + cleanLogs(); 62.123 + } 62.124 +}
63.1 --- a/test/gc/6941923/test6941923.sh Fri Apr 12 10:14:42 2013 +0100 63.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 63.3 @@ -1,166 +0,0 @@ 63.4 -## 63.5 -## @test @(#)test6941923.sh 63.6 -## @bug 6941923 63.7 -## @summary test new added flags for gc log rotation 63.8 -## @author yqi 63.9 -## @run shell test6941923.sh 63.10 -## 63.11 -## some tests require path to find test source dir 63.12 -if [ "${TESTSRC}" = "" ] 63.13 -then 63.14 - TESTSRC=${PWD} 63.15 - echo "TESTSRC not set. Using "${TESTSRC}" as default" 63.16 -fi 63.17 -echo "TESTSRC=${TESTSRC}" 63.18 -## Adding common setup Variables for running shell tests. 63.19 -. ${TESTSRC}/../../test_env.sh 63.20 - 63.21 -## skip on windows 63.22 -OS=`uname -s` 63.23 -case "$OS" in 63.24 - Windows_* | CYGWIN_* ) 63.25 - echo "Test skipped for Windows" 63.26 - exit 0 63.27 - ;; 63.28 -esac 63.29 - 63.30 -# create a small test case 63.31 -testname="Test" 63.32 -if [ -e ${testname}.java ]; then 63.33 - rm -rf ${testname}.* 63.34 -fi 63.35 - 63.36 -cat >> ${testname}.java << __EOF__ 63.37 -import java.util.Vector; 63.38 - 63.39 -public class Test implements Runnable 63.40 -{ 63.41 - private boolean _should_stop = false; 63.42 - 63.43 - public static void main(String[] args) throws Exception { 63.44 - 63.45 - long limit = Long.parseLong(args[0]) * 60L * 1000L; // minutes 63.46 - Test t = new Test(); 63.47 - t.set_stop(false); 63.48 - Thread thr = new Thread(t); 63.49 - thr.start(); 63.50 - 63.51 - long time1 = System.currentTimeMillis(); 63.52 - long time2 = System.currentTimeMillis(); 63.53 - while (time2 - time1 < limit) { 63.54 - try { 63.55 - Thread.sleep(2000); // 2 seconds 63.56 - } 63.57 - catch(Exception e) {} 63.58 - time2 = System.currentTimeMillis(); 63.59 - System.out.print("\r... " + (time2 - time1)/1000 + " seconds"); 63.60 - } 63.61 - System.out.println(); 63.62 - t.set_stop(true); 63.63 - } 63.64 - public void set_stop(boolean value) { _should_stop = value; } 63.65 - public void run() { 63.66 - int cap = 20000; 63.67 - int fix_size = 2048; 63.68 - int loop = 0; 63.69 - Vector< byte[] > v = new Vector< byte[] >(cap); 63.70 - while(!_should_stop) { 63.71 - byte[] g = new byte[fix_size]; 63.72 - v.add(g); 63.73 - loop++; 63.74 - if (loop > cap) { 63.75 - v = null; 63.76 - cap *= 2; 63.77 - if (cap > 80000) cap = 80000; 63.78 - v = new Vector< byte[] >(cap); 63.79 - } 63.80 - } 63.81 - } 63.82 -} 63.83 -__EOF__ 63.84 - 63.85 -msgsuccess="succeeded" 63.86 -msgfail="failed" 63.87 -gclogsize="16K" 63.88 -filesize=$((16*1024)) 63.89 -${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${testname}.java > $NULL 2>&1 63.90 - 63.91 -if [ $? != 0 ]; then 63.92 - echo "${COMPILEJAVA}/bin/javac ${testname}.java $fail" 63.93 - exit -1 63.94 -fi 63.95 - 63.96 -# test for 2 minutes, it will complete circulation of gc log rotation 63.97 -tts=2 63.98 -logfile="test.log" 63.99 -hotspotlog="hotspot.log" 63.100 - 63.101 -if [ -e $logfile ]; then 63.102 - rm -rf $logfile 63.103 -fi 63.104 - 63.105 -#also delete $hotspotlog if it exists 63.106 -if [ -f $hotspotlog ]; then 63.107 - rm -rf $hotspotlog 63.108 -fi 63.109 - 63.110 -options="-Xloggc:$logfile -XX:+UseConcMarkSweepGC -XX:+PrintGC -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=$gclogsize" 63.111 -echo "Test gc log rotation in same file, wait for $tts minutes ...." 63.112 -${TESTJAVA}/bin/java $options $testname $tts 63.113 -if [ $? != 0 ]; then 63.114 - echo "$msgfail" 63.115 - exit -1 63.116 -fi 63.117 - 63.118 -# rotation file will be $logfile.0 63.119 -if [ -f $logfile.0 ]; then 63.120 - outfilesize=`ls -l $logfile.0 | awk '{print $5 }'` 63.121 - if [ $((outfilesize)) -ge $((filesize)) ]; then 63.122 - echo $msgsuccess 63.123 - else 63.124 - echo $msgfail 63.125 - fi 63.126 -else 63.127 - echo $msgfail 63.128 - exit -1 63.129 -fi 63.130 - 63.131 -# delete log file 63.132 -rm -rf $logfile.0 63.133 -if [ -f $hotspotlog ]; then 63.134 - rm -rf $hotspotlog 63.135 -fi 63.136 - 63.137 -#multiple log files 63.138 -numoffiles=3 63.139 -options="-Xloggc:$logfile -XX:+UseConcMarkSweepGC -XX:+PrintGC -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=$numoffiles -XX:GCLogFileSize=$gclogsize" 63.140 -echo "Test gc log rotation in $numoffiles files, wait for $tts minutes ...." 63.141 -${TESTJAVA}/bin/java $options $testname $tts 63.142 -if [ $? != 0 ]; then 63.143 - echo "$msgfail" 63.144 - exit -1 63.145 -fi 63.146 - 63.147 -atleast=0 # at least size of numoffile-1 files >= $gclogsize 63.148 -tk=0 63.149 -while [ $(($tk)) -lt $(($numoffiles)) ] 63.150 -do 63.151 - if [ -f $logfile.$tk ]; then 63.152 - outfilesize=`ls -l $logfile.$tk | awk '{ print $5 }'` 63.153 - if [ $(($outfilesize)) -ge $(($filesize)) ]; then 63.154 - atleast=$((atleast+1)) 63.155 - fi 63.156 - fi 63.157 - tk=$((tk+1)) 63.158 -done 63.159 - 63.160 -rm -rf $logfile.* 63.161 -rm -rf $testname.* 63.162 -rm -rf $hotspotlog 63.163 - 63.164 -if [ $(($atleast)) -ge $(($numoffiles-1)) ]; then 63.165 - echo $msgsuccess 63.166 -else 63.167 - echo $msgfail 63.168 - exit -1 63.169 -fi
64.1 --- a/test/gc/TestVerifyBeforeGCDuringStartup.java Fri Apr 12 10:14:42 2013 +0100 64.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 64.3 @@ -1,45 +0,0 @@ 64.4 -/* 64.5 - * Copyright (c) 2013, 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 -/* @test TestVerifyBeforeGCDuringStartup.java 64.28 - * @key gc 64.29 - * @bug 8010463 64.30 - * @summary Simple test run with -XX:+VerifyBeforeGC -XX:-UseTLAB to verify 8010463 64.31 - * @library /testlibrary 64.32 - */ 64.33 - 64.34 -import com.oracle.java.testlibrary.OutputAnalyzer; 64.35 -import com.oracle.java.testlibrary.ProcessTools; 64.36 - 64.37 -public class TestVerifyBeforeGCDuringStartup { 64.38 - public static void main(String args[]) throws Exception { 64.39 - ProcessBuilder pb = 64.40 - ProcessTools.createJavaProcessBuilder(System.getProperty("test.vm.opts"), 64.41 - "-XX:-UseTLAB", 64.42 - "-XX:+UnlockDiagnosticVMOptions", 64.43 - "-XX:+VerifyBeforeGC", "-version"); 64.44 - OutputAnalyzer output = new OutputAnalyzer(pb.start()); 64.45 - output.shouldContain("[Verifying"); 64.46 - output.shouldHaveExitValue(0); 64.47 - } 64.48 -}
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 65.2 +++ b/test/gc/TestVerifyDuringStartup.java Wed Apr 17 10:12:42 2013 -0700 65.3 @@ -0,0 +1,45 @@ 65.4 +/* 65.5 + * Copyright (c) 2013, 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 +/* @test TestVerifyDuringStartup.java 65.28 + * @key gc 65.29 + * @bug 8010463 65.30 + * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463 65.31 + * @library /testlibrary 65.32 + */ 65.33 + 65.34 +import com.oracle.java.testlibrary.OutputAnalyzer; 65.35 +import com.oracle.java.testlibrary.ProcessTools; 65.36 + 65.37 +public class TestVerifyDuringStartup { 65.38 + public static void main(String args[]) throws Exception { 65.39 + ProcessBuilder pb = 65.40 + ProcessTools.createJavaProcessBuilder(System.getProperty("test.vm.opts"), 65.41 + "-XX:-UseTLAB", 65.42 + "-XX:+UnlockDiagnosticVMOptions", 65.43 + "-XX:+VerifyDuringStartup", "-version"); 65.44 + OutputAnalyzer output = new OutputAnalyzer(pb.start()); 65.45 + output.shouldContain("[Verifying"); 65.46 + output.shouldHaveExitValue(0); 65.47 + } 65.48 +}
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 66.2 +++ b/test/gc/metaspace/G1AddMetaspaceDependency.java Wed Apr 17 10:12:42 2013 -0700 66.3 @@ -0,0 +1,123 @@ 66.4 +/* 66.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 66.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 66.7 + * 66.8 + * This code is free software; you can redistribute it and/or modify it 66.9 + * under the terms of the GNU General Public License version 2 only, as 66.10 + * published by the Free Software Foundation. 66.11 + * 66.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 66.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 66.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 66.15 + * version 2 for more details (a copy is included in the LICENSE file that 66.16 + * accompanied this code). 66.17 + * 66.18 + * You should have received a copy of the GNU General Public License version 66.19 + * 2 along with this work; if not, write to the Free Software Foundation, 66.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 66.21 + * 66.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 66.23 + * or visit www.oracle.com if you need additional information or have any 66.24 + * questions. 66.25 + */ 66.26 + 66.27 +/* 66.28 + * @test G1AddMetaspaceDependency 66.29 + * @bug 8010196 66.30 + * @summary Checks that we don't get locking problems when adding metaspace dependencies with the G1 update buffer monitor 66.31 + * @run main/othervm -XX:+UseG1GC -XX:G1UpdateBufferSize=1 G1AddMetaspaceDependency 66.32 + */ 66.33 + 66.34 +import java.io.InputStream; 66.35 + 66.36 +public class G1AddMetaspaceDependency { 66.37 + 66.38 + static byte[] getClassBytes(String name) { 66.39 + byte[] b = null; 66.40 + try (InputStream is = ClassLoader.getSystemResourceAsStream(name)) { 66.41 + byte[] tmp = new byte[is.available()]; 66.42 + is.read(tmp); 66.43 + b = tmp; 66.44 + } finally { 66.45 + if (b == null) { 66.46 + throw new RuntimeException("Unable to load class file"); 66.47 + } 66.48 + return b; 66.49 + } 66.50 + } 66.51 + 66.52 + static final String a_name = G1AddMetaspaceDependency.class.getName() + "$A"; 66.53 + static final String b_name = G1AddMetaspaceDependency.class.getName() + "$B"; 66.54 + 66.55 + public static void main(String... args) throws Exception { 66.56 + final byte[] a_bytes = getClassBytes(a_name + ".class"); 66.57 + final byte[] b_bytes = getClassBytes(b_name + ".class"); 66.58 + 66.59 + for (int i = 0; i < 1000; i += 1) { 66.60 + runTest(a_bytes, b_bytes); 66.61 + } 66.62 + } 66.63 + 66.64 + static class Loader extends ClassLoader { 66.65 + private final String myClass; 66.66 + private final byte[] myBytes; 66.67 + private final String friendClass; 66.68 + private final ClassLoader friendLoader; 66.69 + 66.70 + Loader(String myClass, byte[] myBytes, 66.71 + String friendClass, ClassLoader friendLoader) { 66.72 + this.myClass = myClass; 66.73 + this.myBytes = myBytes; 66.74 + this.friendClass = friendClass; 66.75 + this.friendLoader = friendLoader; 66.76 + } 66.77 + 66.78 + Loader(String myClass, byte[] myBytes) { 66.79 + this(myClass, myBytes, null, null); 66.80 + } 66.81 + 66.82 + @Override 66.83 + public Class<?> loadClass(String name) throws ClassNotFoundException { 66.84 + Class<?> c = findLoadedClass(name); 66.85 + if (c != null) { 66.86 + return c; 66.87 + } 66.88 + 66.89 + if (name.equals(friendClass)) { 66.90 + return friendLoader.loadClass(name); 66.91 + } 66.92 + 66.93 + if (name.equals(myClass)) { 66.94 + c = defineClass(name, myBytes, 0, myBytes.length); 66.95 + resolveClass(c); 66.96 + return c; 66.97 + } 66.98 + 66.99 + return findSystemClass(name); 66.100 + } 66.101 + 66.102 + } 66.103 + 66.104 + private static void runTest(final byte[] a_bytes, final byte[] b_bytes) throws Exception { 66.105 + Loader a_loader = new Loader(a_name, a_bytes); 66.106 + Loader b_loader = new Loader(b_name, b_bytes, a_name, a_loader); 66.107 + Loader c_loader = new Loader(b_name, b_bytes, a_name, a_loader); 66.108 + Loader d_loader = new Loader(b_name, b_bytes, a_name, a_loader); 66.109 + Loader e_loader = new Loader(b_name, b_bytes, a_name, a_loader); 66.110 + Loader f_loader = new Loader(b_name, b_bytes, a_name, a_loader); 66.111 + Loader g_loader = new Loader(b_name, b_bytes, a_name, a_loader); 66.112 + 66.113 + byte[] b = new byte[20 * 2 << 20]; 66.114 + Class<?> c; 66.115 + c = b_loader.loadClass(b_name); 66.116 + c = c_loader.loadClass(b_name); 66.117 + c = d_loader.loadClass(b_name); 66.118 + c = e_loader.loadClass(b_name); 66.119 + c = f_loader.loadClass(b_name); 66.120 + c = g_loader.loadClass(b_name); 66.121 + } 66.122 + public class A { 66.123 + } 66.124 + class B extends A { 66.125 + } 66.126 +}
67.1 --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Fri Apr 12 10:14:42 2013 +0100 67.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Wed Apr 17 10:12:42 2013 -0700 67.3 @@ -91,13 +91,19 @@ 67.4 // Compiler 67.5 public native void deoptimizeAll(); 67.6 public native boolean isMethodCompiled(Method method); 67.7 - public native boolean isMethodCompilable(Method method); 67.8 + public boolean isMethodCompilable(Method method) { 67.9 + return isMethodCompilable(method, -1 /*any*/); 67.10 + } 67.11 + public native boolean isMethodCompilable(Method method, int compLevel); 67.12 public native boolean isMethodQueuedForCompilation(Method method); 67.13 public native int deoptimizeMethod(Method method); 67.14 public native void makeMethodNotCompilable(Method method); 67.15 public native int getMethodCompilationLevel(Method method); 67.16 - public native boolean setDontInlineMethod(Method method, boolean value); 67.17 + public native boolean testSetDontInlineMethod(Method method, boolean value); 67.18 public native int getCompileQueuesSize(); 67.19 + public native boolean testSetForceInlineMethod(Method method, boolean value); 67.20 + public native boolean enqueueMethodForCompilation(Method method, int compLevel); 67.21 + public native void clearMethodState(Method method); 67.22 67.23 //Intered strings 67.24 public native boolean isInStringTable(String str);