RFR (S) 8150180: String.value contents should be trusted

John Rose john.r.rose at oracle.com
Fri Feb 19 19:03:53 UTC 2016


On Feb 19, 2016, at 9:57 AM, Christian Thalinger <christian.thalinger at oracle.com> wrote:
> 
> Why don’t you change the values to:
> 
>    static final byte LATIN1 = 1;
>    static final byte UTF16  = 2;


Not sure what you are asking, but here's my take on why 0,1 is the (slight) winner.
The values 0,1 are the log2 of the array element sizes 1,2, so they can be used with shift instructions.
With 1,2 they would have to be used with multiply instructions, or else tweaked back to shift inputs.
Most loops will speculate on the scale factor, but those loops which must work with a non-constant scale will be slightly cleaner with 0,1.

— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20160219/52b8b5fe/attachment.html>


More information about the hotspot-compiler-dev mailing list