diff options
| author | vvvv <[email protected]> | 2025-05-15 12:57:26 +0300 |
|---|---|---|
| committer | vvvv <[email protected]> | 2025-05-15 13:36:16 +0300 |
| commit | bdd4c58526c2f4f9fa0834789d573d2160d41084 (patch) | |
| tree | 687c954e38aadee7141602a7eb687de3296984ca /yql/essentials/core/yql_expr_optimize.cpp | |
| parent | 5570d00b16f85de7b4e60f33dca0694c43b962bf (diff) | |
YQL-19945 track stack frames for evaluation
init
commit_hash:6e66d6ead6f0f91a4a60c3ed283dd7800638124a
Diffstat (limited to 'yql/essentials/core/yql_expr_optimize.cpp')
| -rw-r--r-- | yql/essentials/core/yql_expr_optimize.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/yql/essentials/core/yql_expr_optimize.cpp b/yql/essentials/core/yql_expr_optimize.cpp index 24716a16684..9c67a63b859 100644 --- a/yql/essentials/core/yql_expr_optimize.cpp +++ b/yql/essentials/core/yql_expr_optimize.cpp @@ -2,10 +2,13 @@ #include <util/generic/hash.h> #include "yql_expr_type_annotation.h" +#include "yql_func_stack.h" #include <yql/essentials/utils/log/log.h> #include <yql/essentials/utils/log/profile.h> +#include <util/generic/scope.h> + namespace NYql { namespace { @@ -18,6 +21,7 @@ namespace { const TNodeOnNodeOwnedMap* Replaces; ui64 LastNodeId; bool HasRemaps; + TMaybe<TFunctionStack> FunctionStack; TOptimizationContext(TOptimizer optimizer, const TNodeOnNodeOwnedMap* replaces, TExprContext& expr, const TOptimizeExprSettings& settings) : Optimizer(optimizer) @@ -27,6 +31,9 @@ namespace { , LastNodeId(expr.NextUniqueId) , HasRemaps(false) { + if (settings.TrackFrames) { + FunctionStack.ConstructInPlace(); + } } void RemapNode(const TExprNode& fromNode, const TExprNode::TPtr& toNode) final { @@ -106,6 +113,16 @@ namespace { template<typename TContext> TExprNode::TPtr OptimizeNode(const TExprNode::TPtr& node, TContext& ctx, size_t level) { + if (ctx.FunctionStack) { + ctx.FunctionStack->EnterFrame(*node, ctx.Expr); + } + + Y_DEFER { + if (ctx.FunctionStack) { + ctx.FunctionStack->LeaveFrame(*node, ctx.Expr); + } + }; + if ((!ctx.Replaces && node->Type() == TExprNode::Argument) || node->Type() == TExprNode::Atom || node->Type() == TExprNode::Arguments || node->Type() == TExprNode::World) { return node; |
