Skip to content

refactor(minifier): merge persistent symbol metadata#24639

Merged
graphite-app[bot] merged 1 commit into
mainfrom
codex/minifier-persistent-symbol-metadata
Jul 18, 2026
Merged

refactor(minifier): merge persistent symbol metadata#24639
graphite-app[bot] merged 1 commit into
mainfrom
codex/minifier-persistent-symbol-metadata

Conversation

@Dunqing

@Dunqing Dunqing commented Jul 18, 2026

Copy link
Copy Markdown
Member

Pure-call summaries and member-write effects used separate sparse hash maps even though both are keyed by SymbolId and remain valid across peephole iterations.

This stores both values in one PersistentSymbolMetadata entry. Summary replacement and monotone member-effect strengthening remain independent, and clearing a dynamic-binding summary updates an existing entry without allocating or discarding its member effect.

The regenerated allocation snapshot records fewer system allocations: checker 155→152, pdf 2469→2467, antd 1044→1038, and kitchen-sink 1872→1867. minsize.snap remains byte-identical.

The PR tip passed the full oxc_minifier suite independently. The completed stack also passed clippy with warnings denied, formatting, minsize and allocation regeneration, and just ready.

Stack

  1. fix(minifier): avoid stale pure function summaries #24636 — function-summary correctness
  2. refactor(minifier): model symbol effects explicitly #24637 — explicit symbol effect types
  3. refactor(minifier): group symbol reference counts #24638 — grouped reference counts
  4. refactor(minifier): merge persistent symbol metadata #24639 — merged persistent metadata
  5. refactor(minifier): group symbol state #24640 — SymbolState facade

Implemented with AI assistance (OpenAI Codex). The contributor remains responsible for reviewing, understanding, and submitting the changes under the repository AI usage policy.

Dunqing commented Jul 18, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq

codspeed-hq Bot commented Jul 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 57 untouched benchmarks
⏩ 19 skipped benchmarks1


Comparing codex/minifier-persistent-symbol-metadata (b38c502) with codex/minifier-reference-counts (97edfe3)2

Open in CodSpeed

Footnotes

  1. 19 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on codex/minifier-reference-counts (a988cf9) during the generation of this report, so 79cc4b8 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Dunqing
Dunqing force-pushed the codex/minifier-persistent-symbol-metadata branch from 327de79 to baf8949 Compare July 18, 2026 07:11
@Dunqing
Dunqing force-pushed the codex/minifier-reference-counts branch from 1152440 to 51bc9a5 Compare July 18, 2026 07:11
@Dunqing Dunqing added the run-monitor-oxc Add to a PR to dispatch oxc-project/monitor-oxc CI against it label Jul 18, 2026
@oxc-guard

oxc-guard Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

@oxc-guard oxc-guard Bot removed the run-monitor-oxc Add to a PR to dispatch oxc-project/monitor-oxc CI against it label Jul 18, 2026
@Dunqing
Dunqing force-pushed the codex/minifier-reference-counts branch from 51bc9a5 to 97edfe3 Compare July 18, 2026 15:38
@Dunqing
Dunqing force-pushed the codex/minifier-persistent-symbol-metadata branch 2 times, most recently from 00f1815 to b38c502 Compare July 18, 2026 16:25
@Dunqing
Dunqing force-pushed the codex/minifier-reference-counts branch from 97edfe3 to a988cf9 Compare July 18, 2026 16:25
@graphite-app graphite-app Bot added the 0-merge Merge with Graphite Merge Queue label Jul 18, 2026
@graphite-app

graphite-app Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Merge activity

Pure-call summaries and member-write effects used separate sparse hash maps even though both are keyed by `SymbolId` and remain valid across peephole iterations.

This stores both values in one `PersistentSymbolMetadata` entry. Summary replacement and monotone member-effect strengthening remain independent, and clearing a dynamic-binding summary updates an existing entry without allocating or discarding its member effect.

The regenerated allocation snapshot records fewer system allocations: checker 155→152, pdf 2469→2467, antd 1044→1038, and kitchen-sink 1872→1867. `minsize.snap` remains byte-identical.

The PR tip passed the full `oxc_minifier` suite independently. The completed stack also passed clippy with warnings denied, formatting, minsize and allocation regeneration, and `just ready`.

## Stack

1. #24636 — function-summary correctness
2. #24637 — explicit symbol effect types
3. #24638 — grouped reference counts
4. **#24639 — merged persistent metadata**
5. #24640 — SymbolState facade

Implemented with AI assistance (OpenAI Codex). The contributor remains responsible for reviewing, understanding, and submitting the changes under the repository AI usage policy.
graphite-app Bot pushed a commit that referenced this pull request Jul 18, 2026
Pure-function summaries trusted resolved read and write references, but redeclarations, direct `eval`, and classic Script globals can replace a binding without producing such a reference. A later call could therefore be folded according to an earlier empty declaration and lose runtime side effects.

