saulecabrera edited PR #7228:
This change is a follow up to:
- https://github.com/bytecodealliance/wasmtime/pull/7155
- https://github.com/bytecodealliance/wasmtime/pull/7035
One of the objectives of this change is to make it easy to emit function calls at the MacroAssembler layer, for cases in which it's challenging to know ahead-of-time if a particular functionality can be achieved natively (e.g. rounding and SSE4.2). The original implementation of function call emission, made this objective difficult to achieve and it was also difficult to reason about.
I decided to simplify the overall approach to function calls as part of this PR; in essence, thecall
module now exposes a single functionFnCall::emit
which is reponsible of gathtering the dependencies and orchestrating the emission of the call. This new approach deliberately avoids holding any state regarding the function call for simplicity.This change also standardizes the usage of
Callee
as the main entrypoint for function call emission, as of this change 4Callee
types exist (Local
,Builtin
,Import
,FuncRef
), each callee kind is mappable to aCalleeKind
which is the materialized version of a callee which Cranelift understands.This change also moves the creation of the
BuiltinFunctions
to theISA
level given that they can be safely used accross multiple function compilations.Finally, this change also introduces support for some of the "well-known" libcalls and hooks those libcalls at the
MacroAssembler::float_round
callsite.--
prtest:full
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
saulecabrera updated PR #7228.
elliottt submitted PR review:
This is looking great, I'm so happy to see the default cases for fp rounding operations now!
elliottt submitted PR review:
This is looking great, I'm so happy to see the default cases for fp rounding operations now!
elliottt created PR review comment:
Similarly to the
CodeGenContext
parameters, can this be simplified down to using the'a
lifetime for everything?
elliottt created PR review comment:
Awesome! :tada:
elliottt created PR review comment:
Does
'b
actually outlive'a
here, or would it be possible to collapse these down to just'a
?
saulecabrera submitted PR review.
saulecabrera created PR review comment:
It actually outlives 'a; the changes in this PR make it so the
compiled_function
function at the ISA level gets a reference toBuiltinFunctions
, which will outlive any of the other structs created in the body of thecompile_function
function (e.g.FuncEnv
andVMOffsets
) and on top of that, there's is a third lifetime ('data
, previously'c
) which represents the lifetime of any references to the original WebAssembly binary throughwasmtime_environ::ModuleTranslation
.
saulecabrera updated PR #7228.
saulecabrera submitted PR review.
saulecabrera created PR review comment:
Yeah, the same comment applies here too.
saulecabrera updated PR #7228.
saulecabrera merged PR #7228.
Last updated: Dec 23 2024 at 12:05 UTC