Skip to content

LATX: reduce indirect jump lookup overhead - #447

Draft
luzeng87 wants to merge 6 commits into
lat-opensource:masterfrom
luzeng87:x86_64-jump-cache-capacity
Draft

LATX: reduce indirect jump lookup overhead#447
luzeng87 wants to merge 6 commits into
lat-opensource:masterfrom
luzeng87:x86_64-jump-cache-capacity

Conversation

@luzeng87

@luzeng87 luzeng87 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • enlarge the LATX x86-64 per-CPU jump cache from 16 to 19 index bits
  • use low guest-address bits directly in runtime and generated FastTB lookups
  • add a 20-bit open-addressed secondary cache for translated indirect-jump targets
  • keep the secondary-cache miss path inside translated code and promote valid hits into FastTB
  • remove entries during TB invalidation and clear the table during a full TB flush
  • preserve AOT relocation for the secondary-cache miss path

Correctness

The secondary cache stores TranslationBlock *, not only a guest PC and code pointer. A hit must match pc, flags, and cflags; an invalidated TB therefore cannot match. Multiple TB variants at the same guest PC remain independently addressable.

The current TB pointer is passed in a7 only after a FastTB miss. This avoids clobbering the LoongArch return-address register and leaves the primary FastTB hit path unchanged.

An empty slot or one complete probe cycle returns to the regular dispatcher and QHT lookup. Tombstones preserve probe chains and are reused by later insertions.

Validation

This PR remains a draft pending review, CI, and final performance regression testing.

@luzeng87
luzeng87 marked this pull request as draft September 3, 2026 03:06
@luzeng87
luzeng87 force-pushed the x86_64-jump-cache-capacity branch 2 times, most recently from 2261edd to a039bd3 Compare September 3, 2026 06:39
@luzeng87 luzeng87 changed the title LATX: enlarge the x86-64 jump cache LATX: reduce indirect jump lookup overhead Sep 3, 2026
@luzeng87

luzeng87 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Added c04868cbd9 after a clean-build regression exposed return-address clobbering in the secondary-cache glue. The first version allocated eight integer temporaries although x86-64 LATX provides seven, allowing the hash multiplier to occupy ra. The fixed lookup uses five temporaries and index masking for wraparound. The original reproducer changed from rc=139 to rc=0; JIT, cold AOT, hot AOT, Fast Suite 24/24, and the 624-test daily status comparison all passed.

Signed-off-by: Lu Zeng <luzeng87@gmail.com>
Signed-off-by: Lu Zeng <luzeng87@gmail.com>
Signed-off-by: Lu Zeng <luzeng87@gmail.com>
Signed-off-by: Lu Zeng <luzeng87@gmail.com>
Signed-off-by: Lu Zeng <luzeng87@gmail.com>
Signed-off-by: Lu Zeng <luzeng87@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant