Escape Analysis and arrays

P. Thio Paul.Thio at
Sat Nov 27 04:28:40 PST 2010

Here's is a case for Escape Analysis.  When a array of a primitive type is indexed by a variable, the allocation of the array is no longer optimized. A small test case is attached. There are two similar programs. The main difference is:

<             s += b[i];
>             switch (i) {
>                 case 0: s += b[0]; break;
>                 case 1: s += b[1]; break;
>                 case 2: s += b[2]; break;
>                 case 3: s += b[3]; break;
>                 case 4: s += b[4]; break;
>                 case 5: s += b[5]; break;
>             }

For the second program the array allocation is eliminated. A log with more information and the Assembly output are included.
Can for the first program the array allocation be optimized as well ?


The information in this e-mail is intended only for the person or entity to which it is addressed.

It may contain confidential and /or privileged material. If someone other than the intended recipient should receive this e-mail, he / she shall not be entitled to read, disseminate, disclose or duplicate it.

If you receive this e-mail unintentionally, please inform us immediately by "reply" and then delete it from your system. Although this information has been compiled with great care, neither IMC Financial Markets & Asset Management nor any of its related entities shall accept any responsibility for any errors, omissions or other inaccuracies in this information or for the consequences thereof, nor shall it be bound in any way by the contents of this e-mail or its attachments. In the event of incomplete or incorrect transmission, please return the e-mail to the sender and permanently delete this message and any attachments.

Messages and attachments are scanned for all known viruses. Always scan attachments before opening them.
-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: files.tar
Type: application/x-tar
Size: 71680 bytes
Desc: not available
Url : 

More information about the hotspot-compiler-dev mailing list