1.1 --- a/src/share/vm/opto/stringopts.cpp Wed Sep 22 21:10:46 2010 -0700 1.2 +++ b/src/share/vm/opto/stringopts.cpp Wed Sep 22 23:51:03 2010 -0700 1.3 @@ -75,8 +75,7 @@ 1.4 for (SimpleDUIterator i(endprojs.resproj); i.has_next(); i.next()) { 1.5 CallStaticJavaNode *use = i.get()->isa_CallStaticJava(); 1.6 if (use != NULL && use->method() != NULL && 1.7 - use->method()->holder() == C->env()->String_klass() && 1.8 - use->method()->name() == ciSymbol::object_initializer_name() && 1.9 + use->method()->intrinsic_id() == vmIntrinsics::_String_String && 1.10 use->in(TypeFunc::Parms + 1) == endprojs.resproj) { 1.11 // Found useless new String(sb.toString()) so reuse the newly allocated String 1.12 // when creating the result instead of allocating a new one. 1.13 @@ -394,7 +393,9 @@ 1.14 Node* constructor = NULL; 1.15 for (SimpleDUIterator i(result); i.has_next(); i.next()) { 1.16 CallStaticJavaNode *use = i.get()->isa_CallStaticJava(); 1.17 - if (use != NULL && use->method() != NULL && 1.18 + if (use != NULL && 1.19 + use->method() != NULL && 1.20 + !use->method()->is_static() && 1.21 use->method()->name() == ciSymbol::object_initializer_name() && 1.22 use->method()->holder() == m->holder()) { 1.23 // Matched the constructor. 1.24 @@ -444,7 +445,8 @@ 1.25 } 1.26 } else if (cnode->method() == NULL) { 1.27 break; 1.28 - } else if (cnode->method()->holder() == m->holder() && 1.29 + } else if (!cnode->method()->is_static() && 1.30 + cnode->method()->holder() == m->holder() && 1.31 cnode->method()->name() == ciSymbol::append_name() && 1.32 (cnode->method()->signature()->as_symbol() == string_sig || 1.33 cnode->method()->signature()->as_symbol() == char_sig || 1.34 @@ -459,8 +461,7 @@ 1.35 if (arg->is_Proj() && arg->in(0)->is_CallStaticJava()) { 1.36 CallStaticJavaNode* csj = arg->in(0)->as_CallStaticJava(); 1.37 if (csj->method() != NULL && 1.38 - csj->method()->holder() == C->env()->Integer_klass() && 1.39 - csj->method()->name() == ciSymbol::toString_name()) { 1.40 + csj->method()->intrinsic_id() == vmIntrinsics::_Integer_toString) { 1.41 sc->add_control(csj); 1.42 sc->push_int(csj->in(TypeFunc::Parms)); 1.43 continue; 1.44 @@ -537,9 +538,8 @@ 1.45 if (arg->is_Proj() && arg->in(0)->is_CallStaticJava()) { 1.46 CallStaticJavaNode* csj = arg->in(0)->as_CallStaticJava(); 1.47 if (csj->method() != NULL && 1.48 - (csj->method()->holder() == C->env()->StringBuffer_klass() || 1.49 - csj->method()->holder() == C->env()->StringBuilder_klass()) && 1.50 - csj->method()->name() == ciSymbol::toString_name()) { 1.51 + (csj->method()->intrinsic_id() == vmIntrinsics::_StringBuilder_toString || 1.52 + csj->method()->intrinsic_id() == vmIntrinsics::_StringBuffer_toString)) { 1.53 for (int o = 0; o < concats.length(); o++) { 1.54 if (c == o) continue; 1.55 StringConcat* other = concats.at(o);