Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8256523

Streamline Java SHA2 implementation

XMLWordPrintable

        Current sun/security/provider/SHA2 implementation is written with lots of small method invocations on the fastpath in implCompress0. Normally it does not matter much, because compilers are able to inline through it, and then some compilers even intrinsify the entire implCompress0.

        But it comes as major downside for platforms that do not have SHA2 intrinsics, or that VM configs (like Zero) that blindly interpret the bytecode. Zero, for example, keeps re-entering the small methods when computing SHA2 digests during jmod/jlink generation during the build, and spends significant time there.

        Motivational example:
         - original Linux x86_64 Zero fastdebug build: 18.5 min
         - modified Linux x86_64 Zero fastdebug build: 11.0 min

        Note that SHA1 is already written in similar streamlined style. SHA5 is written with helper functions. This patch moves SHA2 to be closer to SHA1 style-wise.

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: