Mon, 07 Mar 2011 09:16:08 -0800
Merge
src/share/vm/runtime/arguments.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/classfile/classFileParser.cpp Fri Mar 04 14:06:22 2011 -0800 1.2 +++ b/src/share/vm/classfile/classFileParser.cpp Mon Mar 07 09:16:08 2011 -0800 1.3 @@ -1616,8 +1616,13 @@ 1.4 1.5 AccessFlags access_flags; 1.6 if (name == vmSymbols::class_initializer_name()) { 1.7 - // We ignore the access flags for a class initializer. (JVM Spec. p. 116) 1.8 - flags = JVM_ACC_STATIC; 1.9 + // We ignore the other access flags for a valid class initializer. 1.10 + // (JVM Spec 2nd ed., chapter 4.6) 1.11 + if (_major_version < 51) { // backward compatibility 1.12 + flags = JVM_ACC_STATIC; 1.13 + } else if ((flags & JVM_ACC_STATIC) == JVM_ACC_STATIC) { 1.14 + flags &= JVM_ACC_STATIC | JVM_ACC_STRICT; 1.15 + } 1.16 } else { 1.17 verify_legal_method_modifiers(flags, is_interface, name, CHECK_(nullHandle)); 1.18 }
2.1 --- a/src/share/vm/oops/constantPoolOop.cpp Fri Mar 04 14:06:22 2011 -0800 2.2 +++ b/src/share/vm/oops/constantPoolOop.cpp Mon Mar 07 09:16:08 2011 -0800 2.3 @@ -1175,8 +1175,15 @@ 2.4 2.5 case JVM_CONSTANT_UnresolvedClass: 2.6 { 2.7 - Symbol* k = from_cp->unresolved_klass_at(from_i); 2.8 - to_cp->unresolved_klass_at_put(to_i, k); 2.9 + // Can be resolved after checking tag, so check the slot first. 2.10 + CPSlot entry = from_cp->slot_at(from_i); 2.11 + if (entry.is_oop()) { 2.12 + assert(entry.get_oop()->is_klass(), "must be"); 2.13 + // Already resolved 2.14 + to_cp->klass_at_put(to_i, (klassOop)entry.get_oop()); 2.15 + } else { 2.16 + to_cp->unresolved_klass_at_put(to_i, entry.get_symbol()); 2.17 + } 2.18 } break; 2.19 2.20 case JVM_CONSTANT_UnresolvedClassInError: 2.21 @@ -1189,8 +1196,14 @@ 2.22 2.23 case JVM_CONSTANT_UnresolvedString: 2.24 { 2.25 - Symbol* s = from_cp->unresolved_string_at(from_i); 2.26 - to_cp->unresolved_string_at_put(to_i, s); 2.27 + // Can be resolved after checking tag, so check the slot first. 2.28 + CPSlot entry = from_cp->slot_at(from_i); 2.29 + if (entry.is_oop()) { 2.30 + // Already resolved (either string or pseudo-string) 2.31 + to_cp->string_at_put(to_i, entry.get_oop()); 2.32 + } else { 2.33 + to_cp->unresolved_string_at_put(to_i, entry.get_symbol()); 2.34 + } 2.35 } break; 2.36 2.37 case JVM_CONSTANT_Utf8:
3.1 --- a/src/share/vm/oops/instanceKlass.cpp Fri Mar 04 14:06:22 2011 -0800 3.2 +++ b/src/share/vm/oops/instanceKlass.cpp Mon Mar 07 09:16:08 2011 -0800 3.3 @@ -735,7 +735,12 @@ 3.4 static int call_class_initializer_impl_counter = 0; // for debugging 3.5 3.6 methodOop instanceKlass::class_initializer() { 3.7 - return find_method(vmSymbols::class_initializer_name(), vmSymbols::void_method_signature()); 3.8 + methodOop clinit = find_method( 3.9 + vmSymbols::class_initializer_name(), vmSymbols::void_method_signature()); 3.10 + if (clinit != NULL && clinit->has_valid_initializer_flags()) { 3.11 + return clinit; 3.12 + } 3.13 + return NULL; 3.14 } 3.15 3.16 void instanceKlass::call_class_initializer_impl(instanceKlassHandle this_oop, TRAPS) {
4.1 --- a/src/share/vm/oops/klassVtable.cpp Fri Mar 04 14:06:22 2011 -0800 4.2 +++ b/src/share/vm/oops/klassVtable.cpp Mon Mar 07 09:16:08 2011 -0800 4.3 @@ -883,7 +883,7 @@ 4.4 int ime_num = 0; 4.5 4.6 // Skip first methodOop if it is a class initializer 4.7 - int i = ((methodOop)methods()->obj_at(0))->name() != vmSymbols::class_initializer_name() ? 0 : 1; 4.8 + int i = ((methodOop)methods()->obj_at(0))->is_static_initializer() ? 1 : 0; 4.9 4.10 // m, method_name, method_signature, klass reset each loop so they 4.11 // don't need preserving across check_signature_loaders call 4.12 @@ -1121,7 +1121,7 @@ 4.13 assert(index < methods->length(), "should find index for resolve_invoke"); 4.14 } 4.15 // Adjust for <clinit>, which is left out of table if first method 4.16 - if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) { 4.17 + if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->is_static_initializer()) { 4.18 index--; 4.19 } 4.20 return index; 4.21 @@ -1135,7 +1135,7 @@ 4.22 4.23 int index = itable_index; 4.24 // Adjust for <clinit>, which is left out of table if first method 4.25 - if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) { 4.26 + if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->is_static_initializer()) { 4.27 index++; 4.28 } 4.29
5.1 --- a/src/share/vm/oops/methodDataOop.hpp Fri Mar 04 14:06:22 2011 -0800 5.2 +++ b/src/share/vm/oops/methodDataOop.hpp Mon Mar 07 09:16:08 2011 -0800 5.3 @@ -228,7 +228,7 @@ 5.4 return byte_offset_of(DataLayout, _header._struct._bci); 5.5 } 5.6 static ByteSize cell_offset(int index) { 5.7 - return byte_offset_of(DataLayout, _cells[index]); 5.8 + return byte_offset_of(DataLayout, _cells) + in_ByteSize(index * cell_size); 5.9 } 5.10 // Return a value which, when or-ed as a byte into _flags, sets the flag. 5.11 static int flag_number_to_byte_constant(int flag_number) {
6.1 --- a/src/share/vm/oops/methodOop.cpp Fri Mar 04 14:06:22 2011 -0800 6.2 +++ b/src/share/vm/oops/methodOop.cpp Mon Mar 07 09:16:08 2011 -0800 6.3 @@ -466,7 +466,20 @@ 6.4 6.5 6.6 bool methodOopDesc::is_initializer() const { 6.7 - return name() == vmSymbols::object_initializer_name() || name() == vmSymbols::class_initializer_name(); 6.8 + return name() == vmSymbols::object_initializer_name() || is_static_initializer(); 6.9 +} 6.10 + 6.11 +bool methodOopDesc::has_valid_initializer_flags() const { 6.12 + return (is_static() || 6.13 + instanceKlass::cast(method_holder())->major_version() < 51); 6.14 +} 6.15 + 6.16 +bool methodOopDesc::is_static_initializer() const { 6.17 + // For classfiles version 51 or greater, ensure that the clinit method is 6.18 + // static. Non-static methods with the name "<clinit>" are not static 6.19 + // initializers. (older classfiles exempted for backward compatibility) 6.20 + return name() == vmSymbols::class_initializer_name() && 6.21 + has_valid_initializer_flags(); 6.22 } 6.23 6.24
7.1 --- a/src/share/vm/oops/methodOop.hpp Fri Mar 04 14:06:22 2011 -0800 7.2 +++ b/src/share/vm/oops/methodOop.hpp Mon Mar 07 09:16:08 2011 -0800 7.3 @@ -497,6 +497,13 @@ 7.4 // returns true if the method is an initializer (<init> or <clinit>). 7.5 bool is_initializer() const; 7.6 7.7 + // returns true if the method is static OR if the classfile version < 51 7.8 + bool has_valid_initializer_flags() const; 7.9 + 7.10 + // returns true if the method name is <clinit> and the method has 7.11 + // valid static initializer flags. 7.12 + bool is_static_initializer() const; 7.13 + 7.14 // compiled code support 7.15 // NOTE: code() is inherently racy as deopt can be clearing code 7.16 // simultaneously. Use with caution.
8.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp Fri Mar 04 14:06:22 2011 -0800 8.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp Mon Mar 07 09:16:08 2011 -0800 8.3 @@ -1084,7 +1084,10 @@ 8.4 jbyte old_tag = old_cp->tag_at(old_i).value(); 8.5 switch (old_tag) { 8.6 case JVM_CONSTANT_Class: 8.7 + case JVM_CONSTANT_UnresolvedClass: 8.8 // revert the copy to JVM_CONSTANT_UnresolvedClass 8.9 + // May be resolving while calling this so do the same for 8.10 + // JVM_CONSTANT_UnresolvedClass (klass_name_at() deals with transition) 8.11 (*merge_cp_p)->unresolved_klass_at_put(old_i, 8.12 old_cp->klass_name_at(old_i)); 8.13 break;
9.1 --- a/src/share/vm/runtime/arguments.cpp Fri Mar 04 14:06:22 2011 -0800 9.2 +++ b/src/share/vm/runtime/arguments.cpp Mon Mar 07 09:16:08 2011 -0800 9.3 @@ -3110,7 +3110,11 @@ 9.4 // Turn off biased locking for locking debug mode flags, 9.5 // which are subtlely different from each other but neither works with 9.6 // biased locking. 9.7 - if (!UseFastLocking || UseHeavyMonitors) { 9.8 + if (UseHeavyMonitors 9.9 +#ifdef COMPILER1 9.10 + || !UseFastLocking 9.11 +#endif // COMPILER1 9.12 + ) { 9.13 if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) { 9.14 // flag set to true on command line; warn the user that they 9.15 // can't enable biased locking here
10.1 --- a/src/share/vm/runtime/os.cpp Fri Mar 04 14:06:22 2011 -0800 10.2 +++ b/src/share/vm/runtime/os.cpp Mon Mar 07 09:16:08 2011 -0800 10.3 @@ -633,10 +633,10 @@ 10.4 *q = (u_char)freeBlockPad; 10.5 } 10.6 if (PrintMalloc && tty != NULL) 10.7 - fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, memblock); 10.8 + fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, (uintptr_t)memblock); 10.9 } else if (PrintMalloc && tty != NULL) { 10.10 // tty->print_cr("os::free %p", memblock); 10.11 - fprintf(stderr, "os::free " PTR_FORMAT "\n", memblock); 10.12 + fprintf(stderr, "os::free " PTR_FORMAT "\n", (uintptr_t)memblock); 10.13 } 10.14 #endif 10.15 ::free((char*)memblock - space_before);