Skip to content

Commit 0bf1dd9

Browse files
authored
Fix GC zeroing (#2446)
1 parent d1f390d commit 0bf1dd9

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/compiler.jl

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -631,31 +631,19 @@ function create_recursive_stores(B::LLVM.IRBuilder, @nospecialize(Ty::DataType),
631631
T_pint8 = LLVM.PointerType(T_int8)
632632

633633
prev2 = bitcast!(B, prev, LLVM.PointerType(T_int8, addrspace(value_type(prev))))
634-
634+
typedesc = Base.DataTypeFieldDesc(Ty)
635635
for i in 1:fieldcount(Ty)
636636
Ty2 = fieldtype(Ty, i)
637637
off = fieldoffset(Ty, i)
638-
639-
if Ty2 <: DataType && Base.datatype_pointerfree(Ty2)
640-
continue
641-
end
642638

643639
prev3 = inbounds_gep!(
644640
B,
645641
T_int8,
646642
prev2,
647643
LLVM.Value[LLVM.ConstantInt(Int64(off))],
648644
)
649-
650-
fallback = Base.isabstracttype(Ty2) || Ty2 isa Union || Ty2 <: Symbol || Ty2 <: String || Ty2 isa UnionAll
651-
652-
@static if VERSION < v"1.11-"
653-
fallback |= Ty2 <: Array
654-
else
655-
fallback |= Ty2 <: GenericMemory
656-
end
657-
658-
if fallback
645+
646+
if typedesc[i].isptr
659647
Ty2 = Any
660648
zeroAll = false
661649
prev3 = bitcast!(B, prev3, LLVM.PointerType(T_prjlvalue, addrspace(value_type(prev3))))
@@ -806,7 +794,7 @@ function zero_single_allocation(builder::LLVM.IRBuilder, @nospecialize(jlType::D
806794
LLVMType,
807795
jlType,
808796
)]
809-
797+
810798
addedvals = LLVM.Value[]
811799
while length(todo) != 0
812800
path, ty, jlty = popfirst!(todo)

0 commit comments

Comments
 (0)