Stream: git-wasmtime

Topic: wasmtime / PR #11040 Add function names to --emit-clif ou...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 19:30):

PhantomInTheWire opened PR #11040 from PhantomInTheWire:feature/add-clif-func-names to bytecodealliance:main:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

Related Issues

Fixes: #10733

Explanation

This PR addresses issue #10733 by adding the function name as a comment to the beginning of each Cranelift IR file generated by the --emit-clif flag.

Previously, the files generated by --emit-clif contained only the raw Cranelift IR, making it difficult to identify which function the IR belonged to without cross-referencing with other tools like wasmtime explore. This change improves the usability of the --emit-clif output by clearly labeling each function's IR.

Input Needed

I'm unsure of where to place tests for this.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 19:30):

PhantomInTheWire requested fitzgen for a review on PR #11040.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 19:30):

PhantomInTheWire requested wasmtime-compiler-reviewers for a review on PR #11040.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 19:31):

PhantomInTheWire updated PR #11040.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 19:39):

bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 19:39):

bjorn3 created PR review comment:

This would work too, right?

                ";; Intermediate Representation of function <{symbol}>:\n",

This avoids truncating a function name like wasm[0]::function[1]::my_library::SomeType::get (as would be used if the names section contains my_library::SomeType::get as name) to the pretty much useless get.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 19:49):

fitzgen submitted PR review:

Nothing to add over what @bjorn3 pointed out.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 20:50):

PhantomInTheWire submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 20:50):

PhantomInTheWire created PR review comment:

would using something like this function work better?

fn remove_first_two_segments(s: &str) -> Option<String> {
    let mut parts = s.split("::").skip(2);
    let rest: Vec<&str> = parts.collect();
    if rest.is_empty() {
        None
    } else {
        Some(format!("::{}", rest.join("::")))
    }
}

also wasmtime explore uses "Intermediate Representation of function <get>:" to should i figure out a way where it gives my_library::SomeType::get too?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 20:50):

PhantomInTheWire edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 23:12):

PhantomInTheWire updated PR #11040.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 23:13):

PhantomInTheWire requested bjorn3 for a review on PR #11040.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 13 2025 at 23:13):

PhantomInTheWire requested fitzgen for a review on PR #11040.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 14 2025 at 08:30):

PhantomInTheWire updated PR #11040.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 16 2025 at 15:02):

fitzgen submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 16 2025 at 15:38):

fitzgen merged PR #11040.


Last updated: Dec 06 2025 at 07:03 UTC