Skip to content

Inline indirect calls where possible.#2135

Merged
ltratt merged 1 commit intoykjit:masterfrom
vext01:indirect_inline
Mar 20, 2026
Merged

Inline indirect calls where possible.#2135
ltratt merged 1 commit intoykjit:masterfrom
vext01:indirect_inline

Conversation

@vext01
Copy link
Contributor

@vext01 vext01 commented Mar 17, 2026

Raising this so it doesn't get forgotten.

This allows indirect calls to be inlined in some circumstances.

Requirements:

  • constant function pointer
  • non-yk_outline callee

__attribute__((yk_inline_indirect)) can be used to prevent functions only targeted by indirect calls from being marked yk_outline by ykllvm.

I experimented with this change a lot in ykmicropython. I was able to get quite a lot of indirect calls inlined, but sadly it didn't make a big performance difference to the mandelbrot benchmark I was trying to optimise.

Note that I have not benchmarked this on yklua. There is potential for a performance change (in either direction!), so me might want to benchmark it first. In light of this, raising as a draft.

@ltratt
Copy link
Contributor

ltratt commented Mar 19, 2026

@vext01 Is this one worth considering now?

@vext01
Copy link
Contributor Author

vext01 commented Mar 19, 2026

I think if this has to performance issues on yklua, it can go in.

Let me measure and get back to you.

@vext01
Copy link
Contributor Author

vext01 commented Mar 19, 2026

haste suggests performance is indistinguishable -- go ahead I reckon.

panic!()
};
if let Some(fname) = self.j2.dladdr(*vaddr) {
use std::ffi::CString;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please force push this use up to the top-level.

@vext01 vext01 marked this pull request as ready for review March 20, 2026 08:59
@vext01
Copy link
Contributor Author

vext01 commented Mar 20, 2026

Force pushed the fix.

@ltratt ltratt added this pull request to the merge queue Mar 20, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 20, 2026
Requirements:
 - constant function pointer
 - non-yk_outline callee

`__attribute__((yk_inline_indirect))` can be used to prevent functions
only targeted by indirect calls from being marked `yk_outline` by
ykllvm.
@vext01
Copy link
Contributor Author

vext01 commented Mar 20, 2026

pushed the clippy fix.

@ltratt ltratt added this pull request to the merge queue Mar 20, 2026
Merged via the queue into ykjit:master with commit edb1bd9 Mar 20, 2026
2 checks passed
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