@@ -49,7 +49,7 @@ use std::fs;
49
49
use std:: io:: { self , Write } ;
50
50
use std:: iter;
51
51
use std:: path:: { Path , PathBuf } ;
52
- use rustc_data_structures:: sync:: { self , Lrc } ;
52
+ use rustc_data_structures:: sync:: { self , Lrc , Lock } ;
53
53
use std:: sync:: mpsc;
54
54
use syntax:: { self , ast, attr, diagnostics, visit} ;
55
55
use syntax:: ext:: base:: ExtCtxt ;
@@ -69,7 +69,9 @@ pub fn spawn_thread_pool<F: FnOnce(config::Options) -> R + sync::Send, R: sync::
69
69
opts : config:: Options ,
70
70
f : F
71
71
) -> R {
72
- f ( opts)
72
+ ty:: tls:: GCX_PTR . set ( & Lock :: new ( 0 ) , || {
73
+ f ( opts)
74
+ } )
73
75
}
74
76
75
77
#[ cfg( parallel_queries) ]
@@ -79,10 +81,13 @@ pub fn spawn_thread_pool<F: FnOnce(config::Options) -> R + sync::Send, R: sync::
79
81
) -> R {
80
82
use syntax;
81
83
use syntax_pos;
82
- use rayon:: { ThreadPoolBuilder , ThreadPool } ;
84
+ use rayon:: { Configuration , ThreadPool } ;
85
+
86
+ let gcx_ptr = & Lock :: new ( 0 ) ;
83
87
84
- let config = ThreadPoolBuilder :: new ( ) . num_threads ( Session :: query_threads_from_opts ( & opts) )
85
- . stack_size ( 16 * 1024 * 1024 ) ;
88
+ let config = Configuration :: new ( ) . num_threads ( Session :: query_threads_from_opts ( & opts) )
89
+ . deadlock_handler ( ty:: maps:: deadlock)
90
+ . stack_size ( 16 * 1024 * 1024 ) ;
86
91
87
92
let with_pool = move |pool : & ThreadPool | {
88
93
pool. install ( move || f ( opts) )
@@ -98,7 +103,9 @@ pub fn spawn_thread_pool<F: FnOnce(config::Options) -> R + sync::Send, R: sync::
98
103
syntax:: GLOBALS . set ( syntax_globals, || {
99
104
syntax_pos:: GLOBALS . set ( syntax_pos_globals, || {
100
105
ty:: tls:: with_thread_locals ( || {
101
- worker ( )
106
+ ty:: tls:: GCX_PTR . set ( gcx_ptr, || {
107
+ worker ( )
108
+ } )
102
109
} )
103
110
} )
104
111
} )
0 commit comments