diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-12-05 15:15:13 +0100 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-02-23 04:08:56 +0100 |
| commit | 6ba785584a163c5ba5b6f0c6fea65be645e157b4 (patch) | |
| tree | 6d82d92623a6bf7a70639e749cc317cb2ec6d3ef /src/InternPool.zig | |
| parent | a502301b5eb84329c8c3ecb4b68bc52048f99cdc (diff) | |
| download | zig-6ba785584a163c5ba5b6f0c6fea65be645e157b4.tar.gz zig-6ba785584a163c5ba5b6f0c6fea65be645e157b4.zip | |
compiler: Implement @disableIntrinsics() builtin function.
Closes #21833.
Closes #22110.
Diffstat (limited to 'src/InternPool.zig')
| -rw-r--r-- | src/InternPool.zig | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig index 391d583004..7f02b548b4 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -6045,8 +6045,9 @@ pub const FuncAnalysis = packed struct(u32) { /// True if this function has an inferred error set. inferred_error_set: bool, disable_instrumentation: bool, + disable_intrinsics: bool, - _: u24 = 0, + _: u23 = 0, }; pub const Bytes = struct { @@ -9077,6 +9078,7 @@ pub fn getFuncDecl( .has_error_trace = false, .inferred_error_set = false, .disable_instrumentation = false, + .disable_intrinsics = false, }, .owner_nav = key.owner_nav, .ty = key.ty, @@ -9186,6 +9188,7 @@ pub fn getFuncDeclIes( .has_error_trace = false, .inferred_error_set = true, .disable_instrumentation = false, + .disable_intrinsics = false, }, .owner_nav = key.owner_nav, .ty = func_ty, @@ -9382,6 +9385,7 @@ pub fn getFuncInstance( .has_error_trace = false, .inferred_error_set = false, .disable_instrumentation = false, + .disable_intrinsics = false, }, // This is populated after we create the Nav below. It is not read // by equality or hashing functions. @@ -9480,6 +9484,7 @@ pub fn getFuncInstanceIes( .has_error_trace = false, .inferred_error_set = true, .disable_instrumentation = false, + .disable_intrinsics = false, }, // This is populated after we create the Nav below. It is not read // by equality or hashing functions. @@ -12313,6 +12318,18 @@ pub fn funcSetDisableInstrumentation(ip: *InternPool, func: Index) void { @atomicStore(FuncAnalysis, analysis_ptr, analysis, .release); } +pub fn funcSetDisableIntrinsics(ip: *InternPool, func: Index) void { + const unwrapped_func = func.unwrap(ip); + const extra_mutex = &ip.getLocal(unwrapped_func.tid).mutate.extra.mutex; + extra_mutex.lock(); + defer extra_mutex.unlock(); + + const analysis_ptr = ip.funcAnalysisPtr(func); + var analysis = analysis_ptr.*; + analysis.disable_intrinsics = true; + @atomicStore(FuncAnalysis, analysis_ptr, analysis, .release); +} + pub fn funcZirBodyInst(ip: *const InternPool, func: Index) TrackedInst.Index { const unwrapped_func = func.unwrap(ip); const item = unwrapped_func.getItem(ip); |
