Skip to content

x86: refine iTable iteration heuristic after lastITable cache check#23640

Merged
0xdaryl merged 1 commit intoeclipse-openj9:masterfrom
a7ehuo:tune-itable-iterations-2
Apr 3, 2026
Merged

x86: refine iTable iteration heuristic after lastITable cache check#23640
0xdaryl merged 1 commit intoeclipse-openj9:masterfrom
a7ehuo:tune-itable-iterations-2

Conversation

@a7ehuo
Copy link
Copy Markdown
Contributor

@a7ehuo a7ehuo commented Apr 2, 2026

Update determineNumOfITableIterations() to use a more nuanced heuristic when choosing how many iTable entries to probe after a failed lastITable cache check.

Previously, the heuristic examined sampled implementers of the declaring interface, tracked only the maximum number of implemented interfaces, and always capped the returned iteration count at MAX_ITABLE_ITERATIONS. This change extends the analysis to also track:

  • the total number of interfaces across sampled implementers
  • whether all sampled implementers have the same interface count

The new policy is:

  • return the exact interface count when there is only one implementer
  • return the exact interface count when all sampled implementers are uniform
  • fall back to MIN_ITABLE_ITERATIONS when the average interface count is high
  • otherwise retain the original capped behavior

This preserves the original default/fallback behavior while allowing more accurate iteration counts in predictable implementer shapes, potentially avoiding unnecessary fallback to the lookup snippet.

@a7ehuo
Copy link
Copy Markdown
Contributor Author

a7ehuo commented Apr 2, 2026

@0xdaryl May I ask you to review this change? Thank you!

@vijaysun-omr @hzongaro fyi

Copy link
Copy Markdown
Contributor

@0xdaryl 0xdaryl left a comment

Choose a reason for hiding this comment

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

Logic seems fine to me. My only comments are on the comments.

Comment thread runtime/compiler/x/codegen/X86PrivateLinkage.cpp Outdated
Comment thread runtime/compiler/x/codegen/X86PrivateLinkage.cpp Outdated
Update determineNumOfITableIterations() to use a more nuanced
heuristic when choosing how many iTable entries to probe after a
failed lastITable cache check.

Previously, the heuristic examined sampled implementers of the
declaring interface, tracked only the maximum number of implemented
interfaces, and always capped the returned iteration count at
MAX_ITABLE_ITERATIONS. This change extends the analysis to also track:

- the total number of interfaces across sampled implementers
- whether all sampled implementers have the same interface count

The new policy is:

- return the exact interface count when there is only one implementer
- return the exact interface count when all sampled implementers are
  uniform
- fall back to MIN_ITABLE_ITERATIONS when the average interface count
  is high
- otherwise retain the original capped behavior

This preserves the original default/fallback behavior while allowing
more accurate iteration counts in predictable implementer shapes,
potentially avoiding unnecessary fallback to the lookup snippet.

Signed-off-by: Annabelle Huo <a7eh1ogh@gmail.com>
@a7ehuo a7ehuo force-pushed the tune-itable-iterations-2 branch from 045e59e to 69511ad Compare April 2, 2026 18:08
@0xdaryl
Copy link
Copy Markdown
Contributor

0xdaryl commented Apr 2, 2026

Jenkins test sanity xlinux,win,osx jdk17

@0xdaryl 0xdaryl self-assigned this Apr 2, 2026
@0xdaryl
Copy link
Copy Markdown
Contributor

0xdaryl commented Apr 2, 2026

x Linux failure is #13875

@0xdaryl
Copy link
Copy Markdown
Contributor

0xdaryl commented Apr 3, 2026

Windows JDK17 failure is #22758

@vijaysun-omr
Copy link
Copy Markdown
Contributor

vijaysun-omr commented Apr 3, 2026

fyi @zl-wang @rmnattas @knn-k @r30shah @ehsankianifar for thinking if this is something to consider for your platform/implementation

@0xdaryl
Copy link
Copy Markdown
Contributor

0xdaryl commented Apr 3, 2026

Windows OpenJDK failure is also #13875

@0xdaryl 0xdaryl merged commit 371d4a3 into eclipse-openj9:master Apr 3, 2026
10 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants