Skip to content

Commit f1c7d51

Browse files
committed
[GR-44710] Add rb_gc_mark_movable C-API function
PullRequest: truffleruby/4014
2 parents b575357 + 713e169 commit f1c7d51

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Compatibility:
1111

1212
* Add `Exception#detailed_message` method (#3257, @andrykonchin).
1313
* Fix `rb_enc_vsprintf` and force String encoding instead of converting it (@andrykonchin).
14+
* Add `rb_gc_mark_movable` function (@andrykonchin).
1415

1516
Performance:
1617

lib/cext/ABI_version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1
1+
2

src/main/c/cext/gc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ void rb_gc_mark(VALUE ptr) {
3434
polyglot_invoke(RUBY_CEXT, "rb_gc_mark", ptr);
3535
}
3636

37+
void rb_gc_mark_movable(VALUE obj) {
38+
rb_gc_mark(obj);
39+
}
40+
3741
void rb_gc_mark_maybe(VALUE ptr) {
3842
if (!RB_TYPE_P(ptr, T_NONE)) {
3943
polyglot_invoke(RUBY_CEXT, "rb_gc_mark", ptr);

src/main/java/org/truffleruby/core/MarkingService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
* Since we are not running on a VM that allows us to add custom mark functions to our garbage collector we keep objects
2828
* alive in 2 ways. Any object converted to a native handle can be kept alive by executing a
2929
* {@link MarkingServiceNodes.KeepAliveNode}. This will add the object to two lists, a list of all objects converted to
30-
* native during this call to a C extension function which will be popped when the we return to Ruby code, and a fixed
31-
* sized list of objects converted to native handles. When the latter of these two lists is full all mark functions will
32-
* be run the next time an object is added.
30+
* native during this call to a C extension function which will be popped when we return to Ruby code, and a fixed-sized
31+
* list of objects converted to native handles. When the latter of these two lists is full all mark functions will be
32+
* run the next time an object is added.
3333
*
3434
* Marker references only keep a week reference to their owning object to ensure they don't themselves stop the object
3535
* from being garbage collected. */

0 commit comments

Comments
 (0)