diff options
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 8e7fe94..1354a24 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2,7 +2,7 @@ vm_insnhelper.c - instruction helper functions. - $Author: kosaki $ + $Author: usa $ Copyright (C) 2007 Koichi Sasada @@ -406,10 +406,6 @@ vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, if (reg_cfp != th->cfp + 1) { rb_bug("cfp consistency error - send"); } -#ifdef __llvm__ -#define RB_LLVM_GUARD(v) RB_GC_GUARD(v) - RB_LLVM_GUARD(reg_cfp); -#endif vm_pop_frame(th); @@ -981,7 +977,7 @@ lfp_svar_place(rb_thread_t *th, VALUE *lfp) } static VALUE -lfp_svar_get(rb_thread_t *th, VALUE *lfp, VALUE key) +lfp_svar_get(rb_thread_t *th, VALUE *lfp, rb_num_t key) { NODE *svar = lfp_svar_place(th, lfp); @@ -991,20 +987,20 @@ lfp_svar_get(rb_thread_t *th, VALUE *lfp, VALUE key) case 1: return svar->u2.value; default: { - const VALUE hash = svar->u3.value; + const VALUE ary = svar->u3.value; - if (hash == Qnil) { + if (NIL_P(ary)) { return Qnil; } else { - return rb_hash_lookup(hash, key); + return rb_ary_entry(ary, key - DEFAULT_SPECIAL_VAR_COUNT); } } } } static void -lfp_svar_set(rb_thread_t *th, VALUE *lfp, VALUE key, VALUE val) +lfp_svar_set(rb_thread_t *th, VALUE *lfp, rb_num_t key, VALUE val) { NODE *svar = lfp_svar_place(th, lfp); @@ -1016,27 +1012,23 @@ lfp_svar_set(rb_thread_t *th, VALUE *lfp, VALUE key, VALUE val) svar->u2.value = val; return; default: { - VALUE hash = svar->u3.value; + VALUE ary = svar->u3.value; - if (hash == Qnil) { - svar->u3.value = hash = rb_hash_new(); + if (NIL_P(ary)) { + svar->u3.value = ary = rb_ary_new(); } - rb_hash_aset(hash, key, val); + rb_ary_store(ary, key - DEFAULT_SPECIAL_VAR_COUNT, val); } } } static inline VALUE -vm_getspecial(rb_thread_t *th, VALUE *lfp, VALUE key, rb_num_t type) +vm_getspecial(rb_thread_t *th, VALUE *lfp, rb_num_t key, rb_num_t type) { VALUE val; if (type == 0) { - VALUE k = key; - if (FIXNUM_P(key)) { - k = FIX2INT(key); - } - val = lfp_svar_get(th, lfp, k); + val = lfp_svar_get(th, lfp, key); } else { VALUE backref = lfp_svar_get(th, lfp, 1); |