Processor support for select operations

Aleksey Shipilev aleksey.shipilev at oracle.com
Tue Nov 11 13:27:07 UTC 2014


Hi Paul,

On 11.11.2014 11:33, Paul Elschot wrote:
> He also pointed to some recent discussions here on the use of bit
> operations to implement an IndexSetIterator, so you may be interested
> because of that.

Notice we are using lookup tables there instead of sophisticated math
there. In fact, we would like to use TZCNT/LZCNT and friends, but it is
hard to do in a cross-platform way from C++ code.


> This was the question, also somewhat off topic here:
> 
> For LUCENE-6040 it would be good to have better processor support for
> selecting the i-th set bit from a 64-bit integer.

I would say this is an offtopic for this list. People on this list are
not hardware people.


> Not too long ago Long.bitCount() was intrinsified in JVM's.

As well as countLeadingZeros/countTrailingZeros, on platforms where
LZCNT/TZCNT are available. You can probably use that to enumerate bits
in a Integer/Long faster.


> I hope something similar will happen to a select(long x, int i)
> method. However, better processor support is needed first.

What method are referring to? We can only safely intrinsify methods with
clear and stable semantics, i.e. those in standard library. I don't see
any, and so I guess the very first thing to do is prototype the Java
function like that in, say, java.lang.Long.

-Aleksey.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20141111/74001886/signature-0001.asc>


More information about the hotspot-compiler-dev mailing list