-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Add -Zjit-mode flag #151009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add -Zjit-mode flag #151009
Conversation
This flag tells the codegen backend to immediately execute the code it builds. This is exactly what miri needs as it is unable to produce real executables. Adding a builtin flag would allow cargo to add native support for this without miri needing to do a bunch of hacks in its cargo wrapper. Furthermore cg_clif also has a jit mode that benefits from it.
If cargo gets native support for -Zjit-mode, this should allow simplifying cargo-miri a fair bit.
|
The Miri subtree was changed cc @rust-lang/miri |
|
This is kind-of a nit, but the naming of the flag implies to me that we generate a binary that calls back |
This comment has been minimized.
This comment has been minimized.
I like those names. I don't have much of a preference which of the two to use. |
| } | ||
| } | ||
| config.program.args.push("-Zui-testing".into()); | ||
| config.program.args.push("-Zjit-mode".into()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code for ./miri run in miri-script/src/commands.rs likely also needs to set this new flag.
|
This seems MCP-worthy. Also, how do you imagine this to work from cargo? Cargo currently treats output from rustc and the program very different: rustc produces JSON output that is fully consumed by cargo, cached, and then rendered to the terminal. The program just gets direct access to the terminal. |
Cargo currently does forward all lines output on stdout which don't start with a |
I assume you mean That said, last time I checked (which was many years ago), it did so in a buffered way, making it unsuitable for Miri (we need to be able to emit partial lines). Also, it's not acceptable for output from the program Miri interprets to be swallowed just because it looks like JSON. |
|
☔ The latest upstream changes (presumably #151533) made this pull request unmergeable. Please resolve the merge conflicts. |
This flag tells the codegen backend to immediately execute the code it builds. This is exactly what miri needs as it is unable to produce real executables. Adding a builtin flag would allow cargo to add native support for this without miri needing to do a bunch of hacks in its cargo wrapper. Furthermore cg_clif also has a jit mode that benefits from it.