16template<
bool IsGlobal>
struct ChainedHashTable;
17template<
bool IsGlobal,
bool ValueInPlace>
struct OpenAddressingHashTable;
27template<
bool CmpPredicated,
bool IsGlobal>
28void quicksort(Buffer<IsGlobal> &buffer,
const std::vector<SortingOperator::order_type> &order);
65 template<sql_type T,
bool IsConst>
68 template<sql_type T,
bool IsConst>
69 requires (not std::same_as<T, NChar>)
and (T::num_simd_lanes == 1)
88 "either both or none of NULL byte and NULL mask must be specified");
122 M_insist(
bool(
is_null_byte_) == _value.can_be_null(),
"value of non-nullable entry must not be nullable");
128 *
value_ = _value.insist_not_null();
167 auto equal_nulls = is_null_.clone() ==
is_null;
184 M_insist(
bool(tru.is_null_byte_) ==
bool(fals.is_null_byte_),
"null byte mismatch");
185 M_insist(
bool(tru.is_null_mask_) ==
bool(fals.is_null_mask_),
"null mask mismatch");
186 if (tru.is_null_byte_) {
188 Select(cond.clone(), tru.value_, fals.value_),
189 Select(cond.clone(), *tru.is_null_byte_, *fals.is_null_byte_),
190 Select(cond.clone(), *tru.is_null_mask_, *fals.is_null_mask_)
200 template<
bool IsConst>
218 "either both or none of NULL byte and NULL mask must be specified");
264 IF (not addr.clone().is_null()) {
265 strncpy(addr_, addr.
clone(), U32x1(addr.size_in_bytes())).discard();
269 Wasm_insist(addr.clone().not_null(),
"value of non-nullable entry must not be nullable");
270 strncpy(addr_, addr, U32x1(addr.size_in_bytes())).discard();
278 strncpy(addr_, addr, U32x1(addr.size_in_bytes())).discard();
311 auto [addr, is_nullptr] = _addr.split();
315 auto [equal_addrs_val, equal_addrs_is_null] = _equal_addrs.split();
316 equal_addrs_is_null.discard();
319 auto equal_nulls = is_nullptr_.clone() == is_nullptr;
320 return equal_nulls
and (is_nullptr_ or equal_addrs_val);
322 return not is_nullptr
and equal_addrs_val;
339 M_insist(tru.addr_.can_be_null() == fals.addr_.can_be_null(),
"nullable mismatch");
340 M_insist(tru.addr_.length() == fals.addr_.length()
and
341 tru.addr_.guarantees_terminating_nul() == fals.addr_.guarantees_terminating_nul(),
343 M_insist(
bool(tru.is_null_byte_) ==
bool(fals.is_null_byte_),
"null byte mismatch");
344 M_insist(
bool(tru.is_null_mask_) ==
bool(fals.is_null_mask_),
"null mask mismatch");
345 if (tru.addr_.can_be_null()) {
347 NChar(
Select(cond.clone(), tru.addr_, fals.addr_),
true,
348 tru.addr_.length(), tru.addr_.guarantees_terminating_nul()),
349 Select(cond.clone(), *tru.is_null_byte_, *fals.is_null_byte_),
350 Select(cond.clone(), *tru.is_null_mask_, *fals.is_null_mask_)
356 tru.addr_.length(), tru.addr_.guarantees_terminating_nul()));
367 template<
bool IsConst>
374#define ADD_TYPE(TYPE) , the_reference<TYPE, IsConst>
383 [](
auto &r) { r.discard(); },
391 std::unordered_multimap<Schema::Identifier, value_t>
refs_;
401 refs_.reserve(refs.size());
402 for (
auto &p : refs) {
406 r.value_, std::move(r.is_null_byte_), std::move(r.is_null_mask_)
408 refs_.emplace(std::move(p.first), std::move(ref));
412 r.addr_, std::move(r.is_null_byte_), std::move(r.is_null_mask_)
414 refs_.emplace(std::move(p.first), std::move(ref));
423 for (
auto &p :
refs_)
444 auto it =
refs_.find(
id);
446 auto nh =
refs_.extract(it);
447 return std::move(nh.mapped());
453 M_insist(
refs_.count(
id) <= 1,
"duplicate identifier, lookup ambiguous");
454 auto it =
refs_.find(
id);
456 auto nh =
refs_.extract(it);
457 M_insist(std::holds_alternative<type>(nh.mapped()));
458 return std::move(*std::get_if<type>(&nh.mapped()));
463 M_insist(
refs_.count(
id) <= 1,
"duplicate identifier, lookup ambiguous");
464 auto it =
refs_.find(
id);
467 [](
auto &r) ->
value_t {
return r.clone(); },
474 using type = the_reference<T, IsConst>;
475 M_insist(
refs_.count(
id) <= 1,
"duplicate identifier, lookup ambiguous");
476 auto it =
refs_.find(
id);
478 M_insist(std::holds_alternative<type>(it->second));
479 return std::get_if<type>(&it->second)->clone();
491 static std::vector<SQL_t>
clone(
const std::vector<SQL_t> &values) {
492 std::vector<SQL_t> cpy;
493 cpy.reserve(values.size());
494 for (
auto &
value : values) {
496 [&](
auto &v) { cpy.push_back(v.clone()); },
560 virtual std::pair<entry_t, Boolx1>
try_emplace(std::vector<SQL_t> key) = 0;
567 virtual std::pair<entry_t, Boolx1>
find(std::vector<SQL_t> key,
hint_t bucket_hint =
hint_t()) = 0;
573 std::pair<const_entry_t, Boolx1>
find(std::vector<SQL_t> key,
hint_t bucket_hint =
hint_t())
const {
574 return const_cast<HashTable*
>(
this)->
find(std::move(key), std::move(bucket_hint));
599 const std::vector<const Type*> &types,
600 offset_t initial_offset_in_bytes = 0,
601 offset_t initial_max_alignment_in_bytes = 1);
607template<
bool IsGlobal>
624template<
bool IsGlobal>
680 void setup()
override;
689 if (percentage < 1.0) {
690 std::cerr <<
"warning: using chained collisions the load factor must be in [1,∞), ignore invalid value "
691 << percentage << std::endl;
702 auto high_watermark_absolute_floored = high_watermark_absolute_new.template to<int32_t>().make_unsigned();
703 Wasm_insist(high_watermark_absolute_floored.clone() >= 1U,
704 "at least one entry must be allowed to insert before growing the table");
717 void clear()
override;
722 std::pair<entry_t, Boolx1>
try_emplace(std::vector<SQL_t> key)
override;
724 std::pair<entry_t, Boolx1>
find(std::vector<SQL_t> key,
hint_t bucket_hint)
override;
728 hint_t bucket_hint)
const override;
810 virtual U32x1
mask()
const = 0;
832 if (percentage < 0.5 or percentage >= 1.0) {
833 std::cerr <<
"warning: using open addressing the load factor must be in [0.5,1), ignore invalid value "
834 << percentage << std::endl;
845 void clear()
override;
852template<
bool ValueInPlace>
880template<
bool IsGlobal>
898template<
bool IsGlobal,
bool ValueInPlace>
923 uint32_t initial_capacity);
938 void setup()
override;
947 auto _capacity =
capacity().make_signed().template to<double>();
954 "at least one entry must be allowed to insert before growing the table");
971 std::pair<entry_t, Boolx1>
try_emplace(std::vector<SQL_t> key)
override;
973 std::pair<entry_t, Boolx1>
find(std::vector<SQL_t> key,
hint_t bucket_hint)
override;
977 hint_t bucket_hint)
const override;
#define SQL_TYPES_SCALAR(X)
Global< Ptr< void > > address_
global backup for address of hash table
Global< U32x1 > num_entries_
global backup for number of occupied entries of hash table
Global< U32x1 > mask_
global backup for mask of hash table
Global< U32x1 > high_watermark_absolute_
global backup for absolute high watermark of hash table
std::vector< HashTable::offset_t > value_offsets_in_bytes_
HashTable::size_t values_max_alignment_in_bytes_
HashTable::offset_t keys_null_bitmap_offset_in_bytes_
only specified if at least one key entry is nullable
std::vector< HashTable::offset_t > key_offsets_in_bytes_
HashTable::size_t values_size_in_bytes_
HashTable::offset_t ptr_offset_in_bytes_
pointer to out-of-place values
HashTable::offset_t null_bitmap_offset_in_bytes_
only specified if at least one entry is nullable
std::vector< HashTable::offset_t > entry_offsets_in_bytes_
Global< U32x1 > num_entries_
global backup for number of occupied entries of hash table
Global< U32x1 > high_watermark_absolute_
global backup for absolute high watermark of hash table
Global< Ptr< void > > address_
global backup for address of hash table
Global< U32x1 > mask_
global backup for mask of hash table
#define M_unreachable(MSG)
_I32x1 strncmp(NChar left, NChar right, U32x1 len, bool reverse=false)
Compares two strings left and right.
template void quicksort< true >(GlobalBuffer &, const std::vector< SortingOperator::order_type > &)
Ptr< Charx1 > strncpy(Ptr< Charx1 > dst, Ptr< Charx1 > src, U32x1 count)
Copies the contents of src to dst, but no more than count characters.
U64x1 str_hash(NChar str)
Hashes the string str.
template void quicksort< false >(GlobalBuffer &, const std::vector< SortingOperator::order_type > &)
typename detail::var_helper< T >::type Var
Local variable.
auto make_unsigned()
Conversion of a PrimitiveExpr<T, L> to a PrimitiveExpr<std::make_unsigned_t<T>, L>.
auto make_signed()
Conversion of a PrimitiveExpr<T, L> to a PrimitiveExpr<std::make_signed_t<T>, L>.
U64x1 murmur3_bit_mix(U64x1 bits)
Mixes the bits of bits using the Murmur3 algorithm.
void quicksort(Buffer< IsGlobal > &buffer, const std::vector< SortingOperator::order_type > &order)
Sorts the buffer buffer using the quicksort algorithm and a branchless binary partition algorithm.
and
Constructs a new PrimitiveExpr from a constant value.
typename detail::global_helper< T >::type Global
Global variable.
Bool< L > is_null(SQL_t &variant)
PrimitiveExpr< uint64_t, L > L L L L U
U64x1 fnv_1a(Ptr< U8x1 > bytes, U32x1 num_bytes)
Hashes num_bytes bytes of bytes using the FNV-1a algorithm.
std::pair<::wasm::Expression *, std::list< std::shared_ptr< Bit > > > move()
Moves the underlying Binaryen ::wasm::Expression and the referenced bits out of this.
U64x1 murmur3_64a_hash(std::vector< std::pair< const Type *, SQL_t > > values)
Hashes the elements of values where the first element is the type of the value to hash and the second...
bool M_EXPORT contains(const H &haystack, const N &needle)
Checks whether haystack contains needle.
void M_EXPORT setbit(T *bytes, bool value, uint32_t n)
Implements push-based evaluation of a pipeline in the plan.
An Identifier is composed of a name and an optional prefix.
A Schema represents a sequence of identifiers, optionally with a prefix, and their associated types.
std::size_t num_entries() const
Returns the number of entries in this Schema.
Buffers tuples by materializing them into memory.
void rehash()
Performs rehashing, i.e.
std::optional< FunctionProxy< void(void)> > rehash_
function to perform rehashing; only possible for global hash tables since variables have to be updat...
void update_high_watermark()
Updates internal high watermark variables according to the currently set high watermark percentage.
HashTable::offset_t null_bitmap_offset_in_bytes_
offset of NULL bitmap; only specified if at least one entry is nullable
std::optional< Var< U32x1 > > high_watermark_absolute_
maximum number of entries before growing the hash table is required
Ptr< void > begin() const
Returns the address of the first bucket, i.e.
std::vector< std::pair< Ptr< void >, U32x1 > > dummy_allocations_
address-size pairs of dummy entry allocations
Ptr< void > end() const
Returns the address of the past-the-end bucket.
void setup() override
Performs the setup of all local variables of the hash table (by reading them from the global backups ...
U32x1 capacity() const
Returns the capacity of the hash table.
void clear() override
Clears the hash table.
std::pair< entry_t, Boolx1 > find(std::vector< SQL_t > key, hint_t bucket_hint) override
Tries to find an entry with key key in the hash table.
void for_each_in_equal_range(std::vector< SQL_t > key, callback_t Pipeline, bool predicated, hint_t bucket_hint) const override
Calls Pipeline for each entry with key key in the hash table, where the key comparison is performed p...
void for_each(callback_t Pipeline) const override
Calls Pipeline for each entry contained in the hash table.
U32x1 size_in_bytes() const
Returns the overall size in bytes of the actual hash table, i.e.
entry_t value_entry(Ptr< void > entry) const
Returns a handle for the entry at address entry which may be used to write the values of the correspo...
HashTable::offset_t ptr_offset_in_bytes_
offset of pointer to next entry in linked collision list
HashTable::size_t entry_size_in_bytes_
entry size in bytes
Boolx1 equal_key(Ptr< void > entry, std::vector< SQL_t > key) const
Compares the key of the entry at address entry with key and returns true iff they are equal.
std::pair< entry_t, Boolx1 > try_emplace(std::vector< SQL_t > key) override
If no entry with key key already exists, inserts one into the hash table, i.e.
std::optional< var_t< Ptr< void > > > predication_dummy_
dummy bucket used for predication
entry_t emplace_without_rehashing(std::vector< SQL_t > key)
Inserts an entry into the hash table with key key regardless whether it already exists,...
void teardown() override
Performs the teardown of all local variables of the hash table (by storing them into the global backu...
std::optional< Var< U32x1 > > num_entries_
number of occupied entries of hash table
void set_high_watermark(double percentage) override
Sets the high watermark, i.e.
HashTable::size_t entry_max_alignment_in_bytes_
alignment requirement in bytes of a single entry
std::vector< HashTable::offset_t > entry_offsets_in_bytes_
entry offsets, i.e.
void insert_key(Ptr< void > entry, std::vector< SQL_t > key)
Inserts the key key into the entry at address entry.
std::optional< Var< Ptr< void > > > address_
base address of hash table
chained_hash_table_storage< IsGlobal > storage_
if IsGlobal, contains backups for address, capacity, number of entries, and absolute high watermark
U32x1 mask() const
Returns the mask of the hash table, i.e.
Ptr< void > compute_bucket(std::vector< SQL_t > key) const override
Computes the bucket for key key.
entry_t dummy_entry() override
Returns a handle to a newly created dummy entry which may be used to write the values for this entry.
const_entry_t entry(Ptr< void > entry) const
Returns a handle for the entry at address entry which may be used to read both the keys and the value...
std::optional< Var< U32x1 > > mask_
mask of hash table, i.e. number of buckets / collision lists minus 1; always a power of 2 minus 1
void create_predication_dummy()
Creates dummy entry for predication.
ChainedHashTable(ChainedHashTable &&)=default
Ptr< void > hash_to_bucket(std::vector< SQL_t > key) const
Returns the bucket address for the key key by hashing it.
std::conditional_t< IsGlobal, Global< T >, Var< T > > var_t
variable type dependent on whether the hash table should be globally usable
entry_t emplace(std::vector< SQL_t > key) override
Inserts an entry into the hash table with key key regardless whether it already exists,...
double high_watermark_percentage_
fraction of occupied entries before growing the hash table is required
A handle to create a Function and to create invocations of that function.
Helper struct as proxy to access a hash table entry.
bool has(const Schema::Identifier &id) const
Returns true iff this contains identifier id.
the_reference< T, IsConst > extract(const Schema::Identifier &id)
Returns the moved entry for identifier id.
value_t get(const Schema::Identifier &id) const
Returns the copied entry for identifier id.
static void discard(value_t &ref)
Discards the held reference of ref.
the_entry(const the_entry &)=delete
std::variant< std::monostate #define ADD_TYPE(TYPE) SQL_TYPES_SCALAR(ADD_TYPE) > value_t
bool empty() const
Returns true iff this does not contain any references.
the_entry(std::unordered_multimap< Schema::Identifier, typename the_entry< not IsConst >::value_t > refs)
constructs an entry from references of the opposite const-ness
std::unordered_multimap< Schema::Identifier, value_t > refs_
maps Schema::Identifiers to the_reference<T, IsConst>s that reference the stored expression,...
the_entry(the_entry &&)=default
value_t extract(const Schema::Identifier &id)
Returns the moved entry for identifier id.
void add(Schema::Identifier id, the_reference< T, IsConst > &&ref)
Adds a mapping from identifier id to reference ref.
Boolx1 operator==(NChar _addr)
Compares this with the string stored at _addr.
friend the_reference Select(Boolx1 cond, the_reference tru, the_reference fals)
Selects either the reference tru or fals depending on the value of cond.
the_reference(NChar addr, Ptr< U8x1 > is_null_byte, U8x1 is_null_mask)
void operator=(NChar addr)
Assigns this to the string stored at addr.
std::optional< U8x1 > is_null_mask_
the_reference clone() const
Returns a deep copy of this.
std::optional< Ptr< U8x1 > > is_null_byte_
void set_null_bit(Boolx1 is_null)
Assigns the NULL bit of this to is_null. Does not update/modify the value of this.
void set_not_null()
Sets this to NOT NULL. Does not modify the value of this.
the_reference(NChar addr)
void discard()
Discards this.
the_reference(NChar addr, Ptr< void > null_bitmap, uint8_t null_bit_offset)
void set_null()
Sets this to NULL. Does not modify the value of this.
the_reference(NChar addr, std::optional< Ptr< U8x1 > > is_null_byte, std::optional< U8x1 > is_null_mask)
void set_value(NChar addr)
Assigns the value of this to the string stored at addr w/o updating the NULL bit.
Helper struct as proxy to access a single value (inclusive NULL bit) of a hash table entry.
Hash table to hash key-value pairs in memory.
the_reference(Ptr< value_t > value, Ptr< void > null_bitmap, uint8_t null_bit_offset)
static std::vector< SQL_t > clone(const std::vector< SQL_t > &values)
Copies the vector of SQL_ts values.
virtual void teardown()=0
Performs the teardown of the hash table.
void discard()
Discards this.
friend the_reference Select(Boolx1 cond, the_reference tru, the_reference fals)
Selects either the reference tru or fals depending on the value of cond.
std::optional< U8x1 > is_null_mask_
void set_null()
Sets this to NULL. Does not modify the value of this.
the_reference(Ptr< value_t > value)
virtual std::pair< entry_t, Boolx1 > try_emplace(std::vector< SQL_t > key)=0
If no entry with key key already exists, inserts one into the hash table, i.e.
virtual entry_t dummy_entry()=0
Returns a handle to a newly created dummy entry which may be used to write the values for this entry.
virtual void setup()=0
Performs the setup of the hash table.
void set_value(value_t value)
Assigns the value of this to value w/o updating the NULL bit.
the_reference(Ptr< value_t > value, Ptr< U8x1 > is_null_byte, U8x1 is_null_mask)
virtual entry_t emplace(std::vector< SQL_t > key)=0
Inserts an entry into the hash table with key key regardless whether it already exists,...
virtual void set_high_watermark(double percentage)=0
Sets the high watermark, i.e.
std::vector< index_t > key_indices_
keys of hash table
HashTable(const HashTable &)=delete
std::pair< const_entry_t, Boolx1 > find(std::vector< SQL_t > key, hint_t bucket_hint=hint_t()) const
Tries to find an entry with key key in the hash table.
void set_not_null()
Sets this to NOT NULL. Does not modify the value of this.
void operator=(T _value)
Assigns this to _value.
std::vector< index_t > value_indices_
values of hash table
std::function< void(const_entry_t)> callback_t
virtual Ptr< void > compute_bucket(std::vector< SQL_t > key) const =0
Computes the bucket for key key.
const Schema & schema() const
the_entry< false > entry_t
virtual std::pair< entry_t, Boolx1 > find(std::vector< SQL_t > key, hint_t bucket_hint=hint_t())=0
Tries to find an entry with key key in the hash table.
std::optional< Ptr< U8x1 > > is_null_byte_
std::optional< Ptr< void > > hint_t
virtual void for_each(callback_t Pipeline) const =0
Calls Pipeline for each entry contained in the hash table.
the_entry< true > const_entry_t
std::reference_wrapper< const Schema > schema_
schema of hash table
std::pair< size_t, size_t > set_byte_offsets(std::vector< offset_t > &offsets_in_bytes, const std::vector< const Type * > &types, offset_t initial_offset_in_bytes=0, offset_t initial_max_alignment_in_bytes=1)
Sets the byte offsets of an entry containing values of types types in offsets_in_bytes with the start...
Boolx1 operator==(T _value)
Compares this with _value.
HashTable(const Schema &schema, std::vector< index_t > key_indices)
Creates a hash table with schema schema and keys at key_indices.
the_reference(Ptr< value_t > value, std::optional< Ptr< U8x1 > > is_null_byte, std::optional< U8x1 > is_null_mask)
friend struct the_entry< true >
the_reference clone() const
Returns a deep copy of this.
virtual void for_each_in_equal_range(std::vector< SQL_t > key, callback_t Pipeline, bool predicated=false, hint_t bucket_hint=hint_t()) const =0
Calls Pipeline for each entry with key key in the hash table, where the key comparison is performed p...
virtual void clear()=0
Clears the hash table.
void set_null_bit(Boolx1 is_null)
Assigns the NULL bit of this to is_null. Does not update/modify the value of this.
HashTable(HashTable &&)=default
Linear probing strategy, i.e.
Ptr< void > skip_slots(Ptr< void > bucket, U32x1 skips) const override
Returns the address of the skips -th (starting with index 0) slot in the bucket starting at bucket.
Ptr< void > advance_to_next_slot(Ptr< void > slot, U32x1 current_step) const override
Returns the address of the current_step -th slot (starting with index 0) of a bucket which follows th...
LinearProbing(const OpenAddressingHashTableBase &ht)
std::size_t length() const
bool guarantees_terminating_nul() const
Probing strategy to handle collisions in an open addressing hash table.
ProbingStrategy(const OpenAddressingHashTableBase &ht)
virtual ~ProbingStrategy()
virtual Ptr< void > skip_slots(Ptr< void > bucket, U32x1 skips) const =0
Returns the address of the skips -th (starting with index 0) slot in the bucket starting at bucket.
virtual Ptr< void > advance_to_next_slot(Ptr< void > slot, U32x1 current_step) const =0
Returns the address of the current_step -th slot (starting with index 0) of a bucket which follows th...
const OpenAddressingHashTableBase & ht_
open addressing hash table which uses this probing strategy
HashTable::offset_t refs_offset_in_bytes_
offset in bytes for reference counter
HashTable::size_t entry_size_in_bytes() const
Returns the size in bytes of a single entry in the hash table.
double high_watermark_percentage_
fraction of occupied entries before growing the hash table is required
virtual Ptr< void > begin() const =0
Returns the address of the first entry.
void set_high_watermark(double percentage) override
Sets the high watermark, i.e.
HashTable::size_t entry_size_in_bytes_
entry size in bytes
Reference< ref_t > reference_count(Ptr< void > entry) const
Returns a Reference to the reference counter for the entry at address entry.
U32x1 size_in_bytes() const
Returns the overall size in bytes of the hash table.
std::unique_ptr< ProbingStrategy > probing_strategy_
probing strategy to handle collisions
virtual U32x1 mask() const =0
Returns the mask of the hash table, i.e.
const ProbingStrategy & probing_strategy() const
Returns the currently used probing strategy of the hash table.
void clear() override
Clears the hash table.
void set_probing_strategy()
Sets the hash table's probing strategy to.
virtual Ptr< void > end() const =0
Returns the address of the past-the-end entry.
Ptr< void > hash_to_bucket(std::vector< SQL_t > key) const
Returns the bucket address for the key key by hashing it.
uint32_t ref_t
4 bytes for reference counting
OpenAddressingHashTableBase(const Schema &schema, std::vector< index_t > key_indices)
Creates an open addressing hash table with schema schema and keys at key_indices.
HashTable::size_t entry_max_alignment_in_bytes_
alignment requirement in bytes of a single entry
virtual void update_high_watermark()
Updates internal high watermark variables according to the currently set high watermark percentage.
U32x1 capacity() const
Returns the capacity of the hash table.
Boolx1 equal_key(Ptr< void > slot, std::vector< SQL_t > key) const
Compares the key of the slot at address slot with key and returns true iff they are equal.
std::optional< Var< U32x1 > > high_watermark_absolute_
maximum number of entries before growing the hash table is required
const_entry_t entry(Ptr< void > slot) const
Returns a handle for the slot at address slot which may be used to read both the keys and the values ...
open_addressing_hash_table_storage< IsGlobal > storage_
if IsGlobal, contains backups for address, capacity, number of entries, and absolute high watermark
std::optional< var_t< Ptr< void > > > predication_dummy_
dummy entry used for predication
void for_each(callback_t Pipeline) const override
Calls Pipeline for each entry contained in the hash table.
void teardown() override
Performs the teardown of all local variables of the hash table (by storing them into the global backu...
std::optional< FunctionProxy< void(void)> > rehash_
function to perform rehashing; only possible for global hash tables since variables have to be updat...
std::optional< Var< U32x1 > > num_entries_
number of occupied entries of hash table
void rehash()
Performs rehashing, i.e.
std::optional< Var< U32x1 > > mask_
mask of hash table; always a power of 2 minus 1, i.e. 0b0..01..1
void update_high_watermark() override
Updates internal high watermark variables according to the currently set high watermark percentage.
std::pair< entry_t, Boolx1 > try_emplace(std::vector< SQL_t > key) override
If no entry with key key already exists, inserts one into the hash table, i.e.
entry_t value_entry(Ptr< void > ptr) const
Returns a handle which may be used to write the values of the corresponding entry.
void setup() override
Performs the setup of all local variables of the hash table (by reading them from the global backups ...
std::optional< Var< Ptr< void > > > address_
base address of hash table
std::pair< entry_t, Boolx1 > find(std::vector< SQL_t > key, hint_t bucket_hint) override
Tries to find an entry with key key in the hash table.
Ptr< void > emplace_without_rehashing(std::vector< SQL_t > key)
Inserts an entry into the hash table with key key regardless whether it already exists,...
U32x1 mask() const override
Returns the mask of the hash table, i.e.
void create_predication_dummy()
Creates dummy entry for predication.
std::vector< std::pair< Ptr< void >, U32x1 > > dummy_allocations_
address-size pairs of dummy entry allocations
Ptr< void > begin() const override
Returns the address of the first entry.
Ptr< void > end() const override
Returns the address of the past-the-end entry.
Ptr< void > compute_bucket(std::vector< SQL_t > key) const override
Computes the bucket for key key.
entry_t emplace(std::vector< SQL_t > key) override
Inserts an entry into the hash table with key key regardless whether it already exists,...
OpenAddressingHashTable(OpenAddressingHashTable &&)=default
void insert_key(Ptr< void > slot, std::vector< SQL_t > key)
Inserts the key key into the slot at address slot.
std::conditional_t< IsGlobal, Global< T >, Var< T > > var_t
variable type dependent on whether the hash table should be globally usable
entry_t dummy_entry() override
Returns a handle to a newly created dummy entry which may be used to write the values for this entry.
~OpenAddressingHashTable()
void for_each_in_equal_range(std::vector< SQL_t > key, callback_t Pipeline, bool predicated, hint_t bucket_hint) const override
Calls Pipeline for each entry with key key in the hash table, where the key comparison is performed p...
open_addressing_hash_table_layout< ValueInPlace > layout_
layout of hash table
Quadratic probing strategy, i.e.
Ptr< void > skip_slots(Ptr< void > bucket, U32x1 skips) const override
Returns the address of the skips -th (starting with index 0) slot in the bucket starting at bucket.
QuadraticProbing(const OpenAddressingHashTableBase &ht)
Ptr< void > advance_to_next_slot(Ptr< void > slot, U32x1 current_step) const override
Returns the address of the current_step -th slot (starting with index 0) of a bucket which follows th...