Skip to content

Commit 87081e6

Browse files
committed
Use @noinline from Compat in linux_perf_func
1 parent dc5e528 commit 87081e6

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
@@ -608,21 +608,25 @@ function generate_benchmark_definition(
608608
)
609609

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

0 commit comments

Comments
 (0)