@zigc/lib 0.17.0-dev.9 → 0.17.0-dev.93

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.
Files changed (107) hide show
  1. package/c/fcntl.zig +6 -1
  2. package/c/inttypes.zig +0 -10
  3. package/c/math.zig +46 -122
  4. package/c/search.zig +1 -27
  5. package/c/stdlib/drand48.zig +0 -57
  6. package/c/stdlib.zig +0 -100
  7. package/c/string.zig +0 -7
  8. package/c/strings.zig +0 -38
  9. package/c/unistd.zig +27 -26
  10. package/c.zig +1 -2
  11. package/compiler/aro/aro/CodeGen.zig +3 -2
  12. package/compiler/aro/aro/Compilation.zig +15 -12
  13. package/compiler/aro/aro/Driver.zig +9 -6
  14. package/compiler/aro/aro/Parser.zig +18 -12
  15. package/compiler/aro/aro/Pragma.zig +3 -2
  16. package/compiler/aro/aro/Preprocessor.zig +9 -6
  17. package/compiler/aro/aro/pragmas/message.zig +3 -2
  18. package/compiler/aro/aro/text_literal.zig +3 -2
  19. package/compiler/aro/assembly_backend/x86_64.zig +3 -2
  20. package/compiler/build_runner.zig +0 -2
  21. package/compiler/test_runner.zig +1 -1
  22. package/compiler/translate-c/Translator.zig +4 -0
  23. package/compiler_rt/cos.zig +0 -2
  24. package/compiler_rt/divmodei4.zig +40 -17
  25. package/compiler_rt/exp.zig +1 -6
  26. package/compiler_rt/exp2.zig +1 -6
  27. package/compiler_rt/exp_f128.zig +377 -0
  28. package/compiler_rt/fabs.zig +0 -2
  29. package/compiler_rt/fma.zig +0 -2
  30. package/compiler_rt/fmax.zig +0 -2
  31. package/compiler_rt/fmin.zig +0 -2
  32. package/compiler_rt/fmod.zig +0 -2
  33. package/compiler_rt/limb64.zig +876 -15
  34. package/compiler_rt/log.zig +0 -2
  35. package/compiler_rt/log10.zig +0 -2
  36. package/compiler_rt/log2.zig +0 -2
  37. package/compiler_rt/mulXi3.zig +1 -1
  38. package/compiler_rt/round.zig +0 -2
  39. package/compiler_rt/sin.zig +0 -2
  40. package/compiler_rt/sincos.zig +0 -2
  41. package/compiler_rt/sqrt.zig +0 -2
  42. package/compiler_rt/ssp.zig +1 -1
  43. package/compiler_rt/tan.zig +0 -2
  44. package/compiler_rt/trunc.zig +0 -2
  45. package/compiler_rt/udivmodei4.zig +28 -0
  46. package/fuzzer.zig +2 -0
  47. package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
  48. package/package.json +1 -1
  49. package/std/Build/Step/Compile.zig +0 -1
  50. package/std/Build.zig +0 -3
  51. package/std/Io/Dispatch.zig +3 -13
  52. package/std/Io/Semaphore.zig +112 -17
  53. package/std/Io/Threaded.zig +167 -33
  54. package/std/Io/Uring.zig +12 -14
  55. package/std/Io/Writer.zig +46 -42
  56. package/std/Io/net.zig +11 -11
  57. package/std/Io.zig +89 -25
  58. package/std/Target.zig +50 -5
  59. package/std/builtin.zig +4 -0
  60. package/std/c/haiku.zig +3 -0
  61. package/std/c/serenity.zig +1 -6
  62. package/std/c.zig +59 -6
  63. package/std/debug.zig +4 -3
  64. package/std/fmt.zig +7 -2
  65. package/std/fs/path.zig +6 -4
  66. package/std/heap/BufferFirstAllocator.zig +165 -0
  67. package/std/heap.zig +2 -126
  68. package/std/http/Client.zig +21 -24
  69. package/std/os/linux/aarch64.zig +41 -12
  70. package/std/os/linux/arc.zig +41 -12
  71. package/std/os/linux/arm.zig +41 -12
  72. package/std/os/linux/hexagon.zig +33 -11
  73. package/std/os/linux/loongarch32.zig +41 -13
  74. package/std/os/linux/loongarch64.zig +41 -12
  75. package/std/os/linux/m68k.zig +41 -13
  76. package/std/os/linux/mips.zig +67 -36
  77. package/std/os/linux/mips64.zig +60 -29
  78. package/std/os/linux/mipsn32.zig +60 -29
  79. package/std/os/linux/or1k.zig +41 -12
  80. package/std/os/linux/powerpc.zig +41 -12
  81. package/std/os/linux/powerpc64.zig +41 -12
  82. package/std/os/linux/riscv32.zig +41 -12
  83. package/std/os/linux/riscv64.zig +41 -12
  84. package/std/os/linux/s390x.zig +44 -7
  85. package/std/os/linux/sparc64.zig +83 -52
  86. package/std/os/linux/thumb.zig +52 -36
  87. package/std/os/linux/x32.zig +41 -12
  88. package/std/os/linux/x86.zig +42 -13
  89. package/std/os/linux/x86_64.zig +41 -12
  90. package/std/os/linux.zig +398 -434
  91. package/std/os.zig +41 -0
  92. package/std/sort.zig +3 -3
  93. package/std/zig/AstGen.zig +22 -92
  94. package/std/zig/AstRlAnnotate.zig +0 -11
  95. package/std/zig/BuiltinFn.zig +0 -32
  96. package/std/zig/LibCInstallation.zig +1 -0
  97. package/std/zig/Zir.zig +50 -63
  98. package/std/zig/ZonGen.zig +5 -4
  99. package/std/zig/llvm/Builder.zig +12 -12
  100. package/std/zig.zig +0 -10
  101. package/zig.h +340 -1
  102. package/libc/mingw/math/fdiml.c +0 -24
  103. package/libc/musl/src/linux/tee.c +0 -8
  104. package/libc/musl/src/math/fdimf.c +0 -10
  105. package/libc/musl/src/math/fdiml.c +0 -18
  106. package/libc/musl/src/unistd/dup2.c +0 -20
  107. package/libc/musl/src/unistd/dup3.c +0 -26
