RFR: 8260617: Merge ZipFile encoding check with the initial hash calculation

Claes Redestad redestad at openjdk.java.net
Fri Jan 29 09:56:57 UTC 2021

- Merge checkEncoding into the byte[]-based normalizedHash. The latter is only used from ZipFile.initCEN right after the checkEncoding today, so verifying this is equivalent is straightforward.
- Factor out the logic to calculate hash, check encoding etc into the addEntry method to allow JITs to chew off larger chunks of the logic early on

Roughly 1.2x speedup on the JarFileMeta microbenchmarks, which include the time required to open the jar file and thus exercising the optimized code.

Testing: tier1-4


Commit messages:
 - Refactor ZipFile.initCEN, merging checkEncoding and normalizedHash

Changes: https://git.openjdk.java.net/jdk/pull/2306/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2306&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8260617
  Stats: 132 lines in 2 files changed: 31 ins; 68 del; 33 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2306.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2306/head:pull/2306

PR: https://git.openjdk.java.net/jdk/pull/2306

More information about the core-libs-dev mailing list