• Manos Koukoutos's avatar
    [wasm] Unify treatment of expressions in elem. segments · e9440c45
    Manos Koukoutos authored
    We unify the implementation of element segment expression entries with
    other initializer expressions: we represent them with a {WireBytesRef}
    and decode them with {InitExprInterface}. Except for reducing code
    duplication, this also fixes a bug where {global.get} entries in element
    segments could reference invalid globals.
    
    Changes:
    - Change {WasmElemSegment::Entry} to a union of a {WireBytesRef}
      initializer expression and a {uint32_t} function index.
    - In module-decoder, change parsing of expression entries to use
      {consume_init_expr}. Add type checking to
      {consume_element_func_index}, to complement type checking happening in
      {consume_init_expr}.
    - In module-instantiate.cc:
      - Move instantiation of indirect tables before loading of element
        segments. This way, when we call {UpdateDispatchTables} in
        {SetTableEntry}, the indirect table for the current table will also
        be updated.
      - Consolidate table entry instantiation into {SetTableEntry}, which
        handles lazily instantiated functions, or dispatches to
        {WasmTableObject::Set}.
      - Rename {InitializeIndirectFunctionTables} to
        {InitializeNonDefaultableTables}.
      - Change {InitializeNonDefaultableTables} and {LoadElemSegmentImpl}
        to use {EvaluateInitExpression}.
    - Add a test to exclude mutable/non-imported globals from the element
      section.
    - Update tests as needed.
    - Update .js module emission in wasm-fuzzer-common.
    
    Change-Id: I29c541bbca8531e8d0312ed95869c8e78a5a0c57
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3364082Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
    Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#78476}
    e9440c45
Name
Last commit
Last update
.github Loading commit data...
bazel Loading commit data...
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.bazelrc Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.mailmap Loading commit data...
.vpython Loading commit data...
.vpython3 Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.bazel Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
COMMON_OWNERS Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LOONG_OWNERS Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
RISCV_OWNERS Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
WORKSPACE Loading commit data...
codereview.settings Loading commit data...