rust/compiler
Guillaume Gomez 6b5e141999
Rollup merge of #82535 - wesleywiser:wip_codegen_thread_names, r=nagisa
Set codegen thread names

Set names on threads spawned during codegen. Various debugging and profiling tools can take advantage of this to show a more useful identifier for threads.

For example, gdb will show thread names in `info threads`:

```
(gdb) info threads
  Id   Target Id                                          Frame
  1    Thread 0x7fffefa7ec40 (LWP 2905) "rustc"           __pthread_clockjoin_ex (threadid=140737214134016, thread_return=0x0, clockid=<optimized out>, abstime=<optimized out>, block=<optimized out>)
    at pthread_join_common.c:145
  2    Thread 0x7fffefa7b700 (LWP 2957) "rustc"           0x00007ffff125eaa8 in llvm::X86_MC::initLLVMToSEHAndCVRegMapping(llvm::MCRegisterInfo*) ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-f866439e29074957.so
  3    Thread 0x7fffeef0f700 (LWP 3116) "rustc"           futex_wait_cancelable (private=0, expected=0, futex_word=0x7fffe8602ac8) at ../sysdeps/nptl/futex-internal.h:183
* 4    Thread 0x7fffeed0e700 (LWP 3123) "rustc"           rustc_codegen_ssa:🔙:write::spawn_work (cgcx=..., work=...) at /home/wesley/code/rust/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1573
  6    Thread 0x7fffe113b700 (LWP 3150) "opt foof.7rcbfp" 0x00007ffff2940e62 in llvm::CallGraph::populateCallGraphNode(llvm::CallGraphNode*) ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-f866439e29074957.so
  8    Thread 0x7fffe0d39700 (LWP 3158) "opt foof.7rcbfp" 0x00007fffefe8998e in malloc_consolidate (av=av@entry=0x7ffe2c000020) at malloc.c:4492
  9    Thread 0x7fffe0f3a700 (LWP 3162) "opt foof.7rcbfp" 0x00007fffefef27c4 in __libc_open64 (file=0x7fffe0f38608 "foof.foof.7rcbfp3g-cgu.6.rcgu.o", oflag=524865) at ../sysdeps/unix/sysv/linux/open64.c:48
(gdb)
```

and Windows Performance Analyzer will also show this information when profiling:

