@@ -2181,7 +2181,8 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void {
21812181 }
21822182
21832183 if (comp .zcu ) | zcu | {
2184- const pt : Zcu.PerThread = .{ .zcu = zcu , .tid = .main };
2184+ const pt : Zcu.PerThread = .activate (zcu , .main );
2185+ defer pt .deactivate ();
21852186
21862187 zcu .compile_log_text .shrinkAndFree (gpa , 0 );
21872188
@@ -2251,7 +2252,8 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void {
22512252 try comp .performAllTheWork (main_progress_node );
22522253
22532254 if (comp .zcu ) | zcu | {
2254- const pt : Zcu.PerThread = .{ .zcu = zcu , .tid = .main };
2255+ const pt : Zcu.PerThread = .activate (zcu , .main );
2256+ defer pt .deactivate ();
22552257
22562258 if (build_options .enable_debug_extensions and comp .verbose_intern_pool ) {
22572259 std .debug .print ("intern pool stats for '{s}':\n " , .{
@@ -3609,7 +3611,8 @@ fn performAllTheWorkInner(
36093611 }
36103612
36113613 if (comp .zcu ) | zcu | {
3612- const pt : Zcu.PerThread = .{ .zcu = zcu , .tid = .main };
3614+ const pt : Zcu.PerThread = .activate (zcu , .main );
3615+ defer pt .deactivate ();
36133616 if (comp .incremental ) {
36143617 const update_zir_refs_node = main_progress_node .start ("Update ZIR References" , 0 );
36153618 defer update_zir_refs_node .end ();
@@ -3683,14 +3686,16 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job, prog_node: std.Progre
36833686 const named_frame = tracy .namedFrame ("analyze_func" );
36843687 defer named_frame .end ();
36853688
3686- const pt : Zcu.PerThread = .{ .zcu = comp .zcu .? , .tid = @enumFromInt (tid ) };
3689+ const pt : Zcu.PerThread = .activate (comp .zcu .? , @enumFromInt (tid ));
3690+ defer pt .deactivate ();
36873691 pt .ensureFuncBodyAnalyzed (func ) catch | err | switch (err ) {
36883692 error .OutOfMemory = > return error .OutOfMemory ,
36893693 error .AnalysisFail = > return ,
36903694 };
36913695 },
36923696 .analyze_cau = > | cau_index | {
3693- const pt : Zcu.PerThread = .{ .zcu = comp .zcu .? , .tid = @enumFromInt (tid ) };
3697+ const pt : Zcu.PerThread = .activate (comp .zcu .? , @enumFromInt (tid ));
3698+ defer pt .deactivate ();
36943699 pt .ensureCauAnalyzed (cau_index ) catch | err | switch (err ) {
36953700 error .OutOfMemory = > return error .OutOfMemory ,
36963701 error .AnalysisFail = > return ,
@@ -3719,7 +3724,8 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job, prog_node: std.Progre
37193724 const named_frame = tracy .namedFrame ("resolve_type_fully" );
37203725 defer named_frame .end ();
37213726
3722- const pt : Zcu.PerThread = .{ .zcu = comp .zcu .? , .tid = @enumFromInt (tid ) };
3727+ const pt : Zcu.PerThread = .activate (comp .zcu .? , @enumFromInt (tid ));
3728+ defer pt .deactivate ();
37233729 Type .fromInterned (ty ).resolveFully (pt ) catch | err | switch (err ) {
37243730 error .OutOfMemory = > return error .OutOfMemory ,
37253731 error .AnalysisFail = > return ,
@@ -3729,7 +3735,8 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job, prog_node: std.Progre
37293735 const named_frame = tracy .namedFrame ("analyze_mod" );
37303736 defer named_frame .end ();
37313737
3732- const pt : Zcu.PerThread = .{ .zcu = comp .zcu .? , .tid = @enumFromInt (tid ) };
3738+ const pt : Zcu.PerThread = .activate (comp .zcu .? , @enumFromInt (tid ));
3739+ defer pt .deactivate ();
37333740 pt .semaPkg (mod ) catch | err | switch (err ) {
37343741 error .OutOfMemory = > return error .OutOfMemory ,
37353742 error .AnalysisFail = > return ,
@@ -4183,7 +4190,8 @@ fn workerAstGenFile(
41834190 const child_prog_node = prog_node .start (file .sub_file_path , 0 );
41844191 defer child_prog_node .end ();
41854192
4186- const pt : Zcu.PerThread = .{ .zcu = comp .zcu .? , .tid = @enumFromInt (tid ) };
4193+ const pt : Zcu.PerThread = .activate (comp .zcu .? , @enumFromInt (tid ));
4194+ defer pt .deactivate ();
41874195 pt .astGenFile (file , path_digest ) catch | err | switch (err ) {
41884196 error .AnalysisFail = > return ,
41894197 else = > {
0 commit comments