• 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
..
DIR_METADATA Loading commit data...
OWNERS Loading commit data...
test-backing-store.cc Loading commit data...
test-c-wasm-entry.cc Loading commit data...
test-compilation-cache.cc Loading commit data...
test-gc.cc Loading commit data...
test-grow-memory.cc Loading commit data...
test-jump-table-assembler.cc Loading commit data...
test-liftoff-for-fuzzing.cc Loading commit data...
test-liftoff-inspection.cc Loading commit data...
test-run-wasm-64.cc Loading commit data...
test-run-wasm-asmjs.cc Loading commit data...
test-run-wasm-atomics.cc Loading commit data...
test-run-wasm-atomics64.cc Loading commit data...
test-run-wasm-bulk-memory.cc Loading commit data...
test-run-wasm-exceptions.cc Loading commit data...
test-run-wasm-interpreter.cc Loading commit data...
test-run-wasm-js.cc Loading commit data...
test-run-wasm-memory64.cc Loading commit data...
test-run-wasm-module.cc Loading commit data...
test-run-wasm-relaxed-simd.cc Loading commit data...
test-run-wasm-sign-extension.cc Loading commit data...
test-run-wasm-simd-liftoff.cc Loading commit data...
test-run-wasm-simd.cc Loading commit data...
test-run-wasm-wrappers.cc Loading commit data...
test-run-wasm.cc Loading commit data...
test-streaming-compilation.cc Loading commit data...
test-wasm-breakpoints.cc Loading commit data...
test-wasm-codegen.cc Loading commit data...
test-wasm-import-wrapper-cache.cc Loading commit data...
test-wasm-metrics.cc Loading commit data...
test-wasm-serialization.cc Loading commit data...
test-wasm-shared-engine.cc Loading commit data...
test-wasm-stack.cc Loading commit data...
test-wasm-trap-position.cc Loading commit data...
wasm-atomics-utils.h Loading commit data...
wasm-run-utils.cc Loading commit data...
wasm-run-utils.h Loading commit data...
wasm-simd-utils.cc Loading commit data...
wasm-simd-utils.h Loading commit data...