Request for reviews (XS): 7123926: Some CTW test crash: !_control.contains(ctrl)

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Jul 5 19:38:57 PDT 2012


Thank you, Kris

Krystal Mok wrote:
> Hi Vladimir,
> 
> foo(Integer intobj) {
>   String intstr = intobj.toString();
>   String str = intstr + ", " + intstr;
> 
> What should be the desired behavior for the case above?
> Is it all right to skip all Integer.toString() calls, and let later 
> optimizations handle it?

You have only one toString() call. And it will be kept because it is referenced 
by debug info which is copied from SB constructor to new char[] constructor 
(AllocateArray node). It is needed for deoptimization since the bytecode will be 
executed after that call.

The next code is the case when Integer.toString() will be eliminated by later 
optimizations:

   StringBuilder sb = new StringBuilder();
   String intstr = intobj.toString();
   String str = sb.append(intstr).append(intstr).toString();

I also applied your uncast() suggestion in argument_uncast() method.

And I fixed typos.

Thanks,
Vladimir

> 
> And, two typos:
> 
> 541               // chain. It's node could be eliminated only if it's 
> result
> 
> It's -> Its. Other occurrences of "it's" should also be replaced with "its".
> 
> 543               // An other limitation: it should be used only once 
> because
> 
> An other -> Another.
> 
> - Kris
> 
> On Fri, Jul 6, 2012 at 4:37 AM, Vladimir Kozlov 
> <vladimir.kozlov at oracle.com <mailto:vladimir.kozlov at oracle.com>> wrote:
> 
>     Vladimir Kozlov wrote:
> 
>         http://cr.openjdk.java.net/~__kvn/7123926/webrev
>         <http://cr.openjdk.java.net/~kvn/7123926/webrev>
> 
>         7123926: Some CTW test crash: !_control.contains(ctrl)
> 
>         Don't try to eliminate Integer::toString() call node during
>         String concatenation optimization if it's result has several uses.
> 
>         Eliminate case:
>           foo (Integer intob) {
>             String str = "int: " + intobj;
> 
>         Keep case:
>           foo (Integer intob) {
>             String intstr = intobj.toString();
>             String str = "int: " + intobj; // second use is in SB
>         allocation
> 
> 
>     Sorry, it should be: "int: " + intstr;
> 
>     Vladimir
> 
> 
>         debug info
> 
>         Tested with failed test.
> 
>         Thanks,
>         Vladimir
> 
> 


More information about the hotspot-compiler-dev mailing list