Skip to content

Conversation

@yurydelendik
Copy link
Contributor

Typical invoke operation requires instant access to the generated trampoline code:

https://github.com/CraneStation/wasmtime/blob/master/wasmtime-jit/src/action.rs#L181-L187

This patch also exposes that for wasmtime users.

@tschneidereit
Copy link
Member

@yurydelendik would it be possible to add a test for this that's run as part of test --all?

})
}

/// Create and publish a trampoline for invoking a function.
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment to get_trampoline mentioning that the code it returns needs to be published (with publish_compiled_code) before it can be executed, and pointing to get_published_trampoline as a way to have this done automatically?

And, we should mention that calling get_published_trampoline many times will use memory inefficiently, because publishing between each trampoline creation means we'll use a whole page for each trampoline. When feasible, it's preferable to create all the trampolines (with get_trampoline) first, and then call publish_compiled_code once.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, looking at this more, get_trampoline and publish_compiled_code are not public functions, so these comments wouldn't immediately make sense. I think this is a symptom of cranelift-jit not being entirely clear about what level of API it wants to be. Hopefully we'll sort all this out with the new APIs.

@sunfishcode
Copy link
Member

@tschneidereit This a step toward while I'm starting to see can be a much larger API refactoring, after which I expect it'll be easier to write tests. So my instinct is to move forward with this for now.

@sunfishcode sunfishcode merged commit 9263b9d into bytecodealliance:master Aug 7, 2019
@tschneidereit
Copy link
Member

@tschneidereit This a step toward while I'm starting to see can be a much larger API refactoring, after which I expect it'll be easier to write tests. So my instinct is to move forward with this for now.

Ok, that makes sense to me!

grishasobol pushed a commit to grishasobol/wasmtime that referenced this pull request Nov 29, 2021
…e#243)

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
mooori pushed a commit to mooori/wasmtime that referenced this pull request Mar 7, 2024
dhil added a commit to dhil/wasmtime that referenced this pull request Oct 29, 2024
avanhatt pushed a commit to wellesley-prog-sys/wasmtime that referenced this pull request Apr 9, 2025
Generate CLIF instruction Wasm tags as an ISLE file.

Updates avanhatt#47
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.

3 participants