summaryrefslogtreecommitdiff
path: root/src/tools/wasm2wast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/wasm2wast.c')
-rw-r--r--src/tools/wasm2wast.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/tools/wasm2wast.c b/src/tools/wasm2wast.c
index 1800b3bb..5015dbbd 100644
--- a/src/tools/wasm2wast.c
+++ b/src/tools/wasm2wast.c
@@ -19,7 +19,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include "allocator.h"
#include "apply-names.h"
#include "ast.h"
#include "ast-writer.h"
@@ -27,7 +26,6 @@
#include "binary-reader-ast.h"
#include "generate-names.h"
#include "option-parser.h"
-#include "stack-allocator.h"
#include "stream.h"
#include "writer.h"
@@ -37,7 +35,6 @@ static int s_verbose;
static const char* s_infile;
static const char* s_outfile;
static WabtReadBinaryOptions s_read_binary_options = {NULL, WABT_TRUE};
-static WabtBool s_use_libc_allocator;
static WabtBool s_generate_names;
static WabtBinaryErrorHandler s_error_handler =
@@ -53,7 +50,6 @@ enum {
FLAG_VERBOSE,
FLAG_HELP,
FLAG_OUTPUT,
- FLAG_USE_LIBC_ALLOCATOR,
FLAG_NO_DEBUG_NAMES,
FLAG_GENERATE_NAMES,
NUM_FLAGS
@@ -76,8 +72,6 @@ static WabtOption s_options[] = {
{FLAG_HELP, 'h', "help", NULL, NOPE, "print this help message"},
{FLAG_OUTPUT, 'o', "output", "FILENAME", YEP,
"output file for the generated wast file, by default use stdout"},
- {FLAG_USE_LIBC_ALLOCATOR, 0, "use-libc-allocator", NULL, NOPE,
- "use malloc, free, etc. instead of stack allocator"},
{FLAG_NO_DEBUG_NAMES, 0, "no-debug-names", NULL, NOPE,
"Ignore debug names in the binary file"},
{FLAG_GENERATE_NAMES, 0, "generate-names", NULL, NOPE,
@@ -105,10 +99,6 @@ static void on_option(struct WabtOptionParser* parser,
s_outfile = argument;
break;
- case FLAG_USE_LIBC_ALLOCATOR:
- s_use_libc_allocator = WABT_TRUE;
- break;
-
case FLAG_NO_DEBUG_NAMES:
s_read_binary_options.read_debug_names = WABT_FALSE;
break;
@@ -147,35 +137,26 @@ static void parse_options(int argc, char** argv) {
int main(int argc, char** argv) {
WabtResult result;
- WabtStackAllocator stack_allocator;
- WabtAllocator* allocator;
wabt_init_stdio();
parse_options(argc, argv);
- if (s_use_libc_allocator) {
- allocator = &g_wabt_libc_allocator;
- } else {
- wabt_init_stack_allocator(&stack_allocator, &g_wabt_libc_allocator);
- allocator = &stack_allocator.allocator;
- }
-
void* data;
size_t size;
- result = wabt_read_file(allocator, s_infile, &data, &size);
+ result = wabt_read_file(s_infile, &data, &size);
if (WABT_SUCCEEDED(result)) {
WabtModule module;
WABT_ZERO_MEMORY(module);
- result = wabt_read_binary_ast(allocator, data, size, &s_read_binary_options,
+ result = wabt_read_binary_ast(data, size, &s_read_binary_options,
&s_error_handler, &module);
if (WABT_SUCCEEDED(result)) {
if (s_generate_names)
- result = wabt_generate_names(allocator, &module);
+ result = wabt_generate_names(&module);
if (WABT_SUCCEEDED(result)) {
/* TODO(binji): This shouldn't fail; if a name can't be applied
* (because the index is invalid, say) it should just be skipped. */
- WabtResult dummy_result = wabt_apply_names(allocator, &module);
+ WabtResult dummy_result = wabt_apply_names(&module);
WABT_USE(dummy_result);
}
@@ -188,18 +169,13 @@ int main(int argc, char** argv) {
}
if (WABT_SUCCEEDED(result)) {
- result = wabt_write_ast(allocator, &file_writer.base, &module);
+ result = wabt_write_ast(&file_writer.base, &module);
wabt_close_file_writer(&file_writer);
}
}
-
- if (s_use_libc_allocator)
- wabt_destroy_module(allocator, &module);
+ wabt_destroy_module(&module);
}
-
- wabt_free(allocator, data);
- wabt_print_allocator_stats(allocator);
- wabt_destroy_allocator(allocator);
+ wabt_free(data);
}
return result;
}