On Mon, 19 Jan 2026 14:55:42 GMT, Andrew Haley <[email protected]> wrote:
>>> It sounds rather complicated. It's important that the performance work we >>> do doesn't over complexify the implementation. Whatever we do should be >>> proportionate to the scale of the problem. Post-call NOPs are not a huge >>> deal. >> >>> Why not use MOVN, and put the data into a stub at the end of the nmethod? >> >> If the data is stored in the stub code, the method size depends on whether >> `cb_offset`/`oopmap_index` fit in the respective post-call NOP - if I >> understand correctly, that would require calculating values of >> `cb_offset`/`oopmap_index` during the code generation because stub code size >> should be known prior to allocation in the code cache. It can't be postponed >> until `NativePostCallNop::patch`. Avoiding the estimation step would >> simplify the change. >> >> Also, referencing the stub code via MOVN - which can be used to store up to >> 18 bits of metadata - would limit the method size by approximately 1MB (`4 * >> (1 << 18)`). It might be a reasonable limit for a compiled method, however >> as far as I understand, right now the limit is `branch_range` (128MB). Would >> the 1MB limit be acceptable? > >> > It sounds rather complicated. It's important that the performance work we >> > do doesn't over complexify the implementation. Whatever we do should be >> > proportionate to the scale of the problem. Post-call NOPs are not a huge >> > deal. >> >> > Why not use MOVN, and put the data into a stub at the end of the nmethod? >> >> If the data is stored in the stub code, the method size depends on whether >> `cb_offset`/`oopmap_index` fit in the respective post-call NOP - if I >> understand correctly, that would require calculating values of >> `cb_offset`/`oopmap_index` during the code generation because stub code size >> should be known prior to allocation in the code cache. It can't be postponed >> until `NativePostCallNop::patch`. Avoiding the estimation step would >> simplify the change. > > It doesn't have to be hard. We can just guess. In the odd instance that the > guess is wrong, emit zeroes. > >> Also, referencing the stub code via MOVN - which can be used to store up to >> 18 bits of metadata - would limit the method size by approximately 1MB (`4 * >> (1 << 18)`). It might be a reasonable limit for a compiled method, however >> as far as I understand, right now the limit is `branch_range` (128MB). Would >> the 1MB limit be acceptable? > > Yes, 1M is plenty. > > Andrew. Hi @theRealAph. I have updated the PR to implement the scheme you suggested. Now, C2 can use MOVN to store an offset to the metadata values at the end of main code if the oopmap_slot or cb_blocks_offset cannot be directly represented within MOVZ or MOVK. In C1, the MOVN offset approach is not supported - so, it is limited to MOVK and MOVZ representation. It means that for C1-compiled methods metadata for some of the code offsets is not encodable where it could be encoded without this change. This is a trade-off with the complexity of supporting MOVN in C1. Is this acceptable? ------------- PR Comment: https://git.openjdk.org/jdk/pull/28855#issuecomment-6955991361
