Skip to content

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

Description

@bartlomieju

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[...]_<target>.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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions