static inline void memassign_safe(int hasptr, jl_value_t *parent, char *dst, const jl_value_t *src, size_t nb) JL_NOTSAFEPOINT
{
if (hasptr) {
// assert that although dst might have some undefined bits, the src heap box should be okay with that
assert(LLT_ALIGN(nb, sizeof(void*)) == LLT_ALIGN(jl_datatype_size(jl_typeof(src)), sizeof(void*)));
size_t nptr = nb / sizeof(void*);
memmove_refs((void**)dst, (void**)src, nptr);
jl_gc_multi_wb(parent, src);
src = (jl_value_t*)((char*)src + nptr * sizeof(void*));
nb -= nptr * sizeof(void*);
}
else {
// src must be a heap box.
assert(nb == jl_datatype_size(jl_typeof(src)));
if (nb >= 16) {
memcpy(dst, jl_assume_aligned(src, 16), nb);
return;
}
}
memcpy(dst, jl_assume_aligned(src, sizeof(void*)), nb);
}