## Example

```js
function foo() {}
eval("foo = () => side_effect()")
foo()
```

Bindings with redeclarations, bindings visible to direct eval, and classic Script-root bindings do not receive a reusable summary; the eval restriction is intentionally non-sticky so removing the final eval can enable the optimization in a later pass. Module and CommonJS bindings retain the existing fold.

The PR tip passed the full `oxc_minifier` suite independently. The completed stack also passed clippy with warnings denied, formatting, minsize and allocation regeneration, and `just ready`.

## Stack

1. **#24636 — function-summary correctness**
2. #24637 — explicit symbol effect types
3. #24638 — grouped reference counts
4. #24639 — merged persistent metadata
5. #24640 — SymbolState facade

Implemented with AI assistance (OpenAI Codex). The contributor remains responsible for reviewing, understanding, and submitting the changes under the repository AI usage policy.
graphite-app Bot pushed a commit that referenced this pull request Jul 18, 2026
Pure-call summaries and member-write hazards encoded semantic states through nested `Option` values and independent bitflags. Reviewers had to reconstruct which combinations were valid and which implications producers must maintain.

This introduces `FunctionSummary` for reusable call proofs and an ordered `MemberWriteEffect` for `None < Hazard < MayMutatePrototype`. Prototype mutation is therefore hazardous by construction, the removed bitflag dependency is no longer needed, and producers and consumers share named contracts. Behavior is unchanged relative to #24636.

The PR tip passed the full `oxc_minifier` suite independently. The completed stack also passed clippy with warnings denied, formatting, minsize and allocation regeneration, and `just ready`.

## Stack

1. #24636 — function-summary correctness
2. **#24637 — explicit symbol effect types**
3. #24638 — grouped reference counts
4. #24639 — merged persistent metadata
5. #24640 — SymbolState facade

Implemented with AI assistance (OpenAI Codex). The contributor remains responsible for reviewing, understanding, and submitting the changes under the repository AI usage policy.
@graphite-app
graphite-app Bot force-pushed the codex/minifier-reference-counts branch from a988cf9 to db06764 Compare July 18, 2026 16:53
graphite-app Bot pushed a commit that referenced this pull request Jul 18, 2026
`SymbolValue` exposed three related counters directly, so every consumer had to coordinate read, write, and member-write-target invariants itself.

This groups them in `ReferenceCounts` and exposes factual queries such as `has_single_read` and `has_only_member_write_target_reads`. The existing 48-byte `SymbolValue` layout is preserved, and the refactor does not change minified output.

The PR tip passed the full `oxc_minifier` suite independently. The completed stack also passed clippy with warnings denied, formatting, minsize and allocation regeneration, and `just ready`.

## Stack

1. #24636 — function-summary correctness
2. #24637 — explicit symbol effect types
3. **#24638 — grouped reference counts**
4. #24639 — merged persistent metadata
5. #24640 — SymbolState facade

Implemented with AI assistance (OpenAI Codex). The contributor remains responsible for reviewing, understanding, and submitting the changes under the repository AI usage policy.
@graphite-app
graphite-app Bot force-pushed the codex/minifier-persistent-symbol-metadata branch from b38c502 to 7492af4 Compare July 18, 2026 16:54
graphite-app Bot pushed a commit that referenced this pull request Jul 18, 2026
`MinifierState` separately exposed dense per-pass values, sparse persistent metadata, and optional reachability state even though all three are indexed by semantic symbols. Its private-member stack also used symbol terminology despite storing names rather than `SymbolId`s.

This introduces a `SymbolState` facade that documents the three storage lifecycles and forwards their operations while leaving the reachability algorithm in its dedicated module. The class-local tracker is renamed around private-member usage so it cannot be confused with semantic symbol state.

The PR tip passed the full `oxc_minifier` suite independently. The completed stack also passed clippy with warnings denied, formatting, minsize and allocation regeneration, and `just ready`.

## Stack

1. #24636 — function-summary correctness
2. #24637 — explicit symbol effect types
3. #24638 — grouped reference counts
4. #24639 — merged persistent metadata
5. **#24640 — SymbolState facade**

Implemented with AI assistance (OpenAI Codex). The contributor remains responsible for reviewing, understanding, and submitting the changes under the repository AI usage policy.
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jul 18, 2026
Base automatically changed from codex/minifier-reference-counts to main July 18, 2026 16:59
@graphite-app
graphite-app Bot merged commit 7492af4 into main Jul 18, 2026
31 checks passed
@graphite-app
graphite-app Bot deleted the codex/minifier-persistent-symbol-metadata branch July 18, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant