@@ -14,6 +14,7 @@ use std::{
1414 collections:: BTreeMap ,
1515 path:: Path ,
1616 sync:: { Arc , Mutex } ,
17+ thread,
1718} ;
1819
1920use move_analyzer:: {
@@ -47,10 +48,11 @@ fn main() {
4748 ) ;
4849
4950 let ( connection, io_threads) = Connection :: stdio ( ) ;
51+ let symbols = Arc :: new ( Mutex :: new ( symbols:: Symbolicator :: empty_symbols ( ) ) ) ;
5052 let mut context = Context {
5153 connection,
5254 files : VirtualFileSystem :: default ( ) ,
53- symbols : Arc :: new ( Mutex :: new ( symbols:: Symbolicator :: empty_symbols ( ) ) ) ,
55+ symbols : symbols. clone ( ) ,
5456 } ;
5557
5658 let ( id, client_response) = context
@@ -114,8 +116,7 @@ fn main() {
114116 serde_json:: from_value ( client_response)
115117 . expect ( "could not deserialize client capabilities" ) ;
116118
117- symbolicator_runner =
118- symbols:: SymbolicatorRunner :: new ( context. symbols . clone ( ) , diag_sender) ;
119+ symbolicator_runner = symbols:: SymbolicatorRunner :: new ( symbols. clone ( ) , diag_sender) ;
119120
120121 // If initialization information from the client contains a path to the directory being
121122 // opened, try to initialize symbols before sending response to the client. Do not bother
@@ -124,11 +125,21 @@ fn main() {
124125 // to be available right after the client is initialized.
125126 if let Some ( uri) = initialize_params. root_uri {
126127 if let Some ( p) = symbols:: SymbolicatorRunner :: root_dir ( & uri. to_file_path ( ) . unwrap ( ) ) {
127- if let Ok ( ( Some ( new_symbols) , _) ) = symbols:: Symbolicator :: get_symbols ( p. as_path ( ) )
128- {
129- let mut old_symbols = context. symbols . lock ( ) . unwrap ( ) ;
130- ( * old_symbols) . merge ( new_symbols) ;
131- }
128+ // need to evaluate in a separate thread to allow for a larger stack size (needed on
129+ // Windows)
130+ thread:: Builder :: new ( )
131+ . stack_size ( symbols:: STACK_SIZE_BYTES )
132+ . spawn ( move || {
133+ if let Ok ( ( Some ( new_symbols) , _) ) =
134+ symbols:: Symbolicator :: get_symbols ( p. as_path ( ) )
135+ {
136+ let mut old_symbols = symbols. lock ( ) . unwrap ( ) ;
137+ ( * old_symbols) . merge ( new_symbols) ;
138+ }
139+ } )
140+ . unwrap ( )
141+ . join ( )
142+ . unwrap ( ) ;
132143 }
133144 }
134145 } ;
0 commit comments