RFR: 8333819: Move embedded external addresses from relocation info into separate global table [v2]

Vladimir Kozlov kvn at openjdk.org
Mon Jun 17 15:43:27 UTC 2024


> Currently we have oops and metadata in nmethod's local data sections which are referenced by index from relocation info.
> On other hand external addresses (declared with `ExternalAddress` in assembler code) are embedded into relocation info data because they don't need to be patched during normal execution.
> 
> But based on my experiments we usually use the same external addresses in generated code.  JavacBanch runs with product VM show about 4000 C1 and C2 compiled nmethods reference only 11 external addresses during execution. Which means these addresses are duplicated in a lot of relocation info data.
> 
> There is also issue with embedded addresses in relocation info in Leyden project. Because these VM external addresses can change between runs we have to update/patch them when we load cached code and its relocation info.  But because addresses are packed (compressed) the number of bytes used for it in relocation info may be not enough to pack new address. So we have to throw out such cached code.
> 
> I suggest to move external addresses from  relocation info into separate global table and use indexes to access it.
> It is similar to what we do for oops and metadata addresses so I used similar to OopRecorder but simplified mechanism.
> The results show that relocation info is reduced by 10% in product VM and by 32% in debug vm (which shared 145 external addresses). Which is few % reduction in nmethod size - more compact CodeCache.
> 
> This should not affect generated code performance but only slightly compilation time (I need to use lock to access table) because we only modify how `external_data_relocation` is processed.
> 
> Tested tier1-5,stress,xcomp
> Performance testing.

Vladimir Kozlov has updated the pull request incrementally with one additional commit since the last revision:

  Address comments

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19703/files
  - new: https://git.openjdk.org/jdk/pull/19703/files/fa582ecc..444878e6

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

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

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


More information about the hotspot-compiler-dev mailing list