Fix jl_gc_wb_genericmemory_copy_boxed not advancing src/dest ptr #61852
any reason not to use the poc above as a regression test?
Might as well!
Not to be annoying but this is technically a codegen check and not a gc one. (jl_gc_wb_genericmemory_copy_boxed) is a horrible name but needed because gcs need to implement their own if they have write barriers that matter
Doesn't this still have an off-by-one bug? Not really observable, but still
I think it's correct? If we copy all the items, this should end up 1 past the end.
Is there a better place for it to live? It could go in arrayops.jl, I suppose.
Right, but if we break we copy an element twice. Not that it really matters now that we at least advance the pointers consistently.
This existed in the pre-#57252 version too, but it's nice to have it fixed.
Approved these changes.
topolarity
xal-0
Claude Opus 4.7 xhigh spotted this one when I was making some unrelated changes (I'm impressed!). #57252/378a42508d4 introduced this bug when extracting the code for
jl_gc_wb_genericmemory_copy_boxedfromjl_genericmemory_copyto: the caller assumessrc_panddest_pwill be updated to point to the remaining elementsmemmove_refsmust copy, but we no longer mutate them. I had Claude turn them into pointers, so they are updated like before.Nifty PoC: