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 <Jiahao_XU@outlook.com> * Convert parallel `compile_objects` to use future instead of threads Also fixed compilation errors in mod `job_token` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Optimize parallel `compile_objects` Remove use of mpsc since the future is executed on one single thread only. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * 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 <Jiahao_XU@outlook.com> * Optimize `job_token`: Make `JobToken` zero-sized Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `windows::JobServerClient::try_acquire` impl Return `Ok(None)` instead of `Err()` if no token is ready. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * 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 <Jiahao_XU@outlook.com> * Rm unnecessary `'static` bound in parameter of `job_token` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Optimize parallel `compile_objects`: Sleep/yield if no progress is made Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix windows implementation: Match all return value explicitly Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Use Result::ok() in job_token.rs Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> * Fix grammer in comments Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> * simplify job_token impl Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> * Add more comment explaining the design choice Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Refactor: Extract new mod `async_executor` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Update src/job_token/unix.rs Co-authored-by: Thom Chiovoloni <thom@shift.click> * Remove outdated comment Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * 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 <Jiahao_XU@outlook.com> * Accept ASCII only in windows `JobServerClient::open` impl Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Use acquire and release ordering for atomic operation in `JobServer` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add a TODO for use of `NUM_JOBS` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Simplify windows jobserver `WAIT_ABANDONED` errmsg Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Co-authored-by: Thom Chiovoloni <thom@shift.click>
- Loading branch information