[WebAssembly] Initialize memory in start function
authorThomas Lively <tlively@google.com>
Wed, 4 Sep 2019 19:50:39 +0000 (19:50 +0000)
committerThomas Lively <tlively@google.com>
Wed, 4 Sep 2019 19:50:39 +0000 (19:50 +0000)
commit09768c5d7abb398e92ed5fd1660d0ea69976943a
treeba30eae1b1b346fb23594e3b3c535d84373319a0
parent85d6edb26577a75940c9d691e6a178726cdb066b
[WebAssembly] Initialize memory in start function

Summary:
 - `__wasm_init_memory` is now the WebAssembly start function instead
   of being called from `__wasm_call_ctors` or called directly by the
   runtime.
 - Adds a new synthetic data symbol `__wasm_init_memory_flag` that is
   atomically incremented from zero to one by the thread responsible
   for initializing memory.
 - All threads now unconditionally perform data.drop on all passive
   segments.
 - Removes --passive-segments and --active-segments flags and controls
   segment type based on --shared-memory instead. The deleted flags
   were only present to ameliorate the upgrade path in Emscripten.

Reviewers: sbc100, aheejin

Subscribers: dschuff, jgravelle-google, sunfish, jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65783

llvm-svn: 370965
21 files changed:
lld/test/wasm/data-layout.ll
lld/test/wasm/data-segment-merging.ll
lld/test/wasm/data-segments.ll
lld/test/wasm/import-memory.test
lld/test/wasm/no-tls.test
lld/test/wasm/relocatable.ll
lld/test/wasm/shared-memory.yaml
lld/test/wasm/tls-align.ll
lld/test/wasm/tls.ll
lld/wasm/Config.h
lld/wasm/Driver.cpp
lld/wasm/MarkLive.cpp
lld/wasm/Options.td
lld/wasm/Symbols.cpp
lld/wasm/Symbols.h
lld/wasm/SyntheticSections.cpp
lld/wasm/SyntheticSections.h
lld/wasm/Writer.cpp
lld/wasm/WriterUtils.cpp
lld/wasm/WriterUtils.h
llvm/include/llvm/BinaryFormat/Wasm.h