Verified Commit 62b48497 authored by nagayama15's avatar nagayama15

add dummy embedding method (that do nothing)

parent 8053699e
...@@ -28,6 +28,7 @@ METHODS = [ ...@@ -28,6 +28,7 @@ METHODS = [
{:name => "function-reorder", :abbr => "fn"}, {:name => "function-reorder", :abbr => "fn"},
{:name => "export-reorder", :abbr => "ex"}, {:name => "export-reorder", :abbr => "ex"},
{:name => "operand-swap", :abbr => "op"}, {:name => "operand-swap", :abbr => "op"},
{:name => "null", :abbr => "null"},
] ]
OPT_PASSES = [ OPT_PASSES = [
......
...@@ -17,6 +17,6 @@ METHODS.each do |method| ...@@ -17,6 +17,6 @@ METHODS.each do |method|
embed(file, out, method[:name], watermark) embed(file, out, method[:name], watermark)
OPT_PASSES.each {|pass| optimize(out, out.sub(".wasm", "-#{pass}.wasm"), pass)} OPT_PASSES.each {|pass| optimize(out, out.sub(".wasm", "-#{pass}.wasm"), pass)} if method[:name] != "null"
end end
end end
...@@ -18,7 +18,7 @@ int main(int argc, char* argv[]) { ...@@ -18,7 +18,7 @@ int main(int argc, char* argv[]) {
options.add("version", 'v', "Print version"); options.add("version", 'v', "Print version");
options.add<std::string>("output", 'o', "Output filename", true); options.add<std::string>("output", 'o', "Output filename", true);
options.add<std::string>("method", 'm', "Embedding method (function-reorder, export-reorder, operand-swap)", true, "", cmdline::oneof<std::string>("function-reorder", "export-reorder", "operand-swap")); options.add<std::string>("method", 'm', "Embedding method (function-reorder, export-reorder, operand-swap, null)", true, "", cmdline::oneof<std::string>("function-reorder", "export-reorder", "operand-swap", "null"));
options.add<std::string>("watermark", 'w', "Watermark to embed", true); options.add<std::string>("watermark", 'w', "Watermark to embed", true);
options.add<std::size_t>("chunk-size", 'c', "Chunk size [2~20]", false, 20, cmdline::range<std::size_t>(2, 20)); options.add<std::size_t>("chunk-size", 'c', "Chunk size [2~20]", false, 20, cmdline::range<std::size_t>(2, 20));
options.add("debug", 'd', "Preserve debug info"); options.add("debug", 'd', "Preserve debug info");
...@@ -77,6 +77,8 @@ int main(int argc, char* argv[]) { ...@@ -77,6 +77,8 @@ int main(int argc, char* argv[]) {
size_bits = kyut::methods::export_reordering::embed(r, module, chunk_size); size_bits = kyut::methods::export_reordering::embed(r, module, chunk_size);
} else if (method == "operand-swap") { } else if (method == "operand-swap") {
size_bits = kyut::methods::operand_swapping::embed(r, module); size_bits = kyut::methods::operand_swapping::embed(r, module);
} else if (method == "null") {
size_bits = 0; /* Don't do anything */
} else { } else {
WASM_UNREACHABLE(("unknown method: " + method).c_str()); WASM_UNREACHABLE(("unknown method: " + method).c_str());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment