Re: Helpers for MethodHandles.byteArrayViewVarHandle VarHandle

2016-05-19 Thread Jaroslav Kameník
> > I meant change the shape of the VarHandle produced by: > > MethodHandles.byteArrayViewVarHandle > MethodHandles.byteBufferViewVarHandle > Aaaha:) I must say, one reason, why I'd like to have it wrapped is that VarHandle.get/set do not have fixed typed signature. Helper.longAt(arr, index)

Re: Helpers for MethodHandles.byteArrayViewVarHandle VarHandle

2016-05-19 Thread Jaroslav Kameník
> > > There certainly is in nio buffer sources (and may be for encoding/decoding > in other areas, i am speculating as i have not looked), but for buffer > sources we can actually remove much if not all of Bits.java via use of the > internal Unsafe unaligned accessors. > I made some notes when I

Re: Helpers for MethodHandles.byteArrayViewVarHandle VarHandle

2016-05-18 Thread Jaroslav Kameník
Hi, thank you for response! > I would prefer not to spread such functionality beyond that of ByteBuffer > and the VarHandle producing methods on MethodHandles. It’s an advanced > feature so think ok if less visible. > > On the other side, this would be easier to use and understand than

Helpers for MethodHandles.byteArrayViewVarHandle VarHandle

2016-05-16 Thread Jaroslav Kameník
Hi, what do you thing about adding helper methods for this kind of VarHandle? It would be nice to have something like Long.getFrom[LE/BE](byte[] arr, int index) // LE/BE -> endianity Long.setTo[LE/BE](long val, byte[] arr, int index) or Arrays.getLongFrom[LE/BE](byte[] arr, int

Re: RFR: 8155795: Optimize Integer/Long.reverse by using reverseBytes

2016-05-09 Thread Jaroslav Kameník
Hi guys, I have looked at generated asm, it does not seem there is problem, only little different order of shifts and ands.. Plus, at haswell, times do not differ so much. Here are different parts: Slower version: 057 sallR10, #24 05b movlR11, RAX# spill 05e sall

Re: RFR: 8155795: Optimize Integer/Long.reverse by using reverseBytes

2016-05-02 Thread Jaroslav Kameník
:00 GMT+02:00 Claes Redestad <claes.redes...@oracle.com>: > On 2016-05-02 16:48, Aleksey Shipilev wrote: > >> On 05/02/2016 05:07 PM, Claes Redestad wrote: >> >>> I'd like to sponsor this patch proposed by Jaroslav Kameník here: >>> >>> http:/

Re: Integer/Long reverse bits optimization

2016-04-29 Thread Jaroslav Kameník
n 2016-04-29 13:36, Jaroslav Kameník wrote: > >> Hello! >> >> I have a small patch to Integer and Long classes, which is speeding up bit >> reversion significantly. >> >> Last two/three steps of bit reversion are doing byte reversion, so there >> is

Integer/Long reverse bits optimization

2016-04-29 Thread Jaroslav Kameník
Hello! I have a small patch to Integer and Long classes, which is speeding up bit reversion significantly. Last two/three steps of bit reversion are doing byte reversion, so there is possibility to use intrinsified method reverseBytes. Java implementation of reverseBytes is similar to those