![]() |
mutable
A Database System for Research and Fast Prototyping
|
A WasmContext
holds associated information of a WebAssembly module instance.
More...
#include <WebAssembly.hpp>
Public Types | |
enum | config_t : uint64_t { TRAP_GUARD_PAGES = 0b1 } |
Public Member Functions | |
WasmContext (uint32_t id, const MatchBase &plan, config_t configuration, std::size_t size) | |
bool | config (config_t cfg) const |
uint32_t | map_table (const Table &table) |
Maps a table at the current start of heap and advances heap past the mapped region. | |
void | install_guard_page () |
Installs a guard page at the current heap and increments heap to the next page. | |
std::size_t | add_index (const idx::IndexBase &index) |
Adds an index to the WasmContext and returns its position in the vector as id. | |
Data Fields | |
unsigned | id |
a unique ID | |
const MatchBase & | plan |
current plan | |
std::unique_ptr< const storage::DataLayoutFactory > | result_set_factory |
| |
memory::AddressSpace | vm |
WebAssembly module instance's virtual address space aka. linear memory | |
uint32_t | heap = 0 |
beginning of the heap, encoded as offset from the beginning of the virtual address space | |
std::vector< std::reference_wrapper< const idx::IndexBase > > | indexes |
the indexes used in the query | |
Private Attributes | |
config_t | config_ |
A WasmContext
holds associated information of a WebAssembly module instance.
Definition at line 26 of file WebAssembly.hpp.
enum m::WasmEngine::WasmContext::config_t : uint64_t |
Enumerator | |
---|---|
TRAP_GUARD_PAGES | map guard pages with PROT_NONE to trap any accesses |
Definition at line 28 of file WebAssembly.hpp.
M_LCOV_EXCL_STOP WasmEngine::WasmContext::WasmContext | ( | uint32_t | id, |
const MatchBase & | plan, | ||
config_t | configuration, | ||
std::size_t | size | ||
) |
Definition at line 56 of file WebAssembly.cpp.
References install_guard_page(), M_insist, and m::WasmEngine::WASM_MAX_MEMORY.
|
inline |
Adds an index to the WasmContext
and returns its position in the vector as id.
Definition at line 59 of file WebAssembly.hpp.
References indexes.
|
inline |
Definition at line 47 of file WebAssembly.hpp.
References config_.
void WasmEngine::WasmContext::install_guard_page | ( | ) |
Installs a guard page at the current heap
and increments heap
to the next page.
Acknowledges TRAP_GUARD_PAGES
.
Definition at line 90 of file WebAssembly.cpp.
References m::get_pagesize(), m::Is_Page_Aligned(), M_DISCARD, and M_insist.
Referenced by WasmContext().
uint32_t WasmEngine::WasmContext::map_table | ( | const Table & | table | ) |
Maps a table at the current start of heap
and advances heap
past the mapped region.
Returns the address (in linear memory) of the mapped table. Installs guard pages after each mapping. Acknowledges TRAP_GUARD_PAGES
.
Definition at line 67 of file WebAssembly.cpp.
References m::Ceil_To_Next_Page(), m::storage::DataLayout::child(), m::Is_Page_Aligned(), m::Table::layout(), M_insist, m::memory::Memory::map(), m::Store::memory(), m::Store::num_rows(), m::storage::DataLayout::Node::num_tuples(), m::Table::store(), and m::storage::DataLayout::stride_in_bits().
|
private |
Definition at line 34 of file WebAssembly.hpp.
Referenced by config().
uint32_t m::WasmEngine::WasmContext::heap = 0 |
beginning of the heap, encoded as offset from the beginning of the virtual address space
Definition at line 42 of file WebAssembly.hpp.
unsigned m::WasmEngine::WasmContext::id |
a unique ID
Definition at line 37 of file WebAssembly.hpp.
Referenced by m::wasm::detail::create_js_debug_script(), and m::WasmEngine::Dispose_Wasm_Context().
std::vector<std::reference_wrapper<const idx::IndexBase> > m::WasmEngine::WasmContext::indexes |
the indexes used in the query
Definition at line 43 of file WebAssembly.hpp.
Referenced by add_index().
const MatchBase& m::WasmEngine::WasmContext::plan |
current plan
Definition at line 38 of file WebAssembly.hpp.
std::unique_ptr<const storage::DataLayoutFactory> m::WasmEngine::WasmContext::result_set_factory |
factory used to create the result set data layout
Definition at line 40 of file WebAssembly.hpp.
memory::AddressSpace m::WasmEngine::WasmContext::vm |
WebAssembly module instance's virtual address space aka. linear memory
Definition at line 41 of file WebAssembly.hpp.
Referenced by m::wasm::Module::Memory().