Thu, 04 Apr 2013 19:07:32 +0200
Merge
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java Wed Apr 03 09:19:02 2013 +0200 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java Thu Apr 04 19:07:32 2013 +0200 1.3 @@ -572,9 +572,14 @@ 1.4 DTFWHome = sysRoot + File.separator + ".." + File.separator + 1.5 "Program Files" + File.separator + "Debugging Tools For Windows"; 1.6 searchList.add(DTFWHome); 1.7 - searchList.add(DTFWHome + " (x86)"); 1.8 - searchList.add(DTFWHome + " (x64)"); 1.9 1.10 + // Only add the search path for the current CPU architecture: 1.11 + String cpu = PlatformInfo.getCPU(); 1.12 + if (cpu.equals("x86")) { 1.13 + searchList.add(DTFWHome + " (x86)"); 1.14 + } else if (cpu.equals("amd64")) { 1.15 + searchList.add(DTFWHome + " (x64)"); 1.16 + } 1.17 // The last place to search is the system directory: 1.18 searchList.add(sysRoot + File.separator + "system32"); 1.19 }
2.1 --- a/src/share/vm/classfile/symbolTable.cpp Wed Apr 03 09:19:02 2013 +0200 2.2 +++ b/src/share/vm/classfile/symbolTable.cpp Thu Apr 04 19:07:32 2013 +0200 2.3 @@ -677,9 +677,14 @@ 2.4 ResourceMark rm; 2.5 int length; 2.6 jchar* chars = symbol->as_unicode(length); 2.7 - unsigned int hashValue = hash_string(chars, length); 2.8 - int index = the_table()->hash_to_index(hashValue); 2.9 - return the_table()->lookup(index, chars, length, hashValue); 2.10 + return lookup(chars, length); 2.11 +} 2.12 + 2.13 + 2.14 +oop StringTable::lookup(jchar* name, int len) { 2.15 + unsigned int hash = hash_string(name, len); 2.16 + int index = the_table()->hash_to_index(hash); 2.17 + return the_table()->lookup(index, name, len, hash); 2.18 } 2.19 2.20
3.1 --- a/src/share/vm/classfile/symbolTable.hpp Wed Apr 03 09:19:02 2013 +0200 3.2 +++ b/src/share/vm/classfile/symbolTable.hpp Thu Apr 04 19:07:32 2013 +0200 3.3 @@ -287,6 +287,7 @@ 3.4 3.5 // Probing 3.6 static oop lookup(Symbol* symbol); 3.7 + static oop lookup(jchar* chars, int length); 3.8 3.9 // Interning 3.10 static oop intern(Symbol* symbol, TRAPS);
4.1 --- a/src/share/vm/classfile/systemDictionary.cpp Wed Apr 03 09:19:02 2013 +0200 4.2 +++ b/src/share/vm/classfile/systemDictionary.cpp Thu Apr 04 19:07:32 2013 +0200 4.3 @@ -816,13 +816,28 @@ 4.4 // We didn't go as far as Klass::restore_unshareable_info(), 4.5 // so nothing to clean up. 4.6 } else { 4.7 - MutexLocker mu(SystemDictionary_lock, THREAD); 4.8 - Klass* kk = find_class(name, ik->class_loader_data()); 4.9 + Klass *kk; 4.10 + { 4.11 + MutexLocker mu(SystemDictionary_lock, THREAD); 4.12 + kk = find_class(name, ik->class_loader_data()); 4.13 + } 4.14 if (kk != NULL) { 4.15 // No clean up is needed if the shared class has been entered 4.16 // into system dictionary, as load_shared_class() won't be called 4.17 // again. 4.18 } else { 4.19 + // This must be done outside of the SystemDictionary_lock to 4.20 + // avoid deadlock. 4.21 + // 4.22 + // Note that Klass::restore_unshareable_info (called via 4.23 + // load_instance_class above) is also called outside 4.24 + // of SystemDictionary_lock. Other threads are blocked from 4.25 + // loading this class because they are waiting on the 4.26 + // SystemDictionary_lock until this thread removes 4.27 + // the placeholder below. 4.28 + // 4.29 + // This need to be re-thought when parallel-capable non-boot 4.30 + // classloaders are supported by CDS (today they're not). 4.31 clean_up_shared_class(ik, class_loader, THREAD); 4.32 } 4.33 } 4.34 @@ -2185,10 +2200,9 @@ 4.35 // Make sure all class components (including arrays) in the given 4.36 // signature will be resolved to the same class in both loaders. 4.37 // Returns the name of the type that failed a loader constraint check, or 4.38 -// NULL if no constraint failed. The returned C string needs cleaning up 4.39 -// with a ResourceMark in the caller. No exception except OOME is thrown. 4.40 +// NULL if no constraint failed. No exception except OOME is thrown. 4.41 // Arrays are not added to the loader constraint table, their elements are. 4.42 -char* SystemDictionary::check_signature_loaders(Symbol* signature, 4.43 +Symbol* SystemDictionary::check_signature_loaders(Symbol* signature, 4.44 Handle loader1, Handle loader2, 4.45 bool is_method, TRAPS) { 4.46 // Nothing to do if loaders are the same. 4.47 @@ -2196,14 +2210,12 @@ 4.48 return NULL; 4.49 } 4.50 4.51 - ResourceMark rm(THREAD); 4.52 SignatureStream sig_strm(signature, is_method); 4.53 while (!sig_strm.is_done()) { 4.54 if (sig_strm.is_object()) { 4.55 - Symbol* s = sig_strm.as_symbol(CHECK_NULL); 4.56 - Symbol* sig = s; 4.57 + Symbol* sig = sig_strm.as_symbol(CHECK_NULL); 4.58 if (!add_loader_constraint(sig, loader1, loader2, THREAD)) { 4.59 - return sig->as_C_string(); 4.60 + return sig; 4.61 } 4.62 } 4.63 sig_strm.next();
5.1 --- a/src/share/vm/classfile/systemDictionary.hpp Wed Apr 03 09:19:02 2013 +0200 5.2 +++ b/src/share/vm/classfile/systemDictionary.hpp Thu Apr 04 19:07:32 2013 +0200 5.3 @@ -483,8 +483,8 @@ 5.4 // Check class loader constraints 5.5 static bool add_loader_constraint(Symbol* name, Handle loader1, 5.6 Handle loader2, TRAPS); 5.7 - static char* check_signature_loaders(Symbol* signature, Handle loader1, 5.8 - Handle loader2, bool is_method, TRAPS); 5.9 + static Symbol* check_signature_loaders(Symbol* signature, Handle loader1, 5.10 + Handle loader2, bool is_method, TRAPS); 5.11 5.12 // JSR 292 5.13 // find a java.lang.invoke.MethodHandle.invoke* method for a given signature
6.1 --- a/src/share/vm/interpreter/linkResolver.cpp Wed Apr 03 09:19:02 2013 +0200 6.2 +++ b/src/share/vm/interpreter/linkResolver.cpp Thu Apr 04 19:07:32 2013 +0200 6.3 @@ -458,25 +458,27 @@ 6.4 Handle class_loader (THREAD, resolved_method->method_holder()->class_loader()); 6.5 { 6.6 ResourceMark rm(THREAD); 6.7 - char* failed_type_name = 6.8 + Symbol* failed_type_symbol = 6.9 SystemDictionary::check_signature_loaders(method_signature, loader, 6.10 class_loader, true, CHECK); 6.11 - if (failed_type_name != NULL) { 6.12 + if (failed_type_symbol != NULL) { 6.13 const char* msg = "loader constraint violation: when resolving method" 6.14 " \"%s\" the class loader (instance of %s) of the current class, %s," 6.15 - " and the class loader (instance of %s) for resolved class, %s, have" 6.16 + " and the class loader (instance of %s) for the method's defining class, %s, have" 6.17 " different Class objects for the type %s used in the signature"; 6.18 char* sig = Method::name_and_sig_as_C_string(resolved_klass(),method_name,method_signature); 6.19 const char* loader1 = SystemDictionary::loader_name(loader()); 6.20 char* current = InstanceKlass::cast(current_klass())->name()->as_C_string(); 6.21 const char* loader2 = SystemDictionary::loader_name(class_loader()); 6.22 - char* resolved = InstanceKlass::cast(resolved_klass())->name()->as_C_string(); 6.23 + char* target = InstanceKlass::cast(resolved_method->method_holder()) 6.24 + ->name()->as_C_string(); 6.25 + char* failed_type_name = failed_type_symbol->as_C_string(); 6.26 size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1) + 6.27 - strlen(current) + strlen(loader2) + strlen(resolved) + 6.28 - strlen(failed_type_name); 6.29 + strlen(current) + strlen(loader2) + strlen(target) + 6.30 + strlen(failed_type_name) + 1; 6.31 char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); 6.32 jio_snprintf(buf, buflen, msg, sig, loader1, current, loader2, 6.33 - resolved, failed_type_name); 6.34 + target, failed_type_name); 6.35 THROW_MSG(vmSymbols::java_lang_LinkageError(), buf); 6.36 } 6.37 } 6.38 @@ -520,26 +522,28 @@ 6.39 Handle class_loader (THREAD, resolved_method->method_holder()->class_loader()); 6.40 { 6.41 ResourceMark rm(THREAD); 6.42 - char* failed_type_name = 6.43 + Symbol* failed_type_symbol = 6.44 SystemDictionary::check_signature_loaders(method_signature, loader, 6.45 class_loader, true, CHECK); 6.46 - if (failed_type_name != NULL) { 6.47 + if (failed_type_symbol != NULL) { 6.48 const char* msg = "loader constraint violation: when resolving " 6.49 "interface method \"%s\" the class loader (instance of %s) of the " 6.50 "current class, %s, and the class loader (instance of %s) for " 6.51 - "resolved class, %s, have different Class objects for the type %s " 6.52 + "the method's defining class, %s, have different Class objects for the type %s " 6.53 "used in the signature"; 6.54 char* sig = Method::name_and_sig_as_C_string(resolved_klass(),method_name,method_signature); 6.55 const char* loader1 = SystemDictionary::loader_name(loader()); 6.56 char* current = InstanceKlass::cast(current_klass())->name()->as_C_string(); 6.57 const char* loader2 = SystemDictionary::loader_name(class_loader()); 6.58 - char* resolved = InstanceKlass::cast(resolved_klass())->name()->as_C_string(); 6.59 + char* target = InstanceKlass::cast(resolved_method->method_holder()) 6.60 + ->name()->as_C_string(); 6.61 + char* failed_type_name = failed_type_symbol->as_C_string(); 6.62 size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1) + 6.63 - strlen(current) + strlen(loader2) + strlen(resolved) + 6.64 - strlen(failed_type_name); 6.65 + strlen(current) + strlen(loader2) + strlen(target) + 6.66 + strlen(failed_type_name) + 1; 6.67 char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); 6.68 jio_snprintf(buf, buflen, msg, sig, loader1, current, loader2, 6.69 - resolved, failed_type_name); 6.70 + target, failed_type_name); 6.71 THROW_MSG(vmSymbols::java_lang_LinkageError(), buf); 6.72 } 6.73 } 6.74 @@ -642,12 +646,12 @@ 6.75 Symbol* signature_ref = pool->signature_ref_at(index); 6.76 { 6.77 ResourceMark rm(THREAD); 6.78 - char* failed_type_name = 6.79 + Symbol* failed_type_symbol = 6.80 SystemDictionary::check_signature_loaders(signature_ref, 6.81 ref_loader, sel_loader, 6.82 false, 6.83 CHECK); 6.84 - if (failed_type_name != NULL) { 6.85 + if (failed_type_symbol != NULL) { 6.86 const char* msg = "loader constraint violation: when resolving field" 6.87 " \"%s\" the class loader (instance of %s) of the referring class, " 6.88 "%s, and the class loader (instance of %s) for the field's resolved " 6.89 @@ -656,8 +660,9 @@ 6.90 const char* loader1 = SystemDictionary::loader_name(ref_loader()); 6.91 char* sel = InstanceKlass::cast(sel_klass())->name()->as_C_string(); 6.92 const char* loader2 = SystemDictionary::loader_name(sel_loader()); 6.93 + char* failed_type_name = failed_type_symbol->as_C_string(); 6.94 size_t buflen = strlen(msg) + strlen(field_name) + strlen(loader1) + 6.95 - strlen(sel) + strlen(loader2) + strlen(failed_type_name); 6.96 + strlen(sel) + strlen(loader2) + strlen(failed_type_name) + 1; 6.97 char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); 6.98 jio_snprintf(buf, buflen, msg, field_name, loader1, sel, loader2, 6.99 failed_type_name);
7.1 --- a/src/share/vm/oops/constMethod.cpp Wed Apr 03 09:19:02 2013 +0200 7.2 +++ b/src/share/vm/oops/constMethod.cpp Thu Apr 04 19:07:32 2013 +0200 7.3 @@ -363,6 +363,26 @@ 7.4 return (AnnotationArray**)constMethod_end() - offset; 7.5 } 7.6 7.7 +// copy annotations from 'cm' to 'this' 7.8 +void ConstMethod::copy_annotations_from(ConstMethod* cm) { 7.9 + if (cm->has_method_annotations()) { 7.10 + assert(has_method_annotations(), "should be allocated already"); 7.11 + set_method_annotations(cm->method_annotations()); 7.12 + } 7.13 + if (cm->has_parameter_annotations()) { 7.14 + assert(has_parameter_annotations(), "should be allocated already"); 7.15 + set_parameter_annotations(cm->parameter_annotations()); 7.16 + } 7.17 + if (cm->has_type_annotations()) { 7.18 + assert(has_type_annotations(), "should be allocated already"); 7.19 + set_type_annotations(cm->type_annotations()); 7.20 + } 7.21 + if (cm->has_default_annotations()) { 7.22 + assert(has_default_annotations(), "should be allocated already"); 7.23 + set_default_annotations(cm->default_annotations()); 7.24 + } 7.25 +} 7.26 + 7.27 // Printing 7.28 7.29 void ConstMethod::print_on(outputStream* st) const {
8.1 --- a/src/share/vm/oops/constMethod.hpp Wed Apr 03 09:19:02 2013 +0200 8.2 +++ b/src/share/vm/oops/constMethod.hpp Thu Apr 04 19:07:32 2013 +0200 8.3 @@ -441,6 +441,9 @@ 8.4 return has_default_annotations() ? default_annotations()->length() : 0; 8.5 } 8.6 8.7 + // Copy annotations from other ConstMethod 8.8 + void copy_annotations_from(ConstMethod* cm); 8.9 + 8.10 // byte codes 8.11 void set_code(address code) { 8.12 if (code_size() > 0) {
9.1 --- a/src/share/vm/oops/klassVtable.cpp Wed Apr 03 09:19:02 2013 +0200 9.2 +++ b/src/share/vm/oops/klassVtable.cpp Thu Apr 04 19:07:32 2013 +0200 9.3 @@ -327,11 +327,11 @@ 9.4 9.5 if (target_loader() != super_loader()) { 9.6 ResourceMark rm(THREAD); 9.7 - char* failed_type_name = 9.8 + Symbol* failed_type_symbol = 9.9 SystemDictionary::check_signature_loaders(signature, target_loader, 9.10 super_loader, true, 9.11 CHECK_(false)); 9.12 - if (failed_type_name != NULL) { 9.13 + if (failed_type_symbol != NULL) { 9.14 const char* msg = "loader constraint violation: when resolving " 9.15 "overridden method \"%s\" the class loader (instance" 9.16 " of %s) of the current class, %s, and its superclass loader " 9.17 @@ -341,6 +341,7 @@ 9.18 const char* loader1 = SystemDictionary::loader_name(target_loader()); 9.19 char* current = _klass->name()->as_C_string(); 9.20 const char* loader2 = SystemDictionary::loader_name(super_loader()); 9.21 + char* failed_type_name = failed_type_symbol->as_C_string(); 9.22 size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1) + 9.23 strlen(current) + strlen(loader2) + strlen(failed_type_name); 9.24 char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); 9.25 @@ -787,12 +788,12 @@ 9.26 Handle method_holder_loader (THREAD, target->method_holder()->class_loader()); 9.27 if (method_holder_loader() != interface_loader()) { 9.28 ResourceMark rm(THREAD); 9.29 - char* failed_type_name = 9.30 + Symbol* failed_type_symbol = 9.31 SystemDictionary::check_signature_loaders(method_signature, 9.32 method_holder_loader, 9.33 interface_loader, 9.34 true, CHECK); 9.35 - if (failed_type_name != NULL) { 9.36 + if (failed_type_symbol != NULL) { 9.37 const char* msg = "loader constraint violation in interface " 9.38 "itable initialization: when resolving method \"%s\" the class" 9.39 " loader (instance of %s) of the current class, %s, " 9.40 @@ -804,6 +805,7 @@ 9.41 char* current = klass->name()->as_C_string(); 9.42 const char* loader2 = SystemDictionary::loader_name(interface_loader()); 9.43 char* iface = InstanceKlass::cast(interf_h())->name()->as_C_string(); 9.44 + char* failed_type_name = failed_type_symbol->as_C_string(); 9.45 size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1) + 9.46 strlen(current) + strlen(loader2) + strlen(iface) + 9.47 strlen(failed_type_name);
10.1 --- a/src/share/vm/oops/method.cpp Wed Apr 03 09:19:02 2013 +0200 10.2 +++ b/src/share/vm/oops/method.cpp Thu Apr 04 19:07:32 2013 +0200 10.3 @@ -1170,6 +1170,8 @@ 10.4 newm->set_stackmap_data(stackmap_data); 10.5 } 10.6 10.7 + // copy annotations over to new method 10.8 + newcm->copy_annotations_from(cm); 10.9 return newm; 10.10 } 10.11
11.1 --- a/src/share/vm/oops/symbol.cpp Wed Apr 03 09:19:02 2013 +0200 11.2 +++ b/src/share/vm/oops/symbol.cpp Thu Apr 04 19:07:32 2013 +0200 11.3 @@ -162,7 +162,7 @@ 11.4 const char *ptr = (const char *)&_body[0]; 11.5 int quoted_length = UTF8::quoted_ascii_length(ptr, utf8_length()); 11.6 char* result = NEW_RESOURCE_ARRAY(char, quoted_length + 1); 11.7 - UTF8::as_quoted_ascii(ptr, result, quoted_length + 1); 11.8 + UTF8::as_quoted_ascii(ptr, utf8_length(), result, quoted_length + 1); 11.9 return result; 11.10 } 11.11
12.1 --- a/src/share/vm/prims/whitebox.cpp Wed Apr 03 09:19:02 2013 +0200 12.2 +++ b/src/share/vm/prims/whitebox.cpp Thu Apr 04 19:07:32 2013 +0200 12.3 @@ -254,6 +254,24 @@ 12.4 CompileBroker::queue_size(CompLevel_full_profile) /* C1 */; 12.5 WB_END 12.6 12.7 +WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString)) 12.8 + ResourceMark rm(THREAD); 12.9 + int len; 12.10 + jchar* name = java_lang_String::as_unicode_string(JNIHandles::resolve(javaString), len); 12.11 + oop found_string = StringTable::the_table()->lookup(name, len); 12.12 + if (found_string == NULL) { 12.13 + return false; 12.14 + } 12.15 + return true; 12.16 +WB_END 12.17 + 12.18 + 12.19 +WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o)) 12.20 + Universe::heap()->collector_policy()->set_should_clear_all_soft_refs(true); 12.21 + Universe::heap()->collect(GCCause::_last_ditch_collection); 12.22 +WB_END 12.23 + 12.24 + 12.25 //Some convenience methods to deal with objects from java 12.26 int WhiteBox::offset_for_field(const char* field_name, oop object, 12.27 Symbol* signature_symbol) { 12.28 @@ -343,6 +361,8 @@ 12.29 CC"(Ljava/lang/reflect/Method;)I", (void*)&WB_GetMethodCompilationLevel}, 12.30 {CC"getCompileQueuesSize", 12.31 CC"()I", (void*)&WB_GetCompileQueuesSize}, 12.32 + {CC"isInStringTable", CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable }, 12.33 + {CC"fullGC", CC"()V", (void*)&WB_FullGC }, 12.34 }; 12.35 12.36 #undef CC
13.1 --- a/src/share/vm/runtime/arguments.cpp Wed Apr 03 09:19:02 2013 +0200 13.2 +++ b/src/share/vm/runtime/arguments.cpp Thu Apr 04 19:07:32 2013 +0200 13.3 @@ -3327,6 +3327,13 @@ 13.4 } 13.5 check_deprecated_gcs(); 13.6 check_deprecated_gc_flags(); 13.7 + if (AssumeMP && !UseSerialGC) { 13.8 + if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) { 13.9 + warning("If the number of processors is expected to increase from one, then" 13.10 + " you should configure the number of parallel GC threads appropriately" 13.11 + " using -XX:ParallelGCThreads=N"); 13.12 + } 13.13 + } 13.14 #else // INCLUDE_ALL_GCS 13.15 assert(verify_serial_gc_flags(), "SerialGC unset"); 13.16 #endif // INCLUDE_ALL_GCS
14.1 --- a/src/share/vm/runtime/globals.hpp Wed Apr 03 09:19:02 2013 +0200 14.2 +++ b/src/share/vm/runtime/globals.hpp Thu Apr 04 19:07:32 2013 +0200 14.3 @@ -457,6 +457,9 @@ 14.4 lp64_product(intx, ObjectAlignmentInBytes, 8, \ 14.5 "Default object alignment in bytes, 8 is minimum") \ 14.6 \ 14.7 + product(bool, AssumeMP, false, \ 14.8 + "Instruct the VM to assume multiple processors are available") \ 14.9 + \ 14.10 /* UseMembar is theoretically a temp flag used for memory barrier \ 14.11 * removal testing. It was supposed to be removed before FCS but has \ 14.12 * been re-added (see 6401008) */ \
15.1 --- a/src/share/vm/runtime/os.hpp Wed Apr 03 09:19:02 2013 +0200 15.2 +++ b/src/share/vm/runtime/os.hpp Thu Apr 04 19:07:32 2013 +0200 15.3 @@ -180,7 +180,7 @@ 15.4 // Interface for detecting multiprocessor system 15.5 static inline bool is_MP() { 15.6 assert(_processor_count > 0, "invalid processor count"); 15.7 - return _processor_count > 1; 15.8 + return _processor_count > 1 || AssumeMP; 15.9 } 15.10 static julong available_memory(); 15.11 static julong physical_memory();
16.1 --- a/src/share/vm/services/memTracker.hpp Wed Apr 03 09:19:02 2013 +0200 16.2 +++ b/src/share/vm/services/memTracker.hpp Thu Apr 04 19:07:32 2013 +0200 16.3 @@ -86,13 +86,13 @@ 16.4 16.5 static inline void set_autoShutdown(bool value) { } 16.6 static void shutdown(ShutdownReason reason) { } 16.7 - static inline bool shutdown_in_progress() { } 16.8 + static inline bool shutdown_in_progress() { return false; } 16.9 static bool print_memory_usage(BaselineOutputer& out, size_t unit, 16.10 - bool summary_only = true) { } 16.11 + bool summary_only = true) { return false; } 16.12 static bool compare_memory_usage(BaselineOutputer& out, size_t unit, 16.13 - bool summary_only = true) { } 16.14 + bool summary_only = true) { return false; } 16.15 16.16 - static bool wbtest_wait_for_data_merge() { } 16.17 + static bool wbtest_wait_for_data_merge() { return false; } 16.18 16.19 static inline void sync() { } 16.20 static inline void thread_exiting(JavaThread* thread) { }
17.1 --- a/src/share/vm/utilities/utf8.cpp Wed Apr 03 09:19:02 2013 +0200 17.2 +++ b/src/share/vm/utilities/utf8.cpp Thu Apr 04 19:07:32 2013 +0200 17.3 @@ -1,5 +1,5 @@ 17.4 /* 17.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 17.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 * 17.9 * This code is free software; you can redistribute it and/or modify it 17.10 @@ -180,11 +180,12 @@ 17.11 } 17.12 17.13 // converts a utf8 string to quoted ascii 17.14 -void UTF8::as_quoted_ascii(const char* utf8_str, char* buf, int buflen) { 17.15 +void UTF8::as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int buflen) { 17.16 const char *ptr = utf8_str; 17.17 + const char *utf8_end = ptr + utf8_length; 17.18 char* p = buf; 17.19 char* end = buf + buflen; 17.20 - while (*ptr != '\0') { 17.21 + while (ptr < utf8_end) { 17.22 jchar c; 17.23 ptr = UTF8::next(ptr, &c); 17.24 if (c >= 32 && c < 127) { 17.25 @@ -196,6 +197,7 @@ 17.26 p += 6; 17.27 } 17.28 } 17.29 + assert(p < end, "sanity"); 17.30 *p = '\0'; 17.31 } 17.32
18.1 --- a/src/share/vm/utilities/utf8.hpp Wed Apr 03 09:19:02 2013 +0200 18.2 +++ b/src/share/vm/utilities/utf8.hpp Thu Apr 04 19:07:32 2013 +0200 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -45,7 +45,7 @@ 18.11 static int quoted_ascii_length(const char* utf8_str, int utf8_length); 18.12 18.13 // converts a utf8 string to quoted ascii 18.14 - static void as_quoted_ascii(const char* utf8_str, char* buf, int buflen); 18.15 + static void as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int buflen); 18.16 18.17 // converts a quoted ascii string to utf8 string. returns the original 18.18 // string unchanged if nothing needs to be done.
19.1 --- a/test/runtime/7116786/Test7116786.java Wed Apr 03 09:19:02 2013 +0200 19.2 +++ b/test/runtime/7116786/Test7116786.java Thu Apr 04 19:07:32 2013 +0200 19.3 @@ -1,5 +1,5 @@ 19.4 /* 19.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 19.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 19.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.8 * 19.9 * This code is free software; you can redistribute it and/or modify it 19.10 @@ -338,9 +338,12 @@ 19.11 "invalid constant pool index in ldc", 19.12 "Invalid index in ldc"), 19.13 19.14 - new Case("case58", "verifier.cpp", true, "verify_switch", 19.15 + /* No longer a valid test case for bytecode version >= 51. Nonzero 19.16 + * padding bytes are permitted with lookupswitch and tableswitch 19.17 + * bytecodes as of JVMS 3d edition */ 19.18 + new Case("case58", "verifier.cpp", false, "verify_switch", 19.19 "bad switch padding", 19.20 - "Nonzero padding byte in lookswitch or tableswitch"), 19.21 + "Nonzero padding byte in lookupswitch or tableswitch"), 19.22 19.23 new Case("case59", "verifier.cpp", true, "verify_switch", 19.24 "tableswitch low is greater than high",
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/runtime/interned/SanityTest.java Thu Apr 04 19:07:32 2013 +0200 20.3 @@ -0,0 +1,59 @@ 20.4 +/* 20.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 + * 20.8 + * This code is free software; you can redistribute it and/or modify it 20.9 + * under the terms of the GNU General Public License version 2 only, as 20.10 + * published by the Free Software Foundation. 20.11 + * 20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.15 + * version 2 for more details (a copy is included in the LICENSE file that 20.16 + * accompanied this code). 20.17 + * 20.18 + * You should have received a copy of the GNU General Public License version 20.19 + * 2 along with this work; if not, write to the Free Software Foundation, 20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.21 + * 20.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20.23 + * or visit www.oracle.com if you need additional information or have any 20.24 + * questions. 20.25 + */ 20.26 + 20.27 +/* 20.28 + * @test SanityTest 20.29 + * @summary Sanity check of String.intern() & GC 20.30 + * @library /testlibrary /testlibrary/whitebox 20.31 + * @build SanityTest 20.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 20.33 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SanityTest 20.34 + */ 20.35 + 20.36 +import java.util.*; 20.37 +import sun.hotspot.WhiteBox; 20.38 + 20.39 + 20.40 +public class SanityTest { 20.41 + public static Object tmp; 20.42 + public static void main(String... args) { 20.43 + 20.44 + WhiteBox wb = WhiteBox.getWhiteBox(); 20.45 + StringBuilder sb = new StringBuilder(); 20.46 + sb.append("1234x"); sb.append("x56789"); 20.47 + String str = sb.toString(); 20.48 + 20.49 + if (wb.isInStringTable(str)) { 20.50 + throw new RuntimeException("String " + str + " is already interned"); 20.51 + } 20.52 + str.intern(); 20.53 + if (!wb.isInStringTable(str)) { 20.54 + throw new RuntimeException("String " + str + " is not interned"); 20.55 + } 20.56 + str = sb.toString(); 20.57 + wb.fullGC(); 20.58 + if (wb.isInStringTable(str)) { 20.59 + throw new RuntimeException("String " + str + " is in StringTable even after GC"); 20.60 + } 20.61 + } 20.62 +}
21.1 --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Wed Apr 03 09:19:02 2013 +0200 21.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Thu Apr 04 19:07:32 2013 +0200 21.3 @@ -94,4 +94,10 @@ 21.4 public native int getMethodCompilationLevel(Method method); 21.5 public native boolean setDontInlineMethod(Method method, boolean value); 21.6 public native int getCompileQueuesSize(); 21.7 + 21.8 + //Intered strings 21.9 + public native boolean isInStringTable(String str); 21.10 + 21.11 + // force Full GC 21.12 + public native void fullGC(); 21.13 }