Skip to content

Commit b6f41d8

Browse files
topolaritygbaraldi
andauthored
Improve inferrability (#308)
Co-authored-by: Gabriel Baraldi <baraldigabriel@gmail.com>
1 parent f888022 commit b6f41d8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/fft.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,9 @@ unsafe_convert(::Type{PlanPtr}, p::FFTWPlan) = p.plan
319319
# This is accomplished by the maybe_destroy_plan function, which is used as the plan finalizer.
320320

321321
# these functions should only be called while the fftwlock is held
322-
unsafe_destroy_plan(plan::FFTWPlan{<:fftwDouble}) =
322+
unsafe_destroy_plan(@nospecialize(plan::FFTWPlan{<:fftwDouble})) =
323323
ccall((:fftw_destroy_plan,libfftw3[]), Cvoid, (PlanPtr,), plan)
324-
unsafe_destroy_plan(plan::FFTWPlan{<:fftwSingle}) =
324+
unsafe_destroy_plan(@nospecialize(plan::FFTWPlan{<:fftwSingle})) =
325325
ccall((:fftwf_destroy_plan,libfftw3f[]), Cvoid, (PlanPtr,), plan)
326326

327327
const deferred_destroy_lock = ReentrantLock() # lock protecting the deferred_destroy_plans list
@@ -335,7 +335,12 @@ function destroy_deferred()
335335
# we'll do nothing (the other function will eventually run destroy_deferred).
336336
if !isempty(deferred_destroy_plans) && trylock(fftwlock)
337337
try
338-
foreach(unsafe_destroy_plan, deferred_destroy_plans)
338+
@static if Base.VERSION >= v"1.9"
339+
@inline foreach(unsafe_destroy_plan, deferred_destroy_plans)
340+
else
341+
# call-site @inline isn't supported on old versions of Julia
342+
foreach(unsafe_destroy_plan, deferred_destroy_plans)
343+
end
339344
empty!(deferred_destroy_plans)
340345
finally
341346
unlock(fftwlock)

0 commit comments

Comments
 (0)