[Bf-blender-cvs] [254b69417b7] functions: remove refcounter from Function class

Jacques Lucke noreply at git.blender.org
Fri Sep 27 15:27:40 CEST 2019


Commit: 254b69417b7fa226f38c4f1b282b1d206b11de88
Author: Jacques Lucke
Date:   Fri Sep 27 15:15:10 2019 +0200
Branches: functions
https://developer.blender.org/rB254b69417b7fa226f38c4f1b282b1d206b11de88

remove refcounter from Function class

===================================================================

M	source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
M	source/blender/functions/backends/dependencies/fgraph_dependencies.hpp
M	source/blender/functions/backends/llvm/build_ir_body.cpp
M	source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
M	source/blender/functions/backends/llvm/fgraph_ir_generation.hpp
M	source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
M	source/blender/functions/backends/llvm/ir_for_tuple_call.hpp
M	source/blender/functions/backends/llvm/ir_to_tuple_call.cpp
M	source/blender/functions/backends/llvm/ir_to_tuple_call.hpp
M	source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
M	source/blender/functions/backends/tuple_call/fgraph_tuple_call.hpp
M	source/blender/functions/backends/tuple_call/lazy_to_normal.cpp
M	source/blender/functions/backends/tuple_call/lazy_to_normal.hpp
M	source/blender/functions/backends/tuple_call/tuple_call.cpp
M	source/blender/functions/backends/tuple_call/tuple_call.hpp
M	source/blender/functions/core/core-c.cpp
M	source/blender/functions/core/data_graph.cpp
M	source/blender/functions/core/data_graph.hpp
M	source/blender/functions/core/data_graph_builder.cpp
M	source/blender/functions/core/data_graph_builder.hpp
M	source/blender/functions/core/dot_export.cpp
M	source/blender/functions/core/function.hpp
M	source/blender/functions/core/function_builder.cpp
M	source/blender/functions/core/function_builder.hpp
M	source/blender/functions/core/function_graph.cpp
M	source/blender/functions/core/function_graph.hpp
M	source/blender/functions/frontends/data_flow_nodes/data_flow_nodes-c.cpp
M	source/blender/functions/frontends/data_flow_nodes/function_generation.cpp
M	source/blender/functions/frontends/data_flow_nodes/function_generation.hpp
M	source/blender/functions/frontends/data_flow_nodes/mappings.cpp
M	source/blender/functions/frontends/data_flow_nodes/mappings.hpp
M	source/blender/functions/frontends/data_flow_nodes/mappings/conversion_inserters.cpp
M	source/blender/functions/frontends/data_flow_nodes/mappings/node_inserters.cpp
M	source/blender/functions/frontends/data_flow_nodes/unlinked_input_groupers.cpp
M	source/blender/functions/frontends/data_flow_nodes/unlinked_input_inserters.cpp
M	source/blender/functions/frontends/data_flow_nodes/vtree_data_graph.cpp
M	source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
M	source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
M	source/blender/functions/functions/array_execution.cpp
M	source/blender/functions/functions/array_execution.hpp
M	source/blender/functions/functions/auto_vectorization.cpp
M	source/blender/functions/functions/auto_vectorization.hpp
M	source/blender/functions/functions/boolean.cpp
M	source/blender/functions/functions/boolean.hpp
M	source/blender/functions/functions/color.cpp
M	source/blender/functions/functions/color.hpp
M	source/blender/functions/functions/comparisons.cpp
M	source/blender/functions/functions/comparisons.hpp
M	source/blender/functions/functions/constants.cpp
M	source/blender/functions/functions/constants.hpp
M	source/blender/functions/functions/lists.cpp
M	source/blender/functions/functions/lists.hpp
M	source/blender/functions/functions/object_input.cpp
M	source/blender/functions/functions/object_input.hpp
M	source/blender/functions/functions/random.cpp
M	source/blender/functions/functions/random.hpp
M	source/blender/functions/functions/ranges.cpp
M	source/blender/functions/functions/ranges.hpp
M	source/blender/functions/functions/scalar_math.cpp
M	source/blender/functions/functions/scalar_math.hpp
M	source/blender/functions/functions/simple_conversions.cpp
M	source/blender/functions/functions/simple_conversions.hpp
M	source/blender/functions/functions/string.cpp
M	source/blender/functions/functions/string.hpp
M	source/blender/functions/functions/switch.cpp
M	source/blender/functions/functions/switch.hpp
M	source/blender/functions/functions/vectors.cpp
M	source/blender/functions/functions/vectors.hpp
M	source/blender/simulations/bparticles/action_interface.hpp
M	source/blender/simulations/bparticles/emitters.hpp
M	source/blender/simulations/bparticles/forces.cpp
M	source/blender/simulations/bparticles/node_frontend.cpp
M	source/blender/simulations/bparticles/particle_function.cpp
M	source/blender/simulations/bparticles/particle_function.hpp
M	source/blender/simulations/bparticles/particle_function_builder.cpp

