Skip to content
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

Please consider adding documentation on the internal architecture #4107

Open
oligamiq opened this issue Dec 24, 2024 · 3 comments
Open

Please consider adding documentation on the internal architecture #4107

oligamiq opened this issue Dec 24, 2024 · 3 comments
Labels
A-dev Area: working on Miri as a developer C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement

Comments

@oligamiq
Copy link

It would be great to have documentation explaining how this works. After spending about 2 hours investigating the code and issues, I’ve gathered the following points:

  • The sysroot is being compiled into MIR (but, you say modified standard library so I miss understanding).
  • Dependency libraries are also being executed by the interpreter.
  • There seems to be some kind of caching mechanism (changes to library files are not reflected unless a clean is performed).
  • Dummy files are being generated without compilation.
  • It appears to be related to rustc’s compile-time constants (https://rustc-dev-guide.rust-lang.org/const-eval/interpret.html).

However, I’m still not entirely sure how everything fits together. Also, some parts are deeply tied to rustc, making it challenging to read through the code.

Having documentation available would be greatly appreciated.

@RalfJung
Copy link
Member

RalfJung commented Dec 24, 2024

Thanks for your interest in Miri!

We don't have the resources to write and maintain a fully in-depth documentation of all the inner workings and implementation details of Miri. Such a document could easily fill a book. We do have documentation on how to use Miri and how to work on Miri, which doesn't seem to be what you are looking for, but it makes the issue title misleading by making it sound like we have no documentation.

So the question is: what would be the goal of this documentation? What is it you are trying to achieve? If you merely want to use Miri, most of these questions should not matter.

@oligamiq
Copy link
Author

Miri is the most advanced implementation of an interpreter for Rust's mid-level intermediate representation. Therefore, I want to customize it, fork it, reference it, or contribute to it. This is why I need documentation.

The documentation I am seeking includes, among other things, an overview of the first two aspects mentioned above and systems that have been extracted outside of repositories like rustc. Without a clear understanding of the system's overall structure, it becomes quite challenging to delve into the code, hence the need for documentation.

It is very difficult, especially when the code you want to refer to may even be in RUSTC.

I would like at least a document that clearly outlines the responsibilities of the relevant code within rustc and the responsibilities of the code within this repository.

@RalfJung RalfJung changed the title Please consider adding documentation Please consider adding documentation on the internal architecture Dec 24, 2024
@RalfJung RalfJung added C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement A-dev Area: working on Miri as a developer labels Dec 24, 2024
@RalfJung
Copy link
Member

Okay, so it's mostly about the large-scale internal architecture. We do have plenty of comments explaining local small-scale concerns, and we have user-facing docs, but we don't have an architecture overview.

That's a fair point. However, I'm not sure I'll be able to prioritize it any time soon.

This depends on #4108 -- we'd need a good place to put those kinds of docs first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dev Area: working on Miri as a developer C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement
Projects
None yet
Development

No branches or pull requests

2 participants