RFR: 8314294: Unsafe::allocateMemory and Unsafe::freeMemory are slower than malloc/free

David Holmes dholmes at openjdk.org
Fri Sep 29 06:55:40 UTC 2023


To increase performance by avoiding a thread-state transition (native -> in_vm) we change the three "raw" allocation functions in Unsafe to be UNSAFE_LEAF rather than UNSAFE_ENTRY.

It is hard to track through all the related code to prove this is a safe change, but I could not spot anything obvious and testing indicated no issues (my main concern was potential missing WXWrite on macOS Aarch64).

Testing:
  - tiers 1-7 on linux and macos x64 and Aarch64, plus Windows x64

Thanks

-------------

Commit messages:
 - 8314294: Unsafe::allocateMemory and Unsafe::freeMemory are slower than malloc/free

Changes: https://git.openjdk.org/jdk/pull/15977/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15977&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8314294
  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/15977.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15977/head:pull/15977

PR: https://git.openjdk.org/jdk/pull/15977


More information about the hotspot-dev mailing list