@zigc/lib 0.16.0-test.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/c/math.zig +135 -35
- package/c/stropts.zig +17 -0
- package/c.zig +1 -0
- package/compiler/aro/aro/Attribute/names.zig +604 -589
- package/compiler/aro/aro/Attribute.zig +202 -116
- package/compiler/aro/aro/Builtins/common.zig +874 -863
- package/compiler/aro/aro/Builtins/eval.zig +15 -7
- package/compiler/aro/aro/Builtins.zig +0 -1
- package/compiler/aro/aro/CodeGen.zig +3 -1
- package/compiler/aro/aro/Compilation.zig +120 -97
- package/compiler/aro/aro/Diagnostics.zig +21 -17
- package/compiler/aro/aro/Driver/GCCDetector.zig +635 -0
- package/compiler/aro/aro/Driver.zig +124 -50
- package/compiler/aro/aro/LangOpts.zig +12 -2
- package/compiler/aro/aro/Parser/Diagnostic.zig +79 -19
- package/compiler/aro/aro/Parser.zig +336 -142
- package/compiler/aro/aro/Preprocessor/Diagnostic.zig +21 -0
- package/compiler/aro/aro/Preprocessor.zig +127 -56
- package/compiler/aro/aro/Target.zig +17 -12
- package/compiler/aro/aro/Tokenizer.zig +31 -14
- package/compiler/aro/aro/Toolchain.zig +4 -7
- package/compiler/aro/aro/Tree.zig +178 -148
- package/compiler/aro/aro/TypeStore.zig +82 -24
- package/compiler/aro/aro/Value.zig +13 -17
- package/compiler/aro/aro/features.zig +1 -0
- package/compiler/aro/aro/pragmas/once.zig +0 -1
- package/compiler/aro/aro/record_layout.zig +3 -3
- package/compiler/aro/assembly_backend/x86_64.zig +3 -4
- package/compiler/aro/backend/Assembly.zig +1 -2
- package/compiler/aro/backend/Interner.zig +2 -2
- package/compiler/aro/backend/Ir.zig +100 -92
- package/compiler/aro/include/ptrcheck.h +49 -0
- package/compiler/aro/main.zig +26 -10
- package/compiler/build_runner.zig +1 -0
- package/compiler/objdump.zig +93 -0
- package/compiler/reduce.zig +5 -1
- package/compiler/resinator/compile.zig +2 -2
- package/compiler/resinator/main.zig +7 -1
- package/compiler/resinator/preprocess.zig +1 -3
- package/compiler/std-docs.zig +8 -1
- package/compiler/test_runner.zig +193 -61
- package/compiler/translate-c/MacroTranslator.zig +80 -11
- package/compiler/translate-c/PatternList.zig +1 -9
- package/compiler/translate-c/Scope.zig +43 -6
- package/compiler/translate-c/Translator.zig +364 -126
- package/compiler/translate-c/ast.zig +19 -11
- package/compiler/translate-c/main.zig +75 -16
- package/compiler_rt/cos.zig +141 -52
- package/compiler_rt/limb64.zig +266 -0
- package/compiler_rt/long_double.zig +37 -0
- package/compiler_rt/mulo.zig +6 -1
- package/compiler_rt/rem_pio2l.zig +173 -0
- package/compiler_rt/sin.zig +140 -55
- package/compiler_rt/sincos.zig +279 -72
- package/compiler_rt/tan.zig +118 -47
- package/compiler_rt/trig.zig +256 -6
- package/compiler_rt.zig +2 -0
- package/fuzzer.zig +855 -307
- package/libc/musl/src/math/pow.c +343 -0
- package/package.json +1 -1
- package/std/Build/Fuzz.zig +6 -19
- package/std/Build/Module.zig +1 -1
- package/std/Build/Step/CheckObject.zig +3 -3
- package/std/Build/Step/Compile.zig +18 -0
- package/std/Build/Step/ConfigHeader.zig +49 -33
- package/std/Build/Step/InstallArtifact.zig +18 -0
- package/std/Build/Step/Run.zig +536 -87
- package/std/Build/Step/TranslateC.zig +0 -6
- package/std/Build/Step.zig +8 -15
- package/std/Build/WebServer.zig +29 -17
- package/std/Build/abi.zig +47 -11
- package/std/Build.zig +17 -14
- package/std/Io/Dispatch.zig +2 -0
- package/std/Io/File/Reader.zig +3 -1
- package/std/Io/File.zig +1 -0
- package/std/Io/Kqueue.zig +2 -2
- package/std/Io/Threaded.zig +181 -143
- package/std/Io/Uring.zig +2 -1
- package/std/Io.zig +970 -2
- package/std/Target.zig +3 -2
- package/std/Thread.zig +8 -3
- package/std/array_hash_map.zig +96 -555
- package/std/array_list.zig +22 -31
- package/std/bit_set.zig +22 -6
- package/std/builtin/assembly.zig +68 -0
- package/std/c.zig +17 -17
- package/std/compress/flate/Compress.zig +3 -3
- package/std/crypto/Certificate/Bundle.zig +15 -1
- package/std/crypto/codecs/asn1.zig +33 -18
- package/std/crypto/codecs/base64_hex_ct.zig +14 -4
- package/std/debug/Dwarf.zig +29 -9
- package/std/debug/Info.zig +4 -0
- package/std/debug/MachOFile.zig +46 -8
- package/std/debug/Pdb.zig +539 -36
- package/std/debug/SelfInfo/Elf.zig +19 -18
- package/std/debug/SelfInfo/MachO.zig +18 -7
- package/std/debug/SelfInfo/Windows.zig +138 -36
- package/std/debug.zig +179 -65
- package/std/enums.zig +25 -19
- package/std/heap/ArenaAllocator.zig +145 -154
- package/std/heap/debug_allocator.zig +7 -7
- package/std/http/Client.zig +10 -6
- package/std/http.zig +11 -9
- package/std/json/Stringify.zig +3 -3
- package/std/json/dynamic.zig +4 -4
- package/std/math/big/int.zig +16 -17
- package/std/mem/Allocator.zig +4 -5
- package/std/mem.zig +48 -0
- package/std/os/emscripten.zig +1 -17
- package/std/os/linux.zig +7 -2
- package/std/os/windows.zig +2 -2
- package/std/pdb.zig +143 -4
- package/std/posix.zig +6 -12
- package/std/priority_dequeue.zig +13 -12
- package/std/priority_queue.zig +5 -4
- package/std/process/Child.zig +1 -1
- package/std/process/Environ.zig +1 -1
- package/std/start.zig +17 -4
- package/std/std.zig +19 -6
- package/std/testing/FailingAllocator.zig +4 -4
- package/std/testing/Smith.zig +37 -2
- package/std/zig/Ast/Render.zig +186 -458
- package/std/zig/Ast.zig +0 -4
- package/std/zig/AstGen.zig +44 -7
- package/std/zig/AstSmith.zig +2602 -0
- package/std/zig/Client.zig +8 -3
- package/std/zig/Parse.zig +83 -74
- package/std/zig/Server.zig +26 -0
- package/std/zig/Zir.zig +17 -0
- package/std/zig/c_translation/helpers.zig +14 -9
- package/std/zig/llvm/Builder.zig +107 -48
- package/std/zig/system.zig +20 -4
- package/std/zig/tokenizer.zig +2 -1
- package/std/zig.zig +6 -0
- package/compiler/aro/aro/Driver/Filesystem.zig +0 -241
- package/libc/mingw/complex/cabs.c +0 -48
- package/libc/mingw/complex/cabsf.c +0 -48
- package/libc/mingw/complex/cacos.c +0 -50
- package/libc/mingw/complex/cacosf.c +0 -50
- package/libc/mingw/complex/carg.c +0 -48
- package/libc/mingw/complex/cargf.c +0 -48
- package/libc/mingw/complex/casin.c +0 -50
- package/libc/mingw/complex/casinf.c +0 -50
- package/libc/mingw/complex/catan.c +0 -50
- package/libc/mingw/complex/catanf.c +0 -50
- package/libc/mingw/complex/ccos.c +0 -50
- package/libc/mingw/complex/ccosf.c +0 -50
- package/libc/mingw/complex/cexp.c +0 -48
- package/libc/mingw/complex/cexpf.c +0 -48
- package/libc/mingw/complex/cimag.c +0 -48
- package/libc/mingw/complex/cimagf.c +0 -48
- package/libc/mingw/complex/clog.c +0 -48
- package/libc/mingw/complex/clog10.c +0 -49
- package/libc/mingw/complex/clog10f.c +0 -49
- package/libc/mingw/complex/clogf.c +0 -48
- package/libc/mingw/complex/conj.c +0 -48
- package/libc/mingw/complex/conjf.c +0 -48
- package/libc/mingw/complex/cpow.c +0 -48
- package/libc/mingw/complex/cpowf.c +0 -48
- package/libc/mingw/complex/cproj.c +0 -48
- package/libc/mingw/complex/cprojf.c +0 -48
- package/libc/mingw/complex/creal.c +0 -48
- package/libc/mingw/complex/crealf.c +0 -48
- package/libc/mingw/complex/csin.c +0 -50
- package/libc/mingw/complex/csinf.c +0 -50
- package/libc/mingw/complex/csqrt.c +0 -48
- package/libc/mingw/complex/csqrtf.c +0 -48
- package/libc/mingw/complex/ctan.c +0 -50
- package/libc/mingw/complex/ctanf.c +0 -50
- package/libc/mingw/math/arm/s_rint.c +0 -86
- package/libc/mingw/math/arm/s_rintf.c +0 -51
- package/libc/mingw/math/arm/sincos.S +0 -30
- package/libc/mingw/math/arm-common/sincosl.c +0 -13
- package/libc/mingw/math/arm64/rint.c +0 -12
- package/libc/mingw/math/arm64/rintf.c +0 -12
- package/libc/mingw/math/arm64/sincos.S +0 -32
- package/libc/mingw/math/bsd_private_base.h +0 -148
- package/libc/mingw/math/frexpf.c +0 -13
- package/libc/mingw/math/frexpl.c +0 -71
- package/libc/mingw/math/x86/acosf.c +0 -29
- package/libc/mingw/math/x86/atanf.c +0 -23
- package/libc/mingw/math/x86/atanl.c +0 -18
- package/libc/mingw/math/x86/cos.def.h +0 -65
- package/libc/mingw/math/x86/cosl.c +0 -46
- package/libc/mingw/math/x86/cosl_internal.S +0 -55
- package/libc/mingw/math/x86/ldexp.c +0 -23
- package/libc/mingw/math/x86/scalbn.S +0 -41
- package/libc/mingw/math/x86/scalbnf.S +0 -40
- package/libc/mingw/math/x86/sin.def.h +0 -65
- package/libc/mingw/math/x86/sinl.c +0 -46
- package/libc/mingw/math/x86/sinl_internal.S +0 -58
- package/libc/mingw/math/x86/tanl.S +0 -62
- package/libc/mingw/misc/btowc.c +0 -28
- package/libc/mingw/misc/wcstof.c +0 -66
- package/libc/mingw/misc/wcstoimax.c +0 -132
- package/libc/mingw/misc/wcstoumax.c +0 -126
- package/libc/mingw/misc/wctob.c +0 -29
- package/libc/mingw/misc/winbs_uint64.c +0 -6
- package/libc/mingw/misc/winbs_ulong.c +0 -6
- package/libc/mingw/misc/winbs_ushort.c +0 -6
- package/libc/mingw/stdio/_Exit.c +0 -10
- package/libc/mingw/stdio/_findfirst64i32.c +0 -21
- package/libc/mingw/stdio/_findnext64i32.c +0 -21
- package/libc/mingw/stdio/_fstat64i32.c +0 -37
- package/libc/mingw/stdio/_stat64i32.c +0 -37
- package/libc/mingw/stdio/_wfindfirst64i32.c +0 -21
- package/libc/mingw/stdio/_wfindnext64i32.c +0 -21
- package/libc/mingw/stdio/_wstat64i32.c +0 -37
- package/libc/musl/src/legacy/isastream.c +0 -7
- package/libc/musl/src/legacy/valloc.c +0 -8
- package/libc/musl/src/math/__cosl.c +0 -96
- package/libc/musl/src/math/__sinl.c +0 -78
- package/libc/musl/src/math/__tanl.c +0 -143
- package/libc/musl/src/math/aarch64/lrint.c +0 -10
- package/libc/musl/src/math/aarch64/lrintf.c +0 -10
- package/libc/musl/src/math/aarch64/rintf.c +0 -7
- package/libc/musl/src/math/cosl.c +0 -39
- package/libc/musl/src/math/fdim.c +0 -10
- package/libc/musl/src/math/finite.c +0 -7
- package/libc/musl/src/math/finitef.c +0 -7
- package/libc/musl/src/math/frexp.c +0 -23
- package/libc/musl/src/math/frexpf.c +0 -23
- package/libc/musl/src/math/frexpl.c +0 -29
- package/libc/musl/src/math/i386/lrint.c +0 -8
- package/libc/musl/src/math/i386/lrintf.c +0 -8
- package/libc/musl/src/math/i386/rintf.c +0 -7
- package/libc/musl/src/math/lrint.c +0 -72
- package/libc/musl/src/math/lrintf.c +0 -8
- package/libc/musl/src/math/powerpc64/lrint.c +0 -16
- package/libc/musl/src/math/powerpc64/lrintf.c +0 -16
- package/libc/musl/src/math/rintf.c +0 -30
- package/libc/musl/src/math/s390x/rintf.c +0 -15
- package/libc/musl/src/math/sincosl.c +0 -60
- package/libc/musl/src/math/sinl.c +0 -41
- package/libc/musl/src/math/tanl.c +0 -29
- package/libc/musl/src/math/x32/lrint.s +0 -5
- package/libc/musl/src/math/x32/lrintf.s +0 -5
- package/libc/musl/src/math/x86_64/lrint.c +0 -8
- package/libc/musl/src/math/x86_64/lrintf.c +0 -8
- package/libc/wasi/libc-bottom-half/sources/reallocarray.c +0 -14
package/std/start.zig
CHANGED
|
@@ -631,6 +631,7 @@ inline fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [:null]?[*:0]u8)
|
|
|
631
631
|
if (std.Options.debug_threaded_io) |t| {
|
|
632
632
|
if (@sizeOf(std.Io.Threaded.Argv0) != 0) t.argv0.value = argv[0];
|
|
633
633
|
t.environ = .{ .process_environ = .{ .block = env_block } };
|
|
634
|
+
t.environ_initialized = env_block.isEmpty();
|
|
634
635
|
}
|
|
635
636
|
std.Thread.maybeAttachSignalStack();
|
|
636
637
|
std.debug.maybeEnableSegfaultHandler();
|
|
@@ -664,10 +665,22 @@ fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) cal
|
|
|
664
665
|
|
|
665
666
|
fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.c) c_int {
|
|
666
667
|
const argv = @as([*][*:0]u8, @ptrCast(c_argv))[0..@intCast(c_argc)];
|
|
667
|
-
|
|
668
|
-
|
|
668
|
+
const environ: [:null]?[*:0]u8 = switch (builtin.os.tag) {
|
|
669
|
+
.wasi, .emscripten => environ: {
|
|
670
|
+
const c_environ = std.c.environ;
|
|
671
|
+
var env_count: usize = 0;
|
|
672
|
+
while (c_environ[env_count] != null) : (env_count += 1) {}
|
|
673
|
+
break :environ c_environ[0..env_count :null];
|
|
674
|
+
},
|
|
675
|
+
else => &.{},
|
|
676
|
+
};
|
|
677
|
+
const env_block: std.process.Environ.Block = .{ .slice = environ };
|
|
678
|
+
if (std.Options.debug_threaded_io) |t| {
|
|
679
|
+
if (@sizeOf(std.Io.Threaded.Argv0) != 0) t.argv0.value = argv[0];
|
|
680
|
+
t.environ = .{ .process_environ = .{ .block = env_block } };
|
|
681
|
+
t.environ_initialized = env_block.isEmpty();
|
|
669
682
|
}
|
|
670
|
-
return callMain(argv,
|
|
683
|
+
return callMain(argv, env_block);
|
|
671
684
|
}
|
|
672
685
|
|
|
673
686
|
/// General error message for a malformed return type
|
|
@@ -748,7 +761,7 @@ inline fn wrapMain(result: anytype) u8 {
|
|
|
748
761
|
std.log.err("{t}", .{err});
|
|
749
762
|
switch (native_os) {
|
|
750
763
|
.freestanding, .other => {},
|
|
751
|
-
else => if (@errorReturnTrace()) |trace| std.debug.
|
|
764
|
+
else => if (@errorReturnTrace()) |trace| std.debug.dumpErrorReturnTrace(trace),
|
|
752
765
|
}
|
|
753
766
|
return 1;
|
|
754
767
|
};
|
package/std/std.zig
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
pub const ArrayHashMap = array_hash_map.ArrayHashMap;
|
|
2
|
-
pub const ArrayHashMapUnmanaged = array_hash_map.ArrayHashMapUnmanaged;
|
|
3
|
-
pub const AutoArrayHashMap = array_hash_map.AutoArrayHashMap;
|
|
4
|
-
pub const AutoArrayHashMapUnmanaged = array_hash_map.AutoArrayHashMapUnmanaged;
|
|
5
1
|
pub const AutoHashMap = hash_map.AutoHashMap;
|
|
6
2
|
pub const AutoHashMapUnmanaged = hash_map.AutoHashMapUnmanaged;
|
|
7
3
|
pub const BitStack = @import("BitStack.zig");
|
|
@@ -31,14 +27,19 @@ pub const SinglyLinkedList = @import("SinglyLinkedList.zig");
|
|
|
31
27
|
pub const StaticBitSet = bit_set.StaticBitSet;
|
|
32
28
|
pub const StringHashMap = hash_map.StringHashMap;
|
|
33
29
|
pub const StringHashMapUnmanaged = hash_map.StringHashMapUnmanaged;
|
|
34
|
-
pub const StringArrayHashMap = array_hash_map.StringArrayHashMap;
|
|
35
|
-
pub const StringArrayHashMapUnmanaged = array_hash_map.StringArrayHashMapUnmanaged;
|
|
36
30
|
pub const Target = @import("Target.zig");
|
|
37
31
|
pub const Thread = @import("Thread.zig");
|
|
38
32
|
pub const Treap = @import("treap.zig").Treap;
|
|
39
33
|
pub const Tz = tz.Tz;
|
|
40
34
|
pub const Uri = @import("Uri.zig");
|
|
41
35
|
|
|
36
|
+
/// Deprecated; use `array_hash_map.Custom`.
|
|
37
|
+
pub const ArrayHashMapUnmanaged = array_hash_map.Custom;
|
|
38
|
+
/// Deprecated; use `array_hash_map.Auto`.
|
|
39
|
+
pub const AutoArrayHashMapUnmanaged = array_hash_map.Auto;
|
|
40
|
+
/// Deprecated; use `array_hash_map.String`.
|
|
41
|
+
pub const StringArrayHashMapUnmanaged = array_hash_map.String;
|
|
42
|
+
|
|
42
43
|
/// A contiguous, growable list of items in memory. This is a wrapper around a
|
|
43
44
|
/// slice of `T` values.
|
|
44
45
|
///
|
|
@@ -164,6 +165,8 @@ pub const Options = struct {
|
|
|
164
165
|
/// * `debug.dumpCurrentStackTrace`
|
|
165
166
|
/// * `debug.writeStackTrace`
|
|
166
167
|
/// * `debug.dumpStackTrace`
|
|
168
|
+
/// * `debug.writeErrorReturnTrace`
|
|
169
|
+
/// * `debug.dumpErrorReturnTrace`
|
|
167
170
|
///
|
|
168
171
|
/// Stack traces can generally be collected and printed when debug info is stripped, but are
|
|
169
172
|
/// often less useful since they usually cannot be mapped to source locations and/or have bad
|
|
@@ -177,6 +180,16 @@ pub const Options = struct {
|
|
|
177
180
|
/// Allows disabling networking in std.Io implementations.
|
|
178
181
|
networking: bool = true,
|
|
179
182
|
|
|
183
|
+
/// Whether or not `error.Unexpected` will print its value and a stack trace.
|
|
184
|
+
///
|
|
185
|
+
/// If this happens the fix is to add the error code to the corresponding
|
|
186
|
+
/// switch expression, possibly introduce a new error in the error set, and
|
|
187
|
+
/// send a patch to Zig.
|
|
188
|
+
unexpected_error_tracing: bool = @import("builtin").mode == .Debug and switch (@import("builtin").zig_backend) {
|
|
189
|
+
.stage2_llvm, .stage2_x86_64 => true,
|
|
190
|
+
else => false,
|
|
191
|
+
},
|
|
192
|
+
|
|
180
193
|
/// TODO This is a separate decl instead of a field as a workaround around
|
|
181
194
|
/// compilation errors due to zig not being lazy enough.
|
|
182
195
|
pub const logTerminalMode: fn () Io.Terminal.Mode = log.defaultTerminalMode;
|
|
@@ -65,7 +65,7 @@ fn alloc(
|
|
|
65
65
|
if (self.alloc_index == self.fail_index) {
|
|
66
66
|
if (!self.has_induced_failure) {
|
|
67
67
|
const st = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &self.stack_addresses);
|
|
68
|
-
@memset(self.stack_addresses[@min(st.
|
|
68
|
+
@memset(self.stack_addresses[@min(st.return_addresses.len, self.stack_addresses.len)..], 0);
|
|
69
69
|
self.has_induced_failure = true;
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
@@ -131,15 +131,15 @@ fn free(
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
/// Only valid once `has_induced_failure == true`
|
|
134
|
-
pub fn getStackTrace(self: *FailingAllocator) std.
|
|
134
|
+
pub fn getStackTrace(self: *FailingAllocator) std.debug.StackTrace {
|
|
135
135
|
std.debug.assert(self.has_induced_failure);
|
|
136
136
|
var len: usize = 0;
|
|
137
137
|
while (len < self.stack_addresses.len and self.stack_addresses[len] != 0) {
|
|
138
138
|
len += 1;
|
|
139
139
|
}
|
|
140
140
|
return .{
|
|
141
|
-
.
|
|
142
|
-
.
|
|
141
|
+
.return_addresses = self.stack_addresses[0..len],
|
|
142
|
+
.skipped = if (len == self.stack_addresses.len) .unknown else .none,
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
|
package/std/testing/Smith.zig
CHANGED
|
@@ -205,6 +205,24 @@ pub noinline fn valueRangeLessThan(s: *Smith, T: type, at_least: T, less_than: T
|
|
|
205
205
|
return s.valueRangeLessThanWithHash(T, at_least, less_than, firstHash());
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
/// It is asserted `len` is nonzero.
|
|
209
|
+
/// It is asserted `len` fits within 64 bits.
|
|
210
|
+
//
|
|
211
|
+
// `noinline` to capture a unique return address
|
|
212
|
+
pub noinline fn index(s: *Smith, len: usize) usize {
|
|
213
|
+
@disableInstrumentation();
|
|
214
|
+
return s.indexWithHash(len, firstHash());
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/// It is asserted that the weight of `false` is non-zero.
|
|
218
|
+
/// It is asserted that the weight of `true` is non-zero.
|
|
219
|
+
//
|
|
220
|
+
// `noinline` to capture a unique return address
|
|
221
|
+
pub noinline fn boolWeighted(s: *Smith, false_weight: u64, true_weight: u64) bool {
|
|
222
|
+
@disableInstrumentation();
|
|
223
|
+
return s.boolWeightedWithHash(false_weight, true_weight, firstHash());
|
|
224
|
+
}
|
|
225
|
+
|
|
208
226
|
/// This is similar to `value(bool)` however it is gauraunteed to eventually
|
|
209
227
|
/// return `true` and provides the fuzzer with an extra hint about the data.
|
|
210
228
|
//
|
|
@@ -228,6 +246,7 @@ pub noinline fn eosWeighted(s: *Smith, weights: []const Weight) bool {
|
|
|
228
246
|
/// This is similar to `value(bool)` however it is gauraunteed to eventually
|
|
229
247
|
/// return `true` and provides the fuzzer with an extra hint about the data.
|
|
230
248
|
///
|
|
249
|
+
/// It is asserted that the weight of `false` is non-zero.
|
|
231
250
|
/// It is asserted that the weight of `true` is non-zero.
|
|
232
251
|
//
|
|
233
252
|
// `noinline` to capture a unique return address
|
|
@@ -463,6 +482,24 @@ pub fn valueRangeLessThanWithHash(s: *Smith, T: type, at_least: T, less_than: T,
|
|
|
463
482
|
return s.valueWeightedWithHash(T, &.{.rangeLessThan(T, at_least, less_than, 1)}, hash);
|
|
464
483
|
}
|
|
465
484
|
|
|
485
|
+
/// It is asserted `len` is nonzero.
|
|
486
|
+
/// It is asserted `len` fits within 64 bits.
|
|
487
|
+
pub fn indexWithHash(s: *Smith, len: usize, hash: u32) usize {
|
|
488
|
+
@disableInstrumentation();
|
|
489
|
+
assert(len != 0);
|
|
490
|
+
return @intCast(s.valueWeightedWithHash(u64, &.{.rangeLessThan(u64, 0, @intCast(len), 1)}, hash));
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/// It is asserted that the weight of `false` is non-zero.
|
|
494
|
+
/// It is asserted that the weight of `true` is non-zero.
|
|
495
|
+
pub fn boolWeightedWithHash(s: *Smith, false_weight: u64, true_weight: u64, hash: u32) bool {
|
|
496
|
+
@disableInstrumentation();
|
|
497
|
+
return s.valueWeightedWithHash(bool, &.{
|
|
498
|
+
.value(bool, false, false_weight),
|
|
499
|
+
.value(bool, true, true_weight),
|
|
500
|
+
}, hash);
|
|
501
|
+
}
|
|
502
|
+
|
|
466
503
|
/// This is similar to `value(bool)` however it is gauraunteed to eventually
|
|
467
504
|
/// return `true` and provides the fuzzer with an extra hint about the data.
|
|
468
505
|
pub fn eosWithHash(s: *Smith, hash: u32) bool {
|
|
@@ -504,8 +541,6 @@ pub fn eosWeightedWithHash(s: *Smith, weights: []const Weight, hash: u32) bool {
|
|
|
504
541
|
///
|
|
505
542
|
/// It is asserted that the weight of `false` is non-zero.
|
|
506
543
|
/// It is asserted that the weight of `true` is non-zero.
|
|
507
|
-
//
|
|
508
|
-
// `noinline` to capture a unique return address
|
|
509
544
|
pub fn eosWeightedSimpleWithHash(s: *Smith, false_weight: u64, true_weight: u64, hash: u32) bool {
|
|
510
545
|
@disableInstrumentation();
|
|
511
546
|
return s.eosWeightedWithHash(&.{
|