# Compilation: multi-thread compiler-rt · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/5cd548e53081428d0e6b4a6b5a305317052c133a)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 5cd548e53081428d0e6b4a6b5a305317052c133a

Requested commit: 5cd548e53081428d0e6b4a6b5a305317052c133a

Commit: 5cd548e53081428d0e6b4a6b5a305317052c133a

Tree: 4beb45ef87a73007a11e004a2fc52e35d8a6dc8e

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Compilation: multi-thread compiler-rt

compiler_rt_lib and compiler_rt_obj are extracted from the generic
JobQueue into simple boolean flags, and then handled explicitly inside
performAllTheWork().

Introduced generic handling of allocation failure and made
setMiscFailure not return a possible error.

Building the compiler-rt static library now takes advantage of
Compilation's ThreadPool. This introduced a problem, however, because
now each of the object files of compiler-rt all perform AstGen for the
full standard library and compiler-rt files. Even though all of them end
up being cache hits except for the first ones, this is wasteful - O(N*M)
where N is number of compilation units inside compiler-rt and M is the
number of .zig files in the standard library and compiler-rt combined.

More importantly, however, it causes a deadlock, because each thread
interacts with a file system lock for doing AstGen on files, and threads
end up waiting for each other. This will need to be handled with a
process-level file caching system, or some other creative solution.

```

## Parents

- [b4f3e69342d176ad7a2572cf4fee704094faaada](https://git.cafe/gitcafe/zig/commit/b4f3e69342d176ad7a2572cf4fee704094faaada?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/5cd548e53081428d0e6b4a6b5a305317052c133a?format=markdown)
