authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 10:54:35-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 10:54:35-07:00
log1b9ffa0824198fc72b085ad99e9f27ad6f533f3a
tree03382a1f770b1a5d0f4d1da221fa095be04383a1
parentba3b3528914f8e886b5fe2cba714de34c176a921

Revert "std.Thread: refining stack size from platform minimum, changes more targetted towards platform like Linux/musl (#15791)"

This reverts commit 41502c6aa53a3da31b276c23c4db74db7d04796b.

12 files changed, 1 insertions(+), 48 deletions(-)

lib/std/Thread.zig+1-1
......@@ -695,7 +695,7 @@ const PosixThreadImpl = struct {
695695 defer assert(c.pthread_attr_destroy(&attr) == .SUCCESS);
696696
697697 // Use the same set of parameters used by the libc-less impl.
698 const stack_size = @max(config.stack_size, c.PTHREAD_STACK_MIN);
698 const stack_size = @max(config.stack_size, 16 * 1024);
699699 assert(c.pthread_attr_setstacksize(&attr, stack_size) == .SUCCESS);
700700 assert(c.pthread_attr_setguardsize(&attr, std.mem.page_size) == .SUCCESS);
701701
lib/std/c/darwin.zig-6
......@@ -4153,9 +4153,3 @@ pub const vm_extmod_statistics_t = *vm_extmod_statistics;
41534153pub const vm_extmod_statistics_data_t = vm_extmod_statistics;
41544154
41554155pub extern "c" fn vm_stats(info: ?*anyopaque, count: *c_uint) kern_return_t;
4156
4157/// TODO refines if necessary
4158pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) {
4159 .arm, .aarch64 => 16 * 1024,
4160 else => 8 * 1024,
4161};
lib/std/c/dragonfly.zig-2
......@@ -1160,5 +1160,3 @@ pub const sigevent = extern struct {
11601160 sigev_value: sigval,
11611161 sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
11621162};
1163
1164pub const PTHREAD_STACK_MIN = 16 * 1024;
lib/std/c/emscripten.zig-2
......@@ -9,5 +9,3 @@ pub const pthread_rwlock_t = extern struct {
99};
1010const __SIZEOF_PTHREAD_COND_T = 48;
1111const __SIZEOF_PTHREAD_MUTEX_T = 28;
12
13pub const PTHREAD_STACK_MIN = 2048;
lib/std/c/freebsd.zig-6
......@@ -2818,9 +2818,3 @@ pub const ptrace_cs_remote = extern struct {
28182818};
28192819
28202820pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: [*:0]u8, data: c_int) c_int;
2821
2822/// TODO refines if necessary
2823pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) {
2824 .x86, .powerpc => 4 * 512,
2825 else => 4 * 1024,
2826};
lib/std/c/haiku.zig-3
......@@ -1068,6 +1068,3 @@ pub const sigevent = extern struct {
10681068 sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
10691069 sigev_notify_attributes: ?*pthread_attr_t,
10701070};
1071
1072/// TODO refines if necessary
1073pub const PTHREAD_STACK_MIN = 2 * 4096;
lib/std/c/linux.zig-12
......@@ -350,18 +350,6 @@ const __SIZEOF_PTHREAD_MUTEX_T = switch (native_abi) {
350350};
351351const __SIZEOF_SEM_T = 4 * @sizeOf(usize);
352352
353/// TODO refines if necessary
354pub const PTHREAD_STACK_MIN = switch (native_abi) {
355 .musl, .musleabi, .musleabihf => 2048,
356 .gnu, .gnuabin32, .gnuabi64, .gnueabi, .gnueabihf, .gnux32 => switch (native_arch) {
357 .aarch64, .arm, .armeb, .powerpc, .powerpc64, .powerpc64le, .loongarch32, .loongarch64 => 131072,
358 .sparc64 => 24576,
359 else => 16 * 1024,
360 },
361 .android => if (@sizeOf(usize) == 8) 16 * 1024 else 8 * 1024,
362 else => 16 * 1024,
363};
364
365353pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8) E;
366354pub extern "c" fn pthread_getname_np(thread: std.c.pthread_t, name: [*:0]u8, len: usize) E;
367355
lib/std/c/minix.zig-2
......@@ -16,5 +16,3 @@ const __SIZEOF_PTHREAD_MUTEX_T = switch (builtin.abi) {
1616 },
1717 else => unreachable,
1818};
19
20pub const PTHREAD_STACK_MIN = 16 * 1024;
lib/std/c/netbsd.zig-3
......@@ -1720,6 +1720,3 @@ pub const PIOD = struct {
17201720};
17211721
17221722pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: ?*anyopaque, data: c_int) c_int;
1723
1724/// TODO refines if necessary
1725pub const PTHREAD_STACK_MIN = 16 * 1024;
lib/std/c/openbsd.zig-7
......@@ -1634,10 +1634,3 @@ pub const HW = struct {
16341634 pub const NCPUONLINE = 25;
16351635 pub const POWER = 26;
16361636};
1637
1638/// TODO refines if necessary
1639pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) {
1640 .sparc64 => 1 << 13,
1641 .mips64 => 1 << 14,
1642 else => 1 << 12,
1643};
lib/std/c/solaris.zig-2
......@@ -1946,5 +1946,3 @@ pub const sigevent = extern struct {
19461946 sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
19471947 sigev_notify_attributes: ?*pthread_attr_t,
19481948};
1949
1950pub const PTHREAD_STACK_MIN = if (@sizeOf(usize) == 8) 8 * 1024 else 4 * 1024;
lib/std/c/wasi.zig-2
......@@ -119,5 +119,3 @@ pub const POLL = struct {
119119 pub const HUP = 0x2000;
120120 pub const NVAL = 0x4000;
121121};
122
123pub const PTHREAD_STACK_MIN = 16 * 1024;