Save an unconditional clone of guest parameters for registered guest functions#1241
Save an unconditional clone of guest parameters for registered guest functions#1241ludfjig wants to merge 2 commits intohyperlight-dev:mainfrom
Conversation
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
dblnz
left a comment
There was a problem hiding this comment.
This is fine from my point of view. I've got burnt by this slight difference between the guest_dispatch_function definition and the other function definitions.
|
The perf improvement looks great, and I don't think that the amount of breaking that you mention there is necessarily a barrier. If we wanted to be very proper I suppose we would introduce a new Two slight comments:
|
I know @jsturtevant has strong opinions on the permissibility of breaking changes that can cause silent failure in downstreams, so paging him on this as well. |
|
Maybe we can rename Regarding the owned |
|
This LGTM. |
Or we can make the type private, and make people use the |
This seems like a pretty small and reasonable thing to do to avoid any downstream users having any issues with this. I believe building a habit of recognizing and coming up with patterns to avoid unexpected downstream issues is a good thing. |
1c1e23f to
bef122c
Compare
|
Updated @syntactically @jprendes @dblnz @jsturtevant |
bef122c to
f808d25
Compare
- Rename guest_dispatch_function to guest_dispatch_function_v2 to force linker errors for out-of-date downstream code - Add guest_dispatch! macro so users don't define the symbol by hand; future signature changes will produce compile errors automatically - Parameterize GuestFunctionDefinition<F: Copy> over the function pointer type, eliminating transmutes in the C API dispatch path - Remove redundant clone in print_output_with_host_print now that FunctionCall is passed by value Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
f808d25 to
4dec0e4
Compare
vs main:

Only affects registered guest functions (not c api, nor when someone implements their own
guest_dispatch_function).Note that this is a breaking change for downstream users who manually register guest functions (hyperlight-wasm), but even more scary is that it will break silently, since the function signature is not type-checked😱. We should probably address this by exporting the type as
pub, and add const time assertions in the downstream libraries. Or make it a macro that users use, which provides the function signature, and let the user provide the function body