Short/Character.reverseBytes intrinsics

Hiroshi Yamauchi yamauchi at google.com
Tue Apr 27 10:29:28 PDT 2010


Tom,

Thanks. It looks like it's been checked in.

  http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/d7f654633cfe

Now, Martin and Ulf, the following patch is up to you:

  http://cr.openjdk.java.net/~martin/webrevs/openjdk7/nioBits.java/

Hiroshi

On Thu, Apr 22, 2010 at 4:15 PM, Tom Rodriguez <tom.rodriguez at oracle.com> wrote:
> Resending because of bounce.
>
> On Apr 22, 2010, at 3:22 PM, Hiroshi Yamauchi wrote:
>
>> Thanks, Tom. It looks good to me.
>
> Thanks.
>
>>
>>> This is Hiroshi's patch for reverseShort and reverseChar intrinsics.
>>> I've redone the sparc implementation and fixed bugs in the original
>>> implementation as well.  The existing versions were broken with
>>> implicit null checking since implicit null checks assume that the
>>> faulting load is the first instruction in the node but because of the
>>> way the memory was being handled it wasn't.  The first instruction was
>>> actually an add so if an implicit null happened the JVM would die.
>>> The new code restricts these forms to use reg+reg addressing only so
>>> any address math is handled automatically.  Tested with new test case
>>
>> I must have overlooked the '+2' offset in the stackSlotI (in
>> bytes_reverse_unsigned_short/bytes_reverse_short.)
>
> It showed up in testing of course.  I didn't notice it before that.
>
>> I'm just curious but I'm not sure who emits the add instruction. One
>> instruction that can be emitted before the load instruction (and that
>> I can see) is:
>>
>> 949     emit3_simm13( cbuf, Assembler::arith_op, index,
>> Assembler::or_op3, 0, disp);
>>
>> emitted by the now-removed emit_form3_mem_reg_asi(). But it's an or,
>> not an add. There may be some code emission that I don't see.
>
> That code was doing or g0, simm13, o7.  On sparc both add and or can be used for the constant formation idiom though you decompose the constant differently when sethi is involved since it does 22 bits and the others do 13 so they overlap.  sethi hi22, r or r, simm13, r always works but an add has to operate on the low 10 bits.
>
> tom
>
>>
>> Hiroshi
>
>


More information about the hotspot-compiler-dev mailing list