Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/shell-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,15 @@ struct ShellExternalInterface : ModuleRunner::ExternalInterface {
return true;
}

void trap(const char* why) override {
void trap(std::string_view why) override {
std::cout << "[trap " << why << "]\n";
throw TrapException();
}

void hostLimit(const char* why) override {
void hostLimit(std::string_view why) override {
std::cout << "[host limit " << why << "]\n";
throw HostLimitException();
}

void throwException(const WasmException& exn) override { throw exn; }
};

Expand Down
8 changes: 4 additions & 4 deletions src/tools/wasm-ctor-eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,12 @@ struct CtorEvalExternalInterface : EvallingModuleRunner::ExternalInterface {
throw FailToEvalException("grow table");
}

void trap(const char* why) override {
throw FailToEvalException(std::string("trap: ") + why);
void trap(std::string_view why) override {
throw FailToEvalException(std::string("trap: ") + std::string(why));
}

void hostLimit(const char* why) override {
throw FailToEvalException(std::string("trap: ") + why);
void hostLimit(std::string_view why) override {
throw FailToEvalException(std::string("trap: ") + std::string(why));
}

void throwException(const WasmException& exn) override {
Expand Down
20 changes: 11 additions & 9 deletions src/wasm-interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Flow {
}

Literals values;
Name breakTo; // if non-null, a break is going on
Name breakTo; // if non-null, a break is going on
Tag* suspendTag = nullptr; // if non-null, breakTo must be SUSPEND_FLOW, and
// this is the tag being suspended

Expand Down Expand Up @@ -2694,9 +2694,9 @@ class ExpressionRunner : public OverriddenVisitor<SubType, Flow> {
return makeGCData(std::move(contents), curr->type);
}

virtual void trap(const char* why) { WASM_UNREACHABLE("unimp"); }
virtual void trap(std::string_view why) { WASM_UNREACHABLE("unimp"); }

virtual void hostLimit(const char* why) { WASM_UNREACHABLE("unimp"); }
virtual void hostLimit(std::string_view why) { WASM_UNREACHABLE("unimp"); }

virtual void throwException(const WasmException& exn) {
WASM_UNREACHABLE("unimp");
Expand Down Expand Up @@ -2929,9 +2929,11 @@ class ConstantExpressionRunner : public ExpressionRunner<SubType> {
Flow visitResumeThrow(ResumeThrow* curr) { return Flow(NONCONSTANT_FLOW); }
Flow visitStackSwitch(StackSwitch* curr) { return Flow(NONCONSTANT_FLOW); }

void trap(const char* why) override { throw NonconstantException(); }
void trap(std::string_view why) override { throw NonconstantException(); }

void hostLimit(const char* why) override { throw NonconstantException(); }
void hostLimit(std::string_view why) override {
throw NonconstantException();
}

virtual void throwException(const WasmException& exn) override {
throw NonconstantException();
Expand Down Expand Up @@ -2974,8 +2976,8 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
const Literal& value,
Index oldSize,
Index newSize) = 0;
virtual void trap(const char* why) = 0;
virtual void hostLimit(const char* why) = 0;
virtual void trap(std::string_view why) = 0;
virtual void hostLimit(std::string_view why) = 0;
virtual void throwException(const WasmException& exn) = 0;
// Get the Tag instance for a tag implemented in the host, that is, not
// among the linked ModuleRunner instances, but imported from the host.
Expand Down Expand Up @@ -4741,13 +4743,13 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
Flow visitResumeThrow(ResumeThrow* curr) { return doResume(curr); }
Flow visitStackSwitch(StackSwitch* curr) { return Flow(NONCONSTANT_FLOW); }

void trap(const char* why) override {
void trap(std::string_view why) override {
// Traps break all current continuations - they will never be resumable.
self()->clearContinuationStore();
externalInterface->trap(why);
}

void hostLimit(const char* why) override {
void hostLimit(std::string_view why) override {
self()->clearContinuationStore();
externalInterface->hostLimit(why);
}
Expand Down
Loading