feat: expose simdutf bindings behind cargo feature#1928
feat: expose simdutf bindings behind cargo feature#1928bartlomieju wants to merge 3 commits intomainfrom
Conversation
V8 bundles simdutf (SIMD-accelerated Unicode validation/transcoding), but consumers like deno_core can't use a separate simdutf Rust crate alongside rusty_v8 due to C++ symbol clashes. This exposes the bundled simdutf API through rusty_v8 behind a `simdutf` cargo feature flag. Changes: - Cargo.toml: add `simdutf` feature - BUILD.gn: conditionally link simdutf dep and define RUSTY_V8_ENABLE_SIMDUTF - build.rs: wire cargo feature to GN arg, add to prebuilt suffix - binding.cc: add ~250 lines of extern "C" wrappers for simdutf functions (validation, conversion, length calculation, base64), gated by preprocessor - simdutf.rs: safe Rust API wrapping all exposed simdutf operations - lib.rs: register simdutf module behind cfg(feature) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a604a0d to
6051898
Compare
kajukitli
left a comment
There was a problem hiding this comment.
not comfortable approving this as-is
biggest issue: the new simdutf feature changes the prebuilt artifact suffix (_simdutf) but the PR doesn't show any corresponding prebuilt artifacts being produced/published. that means consumers enabling the cargo feature will miss the prebuilt binary and fall back to source builds, or just break depending on how they're consuming rusty_v8.
for rusty_v8, feature-gated native code isn't just a Rust API change — it changes the binary compatibility matrix. if we add _simdutf to prebuilt_features_suffix(), we need the release/build pipeline to actually produce those artifacts too.
also, the test plan is still basically unchecked for the important parts (cargo build --features simdutf, no-clash verification, builds without feature, etc). for a 1k+ line FFI surface, that's too hand-wavy.
kajukitli
left a comment
There was a problem hiding this comment.
not comfortable approving this as-is
biggest issue: the new simdutf feature changes the prebuilt artifact suffix (_simdutf) but the PR doesn't show any corresponding prebuilt artifacts being produced/published. that means consumers enabling the cargo feature will miss the prebuilt binary and fall back to source builds, or just break depending on how they're consuming rusty_v8.
for rusty_v8, feature-gated native code isn't just a Rust API change — it changes the binary compatibility matrix. if we add _simdutf to prebuilt_features_suffix(), we need the release/build pipeline to actually produce those artifacts too.
also, the test plan is still basically unchecked for the important parts (cargo build --features simdutf, no-clash verification, builds without feature, etc). for a 1k+ line FFI surface, that's too hand-wavy.
…ests - Remove `_simdutf` from prebuilt_features_suffix() since no prebuilt artifacts are produced with simdutf. Instead, panic early with a helpful message if the simdutf feature is enabled without V8_FROM_SOURCE. - Add tests/test_simdutf.rs with comprehensive tests covering validation, UTF-8/UTF-16/UTF-32/Latin-1 conversion round-trips, length calculation, counting, encoding detection, and base64 encode/decode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of requiring V8_FROM_SOURCE for simdutf, add CI matrix entries to build and publish prebuilt binaries with the simdutf feature enabled. This mirrors the existing pattern used for v8_enable_pointer_compression. Adds debug+release builds for: x86_64-apple-darwin, aarch64-apple-darwin, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
simdutfcargo feature flagWhat's included
Design
simdutfcargo feature →rusty_v8_enable_simdutfGN arg →RUSTY_V8_ENABLE_SIMDUTFpreprocessor guardextern "C"wrappers inbinding.cc(follows existingv8__/cppgc__naming withsimdutf__prefix)src/simdutf.rs— validation/length functions are safe, conversion functions areunsafe(caller provides output buffer)_simdutfprebuilt artifacts (mirroring the_ptrcomppattern), so consumers can use--features simdutfwithoutV8_FROM_SOURCETest plan
tests/test_simdutf.rscover:_simdutfartifacts for all major targets🤖 Generated with Claude Code