[Bf-blender-cvs] [0f3b50329c8] functions: cleanup llvm ir when stack info is maintained
Jacques Lucke
noreply at git.blender.org
Wed Jul 31 16:21:02 CEST 2019
Commit: 0f3b50329c82b6a751f1b9e2042859942771344b
Author: Jacques Lucke
Date: Wed Jul 31 15:18:36 2019 +0200
Branches: functions
https://developer.blender.org/rB0f3b50329c82b6a751f1b9e2042859942771344b
cleanup llvm ir when stack info is maintained
===================================================================
M source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
M source/blender/simulations/bparticles/particle_function.cpp
===================================================================
diff --git a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
index 79415211d3a..0689cd3dda7 100644
--- a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
+++ b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
@@ -167,50 +167,44 @@ class BuildGraphIR : public LLVMBuildIRBody {
llvm::Value *node_info_frame_buf = builder.CreateAllocaBytes_AnyPtr(
sizeof(SourceInfoStackFrame));
- builder.CreateCallPointer((void *)BuildGraphIR::push_source_frame_on_stack,
- {context_ptr, node_info_frame_buf, builder.getAnyPtr(source_info)},
- builder.getVoidTy(),
- "Push source info on stack");
-
llvm::Value *function_info_frame_buf = builder.CreateAllocaBytes_AnyPtr(
sizeof(TextStackFrame));
- builder.CreateCallPointer((void *)BuildGraphIR::push_text_frame_on_stack,
+
+ builder.CreateCallPointer((void *)BuildGraphIR::push_frames_on_stack,
{context_ptr,
+ node_info_frame_buf,
+ builder.getAnyPtr(source_info),
function_info_frame_buf,
builder.getAnyPtr(m_graph->name_ptr_of_node(node_id))},
builder.getVoidTy(),
- "Push function name on stack");
+ "Push stack frames");
}
void pop_stack_frames_for_node(CodeBuilder &builder, llvm::Value *context_ptr) const
{
BLI_assert(context_ptr);
-
- for (uint i = 0; i < 2; i++) {
- builder.CreateCallPointer((void *)BuildGraphIR::pop_frame_from_stack,
- {context_ptr},
- builder.getVoidTy(),
- "Pop stack frame");
- }
- }
-
- static void push_source_frame_on_stack(ExecutionContext *ctx,
- void *frame_buf,
- SourceInfo *source_info)
- {
- StackFrame *frame = new (frame_buf) SourceInfoStackFrame(source_info);
- ctx->stack().push(frame);
+ builder.CreateCallPointer((void *)BuildGraphIR::pop_frames_from_stack,
+ {context_ptr},
+ builder.getVoidTy(),
+ "Pop stack frames");
}
- static void push_text_frame_on_stack(ExecutionContext *ctx, void *frame_buf, const char *text)
+ static void push_frames_on_stack(ExecutionContext *ctx,
+ void *source_frame_buf,
+ SourceInfo *source_info,
+ void *text_frame_buf,
+ const char *text)
{
- StackFrame *frame = new (frame_buf) TextStackFrame(text);
- ctx->stack().push(frame);
+ StackFrame *frame1 = new (source_frame_buf) SourceInfoStackFrame(source_info);
+ StackFrame *frame2 = new (text_frame_buf) TextStackFrame(text);
+ ctx->stack().push(frame1);
+ ctx->stack().push(frame2);
}
- static void pop_frame_from_stack(ExecutionContext *ctx)
+ static void pop_frames_from_stack(ExecutionContext *ctx)
{
ctx->stack().pop();
+ ctx->stack().pop();
}
};
diff --git a/source/blender/simulations/bparticles/particle_function.cpp b/source/blender/simulations/bparticles/particle_function.cpp
index 77156521e90..9fda48ab235 100644
--- a/source/blender/simulations/bparticles/particle_function.cpp
+++ b/source/blender/simulations/bparticles/particle_function.cpp
@@ -189,7 +189,10 @@ void ParticleFunction::init_with_deps(ParticleFunctionResult *result,
ExecutionStack stack;
ExecutionContext execution_context(stack);
+ FN::TextStackFrame stack_frame("Particle Function");
+ stack.push(&stack_frame);
m_array_execution->call(particles.pindices(), input_buffers, output_buffers, execution_context);
+ stack.pop();
for (uint i : inputs_to_free) {
void *buffer = input_buffers[i];
More information about the Bf-blender-cvs
mailing list