MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / genDeliverUnmapped

Function genDeliverUnmapped

src/jrd/RecordSourceNodes.cpp:3968–4140  ·  view source on GitHub ↗

Make new boolean nodes from nodes that contain a field from the given shellStream. Those fields are references (mappings) to other nodes and are used by aggregates and unions.

Source from the content-addressed store, hash-verified

3966// Make new boolean nodes from nodes that contain a field from the given shellStream.
3967// Those fields are references (mappings) to other nodes and are used by aggregates and unions.
3968static void genDeliverUnmapped(CompilerScratch* csb,
3969 const BoolExprNodeStack& conjunctStack,
3970 BoolExprNodeStack& deliverStack,
3971 MapNode* map,
3972 StreamType shellStream)
3973{
3974 MemoryPool& pool = csb->csb_pool;
3975
3976 for (BoolExprNodeStack::const_iterator iter(conjunctStack); iter.hasData(); ++iter)
3977 {
3978 const auto boolean = iter.object();
3979
3980 // Handle the "OR" case first
3981
3982 const auto binaryNode = nodeAs<BinaryBoolNode>(boolean);
3983 if (binaryNode && binaryNode->blrOp == blr_or)
3984 {
3985 BoolExprNodeStack orgStack, newStack;
3986
3987 orgStack.push(binaryNode->arg1);
3988 orgStack.push(binaryNode->arg2);
3989
3990 genDeliverUnmapped(csb, orgStack, newStack, map, shellStream);
3991
3992 if (newStack.getCount() == 2)
3993 {
3994 const auto newArg2 = newStack.pop();
3995 const auto newArg1 = newStack.pop();
3996
3997 const auto newBinaryNode =
3998 FB_NEW_POOL(pool) BinaryBoolNode(pool, blr_or, newArg1, newArg2);
3999
4000 deliverStack.push(newBinaryNode);
4001 }
4002 else
4003 {
4004 while (newStack.hasData())
4005 delete newStack.pop();
4006 }
4007
4008 continue;
4009 }
4010
4011 // Reduce to simple comparisons
4012
4013 const auto cmpNode = nodeAs<ComparativeBoolNode>(boolean);
4014 const auto missingNode = nodeAs<MissingBoolNode>(boolean);
4015 const auto listNode = nodeAs<InListBoolNode>(boolean);
4016 HalfStaticArray<ValueExprNode*, 2> children;
4017
4018 if (cmpNode &&
4019 (cmpNode->blrOp == blr_eql || cmpNode->blrOp == blr_equiv ||
4020 cmpNode->blrOp == blr_gtr || cmpNode->blrOp == blr_geq ||
4021 cmpNode->blrOp == blr_leq || cmpNode->blrOp == blr_lss ||
4022 cmpNode->blrOp == blr_starting))
4023 {
4024 children.add(cmpNode->arg1);
4025 children.add(cmpNode->arg2);

Callers 1

compileMethod · 0.85

Calls 15

InListBoolNodeClass · 0.85
MissingBoolNodeClass · 0.85
LookupValueListClass · 0.85
getAddressMethod · 0.80
ValueListNodeClass · 0.70
BinaryBoolNodeClass · 0.50
ComparativeBoolNodeClass · 0.50
hasDataMethod · 0.45
objectMethod · 0.45
pushMethod · 0.45
getCountMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected