@zigc/lib 0.17.0-dev.657 → 0.17.0-dev.667
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/compiler/Maker.zig +2 -2
- package/libc/include/powerpc-linux-gnu/bits/struct_mutex.h +2 -2
- package/libc/include/s390x-linux-gnu/bits/fenv.h +2 -2
- package/libc/include/s390x-linux-gnu/bits/struct_mutex.h +2 -2
- package/libc/include/x86-linux-gnu/bits/struct_mutex.h +2 -2
- package/package.json +1 -1
- package/std/crypto/aes/aesni.zig +1 -1
- package/std/crypto/aes/armcrypto.zig +4 -4
- package/std/crypto/aes/soft.zig +4 -4
- package/std/crypto/aes.zig +12 -0
- package/std/debug/SelfInfo/MachO.zig +42 -15
- package/std/sort/pdq.zig +22 -5
- package/std/zon/parse.zig +25 -0
package/compiler/Maker.zig
CHANGED
|
@@ -194,7 +194,7 @@ pub fn main(init: process.Init.Minimal) !void {
|
|
|
194
194
|
var max_rss: u64 = 0;
|
|
195
195
|
var skip_oom_steps = false;
|
|
196
196
|
var test_timeout_ns: ?u64 = null;
|
|
197
|
-
var color: Color = .
|
|
197
|
+
var color: Color = .settingFromEnvironment(&graph.environ_map);
|
|
198
198
|
var watch = false;
|
|
199
199
|
var fuzz: ?Fuzz.Mode = null;
|
|
200
200
|
var debounce_interval_ms: u16 = 50;
|
|
@@ -533,7 +533,7 @@ pub fn main(init: process.Init.Minimal) !void {
|
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
const main_progress_node = std.Progress.start(io, .{
|
|
536
|
-
.disable_printing = (
|
|
536
|
+
.disable_printing = (graph.stderr_mode.? == .no_color),
|
|
537
537
|
});
|
|
538
538
|
defer main_progress_node.end();
|
|
539
539
|
|
|
@@ -32,7 +32,7 @@ struct __pthread_mutex_s
|
|
|
32
32
|
int __kind;
|
|
33
33
|
#if __WORDSIZE == 64
|
|
34
34
|
short __spins;
|
|
35
|
-
short
|
|
35
|
+
short __glibc_reserved;
|
|
36
36
|
__pthread_list_t __list;
|
|
37
37
|
# define __PTHREAD_MUTEX_HAVE_PREV 1
|
|
38
38
|
#else
|
|
@@ -59,4 +59,4 @@ struct __pthread_mutex_s
|
|
|
59
59
|
0, 0, 0, __kind, 0, { { 0, 0 } }
|
|
60
60
|
#endif
|
|
61
61
|
|
|
62
|
-
#endif
|
|
62
|
+
#endif
|
|
@@ -76,7 +76,7 @@ typedef unsigned int fexcept_t; /* size of fpc */
|
|
|
76
76
|
typedef struct
|
|
77
77
|
{
|
|
78
78
|
fexcept_t __fpc;
|
|
79
|
-
void *
|
|
79
|
+
void *__glibc_reserved;
|
|
80
80
|
/* The field __unused (formerly __ieee_instruction_pointer) is a relict from
|
|
81
81
|
commit "Remove PTRACE_PEEKUSER" (87b9b50f0d4b92248905e95a06a13c513dc45e59)
|
|
82
82
|
and isn't used anymore. */
|
|
@@ -96,4 +96,4 @@ typedef unsigned int femode_t;
|
|
|
96
96
|
|
|
97
97
|
/* Default floating-point control modes. */
|
|
98
98
|
# define FE_DFL_MODE ((const femode_t *) -1L)
|
|
99
|
-
#endif
|
|
99
|
+
#endif
|
|
@@ -32,7 +32,7 @@ struct __pthread_mutex_s
|
|
|
32
32
|
int __kind;
|
|
33
33
|
#if __WORDSIZE == 64
|
|
34
34
|
short __spins;
|
|
35
|
-
short
|
|
35
|
+
short __glibc_reserved;
|
|
36
36
|
__pthread_list_t __list;
|
|
37
37
|
# define __PTHREAD_MUTEX_HAVE_PREV 1
|
|
38
38
|
#else
|
|
@@ -59,4 +59,4 @@ struct __pthread_mutex_s
|
|
|
59
59
|
0, 0, 0, __kind, 0, { { 0, 0 } }
|
|
60
60
|
#endif
|
|
61
61
|
|
|
62
|
-
#endif
|
|
62
|
+
#endif
|
|
@@ -32,7 +32,7 @@ struct __pthread_mutex_s
|
|
|
32
32
|
int __kind;
|
|
33
33
|
#ifdef __x86_64__
|
|
34
34
|
short __spins;
|
|
35
|
-
short
|
|
35
|
+
short __glibc_reserved;
|
|
36
36
|
__pthread_list_t __list;
|
|
37
37
|
# define __PTHREAD_MUTEX_HAVE_PREV 1
|
|
38
38
|
#else
|
|
@@ -59,4 +59,4 @@ struct __pthread_mutex_s
|
|
|
59
59
|
0, 0, 0, __kind, 0, { { 0, 0 } }
|
|
60
60
|
#endif
|
|
61
61
|
|
|
62
|
-
#endif
|
|
62
|
+
#endif
|
package/package.json
CHANGED
package/std/crypto/aes/aesni.zig
CHANGED
|
@@ -312,7 +312,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
/// Apply the bitwise OR operation to the content of two block vectors.
|
|
315
|
-
pub fn orBlocks(block_vec1: Self, block_vec2:
|
|
315
|
+
pub fn orBlocks(block_vec1: Self, block_vec2: Self) Self {
|
|
316
316
|
var out: Self = undefined;
|
|
317
317
|
inline for (0..native_words) |i| {
|
|
318
318
|
out.repr[i] = block_vec1.repr[i] | block_vec2.repr[i];
|
|
@@ -216,10 +216,10 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
/// XOR the block vector with a byte sequence.
|
|
219
|
-
pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [
|
|
220
|
-
var out:
|
|
219
|
+
pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [blocks_count * 16]u8 {
|
|
220
|
+
var out: [blocks_count * 16]u8 = undefined;
|
|
221
221
|
inline for (0..native_words) |i| {
|
|
222
|
-
out
|
|
222
|
+
out[i * native_word_size ..][0..native_word_size].* = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]);
|
|
223
223
|
}
|
|
224
224
|
return out;
|
|
225
225
|
}
|
|
@@ -279,7 +279,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
/// Apply the bitwise OR operation to the content of two block vectors.
|
|
282
|
-
pub fn orBlocks(block_vec1: Self, block_vec2:
|
|
282
|
+
pub fn orBlocks(block_vec1: Self, block_vec2: Self) Self {
|
|
283
283
|
var out: Self = undefined;
|
|
284
284
|
inline for (0..native_words) |i| {
|
|
285
285
|
out.repr[i] = block_vec1.repr[i].orBlocks(block_vec2.repr[i]);
|
package/std/crypto/aes/soft.zig
CHANGED
|
@@ -391,10 +391,10 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
|
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
/// XOR the block vector with a byte sequence.
|
|
394
|
-
pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [
|
|
395
|
-
var out:
|
|
394
|
+
pub fn xorBytes(block_vec: Self, bytes: *const [blocks_count * 16]u8) [blocks_count * 16]u8 {
|
|
395
|
+
var out: [blocks_count * 16]u8 = undefined;
|
|
396
396
|
for (0..native_words) |i| {
|
|
397
|
-
out
|
|
397
|
+
out[i * native_word_size ..][0..native_word_size].* = block_vec.repr[i].xorBytes(bytes[i * native_word_size ..][0..native_word_size]);
|
|
398
398
|
}
|
|
399
399
|
return out;
|
|
400
400
|
}
|
|
@@ -454,7 +454,7 @@ pub fn BlockVec(comptime blocks_count: comptime_int) type {
|
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
/// Apply the bitwise OR operation to the content of two block vectors.
|
|
457
|
-
pub fn orBlocks(block_vec1: Self, block_vec2:
|
|
457
|
+
pub fn orBlocks(block_vec1: Self, block_vec2: Self) Self {
|
|
458
458
|
var out: Self = undefined;
|
|
459
459
|
for (0..native_words) |i| {
|
|
460
460
|
out.repr[i] = block_vec1.repr[i].orBlocks(block_vec2.repr[i]);
|
package/std/crypto/aes.zig
CHANGED
|
@@ -137,6 +137,18 @@ test "BlockVec invMixColumns" {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
test "BlockVec bitwise operations" {
|
|
141
|
+
const a_bytes: [32]u8 = @splat(0xaa);
|
|
142
|
+
const b_bytes: [32]u8 = @splat(0xbb);
|
|
143
|
+
const a = BlockVec(2).fromBytes(&a_bytes);
|
|
144
|
+
const b = BlockVec(2).fromBytes(&b_bytes);
|
|
145
|
+
|
|
146
|
+
try testing.expectEqual(@as([32]u8, @splat(0x11)), a.xorBytes(&b_bytes));
|
|
147
|
+
try testing.expectEqual(@as([32]u8, @splat(0x11)), a.xorBlocks(b).toBytes());
|
|
148
|
+
try testing.expectEqual(@as([32]u8, @splat(0xbb)), a.orBlocks(b).toBytes());
|
|
149
|
+
try testing.expectEqual(@as([32]u8, @splat(0xaa)), a.andBlocks(b).toBytes());
|
|
150
|
+
}
|
|
151
|
+
|
|
140
152
|
test "expand 256-bit key" {
|
|
141
153
|
const key = [_]u8{
|
|
142
154
|
0x60, 0x3d, 0xeb, 0x10,
|
|
@@ -93,12 +93,28 @@ pub fn getSymbols(
|
|
|
93
93
|
pub fn getModuleName(si: *SelfInfo, io: Io, address: usize) Error![]const u8 {
|
|
94
94
|
_ = si;
|
|
95
95
|
_ = io;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
return getModuleNameInner(address) orelse return error.MissingDebugInfo;
|
|
97
|
+
}
|
|
98
|
+
fn getModuleNameInner(address: usize) ?[]const u8 {
|
|
99
|
+
switch (builtin.target.os.tag) {
|
|
100
|
+
.macos => {
|
|
101
|
+
// This function is marked as deprecated; however, it is significantly more performant
|
|
102
|
+
// than `dladdr` (since the latter also does a very slow symbol lookup), so let's just
|
|
103
|
+
// use it for the better performance since it's still available.
|
|
104
|
+
return std.mem.span(std.c.dyld_image_path_containing_address(
|
|
105
|
+
@ptrFromInt(address),
|
|
106
|
+
) orelse return null);
|
|
107
|
+
},
|
|
108
|
+
else => {
|
|
109
|
+
// On other Darwin systems, the function used above is entirely unavailable, so we have
|
|
110
|
+
// no choice but to use the slow `dladdr`.
|
|
111
|
+
var info: std.c.dl_info = undefined;
|
|
112
|
+
if (std.c.dladdr(@ptrFromInt(address), &info) == 0) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return std.mem.span(info.fname);
|
|
116
|
+
},
|
|
117
|
+
}
|
|
102
118
|
}
|
|
103
119
|
pub fn getModuleSlide(si: *SelfInfo, io: Io, address: usize) Error!usize {
|
|
104
120
|
const gpa = std.debug.getDebugInfoAllocator();
|
|
@@ -446,12 +462,25 @@ fn unwindFrameInner(si: *SelfInfo, io: Io, context: *UnwindContext) !usize {
|
|
|
446
462
|
|
|
447
463
|
/// Acquires the mutex on success.
|
|
448
464
|
fn findModule(si: *SelfInfo, gpa: Allocator, io: Io, address: usize) Error!*Module {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
465
|
+
const text_base: *anyopaque = switch (builtin.target.os.tag) {
|
|
466
|
+
.macos => base: {
|
|
467
|
+
// This function is marked as deprecated; however, it is significantly more performant
|
|
468
|
+
// than `dladdr` (since the latter also does a very slow symbol lookup), so let's just
|
|
469
|
+
// use it for the better performance since it's still available.
|
|
470
|
+
break :base std.c._dyld_get_image_header_containing_address(
|
|
471
|
+
@ptrFromInt(address),
|
|
472
|
+
) orelse return error.MissingDebugInfo;
|
|
473
|
+
},
|
|
474
|
+
else => base: {
|
|
475
|
+
// On other Darwin systems, the function used above is entirely unavailable, so we have
|
|
476
|
+
// no choice but to use the slow `dladdr`.
|
|
477
|
+
var info: std.c.dl_info = undefined;
|
|
478
|
+
if (std.c.dladdr(@ptrFromInt(address), &info) == 0) {
|
|
479
|
+
return error.MissingDebugInfo;
|
|
480
|
+
}
|
|
481
|
+
break :base info.fbase;
|
|
482
|
+
},
|
|
483
|
+
};
|
|
455
484
|
try si.mutex.lock(io);
|
|
456
485
|
errdefer si.mutex.unlock(io);
|
|
457
486
|
const gop = try si.modules.getOrPutAdapted(gpa, @intFromPtr(text_base), Module.Adapter{});
|
|
@@ -563,9 +592,7 @@ const Module = struct {
|
|
|
563
592
|
|
|
564
593
|
fn getFile(module: *Module, gpa: Allocator, io: Io) Error!*MachOFile {
|
|
565
594
|
if (module.file == null) {
|
|
566
|
-
const path =
|
|
567
|
-
std.c.dyld_image_path_containing_address(@ptrFromInt(module.text_base)).?,
|
|
568
|
-
);
|
|
595
|
+
const path = getModuleNameInner(module.text_base).?;
|
|
569
596
|
module.file = MachOFile.load(gpa, io, path, builtin.cpu.arch) catch |err| switch (err) {
|
|
570
597
|
error.InvalidMachO, error.InvalidDwarf => error.InvalidDebugInfo,
|
|
571
598
|
error.MissingDebugInfo, error.OutOfMemory, error.UnsupportedDebugInfo, error.ReadFailed => |e| e,
|
package/std/sort/pdq.zig
CHANGED
|
@@ -47,10 +47,10 @@ pub fn pdqContext(a: usize, b: usize, context: anytype) void {
|
|
|
47
47
|
const max_limit = std.math.floorPowerOfTwo(usize, b - a) + 1;
|
|
48
48
|
|
|
49
49
|
// set upper bound on stack memory usage.
|
|
50
|
-
const Range = struct { a: usize, b: usize, limit: usize };
|
|
50
|
+
const Range = struct { a: usize, b: usize, limit: usize, leftmost: bool };
|
|
51
51
|
const stack_size = math.log2(math.maxInt(usize) + 1);
|
|
52
52
|
var stack: [stack_size]Range = undefined;
|
|
53
|
-
var range = Range{ .a = a, .b = b, .limit = max_limit };
|
|
53
|
+
var range = Range{ .a = a, .b = b, .limit = max_limit, .leftmost = true };
|
|
54
54
|
var top: usize = 0;
|
|
55
55
|
|
|
56
56
|
while (true) {
|
|
@@ -62,7 +62,11 @@ pub fn pdqContext(a: usize, b: usize, context: anytype) void {
|
|
|
62
62
|
|
|
63
63
|
// very short slices get sorted using insertion sort.
|
|
64
64
|
if (len <= max_insertion) {
|
|
65
|
-
|
|
65
|
+
if (range.leftmost) {
|
|
66
|
+
break sort.insertionContext(range.a, range.b, context);
|
|
67
|
+
} else {
|
|
68
|
+
break unguardedInsertionContext(range.a, range.b, context);
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
// if too many bad pivot choices were made, simply fall back to heapsort in order to
|
|
@@ -115,12 +119,13 @@ pub fn pdqContext(a: usize, b: usize, context: anytype) void {
|
|
|
115
119
|
const balanced_threshold = len / 8;
|
|
116
120
|
if (left_len < right_len) {
|
|
117
121
|
was_balanced = left_len >= balanced_threshold;
|
|
118
|
-
stack[top] = .{ .a = range.a, .b = mid, .limit = range.limit };
|
|
122
|
+
stack[top] = .{ .a = range.a, .b = mid, .limit = range.limit, .leftmost = range.leftmost };
|
|
119
123
|
top += 1;
|
|
120
124
|
range.a = mid + 1;
|
|
125
|
+
range.leftmost = false;
|
|
121
126
|
} else {
|
|
122
127
|
was_balanced = right_len >= balanced_threshold;
|
|
123
|
-
stack[top] = .{ .a = mid + 1, .b = range.b, .limit = range.limit };
|
|
128
|
+
stack[top] = .{ .a = mid + 1, .b = range.b, .limit = range.limit, .leftmost = false };
|
|
124
129
|
top += 1;
|
|
125
130
|
range.b = mid;
|
|
126
131
|
}
|
|
@@ -131,6 +136,18 @@ pub fn pdqContext(a: usize, b: usize, context: anytype) void {
|
|
|
131
136
|
}
|
|
132
137
|
}
|
|
133
138
|
|
|
139
|
+
/// Insertion sort that assumes `items[a-1]` exists and is <= all elements in `[a, b)`,
|
|
140
|
+
/// allowing the inner loop to skip the bounds check.
|
|
141
|
+
fn unguardedInsertionContext(a: usize, b: usize, context: anytype) void {
|
|
142
|
+
var i = a + 1;
|
|
143
|
+
while (i < b) : (i += 1) {
|
|
144
|
+
var j = i;
|
|
145
|
+
while (context.lessThan(j, j - 1)) : (j -= 1) {
|
|
146
|
+
context.swap(j, j - 1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
134
151
|
/// partitions `items[a..b]` into elements smaller than `items[pivot]`,
|
|
135
152
|
/// followed by elements greater than or equal to `items[pivot]`.
|
|
136
153
|
///
|
package/std/zon/parse.zig
CHANGED
|
@@ -1094,6 +1094,7 @@ const Parser = struct {
|
|
|
1094
1094
|
name: []const u8,
|
|
1095
1095
|
) error{ OutOfMemory, ParseZon } {
|
|
1096
1096
|
@branchHint(.cold);
|
|
1097
|
+
if (self.diag == null) return error.ParseZon;
|
|
1097
1098
|
const gpa = self.gpa;
|
|
1098
1099
|
const token = if (field) |f| b: {
|
|
1099
1100
|
var buf: [2]Ast.Node.Index = undefined;
|
|
@@ -1150,6 +1151,7 @@ const Parser = struct {
|
|
|
1150
1151
|
field: usize,
|
|
1151
1152
|
) error{ OutOfMemory, ParseZon } {
|
|
1152
1153
|
@branchHint(.cold);
|
|
1154
|
+
if (self.diag == null) return error.ParseZon;
|
|
1153
1155
|
const ast_node = node.getAstNode(self.zoir);
|
|
1154
1156
|
var buf: [2]Ast.Node.Index = undefined;
|
|
1155
1157
|
const token = if (self.ast.fullStructInit(&buf, ast_node)) |struct_init| b: {
|
|
@@ -3540,3 +3542,26 @@ test "std.zon no alloc" {
|
|
|
3540
3542
|
try fromZoirNode(Nested, ast, zoir, .root, null, .{}),
|
|
3541
3543
|
);
|
|
3542
3544
|
}
|
|
3545
|
+
|
|
3546
|
+
test "std.zon errors without diagnostics" {
|
|
3547
|
+
const gpa = std.testing.allocator;
|
|
3548
|
+
|
|
3549
|
+
const Enum = enum {
|
|
3550
|
+
foo,
|
|
3551
|
+
bar,
|
|
3552
|
+
baz,
|
|
3553
|
+
};
|
|
3554
|
+
try std.testing.expectError(error.ParseZon, fromSliceAlloc(Enum, gpa, ".nothing", null, .{}));
|
|
3555
|
+
|
|
3556
|
+
const Struct = struct {
|
|
3557
|
+
name: []const u8,
|
|
3558
|
+
};
|
|
3559
|
+
try std.testing.expectError(error.ParseZon, fromSliceAlloc(Struct, gpa, ".{ .name = \"Alice\", .age = 25 }", null, .{}));
|
|
3560
|
+
|
|
3561
|
+
const Union = union(enum) {
|
|
3562
|
+
x,
|
|
3563
|
+
y: u32,
|
|
3564
|
+
};
|
|
3565
|
+
try std.testing.expectError(error.ParseZon, fromSliceAlloc(Union, gpa, ".a", null, .{}));
|
|
3566
|
+
try std.testing.expectError(error.ParseZon, fromSliceAlloc(Union, gpa, ".{ .b = 8 }", null, .{}));
|
|
3567
|
+
}
|