forked from hyperlight-dev/hyperlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction_call.fbs
33 lines (27 loc) · 1.4 KB
/
function_call.fbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
include "function_types.fbs";
namespace Hyperlight.Generated;
enum FunctionCallType : ubyte {
// none is invalid, its the default, its only here to ensure that the type is explicitly set to guest or host as none should fail validation if a buffer using it is written to memory
none,
guest,
host,
}
// Flatbuffers rust generator doesn't support vectors of unions so we have to wrap them in a table
// see https://github.com/google/flatbuffers/issues/5024
table Parameter {
value:ParameterValue(required);
}
table FunctionCall {
function_name:string(required, key);
parameters:[Parameter];
function_call_type:FunctionCallType;
// For dynamic calls such as WASM functions we need to know the expected return type
// as these functions are not registered in the guest then there is no way of knowing what the return type is expected to be
// we could register all the WASM functions in the guest by examining the WASM module
// but even if we did this we would still not know the return type of the function as WASM metadata does not contain this information
// so we have to rely on the host to tell us what the return type is
// we can also use this to validate what the host expects where we have a statically registered function.
// If we ultimately adopt WIT for IDL then we might not need this any longer
expected_return_type:ReturnType;
}
root_type FunctionCall;