![]() |
mutable
A Database System for Research and Fast Prototyping
|
A WasmEngine
provides an environment to compile and execute WebAssembly modules.
More...
#include <WebAssembly.hpp>
Data Structures | |
struct | WasmContext |
A WasmContext holds associated information of a WebAssembly module instance. More... | |
Public Member Functions | |
WasmEngine ()=default | |
virtual | ~WasmEngine () |
WasmEngine (const WasmEngine &)=delete | |
WasmEngine (WasmEngine &&)=default | |
virtual void | compile (const MatchBase &plan) const =0 |
Compiles the already computed physical covering represented by plan using this WasmEngine . | |
virtual void | execute (const MatchBase &plan)=0 |
Executes the already computed physical covering represented by plan using this WasmEngine . | |
Static Public Member Functions | |
static WasmContext & | Create_Wasm_Context_For_ID (unsigned id, const MatchBase &plan, WasmContext::config_t configuration=WasmContext::config_t(0x0), std::size_t size=WASM_MAX_MEMORY) |
Creates a new WasmContext for ID id with size bytes of virtual address space. | |
static std::pair< std::reference_wrapper< WasmContext >, bool > | Ensure_Wasm_Context_For_ID (unsigned id, const MatchBase &plan, WasmContext::config_t configuration=WasmContext::config_t(0x0), std::size_t size=WASM_MAX_MEMORY) |
If none exists, creates a new WasmContext for ID id with size bytes of virtual address space. | |
static void | Dispose_Wasm_Context (unsigned id) |
Disposes the WasmContext with ID id . | |
static void | Dispose_Wasm_Context (const WasmContext &ctx) |
Disposes the WasmContext ctx . | |
static WasmContext & | Get_Wasm_Context_By_ID (unsigned id) |
Returns a reference to the WasmContext with ID id . | |
static bool | Has_Wasm_Context (unsigned id) |
Tests if the WasmContext with ID id exists. | |
Static Public Attributes | |
static constexpr std::size_t | WASM_PAGE_SIZE = 1UL << 16 |
the size of a WebAssembly memory page, 64 KiB. | |
static constexpr std::size_t | WASM_MAX_MEMORY = (1UL << 32) - (1UL << 16) |
The maximum memory of a WebAssembly module: 2^32 - 2^16 bytes ≈ 4 GiB. | |
static constexpr std::size_t | WASM_ALIGNMENT = 8 |
The alignment that is suitable for all built-in types. | |
Static Private Attributes | |
static std::unordered_map< unsigned, std::unique_ptr< WasmContext > > | contexts_ |
| |
A WasmEngine
provides an environment to compile and execute WebAssembly modules.
Definition at line 16 of file WebAssembly.hpp.
|
default |
|
inlinevirtual |
Definition at line 116 of file WebAssembly.hpp.
|
delete |
|
default |
|
pure virtual |
Compiles the already computed physical covering represented by plan
using this WasmEngine
.
|
inlinestatic |
Creates a new WasmContext
for ID id
with size
bytes of virtual address space.
Definition at line 71 of file WebAssembly.hpp.
|
inlinestatic |
Disposes the WasmContext
ctx
.
Definition at line 103 of file WebAssembly.hpp.
References Dispose_Wasm_Context(), and m::WasmEngine::WasmContext::id.
Referenced by Dispose_Wasm_Context().
|
inlinestatic |
Disposes the WasmContext
with ID id
.
Definition at line 96 of file WebAssembly.hpp.
|
inlinestatic |
If none exists, creates a new WasmContext
for ID id
with size
bytes of virtual address space.
Definition at line 84 of file WebAssembly.hpp.
References contexts_.
|
pure virtual |
Executes the already computed physical covering represented by plan
using this WasmEngine
.
|
inlinestatic |
Returns a reference to the WasmContext
with ID id
.
Definition at line 106 of file WebAssembly.hpp.
References contexts_, and M_insist.
Referenced by m::wasm::detail::create_env(), index_scan_codegen_compilation(), index_scan_codegen_hybrid(), m::wasm::detail::index_seek(), m::wasm::detail::index_sequential_scan(), m::wasm::Module::Memory(), m::wasm::detail::read_result_set(), m::wasm::detail::run_inspector(), m::wasm::detail::set_wasm_instance_raw_memory(), and write_result_set().
|
inlinestatic |
Tests if the WasmContext
with ID id
exists.
Definition at line 113 of file WebAssembly.hpp.
References contexts_.
Referenced by m::wasm::Module::Memory().
|
inlinestaticprivate |
maps unique IDs to
WasmContext
instances
Definition at line 67 of file WebAssembly.hpp.
Referenced by Create_Wasm_Context_For_ID(), Dispose_Wasm_Context(), Ensure_Wasm_Context_For_ID(), Get_Wasm_Context_By_ID(), and Has_Wasm_Context().
|
staticconstexpr |
The alignment that is suitable for all built-in types.
Definition at line 23 of file WebAssembly.hpp.
|
staticconstexpr |
The maximum memory of a WebAssembly module: 2^32 - 2^16 bytes ≈ 4 GiB.
Definition at line 21 of file WebAssembly.hpp.
Referenced by m::wasm::Module::Memory(), m::wasm::Module::Module(), and m::WasmEngine::WasmContext::WasmContext().
|
staticconstexpr |
the size of a WebAssembly memory page, 64 KiB.
Definition at line 19 of file WebAssembly.hpp.
Referenced by m::wasm::Module::Module().