* 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
This commit is contained in:
parent
5a67d8e2e9
commit
ea67fb97d9
@ -1,3 +1,8 @@
|
|||||||
|
Sat Jun 6 07:58:30 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* gc.c: remove struct mark_tbl_arg and pass objspace directly
|
||||||
|
to avoid indirect access overhead.
|
||||||
|
|
||||||
Sat Jun 6 07:08:45 2015 Eric Wong <e@80x24.org>
|
Sat Jun 6 07:08:45 2015 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
* ext/socket/ancdata.c (bsock_sendmsg_internal): drop redundant assignment
|
* ext/socket/ancdata.c (bsock_sendmsg_internal): drop redundant assignment
|
||||||
|
51
gc.c
51
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))
|
#define rb_gc_mark_locations(start, end) gc_mark_locations(objspace, (start), (end))
|
||||||
|
|
||||||
struct mark_tbl_arg {
|
|
||||||
rb_objspace_t *objspace;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mark_entry(st_data_t key, st_data_t value, st_data_t data)
|
mark_entry(st_data_t key, st_data_t value, st_data_t data)
|
||||||
{
|
{
|
||||||
struct mark_tbl_arg *arg = (void*)data;
|
rb_objspace_t *objspace = (rb_objspace_t *)data;
|
||||||
gc_mark(arg->objspace, (VALUE)value);
|
gc_mark(objspace, (VALUE)value);
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_tbl(rb_objspace_t *objspace, st_table *tbl)
|
mark_tbl(rb_objspace_t *objspace, st_table *tbl)
|
||||||
{
|
{
|
||||||
struct mark_tbl_arg arg;
|
|
||||||
if (!tbl || tbl->num_entries == 0) return;
|
if (!tbl || tbl->num_entries == 0) return;
|
||||||
arg.objspace = objspace;
|
st_foreach(tbl, mark_entry, (st_data_t)objspace);
|
||||||
st_foreach(tbl, mark_entry, (st_data_t)&arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mark_key(st_data_t key, st_data_t value, st_data_t data)
|
mark_key(st_data_t key, st_data_t value, st_data_t data)
|
||||||
{
|
{
|
||||||
struct mark_tbl_arg *arg = (void*)data;
|
rb_objspace_t *objspace = (rb_objspace_t *)data;
|
||||||
gc_mark(arg->objspace, (VALUE)key);
|
gc_mark(objspace, (VALUE)key);
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_set(rb_objspace_t *objspace, st_table *tbl)
|
mark_set(rb_objspace_t *objspace, st_table *tbl)
|
||||||
{
|
{
|
||||||
struct mark_tbl_arg arg;
|
|
||||||
if (!tbl) return;
|
if (!tbl) return;
|
||||||
arg.objspace = objspace;
|
st_foreach(tbl, mark_key, (st_data_t)objspace);
|
||||||
st_foreach(tbl, mark_key, (st_data_t)&arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -3902,19 +3894,18 @@ rb_mark_set(st_table *tbl)
|
|||||||
static int
|
static int
|
||||||
mark_keyvalue(st_data_t key, st_data_t value, st_data_t data)
|
mark_keyvalue(st_data_t key, st_data_t value, st_data_t data)
|
||||||
{
|
{
|
||||||
struct mark_tbl_arg *arg = (void*)data;
|
rb_objspace_t *objspace = (rb_objspace_t *)data;
|
||||||
gc_mark(arg->objspace, (VALUE)key);
|
|
||||||
gc_mark(arg->objspace, (VALUE)value);
|
gc_mark(objspace, (VALUE)key);
|
||||||
|
gc_mark(objspace, (VALUE)value);
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_hash(rb_objspace_t *objspace, st_table *tbl)
|
mark_hash(rb_objspace_t *objspace, st_table *tbl)
|
||||||
{
|
{
|
||||||
struct mark_tbl_arg arg;
|
|
||||||
if (!tbl) return;
|
if (!tbl) return;
|
||||||
arg.objspace = objspace;
|
st_foreach(tbl, mark_keyvalue, (st_data_t)objspace);
|
||||||
st_foreach(tbl, mark_keyvalue, (st_data_t)&arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -3962,8 +3953,9 @@ static int
|
|||||||
mark_method_entry_i(st_data_t key, st_data_t value, st_data_t data)
|
mark_method_entry_i(st_data_t key, st_data_t value, st_data_t data)
|
||||||
{
|
{
|
||||||
VALUE me = (VALUE)value;
|
VALUE me = (VALUE)value;
|
||||||
struct mark_tbl_arg *arg = (void*)data;
|
rb_objspace_t *objspace = (rb_objspace_t *)data;
|
||||||
gc_mark(arg->objspace, me);
|
|
||||||
|
gc_mark(objspace, me);
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3971,9 +3963,7 @@ static void
|
|||||||
mark_m_tbl(rb_objspace_t *objspace, struct st_table *tbl)
|
mark_m_tbl(rb_objspace_t *objspace, struct st_table *tbl)
|
||||||
{
|
{
|
||||||
if (tbl) {
|
if (tbl) {
|
||||||
struct mark_tbl_arg arg;
|
st_foreach(tbl, mark_method_entry_i, (st_data_t)objspace);
|
||||||
arg.objspace = objspace;
|
|
||||||
st_foreach(tbl, mark_method_entry_i, (st_data_t)&arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3981,19 +3971,18 @@ static int
|
|||||||
mark_const_entry_i(st_data_t key, st_data_t value, st_data_t data)
|
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;
|
const rb_const_entry_t *ce = (const rb_const_entry_t *)value;
|
||||||
struct mark_tbl_arg *arg = (void*)data;
|
rb_objspace_t *objspace = (rb_objspace_t *)data;
|
||||||
gc_mark(arg->objspace, ce->value);
|
|
||||||
gc_mark(arg->objspace, ce->file);
|
gc_mark(objspace, ce->value);
|
||||||
|
gc_mark(objspace, ce->file);
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_const_tbl(rb_objspace_t *objspace, st_table *tbl)
|
mark_const_tbl(rb_objspace_t *objspace, st_table *tbl)
|
||||||
{
|
{
|
||||||
struct mark_tbl_arg arg;
|
|
||||||
if (!tbl) return;
|
if (!tbl) return;
|
||||||
arg.objspace = objspace;
|
st_foreach(tbl, mark_const_entry_i, (st_data_t)objspace);
|
||||||
st_foreach(tbl, mark_const_entry_i, (st_data_t)&arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if STACK_GROW_DIRECTION < 0
|
#if STACK_GROW_DIRECTION < 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user