After upgrading our (ClickHouse's) libcxx from 15 to 16, the compiler
started to complain about usage of an incomplete type "RoseInstruction"
in this (header) function:
void RoseProgram::replace(Iter it, std::unique_ptr<RoseInstruction> ri) {
...
The reason is that libcxx 16 is the first version which implements C++23
constexpr std::unique_ptr (P2273R3, see (*)). RoseProgram::replace()
happens to be be const-evaluatable and the compiler tries to run
std::unique_ptr's ctor + dtor. This fails because at this point
RoseInstruction isn't defined yet.
There are two ways of fixing this:
1. Include rose_build_instruction.h (which contains RoseInstruction)
into rose_build_program.h. Disadvantage: The new include will
propagate transitively into all callers.
2. Move the function implementation into the source file which sees
RoseInstruction's definition already. Disadvantage: Template
instantiation is no longer automatic, instead there must be either a)
explicit template instantiation (e.g. in rose_build_program.cpp) or
b) all callers which instantiate the function must live in the same
source file and do the instantiations by themselves. Fortunately, the
latter is the case here, but potential future code outside
rose_build_program.cpp will require ugly explicit instantiation.
(*) https://en.cppreference.com/w/cpp/23
This commit replaces the ue2::unordered_{set,map} types with their STL
versions, with some new hashing utilities in util/hash.h. The new types
ue2_unordered_set<T> and ue2_unordered_map<Key, T> default to using the
ue2_hasher.
The header util/ue2_containers.h has been removed, and the flat_set/map
containers moved to util/flat_containers.h.
- Change the compile of literal matchers to two passes.
- Reverse the bucket assignment in FDR, bucket with longer literals has
smaller bucket id.
- Squash the buckets of included literals and jump to the the program of
included literals directly from parent literal program without going
through FDR confirm for included iterals.
Move the hash table used for long literal support in streaming mode from
FDR to Rose, and introduce new instructions CHECK_LONG_LIT and
CHECK_LONG_LIT_NOCASE for doing literal confirm for long literals.
This simplifies FDR confirm, and guarantees that HWLM matchers will only
be used for literals < 256 bytes long.
This commit replaces the build-time representation of the Rose
interpreter programs, from a class containing a discriminated union of
the bytecode structures to a class hierarchy of build-time prototypes.
This makes it easier to reason about and manipulate Rose programs during
compilation.