Skip to content

Commit d0e5039

Browse files
vtjnashJeffBezanson
authored andcommitted
more small tweaks to the layout optimization PR (#34177)
- fix GC/finalizer properties of CFunction definition - fix jl_arrayunset implementation for hasptr - fix missing GC metadata update step inside gc_mark_scan_array8
1 parent f6ca73a commit d0e5039

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

base/c.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ and will be converted automatically at the call site to the appropriate type.
2626
2727
See [`@cfunction`](@ref).
2828
"""
29-
struct CFunction <: Ref{Cvoid}
29+
mutable struct CFunction <: Ref{Cvoid}
3030
ptr::Ptr{Cvoid}
3131
f::Any
3232
_1::Ptr{Cvoid}

src/array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ JL_DLLEXPORT void jl_arrayunset(jl_array_t *a, size_t i)
619619
else if (a->flags.hasptr) {
620620
size_t elsize = a->elsize;
621621
jl_assume(elsize >= sizeof(void*) && elsize % sizeof(void*) == 0);
622-
memset(&((jl_value_t**)a->data)[i], 0, elsize);
622+
memset((char*)a->data + elsize * i, 0, elsize);
623623
}
624624
}
625625

src/gc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,7 @@ STATIC_INLINE int gc_mark_scan_array8(jl_ptls_t ptls, jl_gc_mark_sp_t *sp,
17941794
if (elem_begin < elem_end) {
17951795
// Haven't done with this one yet. Update the content and push it back
17961796
ary8->elem.begin = elem_begin;
1797+
ary8->begin = begin;
17971798
gc_repush_markdata(sp, gc_mark_array8_t);
17981799
}
17991800
else {
@@ -1812,7 +1813,7 @@ STATIC_INLINE int gc_mark_scan_array8(jl_ptls_t ptls, jl_gc_mark_sp_t *sp,
18121813
}
18131814
return 1;
18141815
}
1815-
ary8->elem.begin = elem_begin = ary8->rebegin;
1816+
elem_begin = ary8->rebegin;
18161817
}
18171818
gc_mark_push_remset(ptls, ary8->elem.parent, ary8->elem.nptr);
18181819
return 0;

0 commit comments

Comments
 (0)