[all-commits] [llvm/llvm-project] b2cdf3: [lld][WebAssembly] Add an `--initial-heap` option ...

SingleAccretion via All-commits all-commits at lists.llvm.org
Fri Dec 15 10:16:52 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b2cdf3cc4c08729d0ff582d55e40793a20bbcdcc
      https://github.com/llvm/llvm-project/commit/b2cdf3cc4c08729d0ff582d55e40793a20bbcdcc
  Author: SingleAccretion <62474226+SingleAccretion at users.noreply.github.com>
  Date:   2023-12-15 (Fri, 15 Dec 2023)

  Changed paths:
    M lld/docs/WebAssembly.rst
    A lld/test/wasm/initial-heap.test
    M lld/wasm/Config.h
    M lld/wasm/Driver.cpp
    M lld/wasm/Options.td
    M lld/wasm/Writer.cpp

  Log Message:
  -----------
  [lld][WebAssembly] Add an `--initial-heap` option (#75594)

It is beneficial to preallocate a certain number of pages in the linear
memory (i. e. use the "minimum" field of WASM memories) so that fewer
"memory.grow"s are needed at startup.

So far, the way to do that has been to pass the "--initial-memory"
option to the linker. It works, but has the very significant downside of
requiring the user to know the size of static data beforehand, as it
must not exceed the number of bytes passed-in as "--initial-memory".

The new "--initial-heap" option avoids this downside by simply appending
the specified number of pages to static data (and stack), regardless of
how large they already are.

Ref: https://github.com/emscripten-core/emscripten/issues/20888.




More information about the All-commits mailing list