aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2020-07-19 11:52:11 +0900
committernagachika <nagachika@ruby-lang.org>2020-07-19 11:52:11 +0900
commite619178e52250ceda3a0fe32ff5addb16617b58c (patch)
tree65f8d53a05b525fd1c3b3324bf8c36e525e41ab1
parentad15fd03e915272bdf4b3a8403722b397e3afcf8 (diff)
downloadruby-e619178e52250ceda3a0fe32ff5addb16617b58c.tar.gz
merge revision(s) 6e7e7c1e577d6c2276e9a8cc85c28c55c46c2618: [Backport #17023]
Only marked objects should be considered movable Ruby's GC is incremental, meaning that during the mark phase (and also the sweep phase) programs are allowed to run. This means that programs can allocate objects before the mark or sweep phase have actually completed. Those objects may not have had a chance to be marked, so we can't know if they are movable or not. Something that references the newly created object might have called the pinning function during the mark phase, but since the mark phase hasn't run we can't know if there is a "pinning" relationship. To be conservative, we must only allow objects that are not pinned but also marked to move.
-rw-r--r--gc.c2
-rw-r--r--version.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 4700234e19..a08793f86e 100644
--- a/gc.c
+++ b/gc.c
@@ -7569,7 +7569,7 @@ gc_is_moveable_obj(rb_objspace_t *objspace, VALUE obj)
return FALSE;
}
}
- return !RVALUE_PINNED(obj);
+ return RVALUE_MARKED(obj) && !RVALUE_PINNED(obj);
break;
default:
diff --git a/version.h b/version.h
index c0937dc840..eb934969c0 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 1
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 94
+#define RUBY_PATCHLEVEL 95
#define RUBY_RELEASE_YEAR 2020
#define RUBY_RELEASE_MONTH 7