On 11/03/2019 09:35, Vlad Khorsun wrote:
>
>   I just committed few patches and have few more things to ask here:
>

Vlad, the change just broke reason for NodeRef/NodeRefImpl existence
(which is still commented but not working):

// This class and NodeRefImpl exists for nodes to replace themselves
(eg. pass1) in a type-safe way.

Let me demonstrate it. With this (wrong) patch now the code compiles:

--------------
diff --git a/src/dsql/ExprNodes.cpp b/src/dsql/ExprNodes.cpp
index 4ff5253a2b..26f826ae09 100644
--- a/src/dsql/ExprNodes.cpp
+++ b/src/dsql/ExprNodes.cpp
@@ -10836,6 +10836,7 @@ void SubQueryNode::getChildren(NodeRefsHolder&
holder, bool dsql) const
 
        holder.add(value1);
        holder.add(value2);
+       holder.add(test);
 }
 
 string SubQueryNode::internalPrint(NodePrinter& printer) const
diff --git a/src/dsql/ExprNodes.h b/src/dsql/ExprNodes.h
index 3478e4056b..38469e826e 100644
--- a/src/dsql/ExprNodes.h
+++ b/src/dsql/ExprNodes.h
@@ -1860,6 +1860,7 @@ public:
        NestConst<ValueExprNode> value1;
        NestConst<ValueExprNode> value2;
        NestConst<SubQuery> subQuery;
+       NestConst<CastNode> test;
 };
--------------

While previously it correctly detected the problem, as a specialized
node cannot become some other node not inherited from it.

--------------
In file included from
/home/asfernandes/fb/dev/firebird-master.git/src/dsql/ExprNodes.cpp:27:
In file included from
/home/asfernandes/fb/dev/firebird-master.git/src/include/../jrd/../dsql/ExprNodes.h:27:
/home/asfernandes/fb/dev/firebird-master.git/src/include/../jrd/../dsql/Nodes.h:740:18:
error: assigning to 'Jrd::CastNode *' from incompatible type
'Jrd::ValueExprNode *'
                *ptr = (*ptr)->dsqlFieldRemapper(visitor);
                       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/asfernandes/fb/dev/firebird-master.git/src/include/../jrd/../dsql/Nodes.h:430:11:
note: in instantiation of member function
'Jrd::NodeRefImpl<Jrd::CastNode>::remap' requested here
        explicit NodeRefImpl(T** aPtr)
                 ^
/home/asfernandes/fb/dev/firebird-master.git/src/include/../jrd/../dsql/Nodes.h:759:34:
note: in instantiation of member function
'Jrd::NodeRefImpl<Jrd::CastNode>::NodeRefImpl' requested here
        refs.add(FB_NEW_POOL(getPool())
NodeRefImpl<T>(const_cast<T**>(node.getAddress())));
                                        ^
/home/asfernandes/fb/dev/firebird-master.git/src/dsql/ExprNodes.cpp:10839:9:
note: in instantiation of function template specialization
'Jrd::NodeRefsHolder::add<Jrd::CastNode>' requested here
        holder.add(test);
--------------

If the change really increases performance, then I suppose it should be
conditionally defined based on DEBUG build, so debug could use NodeRef
with virtual method and NodeRefImpl, and release something like
currently (non-virtual method and no NodeRefImpl usage).


Adriano


Adriano



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to