* \brief Global compilation state in Wasmtime. * * Created with either default configuration or with a specified instance of * configuration, an `Engine` is used as an umbrella "session" for all other * operations in Wasmtime. */
| 20 | * operations in Wasmtime. |
| 21 | */ |
| 22 | class Engine { |
| 23 | /// bridging wasm.h vs wasmtime.h conventions |
| 24 | #define wasm_engine_clone wasmtime_engine_clone |
| 25 | WASMTIME_CLONE_WRAPPER(Engine, wasm_engine); |
| 26 | #undef wasm_engine_clone |
| 27 | |
| 28 | /// \brief Creates an engine with default compilation settings. |
| 29 | Engine() : ptr(wasm_engine_new()) {} |
| 30 | /// \brief Creates an engine with the specified compilation settings. |
| 31 | explicit Engine(Config config) |
| 32 | : ptr(wasm_engine_new_with_config(config.capi_release())) {} |
| 33 | |
| 34 | /// \brief Increments the current epoch which may result in interrupting |
| 35 | /// currently executing WebAssembly in connected stores if the epoch is now |
| 36 | /// beyond the configured threshold. |
| 37 | void increment_epoch() const { wasmtime_engine_increment_epoch(ptr.get()); } |
| 38 | |
| 39 | /// \brief Returns whether this engine is using Pulley for execution. |
| 40 | bool is_pulley() const { return wasmtime_engine_is_pulley(ptr.get()); } |
| 41 | }; |
| 42 | |
| 43 | } // namespace wasmtime |
| 44 |
no outgoing calls