Skip to content

Commit

Permalink
address review
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith authored Oct 28, 2024
1 parent ab44b98 commit d29495f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions base/genericmemory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,15 @@ function _unsetindex!(A::MemoryRef{T}) where T
arrayelem = datatype_arrayelem(MemT)
elsz = datatype_layoutsize(MemT)
isbits = 0; isboxed = 1; isunion = 2
arrayelem == isbits && return A
arrayelem == isbits && datatype_pointerfree(T::DataType) && return A
t = @_gc_preserve_begin mem
p = Ptr{Ptr{Cvoid}}(@inbounds pointer(A))
if arrayelem == isboxed
Intrinsics.atomic_pointerset(p, C_NULL, :monotonic)
elseif arrayelem != isunion
if !datatype_pointerfree(T::DataType)
for j = 1:Core.sizeof(Ptr{Cvoid}):elsz
# XXX: this violates memory ordering, since it writes more than one C_NULL to each
Intrinsics.atomic_pointerset(p + j - 1, C_NULL, :monotonic)
end
for j = 1:Core.sizeof(Ptr{Cvoid}):elsz
# XXX: this violates memory ordering, since it writes more than one C_NULL to each
Intrinsics.atomic_pointerset(p + j - 1, C_NULL, :monotonic)
end
end
@_gc_preserve_end t
Expand Down

0 comments on commit d29495f

Please sign in to comment.