rust/src/etc
bors 4916e2b9e6 Auto merge of #98393 - michaelwoerister:new-cpp-like-enum-debuginfo, r=wesleywiser
debuginfo: Generalize C++-like encoding for enums.

The updated encoding should be able to handle niche layouts where more than one variant has fields (as introduced in https://github.com/rust-lang/rust/pull/94075).

The new encoding is more uniform as there is no structural difference between direct-tag, niche-tag, and no-tag layouts anymore. The only difference between those cases is that the "dataful" variant in a niche-tag enum will have a `(start, end)` pair denoting the tag range instead of a single value.

The new encoding now also supports 128-bit tags, which occur in at least some standard library types. These tags are represented as `u64` pairs so that debuggers (which don't always have support for 128-bit integers) can reliably deal with them. The downside is that this adds quite a bit of complexity to the encoding and especially to the corresponding NatVis.

The new encoding seems to increase the size of (x86_64-pc-windows-msvc) debuginfo by 10-15%. The size of binaries is not affected (release builds were built with `-Cdebuginfo=2`, numbers are in kilobytes):

EXE | before | after | relative
-- | -- | -- | --
cargo (debug) | 40453 | 40450 | +0%
ripgrep (debug) | 10275 | 10273 | +0%
cargo (release) | 16186 | 16185 | +0%
ripgrep (release) | 4727 | 4726 | +0%

PDB | before | after | relative
-- | -- | -- | --
cargo (debug) | 236524 | 261412 | +11%
ripgrep (debug) | 53140 | 59060 | +11%
cargo (release) | 148516 | 169620 | +14%
ripgrep (release) | 10676 | 11804 | +11%

Given that the new encoding is more general, this is to be expected. Only platforms using C++-like debuginfo are affected -- which currently is only `*-pc-windows-msvc`.

*TODO*
- [x] Properly update documentation
- [x] Add regression tests for new optimized enum layouts as introduced by #94075.

r? `@wesleywiser`
2022-08-15 12:59:53 +00:00
..
installer
natvis [debuginfo] Remove the notion of a 'fallback variant' from the CPP-like enum debuginfo encoding. 2022-08-12 10:53:08 +02:00
test-float-parse Migrate to 2021 2021-09-20 22:21:42 -04:00
third-party
cat-and-grep.sh
check_missing_items.py Rustdoc-Json: Add Path type for traits. 2022-08-10 10:21:52 +01:00
CONFIGS.md
cpu-usage-over-time-plot.sh update cpu-usage-over-time-plot script 2022-06-21 06:15:31 -04:00
ctags.rust
dec2flt_table.py Changed dec2flt to use the Eisel-Lemire algorithm. 2021-07-17 00:30:34 -05:00
gdb_load_rust_pretty_printers.py
gdb_lookup.py Support pretty printing slices using GDB 2021-07-03 23:42:07 +08:00
gdb_providers.py Fix debugger tests 2022-04-14 19:37:39 +02:00
generate-deriving-span-tests.py
generate-keyword-tests.py
htmldocck.py Fix line lengths 2022-08-13 00:37:14 -04:00
indenter
lldb_batchmode.py
lldb_commands Support pretty printing slices using GDB 2021-07-03 23:42:07 +08:00
lldb_lookup.py
lldb_providers.py Fix debugger tests 2022-04-14 19:37:39 +02:00
pre-push.sh pre-push.sh: Use python3 if python is not found 2022-04-11 12:02:40 -07:00
rust_types.py Support pretty printing slices using GDB 2021-07-03 23:42:07 +08:00
rust-gdb
rust-gdbgui
rust-lldb
rust-windbg.cmd
wasm32-shim.js