RFR: 8287809: Revisit implementation of memory session [v3]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Jun 15 17:52:31 UTC 2022


> This is a cleanup of the memory session implementation. The main new concept is that `MemorySessionImpl` is split into two parts: there is an implementation of memory session and then there is a state abstraction (`MemorySessionImpl.State`). This allows to share the state across multiple session views, in a more clean way. The big consequence of this change is that the routines on `ScopedMemoryAccess` now have to be defined in terms of the state abstraction (but the changes are mostly mechanical).
> 
> I have consolidated the implementation quite a bit, by removing all the duplicated logic for issuing similar-looking exceptions. I have also addressed an issue with `checkValidState` throwing a _new_ `WrongThreadException` instead of using a singleton (which is what the logic for closing down shared session requires, to avoid stack walks that are too deep).
> 
> `MemorySession.State::checkValidState` is now fully monomorphic; when looking at benchmarks, this seems to be the best solution in order to make things fast. Specializing implmentations to remove few plain checks does not buy enough, and always has the risk of adding profile pollution.

Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:

  Address review comments

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/9017/files
  - new: https://git.openjdk.org/jdk/pull/9017/files/5b8f7246..67710665

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=9017&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9017&range=01-02

  Stats: 17 lines in 3 files changed: 0 ins; 0 del; 17 mod
  Patch: https://git.openjdk.org/jdk/pull/9017.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9017/head:pull/9017

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


More information about the security-dev mailing list