1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* iseq.c, internal.h (rb_iseq_clone): removed because we don't need to

clone iseq any more.
* class.c (clone_method): share iseq between cloned methods. All of
  method dependent information are able to refer from method entry.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2015-07-07 02:27:41 +00:00
parent bbf7495fe2
commit 16a68369d2
4 changed files with 9 additions and 28 deletions

View file

@ -1,3 +1,11 @@
Tue Jul 07 11:25:57 2015 Koichi Sasada <ko1@atdot.net>
* iseq.c, internal.h (rb_iseq_clone): removed because we don't need to
clone iseq any more.
* class.c (clone_method): share iseq between cloned methods. All of
method dependent information are able to refer from method entry.
Tue Jul 7 04:42:25 2015 Eric Wong <e@80x24.org>
* string.c (Init_String): use rb_str_freeze for String#freeze

View file

@ -244,11 +244,9 @@ static void
clone_method(VALUE old_klass, VALUE new_klass, ID mid, const rb_method_entry_t *me)
{
if (me->def->type == VM_METHOD_TYPE_ISEQ) {
VALUE newiseqval;
rb_cref_t *new_cref;
newiseqval = rb_iseq_clone(me->def->body.iseq.iseqptr->self, new_klass);
rb_vm_rewrite_cref(me->def->body.iseq.cref, old_klass, new_klass, &new_cref);
rb_add_method_iseq(new_klass, mid, newiseqval, new_cref, METHOD_ENTRY_VISI(me));
rb_add_method_iseq(new_klass, mid, me->def->body.iseq.iseqptr->self, new_cref, METHOD_ENTRY_VISI(me));
}
else {
rb_method_entry_set(new_klass, mid, me, METHOD_ENTRY_VISI(me));

View file

@ -847,7 +847,6 @@ VALUE rb_io_flush_raw(VALUE, int);
size_t rb_io_memsize(const rb_io_t *);
/* iseq.c */
VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
VALUE rb_iseq_path(VALUE iseqval);
VALUE rb_iseq_absolute_path(VALUE iseqval);
VALUE rb_iseq_label(VALUE iseqval);

24
iseq.c
View file

@ -1930,30 +1930,6 @@ iseq_data_to_ary(rb_iseq_t *iseq)
return val;
}
VALUE
rb_iseq_clone(VALUE iseqval, VALUE newcbase)
{
VALUE newiseq = iseq_alloc(rb_cISeq);
rb_iseq_t *iseq0, *iseq1;
GetISeqPtr(iseqval, iseq0);
GetISeqPtr(newiseq, iseq1);
MEMCPY(iseq1, iseq0, rb_iseq_t, 1);
iseq1->self = newiseq;
if (!iseq1->orig) {
RB_OBJ_WRITE(iseq1->self, &iseq1->orig, iseqval);
}
if (iseq0->local_iseq == iseq0) {
iseq1->local_iseq = iseq1;
}
RB_GC_GUARD(iseqval); /* seems necessary iff RGenGC is disabled */
return newiseq;
}
VALUE
rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
{