Repository navigation
Conversation
4239864 to
5b2d4a8
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #8864 +/- ##
==========================================
+ Coverage 80.51% 80.94% +0.43%
==========================================
Files 447 453 +6
Lines 61060 62839 +1779
==========================================
+ Hits 49162 50865 +1703
- Misses 11898 11974 +76
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8864 |
|
@codex review |
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b2d4a83bd
ℹ️ 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".
Process-wide compiler state becomes request-scoped, so one process can run many compiler requests, also on several domains at once. bsc keeps its behavior; the OCaml build system will compile in-process with this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
5b2d4a8 to
2c177e8
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c177e8fa3
ℹ️ 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".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Also tests the writer and capture fixes before it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d81eef0aa
ℹ️ 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".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
cristianoc
left a comment
There was a problem hiding this comment.
fantastic
And zero cost
This makes compiler requests safe to run repeatedly, and on several OCaml domains at once, inside one process.
bsckeeps its behaviour. The OCaml build system (#8780) will use this to compile in-process instead of startingbscfor every file (#8781), which is faster than Rust rewatch. The change is split out of #8781 so it can be reviewed on its own.Changes
Request-scoped state. The compiler's process-wide mutable state moves into domain-local, request-scoped state: Clflags,
Js_config, warnings, environment and CRC caches, predefined types,Identstamps, printers, diagnostics and backend caches. Almost all of it lives inRequest_localkeys:bscprocess would;Only
Identstamps, the request context, output capture and the order-sensitive predefined types keep explicit handling.Clflags.resetis the single definition ofbsc's defaults.Shared driver. The driver moves from
rescript_compiler_main.mlinto therescript_compiler_driverlibrary.bscruns through it, and an embedding process can callrun_requestwith its own working directory and its own runner for external commands such as PPXs. A relative-bs-project-rootis resolved against that directory.Output capture. An embedded request's output is captured in memory, without temporary files. On Windows the captured text gets
bsc's CRLF line endings, without doubling those a PPX already wrote. Output written before an escaping exception is kept and reported with it. The standalonebscstill writes directly to its stdout and stderr.Fixes found along the way:
Js_analyzer's free-variable accumulator was shared, soJs_shakecould drop a live function definition; alsoParmatch.Conv's name counter,Ctype's abbreviation memo and levels, and the parser hooks for error messages;.cmj,.astand PPX output close their file when decoding fails, writers of.ast,.cmjand.cmiclose it when writing fails, and.cmifiles are opened close-on-exec;-e's temporary source file is absolute when the temporary directory is relative, and is removed when compiling it fails;bsc -verboseprints a PPX's command before the PPX's own output again.Cost for
bscRequest-scoped state adds a domain-local lookup per access. For the standalone
bscthis is not measurable: in clean builds oftests/tests(629 modules) through Rust rewatch, 9 interleaved runs per binary, the minimum CPU time was 12.66 s on master and 12.70 s with this PR, and the medians 13.49 s and 13.37 s.ThreadSanitizer
An OCaml 5.5.0 ThreadSanitizer build of the in-process build system reported no data races in compiler code, on clean builds of
rewatch/testrepo(4 domains),tests/tests(2, 8 and 12 domains), the gentype example and the React PPX tests. Two reports appeared in sometests/testsruns, both inside the runtime's parallel minor GC (oldify_oneagainstpool_allocate). With the sharedJs_analyzeraccumulator restored, the same build reports 91 races, all inJs_analyzer, so the tool does catch this class of bug.Tests
tests/ounit_tests/ounit_compiler_request_tests.mlchecks that each kind of request-scoped state is fresh in every request and isolated between consecutive and concurrent requests, including:.cmt);Request_localkeys.🤖 Generated with Claude Code