Skip to content

refactor(link_stage): detach depended_runtime_helper from EcmaView to remove unsafe#9265

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-29-fix_avoid_unsafe_in_reference_needed_symbols
Apr 30, 2026
Merged

refactor(link_stage): detach depended_runtime_helper from EcmaView to remove unsafe#9265
graphite-app[bot] merged 1 commit intomainfrom
04-29-fix_avoid_unsafe_in_reference_needed_symbols

Conversation

@IWANABETHATGUY
Copy link
Copy Markdown
Member

@IWANABETHATGUY IWANABETHATGUY commented Apr 29, 2026

Summary

Lift the per-module depended_runtime_helper map out of EcmaView into a parallel IndexVec<ModuleIdx, Box<DependedRuntimeHelperMap>> on LinkStage. This lets reference_needed_symbols mutate the map through a safe par_iter_mut().zip(...) pipeline instead of casting away & via addr_of!, eliminating the second remaining unsafe block in that pass.

related to #9242, which removed the analogous unsafe for stmt_infos.

Changes

  • Add depended_runtime_helper field on LinkStage and initialize it alongside the module table.
  • Remove depended_runtime_helper from EcmaView and its two construction sites (ecma_module_view_factory, runtime_module_task).
  • reference_needed_symbols: zip the new field into the parallel walk; drop the unsafe { &mut *addr_of!(importer.depended_runtime_helper).cast_mut() } block.
  • include_statements: read the map from its new home via a parallel zip.

Copy link
Copy Markdown
Member Author

IWANABETHATGUY commented Apr 29, 2026


How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready to this PR to add it to 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.

@IWANABETHATGUY IWANABETHATGUY force-pushed the 04-29-docs_reference_needed_symbols branch from 8b5ffdd to fb5d22e Compare April 29, 2026 12:23
@IWANABETHATGUY IWANABETHATGUY force-pushed the 04-29-fix_avoid_unsafe_in_reference_needed_symbols branch from 63f514d to bf0f22f Compare April 29, 2026 12:23
@graphite-app graphite-app Bot force-pushed the 04-29-docs_reference_needed_symbols branch from fb5d22e to 54f5bef Compare April 29, 2026 13:03
@graphite-app graphite-app Bot force-pushed the 04-29-fix_avoid_unsafe_in_reference_needed_symbols branch from bf0f22f to 77f7a0e Compare April 29, 2026 13:03
@IWANABETHATGUY IWANABETHATGUY force-pushed the 04-29-docs_reference_needed_symbols branch from 54f5bef to 703195f Compare April 29, 2026 15:46
@IWANABETHATGUY IWANABETHATGUY force-pushed the 04-29-fix_avoid_unsafe_in_reference_needed_symbols branch from 77f7a0e to 1a9891f Compare April 29, 2026 15:46
@graphite-app graphite-app Bot force-pushed the 04-29-docs_reference_needed_symbols branch 2 times, most recently from 119d78c to 30538df Compare April 29, 2026 16:02
@graphite-app graphite-app Bot force-pushed the 04-29-fix_avoid_unsafe_in_reference_needed_symbols branch from 1a9891f to 32ec354 Compare April 29, 2026 16:02
@IWANABETHATGUY IWANABETHATGUY force-pushed the 04-29-docs_reference_needed_symbols branch from 30538df to 0ef96a7 Compare April 29, 2026 16:20
@IWANABETHATGUY IWANABETHATGUY force-pushed the 04-29-fix_avoid_unsafe_in_reference_needed_symbols branch 3 times, most recently from 568bc9a to a7e5cbd Compare April 30, 2026 03:52
@graphite-app graphite-app Bot changed the base branch from 04-29-docs_reference_needed_symbols to graphite-base/9265 April 30, 2026 04:59
@graphite-app graphite-app Bot force-pushed the 04-29-fix_avoid_unsafe_in_reference_needed_symbols branch from a7e5cbd to 1871b1d Compare April 30, 2026 05:03
@graphite-app graphite-app Bot force-pushed the graphite-base/9265 branch from 9d8a01c to 5eecace Compare April 30, 2026 05:03
@graphite-app graphite-app Bot changed the base branch from graphite-base/9265 to main April 30, 2026 05:04
@graphite-app graphite-app Bot force-pushed the 04-29-fix_avoid_unsafe_in_reference_needed_symbols branch from 1871b1d to fbb45af Compare April 30, 2026 05:04
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 4672704
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/69f2eda03b5cef000921dfc2

@IWANABETHATGUY IWANABETHATGUY changed the title u refactor(link_stage): detach depended_runtime_helper from EcmaView to remove unsafe Apr 30, 2026
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review April 30, 2026 05:45
Copy link
Copy Markdown
Member Author

IWANABETHATGUY commented Apr 30, 2026

Merge activity

  • Apr 30, 5:49 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Apr 30, 5:49 AM UTC: IWANABETHATGUY added this pull request to the Graphite merge queue.
  • Apr 30, 5:54 AM UTC: Merged by the Graphite merge queue.

