aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-07-21 23:50:50 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-07-22 13:07:02 -0700
commit25198810c88d474c63ff537e3647f12e7df6297c (patch)
treef92e3b6dcf75aa653df9786fb6c17360291a8e4c /src/Sema.zig
parent7930efc60becd7624471419b8fd49800512d4e10 (diff)
downloadzig-25198810c88d474c63ff537e3647f12e7df6297c.tar.gz
zig-25198810c88d474c63ff537e3647f12e7df6297c.zip
add new builtin: `@disableInstrumentation`
This is needed to ensure that start code does not try to access thread local storage before it has set up thread local storage.
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index fbd5d636bd..b01c81ff22 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -1316,6 +1316,11 @@ fn analyzeBodyInner(
i += 1;
continue;
},
+ .disable_instrumentation => {
+ try sema.zirDisableInstrumentation();
+ i += 1;
+ continue;
+ },
.restore_err_ret_index => {
try sema.zirRestoreErrRetIndex(block, extended);
i += 1;
@@ -6576,6 +6581,14 @@ fn zirSetCold(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData)
ip.funcSetCold(sema.func_index, is_cold);
}
+fn zirDisableInstrumentation(sema: *Sema) CompileError!void {
+ const pt = sema.pt;
+ const mod = pt.zcu;
+ const ip = &mod.intern_pool;
+ if (sema.func_index == .none) return; // does nothing outside a function
+ ip.funcSetDisableInstrumentation(sema.func_index);
+}
+
fn zirSetFloatMode(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void {
const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;
const src = block.builtinCallArgSrc(extra.node, 0);