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
1 change: 1 addition & 0 deletions barretenberg/cpp/scripts/wasmtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -eu
export WASMTIME_BACKTRACE_DETAILS=1
exec wasmtime run \
-Wthreads=y \
-Wunknown-imports-trap=y \
-Sthreads=y \
${HARDWARE_CONCURRENCY:+--env HARDWARE_CONCURRENCY} \
--env HOME \
Expand Down
13 changes: 13 additions & 0 deletions barretenberg/cpp/src/barretenberg/env/throw_or_abort_impl.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
// In WASM builds, throw_or_abort_impl is provided by the JavaScript environment
// (declared as WASM_IMPORT in throw_or_abort_impl.hpp). The JS implementation
// throws a catchable JS Error with the error message.
//
// For non-JS WASM runtimes (wasmtime), the import must also be provided.
// See barretenberg/cpp/scripts/wasmtime.sh for the wasmtime configuration.
//
// We guard out the C++ definition so the JS import is used instead of being
// shadowed by the local definition (which would call std::abort).
#ifndef __wasm__

#include "barretenberg/common/log.hpp"
#include "barretenberg/common/wasm_export.hpp"
#include <stdexcept>
Expand Down Expand Up @@ -27,3 +38,5 @@ WASM_EXPORT void throw_or_abort_impl [[noreturn]] (const char* err)
abort_with_message(err);
#endif
}

#endif // !__wasm__
Loading