![]() |
mutable
A Database System for Research and Fast Prototyping
|
The Wasm CodeGenContext provides context information necessary for code generation.
More...
#include <WasmUtil.hpp>
Public Member Functions | |
| CodeGenContext ()=default | |
| CodeGenContext (const CodeGenContext &)=delete | |
| ~CodeGenContext () | |
| Scope | scoped_environment () |
Creates a new, scoped Environment. | |
| Scope | scoped_environment (Environment env) |
Creates a new Scope using the Environment env which is immediately used by the CodeGenContext. | |
| Environment & | env () |
Returns the current Environment. | |
| const Environment & | env () const |
Returns the current Environment. | |
| U32x1 | num_tuples () const |
| Returns the number of result tuples produced. | |
| void | set_num_tuples (U32x1 n) |
Set the number of result tuples produced to n. | |
| void | inc_num_tuples (U32x1 n=U32x1(1)) |
Increments the number of result tuples produced by n. | |
| void | add_literal (const char *literal, uint32_t ptr) |
Adds the string literal literal located at pointer offset ptr. | |
| uint32_t | get_literal_raw_address (const char *literal) const |
Returns the raw address at which literal is stored. | |
| NChar | get_literal_address (const char *literal) const |
Returns the address at which literal is stored. | |
| std::size_t | num_simd_lanes () const |
| Returns the number of SIMD lanes used. | |
| void | set_num_simd_lanes (std::size_t n) |
Sets the number of SIMD lanes used to n. | |
| std::size_t | num_simd_lanes_preferred () const |
| Returns the number of SIMD lanes preferred by other operators. | |
| void | update_num_simd_lanes_preferred (std::size_t n) |
Updates the number of SIMD lanes preferred by n. | |
Static Public Member Functions | |
| static void | Init () |
| static void | Dispose () |
| static CodeGenContext & | Get () |
Private Attributes | |
| Environment * | env_ = nullptr |
| environment for locally bound identifiers | |
| Global< U32x1 > | num_tuples_ |
| variable to hold the number of result tuples produced | |
| std::unordered_map< const char *, std::pair< uint32_t, NChar > > | literals_ |
| maps each literal to its address at which it is stored | |
| std::size_t | num_simd_lanes_ = 1 |
| |
| std::size_t | num_simd_lanes_preferred_ = 1 |
| |
Static Private Attributes | |
| static thread_local std::unique_ptr< CodeGenContext > | the_context_ |
Friends | |
| struct | Scope |
The Wasm CodeGenContext provides context information necessary for code generation.
The context contains:
Environment of named values, e.g. SQL attribute valuesExprCompiler to compile expressions within the current EnvironmentDefinition at line 851 of file WasmUtil.hpp.
|
default |
|
delete |
|
inline |
Definition at line 868 of file WasmUtil.hpp.
References literals_, and num_tuples_.
|
inline |
Adds the string literal literal located at pointer offset ptr.
Definition at line 917 of file WasmUtil.hpp.
References literals_, and M_insist.
Referenced by m::wasm::detail::create_env().
|
inlinestatic |
Definition at line 885 of file WasmUtil.hpp.
References M_insist, and the_context_.
|
inline |
Returns the current Environment.
Definition at line 905 of file WasmUtil.hpp.
References env_, and M_insist.
Referenced by m::wasm::and(), m::wasm::compile_data_layout_point_access(), m::wasm::Aggregation::execute(), m::wasm::Filter< Predicated >::execute(), m::wasm::HashBasedGrouping::execute(), m::wasm::HashBasedGroupJoin::execute(), m::wasm::LazyDisjunctiveFilter::execute(), m::wasm::Projection::execute(), m::wasm::SimpleHashJoin< UniqueBuild, Predicated >::execute(), m::wasm::SortMergeJoin< SortLeft, SortRight, Predicated, CmpPredicated >::execute(), m::wasm::ChainedHashTable< IsGlobal >::for_each_in_equal_range(), m::wasm::OpenAddressingHashTable< IsGlobal, ValueInPlace >::for_each_in_equal_range(), m::wasm::buffer_swap_proxy_t< IsGlobal >::operator()(), and scoped_environment().
|
inline |
Returns the current Environment.
Definition at line 907 of file WasmUtil.hpp.
|
inlinestatic |
Definition at line 889 of file WasmUtil.hpp.
References M_insist, and the_context_.
Referenced by m::wasm::and(), m::wasm::ExprCompiler::compile(), m::wasm::compile_data_layout_point_access(), m::wasm::ChainedHashTable< IsGlobal >::compute_bucket(), m::wasm::OpenAddressingHashTable< IsGlobal, ValueInPlace >::compute_bucket(), m::wasm::Buffer< IsGlobal >::consume(), m::wasm::detail::create_env(), m::wasm::ChainedHashTable< IsGlobal >::emplace_without_rehashing(), m::wasm::OpenAddressingHashTable< IsGlobal, ValueInPlace >::emplace_without_rehashing(), m::wasm::Aggregation::execute(), m::wasm::Filter< Predicated >::execute(), m::wasm::HashBasedGrouping::execute(), m::wasm::HashBasedGroupJoin::execute(), m::wasm::LazyDisjunctiveFilter::execute(), m::wasm::NestedLoopsJoin< Predicated >::execute(), m::wasm::NoOp::execute(), m::wasm::Projection::execute(), m::wasm::Quicksort< CmpPredicated >::execute(), m::wasm::Scan< SIMDfied >::execute(), m::wasm::SimpleHashJoin< UniqueBuild, Predicated >::execute(), m::wasm::SortMergeJoin< SortLeft, SortRight, Predicated, CmpPredicated >::execute(), m::execute_buffered(), m::wasm::Buffer< IsGlobal >::execute_pipeline(), m::wasm::Buffer< IsGlobal >::execute_pipeline_inline(), m::wasm::Scope::extract(), m::wasm::ChainedHashTable< IsGlobal >::for_each_in_equal_range(), m::wasm::OpenAddressingHashTable< IsGlobal, ValueInPlace >::for_each_in_equal_range(), index_scan_codegen_compilation(), index_scan_codegen_interpretation(), m::wasm::like(), m::wasm::like_contains(), m::wasm::ExprCompiler::operator()(), m::wasm::buffer_swap_proxy_t< IsGlobal >::operator()(), m::wasm::quicksort(), m::wasm::ChainedHashTable< IsGlobal >::rehash(), m::wasm::OpenAddressingHashTable< IsGlobal, ValueInPlace >::rehash(), m::wasm::Buffer< IsGlobal >::resume_pipeline(), m::wasm::Scope::Scope(), m::wasm::strncmp(), m::wasm::strncpy(), m::wasm::ChainedHashTable< IsGlobal >::try_emplace(), m::wasm::OpenAddressingHashTable< IsGlobal, ValueInPlace >::try_emplace(), write_result_set(), and m::wasm::Scope::~Scope().
|
inline |
Returns the address at which literal is stored.
Definition at line 932 of file WasmUtil.hpp.
References literals_, and M_insist.
Referenced by index_scan_codegen_compilation().
|
inline |
Returns the raw address at which literal is stored.
Definition at line 926 of file WasmUtil.hpp.
References literals_, and M_insist.
Referenced by index_scan_codegen_compilation().
|
inline |
Increments the number of result tuples produced by n.
Definition at line 914 of file WasmUtil.hpp.
References m::wasm::n, and num_tuples_.
Referenced by write_result_set().
|
inlinestatic |
Definition at line 881 of file WasmUtil.hpp.
References M_insist, and the_context_.
|
inline |
Returns the number of SIMD lanes used.
Definition at line 939 of file WasmUtil.hpp.
References num_simd_lanes_.
Referenced by m::wasm::Buffer< IsGlobal >::consume(), m::wasm::Aggregation::execute(), and m::wasm::ExprCompiler::operator()().
|
inline |
Returns the number of SIMD lanes preferred by other operators.
Definition at line 944 of file WasmUtil.hpp.
References num_simd_lanes_preferred_.
Referenced by m::wasm::Scan< SIMDfied >::execute(), m::wasm::Buffer< IsGlobal >::execute_pipeline(), m::wasm::Buffer< IsGlobal >::execute_pipeline_inline(), and m::wasm::Buffer< IsGlobal >::resume_pipeline().
|
inline |
Returns the number of result tuples produced.
Definition at line 910 of file WasmUtil.hpp.
References num_tuples_.
Referenced by write_result_set().
|
inline |
Creates a new, scoped Environment.
The new Environment is immediately used by the CodeGenContext. When the Scope is destroyed (i.e. when it goes out of scope or its method extract() is called), the old Environment is used again by the CodeGenContext.
Definition at line 897 of file WasmUtil.hpp.
References Scope.
Referenced by m::wasm::Aggregation::execute(), m::wasm::HashBasedGrouping::execute(), m::wasm::HashBasedGroupJoin::execute(), m::wasm::NestedLoopsJoin< Predicated >::execute(), m::wasm::Projection::execute(), m::wasm::Quicksort< CmpPredicated >::execute(), m::wasm::SimpleHashJoin< UniqueBuild, Predicated >::execute(), m::wasm::SortMergeJoin< SortLeft, SortRight, Predicated, CmpPredicated >::execute(), m::wasm::Buffer< IsGlobal >::execute_pipeline(), index_scan_codegen_interpretation(), m::wasm::like(), m::wasm::like_contains(), m::wasm::buffer_swap_proxy_t< IsGlobal >::operator()(), m::wasm::quicksort(), m::wasm::ChainedHashTable< IsGlobal >::rehash(), m::wasm::OpenAddressingHashTable< IsGlobal, ValueInPlace >::rehash(), m::wasm::Buffer< IsGlobal >::resume_pipeline(), m::wasm::strncmp(), m::wasm::strncpy(), and write_result_set().
|
inline |
Creates a new Scope using the Environment env which is immediately used by the CodeGenContext.
When the Scope is destroyed (i.e. when it goes out of scope or its method extract() is called), the old Environment is used again by the CodeGenContext.
Definition at line 901 of file WasmUtil.hpp.
|
inline |
Sets the number of SIMD lanes used to n.
Definition at line 941 of file WasmUtil.hpp.
References m::wasm::n, and num_simd_lanes_.
Referenced by m::wasm::Aggregation::execute(), m::wasm::Projection::execute(), m::wasm::Scan< SIMDfied >::execute(), m::wasm::Buffer< IsGlobal >::execute_pipeline(), m::wasm::Buffer< IsGlobal >::execute_pipeline_inline(), and m::wasm::Buffer< IsGlobal >::resume_pipeline().
|
inline |
Set the number of result tuples produced to n.
Definition at line 912 of file WasmUtil.hpp.
References m::wasm::n, and num_tuples_.
Referenced by m::wasm::NoOp::execute(), and write_result_set().
|
inline |
Updates the number of SIMD lanes preferred by n.
Definition at line 946 of file WasmUtil.hpp.
Referenced by m::wasm::Aggregation::execute(), m::wasm::Filter< Predicated >::execute(), m::wasm::Projection::execute(), and m::wasm::Scan< SIMDfied >::execute().
Definition at line 853 of file WasmUtil.hpp.
Referenced by scoped_environment().
|
private |
environment for locally bound identifiers
Definition at line 856 of file WasmUtil.hpp.
Referenced by env(), m::wasm::Scope::extract(), and m::wasm::Scope::~Scope().
|
private |
maps each literal to its address at which it is stored
Definition at line 858 of file WasmUtil.hpp.
Referenced by add_literal(), get_literal_address(), get_literal_raw_address(), and ~CodeGenContext().
|
private |
number of SIMD lanes currently used, i.e. 1 for scalar and at least 2 for vectorial values
Definition at line 860 of file WasmUtil.hpp.
Referenced by num_simd_lanes(), and set_num_simd_lanes().
|
private |
number of SIMD lanes currently preferred, i.e. 1 for scalar and at least 2 for vectorial values
Definition at line 862 of file WasmUtil.hpp.
Referenced by num_simd_lanes_preferred().
|
private |
variable to hold the number of result tuples produced
Definition at line 857 of file WasmUtil.hpp.
Referenced by inc_num_tuples(), num_tuples(), set_num_tuples(), and ~CodeGenContext().
|
staticprivate |
Definition at line 878 of file WasmUtil.hpp.