[code-reflection] RFR: Bytecode locals compaction

Adam Sotona asotona at openjdk.org
Tue Sep 10 14:41:30 UTC 2024


`LocalsCompactor` is a bytecode transformation reducing generated method `maxLocals` by re-using local slots.
Roundtrip of lift and bytecode generation doubles the `maxLocals` value, while `LocalsCompactor` reduces the regression by 50%.

Lifting of compacted locals revealed bugs in `LocalsTypeMapper` variables graph construction. This patch includes significantly  refactored `LocalsTypeMapper` to support lifting of compacted locals.

`BytecodeGenerator` has slightly improved performance (so `TestSmallCorpus` finishes in a reasonable time). However performance has not been main focus of this PR.

`TestSmallCorpus` has been slightly refactored to provide better debugging feedback and compaction statistics. Overall stability is still >99%.

Please review.

Thanks,
Adam

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

Commit messages:
 - LocalsCompactor re-mapping also double slots
 - LocalsCompactor improvements
 - typo
 - disabled TestSmallCorpus
 - LocalsCompactor improvements
 - TestSmallCorpus fixes
 - TestSmallCorpus fixes
 - fixed -0 iinc index :)
 - Merge remote-tracking branch 'babylon/code-reflection' into bytecode-locals-compaction
 - Enabled slots compaction for all generated bytecode
 - ... and 18 more: https://git.openjdk.org/babylon/compare/b836dba3...d4c0b594

Changes: https://git.openjdk.org/babylon/pull/224/files
  Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=224&range=00
  Stats: 680 lines in 5 files changed: 479 ins; 102 del; 99 mod
  Patch: https://git.openjdk.org/babylon/pull/224.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/224/head:pull/224

PR: https://git.openjdk.org/babylon/pull/224


More information about the babylon-dev mailing list