1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* gc.c: trivial performance improvements.

name    modified
    vm1_gc_short_lived*                1.015
    vm1_gc_short_with_complex_long*    1.014
    vm1_gc_short_with_long*            1.000
    vm1_gc_short_with_symbol*          1.016
    vm1_gc_wb_ary*                     1.002
    vm1_gc_wb_ary_promoted*            0.996
    vm1_gc_wb_obj*                     1.045
    vm1_gc_wb_obj_promoted*            1.014
    vm3_gc                             1.021

* gc.c (gc_writebarrier_generational): reorder parameters to optimize
  register passing function call.

* gc.c (gc_writebarrier_incremental): ditto.

* gc.c (rb_gc_writebarrier): remove LIKELY().
  LIKELY() seems to move related functions not better places.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2015-11-19 11:13:27 +00:00
parent d32a48ed6c
commit d5d997fa11
2 changed files with 31 additions and 8 deletions

View file

@ -1,3 +1,26 @@
Thu Nov 19 20:08:59 2015 Koichi Sasada <ko1@atdot.net>
* gc.c: trivial performance improvements.
name modified
vm1_gc_short_lived* 1.015
vm1_gc_short_with_complex_long* 1.014
vm1_gc_short_with_long* 1.000
vm1_gc_short_with_symbol* 1.016
vm1_gc_wb_ary* 1.002
vm1_gc_wb_ary_promoted* 0.996
vm1_gc_wb_obj* 1.045
vm1_gc_wb_obj_promoted* 1.014
vm3_gc 1.021
* gc.c (gc_writebarrier_generational): reorder parameters to optimize
register passing function call.
* gc.c (gc_writebarrier_incremental): ditto.
* gc.c (rb_gc_writebarrier): remove LIKELY().
LIKELY() seems to move related functions not better places.
Thu Nov 19 19:45:05 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (ruby_prog_init): [DOC] ARGV does not contain the name of

16
gc.c
View file

@ -5654,10 +5654,10 @@ rgengc_mark_and_rememberset_clear(rb_objspace_t *objspace, rb_heap_t *heap)
/* RGENGC: APIs */
NOINLINE(static void gc_writebarrier_generational(rb_objspace_t *objspace, VALUE a, VALUE b));
NOINLINE(static void gc_writebarrier_generational(VALUE a, VALUE b, rb_objspace_t *objspace));
static void
gc_writebarrier_generational(rb_objspace_t *objspace, VALUE a, VALUE b)
gc_writebarrier_generational(VALUE a, VALUE b, rb_objspace_t *objspace)
{
if (RGENGC_CHECK_MODE) {
if (!RVALUE_OLD_P(a)) rb_bug("gc_writebarrier_generational: %s is not an old object.", obj_info(a));
@ -5700,10 +5700,10 @@ gc_mark_from(rb_objspace_t *objspace, VALUE obj, VALUE parent)
gc_grey(objspace, obj);
}
NOINLINE(static void gc_writebarrier_incremental(rb_objspace_t *objspace, VALUE a, VALUE b));
NOINLINE(static void gc_writebarrier_incremental(VALUE a, VALUE b, rb_objspace_t *objspace));
static void
gc_writebarrier_incremental(rb_objspace_t *objspace, VALUE a, VALUE b)
gc_writebarrier_incremental(VALUE a, VALUE b, rb_objspace_t *objspace)
{
gc_report(2, objspace, "gc_writebarrier_incremental: [LG] %s -> %s\n", obj_info(a), obj_info(b));
@ -5731,7 +5731,7 @@ gc_writebarrier_incremental(rb_objspace_t *objspace, VALUE a, VALUE b)
}
}
#else
#define gc_writebarrier_incremental(objspace, a, b)
#define gc_writebarrier_incremental(a, b, objspace)
#endif
void
@ -5742,16 +5742,16 @@ rb_gc_writebarrier(VALUE a, VALUE b)
if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(a)) rb_bug("rb_gc_writebarrier: a is special const");
if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(b)) rb_bug("rb_gc_writebarrier: b is special const");
if (LIKELY(!is_incremental_marking(objspace))) {
if (!is_incremental_marking(objspace)) {
if (!RVALUE_OLD_P(a) || RVALUE_OLD_P(b)) {
return;
}
else {
gc_writebarrier_generational(objspace, a, b);
gc_writebarrier_generational(a, b, objspace);
}
}
else { /* slow path */
gc_writebarrier_incremental(objspace, a, b);
gc_writebarrier_incremental(a, b, objspace);
}
}