Add wasmtime-specific C APIs for tables #1654
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds a suite of
wasmtime_funcref_table_*
APIs which mirrorthe standard APIs but have a few differences:
More errors are returned. For example error messages are communicated
through
wasmtime_error_t
and out-of-bounds vs load of null can bedifferentiated in the
get
API.APIs take
wasm_func_t
instead ofwasm_ref_t
. Given the recentdecision to remove subtyping from the anyref proposal it's not clear
how the C API for tables will be affected, so for now these APIs are
all specialized to only funcref tables.
Growth now allows access to the previous size of the table, if
desired, which mirrors the
table.grow
instruction.This was originally motivated by bytecodealliance/wasmtime-go#5 where
the current APIs we have for working with tables don't quite work. We
don't have a great way to take an anyref constructed from a
Func
andget the
Func
back out, so for now this sidesteps those concerns whilewe sort out the anyref story.
It's intended that once the anyref story has settled and the official C
API has updated we'll likely delete these wasmtime-specific APIs or
implement them as trivial wrappers around the official ones.