diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-18 05:33:36 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-18 05:33:36 +0000 |
commit | 1128e61562bd05ade1afcc8b2a7b52a37b7818e6 (patch) | |
tree | dc512ccada286583cbd331ce0a4b60622a99c85d /iseq.c | |
parent | 829ab73879fe7b997a295e2d4c4684fd528105dc (diff) | |
download | ruby-1128e61562bd05ade1afcc8b2a7b52a37b7818e6.tar.gz |
* array.c (rb_ary_resurrect), string.c (rb_str_resurrect): new
functions based on [ruby-dev:37983]
* insns.def (putstring, duparray): use rb_{ary,str}_resurrect().
* iseq.c (iseq_data_to_ary): needs to result TS_VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 29 |
1 files changed, 18 insertions, 11 deletions
@@ -23,6 +23,22 @@ VALUE rb_cISeq; #define hidden_obj_p(obj) (!SPECIAL_CONST_P(obj) && !RBASIC(obj)->klass) +static inline VALUE +obj_resurrect(VALUE obj) +{ + if (hidden_obj_p(obj)) { + switch (BUILTIN_TYPE(obj)) { + case T_STRING: + obj = rb_str_resurrect(obj); + break; + case T_ARRAY: + obj = rb_ary_resurrect(obj); + break; + } + } + return obj; +} + static void compile_data_free(struct iseq_compile_data *compile_data) { @@ -701,16 +717,7 @@ insn_operand_intern(rb_iseq_t *iseq, op = ID2SYM(op); case TS_VALUE: /* VALUE */ - if (hidden_obj_p(op)) { - switch (BUILTIN_TYPE(op)) { - case T_STRING: - op = rb_str_replace(rb_str_new(0, 0), op); - break; - case T_ARRAY: - op = rb_ary_replace(rb_ary_new2(0), op); - break; - } - } + op = obj_resurrect(op); ret = rb_inspect(op); if (CLASS_OF(op) == rb_cISeq) { rb_ary_push(child, op); @@ -1141,7 +1148,7 @@ iseq_data_to_ary(rb_iseq_t *iseq) rb_ary_push(ary, INT2FIX(*seq)); break; case TS_VALUE: - rb_ary_push(ary, *seq); + rb_ary_push(ary, obj_resurrect(*seq)); break; case TS_ISEQ: { |