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 {...@@ -695,7 +695,7 @@ const PosixThreadImpl = struct {
695 defer assert(c.pthread_attr_destroy(&attr) == .SUCCESS);695 defer assert(c.pthread_attr_destroy(&attr) == .SUCCESS);
696696
697 // Use the same set of parameters used by the libc-less impl.697 // 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);
699 assert(c.pthread_attr_setstacksize(&attr, stack_size) == .SUCCESS);699 assert(c.pthread_attr_setstacksize(&attr, stack_size) == .SUCCESS);
700 assert(c.pthread_attr_setguardsize(&attr, std.mem.page_size) == .SUCCESS);700 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;...@@ -4153,9 +4153,3 @@ pub const vm_extmod_statistics_t = *vm_extmod_statistics;
4153pub const vm_extmod_statistics_data_t = vm_extmod_statistics;4153pub const vm_extmod_statistics_data_t = vm_extmod_statistics;
41544154
4155pub extern "c" fn vm_stats(info: ?*anyopaque, count: *c_uint) kern_return_t;4155pub 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 {...@@ -1160,5 +1160,3 @@ pub const sigevent = extern struct {
1160 sigev_value: sigval,1160 sigev_value: sigval,
1161 sigev_notify_function: ?*const fn (sigval) callconv(.C) void,1161 sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
1162};1162};
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 {...@@ -9,5 +9,3 @@ pub const pthread_rwlock_t = extern struct {
9};9};
10const __SIZEOF_PTHREAD_COND_T = 48;10const __SIZEOF_PTHREAD_COND_T = 48;
11const __SIZEOF_PTHREAD_MUTEX_T = 28;11const __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 {...@@ -2818,9 +2818,3 @@ pub const ptrace_cs_remote = extern struct {
2818};2818};
28192819
2820pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: [*:0]u8, data: c_int) c_int;2820pub 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 {...@@ -1068,6 +1068,3 @@ pub const sigevent = extern struct {
1068 sigev_notify_function: ?*const fn (sigval) callconv(.C) void,1068 sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
1069 sigev_notify_attributes: ?*pthread_attr_t,1069 sigev_notify_attributes: ?*pthread_attr_t,
1070};1070};
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) {...@@ -350,18 +350,6 @@ const __SIZEOF_PTHREAD_MUTEX_T = switch (native_abi) {
350};350};
351const __SIZEOF_SEM_T = 4 * @sizeOf(usize);351const __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
365pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8) E;353pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8) E;
366pub extern "c" fn pthread_getname_np(thread: std.c.pthread_t, name: [*:0]u8, len: usize) E;354pub 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) {...@@ -16,5 +16,3 @@ const __SIZEOF_PTHREAD_MUTEX_T = switch (builtin.abi) {
16 },16 },
17 else => unreachable,17 else => unreachable,
18};18};
19
20pub const PTHREAD_STACK_MIN = 16 * 1024;
lib/std/c/netbsd.zig-3
...@@ -1720,6 +1720,3 @@ pub const PIOD = struct {...@@ -1720,6 +1720,3 @@ pub const PIOD = struct {
1720};1720};
17211721
1722pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: ?*anyopaque, data: c_int) c_int;1722pub 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 {...@@ -1634,10 +1634,3 @@ pub const HW = struct {
1634 pub const NCPUONLINE = 25;1634 pub const NCPUONLINE = 25;
1635 pub const POWER = 26;1635 pub const POWER = 26;
1636};1636};
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 {...@@ -1946,5 +1946,3 @@ pub const sigevent = extern struct {
1946 sigev_notify_function: ?*const fn (sigval) callconv(.C) void,1946 sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
1947 sigev_notify_attributes: ?*pthread_attr_t,1947 sigev_notify_attributes: ?*pthread_attr_t,
1948};1948};
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 {...@@ -119,5 +119,3 @@ pub const POLL = struct {
119 pub const HUP = 0x2000;119 pub const HUP = 0x2000;
120 pub const NVAL = 0x4000;120 pub const NVAL = 0x4000;
121};121};
122
123pub const PTHREAD_STACK_MIN = 16 * 1024;