Skip to content

build: WebKit bump for bytecode-cache source-string fix#29506

Draft
dylan-conway wants to merge 5 commits into
mainfrom
claude/webkit-bytecode-cache-skip-source-string
Draft

build: WebKit bump for bytecode-cache source-string fix#29506
dylan-conway wants to merge 5 commits into
mainfrom
claude/webkit-bytecode-cache-skip-source-string

Conversation

@dylan-conway

Copy link
Copy Markdown
Member

Summary

Pins WebKit to the preview build of oven-sh/WebKit#186 so CI can run against it.

That PR stops CachedStringSourceProvider from encoding the bundled source text into the bytecode cache and from heap-allocating a copy of it during decode. Under BUN_JSC_ADDITIONS, SourceCodeKey::operator== already skips the source-bytes comparison, so the encoded copy was never read — but it was still:

  • written verbatim into every .jsc blob (≈15-18% of the file)
  • heap-allocated as an AtomStringImpl during decodeCodeBlockImpl
  • pinned by a Decoder finalizer for the lifetime of every UnlinkedFunctionExecutable with a lazy body — i.e. effectively process-lifetime, since cold functions in the bundle never drop their m_decoder ref

The source bytes that runtime features (Function.prototype.toString, Error.stack, lazy-reparse) read are unaffected: they come from ScriptExecutable::m_source → the runtime ZigSourceProvider, which is a separate object set before decodeCodeBlock runs.

Cross-version .jsc files self-invalidate via m_cacheVersion = hash(BUN_WEBKIT_VERSION), which changes with this pin.

Draft: the version string is a preview tag; will be replaced with the merged commit hash once oven-sh/WebKit#186 lands.

Test plan

  • CI green
  • test/bundler/bundler_compile.test.ts 54/54 (release, local-WebKit)
  • test/bundler/bundler_banner.test.ts 11/11
  • test/bundler/bun-build-api.test.ts -t bytecode 1/1
  • Debug-local (assertions on): Function.prototype.toString, Error.stack, nested-lazy-decode, async, eval, new Function all pass with [Disk Cache] Cache hit
  • Old-format .jsc (system bun) + new decoder → [Disk Cache] Cache miss, falls back to parse, output correct

Pulls in the CachedTypes change that stops encoding the bundled source
text into CachedSourceCodeKey. Under BUN_JSC_ADDITIONS the
SourceCodeKey::operator== string comparison is already skipped, so the
encoded source bytes were never read — but they were still written into
every .jsc blob and heap-allocated as an AtomStringImpl during
decodeCodeBlockImpl, then pinned by a Decoder finalizer for the lifetime
of every UnlinkedFunctionExecutable with a lazy body.

Preview pin so CI can run the full test suite against the WebKit change
before it merges; will be replaced with the real commit hash once #186
lands.
@robobun

robobun commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator
Updated 10:27 PM PT - Apr 20th, 2026

@dylan-conway, your commit e10b48d has 4 failures in Build #46693 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 29506

That installs a local version of the PR into your bun-29506 executable, so you can run:

bun-29506 --bun

@github-actions

Copy link
Copy Markdown
Contributor

Found 1 issue this PR may fix:

  1. When compile into single executable file, this file contaims many garbage code #19498 - PR stops encoding bundled source text into .jsc bytecode cache files, which directly addresses the reported plaintext JS/CSS source visible in compiled executables

If this is helpful, copy the block below into the PR description to auto-close this issue on merge.

Fixes #19498

🤖 Generated with Claude Code

The first test asserts on stdout before stderr/exitCode, so when the
child fails the diff shows only stdout="" with no diagnostic. Collapse
the three assertions into one toEqual on {stdout, stderr, exitCode,
signalCode} so a CI failure prints what the child actually wrote.

Behaviour-only test change; the spawn and inputs are unchanged.
`bun run build:ci` (profile=ci-release, mode=full, ci=true) was failing
with -Wundefined-var-template on JSGenericTypedArrayView::s_info because
the PCH was being skipped. The PCH wrapper applies #pragma clang
system_header to JSC includes, which is the only thing suppressing that
warning (template static defined in JSC's .cpp, linker resolves).

The previous predicate (`!cfg.ci || cfg.mode === "cpp-only"`) only worked
because real CI uses the split cpp-only/zig-only/link-only profiles, where
cpp-only kept PCH on and the others don't compile C++. The full+ci
combination — which is what build:ci and `--ci=on` produce locally — fell
through to no PCH.

Gate on mode instead: PCH for "full" and "cpp-only", off for Windows.
Stops encoding source text into CachedSourceCodeKey under
BUN_JSC_ADDITIONS — the decoded key only feeds SourceCodeKey::operator==
which already skips the byte comparison there. Removes a per-chunk
~source_size AtomStringImpl heap allocation at decode and the matching
bytes from each .jsc on disk.
@dylan-conway dylan-conway changed the title build: WebKit bump for bytecode-cache source-string fix (preview) build: WebKit bump for bytecode-cache source-string fix Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants