This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/doc/rustc-dev-guide/src Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,22 @@ When a query `foo` is evaluated, the cache table for `foo` is locked.
48
48
49
49
As of <!-- date: 2021-07 --> July 2021, work on explicitly parallelizing the
50
50
compiler has stalled. There is a lot of design and correctness work that needs
51
- to be done.
51
+ to be done.
52
+
53
+ These are the basic ideas in the effort to make ` rustc ` parallel:
54
+
55
+ - All data a query provider can access is accessed via the query context, so
56
+ the query context can take care of synchronizing access.
57
+ - Query results are required to be immutable so they can safely be used by
58
+ different threads concurrently.
59
+
60
+ - There are a lot of loops in the compiler that just iterate over all items in
61
+ a crate. These can possibly be parallelized.
62
+ - We can use (a custom fork of) [ ` rayon ` ] to run tasks in parallel. The custom
63
+ fork allows the execution of DAGs of tasks, not just trees.
64
+ - There are currently a lot of global data structures that need to be made
65
+ thread-safe. A key strategy here has been converting interior-mutable
66
+ data-structures (e.g. ` Cell ` ) into their thread-safe siblings (e.g. ` Mutex ` ).
52
67
53
68
[ `rayon` ] : https://crates.io/crates/rayon
54
69
You can’t perform that action at this time.
0 commit comments