zig/lib/std
Andrew Kelley cf88cf2657 std: make ArrayHashMap eql function accept an additional param
which is the index of the key that already exists in the hash map.

This enables the use case of using `AutoArrayHashMap(void, void)` which
may seem surprising at first, but is actually pretty handy!
This commit includes a proof-of-concept of how I want to use it, with a
new InternArena abstraction for stage2 that provides a compact way to
store values (and types) in an "internment arena", thus making types
stored exactly once (per arena), representable with a single u32 as a
reference to a type within an InternArena, and comparable with a
simple u32 integer comparison. If both types are in the same
InternArena, you can check if they are equal by seeing if their index is
the same.

What's neat about `AutoArrayHashMap(void, void)` is that it allows us to
look up the indexes by key, *without actually storing the keys*.
Instead, keys are treated as ephemeral values that are constructed as
needed.

As a result, we have an extremely efficient encoding of types and
values, represented only by three arrays, which has no pointers, and can
therefore be serialized and deserialized by a single writev/readv call.
The `map` field is denormalized data and can be computed from the other
two fields.

This is in contrast to our current Type/Value system which makes
extensive use of pointers.

The test at the bottom of InternArena.zig passes in this commit.
2022-01-31 01:20:45 -07:00
..
atomic allocgate: renamed getAllocator function to allocator 2021-11-30 23:32:47 +00:00
build allow expected_exit_code to be null 2022-01-24 17:29:19 +02:00
c std: Add some missing termios types to c/linux.zig and os.zig 2022-01-23 17:12:07 +01:00
compress std: remove superfluous .read = true from deflate tests 2022-01-29 16:57:10 +02:00
crypto std: break up some long lines 2022-01-28 16:23:47 -07:00
dwarf
event allocgate: renamed getAllocator function to allocator 2021-11-30 23:32:47 +00:00
fmt std.fmt: fix out-of-bounds array write in float printing 2022-01-29 12:25:25 +01:00
fs Merge pull request #10404 from ominitay/iterator 2022-01-30 14:25:50 +01:00
hash std: make ArrayHashMap eql function accept an additional param 2022-01-31 01:20:45 -07:00
heap stage1: deal with BPF not supporting @returnAddress() 2021-12-19 23:22:05 -08:00
io readUntilDelimiter*: read only if buffer not full 2022-01-24 17:44:26 +02:00
json allocgate: renamed getAllocator function to allocator 2021-11-30 23:32:47 +00:00
math Fix overflow in std.math.isNormal when applied to -Inf or a negative NaN 2022-01-29 18:11:49 +02:00
mem std.mem.Allocator: upgrade to new function pointer semantics 2022-01-26 20:02:01 -07:00
meta std lib API deprecations for the upcoming 0.9.0 release 2021-11-30 00:13:07 -07:00
net Check for isDarwin() instead of linked libc 2022-01-14 13:44:38 +01:00
os improve comptime windows GUID.parse performance 2022-01-29 18:10:22 +02:00
rand Add argument for fillFn to Random.init 2021-10-29 19:20:31 -04:00
special stage2: avoid inferred struct in os_version_check.zig 2022-01-26 00:48:05 -05:00
target
testing allocgate: change resize to return optional instead of error 2021-11-30 23:45:01 +00:00
Thread std: add test for Thread.Semaphore 2022-01-29 20:30:53 +00:00
time std.time.epoch: fix issue in documentation 2021-12-16 19:08:58 -08:00
tz Support legacy TZ format, expose header struct to a potential writer 2022-01-01 12:47:08 +00:00
unicode migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
valgrind
x Check for isDarwin() instead of linked libc 2022-01-14 13:44:38 +01:00
zig Remove deprecation warnings and enable test 2022-01-29 15:49:00 +02:00
array_hash_map.zig std: make ArrayHashMap eql function accept an additional param 2022-01-31 01:20:45 -07:00
array_list.zig Preserve alignment when cloning 2022-01-27 19:35:08 +02:00
ascii.zig allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
atomic.zig migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
base64.zig std lib API deprecations for the upcoming 0.9.0 release 2021-11-30 00:13:07 -07:00
bit_set.zig 9944: make allocator the first argument (excl. self) 2021-12-03 16:42:59 -08:00
bounded_array.zig Slice function of BoundedArray now returns slice based on self pointer 2022-01-16 01:37:37 -05:00
buf_map.zig allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
buf_set.zig allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
build.zig Normalize some build function names 2022-01-24 20:15:32 +02:00
builtin.zig std: make ArrayHashMap eql function accept an additional param 2022-01-31 01:20:45 -07:00
c.zig std.c: add shm_open and shm_unlink 2022-01-17 16:56:50 +02:00
child_process.zig stage1, stage2: rename c_void to anyopaque (#10316) 2021-12-19 00:24:45 -05:00
coff.zig allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
compress.zig compress: add a deflate compressor 2022-01-23 19:30:06 +01:00
comptime_string_map.zig
crypto.zig std.crypto.random: Randoms are no longer passed by reference 2022-01-25 13:00:39 -05:00
cstr.zig allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
debug.zig add std.debug.todo 2022-01-27 19:42:40 +02:00
dwarf.zig allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
dynamic_library.zig stage1, stage2: rename c_void to anyopaque (#10316) 2021-12-19 00:24:45 -05:00
elf.zig Rename mem.bswapAllFields to byteSwapAllFields 2022-01-28 21:03:21 -05:00
enums.zig
event.zig
fifo.zig allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
fmt.zig std.fmt: fix out-of-bounds array write in float printing 2022-01-29 12:25:25 +01:00
fs.zig Merge pull request #10404 from ominitay/iterator 2022-01-30 14:25:50 +01:00
hash.zig lint: duplicate import (#10519) 2022-01-07 00:06:06 -05:00
hash_map.zig std: make ArrayHashMap eql function accept an additional param 2022-01-31 01:20:45 -07:00
heap.zig stage1, stage2: rename c_void to anyopaque (#10316) 2021-12-19 00:24:45 -05:00
io.zig std lib API deprecations for the upcoming 0.9.0 release 2021-11-30 00:13:07 -07:00
json.zig std: add json.stringifyAlloc 2022-01-17 12:32:02 +01:00
leb128.zig I'm working on a WebAssembly interpreter in zig. WebAssembly uses LEB128 encoding throughout its specification. 2021-09-20 01:58:18 -04:00
linked_list.zig
log.zig std lib API deprecations for the upcoming 0.9.0 release 2021-11-30 00:13:07 -07:00
macho.zig macho: put LC_* consts in a typed enum(u32) LC 2021-12-15 08:59:20 +01:00
math.zig std: add f80 bits 2022-01-28 11:45:04 -07:00
mem.zig Merge pull request #9915 from zzyxyzz/indexOfMinMax 2022-01-29 15:49:47 +02:00
meta.zig std: add meta.DeclEnum 2022-01-20 10:54:45 +02:00
multi_array_list.zig Revert "MultiArrayList: Fix error when struct is 0 sized" 2022-01-24 21:29:04 -07:00
net.zig Merge pull request #10576 from schmee/macos-resolve-ip 2022-01-15 00:47:12 +01:00
once.zig std.Thread.Mutex: change API to lock() and unlock() 2021-11-09 18:31:03 -07:00
os.zig std: Add some missing termios types to c/linux.zig and os.zig 2022-01-23 17:12:07 +01:00
packed_int_array.zig Better documentation, use of len field instead of function, @bitSizeOf instead of meta.bitCout 2021-10-09 03:15:34 -04:00
pdb.zig Only check the file's length once in pdb.Msf.init 2021-12-21 17:29:23 -08:00
priority_dequeue.zig std.priority_dequeue: allow comparator to take a context parameter 2021-12-15 17:46:10 -08:00
priority_queue.zig std.priority_queue: allow comparator to take a context parameter 2021-12-15 17:46:04 -08:00
process.zig Full response file (*.rsp) support 2022-01-30 21:27:52 +02:00
Progress.zig Fix test label off-by-one error (#10277). 2021-12-06 12:18:41 -08:00
rand.zig stage1, stage2: rename c_void to anyopaque (#10316) 2021-12-19 00:24:45 -05:00
SemanticVersion.zig
sort.zig std.rand: Refactor Random interface 2021-10-27 16:07:48 -04:00
start.zig fix startup procedure for async WinMain 2022-01-27 19:49:12 +02:00
start_windows_tls.zig stage1, stage2: rename c_void to anyopaque (#10316) 2021-12-19 00:24:45 -05:00
std.zig tz parsing reader interface, test thicc files, and exclude tzif 2021-12-31 17:17:49 +00:00
target.zig Remove deprecation warnings and enable test 2022-01-29 15:49:00 +02:00
testing.zig stage2: implement @ctz and @clz including SIMD 2022-01-12 23:53:26 -07:00
Thread.zig fs: Use OpenMode enum instead of read/write flags. 2022-01-29 15:52:08 +02:00
time.zig lint: duplicate import (#10519) 2022-01-07 00:06:06 -05:00
tz.zig Rename mem.bswapAllFields to byteSwapAllFields 2022-01-28 21:03:21 -05:00
unicode.zig Full response file (*.rsp) support 2022-01-30 21:27:52 +02:00
valgrind.zig lint: duplicate import (#10519) 2022-01-07 00:06:06 -05:00
wasm.zig wasm: Implement memset, and sret arguments. 2022-01-04 17:59:05 +01:00
x.zig
zig.zig allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00