about summary refs log tree commit diff
path: root/compiler/rustc_serialize/src/leb128.rs
AgeCommit message (Collapse)AuthorLines
2025-07-05use `div_ceil` instead of manual logicFolkert de Vries-1/+1
2025-03-20Convert `rustc_serialize` integration tests to unit tests.Nicholas Nethercote-0/+3
Because (a) the vast majority of compiler tests are unit tests, and (b) this works better with `unused_crate_dependencies`.
2025-03-07compiler: Use size_of from the prelude instead of importedThalia Archibald-1/+1
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-04-13Add add/sub methods that only panic with debug assertions to rustcNilstrieb-5/+9
This mitigates the perf impact of enabling overflow checks on rustc. The change to use overflow checks will be done in a later PR.
2023-09-10Reimplement FileEncoder with a small-write optimizationBen Kimock-13/+7
2023-04-23Rewrite MemDecoder around pointers not a sliceBen Kimock-8/+8
2022-11-29rename `{max=>largest}_max_leb128_len`Maybe Waffle-3/+3
2022-11-29Replace a macro with a functionMaybe Waffle-11/+8
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-1/+1
2022-01-07Unpeel the first iteration of the loop in impl_read_unsigned_leb128.Nicholas Nethercote-2/+11
2022-01-07Modify the buffer position directly when reading leb128 values.Nicholas Nethercote-10/+8
It's a small but clear performance win.
2021-01-11rustc_serialize: fix incorrect signed LEB128 decodingTyson Nottingham-22/+32
The signed LEB128 decoding function used a hardcoded constant of 64 instead of the number of bits in the type of integer being decoded, which resulted in incorrect results for some inputs. Fix this, make the decoding more consistent with the unsigned version, and increase the LEB128 encoding and decoding test coverage.
2021-01-11Serialize incr comp structures to file via fixed-size bufferTyson Nottingham-32/+68
Reduce a large memory spike that happens during serialization by writing the incr comp structures to file by way of a fixed-size buffer, rather than an unbounded vector. Effort was made to keep the instruction count close to that of the previous implementation. However, buffered writing to a file inherently has more overhead than writing to a vector, because each write may result in a handleable error. To reduce this overhead, arrangements are made so that each LEB128-encoded integer can be written to the buffer with only one capacity and error check. Higher-level optimizations in which entire composite structures can be written with one capacity and error check are possible, but would require much more work. The performance is mostly on par with the previous implementation, with small to moderate instruction count regressions. The memory reduction is significant, however, so it seems like a worth-while trade-off.
2020-08-30mv compiler to compiler/mark-0/+110