aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-04-13 16:53:53 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-04-13 16:55:59 -0400
commit68d7e4a1b60a52b59bc148a81458a89b9b739ab1 (patch)
treedb7f34838133a838c19634c8870c78ef154ca306 /src/analyze.cpp
parenta43fd7a550c3cae7443f09e4294cfccb6bdf0320 (diff)
downloadzig-68d7e4a1b60a52b59bc148a81458a89b9b739ab1.tar.gz
zig-68d7e4a1b60a52b59bc148a81458a89b9b739ab1.zip
better handle quota of setEvalBranchQuota
Now that c58b80203443dcbf8b737ebdaa1f17fb20c77711 has removed the "top of the comptime stack" requirement, the branch quota can be modified somewhere other than the top of the comptime stack. This means that the quota of a parent IrExecutable has to be modifiable by an instruction in the child. Closes #2261
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 394364c68f..730c52c927 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -969,8 +969,9 @@ static ConstExprValue *analyze_const_value(CodeGen *g, Scope *scope, AstNode *no
Buf *type_name)
{
size_t backward_branch_count = 0;
+ size_t backward_branch_quota = default_backward_branch_quota;
return ir_eval_const_value(g, scope, node, type_entry,
- &backward_branch_count, default_backward_branch_quota,
+ &backward_branch_count, &backward_branch_quota,
nullptr, nullptr, node, type_name, nullptr, nullptr);
}
@@ -2623,9 +2624,11 @@ static void get_fully_qualified_decl_name(Buf *buf, Tld *tld) {
ZigFn *create_fn_raw(CodeGen *g, FnInline inline_value) {
ZigFn *fn_entry = allocate<ZigFn>(1);
+ fn_entry->prealloc_backward_branch_quota = default_backward_branch_quota;
+
fn_entry->codegen = g;
fn_entry->analyzed_executable.backward_branch_count = &fn_entry->prealloc_bbc;
- fn_entry->analyzed_executable.backward_branch_quota = default_backward_branch_quota;
+ fn_entry->analyzed_executable.backward_branch_quota = &fn_entry->prealloc_backward_branch_quota;
fn_entry->analyzed_executable.fn_entry = fn_entry;
fn_entry->ir_executable.fn_entry = fn_entry;
fn_entry->fn_inline = inline_value;