Skip to content

Clean up unused compiler IR definitions - #8551

Merged
cknitt merged 8 commits into
rescript-lang:masterfrom
cknitt:codex/cleanup-js-ir
Aug 16, 2026
Merged

Clean up unused compiler IR definitions#8551
cknitt merged 8 commits into
rescript-lang:masterfrom
cknitt:codex/cleanup-js-ir

Conversation

@cknitt

@cknitt cknitt commented Aug 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove the unused legacy integer-operator representation and its printer helpers.
  • Remove unused used-stats, expression, and statement helpers, and stop exporting helpers that are private to Js_exp_make.
  • Remove dead JavaScript IR declarations, including the unused binary Bnot constructor and obsolete type aliases.
  • Remove unobserved metadata from Length and Array expressions and the unnecessary optional argument representation from New expressions.
  • Remove ignored mutability payloads from the ML Lambda array and mutable-list primitives, along with the obsolete conversion FIXMEs.
  • Remove unused mutability from record-field debug metadata.
  • Update the generated JavaScript IR visitors for the simplified representation.
  • Remove stale commented-out scaffolding and consolidate the duplicate Js_arr helpers into Js_of_lam_array.
  • Simplify the JavaScript block-construction wrapper while retaining the cached core Pmakeblock mutability used by optimizer patterns.

Why

The exponentiation precedence investigation exposed definitions and metadata left behind by earlier compiler changes. Keeping them makes the compiler IRs appear to support distinctions and operations that are never constructed or observed.

The cleanup deliberately retains meaningful mutability information. Core Pmakeblock caches mutability derived at the ML-to-core boundary because many optimizer passes pattern-match on it. JavaScript Caml_block also distinguishes mutable list cells, immutable blocks, and constant blocks that should not be flattened.

This cleanup does not change generated JavaScript. It narrows the IR and helper interfaces to the states and operations the compiler actually uses.

Validation

  • make test
  • make checkformat
  • git diff --check

@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.50980% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.88%. Comparing base (932ab67) to head (e9d59d1).

Files with missing lines Patch % Lines
compiler/core/js_exp_make.ml 42.85% 8 Missing ⚠️
compiler/core/js_dump.ml 77.77% 2 Missing ⚠️
compiler/ml/printlambda.ml 0.00% 2 Missing ⚠️
compiler/core/lam_convert.ml 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8551      +/-   ##
==========================================
+ Coverage   74.84%   74.88%   +0.04%     
==========================================
  Files         477      476       -1     
  Lines       63331    63269      -62     
==========================================
- Hits        47398    47382      -16     
+ Misses      15933    15887      -46     
Files with missing lines Coverage Δ
compiler/core/j.ml 100.00% <ø> (ø)
compiler/core/js_analyzer.ml 82.89% <100.00%> (ø)
compiler/core/js_of_lam_array.ml 100.00% <100.00%> (ø)
compiler/core/js_of_lam_block.ml 88.88% <100.00%> (-0.59%) ⬇️
compiler/core/js_op_util.ml 89.28% <100.00%> (+32.96%) ⬆️
compiler/core/js_record_fold.ml 87.11% <100.00%> (-0.39%) ⬇️
compiler/core/js_record_iter.ml 93.75% <100.00%> (-0.06%) ⬇️
compiler/core/js_record_map.ml 93.97% <100.00%> (-0.08%) ⬇️
compiler/core/js_stmt_make.ml 77.06% <ø> (-0.21%) ⬇️
compiler/core/lam_compat.ml 40.00% <ø> (ø)
... and 8 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Aug 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8551

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8551

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8551

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8551

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8551

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8551

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8551

commit: e9d59d1

@cknitt cknitt changed the title Clean up unused JavaScript IR definitions Clean up unused compiler IR definitions Aug 15, 2026
cknitt added 8 commits August 15, 2026 18:11
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt force-pushed the codex/cleanup-js-ir branch from 508ce9b to e9d59d1 Compare August 15, 2026 16:12
@cknitt
cknitt marked this pull request as ready for review August 15, 2026 16:13
@cknitt
cknitt requested a review from cristianoc August 15, 2026 16:48

@cristianoc cristianoc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup!

@cknitt
cknitt merged commit 1beb54d into rescript-lang:master Aug 16, 2026
29 checks passed
@cknitt
cknitt deleted the codex/cleanup-js-ir branch August 16, 2026 17:18
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