Short/Character.reverseBytes intrinsics

Christian Thalinger Christian.Thalinger at Sun.COM
Thu Apr 15 07:25:29 PDT 2010


On Tue, 2010-04-13 at 12:11 -0700, Hiroshi Yamauchi wrote:
> Hi there,
> 
> I'd like to contribute this patch that implements the intrinsics for
> Short/Character.reverseBytes (in C2):
> 
>   http://cr.openjdk.java.net/~rasbold/reversebytes/webrev.01/          (Patch 1)
> 
> (Thanks to Chuck for reviewing it and creating the webrev on my behalf.)
> 
> This adds new siblings for the existing Integer/Long.reverseBytes
> intrinsics. Note: I did my best for the sparc implementation
> (sparc.ad) but haven't been able to build or test it (I don't have
> access to a sparc machine.)

The changes look good.  Just a few comments:

src/cpu/sparc/vm/sparc.ad (loadC_reversed, loadS_reversed):

9764   ins_cost(MEMORY_REF_COST);
9780   ins_cost(MEMORY_REF_COST);

Why are you using MEMORY_REF_COST only when e.g. loadI_reversed uses:

9738   ins_cost(DEFAULT_COST + MEMORY_REF_COST);

What about copyright?  If you're not adding some Google copyright line
we should at least bump the year in Sun's line.

I personally would prefer to use US (unsigned short) instead of C (char)
in class and method names since we renamed LoadC to LoadUS some time
ago.

-- Christian



More information about the hotspot-compiler-dev mailing list