Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimization: Vendor jobserver impl and rm thread spawning in paralle…
…l compile_objects (#889) * Impl vendored jobserver implementation It supports non-blocking `try_acquire` and is much simpler than the one provided by `jobserver` Signed-off-by: Jiahao XU <[email protected]> * Convert parallel `compile_objects` to use future instead of threads Also fixed compilation errors in mod `job_token` Signed-off-by: Jiahao XU <[email protected]> * Optimize parallel `compile_objects` Remove use of mpsc since the future is executed on one single thread only. Signed-off-by: Jiahao XU <[email protected]> * Fix `job_token`: Remove mpsc and make sure tokens are relased The mpsc is stored in a global variable and Rust never calls `Drop::drop` on global variables, so they are never released. This commit removes the mpsc and replaces that with an `AtomicBool` for the implicit token to fix this, also dramatically simplifies the code. Signed-off-by: Jiahao XU <[email protected]> * Optimize `job_token`: Make `JobToken` zero-sized Signed-off-by: Jiahao XU <[email protected]> * Fix `windows::JobServerClient::try_acquire` impl Return `Ok(None)` instead of `Err()` if no token is ready. Signed-off-by: Jiahao XU <[email protected]> * Fix `unix::JobServerClient::from_pipe`: Accept more fd access modes `O_RDWR` is a valid access mode for both read and write end of the pipe. Signed-off-by: Jiahao XU <[email protected]> * Rm unnecessary `'static` bound in parameter of `job_token` Signed-off-by: Jiahao XU <[email protected]> * Optimize parallel `compile_objects`: Sleep/yield if no progress is made Signed-off-by: Jiahao XU <[email protected]> * Fix windows implementation: Match all return value explicitly Signed-off-by: Jiahao XU <[email protected]> * Use Result::ok() in job_token.rs Co-authored-by: Piotr Osiewicz <[email protected]> * Fix grammer in comments Co-authored-by: Piotr Osiewicz <[email protected]> * simplify job_token impl Co-authored-by: Piotr Osiewicz <[email protected]> * Add more comment explaining the design choice Signed-off-by: Jiahao XU <[email protected]> * Refactor: Extract new mod `async_executor` Signed-off-by: Jiahao XU <[email protected]> * Update src/job_token/unix.rs Co-authored-by: Thom Chiovoloni <[email protected]> * Remove outdated comment Signed-off-by: Jiahao XU <[email protected]> * Do not check for `--jobserver-fds` on windows Since the manual specifies that only `--jobsewrver-auth` will be used and windows does not have the concept of fds anyway. Signed-off-by: Jiahao XU <[email protected]> * Accept ASCII only in windows `JobServerClient::open` impl Signed-off-by: Jiahao XU <[email protected]> * Use acquire and release ordering for atomic operation in `JobServer` Signed-off-by: Jiahao XU <[email protected]> * Add a TODO for use of `NUM_JOBS` Signed-off-by: Jiahao XU <[email protected]> * Simplify windows jobserver `WAIT_ABANDONED` errmsg Signed-off-by: Jiahao XU <[email protected]> --------- Signed-off-by: Jiahao XU <[email protected]> Co-authored-by: Piotr Osiewicz <[email protected]> Co-authored-by: Thom Chiovoloni <[email protected]>
- Loading branch information