Skip to content

Commit 468b607

Browse files
committed
Use @noinline from Compat in linux_perf_func
1 parent 78da0b5 commit 468b607

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/execution.jl

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -609,21 +609,25 @@ function generate_benchmark_definition(
609609
)
610610

611611
try
612-
@noinline $(setup)
612+
$BenchmarkTools.@noinline $(setup)
613613
__evals = __params.evals
614614
# Isolate code so that e.g. setup doesn't cause different code to be generated by e.g. changing register allocation
615615
# Unfortunately it still does, e.g. if you define a variable in setup then it's passed into invocation adding a few instructions
616-
@noinline (function (__evals)
617-
$LinuxPerf.enable_all!()
618-
# We'll run it evals times.
619-
@noinline __return_val_2 = $(invocation)
620-
for __iter in 2:__evals
621-
@noinline $(invocation)
616+
$BenchmarkTools.@noinline (
617+
function (__evals)
618+
$LinuxPerf.enable_all!()
619+
# We'll run it evals times.
620+
$BenchmarkTools.@noinline __return_val_2 = $(invocation)
621+
for __iter in 2:__evals
622+
$BenchmarkTools.@noinline $(invocation)
623+
end
624+
$LinuxPerf.disable_all!()
625+
# trick the compiler not to eliminate the code
626+
return __return_val_2
622627
end
623-
$LinuxPerf.disable_all!()
624-
# trick the compiler not to eliminate the code
625-
return __return_val_2
626-
end)(__evals)
628+
)(
629+
__evals
630+
)
627631
return $LinuxPerf.Stats(__linux_perf_bench)
628632
finally
629633
close(__linux_perf_bench)

0 commit comments

Comments
 (0)