Skip to content

Commit

Permalink
cconv_default_memory: add an explicit instance argument
Browse files Browse the repository at this point in the history
to be consistent with cconv_deref_func_ptr
  • Loading branch information
yamt committed Aug 10, 2024
1 parent e080df1 commit 5b55cdf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/cconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ cconv_deref_func_ptr(struct exec_context *ctx, const struct instance *inst,
}

int
cconv_default_memory(struct exec_context *ctx, uint32_t *memidxp)
cconv_default_memory(struct exec_context *ctx, const struct instance *inst,
uint32_t *memidxp)
{
const struct module *m = ctx->instance->module;
const struct module *m = inst->module;
int ret;
/*
* XXX searching exports on each call can be too slow.
Expand Down
3 changes: 2 additions & 1 deletion lib/cconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ int cconv_deref_func_ptr(struct exec_context *ctx, const struct instance *inst,
uint32_t wasmfuncptr, const struct functype *ft,
const struct funcinst **fip);

int cconv_default_memory(struct exec_context *ctx, uint32_t *memidxp);
int cconv_default_memory(struct exec_context *ctx, const struct instance *inst,
uint32_t *memidxp);

__END_EXTERN_C
2 changes: 1 addition & 1 deletion lib/host_instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ host_func_getptr2(struct exec_context *ctx, uint32_t ptr, uint32_t offset,
uint32_t size, void **pp, bool *movedp)
{
uint32_t memidx;
int ret = cconv_default_memory(ctx, &memidx);
int ret = cconv_default_memory(ctx, ctx->instance, &memidx);
if (ret != 0) {
return ret;
}
Expand Down

0 comments on commit 5b55cdf

Please sign in to comment.