* vm_insnhelper.c (lep_svar_place, lep_svar_get): do not create

additional T_NODE object (svars holder) when only getting
  svars.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2015-02-24 10:11:14 +00:00
Родитель 759724fa2d
Коммит fbc8841a8f
2 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Tue Feb 24 19:09:25 2015 Koichi Sasada <ko1@atdot.net>
* vm_insnhelper.c (lep_svar_place, lep_svar_get): do not create
additional T_NODE object (svars holder) when only getting
svars.
Tue Feb 24 11:49:48 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* time.c (time_zone_name): should be US-ASCII only if all 7-bits,

Просмотреть файл

@ -139,7 +139,7 @@ rb_error_arity(int argc, int min, int max)
/* svar */
static inline NODE *
static inline NODE **
lep_svar_place(rb_thread_t *th, VALUE *lep)
{
VALUE *svar;
@ -150,16 +150,17 @@ lep_svar_place(rb_thread_t *th, VALUE *lep)
else {
svar = &th->root_svar;
}
if (NIL_P(*svar)) {
*svar = (VALUE)NEW_IF(Qnil, Qnil, Qnil);
}
return (NODE *)*svar;
return (NODE **)svar;
}
static VALUE
lep_svar_get(rb_thread_t *th, VALUE *lep, rb_num_t key)
{
NODE *svar = lep_svar_place(th, lep);
NODE **svar_place = lep_svar_place(th, lep);
NODE *svar = *svar_place;
if (NIL_P((VALUE)svar)) return Qnil;
switch (key) {
case 0:
@ -182,7 +183,12 @@ lep_svar_get(rb_thread_t *th, VALUE *lep, rb_num_t key)
static void
lep_svar_set(rb_thread_t *th, VALUE *lep, rb_num_t key, VALUE val)
{
NODE *svar = lep_svar_place(th, lep);
NODE **svar_place = lep_svar_place(th, lep);
NODE *svar = *svar_place;
if (NIL_P((VALUE)svar)) {
svar = *svar_place = NEW_IF(Qnil, Qnil, Qnil);
}
switch (key) {
case 0: