2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-06-19 21:10:22 -04:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
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:10:50 -07:00
|
|
|
|
2021-06-19 21:10:22 -04:00
|
|
|
|
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:10:50 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2022-04-17 15:56:59 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-17 15:56:59 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 18:22:04 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 18:22:04 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2020-09-25 20:50:40 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-19 23:27:34 +02:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-06 12:50:53 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-06 12:50:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-30 21:32:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-16 22:49:20 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-16 22:49:20 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2022-12-02 23:05:12 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
2022-03-09 22:50:27 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-08-04 00:29:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-02 19:10:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-09-16 18:22:04 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 18:22:04 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2020-12-29 16:22:22 +11:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-09-25 20:50:40 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-09-25 20:50:40 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:10:50 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-09-16 18:22:04 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 18:22:04 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-04 03:57:53 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-05-06 12:50:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-05-06 12:50:53 -07:00
|
|
|
|
|
|
|
|
|
2022-04-20 17:16:32 -07:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-06 12:50:53 -07:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:10:50 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-30 21:32:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-16 22:49:20 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-16 22:49:20 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2022-12-02 23:05:12 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-02 23:05:12 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2022-12-02 23:05:12 -07:00
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-09 22:50:27 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
2021-08-04 00:29:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:10:50 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:10:50 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-21 12:38:16 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-21 12:38:16 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-21 12:38:16 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 18:22:04 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 18:22:04 -07:00
|
|
|
|
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:10:50 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
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:10:50 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
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:10:50 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:10:50 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
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:10:50 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-21 12:38:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-21 12:38:16 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-10 20:13:43 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2022-11-27 01:07:35 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-10-29 00:37:25 +01:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2022-03-09 22:50:27 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-16 18:22:04 -07:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-19 21:10:22 -04:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-19 21:10:22 -04:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
2022-10-04 03:57:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-28 14:22:34 +09:00
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-03-28 14:22:34 +09:00
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-03-28 14:22:34 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-03-28 14:22:34 +09:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
2021-08-04 00:29:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-05-04 20:47:26 +03:00
|
|
|
|
2020-12-26 15:30:19 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-10 19:10:14 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-05-10 19:10:14 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
2021-05-10 19:10:14 -04:00
|
|
|
|
|
|
|
|
|
2022-03-09 22:50:27 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-19 21:10:22 -04:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-19 21:10:22 -04:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-19 21:10:22 -04:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:10:50 -07:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
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:10:50 -07:00
|
|
|
|
|
|
|
|
|
2021-06-19 21:10:22 -04:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
2021-06-03 15:39:26 -05:00
|
|
|
|
2021-06-19 21:10:22 -04:00
|
|
|
|
2020-08-02 23:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|