Skip to content

Commit

Permalink
more small tweaks to the layout optimization PR (#34177)
Browse files Browse the repository at this point in the history
- fix GC/finalizer properties of CFunction definition
- fix jl_arrayunset implementation for hasptr
- fix missing GC metadata update step inside gc_mark_scan_array8
  • Loading branch information
vtjnash authored and JeffBezanson committed Dec 23, 2019
1 parent f6ca73a commit d0e5039
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion base/c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ and will be converted automatically at the call site to the appropriate type.
See [`@cfunction`](@ref).
"""
struct CFunction <: Ref{Cvoid}
mutable struct CFunction <: Ref{Cvoid}
ptr::Ptr{Cvoid}
f::Any
_1::Ptr{Cvoid}
Expand Down
2 changes: 1 addition & 1 deletion src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ JL_DLLEXPORT void jl_arrayunset(jl_array_t *a, size_t i)
else if (a->flags.hasptr) {
size_t elsize = a->elsize;
jl_assume(elsize >= sizeof(void*) && elsize % sizeof(void*) == 0);
memset(&((jl_value_t**)a->data)[i], 0, elsize);
memset((char*)a->data + elsize * i, 0, elsize);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,7 @@ STATIC_INLINE int gc_mark_scan_array8(jl_ptls_t ptls, jl_gc_mark_sp_t *sp,
if (elem_begin < elem_end) {
// Haven't done with this one yet. Update the content and push it back
ary8->elem.begin = elem_begin;
ary8->begin = begin;
gc_repush_markdata(sp, gc_mark_array8_t);
}
else {
Expand All @@ -1812,7 +1813,7 @@ STATIC_INLINE int gc_mark_scan_array8(jl_ptls_t ptls, jl_gc_mark_sp_t *sp,
}
return 1;
}
ary8->elem.begin = elem_begin = ary8->rebegin;
elem_begin = ary8->rebegin;
}
gc_mark_push_remset(ptls, ary8->elem.parent, ary8->elem.nptr);
return 0;
Expand Down

0 comments on commit d0e5039

Please sign in to comment.