From ab88165326abfd81c5046e8c064bd6603198ed94 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 25 May 2022 17:27:21 -0700 Subject: Sema: generic function instantiations inherit branch quota --- src/Module.zig | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index 24495d8591..bc84d84ae8 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -1476,6 +1476,10 @@ pub const Fn = struct { lbrace_column: u16, rbrace_column: u16, + /// When a generic function is instantiated, this value is inherited from the + /// active Sema context. Importantly, this value is also updated when an existing + /// generic function instantiation is found and called. + branch_quota: u32, state: Analysis, is_cold: bool = false, is_noinline: bool = false, @@ -4891,6 +4895,7 @@ pub fn analyzeFnBody(mod: *Module, func: *Fn, arena: Allocator) SemaError!Air { .func = func, .fn_ret_ty = decl.ty.fnReturnType(), .owner_func = func, + .branch_quota = @maximum(func.branch_quota, Sema.default_branch_quota), }; defer sema.deinit(); -- cgit v1.2.3