… remove unsafe (#9265)

## Summary

Lift the per-module `depended_runtime_helper` map out of `EcmaView` into a parallel `IndexVec<ModuleIdx, Box<DependedRuntimeHelperMap>>` on `LinkStage`. This lets `reference_needed_symbols` mutate the map through a safe `par_iter_mut().zip(...)` pipeline instead of casting away `&` via `addr_of!`, eliminating the second remaining `unsafe` block in that pass.

related to #9242, which removed the analogous unsafe for `stmt_infos`.

## Changes

- Add `depended_runtime_helper` field on `LinkStage` and initialize it alongside the module table.
- Remove `depended_runtime_helper` from `EcmaView` and its two construction sites (`ecma_module_view_factory`, `runtime_module_task`).
- `reference_needed_symbols`: zip the new field into the parallel walk; drop the `unsafe { &mut *addr_of!(importer.depended_runtime_helper).cast_mut() }` block.
- `include_statements`: read the map from its new home via a parallel zip.
@graphite-app graphite-app Bot force-pushed the 04-29-fix_avoid_unsafe_in_reference_needed_symbols branch from fbb45af to 4672704 Compare April 30, 2026 05:50
@graphite-app graphite-app Bot merged commit 4672704 into main Apr 30, 2026
33 checks passed
@graphite-app graphite-app Bot deleted the 04-29-fix_avoid_unsafe_in_reference_needed_symbols branch April 30, 2026 05:54
This was referenced May 6, 2026
@shulaoda shulaoda mentioned this pull request May 7, 2026
shulaoda added a commit that referenced this pull request May 7, 2026
## [1.0.0] - 2026-05-07

### 🐛 Bug Fixes

- dev/lazy: lazily compiled modules should be watched (#9301) by @h-a-n-a
- implement dynamic dominator merge logic (#9270) by @TheAlexLichter
- dev: apply __toCommonJS interop when CJS requires ESM in HMR finalizer (#9261) by @h-a-n-a

### 🚜 Refactor

- ecma_ast: tighten allocator access to enforce Sync invariant (#9278) by @IWANABETHATGUY
- scan_stage: remove stmt_infos field from EcmaView (#9276) by @IWANABETHATGUY
- link_stage: detach stmt_infos from EcmaView (#9274) by @IWANABETHATGUY
- link_stage: detach depended_runtime_helper from EcmaView to remove unsafe (#9265) by @IWANABETHATGUY
- link_stage: remove unsafe in determine_module_exports_kind (#9253) by @IWANABETHATGUY

### 📚 Documentation

- getting-started: remove RC warning for 1.0.0 release (#9310) by @shulaoda
- getting-started: update version references for 1.0.0 release (#9309) by @shulaoda
- add Vite+ tab to getting-started snippets (#9285) by @shulaoda
- lazy-barrel: clarify own-exports behavior for import-then-export records (#9298) by @shulaoda
- restructure top navigation around Learn vs Reference (#9284) by @shulaoda
- builtin-plugins: add bundle analyzer plugin docs (#9292) by @shulaoda
- design doc for reference_needed_symbols (#9264) by @IWANABETHATGUY

### ⚡ Performance

- devtools: write logs on a background thread (#9219) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- mark esbuild/ts/parameter_props_use_define_for_class_fields_true as passed (#9308) by @sapphi-red
- deps: upgrade oxc to 0.129.0 (#9297) by @shulaoda
- deps: update rollup submodule for tests to v4.60.3 (#9294) by @sapphi-red
- deps: update test262 submodule for tests (#9295) by @sapphi-red
- ai: add rolldown REPL decode skill (#9245) by @Dunqing
pull Bot pushed a commit to olrtg/rolldown that referenced this pull request May 7, 2026
## [1.0.0] - 2026-05-07

### 🐛 Bug Fixes

- dev/lazy: lazily compiled modules should be watched (rolldown#9301) by @h-a-n-a
- implement dynamic dominator merge logic (rolldown#9270) by @TheAlexLichter
- dev: apply __toCommonJS interop when CJS requires ESM in HMR finalizer (rolldown#9261) by @h-a-n-a

### 🚜 Refactor

- ecma_ast: tighten allocator access to enforce Sync invariant (rolldown#9278) by @IWANABETHATGUY
- scan_stage: remove stmt_infos field from EcmaView (rolldown#9276) by @IWANABETHATGUY
- link_stage: detach stmt_infos from EcmaView (rolldown#9274) by @IWANABETHATGUY
- link_stage: detach depended_runtime_helper from EcmaView to remove unsafe (rolldown#9265) by @IWANABETHATGUY
- link_stage: remove unsafe in determine_module_exports_kind (rolldown#9253) by @IWANABETHATGUY

### 📚 Documentation

- getting-started: remove RC warning for 1.0.0 release (rolldown#9310) by @shulaoda
- getting-started: update version references for 1.0.0 release (rolldown#9309) by @shulaoda
- add Vite+ tab to getting-started snippets (rolldown#9285) by @shulaoda
- lazy-barrel: clarify own-exports behavior for import-then-export records (rolldown#9298) by @shulaoda
- restructure top navigation around Learn vs Reference (rolldown#9284) by @shulaoda
- builtin-plugins: add bundle analyzer plugin docs (rolldown#9292) by @shulaoda
- design doc for reference_needed_symbols (rolldown#9264) by @IWANABETHATGUY

### ⚡ Performance

- devtools: write logs on a background thread (rolldown#9219) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- mark esbuild/ts/parameter_props_use_define_for_class_fields_true as passed (rolldown#9308) by @sapphi-red
- deps: upgrade oxc to 0.129.0 (rolldown#9297) by @shulaoda
- deps: update rollup submodule for tests to v4.60.3 (rolldown#9294) by @sapphi-red
- deps: update test262 submodule for tests (rolldown#9295) by @sapphi-red
- ai: add rolldown REPL decode skill (rolldown#9245) by @Dunqing

Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
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