diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-04 03:49:43 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-04 03:49:43 +0000 |
commit | a5200c59e41685b68728f8c65a64a8c436b6c9af (patch) | |
tree | 4a32a4fd223657b55bd7f35eb5dd174ea8ed8434 /iseq.c | |
parent | 9eb12e0191907a5684f98cbc948417243729efc9 (diff) |
merges r22395 and r22640 from trunk into ruby_1_9_1.
--
* 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.
--
* iseq.c (cdhash_each): resurrects internal literals.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@26570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 21 |
1 files changed, 19 insertions, 2 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_replace(rb_str_new(0, 0), obj); + break; + case T_ARRAY: + obj = rb_ary_new4(RARRAY_LEN(obj), RARRAY_PTR(obj)); + break; + } + } + return obj; +} + static void compile_data_free(struct iseq_compile_data *compile_data) { @@ -714,6 +730,7 @@ insn_operand_intern(rb_iseq_t *iseq, break; } } + op = obj_resurrect(op); ret = rb_inspect(op); if (CLASS_OF(op) == rb_cISeq) { rb_ary_push(child, op); @@ -1015,7 +1032,7 @@ exception_type2symbol(VALUE type) static int cdhash_each(VALUE key, VALUE value, VALUE ary) { - rb_ary_push(ary, key); + rb_ary_push(ary, obj_resurrect(key)); rb_ary_push(ary, value); return ST_CONTINUE; } @@ -1145,7 +1162,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: { |