Skip to content

Intrinsics: Add @binaryen.inline, parallel to @metadata.code.inline#8820

Merged
kripken merged 21 commits into
WebAssembly:mainfrom
kripken:toolchain.inline
Jun 9, 2026
Merged

Intrinsics: Add @binaryen.inline, parallel to @metadata.code.inline#8820
kripken merged 21 commits into
WebAssembly:mainfrom
kripken:toolchain.inline

Conversation

@kripken

@kripken kripken commented Jun 9, 2026

Copy link
Copy Markdown
Member

The existing standardized annotation is for VMs. This annotation is for
toolchains.

We already have such annotations for never-inline, but not using an
intrinsic, and also allowing partial-inlining to be set. This uses the modern
annotations framework for it. We can deprecate the old form after we
add a partial-inlining form in the modern way.

For reference the old forms are here:

binaryen/src/wasm.h

Lines 2474 to 2477 in 598d0b1

// Inlining metadata: whether to disallow full and/or partial inlining. This
// is a toolchain-level hint. For more details, see Inlining.cpp.
bool noFullInline = false;
bool noPartialInline = false;

Fixes #7972

@kripken kripken requested a review from a team as a code owner June 9, 2026 20:16
@kripken kripken requested review from aheejin and removed request for a team June 9, 2026 20:16
Comment thread src/wasm/wasm-binary.cpp
// Hint contents: inline frequency count
buffer << U32LEB(*annotation.inline_);
// Writes a simple i7 hint, in the range [0..127].
#define WRITE_I7_HINT(code, field) \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not a strong preference, but you can specify a class field this way too

auto getUsingSecondaries = [&](const Name& name, auto UsedNames::* field) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh nice, I didn't think of that. I'll land the current version as it follows the existing code which also uses macros, but maybe we should really refactor it all to the non-macro version later...

@kripken kripken merged commit 3c25487 into WebAssembly:main Jun 9, 2026
16 checks passed
@kripken kripken deleted the toolchain.inline branch June 9, 2026 22:39
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.

Have a dual for --no-inline that will cause a function to be always inlined (modulo recursive inlining)

2 participants