Wasmtime
engine.hh
Go to the documentation of this file.
1
5#ifndef WASMTIME_ENGINE_HH
6#define WASMTIME_ENGINE_HH
7
8#include <cstdlib>
9#include <memory>
10#include <wasmtime/config.hh>
11#include <wasmtime/engine.h>
12#include <wasmtime/helpers.hh>
13
14namespace wasmtime {
15
23class Engine {
25#define wasm_engine_clone wasmtime_engine_clone
26 WASMTIME_CLONE_WRAPPER(Engine, wasm_engine);
27#undef wasm_engine_clone
28
30 Engine() : ptr(wasm_engine_new()) {}
34 explicit Engine(Config config)
35 : ptr(wasm_engine_new_with_config(config.capi_release())) {
36 if (!ptr) {
37 std::abort();
38 }
39 }
40
44 void increment_epoch() const { wasmtime_engine_increment_epoch(ptr.get()); }
45
47 bool is_pulley() const { return wasmtime_engine_is_pulley(ptr.get()); }
48};
49
50} // namespace wasmtime
51
52#endif // WASMTIME_ENGINE_HH
Global compilation state in Wasmtime.
Definition: engine.hh:23
WASM_API_EXTERN void wasmtime_engine_increment_epoch(const wasm_engine_t *engine)
Increments the engine-local epoch variable.
WASM_API_EXTERN bool wasmtime_engine_is_pulley(const wasm_engine_t *engine)
Returns whether this engine is using the Pulley interpreter to execute WebAssembly code.
wasm_engine_t * wasm_engine_new(void)
Creates a new engine with the default configuration.
wasm_engine_t * wasm_engine_new_with_config(wasm_config_t *)
Creates a new engine with the specified configuration.