![image](https://user-images.githubusercontent.com/831192/109231017-d311f780-7793-11eb-8072-ab836a830e90.png)
2021-02-26 15:52:35 +01:00
..
rustc
rustc_apfloat
rustc_arena Update the bootstrap compiler 2021-02-20 17:19:30 -05:00
rustc_ast Rollup merge of #82321 - bugadani:ast3, r=varkor 2021-02-25 14:34:03 +01:00
rustc_ast_lowering Auto merge of #82447 - Amanieu:legacy_const_generics, r=oli-obk 2021-02-25 18:14:50 +00:00
rustc_ast_passes Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakis 2021-02-23 16:10:23 +01:00
rustc_ast_pretty Rollup merge of #82238 - petrochenkov:nocratemod, r=Aaron1011 2021-02-19 02:49:08 +01:00
rustc_attr remove redundant wrapping of return types of allow_internal_unstable() and rustc_allow_const_fn_unstable() 2021-02-21 18:11:27 +01:00
rustc_builtin_macros Remove some P-s 2021-02-20 10:51:26 +01:00
rustc_codegen_cranelift Rollup merge of #81940 - jhpratt:stabilize-str_split_once, r=m-ou-se 2021-02-26 15:52:29 +01:00
rustc_codegen_llvm Rollup merge of #82456 - klensy:or-else, r=estebank 2021-02-26 15:52:31 +01:00
rustc_codegen_ssa Rollup merge of #82535 - wesleywiser:wip_codegen_thread_names, r=nagisa 2021-02-26 15:52:35 +01:00
rustc_data_structures Update the bootstrap compiler 2021-02-20 17:19:30 -05:00
rustc_driver Rollup merge of #82269 - LeSeulArtichaut:cleanup-ppmode, r=spastorino 2021-02-25 16:06:16 -05:00
rustc_error_codes Auto merge of #78429 - casey:doctest-attribute-splitting, r=jyn514 2021-02-26 00:17:22 +00:00
rustc_errors Rollup merge of #82087 - estebank:abolish-ice, r=oli-obk 2021-02-25 14:33:56 +01:00
rustc_expand remove redundant wrapping of return types of allow_internal_unstable() and rustc_allow_const_fn_unstable() 2021-02-21 18:11:27 +01:00
rustc_feature Auto merge of #82447 - Amanieu:legacy_const_generics, r=oli-obk 2021-02-25 18:14:50 +00:00
rustc_fs_util
rustc_graphviz
rustc_hir Improve error msgs when found type is deref of expected 2021-02-23 10:50:06 +03:00
rustc_hir_pretty
rustc_incremental
rustc_index
rustc_infer clarifies error when finding mismatched returned types for async functions 2021-02-24 18:46:54 -08:00
rustc_interface Rollup merge of #82269 - LeSeulArtichaut:cleanup-ppmode, r=spastorino 2021-02-25 16:06:16 -05:00
rustc_lexer
rustc_lint Rollup merge of #82456 - klensy:or-else, r=estebank 2021-02-26 15:52:31 +01:00
rustc_lint_defs Add explanations and suggestions to irrefutable_let_patterns lint 2021-02-18 16:21:16 -08:00
rustc_llvm
rustc_macros replaced some map_or with map_or_else 2021-02-24 02:43:35 +03:00
rustc_metadata Add #[rustc_legacy_const_generics] 2021-02-23 17:25:55 +00:00
rustc_middle Rollup merge of #82510 - jyn514:fix-typo, r=Dylan-DPC 2021-02-25 16:06:26 -05:00
rustc_mir Rollup merge of #82491 - tmiasko:i, r=lcnr 2021-02-26 15:52:32 +01:00
rustc_mir_build Auto merge of #81978 - tmiasko:head-ctor, r=Mark-Simulacrum 2021-02-22 21:45:50 +00:00
rustc_parse Rollup merge of #82456 - klensy:or-else, r=estebank 2021-02-26 15:52:31 +01:00
rustc_parse_format
rustc_passes Rollup merge of #82506 - estebank:unused_variable_lint, r=lcnr 2021-02-26 15:52:33 +01:00
rustc_plugin_impl
rustc_privacy
rustc_query_impl Simplify hashing. 2021-02-21 12:22:22 +01:00
rustc_query_system Simplify hashing. 2021-02-21 12:22:22 +01:00
rustc_resolve Rollup merge of #82456 - klensy:or-else, r=estebank 2021-02-26 15:52:31 +01:00
rustc_save_analysis
rustc_serialize Update the bootstrap compiler 2021-02-20 17:19:30 -05:00
rustc_session Rollup merge of #82456 - klensy:or-else, r=estebank 2021-02-26 15:52:31 +01:00
rustc_span Rollup merge of #81940 - jhpratt:stabilize-str_split_once, r=m-ou-se 2021-02-26 15:52:29 +01:00
rustc_symbol_mangling
rustc_target Rollup merge of #81940 - jhpratt:stabilize-str_split_once, r=m-ou-se 2021-02-26 15:52:29 +01:00
rustc_trait_selection fix review 2021-02-25 04:21:12 +03:00
rustc_traits
rustc_ty_utils Auto merge of #82159 - BoxyUwU:uwu, r=varkor 2021-02-24 21:54:52 +00:00
rustc_type_ir New pass to deduplicate blocks 2021-02-21 21:51:54 +01:00
rustc_typeck Rollup merge of #82456 - klensy:or-else, r=estebank 2021-02-26 15:52:31 +01:00