@@ -32,7 +32,7 @@ use syntax::source_map;
32
32
use syntax:: parse:: { self , ParseSess } ;
33
33
use syntax:: symbol:: Symbol ;
34
34
use syntax_pos:: { MultiSpan , Span } ;
35
- use crate :: util:: profiling:: SelfProfiler ;
35
+ use crate :: util:: profiling:: { SelfProfiler , SelfProfilerRef } ;
36
36
37
37
use rustc_target:: spec:: { PanicStrategy , RelroLevel , Target , TargetTriple } ;
38
38
use rustc_data_structures:: flock;
@@ -129,7 +129,7 @@ pub struct Session {
129
129
pub profile_channel : Lock < Option < mpsc:: Sender < ProfileQueriesMsg > > > ,
130
130
131
131
/// Used by `-Z self-profile`.
132
- pub self_profiling : Option < Arc < SelfProfiler > > ,
132
+ pub prof : SelfProfilerRef ,
133
133
134
134
/// Some measurements that are being gathered during compilation.
135
135
pub perf_stats : PerfStats ,
@@ -835,24 +835,6 @@ impl Session {
835
835
}
836
836
}
837
837
838
- #[ inline( never) ]
839
- #[ cold]
840
- fn profiler_active < F : FnOnce ( & SelfProfiler ) -> ( ) > ( & self , f : F ) {
841
- match & self . self_profiling {
842
- None => bug ! ( "profiler_active() called but there was no profiler active" ) ,
843
- Some ( profiler) => {
844
- f ( & profiler) ;
845
- }
846
- }
847
- }
848
-
849
- #[ inline( always) ]
850
- pub fn profiler < F : FnOnce ( & SelfProfiler ) -> ( ) > ( & self , f : F ) {
851
- if unlikely ! ( self . self_profiling. is_some( ) ) {
852
- self . profiler_active ( f)
853
- }
854
- }
855
-
856
838
pub fn print_perf_stats ( & self ) {
857
839
println ! (
858
840
"Total time spent computing symbol hashes: {}" ,
@@ -1257,7 +1239,7 @@ fn build_session_(
1257
1239
imported_macro_spans : OneThread :: new ( RefCell :: new ( FxHashMap :: default ( ) ) ) ,
1258
1240
incr_comp_session : OneThread :: new ( RefCell :: new ( IncrCompSession :: NotInitialized ) ) ,
1259
1241
cgu_reuse_tracker,
1260
- self_profiling : self_profiler,
1242
+ prof : SelfProfilerRef :: new ( self_profiler) ,
1261
1243
profile_channel : Lock :: new ( None ) ,
1262
1244
perf_stats : PerfStats {
1263
1245
symbol_hash_time : Lock :: new ( Duration :: from_secs ( 0 ) ) ,
0 commit comments