Skip to content

Commit ff24eee

Browse files
committed
Clarify admitted SIMD cleanup labels
1 parent d3d3dc1 commit ff24eee

4 files changed

Lines changed: 10 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@
5959
standard checks so the future encode-dispatch admission contract remains
6060
packaged and machine-checked.
6161
- Wiped the small unpadded in-place decode tail buffer before return, expanded
62-
test-only AArch64 NEON prototype cleanup to all vector registers, and
62+
AArch64 NEON encode cleanup to all vector registers, and
6363
documented the wrapped slice encoder's temporary in-buffer staging behavior.
6464
- Added `base64-ng-subtle` as an optional companion crate for projects that
6565
already admit `subtle` and want reviewed `ConstantTimeEq` comparisons for
6666
`base64-ng` buffers.
67-
- Inlined the test-only AArch64 NEON register cleanup macro into the prototype
68-
path so callee-saved `v8..v15` are not restored by a separate helper frame.
67+
- Inlined the AArch64 NEON register cleanup macro into the encode block path so
68+
callee-saved `v8..v15` are not restored by a separate helper frame.
6969
- Added a real non-dispatchable AVX2 fixed-block encode prototype for Standard
7070
and URL-safe alphabets. The prototype remains test-only and is not reachable
7171
from runtime backend selection.

docs/UNSAFE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ Safety argument:
749749
NEON is part of the target contract. Direct tests use the same availability
750750
precondition.
751751
- Register-retention note: the AArch64 vector path loads caller bytes into NEON
752-
state and expands `clear_neon_registers_for_test_prototype!` directly inside
752+
state and expands `clear_neon_registers_after_encode_block!` directly inside
753753
the block function before return. This is retention reduction for the
754754
admitted encode block, not a formal microarchitectural side-channel proof.
755755

@@ -782,7 +782,7 @@ Unsafe operation:
782782
- `encode_standard_family_indices_neon` maps those indices to Standard or
783783
URL-safe alphabet bytes with NEON comparisons and bit selects.
784784
- `vst1q_u8` stores the 16 encoded bytes into the output buffer.
785-
- `clear_neon_registers_for_test_prototype!` clears `v0` through `v31` inside
785+
- `clear_neon_registers_after_encode_block!` clears `v0` through `v31` inside
786786
the block function before return.
787787
- The local staging array is wiped with the crate cleanup primitive before the
788788
function returns.
@@ -830,7 +830,7 @@ Safety argument:
830830
six-bit Base64 value.
831831
- The helper is private to the Standard-family NEON encode path.
832832

833-
### `clear_neon_registers_for_test_prototype!`
833+
### `clear_neon_registers_after_encode_block!`
834834

835835
Location: `src/simd/mod.rs`
836836

@@ -843,9 +843,9 @@ Purpose:
843843

844844
Preconditions:
845845

846-
- Called only after the prototype has stored its output and no later NEON value
846+
- Called only after the encode block has stored its output and no later NEON value
847847
is needed by the function.
848-
- Expanded directly inside the prototype function. It must not be moved to a
848+
- Expanded directly inside the encode block function. It must not be moved to a
849849
separate function because an AArch64 helper can save and restore callee-saved
850850
`v8` through `v15`, undoing register clearing in the helper frame.
851851

src/simd/neon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ where
191191
target_arch = "aarch64",
192192
any(test, all(feature = "std", feature = "simd"))
193193
))]
194-
macro_rules! clear_neon_registers_for_test_prototype {
194+
macro_rules! clear_neon_registers_after_encode_block {
195195
() => {{
196196
// SAFETY: This cleanup is expanded directly inside the block encoder
197197
// after it stores its output. There is no separate helper frame whose
@@ -304,7 +304,7 @@ where
304304

305305
let encoded = encode_standard_family_indices_neon::<A>(indices);
306306
vst1q_u8(output.as_mut_ptr(), encoded);
307-
clear_neon_registers_for_test_prototype!();
307+
clear_neon_registers_after_encode_block!();
308308
}
309309
crate::wipe_bytes(&mut staged);
310310
}

src/simd/x86/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ where
237237
crate::wipe_bytes(&mut staged);
238238
}
239239

240-
#[allow(dead_code, reason = "inactive prototype is not dispatchable yet")]
241240
#[expect(
242241
clippy::cast_ptr_alignment,
243242
reason = "_mm256_storeu_si256 accepts unaligned pointers"

0 commit comments

Comments
 (0)