aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-05 23:00:22 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-05 23:00:22 +0000
commitea67fb97d96b8439bd9ae035651063bdd1b4ddfb (patch)
treea31d92872807e08f5dfd4afcceec04046c0f3b0d /gc.c
parent5a67d8e2e9cac2bdd41c588fc13e041759028ce0 (diff)
downloadruby-ea67fb97d96b8439bd9ae035651063bdd1b4ddfb.tar.gz
* gc.c: remove struct mark_tbl_arg and pass objspace directly
to avoid indirect access overhead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c51
1 files changed, 20 insertions, 31 deletions
diff --git a/gc.c b/gc.c
index dbbf8daed5..3a6bc5c99d 100644
--- a/gc.c
+++ b/gc.c
@@ -3855,42 +3855,34 @@ rb_gc_mark_values(long n, const VALUE *values)
#define rb_gc_mark_locations(start, end) gc_mark_locations(objspace, (start), (end))
-struct mark_tbl_arg {
- rb_objspace_t *objspace;
-};
-
static int
mark_entry(st_data_t key, st_data_t value, st_data_t data)
{
- struct mark_tbl_arg *arg = (void*)data;
- gc_mark(arg->objspace, (VALUE)value);
+ rb_objspace_t *objspace = (rb_objspace_t *)data;
+ gc_mark(objspace, (VALUE)value);
return ST_CONTINUE;
}
static void
mark_tbl(rb_objspace_t *objspace, st_table *tbl)
{
- struct mark_tbl_arg arg;
if (!tbl || tbl->num_entries == 0) return;
- arg.objspace = objspace;
- st_foreach(tbl, mark_entry, (st_data_t)&arg);
+ st_foreach(tbl, mark_entry, (st_data_t)objspace);
}
static int
mark_key(st_data_t key, st_data_t value, st_data_t data)
{
- struct mark_tbl_arg *arg = (void*)data;
- gc_mark(arg->objspace, (VALUE)key);
+ rb_objspace_t *objspace = (rb_objspace_t *)data;
+ gc_mark(objspace, (VALUE)key);
return ST_CONTINUE;
}
static void
mark_set(rb_objspace_t *objspace, st_table *tbl)
{
- struct mark_tbl_arg arg;
if (!tbl) return;
- arg.objspace = objspace;
- st_foreach(tbl, mark_key, (st_data_t)&arg);
+ st_foreach(tbl, mark_key, (st_data_t)objspace);
}
void
@@ -3902,19 +3894,18 @@ rb_mark_set(st_table *tbl)
static int
mark_keyvalue(st_data_t key, st_data_t value, st_data_t data)
{
- struct mark_tbl_arg *arg = (void*)data;
- gc_mark(arg->objspace, (VALUE)key);
- gc_mark(arg->objspace, (VALUE)value);
+ rb_objspace_t *objspace = (rb_objspace_t *)data;
+
+ gc_mark(objspace, (VALUE)key);
+ gc_mark(objspace, (VALUE)value);
return ST_CONTINUE;
}
static void
mark_hash(rb_objspace_t *objspace, st_table *tbl)
{
- struct mark_tbl_arg arg;
if (!tbl) return;
- arg.objspace = objspace;
- st_foreach(tbl, mark_keyvalue, (st_data_t)&arg);
+ st_foreach(tbl, mark_keyvalue, (st_data_t)objspace);
}
void
@@ -3962,8 +3953,9 @@ static int
mark_method_entry_i(st_data_t key, st_data_t value, st_data_t data)
{
VALUE me = (VALUE)value;
- struct mark_tbl_arg *arg = (void*)data;
- gc_mark(arg->objspace, me);
+ rb_objspace_t *objspace = (rb_objspace_t *)data;
+
+ gc_mark(objspace, me);
return ST_CONTINUE;
}
@@ -3971,9 +3963,7 @@ static void
mark_m_tbl(rb_objspace_t *objspace, struct st_table *tbl)
{
if (tbl) {
- struct mark_tbl_arg arg;
- arg.objspace = objspace;
- st_foreach(tbl, mark_method_entry_i, (st_data_t)&arg);
+ st_foreach(tbl, mark_method_entry_i, (st_data_t)objspace);
}
}
@@ -3981,19 +3971,18 @@ static int
mark_const_entry_i(st_data_t key, st_data_t value, st_data_t data)
{
const rb_const_entry_t *ce = (const rb_const_entry_t *)value;
- struct mark_tbl_arg *arg = (void*)data;
- gc_mark(arg->objspace, ce->value);
- gc_mark(arg->objspace, ce->file);
+ rb_objspace_t *objspace = (rb_objspace_t *)data;
+
+ gc_mark(objspace, ce->value);
+ gc_mark(objspace, ce->file);
return ST_CONTINUE;
}
static void
mark_const_tbl(rb_objspace_t *objspace, st_table *tbl)
{
- struct mark_tbl_arg arg;
if (!tbl) return;
- arg.objspace = objspace;
- st_foreach(tbl, mark_const_entry_i, (st_data_t)&arg);
+ st_foreach(tbl, mark_const_entry_i, (st_data_t)objspace);
}
#if STACK_GROW_DIRECTION < 0