Repository navigation
Conversation
Changelog🐛 Bug fix
Semantic Diff1 commit · Full page Don't store
|
|
@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. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
|
| Benchmark | Base | Head | Change |
|---|---|---|---|
build/no-op |
9,041,058 | 9,282,062 | +2.67% |
build/leaf-edit |
11,680,562 | 11,921,494 | +2.06% |
build/shared-edit |
85,692,718 | 85,917,874 | +0.26% |
Instructions
In total: 8,976,444,511 → 8,976,277,988 (±0.00%).
None of the 33 benchmarks changed by 0.1% or more.
Output size
In total: 27,600,498 → 27,600,450 (±0.00%).
| Benchmark | Base | Head | Change |
|---|---|---|---|
output/tests/*.cmj |
101,631 | 101,159 | -0.46% |
Pull request 97f2861 compared with base 2583394 in this run.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## inline-parameter-args #9535 +/- ##
=========================================================
- Coverage 82.68% 82.65% -0.03%
=========================================================
Files 469 469
Lines 66575 66587 +12
=========================================================
- Hits 55047 55038 -9
- Misses 11528 11549 +21
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
1a66c3c to
9ddb95a
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ddb95a930
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
9ddb95a to
db8768c
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! 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". |
db8768c to
9fffb48
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
9fffb48 to
dc22125
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". |
Why:
`Lam_pass_sroa` turns a local ref or mutable record into a variable
that `Lassign` updates, and an `@inline` body is stored after it.
Other modules inline such a body early in their pipeline, in passes
that assume no variable is assigned before their own sroa. So a
`Some` payload, a tuple field or a module field made from the ref
could be read after the ref was updated: the `Some` payload case
since #9022, the others since BuckleScript. Other modules now call
these functions, and warning 113 says why. No `@inline` function of
the runtime or Belt updates a ref, and storing `@inline` bodies by
default (#9482 and before it) has not been released: v13.0.0-alpha.7
stored them only with `-cross-module-opt`.
Diagnostic added (exported @inline function that updates a local ref):
Example:
@inline
let sumTo = n => {
let total = ref(0)
for i in 0 to n {
total := total.contents + i
}
total.contents
}
Before (diagnostic): none
After (diagnostic):
Warning number 113
This @inline function is inlined only in this module, not in modules that use it: it updates a local ref or mutable record.
JS modified (cross-module @inline that updates a ref):
Example:
// Other.res
@inline
let f = (n: int, q: 'a, q2: 'a) => {
let s = ref(q)
let o = Some(s.contents)
for _ in 0 to n {
s := q2
}
switch o {
| Some(v) => Some((v, s.contents))
| None => None
}
}
// Main.res
let main = () => Other.f(3, "a", "b")
Before (js): returns ["b", "b"]
function main() {
let s = "a";
for (let _for = 0; _for <= 3; ++_for) {
s = "b";
}
return [
s,
s
];
}
After (js): returns ["a", "b"]
function main() {
return Other.f(3, "a", "b");
}
Review: Which cases do the tests cover? The warning fixture gets
`sumTo`. The ref-updating `@inline` helpers in the cross-module tests,
and the repros of #9533 and the `Some` payload, are removed: they
compile to calls now, and keeping them `@inline` would need a warning
suppression. What stays are refs of the caller, assigned by a callback
passed next to an argument made from them. Those bodies are still
inlined, and were not affected; their tests keep it that way.
Review: How does this stay true? With `-check-lam`, which the compiler
tests use, `Lam_check.check` runs after every pass and now also fails on
an assignment before `Lam_pass_sroa`, naming the pass that brought it in.
Without this restriction, inlining a ref-updating `@inline` function from
another module fails it.
Fixes #9533
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHZYwA1rq7zbk3dhQq
Signed-off-by: Christoph Knittel <ck@cca.io>
dc22125 to
97f2861
Compare
An
@inlinefunction that updates a localrefor mutable record is no longer inlined in other modules. Warning 113 says so:Why. Within a module, a local ref only becomes a JavaScript variable assigned with
=at the end of the optimizations (Lam_pass_sroa). The passes before it assume no variable is assigned. A body stored for other modules is stored after that step, so inlining it brought assigned variables into those passes in the other module. So aSomepayload, a tuple field or a module field made from the ref could be read after the ref was updated. TheSomepayload case dates from #9022, the others from BuckleScript; all of #9533 belongs to this class:main(3, "a")returned["b", "b"]. It now callsOther.fand returns["a", "b"].This closes the whole class at its source instead of guarding each optimization. The cost:
@inlinefunction of the runtime or Belt updates a ref, so their output doesn't change.@inlinebodies by default (Warn when other modules can't inline an @inline function #9482) hasn't been released yet, so no user loses inlining they had.We'll see from user feedback whether such helpers need cross-module inlining. If they do, a later change could store the body from before
Lam_pass_sroa, keeping this check as the fallback.Checked, not assumed. With
-check-lam, which the compiler tests use,Lam_check.checkruns after every pass and now also fails if a pass beforeLam_pass_sroaleaves an assignment, naming that pass. Without this restriction, inlining a ref-updating@inlinefunction from another module fails it.Tests:
warning_113_inline_not_storedgets thesumTocase.inline_assigned_payload_testcovers refs of the caller, assigned by a callback passed next to an argument made from them. Those bodies are still inlined and were never affected.@inlinehelpers of the older cross-module tests are removed: they compile to calls now, and keeping them would need a warning suppression.Fixes #9533.
Stacked on #9536.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gHZYwA1rq7zbk3dhQq