• clemensh's avatar
    [wasm] Remove raw byte pointers from WasmModule · 6572b562
    clemensh authored
    These byte pointers (module_start and module_end) were only valid
    during decoding. During instantiation or execution, they can get
    invalidated by garbage collection.
    This CL removes them from the WasmModule struct, and introduces a new
    ModuleStorage struct as interface to the wasm wire bytes.
    Since the storage is often needed together with the ModuleEnv, a new
    ModuleStorageEnv struct holds both a ModuleEnv and a ModuleStorage.
    The pointers in the ModuleStorage should never escape the live range of
    this struct, as they might point into a SeqOneByteString or ArrayBuffer.
    Therefore, the WasmInterpreter needs to create its own copy of the
    whole module.
    Runtime functions that previously used the raw pointers in WasmModule
    (leading to memory errors) now have to use the SeqOneByteString in the
    WasmCompiledModule.
    
    R=titzer@chromium.org
    BUG=chromium:669518
    
    Review-Url: https://codereview.chromium.org/2540133002
    Cr-Commit-Position: refs/heads/master@{#41388}
    6572b562
test-run-wasm-module.cc 31.1 KB