# HG changeset patch # User kvn # Date 1342226906 25200 # Node ID ed21db7b3fdafc75af74952cff33af18f17b3067 # Parent 6d8f36bcef55bbfd74564be8ccc12781429851f9 7123926: Some CTW test crash: !_control.contains(ctrl) Summary: Don't eliminate Integer::toString() call node during String concatenation optimization if it has several uses. Reviewed-by: twisti diff -r 6d8f36bcef55 -r ed21db7b3fda src/share/vm/opto/stringopts.cpp --- a/src/share/vm/opto/stringopts.cpp Thu Jul 12 00:39:53 2012 -0700 +++ b/src/share/vm/opto/stringopts.cpp Fri Jul 13 17:48:26 2012 -0700 @@ -533,7 +533,17 @@ if (arg->is_Proj() && arg->in(0)->is_CallStaticJava()) { CallStaticJavaNode* csj = arg->in(0)->as_CallStaticJava(); if (csj->method() != NULL && - csj->method()->intrinsic_id() == vmIntrinsics::_Integer_toString) { + csj->method()->intrinsic_id() == vmIntrinsics::_Integer_toString && + arg->outcnt() == 1) { + // _control is the list of StringBuilder calls nodes which + // will be replaced by new String code after this optimization. + // Integer::toString() call is not part of StringBuilder calls + // chain. It could be eliminated only if its result is used + // only by this SB calls chain. + // Another limitation: it should be used only once because + // it is unknown that it is used only by this SB calls chain + // until all related SB calls nodes are collected. + assert(arg->unique_out() == cnode, "sanity"); sc->add_control(csj); sc->push_int(csj->in(TypeFunc::Parms)); continue;