RFR: 8356126: Duplication handling and optimization of CaptureCallState [v8]

Chen Liang liach at openjdk.org
Tue May 6 20:07:56 UTC 2025


> Credit to @lukellmann that the duplication arg handling in #24742 avoided throwing exceptions but produced a wrong option. This patch fixes that and removed stream usages in CaptureCallState to speed up bootstrap.
> 
> Also, the previous patch affected the toString display of the option; I added a unit test to ensure the option prints names that is user-friendly.
> 
> Another thing I noted is `CapturableState` uses `OperatingSystem`; using `valueOf` brings a performance overhead due to setups with reflection, so I made this lazy. (The enum is thread safe, so we allow racy access to the cache field)
> 
> Testing: jdk/lang/foreign, tier 1-3 in progress.

Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:

 - Simplify to utility class
 - Merge branch 'master' of https://github.com/openjdk/jdk into fix/ffm-opt-capture-states
 - Update src/java.base/share/classes/jdk/internal/foreign/abi/CapturableState.java
   
   Co-authored-by: Shaojin Wen <shaojin.wensj at alibaba-inc.com>
 - Merge branch 'master' of https://github.com/openjdk/jdk into fix/ffm-opt-capture-states
 - Merge branch 'master' of https://github.com/openjdk/jdk into fix/ffm-opt-capture-states
 - rollback OS
 - Review remarks
 - No env to test
   
 - Unchecked
   
 - Further revamp, remove unnecessary instances on irrelevant platforms
   
 - ... and 2 more: https://git.openjdk.org/jdk/compare/83a1ad55...0f495539

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25025/files
  - new: https://git.openjdk.org/jdk/pull/25025/files/450ea115..0f495539

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25025&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25025&range=06-07

  Stats: 8346 lines in 139 files changed: 4543 ins; 2476 del; 1327 mod
  Patch: https://git.openjdk.org/jdk/pull/25025.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25025/head:pull/25025

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


More information about the core-libs-dev mailing list