Skip to content

Conversation

@tenderlove
Copy link
Member

@tenderlove tenderlove commented Jul 13, 2020

This PR is the same as #3547 except that it defaults auto compaction to enabled. In other words, it runs the entire test suite with GC compaction happening on every major GC.

@tenderlove tenderlove force-pushed the read-barrier branch 3 times, most recently from 1a36004 to 3667936 Compare August 3, 2020 20:30
@tenderlove tenderlove force-pushed the read-barrier branch 3 times, most recently from 17fdd81 to cf875ba Compare August 5, 2020 23:16
@tenderlove tenderlove force-pushed the read-barrier branch 2 times, most recently from b8fba34 to b5601c6 Compare August 24, 2020 20:55
@tenderlove tenderlove force-pushed the read-barrier branch 7 times, most recently from f2c7c94 to 6612445 Compare September 9, 2020 19:37
@tenderlove tenderlove force-pushed the read-barrier branch 7 times, most recently from 5287ffc to 12eadfc Compare September 18, 2020 19:42
@tenderlove tenderlove force-pushed the read-barrier branch 5 times, most recently from 535ddc9 to b5f4938 Compare September 29, 2020 16:52
@tenderlove tenderlove force-pushed the read-barrier branch 3 times, most recently from f7ebd4c to b40e2b8 Compare October 1, 2020 22:34
The forwarding address was in the same slot as `klass` on RBasic.  If
there is a bug and something sees an RMoved object, it will think that
the forwarding address is the class.  We would like to detect those bugs
asap, so this commit adds a dummy field in the same position as `klass`
and sets the "class" to Qundef so hopefully we crash sooner
The call cache is a weak map and sometimes it can reference classes
which will be collected.  In the case it points to a collected class,
update the class pointer to 0 (an uninitialized call cache)
Some objects that are protected by write barriers want to pin objects.
One example is an identity hash.  Identity hash is protected by a write
barrier, but the keys to the hash cannot move as they are based on
memory location.  During incremental marking, if a reference is written
to one of these objects, the reference is marked via the write barrier
even though the mark function on the object would have marked *and*
pinned it.

To fix this, we will pin every reference that is marked via incremental
marking because we cannot know if the object would have pinned its
reference
Checking if T_NONE is marked is kind of an error, so lets just check the
mark bits directly
If we don't call the marking function on the object, we need to assume
the object must be pinned
This commit runs the compactor on every major GC
Compaction only updates references for "live" objects.  But it depends
on the "before_sweep" flag on a page to figure out which objects are
live.  If we're compacting, set the before_sweep flag so we don't try to
update references on garbage objects
For example, objects that are in the finalizers table. They will be
pinned but not marked.  Since that is the case, the read barrier should
ensure the type is T_MOVED before moving objects back.
We should only update objects on blocks that have live objects.  If the
objects are live, they won't have ASAN protection, so we should also
remove the ASAN calls in order to catch bugs
Marked objects will not be "remarked" after the write barrier executes.
Since we can't know whether or not the object would have pinned the
reference that was written, we have to take a conservative approach and
pin all references written via the write barrier
T_MOVED objects can get pushed on to the stack right before the final
compact step.  If this happens, the read barriers will get removed
before anything has a chance to read from that address.  This commit
scans the stack when we finish compaction, looking for any moved
addresses that happened to get pushed on the stack.  If it finds any, it
reverts those moves.
Mutating the object id map can cause the map to resize and that can
cause a GC.  The GC may read from the object id map *while* the map is
being mutated, and that isn't safe.  This commit disables the GC when
mutating the object id map so that the GC won't see the map in an
inconsistent state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant