3

I'm very curious regarding Java intrinsics methods. At the moment, there are only a few ways to find some method is intrinsic or not:

  • Check Java sources
  • Find @HotSpotIntrinsicCandidate annotation within JDK classes
  • Or use printed by @apangin list.

I was wondering - if there some official documentation with the explanation to every intrinsic and motivation for it?

Dmitriy Dumanskiy
  • 11,657
  • 9
  • 37
  • 57
  • 4
    Intrinsics are 100% determined by individual compilers, because the java source does not say anything about whether or not a compiler will *actually* use an intrinsic or not. So 1) pick the exact compiler (down to the build number) and then 2) the answer is in that specific compiler's codebase. For example, your link is about what OpenJDK does. That list in no way corresponds to what another compiler will do. – Mike 'Pomax' Kamermans May 05 '18 at 08:33
  • 2
    Here is example of motivation why `Integer.bitCount` is intrinsic: https://stackoverflow.com/a/19892384/5221149. The motivation for most of the intrinsic methods is likely the same, i.e. the CPU has a special instruction that is faster than the generic Java code is. Which of course means that the list of intrinsic methods would depend on the CPU architecture used. – Andreas May 05 '18 at 09:14

0 Answers0