RFR (S) : 8014362 : Need to expose some processor features via Unsafe interface
David Chase
david.r.chase at oracle.com
Fri May 10 13:33:06 PDT 2013
WEBREV:
http://cr.openjdk.java.net/~drchase/8014362/webrev.00/
PROBLEM:
Bug 7088419 Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32 and java.util.zip.Adler32
can profitably (if Intel docs are to be believed) be addressed using the
PCLMULQDQ - Carry-Less Multiplication Quadword
instruction.
However, this instruction is not available on all Intel processors, so the code in java.util.zip, either the Java or the JNI code that it calls, needs to know if the instruction is available, and also whether it has been disabled on the command line. The least-ugly way of doing this appears to be to expose the UseCLMUL flag via an Unsafe intrinsic.
I considered instead passing the result of cpu_features(), however this is not affected by the command line flags disabling use of these features by hotspot.
FIX:
1) add a bit to cpuFeatureFlags for CLMUL.
2) expose the CLMUL bit in StdCpuid1Ecx
3) add a flag (in the style of UseAES)
4) add an unsafe intrinsic.
And connect all those dots.
The unsafe interface returns UseAVX and UseCLMUL because both are necessary to obtain the 3-operand version of the CLMUL instruction.
TESTING:
no organized testing yet, it seemed better to get comment on the various style issues first.
It has been informally tested quite a lot in other work on 7088419.
More information about the hotspot-compiler-dev
mailing list