lix/src
eldritch horrors 86a1121d16 use byte indexed locations for PosIdx
we now keep not a table of all positions, but a table of all origins and
their sizes. position indices are now direct pointers into the virtual
concatenation of all parsed contents. this slightly reduces memory usage
and time spent in the parser, at the cost of not being able to report
positions if the total input size exceeds 4GiB. this limit is not unique
to nix though, rustc and clang also limit their input to 4GiB (although
at least clang refuses to process inputs that are larger, we will not).

this new 4GiB limit probably will not cause any problems for quite a
while, all of nixpkgs together is less than 100MiB in size and already
needs over 700MiB of memory and multiple seconds just to parse. 4GiB
worth of input will easily take multiple minutes and over 30GiB of
memory without even evaluating anything. if problems *do* arise we can
probably recover the old table-based system by adding some tracking to
Pos::Origin (or increasing the size of PosIdx outright), but for time
being this looks like more complexity than it's worth.

since we now need to read the entire input again to determine the
line/column of a position we'll make unsafeGetAttrPos slightly lazy:
mostly the set it returns is only used to determine the file of origin
of an attribute, not its exact location. the thunks do not add
measurable runtime overhead.

notably this change is necessary to allow changing the parser since
apparently nothing supports nix's very idiosyncratic line ending choice
of "anything goes", making it very hard to calculate line/column
positions in the parser (while byte offsets are very easy).

(cherry picked from commit 5d9fdab3de0ee17c71369ad05806b9ea06dfceda)
Change-Id: Ie0b2430cb120c09097afa8c0101884d94f4bbf34
2024-03-18 16:12:46 +01:00
..
build-remote Merge pull request #9925 from 9999years/fmt-cleanup 2024-03-09 07:00:13 -07:00
libcmd add automated usage mode to the repl 2024-03-11 14:14:43 -07:00
libexpr use byte indexed locations for PosIdx 2024-03-18 16:12:46 +01:00
libfetchers Merge pull request #9324 from 9999years/fix-8854-take-2 2024-03-07 14:50:43 +01:00
libmain util.hh: split out signals stuff 2024-03-11 00:52:09 -07:00
libstore Allow dlopen of plugins to fail 2024-03-15 12:31:16 -07:00
libutil match line endings used by parser and error reports 2024-03-18 16:12:46 +01:00
nix libutil: remove vfork 2024-03-18 06:10:41 -06:00
nix-build Merge pull request #9582 from pennae/misc-opts 2024-03-04 07:32:31 +01:00
nix-channel Merge pull request #10054 from syvb/channel-unpack-count 2024-03-04 09:25:17 +01:00
nix-collect-garbage util.hh: split out signals stuff 2024-03-11 00:52:09 -07:00
nix-copy-closure Merge pull request #9277 from keszybz/file-permissions 2024-03-04 05:26:17 +01:00
nix-env Unify and refactor value printing 2024-03-09 03:50:06 +01:00
nix-instantiate Unify and refactor value printing 2024-03-09 03:50:06 +01:00
nix-store libexpr: Support structured error classes 2024-03-09 04:47:05 -07:00
resolve-system-dependencies Remove FormatOrString and remaining uses of format() 2023-03-02 15:57:54 +01:00
toml11 Replace cpptoml with toml11 2021-12-17 22:03:33 +01:00