Commit: b287de4e68a259fc69d72f02024738e61153d55f Author: Jacques Lucke Date: Sun Apr 28 19:20:24 2019 +0200 Branches: functions https://developer.blender.org/rBb287de4e68a259fc69d72f02024738e61153d55f
deduplicate stack setup code =================================================================== M source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp M source/blender/functions/backends/tuple_call/tuple_call.hpp =================================================================== diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp index 5bbe7a9f444..3bfaeb13215 100644 --- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp +++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp @@ -315,10 +315,8 @@ class ExecuteFGraph : public TupleCallBody { SETUP_SUB_TUPLES(node_id, body, body_in, body_out); - SourceInfoStackFrame frame(m_graph->source_info_of_node(node_id)); - ctx.stack().push(&frame); - body->call(body_in, body_out, ctx, state); - ctx.stack().pop(); + SourceInfo *source_info = m_graph->source_info_of_node(node_id); + body->call__setup_stack(body_in, body_out, ctx, state, source_info); if (state.is_done()) { this->destruct_remaining_node_inputs(node_id, storage); @@ -338,10 +336,8 @@ class ExecuteFGraph : public TupleCallBody { SETUP_SUB_TUPLES(node_id, body, body_in, body_out); - SourceInfoStackFrame frame(m_graph->source_info_of_node(node_id)); - ctx.stack().push(&frame); - body->call(body_in, body_out, ctx, state); - ctx.stack().pop(); + SourceInfo *source_info = m_graph->source_info_of_node(node_id); + body->call__setup_stack(body_in, body_out, ctx, state, source_info); if (state.is_done()) { this->destruct_remaining_node_inputs(node_id, storage); diff --git a/source/blender/functions/backends/tuple_call/tuple_call.hpp b/source/blender/functions/backends/tuple_call/tuple_call.hpp index 0fb383e0f90..50c43cf7501 100644 --- a/source/blender/functions/backends/tuple_call/tuple_call.hpp +++ b/source/blender/functions/backends/tuple_call/tuple_call.hpp @@ -129,6 +129,38 @@ class LazyInTupleCallBody : public TupleCallBodyBase { Tuple &fn_out, ExecutionContext &ctx, LazyState &state) const = 0; + + inline void call__setup_stack(Tuple &fn_in, + Tuple &fn_out, + ExecutionContext &ctx, + LazyState &state) const + { + TextStackFrame frame(this->owner()->name().c_str()); + ctx.stack().push(&frame); + this->call(fn_in, fn_out, ctx, state); + ctx.stack().pop(); + } + + inline void call__setup_stack(Tuple &fn_in, + Tuple &fn_out, + ExecutionContext &ctx, + LazyState &state, + StackFrame &extra_frame) const + { + ctx.stack().push(&extra_frame); + this->call__setup_stack(fn_in, fn_out, ctx, state); + ctx.stack().pop(); + } + + inline void call__setup_stack(Tuple &fn_in, + Tuple &fn_out, + ExecutionContext &ctx, + LazyState &state, + SourceInfo *source_info) const + { + SourceInfoStackFrame frame(source_info); + this->call__setup_stack(fn_in, fn_out, ctx, state, frame); + } }; } /* namespace FN */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs