@@ -80,14 +80,14 @@ uint64_t jl_cumulative_compile_time_ns_before()
8080{
8181 // Increment the flag to allow reentrant callers to `@time`.
8282 jl_atomic_fetch_add (&jl_measure_compile_time_enabled, 1 );
83- return jl_atomic_load (&jl_cumulative_compile_time);
83+ return jl_atomic_load_relaxed (&jl_cumulative_compile_time);
8484}
8585extern " C" JL_DLLEXPORT
8686uint64_t jl_cumulative_compile_time_ns_after ()
8787{
8888 // Decrement the flag when done measuring, allowing other callers to continue measuring.
8989 jl_atomic_fetch_add (&jl_measure_compile_time_enabled, -1 );
90- return jl_atomic_load (&jl_cumulative_compile_time);
90+ return jl_atomic_load_relaxed (&jl_cumulative_compile_time);
9191}
9292
9393// this generates llvm code for the lambda info
@@ -233,7 +233,7 @@ int jl_compile_extern_c(void *llvmmod, void *p, void *sysimg, jl_value_t *declrt
233233{
234234 JL_LOCK (&codegen_lock);
235235 uint64_t compiler_start_time = 0 ;
236- uint8_t measure_compile_time_enabled = jl_atomic_load (&jl_measure_compile_time_enabled);
236+ uint8_t measure_compile_time_enabled = jl_atomic_load_relaxed (&jl_measure_compile_time_enabled);
237237 if (measure_compile_time_enabled)
238238 compiler_start_time = jl_hrtime ();
239239 jl_codegen_params_t params;
@@ -259,7 +259,7 @@ int jl_compile_extern_c(void *llvmmod, void *p, void *sysimg, jl_value_t *declrt
259259 jl_add_to_ee (std::unique_ptr<Module>(into));
260260 }
261261 if (codegen_lock.count == 1 && measure_compile_time_enabled)
262- jl_atomic_fetch_add (&jl_cumulative_compile_time, (jl_hrtime () - compiler_start_time));
262+ jl_atomic_fetch_add_relaxed (&jl_cumulative_compile_time, (jl_hrtime () - compiler_start_time));
263263 JL_UNLOCK (&codegen_lock);
264264 return success;
265265}
@@ -315,7 +315,7 @@ jl_code_instance_t *jl_generate_fptr(jl_method_instance_t *mi JL_PROPAGATES_ROOT
315315{
316316 JL_LOCK (&codegen_lock); // also disables finalizers, to prevent any unexpected recursion
317317 uint64_t compiler_start_time = 0 ;
318- uint8_t measure_compile_time_enabled = jl_atomic_load (&jl_measure_compile_time_enabled);
318+ uint8_t measure_compile_time_enabled = jl_atomic_load_relaxed (&jl_measure_compile_time_enabled);
319319 if (measure_compile_time_enabled)
320320 compiler_start_time = jl_hrtime ();
321321 // if we don't have any decls already, try to generate it now
@@ -355,7 +355,7 @@ jl_code_instance_t *jl_generate_fptr(jl_method_instance_t *mi JL_PROPAGATES_ROOT
355355 codeinst = NULL ;
356356 }
357357 if (codegen_lock.count == 1 && measure_compile_time_enabled)
358- jl_atomic_fetch_add (&jl_cumulative_compile_time, (jl_hrtime () - compiler_start_time));
358+ jl_atomic_fetch_add_relaxed (&jl_cumulative_compile_time, (jl_hrtime () - compiler_start_time));
359359 JL_UNLOCK (&codegen_lock);
360360 JL_GC_POP ();
361361 return codeinst;
@@ -369,7 +369,7 @@ void jl_generate_fptr_for_unspecialized(jl_code_instance_t *unspec)
369369 }
370370 JL_LOCK (&codegen_lock);
371371 uint64_t compiler_start_time = 0 ;
372- uint8_t measure_compile_time_enabled = jl_atomic_load (&jl_measure_compile_time_enabled);
372+ uint8_t measure_compile_time_enabled = jl_atomic_load_relaxed (&jl_measure_compile_time_enabled);
373373 if (measure_compile_time_enabled)
374374 compiler_start_time = jl_hrtime ();
375375 if (unspec->invoke == NULL ) {
@@ -399,7 +399,7 @@ void jl_generate_fptr_for_unspecialized(jl_code_instance_t *unspec)
399399 JL_GC_POP ();
400400 }
401401 if (codegen_lock.count == 1 && measure_compile_time_enabled)
402- jl_atomic_fetch_add (&jl_cumulative_compile_time, (jl_hrtime () - compiler_start_time));
402+ jl_atomic_fetch_add_relaxed (&jl_cumulative_compile_time, (jl_hrtime () - compiler_start_time));
403403 JL_UNLOCK (&codegen_lock); // Might GC
404404}
405405
@@ -422,7 +422,7 @@ jl_value_t *jl_dump_method_asm(jl_method_instance_t *mi, size_t world,
422422 // so create an exception here so we can print pretty our lies
423423 JL_LOCK (&codegen_lock); // also disables finalizers, to prevent any unexpected recursion
424424 uint64_t compiler_start_time = 0 ;
425- uint8_t measure_compile_time_enabled = jl_atomic_load (&jl_measure_compile_time_enabled);
425+ uint8_t measure_compile_time_enabled = jl_atomic_load_relaxed (&jl_measure_compile_time_enabled);
426426 if (measure_compile_time_enabled)
427427 compiler_start_time = jl_hrtime ();
428428 specfptr = (uintptr_t )codeinst->specptr .fptr ;
@@ -449,7 +449,7 @@ jl_value_t *jl_dump_method_asm(jl_method_instance_t *mi, size_t world,
449449 JL_GC_POP ();
450450 }
451451 if (measure_compile_time_enabled)
452- jl_atomic_fetch_add (&jl_cumulative_compile_time, (jl_hrtime () - compiler_start_time));
452+ jl_atomic_fetch_add_relaxed (&jl_cumulative_compile_time, (jl_hrtime () - compiler_start_time));
453453 JL_UNLOCK (&codegen_lock);
454454 }
455455 if (specfptr != 0 )
0 commit comments