diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-22 12:49:14 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-22 12:49:14 +0000 |
commit | f08b595a5b69f9132c76cd6a6869143425d100a4 (patch) | |
tree | 7ad83a65aee7efa31fbca7c61bcbb8e4d8079c61 /iseq.c | |
parent | 1efaf20e256f37208e5c5b3a4d49dbde3eac6f75 (diff) |
merges r22255 from trunk into ruby_1_9_1.
* compile.c (compile_array_, defined_expr, iseq_compile_each): hide
and freeze internal literal objects, to prevent from modifying.
[ruby-dev:37959]
* iseq.c (insn_operand_intern): copy internal literal objects.
* insns.def (putstring, duparray): ditto.
* string.c (rb_str_replace): exported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@22532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -21,6 +21,8 @@ VALUE rb_cISeq; +#define hidden_obj_p(obj) (!SPECIAL_CONST_P(obj) && !RBASIC(obj)->klass) + static void compile_data_free(struct iseq_compile_data *compile_data) { @@ -699,6 +701,16 @@ 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; + } + } ret = rb_inspect(op); if (CLASS_OF(op) == rb_cISeq) { rb_ary_push(child, op); |