@@ -641,8 +641,8 @@ pub fn ensureFuncBodyAnalyzed(pt: Zcu.PerThread, maybe_coerced_func_index: Inter
641
641
642
642
// We'll want to remember what the IES used to be before the update for
643
643
// dependency invalidation purposes.
644
- const old_resolved_ies = if (func .analysis (ip ).inferred_error_set )
645
- func .resolvedErrorSet (ip ).*
644
+ const old_resolved_ies = if (func .analysisUnordered (ip ).inferred_error_set )
645
+ func .resolvedErrorSetUnordered (ip )
646
646
else
647
647
.none ;
648
648
@@ -671,7 +671,7 @@ pub fn ensureFuncBodyAnalyzed(pt: Zcu.PerThread, maybe_coerced_func_index: Inter
671
671
zcu .deleteUnitReferences (func_as_depender );
672
672
}
673
673
674
- switch (func .analysis (ip ).state ) {
674
+ switch (func .analysisUnordered (ip ).state ) {
675
675
.success = > if (! was_outdated ) return ,
676
676
.sema_failure ,
677
677
.dependency_failure ,
@@ -693,11 +693,11 @@ pub fn ensureFuncBodyAnalyzed(pt: Zcu.PerThread, maybe_coerced_func_index: Inter
693
693
694
694
var air = pt .analyzeFnBody (func_index , sema_arena ) catch | err | switch (err ) {
695
695
error .AnalysisFail = > {
696
- if (func .analysis (ip ).state == .in_progress ) {
696
+ if (func .analysisUnordered (ip ).state == .in_progress ) {
697
697
// If this decl caused the compile error, the analysis field would
698
698
// be changed to indicate it was this Decl's fault. Because this
699
699
// did not happen, we infer here that it was a dependency failure.
700
- func .analysis (ip ). state = .dependency_failure ;
700
+ func .setAnalysisState (ip , .dependency_failure ) ;
701
701
}
702
702
return error .AnalysisFail ;
703
703
},
@@ -707,8 +707,8 @@ pub fn ensureFuncBodyAnalyzed(pt: Zcu.PerThread, maybe_coerced_func_index: Inter
707
707
708
708
const invalidate_ies_deps = i : {
709
709
if (! was_outdated ) break :i false ;
710
- if (! func .analysis (ip ).inferred_error_set ) break :i true ;
711
- const new_resolved_ies = func .resolvedErrorSet (ip ).* ;
710
+ if (! func .analysisUnordered (ip ).inferred_error_set ) break :i true ;
711
+ const new_resolved_ies = func .resolvedErrorSetUnordered (ip );
712
712
break :i new_resolved_ies != old_resolved_ies ;
713
713
};
714
714
if (invalidate_ies_deps ) {
@@ -729,7 +729,7 @@ pub fn ensureFuncBodyAnalyzed(pt: Zcu.PerThread, maybe_coerced_func_index: Inter
729
729
return ;
730
730
}
731
731
732
- try comp .work_queue . writeItem (.{ .codegen_func = .{
732
+ try comp .queueJob (.{ .codegen_func = .{
733
733
.func = func_index ,
734
734
.air = air ,
735
735
} });
@@ -783,7 +783,7 @@ pub fn linkerUpdateFunc(pt: Zcu.PerThread, func_index: InternPool.Index, air: Ai
783
783
.{@errorName (err )},
784
784
),
785
785
);
786
- func .analysis (ip ). state = .codegen_failure ;
786
+ func .setAnalysisState (ip , .codegen_failure ) ;
787
787
return ;
788
788
},
789
789
};
@@ -797,12 +797,12 @@ pub fn linkerUpdateFunc(pt: Zcu.PerThread, func_index: InternPool.Index, air: Ai
797
797
// Correcting this failure will involve changing a type this function
798
798
// depends on, hence triggering re-analysis of this function, so this
799
799
// interacts correctly with incremental compilation.
800
- func .analysis (ip ). state = .codegen_failure ;
800
+ func .setAnalysisState (ip , .codegen_failure ) ;
801
801
} else if (comp .bin_file ) | lf | {
802
802
lf .updateFunc (pt , func_index , air , liveness ) catch | err | switch (err ) {
803
803
error .OutOfMemory = > return error .OutOfMemory ,
804
804
error .AnalysisFail = > {
805
- func .analysis (ip ). state = .codegen_failure ;
805
+ func .setAnalysisState (ip , .codegen_failure ) ;
806
806
},
807
807
else = > {
808
808
try zcu .failed_analysis .ensureUnusedCapacity (gpa , 1 );
@@ -812,7 +812,7 @@ pub fn linkerUpdateFunc(pt: Zcu.PerThread, func_index: InternPool.Index, air: Ai
812
812
"unable to codegen: {s}" ,
813
813
.{@errorName (err )},
814
814
));
815
- func .analysis (ip ). state = .codegen_failure ;
815
+ func .setAnalysisState (ip , .codegen_failure ) ;
816
816
try zcu .retryable_failures .append (zcu .gpa , InternPool .AnalUnit .wrap (.{ .func = func_index }));
817
817
},
818
818
};
@@ -903,7 +903,7 @@ fn getFileRootStruct(
903
903
decl .analysis = .complete ;
904
904
905
905
try pt .scanNamespace (namespace_index , decls , decl );
906
- try zcu .comp .work_queue . writeItem (.{ .resolve_type_fully = wip_ty .index });
906
+ try zcu .comp .queueJob (.{ .resolve_type_fully = wip_ty .index });
907
907
return wip_ty .finish (ip , decl_index , namespace_index .toOptional ());
908
908
}
909
909
@@ -1080,7 +1080,7 @@ fn semaDecl(pt: Zcu.PerThread, decl_index: Zcu.Decl.Index) !Zcu.SemaDeclResult {
1080
1080
const old_linksection = decl .@"linksection" ;
1081
1081
const old_addrspace = decl .@"addrspace" ;
1082
1082
const old_is_inline = if (decl .getOwnedFunction (zcu )) | prev_func |
1083
- prev_func .analysis (ip ).state == .inline_only
1083
+ prev_func .analysisUnordered (ip ).state == .inline_only
1084
1084
else
1085
1085
false ;
1086
1086
@@ -1311,10 +1311,10 @@ fn semaDecl(pt: Zcu.PerThread, decl_index: Zcu.Decl.Index) !Zcu.SemaDeclResult {
1311
1311
// codegen backend wants full access to the Decl Type.
1312
1312
try decl_ty .resolveFully (pt );
1313
1313
1314
- try zcu .comp .work_queue . writeItem (.{ .codegen_decl = decl_index });
1314
+ try zcu .comp .queueJob (.{ .codegen_decl = decl_index });
1315
1315
1316
1316
if (result .invalidate_decl_ref and zcu .emit_h != null ) {
1317
- try zcu .comp .work_queue . writeItem (.{ .emit_h_decl = decl_index });
1317
+ try zcu .comp .queueJob (.{ .emit_h_decl = decl_index });
1318
1318
}
1319
1319
}
1320
1320
@@ -1740,8 +1740,6 @@ pub fn scanNamespace(
1740
1740
var seen_decls : std .AutoHashMapUnmanaged (InternPool.NullTerminatedString , void ) = .{};
1741
1741
defer seen_decls .deinit (gpa );
1742
1742
1743
- try zcu .comp .work_queue .ensureUnusedCapacity (decls .len );
1744
-
1745
1743
namespace .decls .clearRetainingCapacity ();
1746
1744
try namespace .decls .ensureTotalCapacity (gpa , decls .len );
1747
1745
@@ -1967,7 +1965,7 @@ const ScanDeclIter = struct {
1967
1965
log .debug ("scanDecl queue analyze_decl file='{s}' decl_name='{}' decl_index={d}" , .{
1968
1966
namespace .fileScope (zcu ).sub_file_path , decl_name .fmt (ip ), decl_index ,
1969
1967
});
1970
- comp .work_queue . writeItemAssumeCapacity (.{ .analyze_decl = decl_index });
1968
+ try comp .queueJob (.{ .analyze_decl = decl_index });
1971
1969
}
1972
1970
}
1973
1971
@@ -1976,7 +1974,7 @@ const ScanDeclIter = struct {
1976
1974
// updated line numbers. Look into this!
1977
1975
// TODO Look into detecting when this would be unnecessary by storing enough state
1978
1976
// in `Decl` to notice that the line number did not change.
1979
- comp .work_queue . writeItemAssumeCapacity (.{ .update_line_number = decl_index });
1977
+ try comp .queueJob (.{ .update_line_number = decl_index });
1980
1978
}
1981
1979
}
1982
1980
};
@@ -1991,7 +1989,7 @@ pub fn abortAnonDecl(pt: Zcu.PerThread, decl_index: Zcu.Decl.Index) void {
1991
1989
/// Finalize the creation of an anon decl.
1992
1990
pub fn finalizeAnonDecl (pt : Zcu.PerThread , decl_index : Zcu.Decl.Index ) Allocator.Error ! void {
1993
1991
if (pt .zcu .declPtr (decl_index ).typeOf (pt .zcu ).isFnOrHasRuntimeBits (pt )) {
1994
- try pt .zcu .comp .work_queue . writeItem (.{ .codegen_decl = decl_index });
1992
+ try pt .zcu .comp .queueJob (.{ .codegen_decl = decl_index });
1995
1993
}
1996
1994
}
1997
1995
@@ -2037,7 +2035,7 @@ pub fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index, arena: All
2037
2035
.fn_ret_ty = Type .fromInterned (fn_ty_info .return_type ),
2038
2036
.fn_ret_ty_ies = null ,
2039
2037
.owner_func_index = func_index ,
2040
- .branch_quota = @max (func .branchQuota (ip ).* , Sema .default_branch_quota ),
2038
+ .branch_quota = @max (func .branchQuotaUnordered (ip ), Sema .default_branch_quota ),
2041
2039
.comptime_err_ret_trace = & comptime_err_ret_trace ,
2042
2040
};
2043
2041
defer sema .deinit ();
@@ -2047,14 +2045,14 @@ pub fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index, arena: All
2047
2045
try sema .declareDependency (.{ .src_hash = decl .zir_decl_index .unwrap ().? });
2048
2046
try sema .declareDependency (.{ .decl_val = decl_index });
2049
2047
2050
- if (func .analysis (ip ).inferred_error_set ) {
2048
+ if (func .analysisUnordered (ip ).inferred_error_set ) {
2051
2049
const ies = try arena .create (Sema .InferredErrorSet );
2052
2050
ies .* = .{ .func = func_index };
2053
2051
sema .fn_ret_ty_ies = ies ;
2054
2052
}
2055
2053
2056
2054
// reset in case calls to errorable functions are removed.
2057
- func .analysis (ip ). calls_or_awaits_errorable_fn = false ;
2055
+ func .setCallsOrAwaitsErrorableFn (ip , false ) ;
2058
2056
2059
2057
// First few indexes of extra are reserved and set at the end.
2060
2058
const reserved_count = @typeInfo (Air .ExtraIndex ).Enum .fields .len ;
@@ -2080,7 +2078,7 @@ pub fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index, arena: All
2080
2078
};
2081
2079
defer inner_block .instructions .deinit (gpa );
2082
2080
2083
- const fn_info = sema .code .getFnInfo (func .zirBodyInst (ip ).resolve (ip ));
2081
+ const fn_info = sema .code .getFnInfo (func .zirBodyInstUnordered (ip ).resolve (ip ));
2084
2082
2085
2083
// Here we are performing "runtime semantic analysis" for a function body, which means
2086
2084
// we must map the parameter ZIR instructions to `arg` AIR instructions.
@@ -2149,7 +2147,7 @@ pub fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index, arena: All
2149
2147
});
2150
2148
}
2151
2149
2152
- func .analysis (ip ). state = .in_progress ;
2150
+ func .setAnalysisState (ip , .in_progress ) ;
2153
2151
2154
2152
const last_arg_index = inner_block .instructions .items .len ;
2155
2153
@@ -2176,7 +2174,7 @@ pub fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index, arena: All
2176
2174
}
2177
2175
2178
2176
// If we don't get an error return trace from a caller, create our own.
2179
- if (func .analysis (ip ).calls_or_awaits_errorable_fn and
2177
+ if (func .analysisUnordered (ip ).calls_or_awaits_errorable_fn and
2180
2178
mod .comp .config .any_error_tracing and
2181
2179
! sema .fn_ret_ty .isError (mod ))
2182
2180
{
@@ -2218,10 +2216,10 @@ pub fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index, arena: All
2218
2216
else = > | e | return e ,
2219
2217
};
2220
2218
assert (ies .resolved != .none );
2221
- ip .funcIesResolved (func_index ) .* = ies .resolved ;
2219
+ ip .funcSetIesResolved (func_index , ies .resolved ) ;
2222
2220
}
2223
2221
2224
- func .analysis (ip ). state = .success ;
2222
+ func .setAnalysisState (ip , .success ) ;
2225
2223
2226
2224
// Finally we must resolve the return type and parameter types so that backends
2227
2225
// have full access to type information.
@@ -2415,6 +2413,7 @@ fn processExportsInner(
2415
2413
) error {OutOfMemory }! void {
2416
2414
const zcu = pt .zcu ;
2417
2415
const gpa = zcu .gpa ;
2416
+ const ip = & zcu .intern_pool ;
2418
2417
2419
2418
for (export_indices ) | export_idx | {
2420
2419
const new_export = & zcu .all_exports .items [export_idx ];
@@ -2423,7 +2422,7 @@ fn processExportsInner(
2423
2422
new_export .status = .failed_retryable ;
2424
2423
try zcu .failed_exports .ensureUnusedCapacity (gpa , 1 );
2425
2424
const msg = try Zcu .ErrorMsg .create (gpa , new_export .src , "exported symbol collision: {}" , .{
2426
- new_export .opts .name .fmt (& zcu . intern_pool ),
2425
+ new_export .opts .name .fmt (ip ),
2427
2426
});
2428
2427
errdefer msg .destroy (gpa );
2429
2428
const other_export = zcu .all_exports .items [gop .value_ptr .* ];
@@ -2443,8 +2442,7 @@ fn processExportsInner(
2443
2442
if (! decl .owns_tv ) break :failed false ;
2444
2443
if (decl .typeOf (zcu ).zigTypeTag (zcu ) != .Fn ) break :failed false ;
2445
2444
// Check if owned function failed
2446
- const a = zcu .funcInfo (decl .val .toIntern ()).analysis (& zcu .intern_pool );
2447
- break :failed a .state != .success ;
2445
+ break :failed zcu .funcInfo (decl .val .toIntern ()).analysisUnordered (ip ).state != .success ;
2448
2446
}) {
2449
2447
// This `Decl` is failed, so was never sent to codegen.
2450
2448
// TODO: we should probably tell the backend to delete any old exports of this `Decl`?
@@ -3072,7 +3070,7 @@ pub fn getUnionLayout(pt: Zcu.PerThread, loaded_union: InternPool.LoadedUnionTyp
3072
3070
most_aligned_field_size = field_size ;
3073
3071
}
3074
3072
}
3075
- const have_tag = loaded_union .flagsPtr (ip ).runtime_tag .hasTag ();
3073
+ const have_tag = loaded_union .flagsUnordered (ip ).runtime_tag .hasTag ();
3076
3074
if (! have_tag or ! Type .fromInterned (loaded_union .enum_tag_ty ).hasRuntimeBits (pt )) {
3077
3075
return .{
3078
3076
.abi_size = payload_align .forward (payload_size ),
@@ -3091,7 +3089,7 @@ pub fn getUnionLayout(pt: Zcu.PerThread, loaded_union: InternPool.LoadedUnionTyp
3091
3089
const tag_size = Type .fromInterned (loaded_union .enum_tag_ty ).abiSize (pt );
3092
3090
const tag_align = Type .fromInterned (loaded_union .enum_tag_ty ).abiAlignment (pt ).max (.@"1" );
3093
3091
return .{
3094
- .abi_size = loaded_union .size (ip ).* ,
3092
+ .abi_size = loaded_union .sizeUnordered (ip ),
3095
3093
.abi_align = tag_align .max (payload_align ),
3096
3094
.most_aligned_field = most_aligned_field ,
3097
3095
.most_aligned_field_size = most_aligned_field_size ,
@@ -3100,7 +3098,7 @@ pub fn getUnionLayout(pt: Zcu.PerThread, loaded_union: InternPool.LoadedUnionTyp
3100
3098
.payload_align = payload_align ,
3101
3099
.tag_align = tag_align ,
3102
3100
.tag_size = tag_size ,
3103
- .padding = loaded_union .padding (ip ).* ,
3101
+ .padding = loaded_union .paddingUnordered (ip ),
3104
3102
};
3105
3103
}
3106
3104
@@ -3142,7 +3140,7 @@ pub fn unionFieldNormalAlignmentAdvanced(
3142
3140
strat : Type.ResolveStrat ,
3143
3141
) Zcu.SemaError ! InternPool.Alignment {
3144
3142
const ip = & pt .zcu .intern_pool ;
3145
- assert (loaded_union .flagsPtr (ip ).layout != .@"packed" );
3143
+ assert (loaded_union .flagsUnordered (ip ).layout != .@"packed" );
3146
3144
const field_align = loaded_union .fieldAlign (ip , field_index );
3147
3145
if (field_align != .none ) return field_align ;
3148
3146
const field_ty = Type .fromInterned (loaded_union .field_types .get (ip )[field_index ]);
0 commit comments