summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-11-12 20:47:09 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-12-07 16:50:03 -1000
commite0d5a85961d21d651298d6f069a3753e011aa280 (patch)
tree63b723d750cb8e736b2ce73df3783827582f68c0 /src
parentba7638d561f09ec24f90d571763b2ef84b775318 (diff)
downloadbinaryen-e0d5a85961d21d651298d6f069a3753e011aa280.tar.gz
binaryen-e0d5a85961d21d651298d6f069a3753e011aa280.tar.bz2
binaryen-e0d5a85961d21d651298d6f069a3753e011aa280.zip
add table-max option, and make it and mem-max set the limit to no limit for -1
Diffstat (limited to 'src')
-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;