aboutsummaryrefslogtreecommitdiff
path: root/crates/hashx/src
Commit message (Collapse)AuthorAgeFilesLines
* add_warning: add reference to arti#2556Jim Newsome2026-07-151-1/+1
|
* Removed unnecessary lintpryty262026-07-151-1/+1
| | | | Removed unnecessary lint
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-124-28/+32
| | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* hashx: Bump dynasmrt to 5.0.0Gabriela Moldovan2026-03-041-1/+1
| | | | | Contains a small code change as `bare_relocation()` was replaced with `value_relocation()`.
* hashx: Use .is_multiple_of() as recommended by clippyGabriela Moldovan2026-02-161-1/+1
| | | | | | I'm applying the clippy suggestion, even though in this case, using `is_multiple_of()` instead of `%` is a bit questionable IMO, because the `% 3` operation can never panic.
* Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
| | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* hashx: Gate as_u8() behind the compiler featureGabriela Moldovan2025-11-201-0/+1
| | | | | | | | | | | | | | | | | | This resolves a dead code warning when building without the `compiler` feature: ``` warning: method `as_u8` is never used --> crates/hashx/src/register.rs:39:19 | 27 | impl RegisterId { | --------------- method in this implementation ... 39 | pub(crate) fn as_u8(&self) -> u8 { | ^^^^^ | = note: `#[warn(dead_code)]` on by default ```
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* hashx: A couple of comments about register rangesNick Mathewson2025-10-082-0/+4
|
* hashx: Make exceptions for clippy warnings from dynasm.Nick Mathewson2025-10-081-9/+17
| | | | | The new conversion mechanisms in dynasm 4.0 make clippy unhappy under aarch64.
* hashx: Make RegisterId::x() return u8 on aarch64Nick Mathewson2025-10-071-3/+3
| | | | | (Starting with version 4, dynasm wants something that implements Into<u8>.)
* hashx: Provide a u8 accessor for RegisterId.Nick Mathewson2025-10-072-1/+7
|
* hashx: Fix/ignore clippy lints.Wesley Aptekar-Cassels2025-10-061-2/+5
| | | | | Some of these lints are in macros in a way that seems to make them impossible to avoid, or at least, I can't figure out how to avoid them.
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* Rename variables named "gen"Nick Mathewson2025-08-071-4/+4
| | | | | | This is now a reserved identifier. The automatic migration changed it to a raw identifier (`r#gen`), but it's better to use a different name.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-0711-19/+19
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Update code for Edition 2024Nick Mathewson2025-08-071-4/+4
| | | | | | | | | | | | | | | | | | 1. Run cargo fix --edition 2. Selectively revert the "if let"->"match" changes. These changes are meant to protect us from the lifetime changes for "if let" bindings in Rust 2024. But we're not actually relying on the old lifetime rules anywhere, and the match syntax here is quite ugly. 3. Automatically revert `$pat:expr_2021` to `$pat:expr`. (We don't actually want to restrict the expression syntax that our macros accept). Done with `git grep -l expr_2021 | xargs perl -i -pe 's/expr_2021/expr/g;'` 4. Run cargo fmt.
* Typo fixes (automatic and hand-verified)Nick Mathewson2025-07-091-1/+1
| | | | Made with https://crates.io/crates/typos-cli
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* hashx, tor-persist: fix intra-doc link backtickshashcatHitman2025-04-161-1/+1
| | | | | | | | | | - Replaced single quotes in [`hashx::rand`] documentation link to [`hashx::rand::RngBuffer`] with backticks so it actually works. - Added a missing backtick to the link to [`tor_persist::state_dir::StateDirectory::instance_peek_storage`] in the documentation of [`tor_persist::state_dir::StateDirectory::with_instance_path_pieces`].
* fix `clippy::unneeded_struct_pattern`Steven Engler2025-04-032-13/+13
| | | | | | | | | | | | | | | | | | | | Example: ```text warning: struct pattern is not needed for a unit variant --> crates/hashx/src/program.rs:165:32 | 165 | Instruction::Target { .. } => Opcode::Target, | ^^^^^^^ help: remove the struct pattern | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern note: the lint level is defined here --> crates/hashx/src/lib.rs:9:9 | 9 | #![warn(clippy::all)] | ^^^^^^^^^^^ = note: `#[warn(clippy::unneeded_struct_pattern)]` implied by `#[warn(clippy::all)]` ```
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-8/+0
| | | | - `try_fill_bytes()` is no longer a member of RngCore.
* Merge branch 'mod-module-files' into 'main'Nick Mathewson2025-01-071-0/+1
|\ | | | | | | | | clippy: deny `mod_module_files` See merge request tpo/core/arti!2689
| * clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | | | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* | Fix "unnecessary parentheses around assigned value" warning on aarch64.Alexander Færøy2025-01-061-2/+2
|/
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Resolve nightly clippy errors in hashx.Nick Mathewson2024-04-221-3/+3
| | | | | | Nightly clippy doesn't like using "expr as T" when the conversion is lossless; it prefers "T::from(expr)" so that if we later change the type of T to something with a lossy conversion, we'll know.
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* Fix typosDimitris Apostolou2024-01-081-1/+1
|
* Switch to FixedCapacityVec 0.1.0 from crates.ioIan Jackson2023-09-063-300/+1
|
* hashx: Cleanup around Instruction and NUM_INSTRUCTIONSMicah Elizabeth Scott2023-08-256-28/+24
| | | | | | | | | This patch tries to make some of the expressions around NUM_INSTRUCTIONS more convenient. We can import it directly where it's needed, but most uses are replaced by new type aliases for InstructionArray and InstructionVec. No change to any hashx_cachegrind iai benchmarks
* hashx: Avoid memcpy in Assembler::finalize()Micah Elizabeth Scott2023-08-251-1/+7
| | | | | | | | | | | | | | | | | This is a very simple change, just passing 'self' by reference instead of value. The by-value version generates a memcpy of the entire temporary program buffer which doesn't optimize out like I expected it would. The juicy impact here is a much lower cache footprint for compilation, since we avoid having yet another temporary storage location for the program data. generate_compiled_1000x Instructions: 271682605 (-0.627292%) L1 Accesses: 341834751 (-0.813903%) L2 Accesses: 56420 (-39.48365%) RAM Accesses: 618 (-20.25806%) Estimated Cycles: 342138481 (-0.867660%)
* RustfmtIan Jackson2023-08-253-3/+3
|
* RFC: hashx: Make Architecture::compile take an array refIan Jackson2023-08-254-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | generate_interp_1000x Instructions: 219216169 (No change) L1 Accesses: 278017243 (-0.000441%) L2 Accesses: 1257 (+4389.286%) RAM Accesses: 415 (-0.479616%) Estimated Cycles: 278038053 (+0.001744%) generate_interp_1000x_c Instructions: 272748034 (No change) L1 Accesses: 349932964 (No change) L2 Accesses: 76 (-1.298701%) RAM Accesses: 411 (+0.243902%) Estimated Cycles: 349947729 (+0.000009%) generate_compiled_1000x Instructions: 256896028 (+0.175731%) L1 Accesses: 342543838 (+0.131802%) L2 Accesses: 149273 (-10.34924%) RAM Accesses: 810 (-0.246305%) Estimated Cycles: 343318553 (+0.106328%) generate_compiled_1000x_c Instructions: 281855218 (No change) L1 Accesses: 362569035 (-0.000001%) L2 Accesses: 88 (+1.149425%) RAM Accesses: 473 (+0.211864%) Estimated Cycles: 362586030 (+0.000010%) interp_u64_hash_1000x Instructions: 13450926 (No change) L1 Accesses: 16622561 (+0.000024%) L2 Accesses: 28 (No change) RAM Accesses: 390 (-1.015228%) Estimated Cycles: 16636351 (-0.000817%) interp_8b_hash_1000x_c Instructions: 8618541 (No change) L1 Accesses: 12316160 (-0.000008%) L2 Accesses: 80 (No change) RAM Accesses: 433 (+0.231481%) Estimated Cycles: 12331715 (+0.000276%) compiled_u64_hash_100000x Instructions: 87311792 (+0.000520%) L1 Accesses: 94396598 (+0.000463%) L2 Accesses: 215 (+2.380952%) RAM Accesses: 774 (-0.641849%) Estimated Cycles: 94424763 (+0.000304%) compiled_8b_hash_100000x_c Instructions: 91547640 (No change) L1 Accesses: 98838166 (-0.000007%) L2 Accesses: 137 (+3.007519%) RAM Accesses: 488 (+0.618557%) Estimated Cycles: 98855931 (+0.000119%)
* Run maint/add-warningIan Jackson2023-08-251-0/+1
| | | | Yet another new module concurrently with a new lint.
* hashx: FixedCapacityVec: Fix clippy lintsIan Jackson2023-08-241-4/+3
|
* RustfmtIan Jackson2023-08-244-6/+12
|
* hashx: FixedCapacityVec: impl Send, Sync, [Ref]UnwindSafeIan Jackson2023-08-241-0/+13
|
* hashx: FixedCapacityVec: TestsIan Jackson2023-08-241-0/+105
| | | | These pass miri too.
* hashx: FixedCapacityVec: introduce push_innerIan Jackson2023-08-241-7/+21
| | | | | | To support testing. No change to iai benchmarks.
* hashx: FixedCapacityVec: use *mut T, and impl DropIan Jackson2023-08-241-24/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | generate_interp_1000x Instructions: 219216169 (-0.408535%) L1 Accesses: 278018470 (-0.322766%) L2 Accesses: 28 (+12.00000%) RAM Accesses: 417 (+0.724638%) Estimated Cycles: 278033205 (-0.322706%) generate_interp_1000x_c Instructions: 272748034 (No change) L1 Accesses: 349932964 (-0.000002%) L2 Accesses: 77 (+1.315789%) RAM Accesses: 410 (+1.234568%) Estimated Cycles: 349947699 (+0.000050%) generate_compiled_1000x Instructions: 256445375 (-0.349434%) L1 Accesses: 342092951 (-0.266541%) L2 Accesses: 166505 (+9.182175%) RAM Accesses: 812 (+0.370828%) Estimated Cycles: 342953896 (-0.245532%) generate_compiled_1000x_c Instructions: 281855218 (No change) L1 Accesses: 362569037 (-0.000002%) L2 Accesses: 87 (No change) RAM Accesses: 472 (+1.287554%) Estimated Cycles: 362585992 (+0.000056%) interp_u64_hash_1000x Instructions: 13450926 (-0.006631%) L1 Accesses: 16622557 (-0.005384%) L2 Accesses: 28 (No change) RAM Accesses: 394 (+0.510204%) Estimated Cycles: 16636487 (-0.004959%) interp_8b_hash_1000x_c Instructions: 8618541 (No change) L1 Accesses: 12316161 (-0.000032%) L2 Accesses: 80 (No change) RAM Accesses: 432 (+0.934579%) Estimated Cycles: 12331681 (+0.001103%) compiled_u64_hash_100000x Instructions: 87311338 (-0.001022%) L1 Accesses: 94396161 (-0.000947%) L2 Accesses: 210 (-0.943396%) RAM Accesses: 779 (+0.386598%) Estimated Cycles: 94424476 (-0.000846%) compiled_8b_hash_100000x_c Instructions: 91547640 (No change) L1 Accesses: 98838173 (-0.000003%) L2 Accesses: 133 (-0.746269%) RAM Accesses: 485 (+0.831601%) Estimated Cycles: 98855813 (+0.000134%)
* hashx: FixedCapacityVec: Note some missing stuffIan Jackson2023-08-241-0/+12
|
* hashx: FixedCapacityVec: DocumentationIan Jackson2023-08-241-0/+27
|
* hashx: FixedCapacityVec: Replace .into_boxed_array method with TryIan Jackson2023-08-242-9/+16
| | | | | This version pushes the panic into the call site, which seems much better. No change to the iai results.
* hashx: FixedCapacityVec: Move into its own moduleIan Jackson2023-08-245-71/+80
|
* RustfmtIan Jackson2023-08-233-9/+9
|
* RFC: hashx: Introduce FixedCapacityVecIan Jackson2023-08-233-6/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is quite shoddy. It shouldn't be merged without some tidying up and unit tests and so on. Also I am confused about the difference between NUM_INSTRUCTIONS and model::REQUIRED_INSTRUCTIONS. However: generate_interp_1000x Instructions: 220115418 (-1.147100%) L1 Accesses: 278918725 (-0.936103%) L2 Accesses: 25 (-98.46248%) RAM Accesses: 414 (-0.956938%) Estimated Cycles: 278933340 (-0.938920%) generate_interp_1000x_c Instructions: 272748034 (No change) L1 Accesses: 349932970 (+0.000001%) L2 Accesses: 76 (-1.298701%) RAM Accesses: 405 (-0.491400%) Estimated Cycles: 349947525 (-0.000021%) generate_compiled_1000x Instructions: 257344624 (-0.982784%) L1 Accesses: 343007206 (-0.753942%) L2 Accesses: 152502 (-17.12839%) RAM Accesses: 809 (-0.369458%) Estimated Cycles: 343798031 (-0.797384%) generate_compiled_1000x_c Instructions: 281855218 (No change) L1 Accesses: 362569043 (+0.000002%) L2 Accesses: 87 (-4.395604%) RAM Accesses: 466 (-0.427350%) Estimated Cycles: 362585788 (-0.000023%) interp_u64_hash_1000x Instructions: 13451818 (-0.100680%) L1 Accesses: 16623452 (-0.105967%) L2 Accesses: 28 (No change) RAM Accesses: 392 (-1.507538%) Estimated Cycles: 16637312 (-0.107138%) interp_8b_hash_1000x_c Instructions: 8618541 (No change) L1 Accesses: 12316165 (+0.000032%) L2 Accesses: 80 (-2.439024%) RAM Accesses: 428 (-0.465116%) Estimated Cycles: 12331545 (-0.000616%) compiled_u64_hash_100000x Instructions: 87312230 (-1.358594%) L1 Accesses: 94397055 (-1.669415%) L2 Accesses: 212 (-0.469484%) RAM Accesses: 776 (-0.767263%) Estimated Cycles: 94425275 (-1.669144%) compiled_8b_hash_100000x_c Instructions: 91547640 (No change) L1 Accesses: 98838176 (+0.000009%) L2 Accesses: 134 (-4.964539%) RAM Accesses: 481 (-0.414079%) Estimated Cycles: 98855681 (-0.000097%)