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 Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
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 Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
cat-and-grep.sh Remove licenses 2018-12-25 21:08:33 -07:00
check_missing_items.py Rustdoc-Json: Add Path type for traits. 2022-08-10 10:21:52 +01:00
CONFIGS.md Add sublime-rust to CONFIGS.md. 2016-08-22 01:24:01 -04:00
cpu-usage-over-time-plot.sh update cpu-usage-over-time-plot script 2022-06-21 06:15:31 -04:00
ctags.rust Update the ctags rules and targets. 2015-07-30 06:35:42 +10:00
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 Implement new gdb/lldb pretty-printers 2020-06-09 16:13:11 +03:00
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 Remove compile-fail test suite 2020-12-29 23:39:56 +03:00
generate-keyword-tests.py remove unnecessary import statement 2020-02-08 00:03:51 -05:00
htmldocck.py Fix line lengths 2022-08-13 00:37:14 -04:00
indenter fix some python3 incompatibilities 2017-11-16 13:34:13 -05:00
lldb_batchmode.py lldb_batchmode: show more error information 2020-11-03 12:01:46 +01:00
lldb_commands Support pretty printing slices using GDB 2021-07-03 23:42:07 +08:00
lldb_lookup.py Implement HashSet in terms of hashbrown::HashSet 2020-09-08 17:24:23 -07:00
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-gdb Prefer sysroot from rustc in same directory as rust-gdb 2020-04-02 11:52:35 -07:00
rust-gdbgui Prefer sysroot from rustc in same directory as rust-gdb 2020-04-02 11:52:35 -07:00
rust-lldb Fix loading pretty-printers in rust-lldb script 2020-08-28 09:29:45 +03:00
rust-windbg.cmd Remove licenses 2018-12-25 21:08:33 -07:00
rust_types.py Support pretty printing slices using GDB 2021-07-03 23:42:07 +08:00
wasm32-shim.js std: Remove the wasm_syscall feature 2019-08-28 08:34:31 -07:00