diff options
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 02710d4b3..64dc824f6 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -98,9 +98,6 @@ public: } }; -// A list of literals, for function calls -typedef std::vector<Literal> LiteralList; - // Debugging helpers #ifdef WASM_INTERPRETER_DEBUG class Indenter { @@ -165,8 +162,7 @@ protected: // Maximum iterations before giving up on a loop. Index maxLoopIterations; - Flow generateArguments(const ExpressionList& operands, - LiteralList& arguments) { + Flow generateArguments(const ExpressionList& operands, Literals& arguments) { NOTE_ENTER_("generateArguments"); arguments.reserve(operands.size()); for (auto expression : operands) { @@ -1284,7 +1280,7 @@ public: } Flow visitTupleMake(TupleMake* curr) { NOTE_ENTER("tuple.make"); - LiteralList arguments; + Literals arguments; Flow flow = generateArguments(curr->operands, arguments); if (flow.breaking()) { return flow; @@ -1384,7 +1380,7 @@ public: Flow visitTry(Try* curr) { WASM_UNREACHABLE("unimp"); } Flow visitThrow(Throw* curr) { NOTE_ENTER("Throw"); - LiteralList arguments; + Literals arguments; Flow flow = generateArguments(curr->operands, arguments); if (flow.breaking()) { return flow; @@ -2306,11 +2302,11 @@ public: virtual ~ExternalInterface() = default; virtual void init(Module& wasm, SubType& instance) {} virtual void importGlobals(GlobalManager& globals, Module& wasm) = 0; - virtual Literals callImport(Function* import, LiteralList& arguments) = 0; + virtual Literals callImport(Function* import, Literals& arguments) = 0; virtual Literals callTable(Name tableName, Index index, HeapType sig, - LiteralList& arguments, + Literals& arguments, Type result, SubType& instance) = 0; virtual bool growMemory(Address oldSize, Address newSize) = 0; @@ -2510,13 +2506,13 @@ public: // run start, if present if (wasm.start.is()) { - LiteralList arguments; + Literals arguments; callFunction(wasm.start, arguments); } } // call an exported function - Literals callExport(Name name, const LiteralList& arguments) { + Literals callExport(Name name, const Literals& arguments) { Export* export_ = wasm.getExportOrNull(name); if (!export_) { externalInterface->trap("callExport not found"); @@ -2524,7 +2520,7 @@ public: return callFunction(export_->value, arguments); } - Literals callExport(Name name) { return callExport(name, LiteralList()); } + Literals callExport(Name name) { return callExport(name, Literals()); } // get an exported global Literals getExport(Name name) { @@ -2659,7 +2655,7 @@ public: std::vector<Literals> locals; Function* function; - FunctionScope(Function* function, const LiteralList& arguments) + FunctionScope(Function* function, const Literals& arguments) : function(function) { if (function->getParams().size() != arguments.size()) { std::cerr << "Function `" << function->name << "` expects " @@ -2731,7 +2727,7 @@ public: Flow visitCall(Call* curr) { NOTE_ENTER("Call"); NOTE_NAME(curr->target); - LiteralList arguments; + Literals arguments; Flow flow = this->generateArguments(curr->operands, arguments); if (flow.breaking()) { return flow; @@ -2755,7 +2751,7 @@ public: Flow visitCallIndirect(CallIndirect* curr) { NOTE_ENTER("CallIndirect"); - LiteralList arguments; + Literals arguments; Flow flow = this->generateArguments(curr->operands, arguments); if (flow.breaking()) { return flow; @@ -2780,7 +2776,7 @@ public: } Flow visitCallRef(CallRef* curr) { NOTE_ENTER("CallRef"); - LiteralList arguments; + Literals arguments; Flow flow = this->generateArguments(curr->operands, arguments); if (flow.breaking()) { return flow; @@ -3555,7 +3551,7 @@ public: }; // Call a function, starting an invocation. - Literals callFunction(Name name, const LiteralList& arguments) { + Literals callFunction(Name name, const Literals& arguments) { // if the last call ended in a jump up the stack, it might have left stuff // for us to clean up here callDepth = 0; @@ -3565,7 +3561,7 @@ public: // Internal function call. Must be public so that callTable implementations // can use it (refactor?) - Literals callFunctionInternal(Name name, const LiteralList& arguments) { + Literals callFunctionInternal(Name name, const Literals& arguments) { if (callDepth > maxDepth) { externalInterface->trap("stack limit"); } |