aboutsummaryrefslogtreecommitdiff
path: root/src/InternPool.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-07-23 11:39:19 -0700
committerGitHub <noreply@github.com>2024-07-23 11:39:19 -0700
commit6f3e9939d0389539570d4a7cad95b1e96bc8f0d4 (patch)
treeabf951c8dc19393655df93f23a6911ce6fad660d /src/InternPool.zig
parent255547d7a6a1acee9c9b65d251ec4935433b6878 (diff)
parent61ad1be6bd7d27f79773e7da891898449a45a80e (diff)
downloadzig-6f3e9939d0389539570d4a7cad95b1e96bc8f0d4.tar.gz
zig-6f3e9939d0389539570d4a7cad95b1e96bc8f0d4.zip
Merge pull request #20725 from ziglang/fuzz
initial support for integrated fuzzing
Diffstat (limited to 'src/InternPool.zig')
-rw-r--r--src/InternPool.zig20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig
index c3cee5852b..2934340034 100644
--- a/src/InternPool.zig
+++ b/src/InternPool.zig
@@ -5184,11 +5184,11 @@ pub const FuncAnalysis = packed struct(u32) {
is_noinline: bool,
calls_or_awaits_errorable_fn: bool,
stack_alignment: Alignment,
-
/// True if this function has an inferred error set.
inferred_error_set: bool,
+ disable_instrumentation: bool,
- _: u14 = 0,
+ _: u13 = 0,
pub const State = enum(u8) {
/// This function has not yet undergone analysis, because we have not
@@ -8111,6 +8111,7 @@ pub fn getFuncDecl(
.calls_or_awaits_errorable_fn = false,
.stack_alignment = .none,
.inferred_error_set = false,
+ .disable_instrumentation = false,
},
.owner_decl = key.owner_decl,
.ty = key.ty,
@@ -8214,6 +8215,7 @@ pub fn getFuncDeclIes(
.calls_or_awaits_errorable_fn = false,
.stack_alignment = .none,
.inferred_error_set = true,
+ .disable_instrumentation = false,
},
.owner_decl = key.owner_decl,
.ty = func_ty,
@@ -8405,6 +8407,7 @@ pub fn getFuncInstance(
.calls_or_awaits_errorable_fn = false,
.stack_alignment = .none,
.inferred_error_set = false,
+ .disable_instrumentation = false,
},
// This is populated after we create the Decl below. It is not read
// by equality or hashing functions.
@@ -8504,6 +8507,7 @@ pub fn getFuncInstanceIes(
.calls_or_awaits_errorable_fn = false,
.stack_alignment = .none,
.inferred_error_set = true,
+ .disable_instrumentation = false,
},
// This is populated after we create the Decl below. It is not read
// by equality or hashing functions.
@@ -11225,6 +11229,18 @@ pub fn funcSetCallsOrAwaitsErrorableFn(ip: *InternPool, func: Index) void {
@atomicStore(FuncAnalysis, analysis_ptr, analysis, .release);
}
+pub fn funcSetDisableInstrumentation(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_instrumentation = true;
+ @atomicStore(FuncAnalysis, analysis_ptr, analysis, .release);
+}
+
pub fn funcSetCold(ip: *InternPool, func: Index, is_cold: bool) void {
const unwrapped_func = func.unwrap(ip);
const extra_mutex = &ip.getLocal(unwrapped_func.tid).mutate.extra.mutex;