<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/ruby.git/test/ruby/test_gc_compact.rb, branch ruby_3_2</title>
<subtitle>github.com: ruby/ruby.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/'/>
<entry>
<title>merge revision(s) cb22d78354e201ca74eba68a8b4edefb593e6754: [Backport #19536]</title>
<updated>2023-03-22T23:11:23+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>naruse@airemix.jp</email>
</author>
<published>2023-03-22T23:11:23+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=400ccb16eefe4e21c4e3eacab4fd0f208fc5e151'/>
<id>400ccb16eefe4e21c4e3eacab4fd0f208fc5e151</id>
<content type='text'>
	Fix frozen status loss when moving objects

	[Bug #19536]

	When objects are moved between size pools, their frozen status is lost
	in the shape. This will cause the frozen check to be bypassed when there
	is an inline cache. For example, the following script should raise a
	FrozenError, but doesn't on Ruby 3.2 and master.

	    class A
	      def add_ivars
	        @a = @b = @c = @d = 1
	      end

	      def set_a
	        @a = 10
	      end
	    end

	    a = A.new
	    a.add_ivars
	    a.freeze

	    b = A.new
	    b.add_ivars
	    b.set_a # Set the inline cache in set_a

	    GC.verify_compaction_references(expand_heap: true, toward: :empty)

	    a.set_a
	---
	 shape.c                      |  2 +-
	 test/ruby/test_gc_compact.rb | 28 ++++++++++++++++++++++++++++
	 2 files changed, 29 insertions(+), 1 deletion(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix frozen status loss when moving objects

	[Bug #19536]

	When objects are moved between size pools, their frozen status is lost
	in the shape. This will cause the frozen check to be bypassed when there
	is an inline cache. For example, the following script should raise a
	FrozenError, but doesn't on Ruby 3.2 and master.

	    class A
	      def add_ivars
	        @a = @b = @c = @d = 1
	      end

	      def set_a
	        @a = 10
	      end
	    end

	    a = A.new
	    a.add_ivars
	    a.freeze

	    b = A.new
	    b.add_ivars
	    b.set_a # Set the inline cache in set_a

	    GC.verify_compaction_references(expand_heap: true, toward: :empty)

	    a.set_a
	---
	 shape.c                      |  2 +-
	 test/ruby/test_gc_compact.rb | 28 ++++++++++++++++++++++++++++
	 2 files changed, 29 insertions(+), 1 deletion(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 3be2acfafd3b3c6168e2266c7c6561d143d7ae5c: [Backport #19327]</title>
<updated>2023-01-19T12:52:47+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>naruse@airemix.jp</email>
</author>
<published>2023-01-19T12:52:47+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=6a8fcb50210f8414d76968298576e39b9fa82562'/>
<id>6a8fcb50210f8414d76968298576e39b9fa82562</id>
<content type='text'>
	Fix re-embedding of strings during compaction

	The reference updating code for strings is not re-embedding strings
	because the code is incorrectly wrapped inside of a
	`if (STR_SHARED_P(obj))` clause. Shared strings can't be re-embedded
	so this ends up being a no-op. This means that strings can be moved to a
	large size pool during compaction, but won't be re-embedded, which would
	waste the space.
	---
	 gc.c                         | 16 +++++++++-------
	 string.c                     | 12 ++++++++----
	 test/ruby/test_gc_compact.rb |  8 ++++----
	 3 files changed, 21 insertions(+), 15 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix re-embedding of strings during compaction

	The reference updating code for strings is not re-embedding strings
	because the code is incorrectly wrapped inside of a
	`if (STR_SHARED_P(obj))` clause. Shared strings can't be re-embedded
	so this ends up being a no-op. This means that strings can be moved to a
	large size pool during compaction, but won't be re-embedded, which would
	waste the space.
	---
	 gc.c                         | 16 +++++++++-------
	 string.c                     | 12 ++++++++----
	 test/ruby/test_gc_compact.rb |  8 ++++----
	 3 files changed, 21 insertions(+), 15 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>Add tests for compacting shared arrays</title>
<updated>2022-12-23T16:21:14+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2022-12-23T14:42:18+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=1876cda972ea226ee85faf14dae6d047e145a4c6'/>
<id>1876cda972ea226ee85faf14dae6d047e145a4c6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't allow re-embedding frozen arrays</title>
<updated>2022-12-23T16:21:14+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2022-12-23T14:33:51+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=7891f9407184ca6b4636092555d2546e3830c2ff'/>
<id>7891f9407184ca6b4636092555d2546e3830c2ff</id>
<content type='text'>
Frozen arrays should not move from heap allocated to embedded because
frozen arrays could be shared roots for other (shared) arrays. If the
frozen array moves from heap allocated to embedded it would cause issues
since the shared array would no longer know where to set the pointer
in the shared root.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Frozen arrays should not move from heap allocated to embedded because
frozen arrays could be shared roots for other (shared) arrays. If the
frozen array moves from heap allocated to embedded it would cause issues
since the shared array would no longer know where to set the pointer
in the shared root.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix Object Movement allocation in GC</title>
<updated>2022-12-15T20:27:38+00:00</updated>
<author>
<name>Matt Valentine-House</name>
<email>matt@eightbitraptor.com</email>
</author>
<published>2022-12-13T15:11:57+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=bfc66e07b7e0134dfa2041c311dc56941fe1caf0'/>
<id>bfc66e07b7e0134dfa2041c311dc56941fe1caf0</id>
<content type='text'>
When moving Objects between size pools we have to assign a new shape.

This happened during updating references - we tried to create a new shape
tree that mirrored the existing tree, but based on the root shape of the
new size pool.

This causes allocations to happen if the new tree doesn't already exist,
potentially triggering a GC, during GC.

This commit changes object movement to look for a pre-existing new tree
during object movement, and if that tree does not exist, we don't move
the object to the new pool.

This allows us to remove the shape allocation from update references.

Co-Authored-By: Peter Zhu &lt;peter@peterzhu.ca&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When moving Objects between size pools we have to assign a new shape.

This happened during updating references - we tried to create a new shape
tree that mirrored the existing tree, but based on the root shape of the
new size pool.

This causes allocations to happen if the new tree doesn't already exist,
potentially triggering a GC, during GC.

This commit changes object movement to look for a pre-existing new tree
during object movement, and if that tree does not exist, we don't move
the object to the new pool.

This allows us to remove the shape allocation from update references.

Co-Authored-By: Peter Zhu &lt;peter@peterzhu.ca&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Fix Object Movement allocation in GC"</title>
<updated>2022-12-15T17:00:30+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2022-12-15T17:00:30+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=f50aa19da63067c4b0de5964b6632df20202e71c'/>
<id>f50aa19da63067c4b0de5964b6632df20202e71c</id>
<content type='text'>
This reverts commit 9c54466e299aa91af225bc2d92a3d7755730948f.

We're seeing crashes in Shopify CI after this commit.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 9c54466e299aa91af225bc2d92a3d7755730948f.

We're seeing crashes in Shopify CI after this commit.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix Object Movement allocation in GC</title>
<updated>2022-12-15T14:04:30+00:00</updated>
<author>
<name>Matt Valentine-House</name>
<email>matt@eightbitraptor.com</email>
</author>
<published>2022-12-13T15:11:57+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=9c54466e299aa91af225bc2d92a3d7755730948f'/>
<id>9c54466e299aa91af225bc2d92a3d7755730948f</id>
<content type='text'>
When moving Objects between size pools we have to assign a new shape.

This happened during updating references - we tried to create a new shape
tree that mirrored the existing tree, but based on the root shape of the
new size pool.

This causes allocations to happen if the new tree doesn't already exist,
potentially triggering a GC, during GC.

This commit changes object movement to look for a pre-existing new tree
during object movement, and if that tree does not exist, we don't move
the object to the new pool.

This allows us to remove the shape allocation from update references.

Co-Authored-By: Peter Zhu &lt;peter@peterzhu.ca&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When moving Objects between size pools we have to assign a new shape.

This happened during updating references - we tried to create a new shape
tree that mirrored the existing tree, but based on the root shape of the
new size pool.

This causes allocations to happen if the new tree doesn't already exist,
potentially triggering a GC, during GC.

This commit changes object movement to look for a pre-existing new tree
during object movement, and if that tree does not exist, we don't move
the object to the new pool.

This allows us to remove the shape allocation from update references.

Co-Authored-By: Peter Zhu &lt;peter@peterzhu.ca&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Transition shape when object's capacity changes</title>
<updated>2022-11-10T15:11:34+00:00</updated>
<author>
<name>Jemma Issroff</name>
<email>jemmaissroff@gmail.com</email>
</author>
<published>2022-11-08T20:35:31+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=5246f4027ec574e77809845e1b1f7822cc2a5cef'/>
<id>5246f4027ec574e77809845e1b1f7822cc2a5cef</id>
<content type='text'>
This commit adds a `capacity` field to shapes, and adds shape
transitions whenever an object's capacity changes. Objects which are
allocated out of a bigger size pool will also make a transition from the
root shape to the shape with the correct capacity for their size pool
when they are allocated.

This commit will allow us to remove numiv from objects completely, and
will also mean we can guarantee that if two objects share shapes, their
IVs are in the same positions (an embedded and extended object cannot
share shapes). This will enable us to implement ivar sets in YJIT using
object shapes.

Co-Authored-By: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit adds a `capacity` field to shapes, and adds shape
transitions whenever an object's capacity changes. Objects which are
allocated out of a bigger size pool will also make a transition from the
root shape to the shape with the correct capacity for their size pool
when they are allocated.

This commit will allow us to remove numiv from objects completely, and
will also mean we can guarantee that if two objects share shapes, their
IVs are in the same positions (an embedded and extended object cannot
share shapes). This will enable us to implement ivar sets in YJIT using
object shapes.

Co-Authored-By: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Implement Objects on VWA</title>
<updated>2022-07-15T13:21:07+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2022-07-11T14:09:39+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=7424ea184f9d67c1c7f3ee97494ed3bd1aa60833'/>
<id>7424ea184f9d67c1c7f3ee97494ed3bd1aa60833</id>
<content type='text'>
This commit implements Objects on Variable Width Allocation. This allows
Objects with more ivars to be embedded (i.e. contents directly follow the
object header) which improves performance through better cache locality.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit implements Objects on Variable Width Allocation. This allows
Objects with more ivars to be embedded (i.e. contents directly follow the
object header) which improves performance through better cache locality.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Feature #18901] Don't run size pool move tests without VWA</title>
<updated>2022-07-12T12:50:33+00:00</updated>
<author>
<name>Matt Valentine-House</name>
<email>matt@eightbitraptor.com</email>
</author>
<published>2022-07-07T13:17:39+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=067a5f1a0024ebd270f363cd440147da9dc176b5'/>
<id>067a5f1a0024ebd270f363cd440147da9dc176b5</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
