diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2019-10-17 11:37:32 -0700 |
---|---|---|
committer | Aaron Patterson <tenderlove@ruby-lang.org> | 2019-10-28 14:50:36 -0700 |
commit | 60a7f9f446604571f8a81499080c57c47baf0e6b (patch) | |
tree | be5f16cdce95b0042cdc943e1ee1750fd0f1e7dc /bin | |
parent | 6147fa82a923e7318f493857023006801ed25eb5 (diff) | |
download | ruby-60a7f9f446604571f8a81499080c57c47baf0e6b.tar.gz |
Protect finalizer references during execution
When we run finalizers we have to copy all of the finalizers to a new
data structure because a finalizer could add another finalizer and we
need to keep draining the "real" finalizer table until it's empty.
We don't want Ruby programs to mutate the finalizers that we're
iterating over as well.
Before this commit we would copy the finalizers in to a linked list.
The problem with this approach is that if compaction happens, the linked
list will need to be updated. But the GC doesn't know about the
existence of the linked list, so it could not update references. This
commit changes the linked list to be a Ruby array so that when
compaction happens, the arrays will automatically be updated and all
references remain valid.
Diffstat (limited to 'bin')
0 files changed, 0 insertions, 0 deletions