Fix data/elem drop (#2747)

Currently, `data.drop` instruction is implemented by directly modifying the
underlying module. It breaks use cases where you have multiple instances
sharing a single loaded module. `elem.drop` has the same problem too.

This PR  fixes the issue by keeping track of which data/elem segments have
been dropped by using bitmaps for each module instances separately, and
add a sample to demonstrate the issue and make the CI run it.

Also add a missing check of dropped elements to the fast-jit `table.init`.

Fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/2735
Fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/2772
This commit is contained in:
YAMAMOTO Takashi
2023-11-18 09:50:16 +09:00
committed by GitHub
parent 08c0ec74c4
commit 562a5dd1b6
26 changed files with 745 additions and 72 deletions

View File

@ -98,6 +98,7 @@ $(NAME)_SOURCES := ${SHARED_ROOT}/platform/alios/alios_platform.c \
${SHARED_ROOT}/mem-alloc/ems/ems_alloc.c \
${SHARED_ROOT}/mem-alloc/ems/ems_hmu.c \
${SHARED_ROOT}/utils/bh_assert.c \
${SHARED_ROOT}/utils/bh_bitmap.c \
${SHARED_ROOT}/utils/bh_common.c \
${SHARED_ROOT}/utils/bh_hashmap.c \
${SHARED_ROOT}/utils/bh_list.c \

View File

@ -371,6 +371,7 @@ CSRCS += nuttx_platform.c \
ems_alloc.c \
ems_hmu.c \
bh_assert.c \
bh_bitmap.c \
bh_common.c \
bh_hashmap.c \
bh_list.c \