alexcrichton requested fitzgen for a review on PR #4005.
alexcrichton opened PR #4005 from component-model
to main
:
This commit is the first of what will likely be many to implement the
component model proposal in Wasmtime. This will be structured as a
series of incremental commits, most of which haven't been written yet.
My hope is to make this incremental and over time to make this easier to
review and easier to test each step in isolation.Here much of the skeleton of how components are going to work in
Wasmtime is sketched out. This is not a complete implementation of the
component model so it's not all that useful yet, but some things you can
do are:
Process the type section into a representation amenable for working
with in Wasmtime.Process the module section and register core wasm modules.
- Process the instance section for core wasm modules.
- Process core wasm module imports.
- Process core wasm instance aliasing.
- Ability to compile a component with core wasm embedded.
- Ability to instantiate a component with no imports.
- Ability to get functions from this component.
This is already starting to diverge from the previous module linking
representation where aComponent
will try to avoid unnecessary
metadata about the component and instead internally only have the bare
minimum necessary to instantiate the module. My hope is we can avoid
constructing most of the index spaces during instantiation only for it
to all ge thrown away. Additionally I'm predicting that we'll need to
see through processing where possible to know how to generate adapters
and where they are fused.At this time you can't actually call a component's functions, and that's
the next PR that I would like to make.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
alexcrichton updated PR #4005 from component-model
to main
.
fitzgen submitted PR review.
fitzgen submitted PR review.
fitzgen created PR review comment:
/// This type is intended to mirror the `Module` type in this crate which
fitzgen created PR review comment:
/// This represents how a function was lifted, what options were used to lift
fitzgen created PR review comment:
I too am annoyed by how
rustfmt
will squoosh comments down into doc comments :pensive:// is implemented. // /// Modules and how they're defined (either closed-over or imported)
fitzgen created PR review comment:
Why
match &func
here, which require derefs fortype_index
andfunc_index
when the matchedfunc
is never used again?let func = match func? { wasmparser::ComponentFunction::Lift { type_index, func_index, options, } => { let ty = TypeIndex::from_u32(type_index); let func = FuncIndex::from_u32(func_index); self.lift_function(ty, func, options)
fitzgen created PR review comment:
This clone is necessary because this method takes a
&Payload
instead of aPayload
but the only caller doesn't reuse the payload so it might as well give ownership to this function and then readers won't have to go down a rabbit hole wondering why the heck this seemingly-unnecessary clone is here.
fitzgen created PR review comment:
A thing that translates? Should this be called a
Translator
?
fitzgen created PR review comment:
/// Canonical ABI options associated with a lifted function.
fitzgen created PR review comment:
Would be nice if we added a
len
method towasmparser::Range
.
fitzgen created PR review comment:
Can this be a
From
implementation?
fitzgen created PR review comment:
/// Note that this is unsafe as the validity of `item` is not verified and
fitzgen created PR review comment:
Once this method takes
Payload
by value this can be rewritten without the clones:let old_parser = mem::replace(&mut self.parser, parser); self.parsers.push(old_parser);
fitzgen created PR review comment:
That isn't quite grammatical, but I think this is what you mean?
/// Different ways to instantiate a module at runtime.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Consider me sufficiently inspired
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton updated PR #4005 from component-model
to main
.
alexcrichton has marked PR #4005 as ready for review.
fitzgen submitted PR review.
alexcrichton merged PR #4005.
Last updated: Nov 22 2024 at 16:03 UTC