Skip to content

Commit 8caacdb

Browse files
authored
libuv: Mark (un)preserve_handle as @nospecialize (#58844)
These functions only worry about object identity, so there's no need for them to specialize them on their type.
1 parent c985dba commit 8caacdb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

base/libuv.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ macro handle_as(hand, typ)
3939
end
4040
end
4141

42-
associate_julia_struct(handle::Ptr{Cvoid}, @nospecialize(jlobj)) =
42+
@nospecializeinfer associate_julia_struct(handle::Ptr{Cvoid}, @nospecialize(jlobj)) =
4343
ccall(:jl_uv_associate_julia_struct, Cvoid, (Ptr{Cvoid}, Any), handle, jlobj)
4444
disassociate_julia_struct(uv) = disassociate_julia_struct(uv.handle)
4545
disassociate_julia_struct(handle::Ptr{Cvoid}) =
@@ -52,14 +52,14 @@ iolock_end() = ccall(:jl_iolock_end, Cvoid, ())
5252
# and should thus not be garbage collected
5353
const uvhandles = IdDict()
5454
const preserve_handle_lock = Threads.SpinLock()
55-
function preserve_handle(x)
55+
@nospecializeinfer function preserve_handle(@nospecialize(x))
5656
lock(preserve_handle_lock)
5757
v = get(uvhandles, x, 0)::Int
5858
uvhandles[x] = v + 1
5959
unlock(preserve_handle_lock)
6060
nothing
6161
end
62-
function unpreserve_handle(x)
62+
@nospecializeinfer function unpreserve_handle(@nospecialize(x))
6363
lock(preserve_handle_lock)
6464
v = get(uvhandles, x, 0)::Int
6565
if v == 0

0 commit comments

Comments
 (0)