Question: "backwards" adressing

Christian Thalinger Christian.Thalinger at Sun.COM
Mon Aug 24 05:40:29 PDT 2009


Ulf Zibis wrote:
> Hi Christian,
> 
> can you give a hint, if following code from Character class is 
> potentially slower after hotspot compile as if it would be coded 
> "forwards" ?
> 
>     static void toSurrogates(int codePoint, char[] dst, int index) {
>         // We write elements "backwards" to guarantee all-or-nothing // 
> TODO: isn't forward faster ?
>         dst[index+1] = lowSurrogate(codePoint);
>         dst[index] = highSurrogate(codePoint);
>     }

I don't see a reason why it should.  What would you expect the compiler
to do when it would be coded "forwards"?

-- Christian


More information about the hotspot-compiler-dev mailing list