Skip to content

Conversation

@jserv
Copy link
Contributor

@jserv jserv commented Jan 16, 2026

This implements inline cache optimization for T2C-compiled code:

  • Add inline_cache struct with (key, entry) pairs
  • Fast path: check inline cache before seqlock-based jit_cache lookup
  • Slow path: full jit_cache lookup + update inline cache on hit
  • Skip ISB on ARM64 for inline cache hits (already executed this target)
  • Clear inline cache on SFENCE.VMA, FENCE.I, and block eviction

Benchmark: 44% faster on ARM64 (ISB avoidance), ~4% on x86_64.


Summary by cubic

Add inline caching for T2C indirect jumps to speed up hot paths by bypassing jit_cache and skipping ARM64 ISB on hits. This reduces indirect jump overhead and lowers contention.

  • New Features

    • Per-instance inline_cache storing (key, entry) pairs for indirect call sites.
    • Fast path: check inline_cache first; direct call on hit.
    • Slow path: seqlock jit_cache lookup; populate inline_cache on success; ISB only on ARM64 misses.
    • Invalidation on SFENCE.VMA (full/page), FENCE.I, and block eviction.
    • Initialization and cleanup wired into rv_create/rv_delete and code_cache_flush.
  • Performance

    • 44% faster on ARM64 (ISB avoidance on hits).
    • ~4% faster on x86_64.

Written for commit df9727a. Summary will update on new commits.

This implements inline cache optimization for T2C-compiled code:
- Add inline_cache struct with (key, entry) pairs
- Fast path: check inline cache before seqlock-based jit_cache lookup
- Slow path: full jit_cache lookup + update inline cache on hit
- Skip ISB on ARM64 for inline cache hits (already executed this target)
- Clear inline cache on SFENCE.VMA, FENCE.I, and block eviction

Benchmark: 44% faster on ARM64 (ISB avoidance), ~4% on x86_64.
@jserv jserv added this to the release-2026.1 milestone Jan 16, 2026
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 8 files

Copy link
Contributor Author

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Details
Benchmark suite Current: df9727a Previous: c5a3ee4 Ratio
Dhrystone 1593.333 DMIPS 1631.333 DMIPS 1.02
CoreMark 947.117 iterations/sec 946.285 iterations/sec 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@jserv jserv merged commit df65ed7 into master Jan 16, 2026
23 checks passed
@jserv jserv deleted the improve-t2c branch January 16, 2026 09:45
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.

2 participants