===================================================================

diff --git a/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp b/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
index 55bcae3f0d4..dbc98521c75 100644
--- a/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
+++ b/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
@@ -32,11 +32,11 @@ class FGraphDependencies : public DepsBody {
     }
     else {
       uint node_id = m_graph.node_id_of_output(socket);
-      SharedFunction &fn = m_graph.function_of_node(node_id);
-      if (fn->has_body<DepsBody>()) {
+      Function &fn = m_graph.function_of_node(node_id);
+      if (fn.has_body<DepsBody>()) {
         MultiMap<uint, ID *> input_ids;
 
-        for (uint i = 0; i < fn->input_amount(); i++) {
+        for (uint i = 0; i < fn.input_amount(); i++) {
           input_ids.add_multiple_new(
               i,
               this->find_deps_and_outputs(m_graph.socket_of_node_input(node_id, i),
@@ -45,7 +45,7 @@ class FGraphDependencies : public DepsBody {
 
         MultiMap<uint, ID *> output_ids;
         FunctionDepsBuilder builder(input_ids, output_ids, parent_builder.dependency_components());
-        DepsBody &body = fn->body<DepsBody>();
+        DepsBody &body = fn.body<DepsBody>();
         body.build_deps(builder);
         return output_ids.lookup_default(m_graph.index_of_output(socket));
       }
@@ -59,9 +59,9 @@ class FGraphDependencies : public DepsBody {
   }
 };
 
-void fgraph_add_DependenciesBody(SharedFunction &fn, FunctionGraph &fgraph)
+void fgraph_add_DependenciesBody(Function &fn, FunctionGraph &fgraph)
 {
-  fn->add_body<FGraphDependencies>(fgraph);
+  fn.add_body<FGraphDependencies>(fgraph);
 }
 
 }  // namespace FN
diff --git a/source/blender/functions/backends/dependencies/fgraph_dependencies.hpp b/source/blender/functions/backends/dependencies/fgraph_dependencies.hpp
index 50f2dfb373f..f2d373c4c7c 100644
--- a/source/blender/functions/backends/dependencies/fgraph_dependencies.hpp
+++ b/source/blender/functions/backends/dependencies/fgraph_dependencies.hpp
@@ -5,6 +5,6 @@
 
 namespace FN {
 
-void fgraph_add_DependenciesBody(SharedFunction &fn, FunctionGraph &fgraph);
+void fgraph_add_DependenciesBody(Function &fn, FunctionGraph &fgraph);
 
 } /* namespace FN */
diff --git a/source/blender/functions/backends/llvm/build_ir_body.cpp b/source/blender/functions/backends/llvm/build_ir_body.cpp
index 64a40c30962..5a30ac82944 100644
--- a/source/blender/functions/backends/llvm/build_ir_body.cpp
+++ b/source/blender/functions/backends/llvm/build_ir_body.cpp
@@ -7,11 +7,11 @@ llvm::Function *LLVMBuildIRBody::build_function(llvm::Module *module,
                                                 BuildIRSettings &settings,
                                                 FunctionIRCache &function_cache)
 {
-  Function *owner_fn = this->owner();
+  Function &owner_fn = this->owner();
   llvm::LLVMContext &context = module->getContext();
 
-  uint input_amount = owner_fn->input_amount();
-  uint output_amount = owner_fn->output_amount();
+  uint input_amount = owner_fn.input_amount();
+  uint output_amount = owner_fn.output_amount();
 
   Vector<LLVMTypeInfo *> input_type_infos(input_amount);
   Vector<LLVMTypeInfo *> output_type_infos(output_amount);
@@ -19,13 +19,13 @@ llvm::Function *LLVMBuildIRBody::build_function(llvm::Module *module,
   Vector<llvm::Type *> output_types(output_amount);
 
   for (uint i = 0; i < input_amount; i++) {
-    LLVMTypeInfo &type_info = owner_fn->input_type(i)->extension<LLVMTypeInfo>();
+    LLVMTypeInfo &type_info = owner_fn.input_type(i)->extension<LLVMTypeInfo>();
     input_type_infos[i] = &type_info;
     input_types[i] = type_info.get_type(context);
   }
 
   for (uint i = 0; i < output_amount; i++) {
-    LLVMTypeInfo &type_info = owner_fn->output_type(i)->extension<LLVMTypeInfo>();
+    LLVMTypeInfo &type_info = owner_fn.output_type(i)->extension<LLVMTypeInfo>();
     output_type_infos[i] = &type_info;
     output_types[i] = type_info.get_type(context);
   }
@@ -42,7 +42,7 @@ llvm::Function *LLVMBuildIRBody::build_function(llvm::Module *module,
 
   Vector<llvm::Value *> input_values(input_amount);
   for (uint i = 0; i < input_amount; i++) {
-    input_values[i] = builder.take_function_input(i, owner_fn->input_name(i));
+    input_values[i] = builder.take_function_input(i, owner_fn.input_name(i));
   }
   llvm::Value *context_ptr = builder.take_function_input(input_amount, "context_ptr");
   Vector<llvm::Value *> output_values(output_amount);
diff --git a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
index 03958aa00e6..cd51310574b 100644
--- a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
+++ b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
@@ -14,15 +14,15 @@ class BuildGraphIR : public LLVMBuildIRBody {
   BuildGraphIR(FunctionGraph &fgraph) : m_fgraph(fgraph), m_graph(fgraph.graph())
   {
     for (uint node_id : m_graph.node_ids()) {
-      SharedFunction &fn = m_graph.function_of_node(node_id);
-      if (fn->has_body<LLVMBuildIRBody>()) {
+      Function &fn = m_graph.function_of_node(node_id);
+      if (fn.has_body<LLVMBuildIRBody>()) {
         continue;
       }
-      if (fn->has_body<TupleCallBody>()) {
+      if (fn.has_body<TupleCallBody>()) {
         derive_LLVMBuildIRBody_from_TupleCallBody(fn);
         continue;
       }
-      if (fn->has_body<LazyInTupleCallBody>()) {
+      if (fn.has_body<LazyInTupleCallBody>()) {
         derive_TupleCallBody_from_LazyInTupleCallBody(fn);
         derive_LLVMBuildIRBody_from_TupleCallBody(fn);
         continue;
@@ -139,8 +139,8 @@ class BuildGraphIR : public LLVMBuildIRBody {
                                       uint node_id,
                                       Vector<llvm::Value *> &input_values) const
   {
-    SharedFunction &fn = m_graph.function_of_node(node_id);
-    auto &body = fn->body<LLVMBuildIRBody>();
+    Function &fn = m_graph.function_of_node(node_id);
+    auto &body = fn.body<LLVMBuildIRBody>();
     bool setup_stack = settings.maintain_stack() && body.prepare_execution_context();
 
     if (setup_stack) {
@@ -210,9 +210,9 @@ class BuildGraphIR : public LLVMBuildIRBody {
   }
 };
 
-void fgraph_add_LLVMBuildIRBody(SharedFunction &fn, FunctionGraph &fgraph)
+void fgraph_add_LLVMBuildIRBody(Function &fn, FunctionGraph &fgraph)
 {
-  fn->add_body<BuildGraphIR>(fgraph);
+  fn.add_body<BuildGraphIR>(fgraph);
 }
 
 } /* namespace FN */
diff --git a/source/blender/functions/backends/llvm/fgraph_ir_generation.hpp b/source/blender/functions/backends/llvm/fgraph_ir_generation.hpp
index 7ddb7232fd7..a00dd62a397 100644
--- a/source/blender/functions/backends/llvm/fgraph_ir_generation.hpp
+++ b/source/blender/functions/backends/llvm/fgraph_ir_generation.hpp
@@ -4,6 +4,6 @@
 
 namespace FN {
 
-void fgraph_add_LLVMBuildIRBody(SharedFunction &fn, FunctionGraph &fgraph);
+void fgraph_add_LLVMBuildIRBody(Function &fn, FunctionGraph &fgraph);
 
 } /* namespace FN */
diff --git a/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp b/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
index b6cb2fcac31..b783077de93 100644
--- a/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
+++ b/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
@@ -60,11 +60,11 @@ class TupleCallLLVM : public LLVMBuildIRBody {
                 CodeInterface &interface,
                 const BuildIRSettings &settings) const override
   {
-    Function *fn = m_tuple_call.owner();
+    Function &fn = m_tuple_call.owner();
 
     /* Find relevant type information. */
-    auto input_type_infos = fn->input_extensions<LLVMTypeInfo>();
-    auto output_type_infos = fn->output_extensions<LLVMTypeInfo>();
+    auto input_type_infos = fn.input_extensions<LLVMTypeInfo>();
+    auto output_type_infos = fn.output_extensions<LLVMTypeInfo>();
 
     /* Build wrapper function. */
     llvm::Function *wrapper_function = this->get_wrapper_function(
@@ -91,7 +91,7 @@ class TupleCallLLVM : public LLVMBuildIRBody {
                                        ArrayRef<LLVMTypeInfo *> input_type_infos,
                                        ArrayRef<LLVMTypeInfo *> output_type_infos) const
   {
-    Function *fn = m_tuple_call.owner();
+    Function &fn = m_tuple_call.owner();
 
     Vector<llvm::Type *> input_types = builder.types_of_values(interface.inputs());
     if (settings.maintain_stack()) {
@@ -116,7 +116,7 @@ class TupleCallLLVM : public LLVMBuildIRBody {
 
       wrapper_function = llvm::Function::Create(wrapper_function_type,
                                                 llvm::GlobalValue::LinkageTypes::InternalLinkage,
-                                                fn->name() + " Wrapper",
+                                                fn.name() + " Wrapper",
                                                 builder.getModule());
 
       this->build_wrapper_function(
@@ -182,12 +182,12 @@ class TupleCallLLVM : public LLVMBuildIRBody {
   }
 };
 
-void derive_LLVMBuildIRBody_from_TupleCallBody(SharedFunction &fn)
+void derive_LLVMBuildIRBody_from_TupleCallBody(Function &fn)
 {
-  BLI_assert(fn->has_body<TupleCallBody>());
-  BLI_assert(!fn->has_body<LLVMBuildIRBody>());
+  BLI_assert(fn.has_body<TupleCallBody>());
+  BLI_assert(!fn.has_body<LLVMBuildIRBody>());
 
-  fn->add_body<TupleCallLLVM>(fn->body<TupleCallBody>());
+  fn.add_body<TupleCallLLVM>(fn.body<TupleCallBody>());
 }
 
 } /* namespace FN */
diff --git a/source/blender/functions/backends/llvm/ir_for_tuple_call.hpp b/source/blender/functions/backends/llvm/ir_for_tuple_call.hpp
index ad72ffc94e4..dd0f8985532 100644
--- a/source/blender/functions/backends/llvm/ir_for_tuple_call.hpp
+++ b/source/blender/functions/backends/llvm/ir_for_tuple_call.hpp
@@ -8,6 +8,6 @@ class LLVMContext;
 
 namespace FN {
 
-void derive_LLVMBuildIRBody_from_TupleCallBody(SharedFunction &fn);
+void derive_LLVMBuildIRBody_from_TupleCallBody(Function &fn);
 
 } /* namespace FN */
diff --git a/source/blender/functions/backends/llvm/ir_to_tuple_call.cpp b/source/blender/functions/backends/llvm/ir_to_tu

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list