Repository navigation
Remove -bs-cross-module-opt - #9480
Conversation
Changelog💥 Breaking Change
🐛 Bug fix
Semantic Diff1 commit · Full page Remove -bs-cross-module-opt7cc0465 · cknitt + Claude · Nov 29, 2026, 09:11 UTC
Representation modified (which bodies a .cmj stores)
true, false, null, undefined ↦ always
@inline function or functor ↦ always
-other closed function under size 5, closed functor ↦ with -bs-cross-module-opt
+anything else ↦ neverJS modified (the runtime, built without the flag) // Stdlib_Uint8Array.res
include Stdlib_TypedArray.Impl({ … })
-import * as Stdlib_TypedArray from "./Stdlib_TypedArray.mjs";
-
-Stdlib_TypedArray.Impl({});
+let Constants = {};
…
-/* Not a pure module */
+/* No side effect */
Review
|
|
| Benchmark | Base | Head | Change |
|---|---|---|---|
build/no-op |
9,347,453 | 10,893,262 | +16.54% |
build/leaf-edit |
12,080,269 | 13,626,187 | +12.80% |
build/shared-edit |
87,815,598 | 88,676,682 | +0.98% |
packages/@rescript/belt/src/Belt_Map.res (inputs changed) |
986,012 | 981,032 | -0.51% |
packages/@rescript/belt/src/Belt_Set.res (inputs changed) |
861,971 | 857,736 | -0.49% |
packages/@rescript/runtime/Stdlib_Generator.res (inputs changed) |
200,910 | 200,017 | -0.44% |
packages/@rescript/belt/src/Belt_MutableMapString.res (inputs changed) |
1,159,197 | 1,154,468 | -0.41% |
packages/@rescript/belt/src/Belt_MutableMapInt.res (inputs changed) |
1,158,916 | 1,154,189 | -0.41% |
packages/@rescript/runtime/Stdlib_Ordering.res (inputs changed) |
154,001 | 153,385 | -0.40% |
packages/@rescript/runtime/Primitive_module.res (inputs changed) |
338,469 | 337,202 | -0.37% |
62 more changes
| Benchmark | Base | Head | Change |
|---|---|---|---|
packages/@rescript/belt/src/Belt_Array.res (inputs changed) |
2,163,756 | 2,155,725 | -0.37% |
packages/@rescript/belt/src/Belt_MutableSetInt.res (inputs changed) |
1,668,978 | 1,662,857 | -0.37% |
packages/@rescript/belt/src/Belt_MutableSetString.res (inputs changed) |
1,670,217 | 1,664,103 | -0.37% |
packages/@rescript/runtime/Dom_storage.res (inputs changed) |
167,603 | 166,998 | -0.36% |
packages/@rescript/belt/src/Belt_MutableMap.res (inputs changed) |
1,306,699 | 1,302,107 | -0.35% |
packages/@rescript/runtime/Stdlib_AsyncGenerator.res (inputs changed) |
211,720 | 211,041 | -0.32% |
packages/@rescript/belt/src/Belt_MutableSet.res (inputs changed) |
1,906,866 | 1,900,871 | -0.31% |
packages/@rescript/runtime/Stdlib_Array.res (inputs changed) |
1,284,531 | 1,280,687 | -0.30% |
packages/@rescript/belt/src/Belt_Option.res (inputs changed) |
390,937 | 389,772 | -0.30% |
packages/@rescript/runtime/Stdlib_IterableIterator.res (inputs changed) |
179,435 | 178,912 | -0.29% |
packages/@rescript/runtime/Stdlib_AsyncIterableIterator.res (inputs changed) |
229,055 | 228,391 | -0.29% |
packages/@rescript/runtime/Primitive_array.res (inputs changed) |
192,806 | 192,256 | -0.29% |
packages/@rescript/runtime/Stdlib_Int.res (inputs changed) |
456,149 | 454,852 | -0.28% |
packages/@rescript/belt/src/Belt_MutableStack.res (inputs changed) |
389,160 | 388,072 | -0.28% |
packages/@rescript/belt/src/Belt_SortArray.res (inputs changed) |
1,452,650 | 1,448,739 | -0.27% |
packages/@rescript/belt/src/Belt_SortArrayString.res (inputs changed) |
1,348,646 | 1,345,170 | -0.26% |
packages/@rescript/belt/src/Belt_SortArrayInt.res (inputs changed) |
1,346,850 | 1,343,380 | -0.26% |
packages/@rescript/runtime/Stdlib_Result.res (inputs changed) |
1,272,049 | 1,268,910 | -0.25% |
packages/@rescript/runtime/Primitive_bool.res (inputs changed) |
147,831 | 147,472 | -0.24% |
packages/@rescript/belt/src/Belt_MutableQueue.res (inputs changed) |
794,116 | 792,242 | -0.24% |
packages/@rescript/runtime/Primitive_int.res (inputs changed) |
172,595 | 172,188 | -0.24% |
packages/@rescript/runtime/Primitive_bigint.res (inputs changed) |
178,069 | 177,662 | -0.23% |
packages/@rescript/runtime/Stdlib_Nullable.res (inputs changed) |
331,242 | 330,502 | -0.22% |
packages/@rescript/runtime/Stdlib_Null.res (inputs changed) |
333,743 | 333,003 | -0.22% |
packages/@rescript/runtime/Primitive_string.res (inputs changed) |
160,230 | 159,885 | -0.22% |
packages/@rescript/runtime/Stdlib_AsyncIterator.res (inputs changed) |
295,758 | 295,123 | -0.21% |
packages/@rescript/runtime/Stdlib_IteratorObject.res (inputs changed) |
251,232 | 250,705 | -0.21% |
packages/@rescript/belt/src/Belt_Result.res (inputs changed) |
411,207 | 410,356 | -0.21% |
packages/@rescript/runtime/Stdlib_Option.res (inputs changed) |
759,061 | 757,501 | -0.21% |
packages/@rescript/runtime/Stdlib_Iterator.res (inputs changed) |
235,789 | 235,310 | -0.20% |
packages/@rescript/runtime/Stdlib_Bool.res (inputs changed) |
146,591 | 146,296 | -0.20% |
packages/@rescript/runtime/Primitive_hash.res (inputs changed) |
965,782 | 963,858 | -0.20% |
packages/@rescript/runtime/Stdlib_Pair.res (inputs changed) |
165,847 | 165,531 | -0.19% |
packages/@rescript/runtime/Primitive_float.res (inputs changed) |
147,482 | 147,214 | -0.18% |
packages/@rescript/runtime/Stdlib_List.res (inputs changed) |
2,695,444 | 2,690,625 | -0.18% |
packages/@rescript/runtime/Stdlib_Lazy.res (inputs changed) |
222,047 | 221,656 | -0.18% |
packages/@rescript/belt/src/Belt_HashMapInt.res (inputs changed) |
1,064,116 | 1,062,330 | -0.17% |
packages/@rescript/belt/src/Belt_HashMapString.res (inputs changed) |
1,064,824 | 1,063,038 | -0.17% |
packages/@rescript/runtime/Stdlib_BigInt.res (inputs changed) |
207,637 | 207,297 | -0.16% |
packages/@rescript/belt/src/Belt_HashSetInt.res (inputs changed) |
853,288 | 851,906 | -0.16% |
packages/@rescript/belt/src/Belt_HashSetString.res (inputs changed) |
853,610 | 852,228 | -0.16% |
packages/@rescript/runtime/Stdlib_JsExn.res (inputs changed) |
173,900 | 173,621 | -0.16% |
packages/@rescript/belt/src/Belt_internalBucketsType.res (inputs changed) |
292,448 | 291,993 | -0.16% |
packages/@rescript/belt/src/Belt_HashMap.res (inputs changed) |
1,203,473 | 1,201,617 | -0.15% |
packages/@rescript/belt/src/Belt_internalSetBuckets.res (inputs changed) |
703,213 | 702,145 | -0.15% |
packages/@rescript/belt/src/Belt_HashSet.res (inputs changed) |
981,037 | 979,577 | -0.15% |
packages/@rescript/belt/src/Belt_List.res (inputs changed) |
3,187,375 | 3,182,676 | -0.15% |
packages/@rescript/belt/src/Belt_Id.res (inputs changed) |
290,989 | 290,570 | -0.14% |
packages/@rescript/belt/src/Belt_Range.res (inputs changed) |
289,597 | 289,195 | -0.14% |
packages/@rescript/runtime/Primitive_exceptions.res (inputs changed) |
201,840 | 201,574 | -0.13% |
packages/@rescript/belt/src/Belt_internalBuckets.res (inputs changed) |
971,403 | 970,123 | -0.13% |
packages/@rescript/runtime/Stdlib_String.res (inputs changed) |
504,706 | 504,065 | -0.13% |
packages/@rescript/runtime/Stdlib_Temporal_PlainMonthDay.res (inputs changed) |
268,707 | 268,380 | -0.12% |
packages/@rescript/runtime/Primitive_list.res (inputs changed) |
204,430 | 204,184 | -0.12% |
packages/@rescript/belt/src/Belt_internalAVLset.res (inputs changed) |
2,885,429 | 2,882,050 | -0.12% |
packages/@rescript/belt/src/Belt_internalAVLtree.res (inputs changed) |
3,514,124 | 3,510,171 | -0.11% |
packages/@rescript/runtime/Stdlib_Intl_NumberFormat_Grouping.res (inputs changed) |
159,893 | 159,721 | -0.11% |
packages/@rescript/runtime/Stdlib_Temporal_Instant.res (inputs changed) |
308,062 | 307,735 | -0.11% |
packages/@rescript/runtime/Primitive_object.res (inputs changed) |
1,158,852 | 1,157,633 | -0.11% |
packages/@rescript/runtime/Stdlib_Map.res (inputs changed) |
206,088 | 205,875 | -0.10% |
packages/@rescript/runtime/Stdlib_Temporal_PlainTime.res (inputs changed) |
320,724 | 320,397 | -0.10% |
packages/@rescript/runtime/Stdlib_Set.res (inputs changed) |
211,434 | 211,221 | -0.10% |
(inputs changed): this pull request changes runtime or Belt sources, so these benchmarks compile different code than on the base, and their changes don't count as regressions.
Instructions
In total: 9,226,257,585 → 9,225,535,582 (-0.01%).
| Benchmark | Base | Head | Change |
|---|---|---|---|
stress/InlineChain.res |
139,435,534 | 139,185,649 | -0.18% |
packages/@rescript/belt/src/Belt_List.res (inputs changed) |
118,363,111 | 118,224,909 | -0.12% |
packages/@rescript/belt/src/Belt_internalAVLtree.res (inputs changed) |
136,609,855 | 136,467,698 | -0.10% |
(inputs changed): this pull request changes runtime or Belt sources, so these benchmarks compile different code than on the base, and their changes don't count as regressions.
Output size
In total: 27,366,836 → 27,351,499 (-0.06%).
| Benchmark | Base | Head | Change |
|---|---|---|---|
output/belt/*.cmj (inputs changed) |
33,211 | 22,376 | -32.62% |
output/runtime/*.cmj (inputs changed) |
17,467 | 14,126 | -19.13% |
output/tests/*.cmj |
99,938 | 99,491 | -0.45% |
(inputs changed): this pull request changes runtime or Belt sources, so these benchmarks compile different code than on the base, and their changes don't count as regressions.
Pull request 7cc0465 compared with base fc9e0cf in this run.
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## warn-inline-not-stored #9480 +/- ##
==========================================================
- Coverage 82.47% 82.46% -0.02%
==========================================================
Files 466 466
Lines 66055 66029 -26
==========================================================
- Hits 54481 54448 -33
- Misses 11574 11581 +7
🚀 New features to boost your workflow:
|
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
b55d092 to
a130b27
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
a130b27 to
37c1bfe
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
37c1bfe to
fb74e15
Compare
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
fb74e15 to
c99daf1
Compare
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
c99daf1 to
e0a8fe0
Compare
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
e0a8fe0 to
7fa7e77
Compare
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
7fa7e77 to
bda0b78
Compare
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
bda0b78 to
3d980c5
Compare
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
3d980c5 to
9be7178
Compare
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).
Representation modified (which bodies a .cmj stores):
Before (mapping): Lam_stats_export.values_of_export, Js_cmj_format.get_result
true, false, null, undefined ↦ always
@inline function or functor ↦ always
other closed function under size 5, closed functor ↦ with -bs-cross-module-opt
After (mapping): Lam_stats_export.values_of_export
true, false, null, undefined ↦ always
@inline function or functor ↦ always
anything else ↦ never
JS modified (the runtime, built without the flag):
Example:
// Stdlib_Uint8Array.res
include Stdlib_TypedArray.Impl({ … })
Before (js): Stdlib_Uint8Array.mjs without the flag, before @inline on Impl
import * as Stdlib_TypedArray from "./Stdlib_TypedArray.mjs";
Stdlib_TypedArray.Impl({});
…
/* Not a pure module */
After (js): Stdlib_Uint8Array.mjs, as with the flag
let Constants = {};
…
/* 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.
Review: 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.
Review: 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.
Breaking: bsc rejects -bs-cross-module-opt and -bs-no-cross-module-opt
as unknown options; drop them from `compiler-flags`. Small functions and
functors are no longer inlined into other modules automatically; mark
the ones that should be with `@inline`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
9be7178 to
7cc0465
Compare
Why:
Since #9479, other modules inline `@inline` functions, but apart from
the nine Option helpers, the stdlib marked none, so every call to a
one-line wrapper such as `Array.reduce` stayed a call through the
wrapper. 72 functions are now `@inline`, chosen from the exported
functions whose bodies other modules can store:
- argument-reordering wrappers around externals: `Array.reduce` and its
variants, `Array.concatAll`, `Promise.catch`, the iterator and
generator `next` functions, `Dom_storage`, `Dict.delete`,
`BigInt.toInt`, `Bool.toString`;
- combinators that take a callback: `Null`, `Nullable` and `Result`
`map`, `flatMap`, `mapOr`, `getOr`, `forEach` and the like, `Result`,
`Pair` and `Date` `equal` and `compare`;
- the `…Opt` lookups of `Array` and `String`, `Array.last`, `isEmpty`
of `Array`, `String`, `Map` and `Set`, `List.add`, `head`, `tail`,
and the `Ordering` helpers.
`Int.Constants.minValue` and `maxValue` become `@inline` constants in
`Stdlib_Int.resi`.
JS modified (a caller of the stdlib):
Example:
let reversed = [1, 2, 3]->Array.reduce(list{}, List.add)
let last = [1, 2, 3]->Array.last
Before (js):
let reversed = Stdlib_Array.reduce([1, 2, 3], /* [] */0, Stdlib_List.add);
let last = Stdlib_Array.last([1, 2, 3]);
After (js):
let reversed = [1, 2, 3].reduce(Stdlib_List.add, /* [] */0);
let a = [1, 2, 3];
let last = a[a.length - 1 | 0];
JS modified (a Promise.catch handler):
Before (js):
Stdlib_Promise.$$catch(promise, e => { … });
After (js):
promise.catch(err => {
let e = Primitive_exceptions.internalToException(err);
…
});
Review: What was left out? Loops (`zip`, `partition`, `filterMap`,
`Option.all*`), parsers wrapped in `try`, async functions, and larger
functions such as `clamp`. Also functions whose inlined code came out
worse in the tests: every `…OrThrow` (a `throw` block at each call, without
a source position), `Lazy.make` and `isEvaluated` (the runtime's lazy
representation in every caller), `JsError.throwWithMessage` (its throw
site lost its source position), `Option.equal` and `compare`, `Null` and
`Nullable` `equal` and `compare`, and `JsExn.fromException` (larger, with
no simplification), and `Iterator.next` and `nextValue`, which use a
module-local helper. Belt is left for its own pass. `JsError.panic` stays
`@inline` (#9480), since without it the runtime's own JavaScript changes.
JS modified (the Int constants):
Example:
// Stdlib_Int.resi, in module Constants
@inline(-2147483648)
let minValue: int
Before (js): Stdlib_Int.mjs
let Constants = {
minValue: -2147483648,
maxValue: 2147483647
};
After (js): Stdlib_Int.mjs; other modules inline the constants
let Constants = {};
Review: How is a wrong `@inline` caught? Warning 113: the runtime builds
with warnings as errors, so a function other modules cannot inline fails
the build. The runtime's and Belt's own JavaScript is unchanged.
Breaking: JavaScript that reads `Int.Constants.minValue` or `maxValue`
from the runtime's `Stdlib_Int` module gets `undefined`; ReScript code
inlines them.
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Removes the internal
-bs-cross-module-optand-bs-no-cross-module-optflags. They were never meant for users, so bsc now rejects them as unknown options. This is PR 7 of the plan in #8733 (proposal 4).With
@inlinefunctions inlined in every module (#9479), the flag only added an internal heuristic: every closed function under size 5, and every closed functor, was inlined into other modules, annotated or not. Now a.cmjstores@inlinebodies and the four always-copied constants (true,false,null,undefined), and nothing else.Only the runtime and Belt set the flag. Without it, the runtime lost three inlinings, which are now
@inline:Primitive_option.isNested,Stdlib_JsError.panic, and theStdlib_TypedArray.Implfunctor. With them, the runtime's and Belt's JavaScript is the same as before.Tests:
tests/testsused the flag. Their library functions (minus3,callNext, theMakefunctor) are now@inline, and their outputs differ only in source locations.DocTestnow inlinesJsError.panic.The changelog entry is
breaking: projects that set the flag no longer get small functions inlined into other modules automatically.The benchmarks'
build/no-opandbuild/leaf-editgrow because of how they measure, not because of this PR. They compile the base branch's test sources with this PR's compiler. In the base, eight cross-module inlining tests still set-bs-cross-module-optin@@config; this PR removes those lines. This PR's compiler rejects the flag ("invalid flags for bsc", warning 22), and the build system compiles a module with warnings again on every build, so those eight files are compiled even in a build with nothing to do. Belt's and the runtime's.cmjfiles shrink (-33%, -19%) because they no longer store the bodies of unannotated small functions; only builds with the flag read those. Their JavaScript doesn't change.Part of stack #9486, after #9482.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D