java - AES-NI intrinsics enabled by default? -


oracle has java 8 regards aes-ni:

hardware intrinsics added use advanced encryption standard (aes). useaes , useaesintrinsics flags available enable hardware-based aes intrinsics intel hardware. hardware must 2010 or newer westmere hardware. example, enable hardware aes, use following flags:

-xx:+useaes -xx:+useaesintrinsics 

to disable hardware aes use following flags:

-xx:-useaes -xx:-useaesintrinsics 

but not indicate if aes intrinsics enabled default (for processors support it). question simple: if processor supports aes-ni, aes intrinsics used?

bonus question: there way test if aes-ni being used? guess can guess based on performance, that's not optimal or sure fire way of testing.


for readers not familiar aes-ni intrinsics: it's replacing byte code pre-compiled machine code, using aes-ni instruction set. happens jvm, not show in api of java runtime or bytecode.

the flag has default of true , set false if detection fails, can use +printflagsfinal see if used:

my laptop without aes-ni:

c:\>"c:\program files\java\jdk1.7.0_51\bin\java" -xx:+printflagsfinal -version | find "useaes"      bool useaes                                    = false           {product}      bool useaesintrinsics                          = false           {product} java version "1.7.0_51" java(tm) se runtime environment (build 1.7.0_51-b13) java hotspot(tm) 64-bit server vm (build 24.51-b03, mixed mode) 

same on desktop with aes-ni:

c:\>"c:\program files\java\jdk7\bin\java" -xx:+printflagsfinal -version | find "aes"      bool useaes                                    = true            {product}      bool useaesintrinsics                          = true            {product}  java version "1.7.0_51" java(tm) se runtime environment (build 1.7.0_51-b13) java hotspot(tm) 64-bit server vm (build 24.51-b03, mixed mode)  c:\>"c:\program files (x86)\java\jre7\bin\java" -xx:+printflagsfinal -version | find "aes"      bool useaes                                    = true            {product}      bool useaesintrinsics                          = true            {product}  java version "1.7.0_51" java(tm) se runtime environment (build 1.7.0_51-b13) java hotspot(tm) client vm (build 24.51-b03, mixed mode, sharing) 

so, works both x64 , i686 (wow64) recent java 7. feature introduced https://bugs.openjdk.java.net/browse/jdk-7184394 , backported 7u40 , 7u45.


important: aes-ni may available on server vm.

this acknowledged oracle after a bug report filed. vital piece of information missing when created featues list of java 8 introduced (it later got backported 7 well). server vm can explicitly choosen providing -server option on java or javaw command line.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -