-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add global export apis #3452
Add global export apis #3452
Conversation
0d748e9
to
ad39cf9
Compare
Is it about to operate |
@bnason-nf the method of this PR in the AOT mode will allocate memory for the global instances, which increases footprint and the binary size. How about we define the typedef struct wasm_global_inst_t {
wasm_valkind_t kind;;
bool is_mutable;
void *global_data;
} wasm_global_inst_t;
WASM_RUNTIME_API_EXTERN unt32_t
wasm_runtime_get_global_inst_count(const wasm_module_inst_t module_inst);
WASM_RUNTIME_API_EXTERN void
wasm_runtime_get_global_inst(const wasm_module_inst_t module_inst, uint32_t global_index,
wasm_global_inst_t *global_inst); I am not sure whether exposing |
9248227
to
32f2d14
Compare
32f2d14
to
5cf55a1
Compare
@wenyongh I implemented something very close to your idea, except that I kept the lookup by name instead of by index, since to me it feels more natural to use it that way from the calling application code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except minor comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'm very new to this code, so I'm not confident at all that this is the best way (or even a good way) to expose export globals, so please let me know if there is a better strategy or if I've just done it wrong. As a minor detail, I didn't see a good way in the AOT global_instantiate() to fill in the ref_type.