0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/lib/std/debug.zig

1861 lines
70 KiB

2019-05-26 13:17:34 -04:00
2019-05-24 22:52:07 -04:00
2019-05-26 13:17:34 -04:00
2016-08-17 20:11:04 -07:00
2019-05-26 13:17:34 -04:00
2020-05-05 05:14:22 -06:00
2021-12-10 11:47:38 +05:30
2021-06-21 13:47:38 -05:00
2021-06-21 13:47:38 -05:00
2020-05-05 05:14:22 -06:00
2019-05-27 02:16:05 -04:00
2020-05-05 05:14:22 -06:00
2019-05-26 13:17:34 -04:00
2019-05-26 13:17:34 -04:00
2019-05-26 13:17:34 -04:00
2019-05-26 13:17:34 -04:00
2019-05-26 13:17:34 -04:00
2020-05-05 05:14:22 -06:00
2019-05-27 02:16:05 -04:00
2019-07-16 01:48:47 +02:00
2018-02-28 21:19:51 -05:00
2020-05-05 05:14:22 -06:00
2020-03-13 19:20:18 +01:00
2020-03-13 19:20:18 +01:00
2017-04-24 12:01:19 -04:00
2017-04-24 12:01:19 -04:00
2017-04-24 12:01:19 -04:00
2021-06-19 21:10:22 -04:00
2018-01-14 10:19:21 -05:00
2018-12-02 18:54:04 -05:00
2018-12-02 18:54:04 -05:00
2018-12-02 18:54:04 -05:00
2018-12-02 18:54:04 -05:00
2018-07-29 23:25:40 -04:00
2018-12-02 18:54:04 -05:00
2021-02-05 00:28:07 +07:00
2020-05-13 16:21:15 +01:00
2018-12-02 18:54:04 -05:00
2018-12-02 18:54:04 -05:00
2018-12-02 18:54:04 -05:00
2021-02-05 00:28:07 +07:00
2018-12-02 18:54:04 -05:00
2018-07-29 23:25:40 -04:00
2018-12-02 18:54:04 -05:00
2018-01-14 10:19:21 -05:00
2018-09-12 14:26:21 -04:00
2018-09-12 14:26:21 -04:00
2018-09-12 14:26:21 -04:00
2020-05-05 05:14:22 -06:00
2020-02-22 12:44:21 +01:00
2020-02-22 11:51:45 +01:00
2020-02-21 12:11:04 +01:00
2020-02-22 12:44:21 +01:00
2020-02-21 12:11:04 +01:00
2020-02-20 20:48:54 +01:00
2020-02-21 12:11:04 +01:00
2020-02-22 12:44:21 +01:00
2020-02-20 20:48:54 +01:00
2020-02-09 11:55:43 +01:00
2020-02-22 12:44:21 +01:00
2020-02-22 12:44:21 +01:00
2020-05-05 05:14:22 -06:00
2020-02-01 13:15:49 +02:00
2020-05-05 05:14:22 -06:00
2020-10-11 08:23:36 +00:00
2020-10-12 14:29:43 +05:30
2020-02-09 11:55:43 +01:00
2020-02-10 13:18:28 +01:00
2020-02-20 20:18:51 +01:00
2020-05-29 16:39:47 -04:00
2020-05-05 05:14:22 -06:00
2020-02-20 20:18:51 +01:00
2020-02-18 13:06:17 +01:00
2020-02-01 13:15:49 +02:00
2020-05-29 16:39:47 -04:00
2020-05-05 05:14:22 -06:00
2020-02-20 20:18:51 +01:00
2020-03-10 20:22:30 -04:00
2020-02-20 20:18:51 +01:00
2020-11-25 13:23:43 -07:00
2018-08-25 03:07:37 -04:00
2020-02-01 13:15:49 +02:00
2021-06-10 18:20:18 +01:00
2020-05-29 16:39:47 -04:00
2020-02-20 20:18:51 +01:00
2020-02-18 12:37:25 +01:00
2020-02-20 20:18:51 +01:00
2020-02-18 12:37:25 +01:00
2020-02-22 11:51:45 +01:00
2020-02-18 12:37:25 +01:00
2018-08-25 03:07:37 -04:00
2020-02-18 12:37:25 +01:00
2020-06-08 16:33:35 -04:00
2020-02-22 11:51:45 +01:00
2020-02-18 12:37:25 +01:00
2020-02-20 20:18:51 +01:00
2020-02-22 11:51:45 +01:00
2017-04-24 12:01:19 -04:00
2017-04-24 12:01:19 -04:00
2017-04-24 12:01:19 -04:00
2017-04-24 12:01:19 -04:00
2017-04-24 12:01:19 -04:00
2020-06-08 16:33:35 -04:00
2021-06-19 21:10:22 -04:00
2020-05-29 16:39:47 -04:00
2020-05-05 05:14:22 -06:00
2020-02-20 20:18:51 +01:00
2020-02-20 20:18:51 +01:00
2020-02-20 20:18:51 +01:00
2020-02-09 11:55:43 +01:00
2020-02-22 11:51:45 +01:00
2020-02-09 11:55:43 +01:00
2020-02-09 11:55:43 +01:00
2020-02-22 11:51:45 +01:00
2020-02-09 11:55:43 +01:00
2020-02-18 13:06:17 +01:00
2020-02-09 11:55:43 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-09 11:55:43 +01:00
2020-02-22 11:51:45 +01:00
2020-02-11 09:40:21 +01:00
2020-02-18 12:37:25 +01:00
2020-02-11 09:40:21 +01:00
2020-02-18 12:37:25 +01:00
2020-02-11 09:40:21 +01:00
2020-02-18 12:37:25 +01:00
2020-07-04 22:25:49 +00:00
2020-02-18 12:37:25 +01:00
2020-02-22 11:51:45 +01:00
2020-02-18 12:37:25 +01:00
2020-05-29 16:39:47 -04:00
2020-02-22 12:44:21 +01:00
2020-02-18 12:37:25 +01:00
2020-02-22 12:44:21 +01:00
2020-02-18 12:37:25 +01:00
2020-02-11 09:40:21 +01:00
2020-02-18 12:37:25 +01:00
2020-02-20 20:48:54 +01:00
2020-02-11 09:40:21 +01:00
2020-02-22 11:51:45 +01:00
2020-02-10 13:18:28 +01:00
2020-02-10 13:18:28 +01:00
2020-02-10 13:18:28 +01:00
2020-02-20 20:48:54 +01:00
2020-02-10 13:18:28 +01:00
2020-02-20 20:48:54 +01:00
2020-02-10 13:18:28 +01:00
2020-02-20 20:48:54 +01:00
2020-02-10 13:18:28 +01:00
2020-07-04 22:25:49 +00:00
2020-02-18 12:37:25 +01:00
2020-02-10 20:47:07 +01:00
2020-02-10 13:18:28 +01:00
2020-02-10 20:47:07 +01:00
2020-02-10 13:18:28 +01:00
2020-02-22 11:51:45 +01:00
2020-02-10 13:18:28 +01:00
2020-02-22 12:44:21 +01:00
2020-02-10 13:18:28 +01:00
2020-02-22 12:44:21 +01:00
2020-02-10 13:18:28 +01:00
2020-02-20 20:48:54 +01:00
2020-02-10 13:18:28 +01:00
2020-02-22 11:51:45 +01:00
2020-02-18 12:37:25 +01:00
2020-02-09 11:55:43 +01:00
2020-02-18 12:37:25 +01:00
2021-06-19 21:10:22 -04:00
2020-02-18 12:37:25 +01:00
2020-02-18 12:37:25 +01:00
2020-02-20 20:48:54 +01:00
2020-02-20 20:18:51 +01:00
2020-02-20 20:48:54 +01:00
2020-02-18 12:37:25 +01:00
2020-02-09 11:55:43 +01:00
reimplement std.HashMap * breaking changes to the API. Some of the weird decisions from before are changed to what would be more expected. - `get` returns `?V`, use `getEntry` for the old API. - `put` returns `!void`, use `fetchPut` for the old API. * HashMap now has a comptime parameter of whether to store hashes with entries. AutoHashMap has heuristics on whether to set this parameter. For example, for integers, it is false, since equality checking is cheap, but for strings, it is true, since equality checking is probably expensive. * The implementation has a separate array for entry_index / distance_from_start_index. Entries no longer has holes; it is an ArrayList, and iteration is simpler and more cache coherent. This is inspired by Python's new dictionaries. * HashMap is separated into an "unmanaged" and a "managed" API. The unmanaged API is where the actual implementation is; the managed API wraps it and provides a more convenient API, storing the allocator. * Memory usage: When there are less than or equal to 8 entries, HashMap now incurs only a single pointer-size integer as overhead, opposed to using an ArrayList. * Since the entries array is separate from the indexes array, the holes in the indexes array take up less room than the holes in the entries array otherwise would. However the entries array also allocates additional capacity for appending into the array. * HashMap now maintains insertion order. Deletion performs a "swap remove". It's now possible to modify the HashMap while iterating.
2020-07-03 23:57:24 +00:00
2020-02-09 11:55:43 +01:00
2020-02-22 11:51:45 +01:00
2020-02-09 11:55:43 +01:00
2020-06-04 13:11:23 +03:00
2020-05-29 16:39:47 -04:00
2020-06-04 13:11:23 +03:00
2020-06-08 16:33:35 -04:00
2020-06-04 13:11:23 +03:00
2020-02-22 12:44:21 +01:00
2020-02-20 20:18:51 +01:00
2020-02-09 11:55:43 +01:00
2020-02-22 12:44:21 +01:00
2020-02-09 11:55:43 +01:00
2021-06-19 21:10:22 -04:00
2020-02-09 11:55:43 +01:00
2020-10-12 14:29:43 +05:30
2020-02-11 09:40:21 +01:00
2020-02-20 20:18:51 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-05-29 16:39:47 -04:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-12-03 13:40:49 -08:00
2020-05-05 05:14:22 -06:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2020-02-22 11:51:45 +01:00
2019-05-26 13:17:34 -04:00
2020-02-10 13:18:28 +01:00
2020-02-22 12:05:50 +01:00
2020-02-22 12:05:50 +01:00
2020-12-03 13:40:49 -08:00
2020-02-22 12:05:50 +01:00
2020-02-22 12:05:50 +01:00
2020-02-22 12:05:50 +01:00
2020-02-22 12:05:50 +01:00
2020-02-22 12:05:50 +01:00
2020-02-22 12:05:50 +01:00
2020-02-09 11:55:43 +01:00
2020-02-20 20:18:51 +01:00
2020-02-21 12:11:04 +01:00
2020-12-03 13:40:49 -08:00
2020-02-21 12:11:04 +01:00
2020-02-21 12:11:04 +01:00
2020-02-09 11:55:43 +01:00
2016-12-18 19:40:26 -05:00
2019-11-30 16:13:33 +01:00
2019-11-30 16:13:33 +01:00
2020-12-19 10:21:55 +00:00
2020-12-19 10:21:55 +00:00
2020-12-19 10:21:55 +00:00
2020-12-19 10:21:55 +00:00
improvements targeted at improving async functions * Reuse bytes of async function frames when non-async functions make `noasync` calls. This prevents explosive stack growth. * Zig now passes a stack size argument to the linker when linking ELF binaries. Linux ignores this value, but it is available as a program header called GNU_STACK. I prototyped some code that memory maps extra space to the stack using this program header, but there was still a problem when accessing stack memory very far down. Stack probing is needed or not working or something. I also prototyped using `@newStackCall` to call main and that does work around the issue but it also brings its own issues. That code is commented out for now in std/special/start.zig. I'm on a plane with no Internet, but I plan to consult with the musl community for advice when I get a chance. * Added `noasync` to a bunch of function calls in std.debug. It's very messy but it's a workaround that makes stack traces functional with evented I/O enabled. Eventually these will be cleaned up as the root bugs are found and fixed. Programs built in blocking mode are unaffected. * Lowered the default stack size of std.io.InStream (for the async version) to 1 MiB instead of 4. Until we figure out how to get choosing a stack size working (see 2nd bullet point above), 4 MiB tends to cause segfaults due to stack size running out, or usage of stack memory too far apart, or something like that. * Default thread stack size is bumped from 8 MiB to 16 to match the size we give for the main thread. It's planned to eventually remove this hard coded value and have Zig able to determine this value during semantic analysis, with call graph analysis and function pointer annotations and extern function annotations.
2019-09-11 20:22:49 -04:00
2020-01-29 23:15:17 +02:00
2020-01-29 23:15:17 +02:00
improvements targeted at improving async functions * Reuse bytes of async function frames when non-async functions make `noasync` calls. This prevents explosive stack growth. * Zig now passes a stack size argument to the linker when linking ELF binaries. Linux ignores this value, but it is available as a program header called GNU_STACK. I prototyped some code that memory maps extra space to the stack using this program header, but there was still a problem when accessing stack memory very far down. Stack probing is needed or not working or something. I also prototyped using `@newStackCall` to call main and that does work around the issue but it also brings its own issues. That code is commented out for now in std/special/start.zig. I'm on a plane with no Internet, but I plan to consult with the musl community for advice when I get a chance. * Added `noasync` to a bunch of function calls in std.debug. It's very messy but it's a workaround that makes stack traces functional with evented I/O enabled. Eventually these will be cleaned up as the root bugs are found and fixed. Programs built in blocking mode are unaffected. * Lowered the default stack size of std.io.InStream (for the async version) to 1 MiB instead of 4. Until we figure out how to get choosing a stack size working (see 2nd bullet point above), 4 MiB tends to cause segfaults due to stack size running out, or usage of stack memory too far apart, or something like that. * Default thread stack size is bumped from 8 MiB to 16 to match the size we give for the main thread. It's planned to eventually remove this hard coded value and have Zig able to determine this value during semantic analysis, with call graph analysis and function pointer annotations and extern function annotations.
2019-09-11 20:22:49 -04:00
2019-09-25 18:17:29 +03:00
2019-09-25 18:17:29 +03:00
improvements targeted at improving async functions * Reuse bytes of async function frames when non-async functions make `noasync` calls. This prevents explosive stack growth. * Zig now passes a stack size argument to the linker when linking ELF binaries. Linux ignores this value, but it is available as a program header called GNU_STACK. I prototyped some code that memory maps extra space to the stack using this program header, but there was still a problem when accessing stack memory very far down. Stack probing is needed or not working or something. I also prototyped using `@newStackCall` to call main and that does work around the issue but it also brings its own issues. That code is commented out for now in std/special/start.zig. I'm on a plane with no Internet, but I plan to consult with the musl community for advice when I get a chance. * Added `noasync` to a bunch of function calls in std.debug. It's very messy but it's a workaround that makes stack traces functional with evented I/O enabled. Eventually these will be cleaned up as the root bugs are found and fixed. Programs built in blocking mode are unaffected. * Lowered the default stack size of std.io.InStream (for the async version) to 1 MiB instead of 4. Until we figure out how to get choosing a stack size working (see 2nd bullet point above), 4 MiB tends to cause segfaults due to stack size running out, or usage of stack memory too far apart, or something like that. * Default thread stack size is bumped from 8 MiB to 16 to match the size we give for the main thread. It's planned to eventually remove this hard coded value and have Zig able to determine this value during semantic analysis, with call graph analysis and function pointer annotations and extern function annotations.
2019-09-11 20:22:49 -04:00