mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-13 22:06:55 +00:00
tbv2: replace DB template param with Ctx
TreeBuilder v2 adds a DB template parameter to every function. This is used as part of the static type to decide what type of DataBuffer is being used: currently `BackInserterDataBuffer<std::vector<uint8_t>>` for OIL and it would be `DataSegmentDataBuffer` for OID. This change replaces the `DB` template parameter with a more general `Ctx`. Due to issues with dependent naming it also adds a `using DB` to each `TypeHandler` which has the same function as before. This allows us to add more "static context" (typedefs and constants) to functions without changing this signature again, because changing the signature of everything is a massive pain. Currently this change achieves nothing because Ctx contains only DB in a static wrapper. In the next change I'm going to pass a reference of type Ctx around to add a "dynamic context" to invocations which will contain the pointer array. In future we'll then be able to add either static or dynamic context without any signature adjustments. Test plan: - CI
This commit is contained in:
parent
8647b87c1b
commit
ba79e50fb4
@ -651,7 +651,7 @@ void CodeGen::genClassTraversalFunction(const Class& c, std::string& code) {
|
|||||||
code += funcName;
|
code += funcName;
|
||||||
code += "(\n const ";
|
code += "(\n const ";
|
||||||
code += c.name();
|
code += c.name();
|
||||||
code += "& t,\n typename TypeHandler<DB, ";
|
code += "& t,\n typename TypeHandler<Ctx, ";
|
||||||
code += c.name();
|
code += c.name();
|
||||||
code += ">::type returnArg) {\n";
|
code += ">::type returnArg) {\n";
|
||||||
|
|
||||||
@ -683,7 +683,7 @@ void CodeGen::genClassTraversalFunction(const Class& c, std::string& code) {
|
|||||||
} else {
|
} else {
|
||||||
code += "delegate";
|
code += "delegate";
|
||||||
}
|
}
|
||||||
code += "([&t](auto ret) { return OIInternal::getSizeType<DB>(t.";
|
code += "([&t](auto ret) { return OIInternal::getSizeType<Ctx>(t.";
|
||||||
code += member.name;
|
code += member.name;
|
||||||
code += ", ret); })";
|
code += ", ret); })";
|
||||||
}
|
}
|
||||||
@ -695,7 +695,7 @@ void CodeGen::genClassTraversalFunction(const Class& c, std::string& code) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate the static type for the class's representation in the data buffer.
|
// Generate the static type for the class's representation in the data buffer.
|
||||||
// For `class { int a,b,c; }` we generate (DB omitted for clarity):
|
// For `class { int a,b,c; }` we generate (Ctx/DB omitted for clarity):
|
||||||
// Pair<TypeHandler<int>::type,
|
// Pair<TypeHandler<int>::type,
|
||||||
// Pair<TypeHandler<int>::type,
|
// Pair<TypeHandler<int>::type,
|
||||||
// TypeHandler<int>::type
|
// TypeHandler<int>::type
|
||||||
@ -734,7 +734,7 @@ void CodeGen::genClassStaticType(const Class& c, std::string& code) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
code +=
|
code +=
|
||||||
(boost::format("typename TypeHandler<DB, decltype(%1%::%2%)>::type") %
|
(boost::format("typename TypeHandler<Ctx, decltype(%1%::%2%)>::type") %
|
||||||
c.name() % member.name)
|
c.name() % member.name)
|
||||||
.str();
|
.str();
|
||||||
|
|
||||||
@ -787,8 +787,8 @@ void CodeGen::genClassTreeBuilderInstructions(const Class& c,
|
|||||||
code += " inst::Field{sizeof(" + fullName + "), " +
|
code += " inst::Field{sizeof(" + fullName + "), " +
|
||||||
std::to_string(calculateExclusiveSize(m.type())) + ",\"" +
|
std::to_string(calculateExclusiveSize(m.type())) + ",\"" +
|
||||||
m.inputName + "\", member_" + std::to_string(index) +
|
m.inputName + "\", member_" + std::to_string(index) +
|
||||||
"_type_names, TypeHandler<DB, decltype(" + fullName +
|
"_type_names, TypeHandler<Ctx, decltype(" + fullName +
|
||||||
")>::fields, TypeHandler<DB, decltype(" + fullName +
|
")>::fields, TypeHandler<Ctx, decltype(" + fullName +
|
||||||
")>::processors},\n";
|
")>::processors},\n";
|
||||||
}
|
}
|
||||||
code += " };\n";
|
code += " };\n";
|
||||||
@ -820,10 +820,11 @@ void CodeGen::genClassTypeHandler(const Class& c, std::string& code) {
|
|||||||
.str();
|
.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
code += "template <typename DB>\n";
|
code += "template <typename Ctx>\n";
|
||||||
code += "class TypeHandler<DB, ";
|
code += "class TypeHandler<Ctx, ";
|
||||||
code += c.name();
|
code += c.name();
|
||||||
code += "> {\n";
|
code += "> {\n";
|
||||||
|
code += " using DB = typename Ctx::DataBuffer;\n";
|
||||||
code += helpers;
|
code += helpers;
|
||||||
code += " public:\n";
|
code += " public:\n";
|
||||||
code += " using type = ";
|
code += " using type = ";
|
||||||
@ -877,7 +878,7 @@ void genContainerTypeHandler(std::unordered_set<const ContainerInfo*>& used,
|
|||||||
containerWithTypes = "OICaptureKeys<" + containerWithTypes + ">";
|
containerWithTypes = "OICaptureKeys<" + containerWithTypes + ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
code += "template <typename DB";
|
code += "template <typename Ctx";
|
||||||
types = 0, values = 0;
|
types = 0, values = 0;
|
||||||
for (const auto& p : templateParams) {
|
for (const auto& p : templateParams) {
|
||||||
if (p.value) {
|
if (p.value) {
|
||||||
@ -889,9 +890,10 @@ void genContainerTypeHandler(std::unordered_set<const ContainerInfo*>& used,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
code += ">\n";
|
code += ">\n";
|
||||||
code += "struct TypeHandler<DB, ";
|
code += "struct TypeHandler<Ctx, ";
|
||||||
code += containerWithTypes;
|
code += containerWithTypes;
|
||||||
code += "> {\n";
|
code += "> {\n";
|
||||||
|
code += " using DB = typename Ctx::DataBuffer;\n";
|
||||||
|
|
||||||
if (c.captureKeys) {
|
if (c.captureKeys) {
|
||||||
code += " static constexpr bool captureKeys = true;\n";
|
code += " static constexpr bool captureKeys = true;\n";
|
||||||
@ -922,7 +924,7 @@ void genContainerTypeHandler(std::unordered_set<const ContainerInfo*>& used,
|
|||||||
code += " const ";
|
code += " const ";
|
||||||
code += containerWithTypes;
|
code += containerWithTypes;
|
||||||
code += "& container,\n";
|
code += "& container,\n";
|
||||||
code += " typename TypeHandler<DB, ";
|
code += " typename TypeHandler<Ctx, ";
|
||||||
code += containerWithTypes;
|
code += containerWithTypes;
|
||||||
code += ">::type returnArg) {\n";
|
code += ">::type returnArg) {\n";
|
||||||
code += func; // has rubbish indentation
|
code += func; // has rubbish indentation
|
||||||
@ -961,8 +963,9 @@ void genContainerTypeHandler(std::unordered_set<const ContainerInfo*>& used,
|
|||||||
|
|
||||||
void addCaptureKeySupport(std::string& code) {
|
void addCaptureKeySupport(std::string& code) {
|
||||||
code += R"(
|
code += R"(
|
||||||
template <typename DB, typename T>
|
template <typename Ctx, typename T>
|
||||||
class CaptureKeyHandler {
|
class CaptureKeyHandler {
|
||||||
|
using DB = typename Ctx::DataBuffer;
|
||||||
public:
|
public:
|
||||||
using type = types::st::Sum<DB, types::st::VarInt<DB>, types::st::VarInt<DB>>;
|
using type = types::st::Sum<DB, types::st::VarInt<DB>, types::st::VarInt<DB>>;
|
||||||
|
|
||||||
@ -975,24 +978,24 @@ void addCaptureKeySupport(std::string& code) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <bool CaptureKeys, typename DB, typename T>
|
template <bool CaptureKeys, typename Ctx, typename T>
|
||||||
auto maybeCaptureKey(const T& key, auto returnArg) {
|
auto maybeCaptureKey(const T& key, auto returnArg) {
|
||||||
if constexpr (CaptureKeys) {
|
if constexpr (CaptureKeys) {
|
||||||
return returnArg.delegate([&key](auto ret) {
|
return returnArg.delegate([&key](auto ret) {
|
||||||
return CaptureKeyHandler<DB, T>::captureKey(key, ret);
|
return CaptureKeyHandler<Ctx, T>::captureKey(key, ret);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return returnArg;
|
return returnArg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DB, typename T>
|
template <typename Ctx, typename T>
|
||||||
static constexpr inst::ProcessorInst CaptureKeysProcessor{
|
static constexpr inst::ProcessorInst CaptureKeysProcessor{
|
||||||
CaptureKeyHandler<DB, T>::type::describe,
|
CaptureKeyHandler<Ctx, T>::type::describe,
|
||||||
[](result::Element& el, std::function<void(inst::Inst)> stack_ins, ParsedData d) {
|
[](result::Element& el, std::function<void(inst::Inst)> stack_ins, ParsedData d) {
|
||||||
if constexpr (std::is_same_v<
|
if constexpr (std::is_same_v<
|
||||||
typename CaptureKeyHandler<DB, T>::type,
|
typename CaptureKeyHandler<Ctx, T>::type,
|
||||||
types::st::List<DB, types::st::VarInt<DB>>>) {
|
types::st::List<typename Ctx::DataBuffer, types::st::VarInt<typename Ctx::DataBuffer>>>) {
|
||||||
// String
|
// String
|
||||||
auto& str = el.data.emplace<std::string>();
|
auto& str = el.data.emplace<std::string>();
|
||||||
auto list = std::get<ParsedData::List>(d.val);
|
auto list = std::get<ParsedData::List>(d.val);
|
||||||
@ -1013,11 +1016,11 @@ void addCaptureKeySupport(std::string& code) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <bool CaptureKeys, typename DB, typename T>
|
template <bool CaptureKeys, typename Ctx, typename T>
|
||||||
static constexpr auto maybeCaptureKeysProcessor() {
|
static constexpr auto maybeCaptureKeysProcessor() {
|
||||||
if constexpr (CaptureKeys) {
|
if constexpr (CaptureKeys) {
|
||||||
return std::array<inst::ProcessorInst, 1>{
|
return std::array<inst::ProcessorInst, 1>{
|
||||||
CaptureKeysProcessor<DB, T>,
|
CaptureKeysProcessor<Ctx, T>,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1034,28 +1037,28 @@ void addStandardTypeHandlers(TypeGraph& typeGraph,
|
|||||||
addCaptureKeySupport(code);
|
addCaptureKeySupport(code);
|
||||||
|
|
||||||
// Provide a wrapper function, getSizeType, to infer T instead of having to
|
// Provide a wrapper function, getSizeType, to infer T instead of having to
|
||||||
// explicitly specify it with TypeHandler<DB, T>::getSizeType every time.
|
// explicitly specify it with TypeHandler<Ctx, T>::getSizeType every time.
|
||||||
code += R"(
|
code += R"(
|
||||||
template <typename DB, typename T>
|
template <typename Ctx, typename T>
|
||||||
types::st::Unit<DB>
|
types::st::Unit<typename Ctx::DataBuffer>
|
||||||
getSizeType(const T &t, typename TypeHandler<DB, T>::type returnArg) {
|
getSizeType(const T &t, typename TypeHandler<Ctx, T>::type returnArg) {
|
||||||
JLOG("obj @");
|
JLOG("obj @");
|
||||||
JLOGPTR(&t);
|
JLOGPTR(&t);
|
||||||
return TypeHandler<DB, T>::getSizeType(t, returnArg);
|
return TypeHandler<Ctx, T>::getSizeType(t, returnArg);
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
if (features[Feature::TreeBuilderV2]) {
|
if (features[Feature::TreeBuilderV2]) {
|
||||||
code += R"(
|
code += R"(
|
||||||
template <typename DB, typename T>
|
template <typename Ctx, typename T>
|
||||||
constexpr inst::Field make_field(std::string_view name) {
|
constexpr inst::Field make_field(std::string_view name) {
|
||||||
return inst::Field{
|
return inst::Field{
|
||||||
sizeof(T),
|
sizeof(T),
|
||||||
ExclusiveSizeProvider<T>::size,
|
ExclusiveSizeProvider<T>::size,
|
||||||
name,
|
name,
|
||||||
NameProvider<T>::names,
|
NameProvider<T>::names,
|
||||||
TypeHandler<DB, T>::fields,
|
TypeHandler<Ctx, T>::fields,
|
||||||
TypeHandler<DB, T>::processors,
|
TypeHandler<Ctx, T>::processors,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
@ -268,11 +268,13 @@ void __attribute__((used, retain)) introspect_%2$016x(
|
|||||||
v.clear();
|
v.clear();
|
||||||
v.reserve(4096);
|
v.reserve(4096);
|
||||||
|
|
||||||
using DataBufferType = DataBuffer::BackInserter<std::vector<uint8_t>>;
|
struct Context {
|
||||||
using ContentType = OIInternal::TypeHandler<DataBufferType, OIInternal::__ROOT_TYPE__>::type;
|
using DataBuffer = DataBuffer::BackInserter<std::vector<uint8_t>>;
|
||||||
|
};
|
||||||
|
using ContentType = OIInternal::TypeHandler<Context, OIInternal::__ROOT_TYPE__>::type;
|
||||||
|
|
||||||
ContentType ret{DataBufferType{v}};
|
ContentType ret{Context::DataBuffer{v}};
|
||||||
OIInternal::getSizeType<DataBufferType>(t, ret);
|
OIInternal::getSizeType<Context>(t, ret);
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
@ -364,6 +366,9 @@ void FuncGen::DefineTreeBuilderInstructions(
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wunknown-attributes"
|
#pragma GCC diagnostic ignored "-Wunknown-attributes"
|
||||||
namespace {
|
namespace {
|
||||||
|
struct FakeContext {
|
||||||
|
using DataBuffer = int;
|
||||||
|
};
|
||||||
const std::array<std::string_view, )";
|
const std::array<std::string_view, )";
|
||||||
code += std::to_string(typeNames.size());
|
code += std::to_string(typeNames.size());
|
||||||
code += "> typeNames";
|
code += "> typeNames";
|
||||||
@ -382,8 +387,10 @@ const std::array<std::string_view, )";
|
|||||||
code += ", \"a0\", typeNames";
|
code += ", \"a0\", typeNames";
|
||||||
code += typeHash;
|
code += typeHash;
|
||||||
code +=
|
code +=
|
||||||
", OIInternal::TypeHandler<int, OIInternal::__ROOT_TYPE__>::fields, "
|
", OIInternal::TypeHandler<FakeContext, "
|
||||||
"OIInternal::TypeHandler<int, OIInternal::__ROOT_TYPE__>::processors};\n";
|
"OIInternal::__ROOT_TYPE__>::fields, "
|
||||||
|
"OIInternal::TypeHandler<FakeContext, "
|
||||||
|
"OIInternal::__ROOT_TYPE__>::processors};\n";
|
||||||
code += "} // namespace\n";
|
code += "} // namespace\n";
|
||||||
code +=
|
code +=
|
||||||
"extern const exporters::inst::Inst __attribute__((used, retain)) "
|
"extern const exporters::inst::Inst __attribute__((used, retain)) "
|
||||||
@ -595,14 +602,15 @@ class BackInserter {
|
|||||||
*/
|
*/
|
||||||
void FuncGen::DefineBasicTypeHandlers(std::string& code, FeatureSet features) {
|
void FuncGen::DefineBasicTypeHandlers(std::string& code, FeatureSet features) {
|
||||||
code += R"(
|
code += R"(
|
||||||
template <typename DB, typename T>
|
template <typename Ctx, typename T>
|
||||||
struct TypeHandler {
|
struct TypeHandler {
|
||||||
|
using DB = typename Ctx::DataBuffer;
|
||||||
private:
|
private:
|
||||||
static auto choose_type() {
|
static auto choose_type() {
|
||||||
if constexpr(std::is_pointer_v<T>) {
|
if constexpr(std::is_pointer_v<T>) {
|
||||||
return std::type_identity<types::st::Pair<DB,
|
return std::type_identity<types::st::Pair<DB,
|
||||||
types::st::VarInt<DB>,
|
types::st::VarInt<DB>,
|
||||||
types::st::Sum<DB, types::st::Unit<DB>, typename TypeHandler<DB, std::remove_pointer_t<T>>::type>
|
types::st::Sum<DB, types::st::Unit<DB>, typename TypeHandler<Ctx, std::remove_pointer_t<T>>::type>
|
||||||
>>();
|
>>();
|
||||||
} else {
|
} else {
|
||||||
return std::type_identity<types::st::Unit<DB>>();
|
return std::type_identity<types::st::Unit<DB>>();
|
||||||
@ -623,8 +631,8 @@ void FuncGen::DefineBasicTypeHandlers(std::string& code, FeatureSet features) {
|
|||||||
sizeof(T),
|
sizeof(T),
|
||||||
"*",
|
"*",
|
||||||
names,
|
names,
|
||||||
TypeHandler<DB, T>::fields,
|
TypeHandler<Ctx, T>::fields,
|
||||||
TypeHandler<DB, T>::processors,
|
TypeHandler<Ctx, T>::processors,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ParsedData::Sum& sum = std::get<ParsedData::Sum>(d.val);
|
const ParsedData::Sum& sum = std::get<ParsedData::Sum>(d.val);
|
||||||
@ -649,7 +657,7 @@ void FuncGen::DefineBasicTypeHandlers(std::string& code, FeatureSet features) {
|
|||||||
if constexpr(std::is_pointer_v<T>) {
|
if constexpr(std::is_pointer_v<T>) {
|
||||||
return std::array<inst::ProcessorInst, 2>{
|
return std::array<inst::ProcessorInst, 2>{
|
||||||
{types::st::VarInt<DB>::describe, &process_pointer},
|
{types::st::VarInt<DB>::describe, &process_pointer},
|
||||||
{types::st::Sum<DB, types::st::Unit<DB>, typename TypeHandler<DB, std::remove_pointer_t<T>>::type>::describe, &process_pointer_content},
|
{types::st::Sum<DB, types::st::Unit<DB>, typename TypeHandler<Ctx, std::remove_pointer_t<T>>::type>::describe, &process_pointer_content},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return std::array<inst::ProcessorInst, 0>{};
|
return std::array<inst::ProcessorInst, 0>{};
|
||||||
@ -663,7 +671,7 @@ void FuncGen::DefineBasicTypeHandlers(std::string& code, FeatureSet features) {
|
|||||||
code += R"(
|
code += R"(
|
||||||
static types::st::Unit<DB> getSizeType(
|
static types::st::Unit<DB> getSizeType(
|
||||||
const T& t,
|
const T& t,
|
||||||
typename TypeHandler<DB, T>::type returnArg) {
|
typename TypeHandler<Ctx, T>::type returnArg) {
|
||||||
if constexpr(std::is_pointer_v<T>) {
|
if constexpr(std::is_pointer_v<T>) {
|
||||||
JLOG("ptr val @");
|
JLOG("ptr val @");
|
||||||
JLOGPTR(t);
|
JLOGPTR(t);
|
||||||
@ -671,7 +679,7 @@ void FuncGen::DefineBasicTypeHandlers(std::string& code, FeatureSet features) {
|
|||||||
if (t && pointers.add((uintptr_t)t)) {
|
if (t && pointers.add((uintptr_t)t)) {
|
||||||
return r0.template delegate<1>([&t](auto ret) {
|
return r0.template delegate<1>([&t](auto ret) {
|
||||||
if constexpr (!std::is_void<std::remove_pointer_t<T>>::value) {
|
if constexpr (!std::is_void<std::remove_pointer_t<T>>::value) {
|
||||||
return TypeHandler<DB, std::remove_pointer_t<T>>::getSizeType(*t, ret);
|
return TypeHandler<Ctx, std::remove_pointer_t<T>>::getSizeType(*t, ret);
|
||||||
} else {
|
} else {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -687,8 +695,9 @@ void FuncGen::DefineBasicTypeHandlers(std::string& code, FeatureSet features) {
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
code += R"(
|
code += R"(
|
||||||
template <typename DB>
|
template <typename Ctx>
|
||||||
class TypeHandler<DB, void> {
|
class TypeHandler<Ctx, void> {
|
||||||
|
using DB = typename Ctx::DataBuffer;
|
||||||
public:
|
public:
|
||||||
using type = types::st::Unit<DB>;
|
using type = types::st::Unit<DB>;
|
||||||
)";
|
)";
|
||||||
@ -711,21 +720,21 @@ ContainerInfo FuncGen::GetOiArrayContainerInfo() {
|
|||||||
auto tail = returnArg.write(N0);
|
auto tail = returnArg.write(N0);
|
||||||
for (size_t i=0; i<N0; i++) {
|
for (size_t i=0; i<N0; i++) {
|
||||||
tail = tail.delegate([&container, i](auto ret) {
|
tail = tail.delegate([&container, i](auto ret) {
|
||||||
return TypeHandler<DB, T0>::getSizeType(container.vals[i], ret);
|
return TypeHandler<Ctx, T0>::getSizeType(container.vals[i], ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return tail.finish();
|
return tail.finish();
|
||||||
)";
|
)";
|
||||||
oiArray.codegen.processors.emplace_back(ContainerInfo::Processor{
|
oiArray.codegen.processors.emplace_back(ContainerInfo::Processor{
|
||||||
.type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>",
|
.type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>",
|
||||||
.func = R"(
|
.func = R"(
|
||||||
static constexpr std::array<std::string_view, 1> names{"TODO"};
|
static constexpr std::array<std::string_view, 1> names{"TODO"};
|
||||||
static constexpr auto childField = inst::Field{
|
static constexpr auto childField = inst::Field{
|
||||||
sizeof(T0),
|
sizeof(T0),
|
||||||
"[]",
|
"[]",
|
||||||
names,
|
names,
|
||||||
TypeHandler<DB, T0>::fields,
|
TypeHandler<Ctx, T0>::fields,
|
||||||
TypeHandler<DB, T0>::processors,
|
TypeHandler<Ctx, T0>::processors,
|
||||||
};
|
};
|
||||||
|
|
||||||
el.exclusive_size = 0;
|
el.exclusive_size = 0;
|
||||||
|
@ -34,7 +34,7 @@ traversal_func = """
|
|||||||
|
|
||||||
for (auto & it: container) {
|
for (auto & it: container) {
|
||||||
tail = tail.delegate([&it](auto ret) {
|
tail = tail.delegate([&it](auto ret) {
|
||||||
return TypeHandler<DB, T0>::getSizeType(it, ret);
|
return TypeHandler<Ctx, T0>::getSizeType(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,9 @@ traversal_func = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
|
|
||||||
size_t size = std::get<ParsedData::List>(d.val).length;
|
size_t size = std::get<ParsedData::List>(d.val).length;
|
||||||
el.exclusive_size = N0 == 0 ? 1 : 0;
|
el.exclusive_size = N0 == 0 ? 1 : 0;
|
||||||
|
@ -39,7 +39,7 @@ auto tail = returnArg.write((uintptr_t)&container)
|
|||||||
|
|
||||||
for (auto&& it : container) {
|
for (auto&& it : container) {
|
||||||
tail = tail.delegate([&it](auto ret) {
|
tail = tail.delegate([&it](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(it, ret);
|
return OIInternal::getSizeType<Ctx>(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ el.pointer = std::get<ParsedData::VarInt>(d.val).value;
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
#ifdef __GLIBCXX__
|
#ifdef __GLIBCXX__
|
||||||
static constexpr size_t element_size = sizeof(std::_List_node<T0>);
|
static constexpr size_t element_size = sizeof(std::_List_node<T0>);
|
||||||
@ -62,7 +62,7 @@ static_assert(false && "No known element_size for list. See types/cxx11_list_typ
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 1> child_field{
|
static constexpr std::array<inst::Field, 1> child_field{
|
||||||
make_field<DB, T0>("*"),
|
make_field<Ctx, T0>("*"),
|
||||||
};
|
};
|
||||||
static constexpr inst::Field element{
|
static constexpr inst::Field element{
|
||||||
element_size,
|
element_size,
|
||||||
@ -72,7 +72,7 @@ static constexpr inst::Field element{
|
|||||||
child_field,
|
child_field,
|
||||||
std::array<inst::ProcessorInst, 0>{},
|
std::array<inst::ProcessorInst, 0>{},
|
||||||
};
|
};
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
|
|
||||||
auto list = std::get<ParsedData::List>(d.val);
|
auto list = std::get<ParsedData::List>(d.val);
|
||||||
el.container_stats.emplace(result::Element::ContainerStats{
|
el.container_stats.emplace(result::Element::ContainerStats{
|
||||||
|
@ -37,8 +37,9 @@ void getSizeType(const %1%<T, Traits, Allocator> &container, size_t& returnArg)
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
extra = """
|
extra = """
|
||||||
template <typename DB, typename CharT, typename Traits, typename Allocator>
|
template <typename Ctx, typename CharT, typename Traits, typename Allocator>
|
||||||
class CaptureKeyHandler<DB, std::__cxx11::basic_string<CharT, Traits, Allocator>> {
|
class CaptureKeyHandler<Ctx, std::__cxx11::basic_string<CharT, Traits, Allocator>> {
|
||||||
|
using DB = typename Ctx::DataBuffer;
|
||||||
public:
|
public:
|
||||||
// List of characters
|
// List of characters
|
||||||
using type = types::st::List<DB, types::st::VarInt<DB>>;
|
using type = types::st::List<DB, types::st::VarInt<DB>>;
|
||||||
|
@ -44,10 +44,10 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (auto &&entry: container) {
|
for (auto &&entry: container) {
|
||||||
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
||||||
auto next = ret.delegate([&key](typename TypeHandler<DB, T0>::type ret) {
|
auto next = ret.delegate([&key](typename TypeHandler<Ctx, T0>::type ret) {
|
||||||
return OIInternal::getSizeType<DB>(key, ret);
|
return OIInternal::getSizeType<Ctx>(key, ret);
|
||||||
});
|
});
|
||||||
return OIInternal::getSizeType<DB>(value, next);
|
return OIInternal::getSizeType<Ctx>(value, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, types::st::Pair<DB,
|
types::st::List<DB, types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>
|
typename TypeHandler<Ctx, T1>::type>>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
static constexpr size_t element_size = sizeof(typename container_type::value_type);
|
static constexpr size_t element_size = sizeof(typename container_type::value_type);
|
||||||
@ -84,8 +84,8 @@ el.container_stats->length = list.length;
|
|||||||
el.exclusive_size += allocationSize - list.length * element_size;
|
el.exclusive_size += allocationSize - list.length * element_size;
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 2> element_fields{
|
static constexpr std::array<inst::Field, 2> element_fields{
|
||||||
make_field<DB, T0>("key"),
|
make_field<Ctx, T0>("key"),
|
||||||
make_field<DB, T1>("value"),
|
make_field<Ctx, T1>("value"),
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr inst::Field element{
|
static constexpr inst::Field element{
|
||||||
|
@ -43,7 +43,7 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (auto &&entry: container) {
|
for (auto &&entry: container) {
|
||||||
tail = tail.delegate([&entry](auto ret) {
|
tail = tail.delegate([&entry](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(entry, ret);
|
return OIInternal::getSizeType<Ctx>(entry, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, typename TypeHandler<DB, T0>::type>
|
types::st::List<DB, typename TypeHandler<Ctx, T0>::type>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
auto allocationSize = el.pointer.value();
|
auto allocationSize = el.pointer.value();
|
||||||
@ -75,7 +75,7 @@ el.container_stats->length = list.length;
|
|||||||
|
|
||||||
el.exclusive_size += allocationSize - list.length * sizeof(T0);
|
el.exclusive_size += allocationSize - list.length * sizeof(T0);
|
||||||
|
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
for (size_t i = 0; i < list.length; i++)
|
for (size_t i = 0; i < list.length; i++)
|
||||||
stack_ins(childField);
|
stack_ins(childField);
|
||||||
"""
|
"""
|
||||||
|
@ -44,10 +44,10 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (auto &&entry: container) {
|
for (auto &&entry: container) {
|
||||||
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
||||||
auto next = ret.delegate([&key](typename TypeHandler<DB, T0>::type ret) {
|
auto next = ret.delegate([&key](typename TypeHandler<Ctx, T0>::type ret) {
|
||||||
return OIInternal::getSizeType<DB>(key, ret);
|
return OIInternal::getSizeType<Ctx>(key, ret);
|
||||||
});
|
});
|
||||||
return OIInternal::getSizeType<DB>(value, next);
|
return OIInternal::getSizeType<Ctx>(value, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, types::st::Pair<DB,
|
types::st::List<DB, types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>
|
typename TypeHandler<Ctx, T1>::type>>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
static constexpr size_t element_size = sizeof(typename container_type::value_type);
|
static constexpr size_t element_size = sizeof(typename container_type::value_type);
|
||||||
@ -84,8 +84,8 @@ el.container_stats->length = list.length;
|
|||||||
el.exclusive_size += allocationSize - list.length * element_size;
|
el.exclusive_size += allocationSize - list.length * element_size;
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 2> element_fields{
|
static constexpr std::array<inst::Field, 2> element_fields{
|
||||||
make_field<DB, T0>("key"),
|
make_field<Ctx, T0>("key"),
|
||||||
make_field<DB, T1>("value"),
|
make_field<Ctx, T1>("value"),
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr inst::Field element{
|
static constexpr inst::Field element{
|
||||||
|
@ -43,7 +43,7 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (auto &&entry: container) {
|
for (auto &&entry: container) {
|
||||||
tail = tail.delegate([&entry](auto ret) {
|
tail = tail.delegate([&entry](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(entry, ret);
|
return OIInternal::getSizeType<Ctx>(entry, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, typename TypeHandler<DB, T0>::type>
|
types::st::List<DB, typename TypeHandler<Ctx, T0>::type>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
auto allocationSize = el.pointer.value();
|
auto allocationSize = el.pointer.value();
|
||||||
@ -75,7 +75,7 @@ el.container_stats->length = list.length;
|
|||||||
|
|
||||||
el.exclusive_size += allocationSize - list.length * sizeof(T0);
|
el.exclusive_size += allocationSize - list.length * sizeof(T0);
|
||||||
|
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
for (size_t i = 0; i < list.length; i++)
|
for (size_t i = 0; i < list.length; i++)
|
||||||
stack_ins(childField);
|
stack_ins(childField);
|
||||||
"""
|
"""
|
||||||
|
@ -44,10 +44,10 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (auto &&entry: container) {
|
for (auto &&entry: container) {
|
||||||
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
||||||
auto next = ret.delegate([&key](typename TypeHandler<DB, T0>::type ret) {
|
auto next = ret.delegate([&key](typename TypeHandler<Ctx, T0>::type ret) {
|
||||||
return OIInternal::getSizeType<DB>(key, ret);
|
return OIInternal::getSizeType<Ctx>(key, ret);
|
||||||
});
|
});
|
||||||
return OIInternal::getSizeType<DB>(value, next);
|
return OIInternal::getSizeType<Ctx>(value, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, types::st::Pair<DB,
|
types::st::List<DB, types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>
|
typename TypeHandler<Ctx, T1>::type>>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
static constexpr size_t element_size = sizeof(typename container_type::value_type);
|
static constexpr size_t element_size = sizeof(typename container_type::value_type);
|
||||||
@ -84,8 +84,8 @@ el.container_stats->length = list.length;
|
|||||||
el.exclusive_size += allocationSize - list.length * element_size;
|
el.exclusive_size += allocationSize - list.length * element_size;
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 2> element_fields{
|
static constexpr std::array<inst::Field, 2> element_fields{
|
||||||
make_field<DB, T0>("key"),
|
make_field<Ctx, T0>("key"),
|
||||||
make_field<DB, T1>("value"),
|
make_field<Ctx, T1>("value"),
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr inst::Field element{
|
static constexpr inst::Field element{
|
||||||
|
@ -43,7 +43,7 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (auto &&entry: container) {
|
for (auto &&entry: container) {
|
||||||
tail = tail.delegate([&entry](auto ret) {
|
tail = tail.delegate([&entry](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(entry, ret);
|
return OIInternal::getSizeType<Ctx>(entry, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, typename TypeHandler<DB, T0>::type>
|
types::st::List<DB, typename TypeHandler<Ctx, T0>::type>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
auto allocationSize = el.pointer.value();
|
auto allocationSize = el.pointer.value();
|
||||||
@ -75,7 +75,7 @@ el.container_stats->length = list.length;
|
|||||||
|
|
||||||
el.exclusive_size += allocationSize - list.length * sizeof(T0);
|
el.exclusive_size += allocationSize - list.length * sizeof(T0);
|
||||||
|
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
for (size_t i = 0; i < list.length; i++)
|
for (size_t i = 0; i < list.length; i++)
|
||||||
stack_ins(childField);
|
stack_ins(childField);
|
||||||
"""
|
"""
|
||||||
|
@ -44,10 +44,10 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (auto &&entry: container) {
|
for (auto &&entry: container) {
|
||||||
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
||||||
auto next = ret.delegate([&key](typename TypeHandler<DB, T0>::type ret) {
|
auto next = ret.delegate([&key](typename TypeHandler<Ctx, T0>::type ret) {
|
||||||
return OIInternal::getSizeType<DB>(key, ret);
|
return OIInternal::getSizeType<Ctx>(key, ret);
|
||||||
});
|
});
|
||||||
return OIInternal::getSizeType<DB>(value, next);
|
return OIInternal::getSizeType<Ctx>(value, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, types::st::Pair<DB,
|
types::st::List<DB, types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>
|
typename TypeHandler<Ctx, T1>::type>>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
static constexpr size_t element_size = sizeof(typename container_type::value_type);
|
static constexpr size_t element_size = sizeof(typename container_type::value_type);
|
||||||
@ -84,8 +84,8 @@ el.container_stats->length = list.length;
|
|||||||
el.exclusive_size += allocationSize - list.length * element_size;
|
el.exclusive_size += allocationSize - list.length * element_size;
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 2> element_fields{
|
static constexpr std::array<inst::Field, 2> element_fields{
|
||||||
make_field<DB, T0>("key"),
|
make_field<Ctx, T0>("key"),
|
||||||
make_field<DB, T1>("value"),
|
make_field<Ctx, T1>("value"),
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr inst::Field element{
|
static constexpr inst::Field element{
|
||||||
|
@ -43,7 +43,7 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (auto &&entry: container) {
|
for (auto &&entry: container) {
|
||||||
tail = tail.delegate([&entry](auto ret) {
|
tail = tail.delegate([&entry](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(entry, ret);
|
return OIInternal::getSizeType<Ctx>(entry, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, typename TypeHandler<DB, T0>::type>
|
types::st::List<DB, typename TypeHandler<Ctx, T0>::type>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
auto allocationSize = el.pointer.value();
|
auto allocationSize = el.pointer.value();
|
||||||
@ -75,7 +75,7 @@ el.container_stats->length = list.length;
|
|||||||
|
|
||||||
el.exclusive_size += allocationSize - list.length * sizeof(T0);
|
el.exclusive_size += allocationSize - list.length * sizeof(T0);
|
||||||
|
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
for (size_t i = 0; i < list.length; i++)
|
for (size_t i = 0; i < list.length; i++)
|
||||||
stack_ins(childField);
|
stack_ins(childField);
|
||||||
"""
|
"""
|
||||||
|
@ -39,7 +39,7 @@ auto tail = returnArg.write((uintptr_t)&container)
|
|||||||
|
|
||||||
for (auto&& it : container) {
|
for (auto&& it : container) {
|
||||||
tail = tail.delegate([&it](auto ret) {
|
tail = tail.delegate([&it](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(it, ret);
|
return OIInternal::getSizeType<Ctx>(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ el.pointer = std::get<ParsedData::VarInt>(d.val).value;
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
#ifdef __GLIBCXX__
|
#ifdef __GLIBCXX__
|
||||||
static constexpr size_t element_size = sizeof(std::_List_node<T0>);
|
static constexpr size_t element_size = sizeof(std::_List_node<T0>);
|
||||||
@ -62,7 +62,7 @@ static_assert(false && "No known element_size for list. See types/cxx11_list_typ
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 1> child_field{
|
static constexpr std::array<inst::Field, 1> child_field{
|
||||||
make_field<DB, T0>("*"),
|
make_field<Ctx, T0>("*"),
|
||||||
};
|
};
|
||||||
static constexpr inst::Field element{
|
static constexpr inst::Field element{
|
||||||
element_size,
|
element_size,
|
||||||
@ -72,7 +72,7 @@ static constexpr inst::Field element{
|
|||||||
child_field,
|
child_field,
|
||||||
std::array<inst::ProcessorInst, 0>{},
|
std::array<inst::ProcessorInst, 0>{},
|
||||||
};
|
};
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
|
|
||||||
auto list = std::get<ParsedData::List>(d.val);
|
auto list = std::get<ParsedData::List>(d.val);
|
||||||
el.container_stats.emplace(result::Element::ContainerStats{
|
el.container_stats.emplace(result::Element::ContainerStats{
|
||||||
|
@ -43,11 +43,11 @@ traversal_func = '''
|
|||||||
|
|
||||||
for (const auto& kv : container) {
|
for (const auto& kv : container) {
|
||||||
tail = tail.delegate([&kv](auto ret) {
|
tail = tail.delegate([&kv](auto ret) {
|
||||||
auto start = maybeCaptureKey<captureKeys, DB, T0>(kv.first, ret);
|
auto start = maybeCaptureKey<captureKeys, Ctx, T0>(kv.first, ret);
|
||||||
auto next = start.delegate([&kv](typename TypeHandler<DB, T0>::type ret) {
|
auto next = start.delegate([&kv](typename TypeHandler<Ctx, T0>::type ret) {
|
||||||
return OIInternal::getSizeType<DB>(kv.first, ret);
|
return OIInternal::getSizeType<Ctx>(kv.first, ret);
|
||||||
});
|
});
|
||||||
return OIInternal::getSizeType<DB>(kv.second, next);
|
return OIInternal::getSizeType<Ctx>(kv.second, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,22 +68,22 @@ el.container_stats.emplace(result::Element::ContainerStats{ .capacity = std::get
|
|||||||
type = '''
|
type = '''
|
||||||
std::conditional_t<captureKeys,
|
std::conditional_t<captureKeys,
|
||||||
types::st::List<DB, types::st::Pair<DB,
|
types::st::List<DB, types::st::Pair<DB,
|
||||||
typename CaptureKeyHandler<DB, T0>::type,
|
typename CaptureKeyHandler<Ctx, T0>::type,
|
||||||
types::st::Pair<DB,
|
types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>>,
|
typename TypeHandler<Ctx, T1>::type>>>,
|
||||||
types::st::List<DB, types::st::Pair<DB,
|
types::st::List<DB, types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>>
|
typename TypeHandler<Ctx, T1>::type>>>
|
||||||
'''
|
'''
|
||||||
func = '''
|
func = '''
|
||||||
using element_type = std::pair<T0, T1>;
|
using element_type = std::pair<T0, T1>;
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 2> entryFields{
|
static constexpr std::array<inst::Field, 2> entryFields{
|
||||||
make_field<DB, T0>("key"),
|
make_field<Ctx, T0>("key"),
|
||||||
make_field<DB, T1>("value"),
|
make_field<Ctx, T1>("value"),
|
||||||
};
|
};
|
||||||
static constexpr auto processors = maybeCaptureKeysProcessor<captureKeys, DB, T0>();
|
static constexpr auto processors = maybeCaptureKeysProcessor<captureKeys, Ctx, T0>();
|
||||||
static constexpr auto entry = inst::Field {
|
static constexpr auto entry = inst::Field {
|
||||||
sizeof(element_type),
|
sizeof(element_type),
|
||||||
sizeof(element_type) - sizeof(T0) - sizeof(T1),
|
sizeof(element_type) - sizeof(T0) - sizeof(T1),
|
||||||
|
@ -40,10 +40,10 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (const auto &entry: container) {
|
for (const auto &entry: container) {
|
||||||
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
||||||
auto next = ret.delegate([&key](typename TypeHandler<DB, T0>::type ret) {
|
auto next = ret.delegate([&key](typename TypeHandler<Ctx, T0>::type ret) {
|
||||||
return OIInternal::getSizeType<DB>(key, ret);
|
return OIInternal::getSizeType<Ctx>(key, ret);
|
||||||
});
|
});
|
||||||
return OIInternal::getSizeType<DB>(value, next);
|
return OIInternal::getSizeType<Ctx>(value, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,8 +57,8 @@ func = "el.pointer = std::get<ParsedData::VarInt>(d.val).value;"
|
|||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, types::st::Pair<DB,
|
types::st::List<DB, types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>
|
typename TypeHandler<Ctx, T1>::type>>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
#ifdef __GLIBCXX__
|
#ifdef __GLIBCXX__
|
||||||
@ -108,8 +108,8 @@ static_assert(false && "No known element_size for sets. See types/multi_map_type
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 2> elementFields{
|
static constexpr std::array<inst::Field, 2> elementFields{
|
||||||
make_field<DB, T0>("key"),
|
make_field<Ctx, T0>("key"),
|
||||||
make_field<DB, T1>("value"),
|
make_field<Ctx, T1>("value"),
|
||||||
};
|
};
|
||||||
static constexpr auto element = inst::Field {
|
static constexpr auto element = inst::Field {
|
||||||
element_size,
|
element_size,
|
||||||
|
@ -43,7 +43,7 @@ auto tail = returnArg.write((uintptr_t)&container)
|
|||||||
// vector<bool>
|
// vector<bool>
|
||||||
for (auto&& it : container) {
|
for (auto&& it : container) {
|
||||||
tail = tail.delegate([&it](auto ret) {
|
tail = tail.delegate([&it](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(it, ret);
|
return OIInternal::getSizeType<Ctx>(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ el.pointer = std::get<ParsedData::VarInt>(d.val).value;
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
#ifdef __GLIBCXX__
|
#ifdef __GLIBCXX__
|
||||||
/* We don't have access to the _Rb_tree_node struct, so we manually re-create it
|
/* We don't have access to the _Rb_tree_node struct, so we manually re-create it
|
||||||
@ -103,7 +103,7 @@ static constexpr size_t element_size = sizeof(OI__tree_node);
|
|||||||
static_assert(false && "No known element_size for multisets. See types/multi_set_type.toml");
|
static_assert(false && "No known element_size for multisets. See types/multi_set_type.toml");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
|
|
||||||
auto list = std::get<ParsedData::List>(d.val);
|
auto list = std::get<ParsedData::List>(d.val);
|
||||||
el.container_stats.emplace(result::Element::ContainerStats {
|
el.container_stats.emplace(result::Element::ContainerStats {
|
||||||
|
@ -31,7 +31,7 @@ void getSizeType(const %1%<T>& container, size_t& returnArg) {
|
|||||||
traversal_func = """
|
traversal_func = """
|
||||||
if (container.has_value()) {
|
if (container.has_value()) {
|
||||||
return returnArg.template delegate<1>([&container](auto ret) {
|
return returnArg.template delegate<1>([&container](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(*container, ret);
|
return OIInternal::getSizeType<Ctx>(*container, ret);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return returnArg.template delegate<0>(std::identity());
|
return returnArg.template delegate<0>(std::identity());
|
||||||
@ -39,15 +39,15 @@ if (container.has_value()) {
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::Sum<DB, types::st::Unit<DB>, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::Sum<DB, types::st::Unit<DB>, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
static constexpr std::array<std::string_view, 1> names{"TODO"};
|
static constexpr std::array<std::string_view, 1> names{"TODO"};
|
||||||
static constexpr auto elementField = inst::Field{
|
static constexpr auto elementField = inst::Field{
|
||||||
sizeof(T0),
|
sizeof(T0),
|
||||||
"el",
|
"el",
|
||||||
names,
|
names,
|
||||||
TypeHandler<DB, T0>::fields,
|
TypeHandler<Ctx, T0>::fields,
|
||||||
TypeHandler<DB, T0>::processors,
|
TypeHandler<Ctx, T0>::processors,
|
||||||
};
|
};
|
||||||
|
|
||||||
auto sum = std::get<ParsedData::Sum>(d.val);
|
auto sum = std::get<ParsedData::Sum>(d.val);
|
||||||
|
@ -27,19 +27,19 @@ void getSizeType(const %1%<P,Q> &container, size_t& returnArg)
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
traversal_func = """
|
traversal_func = """
|
||||||
return OIInternal::getSizeType<DB>(
|
return OIInternal::getSizeType<Ctx>(
|
||||||
container.second,
|
container.second,
|
||||||
returnArg.delegate([&container](auto ret) {
|
returnArg.delegate([&container](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(container.first, ret);
|
return OIInternal::getSizeType<Ctx>(container.first, ret);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::Pair<DB, typename TypeHandler<DB, T0>::type, typename TypeHandler<DB, T1>::type>"
|
type = "types::st::Pair<DB, typename TypeHandler<Ctx, T0>::type, typename TypeHandler<Ctx, T1>::type>"
|
||||||
func = """
|
func = """
|
||||||
static constexpr auto firstField = make_field<DB, T0>("first");
|
static constexpr auto firstField = make_field<Ctx, T0>("first");
|
||||||
static constexpr auto secondField = make_field<DB, T1>("second");
|
static constexpr auto secondField = make_field<Ctx, T1>("second");
|
||||||
|
|
||||||
el.exclusive_size = sizeof(std::pair<T0, T1>) - sizeof(T0) - sizeof(T1);
|
el.exclusive_size = sizeof(std::pair<T0, T1>) - sizeof(T0) - sizeof(T1);
|
||||||
stack_ins(secondField);
|
stack_ins(secondField);
|
||||||
|
@ -44,7 +44,7 @@ auto tail = returnArg.write((uintptr_t)&container)
|
|||||||
// vector<bool>
|
// vector<bool>
|
||||||
for (auto&& it : container) {
|
for (auto&& it : container) {
|
||||||
tail = tail.delegate([&it](auto ret) {
|
tail = tail.delegate([&it](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(it, ret);
|
return OIInternal::getSizeType<Ctx>(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,9 +64,9 @@ el.container_stats.emplace(result::Element::ContainerStats{ .capacity = std::get
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
|
|
||||||
auto list = std::get<ParsedData::List>(d.val);
|
auto list = std::get<ParsedData::List>(d.val);
|
||||||
el.container_stats->length = list.length;
|
el.container_stats->length = list.length;
|
||||||
|
@ -44,7 +44,7 @@ auto tail = returnArg.write((uintptr_t)&container)
|
|||||||
// vector<bool>
|
// vector<bool>
|
||||||
for (auto&& it : container) {
|
for (auto&& it : container) {
|
||||||
tail = tail.delegate([&it](auto ret) {
|
tail = tail.delegate([&it](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(it, ret);
|
return OIInternal::getSizeType<Ctx>(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ el.pointer = std::get<ParsedData::VarInt>(d.val).value;
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
#ifdef __GLIBCXX__
|
#ifdef __GLIBCXX__
|
||||||
/* We don't have access to the _Rb_tree_node struct, so we manually re-create it
|
/* We don't have access to the _Rb_tree_node struct, so we manually re-create it
|
||||||
@ -104,7 +104,7 @@ static constexpr size_t element_size = sizeof(OI__tree_node);
|
|||||||
static_assert(false && "No known element_size for sets. See types/set_type.toml");
|
static_assert(false && "No known element_size for sets. See types/set_type.toml");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
|
|
||||||
auto list = std::get<ParsedData::List>(d.val);
|
auto list = std::get<ParsedData::List>(d.val);
|
||||||
el.container_stats.emplace(result::Element::ContainerStats {
|
el.container_stats.emplace(result::Element::ContainerStats {
|
||||||
|
@ -45,7 +45,7 @@ if constexpr (std::is_void<T0>::value) {
|
|||||||
return tail.template delegate<0>(std::identity());
|
return tail.template delegate<0>(std::identity());
|
||||||
|
|
||||||
return tail.template delegate<1>([&container](auto ret) {
|
return tail.template delegate<1>([&container](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(*container, ret);
|
return OIInternal::getSizeType<Ctx>(*container, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
@ -60,7 +60,7 @@ el.pointer = std::get<ParsedData::VarInt>(d.val).value;
|
|||||||
type = """
|
type = """
|
||||||
types::st::Sum<DB,
|
types::st::Sum<DB,
|
||||||
types::st::Unit<DB>,
|
types::st::Unit<DB>,
|
||||||
typename TypeHandler<DB, T0>::type>
|
typename TypeHandler<Ctx, T0>::type>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
#ifdef __GLIBCXX__
|
#ifdef __GLIBCXX__
|
||||||
@ -84,10 +84,10 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
.length = sum.index, // 0 for empty containers/void, 1 otherwise
|
.length = sum.index, // 0 for empty containers/void, 1 otherwise
|
||||||
});
|
});
|
||||||
|
|
||||||
// Must be in a `if constexpr` or the compiler will complain about make_field<DB, void>
|
// Must be in a `if constexpr` or the compiler will complain about make_field<Ctx, void>
|
||||||
if constexpr (!std::is_void<T0>::value) {
|
if constexpr (!std::is_void<T0>::value) {
|
||||||
if (sum.index == 1) {
|
if (sum.index == 1) {
|
||||||
static constexpr auto element = make_field<DB, T0>("ptr_val");
|
static constexpr auto element = make_field<Ctx, T0>("ptr_val");
|
||||||
stack_ins(element);
|
stack_ins(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ auto tail = returnArg
|
|||||||
.write(container.size());
|
.write(container.size());
|
||||||
|
|
||||||
for (auto &&it: container) {
|
for (auto &&it: container) {
|
||||||
tail = tail.delegate([&it](typename TypeHandler<DB, T0>::type ret) {
|
tail = tail.delegate([&it](typename TypeHandler<Ctx, T0>::type ret) {
|
||||||
return OIInternal::getSizeType<DB>(it, ret);
|
return OIInternal::getSizeType<Ctx>(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
// Reading the `uses_intern_storage` boolean that was stored in `pointer` by the processor above.
|
// Reading the `uses_intern_storage` boolean that was stored in `pointer` by the processor above.
|
||||||
bool uses_intern_storage = std::exchange(el.pointer.value(), (uintptr_t)0);
|
bool uses_intern_storage = std::exchange(el.pointer.value(), (uintptr_t)0);
|
||||||
@ -97,7 +97,7 @@ if (uses_intern_storage) {
|
|||||||
el.exclusive_size += (el.container_stats->capacity - el.container_stats->length) * sizeof(T0);
|
el.exclusive_size += (el.container_stats->capacity - el.container_stats->length) * sizeof(T0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
for (size_t i = 0; i < list.length; i++)
|
for (size_t i = 0; i < list.length; i++)
|
||||||
stack_ins(childField);
|
stack_ins(childField);
|
||||||
"""
|
"""
|
||||||
|
@ -38,7 +38,7 @@ auto tail = returnArg.write((uintptr_t)&container)
|
|||||||
|
|
||||||
for (const auto& el : container) {
|
for (const auto& el : container) {
|
||||||
tail = tail.delegate([&el](auto ret) {
|
tail = tail.delegate([&el](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(el, ret);
|
return OIInternal::getSizeType<Ctx>(el, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,9 +56,9 @@ el.container_stats.emplace(result::Element::ContainerStats{ .capacity = std::get
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
|
|
||||||
auto list = std::get<ParsedData::List>(d.val);
|
auto list = std::get<ParsedData::List>(d.val);
|
||||||
el.container_stats->length = list.length;
|
el.container_stats->length = list.length;
|
||||||
|
@ -44,11 +44,11 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (const auto &entry: container) {
|
for (const auto &entry: container) {
|
||||||
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) {
|
||||||
auto start = maybeCaptureKey<captureKeys, DB, T0>(key, ret);
|
auto start = maybeCaptureKey<captureKeys, Ctx, T0>(key, ret);
|
||||||
auto next = start.delegate([&key](typename TypeHandler<DB, T0>::type ret) {
|
auto next = start.delegate([&key](typename TypeHandler<Ctx, T0>::type ret) {
|
||||||
return OIInternal::getSizeType<DB>(key, ret);
|
return OIInternal::getSizeType<Ctx>(key, ret);
|
||||||
});
|
});
|
||||||
return OIInternal::getSizeType<DB>(value, next);
|
return OIInternal::getSizeType<Ctx>(value, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,14 +64,14 @@ type = """
|
|||||||
std::conditional_t<captureKeys,
|
std::conditional_t<captureKeys,
|
||||||
types::st::List<DB,
|
types::st::List<DB,
|
||||||
types::st::Pair<DB,
|
types::st::Pair<DB,
|
||||||
typename CaptureKeyHandler<DB, T0>::type,
|
typename CaptureKeyHandler<Ctx, T0>::type,
|
||||||
types::st::Pair<DB,
|
types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>>,
|
typename TypeHandler<Ctx, T1>::type>>>,
|
||||||
types::st::List<DB,
|
types::st::List<DB,
|
||||||
types::st::Pair<DB,
|
types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>
|
typename TypeHandler<Ctx, T1>::type>>
|
||||||
>
|
>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
@ -122,11 +122,11 @@ static_assert(false && "No known element_size for sets. See types/std_map_type.t
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 2> element_fields{
|
static constexpr std::array<inst::Field, 2> element_fields{
|
||||||
make_field<DB, T0>("key"),
|
make_field<Ctx, T0>("key"),
|
||||||
make_field<DB, T1>("value"),
|
make_field<Ctx, T1>("value"),
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr auto processors = maybeCaptureKeysProcessor<captureKeys, DB, T0>();
|
static constexpr auto processors = maybeCaptureKeysProcessor<captureKeys, Ctx, T0>();
|
||||||
|
|
||||||
static constexpr inst::Field element{
|
static constexpr inst::Field element{
|
||||||
element_size,
|
element_size,
|
||||||
|
@ -47,11 +47,11 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (const auto& kv : container) {
|
for (const auto& kv : container) {
|
||||||
tail = tail.delegate([&kv](auto ret) {
|
tail = tail.delegate([&kv](auto ret) {
|
||||||
auto start = maybeCaptureKey<captureKeys, DB, T0>(kv.first, ret);
|
auto start = maybeCaptureKey<captureKeys, Ctx, T0>(kv.first, ret);
|
||||||
auto next = start.delegate([&kv](typename TypeHandler<DB, T0>::type ret) {
|
auto next = start.delegate([&kv](typename TypeHandler<Ctx, T0>::type ret) {
|
||||||
return OIInternal::getSizeType<DB>(kv.first, ret);
|
return OIInternal::getSizeType<Ctx>(kv.first, ret);
|
||||||
});
|
});
|
||||||
return OIInternal::getSizeType<DB>(kv.second, next);
|
return OIInternal::getSizeType<Ctx>(kv.second, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,13 +79,13 @@ type = """
|
|||||||
std::conditional_t<captureKeys,
|
std::conditional_t<captureKeys,
|
||||||
types::st::List<DB,
|
types::st::List<DB,
|
||||||
types::st::Pair<DB,
|
types::st::Pair<DB,
|
||||||
typename CaptureKeyHandler<DB, T0>::type,
|
typename CaptureKeyHandler<Ctx, T0>::type,
|
||||||
types::st::Pair<DB,
|
types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>>,
|
typename TypeHandler<Ctx, T1>::type>>>,
|
||||||
types::st::List<DB, types::st::Pair<DB,
|
types::st::List<DB, types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>
|
typename TypeHandler<Ctx, T1>::type>>
|
||||||
>
|
>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
@ -122,11 +122,11 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
});
|
});
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 2> element_fields{
|
static constexpr std::array<inst::Field, 2> element_fields{
|
||||||
make_field<DB, T0>("key"),
|
make_field<Ctx, T0>("key"),
|
||||||
make_field<DB, T1>("value"),
|
make_field<Ctx, T1>("value"),
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr auto processors = maybeCaptureKeysProcessor<captureKeys, DB, T0>();
|
static constexpr auto processors = maybeCaptureKeysProcessor<captureKeys, Ctx, T0>();
|
||||||
|
|
||||||
static constexpr auto element = inst::Field{
|
static constexpr auto element = inst::Field{
|
||||||
element_size,
|
element_size,
|
||||||
|
@ -47,7 +47,7 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (const auto &it : container) {
|
for (const auto &it : container) {
|
||||||
tail = tail.delegate([&it](auto ret) {
|
tail = tail.delegate([&it](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(it, ret);
|
return OIInternal::getSizeType<Ctx>(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,8 +73,8 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = """
|
type = """
|
||||||
types::st::List<DB, types::st::Pair<DB,
|
types::st::List<DB, types::st::Pair<DB,
|
||||||
typename TypeHandler<DB, T0>::type,
|
typename TypeHandler<Ctx, T0>::type,
|
||||||
typename TypeHandler<DB, T1>::type>>
|
typename TypeHandler<Ctx, T1>::type>>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
#ifdef __GLIBCXX__
|
#ifdef __GLIBCXX__
|
||||||
@ -110,8 +110,8 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
});
|
});
|
||||||
|
|
||||||
static constexpr std::array<inst::Field, 2> element_fields{
|
static constexpr std::array<inst::Field, 2> element_fields{
|
||||||
make_field<DB, T0>("key"),
|
make_field<Ctx, T0>("key"),
|
||||||
make_field<DB, T1>("value"),
|
make_field<Ctx, T1>("value"),
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr auto element = inst::Field{
|
static constexpr auto element = inst::Field{
|
||||||
|
@ -46,7 +46,7 @@ if constexpr (std::is_void<T0>::value) {
|
|||||||
return tail.template delegate<0>(std::identity());
|
return tail.template delegate<0>(std::identity());
|
||||||
|
|
||||||
return tail.template delegate<1>([&container](auto ret) {
|
return tail.template delegate<1>([&container](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(*container, ret);
|
return OIInternal::getSizeType<Ctx>(*container, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
@ -61,7 +61,7 @@ el.pointer = std::get<ParsedData::VarInt>(d.val).value;
|
|||||||
type = """
|
type = """
|
||||||
types::st::Sum<DB,
|
types::st::Sum<DB,
|
||||||
types::st::Unit<DB>,
|
types::st::Unit<DB>,
|
||||||
typename TypeHandler<DB, T0>::type>
|
typename TypeHandler<Ctx, T0>::type>
|
||||||
"""
|
"""
|
||||||
func = """
|
func = """
|
||||||
auto sum = std::get<ParsedData::Sum>(d.val);
|
auto sum = std::get<ParsedData::Sum>(d.val);
|
||||||
@ -70,10 +70,10 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
.length = sum.index, // 0 for empty containers/void, 1 otherwise
|
.length = sum.index, // 0 for empty containers/void, 1 otherwise
|
||||||
});
|
});
|
||||||
|
|
||||||
// Must be in a `if constexpr` or the compiler will complain about make_field<DB, void>
|
// Must be in a `if constexpr` or the compiler will complain about make_field<Ctx, void>
|
||||||
if constexpr (!std::is_void<T0>::value) {
|
if constexpr (!std::is_void<T0>::value) {
|
||||||
if (sum.index == 1) {
|
if (sum.index == 1) {
|
||||||
static constexpr auto element = make_field<DB, T0>("ptr_val");
|
static constexpr auto element = make_field<Ctx, T0>("ptr_val");
|
||||||
stack_ins(element);
|
stack_ins(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (const auto &it : container) {
|
for (const auto &it : container) {
|
||||||
tail = tail.delegate([&it](auto ret) {
|
tail = tail.delegate([&it](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(it, ret);
|
return OIInternal::getSizeType<Ctx>(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
#ifdef __GLIBCXX__
|
#ifdef __GLIBCXX__
|
||||||
/* Use libstdc++ implementation __details to compute the size of Nodes and Buckets.
|
/* Use libstdc++ implementation __details to compute the size of Nodes and Buckets.
|
||||||
@ -100,7 +100,7 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
.length = list.length,
|
.length = list.length,
|
||||||
});
|
});
|
||||||
|
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
for (size_t i = 0; i < list.length; i++)
|
for (size_t i = 0; i < list.length; i++)
|
||||||
stack_ins(childField);
|
stack_ins(childField);
|
||||||
"""
|
"""
|
||||||
|
@ -45,7 +45,7 @@ auto tail = returnArg
|
|||||||
|
|
||||||
for (const auto &it : container) {
|
for (const auto &it : container) {
|
||||||
tail = tail.delegate([&it](auto ret) {
|
tail = tail.delegate([&it](auto ret) {
|
||||||
return OIInternal::getSizeType<DB>(it, ret);
|
return OIInternal::getSizeType<Ctx>(it, ret);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
[[codegen.processor]]
|
[[codegen.processor]]
|
||||||
type = "types::st::List<DB, typename TypeHandler<DB, T0>::type>"
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
||||||
func = """
|
func = """
|
||||||
#ifdef __GLIBCXX__
|
#ifdef __GLIBCXX__
|
||||||
/* Use libstdc++ implementation __details to compute the size of Nodes and Buckets.
|
/* Use libstdc++ implementation __details to compute the size of Nodes and Buckets.
|
||||||
@ -100,7 +100,7 @@ el.container_stats.emplace(result::Element::ContainerStats {
|
|||||||
.length = list.length,
|
.length = list.length,
|
||||||
});
|
});
|
||||||
|
|
||||||
static constexpr auto childField = make_field<DB, T0>("[]");
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
||||||
for (size_t i = 0; i < list.length; i++)
|
for (size_t i = 0; i < list.length; i++)
|
||||||
stack_ins(childField);
|
stack_ins(childField);
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user