julia icon indicating copy to clipboard operation
julia copied to clipboard

Optimize jl_tls_world_age ccall

Open gbaraldi opened this issue 1 year ago • 1 comments

This makes it so we avoid a ccall boundary and potentially optimize away repeated world age checks

gbaraldi avatar May 21 '24 17:05 gbaraldi

With the latest change we avoid any of the wird invariant.load stuff but it still lifts the check to a preheader in a function like

function foo(oc, arr)
       sum = 0.0
           for i in eachindex(arr)
               if (oc.world) == Base.tls_world_age()
                  sum += oc(arr[i])
               else
                   sum += arr[i]
               end
           end
       sum
       end

gbaraldi avatar May 22 '24 17:05 gbaraldi