Skip to content

Commit a521ba4

Browse files
committed
Add comments to Message and WorkItem.
This is particularly useful for `Message`.
1 parent 88cd8f9 commit a521ba4

File tree

1 file changed

+22
-8
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+22
-8
lines changed

compiler/rustc_codegen_ssa/src/back/write.rs

+22-8
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ impl<B: WriteBackendMethods> WorkItem<B> {
731731
}
732732
}
733733

734+
/// A result produced by the backend.
734735
pub(crate) enum WorkItemResult<B: WriteBackendMethods> {
735736
Compiled(CompiledModule),
736737
NeedsLink(ModuleCodegen<B::Module>),
@@ -923,21 +924,34 @@ fn finish_intra_module_work<B: ExtraBackendMethods>(
923924
}
924925
}
925926

927+
/// Messages sent to the coordinator.
926928
pub(crate) enum Message<B: WriteBackendMethods> {
929+
/// A jobserver token has become available. Sent from the jobserver helper
930+
/// thread.
927931
Token(io::Result<Acquired>),
928-
WorkItem {
929-
result: Result<WorkItemResult<B>, Option<WorkerFatalError>>,
930-
worker_id: usize,
931-
},
932-
CodegenDone {
933-
llvm_work_item: WorkItem<B>,
934-
cost: u64,
935-
},
932+
933+
/// The backend has finished processing a work item for a codegen unit.
934+
/// Sent from a backend worker thread.
935+
WorkItem { result: Result<WorkItemResult<B>, Option<WorkerFatalError>>, worker_id: usize },
936+
937+
/// The frontend has finished generating something (backend IR or a
938+
/// post-LTO artifact) for a codegen unit, and it should be passed to the
939+
/// backend. Sent from the main thread.
940+
CodegenDone { llvm_work_item: WorkItem<B>, cost: u64 },
941+
942+
/// Similar to `CodegenDone`, but for reusing a pre-LTO artifact
943+
/// Sent from the main thread.
936944
AddImportOnlyModule {
937945
module_data: SerializedModule<B::ModuleBuffer>,
938946
work_product: WorkProduct,
939947
},
948+
949+
/// The frontend has finished generating everything for all codegen units.
950+
/// Sent from the main thread.
940951
CodegenComplete,
952+
953+
/// Some normal-ish compiler error occurred, and codegen should be wound
954+
/// down. Sent from the main thread.
941955
CodegenAborted,
942956
}
943957

0 commit comments

Comments
 (0)