summaryrefslogtreecommitdiff
path: root/src/tools/asm2wasm.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-12-27 21:42:44 -0500
committerGitHub <noreply@github.com>2016-12-27 21:42:44 -0500
commit575d695762f545e1c2784595d9c926488062f383 (patch)
tree5f18013a7cb2fa39c7a62aa11b2753e86725477c /src/tools/asm2wasm.cpp
parente5704f392404b1f69d762217b89e3b8736277f08 (diff)
parent97968a879d0b55baccb5f72627fca84a6a015356 (diff)
downloadbinaryen-575d695762f545e1c2784595d9c926488062f383.tar.gz
binaryen-575d695762f545e1c2784595d9c926488062f383.tar.bz2
binaryen-575d695762f545e1c2784595d9c926488062f383.zip
Merge pull request #859 from WebAssembly/linking
Dynamic linking
Diffstat (limited to 'src/tools/asm2wasm.cpp')
-rw-r--r--src/tools/asm2wasm.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/tools/asm2wasm.cpp b/src/tools/asm2wasm.cpp
index db6d723db..9ba6062ea 100644
--- a/src/tools/asm2wasm.cpp
+++ b/src/tools/asm2wasm.cpp
@@ -55,7 +55,7 @@ int main(int argc, const char *argv[]) {
[](Options *o, const std::string &argument) {
o->extra["mem base"] = argument;
})
- .add("--mem-max", "-mm", "Set the maximum size of memory in the wasm module (in bytes). Without this, TOTAL_MEMORY is used (as it is used for the initial value), or if memory growth is enabled, no limit is set. This overrides both of those.", Options::Arguments::One,
+ .add("--mem-max", "-mm", "Set the maximum size of memory in the wasm module (in bytes). -1 means no limit. Without this, TOTAL_MEMORY is used (as it is used for the initial value), or if memory growth is enabled, no limit is set. This overrides both of those.", Options::Arguments::One,
[](Options *o, const std::string &argument) {
o->extra["mem max"] = argument;
})
@@ -63,6 +63,10 @@ int main(int argc, const char *argv[]) {
[](Options *o, const std::string &argument) {
o->extra["total memory"] = argument;
})
+ .add("--table-max", "-tM", "Set the maximum size of the table. Without this, it is set depending on how many functions are in the module. -1 means no limit", Options::Arguments::One,
+ [](Options *o, const std::string &argument) {
+ o->extra["table max"] = argument;
+ })
#include "optimization-options.h"
.add("--no-opts", "-n", "Disable optimization passes (deprecated)", Options::Arguments::Zero,
[](Options *o, const std::string &) {
@@ -130,7 +134,22 @@ int main(int argc, const char *argv[]) {
// Set the max memory size, if requested
const auto &memMax = options.extra.find("mem max");
if (memMax != options.extra.end()) {
- wasm.memory.max = atoi(memMax->second.c_str()) / Memory::kPageSize;
+ int max = atoi(memMax->second.c_str());
+ if (max >= 0) {
+ wasm.memory.max = max / Memory::kPageSize;
+ } else {
+ wasm.memory.max = Memory::kMaxSize;
+ }
+ }
+ // Set the table sizes, if requested
+ const auto &tableMax = options.extra.find("table max");
+ if (tableMax != options.extra.end()) {
+ int max = atoi(tableMax->second.c_str());
+ if (max >= 0) {
+ wasm.table.max = max;
+ } else {
+ wasm.table.max = Table::kMaxSize;
+ }
}
if (options.debug) std::cerr << "printing..." << std::endl;