mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | Friends
m::wasm::CodeGenContext Struct Reference

The Wasm CodeGenContext provides context information necessary for code generation. More...

#include <WasmUtil.hpp>

Collaboration diagram for m::wasm::CodeGenContext:
[legend]

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.
 
Environmentenv ()
 Returns the current Environment.
 
const Environmentenv () 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 CodeGenContextGet ()
 

Private Attributes

Environmentenv_ = 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
 

‍number of SIMD lanes currently used, i.e. 1 for scalar and at least 2 for vectorial values


 
std::size_t num_simd_lanes_preferred_ = 1
 

‍number of SIMD lanes currently preferred, i.e. 1 for scalar and at least 2 for vectorial values


 

Static Private Attributes

static thread_local std::unique_ptr< CodeGenContextthe_context_
 

Friends

struct Scope
 

Detailed Description

The Wasm CodeGenContext provides context information necessary for code generation.

The context contains:

Definition at line 851 of file WasmUtil.hpp.

Constructor & Destructor Documentation

◆ CodeGenContext() [1/2]

m::wasm::CodeGenContext::CodeGenContext ( )
default

◆ CodeGenContext() [2/2]

m::wasm::CodeGenContext::CodeGenContext ( const CodeGenContext )
delete

◆ ~CodeGenContext()

m::wasm::CodeGenContext::~CodeGenContext ( )
inline

Definition at line 868 of file WasmUtil.hpp.

References literals_, and num_tuples_.

Member Function Documentation

◆ add_literal()

void m::wasm::CodeGenContext::add_literal ( const char *  literal,
uint32_t  ptr 
)
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().

◆ Dispose()

static void m::wasm::CodeGenContext::Dispose ( )
inlinestatic

Definition at line 885 of file WasmUtil.hpp.

References M_insist, and the_context_.

◆ env() [1/2]

Environment & m::wasm::CodeGenContext::env ( )
inline

◆ env() [2/2]

const Environment & m::wasm::CodeGenContext::env ( ) const
inline

Returns the current Environment.

Definition at line 907 of file WasmUtil.hpp.

References env_, and M_insist.

◆ Get()

static CodeGenContext & m::wasm::CodeGenContext::Get ( )
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().

◆ get_literal_address()

NChar m::wasm::CodeGenContext::get_literal_address ( const char *  literal) const
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().

◆ get_literal_raw_address()

uint32_t m::wasm::CodeGenContext::get_literal_raw_address ( const char *  literal) const
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().

◆ inc_num_tuples()

void m::wasm::CodeGenContext::inc_num_tuples ( U32x1  n = U32x1(1))
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().

◆ Init()

static void m::wasm::CodeGenContext::Init ( )
inlinestatic

Definition at line 881 of file WasmUtil.hpp.

References M_insist, and the_context_.

◆ num_simd_lanes()

std::size_t m::wasm::CodeGenContext::num_simd_lanes ( ) const
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()().

◆ num_simd_lanes_preferred()

std::size_t m::wasm::CodeGenContext::num_simd_lanes_preferred ( ) const
inline

◆ num_tuples()

U32x1 m::wasm::CodeGenContext::num_tuples ( ) const
inline

Returns the number of result tuples produced.

Definition at line 910 of file WasmUtil.hpp.

References num_tuples_.

Referenced by write_result_set().

◆ scoped_environment() [1/2]

Scope m::wasm::CodeGenContext::scoped_environment ( )
inline

◆ scoped_environment() [2/2]

Scope m::wasm::CodeGenContext::scoped_environment ( Environment  env)
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.

References env(), and Scope.

◆ set_num_simd_lanes()

void m::wasm::CodeGenContext::set_num_simd_lanes ( std::size_t  n)
inline

◆ set_num_tuples()

void m::wasm::CodeGenContext::set_num_tuples ( U32x1  n)
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().

◆ update_num_simd_lanes_preferred()

void m::wasm::CodeGenContext::update_num_simd_lanes_preferred ( std::size_t  n)
inline

Friends And Related Function Documentation

◆ Scope

friend struct Scope
friend

Definition at line 853 of file WasmUtil.hpp.

Referenced by scoped_environment().

Field Documentation

◆ env_

Environment* m::wasm::CodeGenContext::env_ = nullptr
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().

◆ literals_

std::unordered_map<const char*, std::pair<uint32_t, NChar> > m::wasm::CodeGenContext::literals_
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().

◆ num_simd_lanes_

std::size_t m::wasm::CodeGenContext::num_simd_lanes_ = 1
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().

◆ num_simd_lanes_preferred_

std::size_t m::wasm::CodeGenContext::num_simd_lanes_preferred_ = 1
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().

◆ num_tuples_

Global<U32x1> m::wasm::CodeGenContext::num_tuples_
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().

◆ the_context_

M_LCOV_EXCL_STOP thread_local std::unique_ptr< CodeGenContext > CodeGenContext::the_context_
staticprivate

Definition at line 878 of file WasmUtil.hpp.

Referenced by Dispose(), Get(), and Init().


The documentation for this struct was generated from the following files: