summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-05 16:15:26 +0000
committertarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-05 16:15:26 +0000
commit3a17a592da8415433ee58960e266d16a8b0cd048 (patch)
tree40df091f9d8b3149aee13a0cd3c1675dd3b599c8
parent2b78c3256158a1bec5426b149be0480ffeae917c (diff)
* gc.c (gc_mark): get rid of pushing useless objests.
* gc.c (rgengc_rememberset_mark): bypass gc_mark() in order to push sunny old object at minor gc. * gc.c (gc_mark_children): move sunny old check to gc_mark(). * gc.c (rgengc_check_shady): remove DEMOTE that already unnecessary. * gc.c (rb_gc_writebarrier): ditto. change sunny old check point in order to save mark stack and remove unnatural rest_sweep & demote. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog12
-rw-r--r--gc.c30
2 files changed, 23 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index e7ad0e9762b..7e2bba6e61f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Thu Jun 6 00:59:44 2013 Masaya Tarui <tarui@ruby-lang.org>
+
+ * gc.c (gc_mark): get rid of pushing useless objests.
+ * gc.c (rgengc_rememberset_mark): bypass gc_mark() in order to push
+ sunny old object at minor gc.
+ * gc.c (gc_mark_children): move sunny old check to gc_mark().
+ * gc.c (rgengc_check_shady): remove DEMOTE that already unnecessary.
+ * gc.c (rb_gc_writebarrier): ditto.
+
+ change sunny old check point in order to save mark stack and
+ remove unnatural rest_sweep & demote.
+
Thu Jun 6 00:52:42 2013 Masaya Tarui <tarui@ruby-lang.org>
* gc.c (rgengc_rememberset_mark): change scan algorithm for performance:
diff --git a/gc.c b/gc.c
index cc34fefa0d6..08864ff8049 100644
--- a/gc.c
+++ b/gc.c
@@ -2974,8 +2974,6 @@ rgengc_check_shady(rb_objspace_t *objspace, VALUE obj)
if (objspace->rgengc.parent_object_is_promoted &&
RVALUE_SHADY(obj) && !rgengc_remembered(objspace, obj)) {
- RVALUE_DEMOTE(obj);
-
rgengc_remember(objspace, obj);
if (objspace->rgengc.during_minor_gc == FALSE) { /* major/full GC */
objspace->rgengc.remembered_shady_object_count++;
@@ -2992,6 +2990,15 @@ gc_mark(rb_objspace_t *objspace, VALUE ptr)
if (LIKELY(objspace->mark_func_data == 0)) {
rgengc_check_shady(objspace, ptr);
if (!gc_mark_ptr(objspace, ptr)) return; /* already marked */
+#if USE_RGENGC
+ if (objspace->rgengc.during_minor_gc) {
+ /* only minor gc skip marking promoted objects */
+ if (RVALUE_PROMOTED(ptr)) {
+ rgengc_report(3, objspace, "gc_mark: %p (%s) was promoted.\n", ptr, obj_type_name((VALUE)ptr));
+ return; /* old gen */
+ }
+ }
+#endif /* USE_RGENGC */
push_mark_stack(&objspace->mark_stack, ptr);
}
else {
@@ -3041,13 +3048,6 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
rb_bug("gc_mark_children: (1) %p (%s) is shady and promoted.\n", (void *)obj, obj_type_name((VALUE)obj));
}
- if (objspace->rgengc.during_minor_gc) {
- /* only minor gc skip marking promoted objects */
- if (RVALUE_PROMOTED(obj)) {
- rgengc_report(3, objspace, "gc_mark_children: %p (%s) was promoted.\n", obj, obj_type_name((VALUE)obj));
- return; /* old gen */
- }
- }
/* minor/major common */
if (RVALUE_SUNNY(obj)) {
@@ -3608,7 +3608,8 @@ rgengc_rememberset_mark(rb_objspace_t *objspace)
bitset = bits[j];
while (bitset) {
if (bitset & 1) {
- gc_mark(objspace, (VALUE)p);
+ if (gc_mark_ptr(objspace, (VALUE)p))
+ push_mark_stack(&objspace->mark_stack, (VALUE) p);
rgengc_report(2, objspace, "rgengc_rememberset_mark: mark %p (%s)\n", p, obj_type_name((VALUE)p));
if (RVALUE_SUNNY(p)) {
@@ -3657,15 +3658,6 @@ rb_gc_writebarrier(VALUE a, VALUE b)
if (!rgengc_remembered(objspace, a)) {
rgengc_report(2, objspace, "rb_gc_wb: %p (%s) -> %p (%s)\n",
(void *)a, obj_type_name(a), (void *)b, obj_type_name(b));
-
- /* need to sweep all slots before demote */
- /* TODO: check delayed sweeping slot or not
- * if delayed sweepling slot, then mark it
- * else demote simple
- */
- rest_sweep(objspace);
-
- RVALUE_DEMOTE(a);
rgengc_remember(objspace, a);
}
}