[go: nahoru, domu]

Skip to content

Commit

Permalink
Add comments to Message and WorkItem.
Browse files Browse the repository at this point in the history
This is particularly useful for `Message`.
  • Loading branch information
nnethercote committed Jun 21, 2023
1 parent 88cd8f9 commit a521ba4
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ impl<B: WriteBackendMethods> WorkItem<B> {
}
}

/// A result produced by the backend.
pub(crate) enum WorkItemResult<B: WriteBackendMethods> {
Compiled(CompiledModule),
NeedsLink(ModuleCodegen<B::Module>),
Expand Down Expand Up @@ -923,21 +924,34 @@ fn finish_intra_module_work<B: ExtraBackendMethods>(
}
}

/// Messages sent to the coordinator.
pub(crate) enum Message<B: WriteBackendMethods> {
/// A jobserver token has become available. Sent from the jobserver helper
/// thread.
Token(io::Result<Acquired>),
WorkItem {
result: Result<WorkItemResult<B>, Option<WorkerFatalError>>,
worker_id: usize,
},
CodegenDone {
llvm_work_item: WorkItem<B>,
cost: u64,
},

/// The backend has finished processing a work item for a codegen unit.
/// Sent from a backend worker thread.
WorkItem { result: Result<WorkItemResult<B>, Option<WorkerFatalError>>, worker_id: usize },

/// The frontend has finished generating something (backend IR or a
/// post-LTO artifact) for a codegen unit, and it should be passed to the
/// backend. Sent from the main thread.
CodegenDone { llvm_work_item: WorkItem<B>, cost: u64 },

/// Similar to `CodegenDone`, but for reusing a pre-LTO artifact
/// Sent from the main thread.
AddImportOnlyModule {
module_data: SerializedModule<B::ModuleBuffer>,
work_product: WorkProduct,
},

/// The frontend has finished generating everything for all codegen units.
/// Sent from the main thread.
CodegenComplete,

/// Some normal-ish compiler error occurred, and codegen should be wound
/// down. Sent from the main thread.
CodegenAborted,
}

Expand Down

0 comments on commit a521ba4

Please sign in to comment.