summaryrefslogtreecommitdiff
path: root/src/tools/wasm-interp.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-10-12 12:22:39 -0700
committerGitHub <noreply@github.com>2017-10-12 12:22:39 -0700
commit9fc1661250adf19e3678bb44ee72b8cd85680de8 (patch)
tree7afbd026f56e1215d76d5e10d5fbc5d360871def /src/tools/wasm-interp.cc
parent6e96660b2987df6ea170cea17025e685af5deb27 (diff)
downloadwabt-9fc1661250adf19e3678bb44ee72b8cd85680de8.tar.gz
wabt-9fc1661250adf19e3678bb44ee72b8cd85680de8.tar.bz2
wabt-9fc1661250adf19e3678bb44ee72b8cd85680de8.zip
Rename interpreter -> interp everywhere (#649)
We already used `interp` in a few places, may as well be consistent.
Diffstat (limited to 'src/tools/wasm-interp.cc')
-rw-r--r--src/tools/wasm-interp.cc61
1 files changed, 30 insertions, 31 deletions
diff --git a/src/tools/wasm-interp.cc b/src/tools/wasm-interp.cc
index 9bd2cc24..af842853 100644
--- a/src/tools/wasm-interp.cc
+++ b/src/tools/wasm-interp.cc
@@ -23,12 +23,12 @@
#include <string>
#include <vector>
-#include "src/binary-reader-interpreter.h"
+#include "src/binary-reader-interp.h"
#include "src/binary-reader.h"
#include "src/cast.h"
#include "src/error-handler.h"
#include "src/feature.h"
-#include "src/interpreter.h"
+#include "src/interp.h"
#include "src/literal.h"
#include "src/option-parser.h"
#include "src/resolve-names.h"
@@ -38,7 +38,7 @@
#include "src/wast-parser.h"
using namespace wabt;
-using namespace wabt::interpreter;
+using namespace wabt::interp;
static int s_verbose;
static const char* s_infile;
@@ -56,7 +56,7 @@ enum class RunVerbosity {
};
static const char s_description[] =
-R"( read a file in the wasm binary format, and run in it a stack-based
+ R"( read a file in the wasm binary format, and run in it a stack-based
interpreter.
examples:
@@ -112,13 +112,13 @@ static void ParseOptions(int argc, char** argv) {
parser.Parse(argc, argv);
}
-static void RunAllExports(interpreter::Module* module,
+static void RunAllExports(interp::Module* module,
Thread* thread,
RunVerbosity verbose) {
TypedValues args;
TypedValues results;
- for (const interpreter::Export& export_ : module->exports) {
- interpreter::Result iresult = thread->RunExport(&export_, args, &results);
+ for (const interp::Export& export_ : module->exports) {
+ interp::Result iresult = thread->RunExport(&export_, args, &results);
if (verbose == RunVerbosity::Verbose) {
WriteCall(s_stdout_stream.get(), string_view(), export_.name, args,
results, iresult);
@@ -141,8 +141,8 @@ static wabt::Result ReadModule(const char* module_filename,
const bool kStopOnFirstError = true;
ReadBinaryOptions options(s_features, s_log_stream.get(), kReadDebugNames,
kStopOnFirstError);
- result = ReadBinaryInterpreter(env, DataOrNull(file_data), file_data.size(),
- &options, error_handler, out_module);
+ result = ReadBinaryInterp(env, DataOrNull(file_data), file_data.size(),
+ &options, error_handler, out_module);
if (Succeeded(result)) {
if (s_verbose)
@@ -153,15 +153,15 @@ static wabt::Result ReadModule(const char* module_filename,
}
#define PRIimport "\"" PRIstringview "." PRIstringview "\""
-#define PRINTF_IMPORT_ARG(x) \
+#define PRINTF_IMPORT_ARG(x) \
WABT_PRINTF_STRING_VIEW_ARG((x).module_name) \
, WABT_PRINTF_STRING_VIEW_ARG((x).field_name)
class WasmInterpHostImportDelegate : public HostImportDelegate {
public:
- wabt::Result ImportFunc(interpreter::FuncImport* import,
- interpreter::Func* func,
- interpreter::FuncSignature* func_sig,
+ wabt::Result ImportFunc(interp::FuncImport* import,
+ interp::Func* func,
+ interp::FuncSignature* func_sig,
const ErrorCallback& callback) override {
if (import->field_name == "print") {
cast<HostFunc>(func)->callback = PrintCallback;
@@ -173,33 +173,32 @@ class WasmInterpHostImportDelegate : public HostImportDelegate {
}
}
- wabt::Result ImportTable(interpreter::TableImport* import,
- interpreter::Table* table,
+ wabt::Result ImportTable(interp::TableImport* import,
+ interp::Table* table,
const ErrorCallback& callback) override {
return wabt::Result::Error;
}
- wabt::Result ImportMemory(interpreter::MemoryImport* import,
- interpreter::Memory* memory,
+ wabt::Result ImportMemory(interp::MemoryImport* import,
+ interp::Memory* memory,
const ErrorCallback& callback) override {
return wabt::Result::Error;
}
- wabt::Result ImportGlobal(interpreter::GlobalImport* import,
- interpreter::Global* global,
+ wabt::Result ImportGlobal(interp::GlobalImport* import,
+ interp::Global* global,
const ErrorCallback& callback) override {
return wabt::Result::Error;
}
private:
- static interpreter::Result PrintCallback(
- const HostFunc* func,
- const interpreter::FuncSignature* sig,
- Index num_args,
- TypedValue* args,
- Index num_results,
- TypedValue* out_results,
- void* user_data) {
+ static interp::Result PrintCallback(const HostFunc* func,
+ const interp::FuncSignature* sig,
+ Index num_args,
+ TypedValue* args,
+ Index num_results,
+ TypedValue* out_results,
+ void* user_data) {
memset(out_results, 0, sizeof(TypedValue) * num_results);
for (Index i = 0; i < num_results; ++i)
out_results[i].type = sig->result_types[i];
@@ -209,8 +208,8 @@ class WasmInterpHostImportDelegate : public HostImportDelegate {
printf("called host ");
WriteCall(s_stdout_stream.get(), func->module_name, func->field_name,
- vec_args, vec_results, interpreter::Result::Ok);
- return interpreter::Result::Ok;
+ vec_args, vec_results, interp::Result::Ok);
+ return interp::Result::Ok;
}
void PrintError(const ErrorCallback& callback, const char* format, ...) {
@@ -236,8 +235,8 @@ static wabt::Result ReadAndRunModule(const char* module_filename) {
result = ReadModule(module_filename, &env, &error_handler, &module);
if (Succeeded(result)) {
Thread thread(&env, s_thread_options);
- interpreter::Result iresult = thread.RunStartFunction(module);
- if (iresult == interpreter::Result::Ok) {
+ interp::Result iresult = thread.RunStartFunction(module);
+ if (iresult == interp::Result::Ok) {
if (s_run_all_exports)
RunAllExports(module, &thread, RunVerbosity::Verbose);
} else {