Docs: added section discussing core ideas
This commit is contained in:
parent
78afd53e8a
commit
c31ec83e91
|
|
@ -50,6 +50,21 @@ As of <!-- date: 2021-07 --> July 2021, work on explicitly parallelizing the
|
||||||
compiler has stalled. There is a lot of design and correctness work that needs
|
compiler has stalled. There is a lot of design and correctness work that needs
|
||||||
to be done.
|
to be done.
|
||||||
|
|
||||||
|
These are the basic ideas in the effort to make `rustc` parallel:
|
||||||
|
|
||||||
|
- All data a query provider can access is accessed via the query context, so
|
||||||
|
the query context can take care of synchronizing access.
|
||||||
|
- Query results are required to be immutable so they can safely be used by
|
||||||
|
different threads concurrently.
|
||||||
|
|
||||||
|
- There are a lot of loops in the compiler that just iterate over all items in
|
||||||
|
a crate. These can possibly be parallelized.
|
||||||
|
- We can use (a custom fork of) [`rayon`] to run tasks in parallel. The custom
|
||||||
|
fork allows the execution of DAGs of tasks, not just trees.
|
||||||
|
- There are currently a lot of global data structures that need to be made
|
||||||
|
thread-safe. A key strategy here has been converting interior-mutable
|
||||||
|
data-structures (e.g. `Cell`) into their thread-safe siblings (e.g. `Mutex`).
|
||||||
|
|
||||||
[`rayon`]: https://crates.io/crates/rayon
|
[`rayon`]: https://crates.io/crates/rayon
|
||||||
|
|
||||||
As of <!-- date: 2021-02 --> February 2021, much of this effort is on hold due
|
As of <!-- date: 2021-02 --> February 2021, much of this effort is on hold due
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue