diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-01-04 13:40:01 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-01-04 13:40:01 -0700 |
| commit | 7e64dc42215c93a2d1d6b7fa4f5e07b885788a7d (patch) | |
| tree | 5c5c538cf0b1d79e6626637ea5b3192e7cdec868 /src/Module.zig | |
| parent | 638f93ebdceb860974aae54b6f8c2c9f52157305 (diff) | |
| download | zig-7e64dc42215c93a2d1d6b7fa4f5e07b885788a7d.tar.gz zig-7e64dc42215c93a2d1d6b7fa4f5e07b885788a7d.zip | |
stage2: improvements to `@setEvalBranchQuota`
* extract magic number into a constant
* properly use result location casting for the operand
* naming convention for ZIR instructions
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Module.zig b/src/Module.zig index ce4fd51bb9..6a4575394a 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -23,6 +23,8 @@ const trace = @import("tracy.zig").trace; const astgen = @import("astgen.zig"); const zir_sema = @import("zir_sema.zig"); +const default_eval_branch_quota = 1000; + /// General-purpose allocator. Used for both temporary and long-term storage. gpa: *Allocator, comp: *Compilation, @@ -1105,7 +1107,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool { var inst_table = Scope.Block.InstTable.init(self.gpa); defer inst_table.deinit(); - var branch_quota: u32 = 1000; + var branch_quota: u32 = default_eval_branch_quota; var block_scope: Scope.Block = .{ .parent = null, @@ -1301,7 +1303,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool { var decl_inst_table = Scope.Block.InstTable.init(self.gpa); defer decl_inst_table.deinit(); - var branch_quota: u32 = 1000; + var branch_quota: u32 = default_eval_branch_quota; var block_scope: Scope.Block = .{ .parent = null, @@ -1374,7 +1376,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool { var var_inst_table = Scope.Block.InstTable.init(self.gpa); defer var_inst_table.deinit(); - var branch_quota_vi: u32 = 1000; + var branch_quota_vi: u32 = default_eval_branch_quota; var inner_block: Scope.Block = .{ .parent = null, .inst_table = &var_inst_table, @@ -1503,7 +1505,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool { var inst_table = Scope.Block.InstTable.init(self.gpa); defer inst_table.deinit(); - var branch_quota: u32 = 1000; + var branch_quota: u32 = default_eval_branch_quota; var block_scope: Scope.Block = .{ .parent = null, @@ -1887,7 +1889,7 @@ pub fn analyzeFnBody(self: *Module, decl: *Decl, func: *Fn) !void { defer decl.typed_value.most_recent.arena.?.* = arena.state; var inst_table = Scope.Block.InstTable.init(self.gpa); defer inst_table.deinit(); - var branch_quota: u32 = 1000; + var branch_quota: u32 = default_eval_branch_quota; var inner_block: Scope.Block = .{ .parent = null, |
