Semantic Diff

#9480 Remove -bs-cross-module-opt

1 commit

ac21673cb0f752a701e930ae973bbf4cbf98e551..pr-9480

7cc0465ba · cknitt + Claude · Nov 29, 2026, 09:11 UTC

Remove -bs-cross-module-opt

Why

Since @inline functions are inlined in every module, the flag only added an internal heuristic: with it, every closed function under size 5 and every closed functor was inlined into other modules, annotated or not. Only the runtime and Belt set it, plus a few tests. It was always internal, so it is removed with its -bs-no-cross-module-opt partner: bsc now reports both as unknown options. This is PR 7 of the plan in #8733 (proposal 4).

modifiedRepresentation which bodies a .cmj stores

mapping
Before Lam_stats_export.values_of_export, Js_cmj_format.get_result
After Lam_stats_export.values_of_export
true, false, null, undefined ↦ alwaystrue, false, null, undefined ↦ always@inline function or functor ↦ always@inline function or functor ↦ alwaysother closed function under size 5, closed functor ↦ with -bs-cross-module-optanything else ↦ never

modifiedJS the runtime, built without the flag

// Stdlib_Uint8Array.resinclude Stdlib_TypedArray.Impl({ … })
js
Before Stdlib_Uint8Array.mjs without the flag, before @inline on Impl
After Stdlib_Uint8Array.mjs, as with the flag
import * as Stdlib_TypedArray from "./Stdlib_TypedArray.mjs"; Stdlib_TypedArray.Impl({});let Constants = {}; ……/* Not a pure module *//* No side effect */

Review

  • What did the runtime lose without the flag? Three things, now @inline: Primitive_option.isNested, Stdlib_JsError.panic and the Stdlib_TypedArray.Impl functor. With them, the runtime's and Belt's JavaScript is the same as with the flag. Of the tests, only DocTest changes: JsError.panic is inlined there now.
  • Do the cross-module inlining tests still inline? Yes. Their libraries used the flag; minus3, callNext and the Make functor are now @inline, and their outputs differ only in source locations.
  • What else goes with the flag? Lam_analysis.safe_to_inline, which only the heuristic used, two runtime comments saying the runtime needs the flag, and the flag in the wording of the unreleased changelog entry for #9424.