package/std/Io.zig CHANGED
@@ -243,8 +243,6 @@ pub const VTable = struct {
243
243
  netConnectUnix: *const fn (?*anyopaque, *const net.UnixAddress) net.UnixAddress.ConnectError!net.Socket.Handle,
244
244
  netSocketCreatePair: *const fn (?*anyopaque, net.Socket.CreatePairOptions) net.Socket.CreatePairError![2]net.Socket,
245
245
  netSend: *const fn (?*anyopaque, net.Socket.Handle, []net.OutgoingMessage, net.SendFlags) struct { ?net.Socket.SendError, usize },
246
- /// Returns 0 on end of stream.
247
- netRead: *const fn (?*anyopaque, src: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usize,
248
246
  netWrite: *const fn (?*anyopaque, dest: net.Socket.Handle, header: []const u8, data: []const []const u8, splat: usize) net.Stream.Writer.Error!usize,
249
247
  netWriteFile: *const fn (?*anyopaque, net.Socket.Handle, header: []const u8, *Io.File.Reader, Io.Limit) net.Stream.Writer.WriteFileError!usize,
250
248
  netClose: *const fn (?*anyopaque, handle: []const net.Socket.Handle) void,
@@ -261,6 +259,7 @@ pub const Operation = union(enum) {
261
259
  /// other systems this tag is unreachable.
262
260
  device_io_control: DeviceIoControl,
263
261
  net_receive: NetReceive,
262
+ net_read: NetRead,
264
263
 
265
264
  pub const Tag = @typeInfo(Operation).@"union".tag_type.?;
266
265
 
@@ -386,6 +385,23 @@ pub const Operation = union(enum) {
386
385
  pub const Result = struct { ?net.Socket.ReceiveError, usize };
387
386
  };
388
387
 
388
+ pub const NetRead = struct {
389
+ socket_handle: net.Socket.Handle,
390
+ data: [][]u8,
391
+
392
+ pub const Error = error{
393
+ SystemResources,
394
+ ConnectionResetByPeer,
395
+ SocketUnconnected,
396
+ /// The file descriptor does not hold the required rights to read
397
+ /// from it.
398
+ AccessDenied,
399
+ NetworkDown,
400
+ } || Io.UnexpectedError;
401
+
402
+ pub const Result = Error!usize;
403
+ };
404
+
389
405
  pub const Result = Result: {
390
406
  const operation_fields = @typeInfo(Operation).@"union".fields;
391
407
  var field_names: [operation_fields.len][]const u8 = undefined;
@@ -1665,20 +1681,29 @@ pub const Condition = struct {
1665
1681
  .epoch = .init(0),
1666
1682
  };
1667
1683
 
1684
+ /// Blocks until the condition is signaled or canceled.
1685
+ ///
1686
+ /// See also:
1687
+ /// * `waitUncancelable`
1688
+ /// * `waitTimeout`
1668
1689
  pub fn wait(cond: *Condition, io: Io, mutex: *Mutex) Cancelable!void {
1669
- try waitInner(cond, io, mutex, false);
1690
+ waitTimeout(cond, io, mutex, .none) catch |err| switch (err) {
1691
+ error.Timeout => unreachable,
1692
+ error.Canceled => |e| return e,
1693
+ };
1670
1694
  }
1671
1695
 
1672
- /// Same as `wait`, except does not introduce a cancelation point.
1696
+ pub const WaitTimeoutError = Cancelable || Timeout.Error;
1697
+
1698
+ /// Blocks until the condition is signaled, canceled, or the provided
1699
+ /// timeout expires.
1673
1700
  ///
1674
- /// For a description of cancelation and cancelation points, see `Future.cancel`.
1675
- pub fn waitUncancelable(cond: *Condition, io: Io, mutex: *Mutex) void {
1676
- waitInner(cond, io, mutex, true) catch |err| switch (err) {
1677
- error.Canceled => unreachable,
1678
- };
1679
- }
1701
+ /// See also:
1702
+ /// * `wait`
1703
+ /// * `waitUncancelable`
1704
+ pub fn waitTimeout(cond: *Condition, io: Io, mutex: *Mutex, timeout: Timeout) WaitTimeoutError!void {
1705
+ const deadline = timeout.toDeadline(io);
1680
1706
 
1681
- fn waitInner(cond: *Condition, io: Io, mutex: *Mutex, uncancelable: bool) Cancelable!void {
1682
1707
  var epoch = cond.epoch.load(.acquire); // `.acquire` to ensure ordered before state load
1683
1708
 
1684
1709
  {
@@ -1690,10 +1715,7 @@ pub const Condition = struct {
1690
1715
  defer mutex.lockUncancelable(io);
1691
1716
 
1692
1717
  while (true) {
1693
- const result = if (uncancelable)
1694
- io.futexWaitUncancelable(u32, &cond.epoch.raw, epoch)
1695
- else
1696
- io.futexWait(u32, &cond.epoch.raw, epoch);
1718
+ const result = io.futexWaitTimeout(u32, &cond.epoch.raw, epoch, deadline);
1697
1719
 
1698
1720
  epoch = cond.epoch.load(.acquire); // `.acquire` to ensure ordered before `state` laod
1699
1721
 
@@ -1713,13 +1735,62 @@ pub const Condition = struct {
1713
1735
  }
1714
1736
 
1715
1737
  // There are no more signals available; this was a spurious wakeup or an error. If it
1716
- // was an error, we will remove ourselves as a waiter and return that error. Otherwise,
1717
- // we'll loop back to the futex wait.
1738
+ // was an error, we will remove ourselves as a waiter and return that error. If a
1739
+ // timeout was specified and the deadline has passed, we remove ourselves as a waiter
1740
+ // and return `error.Timeout`. Otherwise, we'll loop back to the futex wait.
1718
1741
  result catch |err| {
1719
1742
  const prev_state = cond.state.fetchSub(.{ .waiters = 1, .signals = 0 }, .monotonic);
1720
1743
  assert(prev_state.waiters > 0); // underflow caused by illegal state
1721
1744
  return err;
1722
1745
  };
1746
+ switch (deadline) {
1747
+ .none => {},
1748
+ .deadline => |d| if (d.untilNow(io).raw.nanoseconds >= 0) {
1749
+ const prev_state = cond.state.fetchSub(.{ .waiters = 1, .signals = 0 }, .monotonic);
1750
+ assert(prev_state.waiters > 0); // underflow caused by illegal state
1751
+ return error.Timeout;
1752
+ },
1753
+ .duration => unreachable,
1754
+ }
1755
+ }
1756
+ }
1757
+
1758
+ /// Same as `wait`, except does not introduce a cancelation point.
1759
+ ///
1760
+ /// See `Future.cancel` for a description of cancelation points.
1761
+ pub fn waitUncancelable(cond: *Condition, io: Io, mutex: *Mutex) void {
1762
+ var epoch = cond.epoch.load(.acquire); // `.acquire` to ensure ordered before state load
1763
+
1764
+ {
1765
+ const prev_state = cond.state.fetchAdd(.{ .waiters = 1, .signals = 0 }, .monotonic);
1766
+ assert(prev_state.waiters < math.maxInt(u16)); // overflow caused by too many waiters
1767
+ }
1768
+
1769
+ mutex.unlock(io);
1770
+ defer mutex.lockUncancelable(io);
1771
+
1772
+ while (true) {
1773
+ io.futexWaitUncancelable(u32, &cond.epoch.raw, epoch);
1774
+
1775
+ epoch = cond.epoch.load(.acquire); // `.acquire` to ensure ordered before `state` laod
1776
+
1777
+ // Even on error, try to consume a pending signal first. Otherwise a race might
1778
+ // cause a signal to get stuck in the state with no corresponding waiter.
1779
+ {
1780
+ var prev_state = cond.state.load(.monotonic);
1781
+ while (prev_state.signals > 0) {
1782
+ prev_state = cond.state.cmpxchgWeak(prev_state, .{
1783
+ .waiters = prev_state.waiters - 1,
1784
+ .signals = prev_state.signals - 1,
1785
+ }, .acquire, .monotonic) orelse {
1786
+ // We successfully consumed a signal.
1787
+ return;
1788
+ };
1789
+ }
1790
+ }
1791
+
1792
+ // There are no more signals available; this was a spurious wakeup,
1793
+ // so we'll loop back to the futex wait.
1723
1794
  }
1724
1795
  }
1725
1796
 
@@ -2626,7 +2697,6 @@ pub const failing: std.Io = .{
2626
2697
  .netConnectUnix = failingNetConnectUnix,
2627
2698
  .netSocketCreatePair = failingNetSocketCreatePair,
2628
2699
  .netSend = failingNetSend,
2629
- .netRead = failingNetRead,
2630
2700
  .netWrite = failingNetWrite,
2631
2701
  .netWriteFile = failingNetWriteFile,
2632
2702
  .netClose = unreachableNetClose,
@@ -2774,6 +2844,7 @@ pub fn failingOperate(userdata: ?*anyopaque, operation: Operation) Cancelable!Op
2774
2844
  .file_write_streaming => .{ .file_write_streaming = error.InputOutput },
2775
2845
  .device_io_control => unreachable,
2776
2846
  .net_receive => .{ .net_receive = .{ error.NetworkDown, 0 } },
2847
+ .net_read => .{ .net_read = error.NetworkDown },
2777
2848
  };
2778
2849
  }
2779
2850
 
@@ -3377,13 +3448,6 @@ pub fn failingNetSend(userdata: ?*anyopaque, handle: net.Socket.Handle, messages
3377
3448
  return .{ error.NetworkDown, 0 };
3378
3449
  }
3379
3450
 
3380
- pub fn failingNetRead(userdata: ?*anyopaque, src: net.Socket.Handle, data: [][]u8) net.Stream.Reader.Error!usize {
3381
- _ = userdata;
3382
- _ = src;
3383
- _ = data;
3384
- return error.NetworkDown;
3385
- }
3386
-
3387
3451
  pub fn failingNetWrite(userdata: ?*anyopaque, dest: net.Socket.Handle, header: []const u8, data: []const []const u8, splat: usize) net.Stream.Writer.Error!usize {
3388
3452
  _ = userdata;
3389
3453
  _ = dest;
package/std/Target.zig CHANGED
@@ -68,6 +68,8 @@ pub const Os = struct {
68
68
  opengl,
69
69
  vulkan,
70
70
 
71
+ tios,
72
+
71
73
  // LLVM tags deliberately omitted:
72
74
  // - bridgeos
73
75
  // - cheriotrtos
@@ -207,6 +209,8 @@ pub const Os = struct {
207
209
  .opencl,
208
210
  .opengl,
209
211
  .vulkan,
212
+
213
+ .tios,
210
214
  => .semver,
211
215
 
212
216
  .hurd => .hurd,
@@ -670,6 +674,12 @@ pub const Os = struct {
670
674
  .max = .{ .major = 4, .minor = 6, .patch = 0 },
671
675
  },
672
676
  },
677
+ .tios => .{
678
+ .semver = .{
679
+ .min = .{ .major = 5, .minor = 0, .patch = 0 },
680
+ .max = .{ .major = 5, .minor = 8, .patch = 4 },
681
+ },
682
+ },
673
683
  .vulkan => .{
674
684
  .semver = .{
675
685
  .min = .{ .major = 1, .minor = 2, .patch = 0 },
@@ -758,6 +768,7 @@ pub const wasm = @import("Target/wasm.zig");
758
768
  pub const x86 = @import("Target/x86.zig");
759
769
  pub const xcore = @import("Target/xcore.zig");
760
770
  pub const xtensa = @import("Target/xtensa.zig");
771
+ pub const z80 = @import("Target/generic.zig");
761
772
 
762
773
  pub const Abi = enum {
763
774
  none,
@@ -942,6 +953,7 @@ pub const Abi = enum {
942
953
  .opencl,
943
954
  .opengl,
944
955
  .vulkan,
956
+ .tios,
945
957
  => .none,
946
958
  };
947
959
  }
@@ -1068,6 +1080,7 @@ pub fn toElfMachine(target: *const Target) std.elf.EM {
1068
1080
  .avr => .AVR,
1069
1081
  .bpfeb, .bpfel => .BPF,
1070
1082
  .csky => .CSKY,
1083
+ .ez80 => .Z80,
1071
1084
  .hexagon => .QDSP6,
1072
1085
  .hppa, .hppa64 => .PARISC,
1073
1086
  .kalimba => .CSR_KALIMBA,
@@ -1130,6 +1143,7 @@ pub fn toCoffMachine(target: *const Target) std.coff.IMAGE.FILE.MACHINE {
1130
1143
  .bpfeb,
1131
1144
  .bpfel,
1132
1145
  .csky,
1146
+ .ez80,
1133
1147
  .hexagon,
1134
1148
  .hppa,
1135
1149
  .hppa64,
@@ -1336,6 +1350,7 @@ pub const Cpu = struct {
1336
1350
  bpfeb,
1337
1351
  bpfel,
1338
1352
  csky,
1353
+ ez80,
1339
1354
  hexagon,
1340
1355
  hppa,
1341
1356
  hppa64,
@@ -1437,6 +1452,7 @@ pub const Cpu = struct {
1437
1452
  x86,
1438
1453
  xcore,
1439
1454
  xtensa,
1455
+ z80,
1440
1456
  };
1441
1457
 
1442
1458
  pub inline fn family(arch: Arch) Family {
@@ -1449,6 +1465,7 @@ pub const Cpu = struct {
1449
1465
  .avr => .avr,
1450
1466
  .bpfeb, .bpfel => .bpf,
1451
1467
  .csky => .csky,
1468
+ .ez80 => .z80,
1452
1469
  .hexagon => .hexagon,
1453
1470
  .hppa, .hppa64 => .hppa,
1454
1471
  .kalimba => .kalimba,
@@ -1678,6 +1695,7 @@ pub const Cpu = struct {
1678
1695
  .x86_64,
1679
1696
  .xcore,
1680
1697
  .xtensa,
1698
+ .ez80,
1681
1699
  => .little,
1682
1700
 
1683
1701
  .aarch64_be,
@@ -1948,6 +1966,10 @@ pub const Cpu = struct {
1948
1966
  .spirv_fragment,
1949
1967
  .spirv_vertex,
1950
1968
  => &.{ .spirv32, .spirv64 },
1969
+
1970
+ .ez80_cet,
1971
+ .ez80_tiflags,
1972
+ => &.{.ez80},
1951
1973
  };
1952
1974
  }
1953
1975
  };
@@ -2236,6 +2258,7 @@ pub fn requiresLibC(target: *const Target) bool {
2236
2258
  .plan9,
2237
2259
  .other,
2238
2260
  .@"3ds",
2261
+ .tios,
2239
2262
  => false,
2240
2263
  };
2241
2264
  }
@@ -2398,6 +2421,8 @@ pub const DynamicLinker = struct {
2398
2421
  .ps5,
2399
2422
  .psp,
2400
2423
  .vita,
2424
+
2425
+ .tios,
2401
2426
  => .none,
2402
2427
  };
2403
2428
  }
@@ -2815,6 +2840,8 @@ pub const DynamicLinker = struct {
2815
2840
  .opencl,
2816
2841
  .opengl,
2817
2842
  .vulkan,
2843
+
2844
+ .tios,
2818
2845
  => none,
2819
2846
 
2820
2847
  // TODO go over each item in this list and either move it to the above list, or
@@ -2849,6 +2876,9 @@ pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 {
2849
2876
  .x86_16,
2850
2877
  => 16,
2851
2878
 
2879
+ .ez80,
2880
+ => 24,
2881
+
2852
2882
  .arc,
2853
2883
  .arceb,
2854
2884
  .arm,
@@ -2917,6 +2947,8 @@ pub fn ptrBitWidth(target: *const Target) u16 {
2917
2947
  pub fn stackAlignment(target: *const Target) u16 {
2918
2948
  // Overrides for when the stack alignment is not equal to the pointer width.
2919
2949
  switch (target.cpu.arch) {
2950
+ .ez80,
2951
+ => return 1,
2920
2952
  .m68k,
2921
2953
  => return 2,
2922
2954
  .amdgcn,
@@ -2997,6 +3029,7 @@ pub fn cCharSignedness(target: *const Target) std.builtin.Signedness {
2997
3029
  .arc,
2998
3030
  .arceb,
2999
3031
  .csky,
3032
+ .ez80,
3000
3033
  .hexagon,
3001
3034
  .msp430,
3002
3035
  .powerpc,
@@ -3049,8 +3082,6 @@ pub fn cTypeByteSize(t: *const Target, c_type: CType) u16 {
3049
3082
  => @divExact(cTypeBitSize(t, c_type), 8),
3050
3083
 
3051
3084
  .longdouble => switch (cTypeBitSize(t, c_type)) {
3052
- 16 => 2,
3053
- 32 => 4,
3054
3085
  64 => 8,
3055
3086
  80 => @intCast(std.mem.alignForward(usize, 10, cTypeAlignment(t, .longdouble))),
3056
3087
  128 => 16,
@@ -3364,6 +3395,13 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
3364
3395
  .long, .ulong => return 64,
3365
3396
  .longlong, .ulonglong, .double, .longdouble => return 64,
3366
3397
  },
3398
+ .tios => switch (c_type) {
3399
+ .char => return 8,
3400
+ .short, .ushort => return 16,
3401
+ .int, .uint => return 24,
3402
+ .long, .ulong, .float, .double => return 32,
3403
+ .longlong, .ulonglong, .longdouble => return 64,
3404
+ },
3367
3405
 
3368
3406
  .ps3,
3369
3407
  .contiki,
@@ -3376,7 +3414,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 {
3376
3414
  pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
3377
3415
  // Overrides for unusual alignments
3378
3416
  switch (target.cpu.arch) {
3379
- .avr => return 1,
3417
+ .avr, .ez80 => return 1,
3380
3418
  .x86 => switch (target.os.tag) {
3381
3419
  .windows, .uefi => switch (c_type) {
3382
3420
  .longlong, .ulonglong, .double => return 8,
@@ -3406,6 +3444,8 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
3406
3444
  return @min(
3407
3445
  std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8),
3408
3446
  @as(u16, switch (target.cpu.arch) {
3447
+ .ez80 => 1,
3448
+
3409
3449
  .msp430,
3410
3450
  .x86_16,
3411
3451
  => 2,
@@ -3484,7 +3524,7 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
3484
3524
  .longdouble => return 4,
3485
3525
  else => {},
3486
3526
  },
3487
- .avr => return 1,
3527
+ .avr, .ez80 => return 1,
3488
3528
  .x86 => switch (target.os.tag) {
3489
3529
  .windows, .uefi => switch (c_type) {
3490
3530
  .longdouble => switch (target.abi) {
@@ -3516,6 +3556,8 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
3516
3556
  return @min(
3517
3557
  std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8),
3518
3558
  @as(u16, switch (target.cpu.arch) {
3559
+ .ez80 => 1,
3560
+
3519
3561
  .x86_16, .msp430 => 2,
3520
3562
 
3521
3563
  .arc,
@@ -3587,7 +3629,9 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
3587
3629
 
3588
3630
  pub fn cMaxIntAlignment(target: *const Target) u16 {
3589
3631
  return switch (target.cpu.arch) {
3590
- .avr => 1,
3632
+ .avr,
3633
+ .ez80,
3634
+ => 1,
3591
3635
 
3592
3636
  .msp430, .x86_16 => 2,
3593
3637
 
@@ -3726,6 +3770,7 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
3726
3770
  .amdgcn => .{ .amdgcn_device = .{} },
3727
3771
  .nvptx, .nvptx64 => .nvptx_device,
3728
3772
  .spirv32, .spirv64 => .spirv_device,
3773
+ .ez80 => .ez80_cet,
3729
3774
  };
3730
3775
  }
3731
3776
 
package/std/builtin.zig CHANGED
@@ -341,6 +341,10 @@ pub const CallingConvention = union(enum(u8)) {
341
341
  spirv_fragment,
342
342
  spirv_vertex,
343
343
 
344
+ // Calling conventions for the `ez80` architecture.
345
+ ez80_cet,
346
+ ez80_tiflags,
347
+
344
348
  /// Options shared across most calling conventions.
345
349
  pub const CommonOptions = struct {
346
350
  /// The boundary the stack is aligned to when the function is called.
package/std/c/haiku.zig CHANGED
@@ -6,6 +6,7 @@ const iovec = std.posix.iovec;
6
6
  const iovec_const = std.posix.iovec_const;
7
7
  const socklen_t = std.c.socklen_t;
8
8
  const fd_t = std.c.fd_t;
9
+ const off_t = std.c.off_t;
9
10
  const PATH_MAX = std.c.PATH_MAX;
10
11
  const uid_t = std.c.uid_t;
11
12
  const gid_t = std.c.gid_t;
@@ -28,6 +29,8 @@ pub extern "root" fn _kern_open_dir(fd: fd_t, path: [*:0]const u8) fd_t;
28
29
  pub extern "root" fn _kern_read_dir(fd: fd_t, buffer: [*]u8, bufferSize: usize, maxCount: u32) isize;
29
30
  pub extern "root" fn _kern_rewind_dir(fd: fd_t) status_t;
30
31
  pub extern "root" fn _kern_read_stat(fd: fd_t, path: [*:0]const u8, traverseLink: bool, stat: *std.c.Stat, statSize: usize) status_t;
32
+ pub extern "root" fn readv_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec, count: i32) isize;
33
+ pub extern "root" fn writev_pos(fd: fd_t, pos: off_t, vec: [*]const std.c.iovec_const, count: i32) isize;
31
34
 
32
35
  pub const area_info = extern struct {
33
36
  area: u32,
@@ -53,9 +53,7 @@ pub extern "c" fn profiling_enable(pid: pid_t, event_mask: PERF_EVENT) c_int;
53
53
  pub extern "c" fn profiling_disable(pid: pid_t) c_int;
54
54
  pub extern "c" fn profiling_free_buffer(pid: pid_t) c_int;
55
55
 
56
- pub extern "c" fn futex(userspace_address: *u32, futex_op: c_int, value: u32, timeout: *const timespec, userspace_address2: *u32, value3: u32) c_int;
57
- pub extern "c" fn futex_wait(userspace_address: *u32, value: u32, abstime: *const timespec, clockid: clockid_t, process_shared: c_int) c_int;
58
- pub extern "c" fn futex_wake(userspace_address: *u32, count: u32, process_shared: c_int) c_int;
56
+ pub extern "c" fn futex(userspace_address: *u32, futex_op: c_int, value: u32, timeout: ?*const timespec, userspace_address2: ?*u32, value3: u32) c_int;
59
57
 
60
58
  pub extern "c" fn purge(mode: c_int) c_int;
61
59
 
@@ -66,9 +64,6 @@ pub extern "c" fn get_stack_bounds(user_stack_base: *usize, user_stack_size: *us
66
64
 
67
65
  pub extern "c" fn anon_create(size: usize, options: O) c_int;
68
66
 
69
- pub extern "c" fn serenity_readlink(path: [*]const u8, path_length: usize, buffer: [*]u8, buffer_size: usize) c_int;
70
- pub extern "c" fn serenity_open(path: [*]const u8, path_length: usize, options: c_int, ...) c_int;
71
-
72
67
  pub extern "c" fn getkeymap(name_buffer: [*]u8, name_buffer_size: usize, map: [*]u32, shift_map: [*]u32, alt_map: [*]u32, altgr_map: [*]u32, shift_altgr_map: [*]u32) c_int;
73
68
  pub extern "c" fn setkeymap(name: [*]const u8, map: [*]const u32, shift_map: [*]const u32, alt_map: [*]const u32, altgr_map: [*]const u32, shift_altgr_map: [*]const u32) c_int;
74
69
 
package/std/c.zig CHANGED
@@ -3260,8 +3260,8 @@ pub const Sigaction = switch (native_os) {
3260
3260
 
3261
3261
  /// signal handler
3262
3262
  handler: extern union {
3263
- handler: handler_fn,
3264
- sigaction: sigaction_fn,
3263
+ handler: ?handler_fn,
3264
+ sigaction: ?sigaction_fn,
3265
3265
  },
3266
3266
 
3267
3267
  /// signal mask to apply
@@ -11102,6 +11102,61 @@ pub const ioctl = switch (native_os) {
11102
11102
  else => private.ioctl,
11103
11103
  };
11104
11104
 
11105
+ pub extern "c" fn bzero(s: *anyopaque, n: usize) void;
11106
+
11107
+ pub extern "c" fn swab(noalias from: *const anyopaque, noalias to: *anyopaque, n: isize) void;
11108
+
11109
+ pub extern "c" fn strncmp(a: [*:0]const c_char, b: [*:0]const c_char, max: usize) c_int;
11110
+ pub extern "c" fn strcasecmp(a: [*:0]const c_char, b: [*:0]const c_char) c_int;
11111
+ pub extern "c" fn strncasecmp(a: [*:0]const c_char, b: [*:0]const c_char, max: usize) c_int;
11112
+
11113
+ pub extern "c" fn ffs(i: c_int) c_int;
11114
+ pub extern "c" fn ffsl(i: c_long) c_long;
11115
+ pub extern "c" fn ffsll(i: c_longlong) c_longlong;
11116
+
11117
+ pub extern "c" fn erand48(xsubi: *[3]c_ushort) f64;
11118
+ pub extern "c" fn jrand48(xsubi: *[3]c_ushort) c_long;
11119
+ pub extern "c" fn nrand48(xsubi: *[3]c_ushort) c_long;
11120
+
11121
+ pub extern "c" fn insque(element: *anyopaque, pred: ?*anyopaque) void;
11122
+ pub extern "c" fn remque(element: *anyopaque) void;
11123
+
11124
+ pub extern "c" fn imaxabs(a: intmax_t) intmax_t;
11125
+ pub extern "c" fn imaxdiv(a: intmax_t, b: intmax_t) imaxdiv_t;
11126
+
11127
+ pub extern "c" fn abs(a: c_int) c_int;
11128
+ pub extern "c" fn labs(a: c_long) c_long;
11129
+ pub extern "c" fn llabs(a: c_longlong) c_longlong;
11130
+
11131
+ pub extern "c" fn div(a: c_int, b: c_int) div_t;
11132
+ pub extern "c" fn ldiv(a: c_long, b: c_long) ldiv_t;
11133
+ pub extern "c" fn lldiv(a: c_longlong, b: c_longlong) lldiv_t;
11134
+
11135
+ pub extern "c" fn atoi(str: [*:0]const c_char) c_int;
11136
+ pub extern "c" fn atol(str: [*:0]const c_char) c_long;
11137
+ pub extern "c" fn atoll(str: [*:0]const c_char) c_longlong;
11138
+
11139
+ pub extern "c" fn bsearch(
11140
+ key: *const anyopaque,
11141
+ base: *const anyopaque,
11142
+ n: usize,
11143
+ size: usize,
11144
+ compare: *const fn (a: *const anyopaque, b: *const anyopaque) callconv(.c) c_int,
11145
+ ) ?*anyopaque;
11146
+
11147
+ // Math
11148
+ pub extern "c" fn atan(x: f64) f64;
11149
+ pub extern "c" fn copysign(x: f64, y: f64) f64;
11150
+ pub extern "c" fn fdim(x: f64, y: f64) f64;
11151
+ pub extern "c" fn frexp(x: f64, e: *c_int) f64;
11152
+ pub extern "c" fn hypot(x: f64, y: f64) f64;
11153
+ pub extern "c" fn modff(x: f32, iptr: *f32) f32;
11154
+ pub extern "c" fn modf(x: f64, iptr: *f64) f64;
11155
+ pub extern "c" fn modfl(x: c_longdouble, iptr: *c_longdouble) c_longdouble;
11156
+ pub extern "c" fn rintf(x: f32) f32;
11157
+ pub extern "c" fn rint(x: f64) f64;
11158
+ pub extern "c" fn rintl(x: c_longdouble) c_longdouble;
11159
+
11105
11160
  // OS-specific bits. These are protected from being used on the wrong OS by
11106
11161
  // comptime assertions inside each OS-specific file.
11107
11162
 
@@ -11142,6 +11197,8 @@ pub const _kern_open_dir = haiku._kern_open_dir;
11142
11197
  pub const _kern_read_dir = haiku._kern_read_dir;
11143
11198
  pub const _kern_read_stat = haiku._kern_read_stat;
11144
11199
  pub const _kern_rewind_dir = haiku._kern_rewind_dir;
11200
+ pub const readv_pos = haiku.readv_pos;
11201
+ pub const writev_pos = haiku.writev_pos;
11145
11202
  pub const area_id = haiku.area_id;
11146
11203
  pub const area_info = haiku.area_info;
11147
11204
  pub const directory_which = haiku.directory_which;
@@ -11449,15 +11506,11 @@ pub const disown = serenity.disown;
11449
11506
  pub const profiling_enable = serenity.profiling_enable;
11450
11507
  pub const profiling_disable = serenity.profiling_disable;
11451
11508
  pub const profiling_free_buffer = serenity.profiling_free_buffer;
11452
- pub const futex_wait = serenity.futex_wait;
11453
- pub const futex_wake = serenity.futex_wake;
11454
11509
  pub const purge = serenity.purge;
11455
11510
  pub const perf_event = serenity.perf_event;
11456
11511
  pub const perf_register_string = serenity.perf_register_string;
11457
11512
  pub const get_stack_bounds = serenity.get_stack_bounds;
11458
11513
  pub const anon_create = serenity.anon_create;
11459
- pub const serenity_readlink = serenity.serenity_readlink;
11460
- pub const serenity_open = serenity.serenity_open;
11461
11514
  pub const getkeymap = serenity.getkeymap;
11462
11515
  pub const setkeymap = serenity.setkeymap;
11463
11516
 
package/std/debug.zig CHANGED
@@ -1197,8 +1197,9 @@ fn printSourceAtAddress(
1197
1197
 
1198
1198
  // Initialize the symbol array with space for at least one element, allocating this on the stack
1199
1199
  // in the common case where only one element is needed
1200
- var symbol_fallback_allocator = std.heap.stackFallback(@sizeOf(Symbol) + @alignOf(Symbol) - 1, getDebugInfoAllocator());
1201
- const symbol_allocator = symbol_fallback_allocator.get();
1200
+ var buf: [1]Symbol = undefined;
1201
+ var bfa: std.heap.BufferFirstAllocator = .init(@ptrCast(&buf), getDebugInfoAllocator());
1202
+ const symbol_allocator = bfa.allocator();
1202
1203
  var symbols = std.ArrayList(Symbol).initCapacity(symbol_allocator, 1) catch unreachable;
1203
1204
  defer symbols.deinit(symbol_allocator);
1204
1205
 
@@ -1576,12 +1577,12 @@ fn handleSegfaultPosix(sig: posix.SIG, info: *const posix.siginfo_t, ctx_ptr: ?*
1576
1577
  .tvos,
1577
1578
  .visionos,
1578
1579
  .watchos,
1580
+ .haiku,
1579
1581
  => @intFromPtr(info.addr),
1580
1582
  .linux,
1581
1583
  => @intFromPtr(info.fields.sigfault.addr),
1582
1584
  .netbsd,
1583
1585
  => @intFromPtr(info.info.reason.fault.addr),
1584
- .haiku,
1585
1586
  .openbsd,
1586
1587
  => @intFromPtr(info.data.fault.addr),
1587
1588
  .illumos,
package/std/fmt.zig CHANGED
@@ -1342,9 +1342,9 @@ pub const hex_charset = "0123456789abcdef";
1342
1342
 
1343
1343
  /// Converts an unsigned integer of any multiple of u8 to an array of lowercase
1344
1344
  /// hex bytes, little endian.
1345
- pub fn hex(x: anytype) [@sizeOf(@TypeOf(x)) * 2]u8 {
1345
+ pub fn hex(x: anytype) [@typeInfo(@TypeOf(x)).int.bits / 4]u8 {
1346
1346
  comptime assert(@typeInfo(@TypeOf(x)).int.signedness == .unsigned);
1347
- var result: [@sizeOf(@TypeOf(x)) * 2]u8 = undefined;
1347
+ var result: [@typeInfo(@TypeOf(x)).int.bits / 4]u8 = undefined;
1348
1348
  var i: usize = 0;
1349
1349
  while (i < result.len / 2) : (i += 1) {
1350
1350
  const byte: u8 = @truncate(x >> @intCast(8 * i));
@@ -1360,6 +1360,11 @@ test hex {
1360
1360
  try std.testing.expect(x.len == 8);
1361
1361
  try std.testing.expectEqualStrings("efbeadde", &x);
1362
1362
  }
1363
+ {
1364
+ const s = "[" ++ hex(@as(u48, 0x12345678_abcd)) ++ "]";
1365
+ try std.testing.expect(s.len == 14);
1366
+ try std.testing.expectEqualStrings("[cdab78563412]", s);
1367
+ }
1363
1368
  {
1364
1369
  const s = "[" ++ hex(@as(u64, 0x12345678_abcdef00)) ++ "]";
1365
1370
  try std.testing.expect(s.len == 18);
package/std/fs/path.zig CHANGED
@@ -894,8 +894,9 @@ pub fn resolve(allocator: Allocator, paths: []const []const u8) Allocator.Error!
894
894
  pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) Allocator.Error![]u8 {
895
895
  // Avoid heap allocation when paths.len is <= @bitSizeOf(usize) * 2
896
896
  // (we use `* 3` because stackFallback uses 1 usize as a length)
897
- var bit_set_allocator_state = std.heap.stackFallback(@sizeOf(usize) * 3, allocator);
898
- const bit_set_allocator = bit_set_allocator_state.get();
897
+ var buf: [3]usize = undefined;
898
+ var bit_set_allocator_state: std.heap.BufferFirstAllocator = .init(@ptrCast(&buf), allocator);
899
+ const bit_set_allocator = bit_set_allocator_state.allocator();
899
900
  var relevant_paths = try std.bit_set.DynamicBitSetUnmanaged.initEmpty(bit_set_allocator, paths.len);
900
901
  defer relevant_paths.deinit(bit_set_allocator);
901
902
 
@@ -1642,7 +1643,8 @@ fn windowsResolveAgainstCwd(
1642
1643
  parsed: WindowsPath2(u8),
1643
1644
  ) ![]u8 {
1644
1645
  // Space for 256 WTF-16 code units; potentially 3 WTF-8 bytes per WTF-16 code unit
1645
- var temp_allocator_state = std.heap.stackFallback(256 * 3, gpa);
1646
+ var buf: [256 * 3]u8 = undefined;
1647
+ var temp_allocator_state: std.heap.BufferFirstAllocator = .init(&buf, gpa);
1646
1648
  return switch (parsed.kind) {
1647
1649
  .drive_absolute,
1648
1650
  .unc_absolute,
@@ -1668,7 +1670,7 @@ fn windowsResolveAgainstCwd(
1668
1670
  }
1669
1671
  },
1670
1672
  .drive_relative => blk: {
1671
- const temp_allocator = temp_allocator_state.get();
1673
+ const temp_allocator = temp_allocator_state.allocator();
1672
1674
  const drive_cwd = drive_cwd: {
1673
1675
  const parsed_cwd = parsePathWindows(u8, cwd);
1674
1676