denoland / denoland/rusty_v8

Refactor simdutf into a separate composable archive to remove it as a build-matrix axis

Open
#1,997 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.9k
Forks
418
Avg merge
1d 20h
Merged PRs (30d)
6

Description

## Problem

Every compile-time option that changes the published static library has to
become a dimension of the CI build matrix, because we ship one monolithic
`librusty_v8[...]_.a` per feature combination. As we add more
optional features (for example the `no_icu` variant in #1996), the number
of archives we build and publish grows.

Some of these axes are irreducible: `v8_enable_pointer_compression` and
`v8_enable_i18n_support` are deep V8 compile flags woven through V8's core
ABI, so they fundamentally require separate full builds.

`simdutf` is different, and could be made composable.

## Why simdutf can be separated

- simdutf is already a discrete GN static library target
(`//third_party/simdutf:simdutf`).
- Only the binding functions that call into it are folded into the main
`librusty_v8.a`, gated by the `RUSTY_V8_ENABLE_SIMDUTF` define (see the
`#ifdef RUSTY_V8_ENABLE_SIMDUTF` section in `src/binding.cc`).

If those binding functions were compiled into their own small static
library (for example `librusty_v8_simdutf.a`) and published as a separate
artifact, the main archive would no longer reference simdutf at all.
Consumers that want simdutf would link the extra archive; consumers that
do not would link only the base archive. simdutf would then stop being a
matrix axis entirely.

## Sketch

- Move the simdutf binding section out of `src/binding.cc` into its own
translation unit compiled by a dedicated GN `static_library` target.
- Publish the resulting archive as a separate artifact (no `_simdutf`
suffix permutations on the main archive).
- In `build.rs`, emit an extra `cargo:rustc-link-lib`/search directive for
the simdutf archive when the `simdutf` feature is enabled, instead of
selecting a different main archive.

## Caveats

- This only removes the simdutf axis. `ptrcomp` and `i18n` remain separate
full builds because they change V8's core ABI and cannot be linked in
as add-ons.
- Needs care around symbol visibility and `complete_static_lib` so the two
archives compose cleanly across platforms (including the Windows `.lib`).

Context: came up while adding the `no_icu` feature (#1996), where the slim
deno build needs `simdutf + no_icu`. Today that is a specific combined
archive; with this refactor it would be base + no_icu plus the standalone
simdutf archive.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the RUSTY_V8_ENABLE_SIMDUTF section in src/binding.cc, the //third_party/simdutf:simdutf GN target, and feature/archive selection in build.rs. Trace how static libraries are published on supported platforms. Done means a standalone simdutf archive is published, the main archive has no simdutf references, and the enabled Rust feature links the extra archive across Unix and Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
build-system
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.