Skip to content

Commit

Permalink
Experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Nov 12, 2023
1 parent 7c1f693 commit e2078a5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/compiler/llvm_codegen_expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6189,7 +6189,7 @@ static inline void llvm_emit_macro_block(GenContext *c, BEValue *be_value, Expr
llvm_emit_update_stack_row(c, expr->span.row);
Decl *macro = expr->macro_block.macro;
old_stack_trace = c->debug.stacktrace;
llvm_emit_push_stacktrace(c, macro, macro->name, ST_MACRO);
llvm_emit_push_emulated_stacktrace(c, macro, macro->name, ST_MACRO);
}
}
llvm_emit_return_block(c, be_value, expr->type, expr->macro_block.first_stmt, expr->macro_block.block_exit, restore_at_exit ? &old_stack_trace : NULL);
Expand Down
10 changes: 5 additions & 5 deletions src/compiler/llvm_codegen_function.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ void llvm_emit_update_stack_row(GenContext *c, uint32_t row)
llvm_store_to_ptr_raw_aligned(c, c->debug.stacktrace.row, llvm_const_int(c, type_uint, row), type_abi_alignment(type_uint));

}
void llvm_emit_push_stacktrace(GenContext *c, Decl *decl, const char *function_name, StacktraceType type)
void llvm_emit_push_emulated_stacktrace(GenContext *c, Decl *decl, const char *function_name, StacktraceType type)
{
LLVMTypeRef slot_type = c->debug.stack_type;
AlignSize alignment = llvm_abi_alignment(c, slot_type);
Expand Down Expand Up @@ -525,8 +525,8 @@ void llvm_emit_body(GenContext *c, LLVMValueRef function, FunctionPrototype *pro
LLVMValueRef prev_function = c->function;
LLVMBuilderRef prev_builder = c->builder;

bool use_stacktrace = emit_debug && c->debug.emulated_stacktrace;
if (use_stacktrace && !c->debug.stack_init_fn)
bool use_emulated_stacktrace = emit_debug && c->debug.enable_stacktrace;
if (use_emulated_stacktrace && !c->debug.stack_init_fn)
{
llvm_emit_stacktrace_definitions(c);
c->builder = prev_builder;
Expand Down Expand Up @@ -582,9 +582,9 @@ void llvm_emit_body(GenContext *c, LLVMValueRef function, FunctionPrototype *pro
{
llvm_debug_scope_push(c, c->debug.function);
EMIT_LOC(c, body);
if (use_stacktrace)
if (use_emulated_stacktrace)
{
llvm_emit_push_stacktrace(c, decl, function_name, type);
llvm_emit_push_emulated_stacktrace(c, decl, function_name, type);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/llvm_codegen_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ void llvm_emit_debug_local_var(GenContext *c, Decl *var);
void llvm_emit_debug_global_var(GenContext *c, Decl *global);
void llvm_emit_update_stack_row(GenContext *c, uint32_t row);
void llvm_emit_pop_stacktrace(GenContext *c, Stacktrace *slot);
void llvm_emit_push_stacktrace(GenContext *c, Decl *decl, const char *function_name, StacktraceType type);
void llvm_emit_push_emulated_stacktrace(GenContext *c, Decl *decl, const char *function_name, StacktraceType type);

#define EMIT_LOC(c, x) do { if (c->debug.builder) llvm_emit_debug_location(c, x->span); } while (0);

Expand Down

0 comments on commit e2078a5

Please sign in to comment.