Skip to content

Commit 2421e8c

Browse files
committed
---
yaml --- r: 163356 b: refs/heads/snap-stage3 c: 394f684 h: refs/heads/master v: v3
1 parent 14ff40e commit 2421e8c

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: d8e51ea0e2e0c7d363a4202c0ae395f320a19f3d
4+
refs/heads/snap-stage3: 394f6846b80240480f8d7ce4b3d5d4c42ba85201
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustc_trans/back/write.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -842,18 +842,31 @@ pub fn run_passes(sess: &Session,
842842
//if sess.time_llvm_passes() { llvm::LLVMRustPrintPassTimings(); }
843843
}
844844

845-
type WorkItem = proc(&CodegenContext):Send;
845+
struct WorkItem {
846+
mtrans: ModuleTranslation,
847+
config: ModuleConfig,
848+
output_names: OutputFilenames,
849+
name_extra: String
850+
}
846851

847852
fn build_work_item(sess: &Session,
848853
mtrans: ModuleTranslation,
849854
config: ModuleConfig,
850855
output_names: OutputFilenames,
851-
name_extra: String) -> WorkItem {
856+
name_extra: String)
857+
-> WorkItem
858+
{
852859
let mut config = config;
853860
config.tm = create_target_machine(sess);
861+
WorkItem { mtrans: mtrans, config: config, output_names: output_names,
862+
name_extra: name_extra }
863+
}
854864

855-
proc(cgcx) unsafe {
856-
optimize_and_codegen(cgcx, mtrans, config, name_extra, output_names);
865+
fn execute_work_item(cgcx: &CodegenContext,
866+
work_item: WorkItem) {
867+
unsafe {
868+
optimize_and_codegen(cgcx, work_item.mtrans, work_item.config,
869+
work_item.name_extra, work_item.output_names);
857870
}
858871
}
859872

@@ -866,7 +879,7 @@ fn run_work_singlethreaded(sess: &Session,
866879
// Since we're running single-threaded, we can pass the session to
867880
// the proc, allowing `optimize_and_codegen` to perform LTO.
868881
for work in Unfold::new((), |_| work_items.pop()) {
869-
work(&cgcx);
882+
execute_work_item(&cgcx, work);
870883
}
871884
}
872885

@@ -883,7 +896,7 @@ fn run_work_multithreaded(sess: &Session,
883896
let diag_emitter = diag_emitter.clone();
884897
let remark = sess.opts.cg.remark.clone();
885898

886-
let future = TaskBuilder::new().named(format!("codegen-{}", i)).try_future(proc() {
899+
let future = TaskBuilder::new().named(format!("codegen-{}", i)).try_future(move |:| {
887900
let diag_handler = mk_handler(box diag_emitter);
888901

889902
// Must construct cgcx inside the proc because it has non-Send
@@ -899,7 +912,7 @@ fn run_work_multithreaded(sess: &Session,
899912
let maybe_work = work_items_arc.lock().pop();
900913
match maybe_work {
901914
Some(work) => {
902-
work(&cgcx);
915+
execute_work_item(&cgcx, work);
903916

904917
// Make sure to fail the worker so the main thread can
905918
// tell that there were errors.

0 commit comments

Comments
 (0)