From f395c5be87dac498debc538d2d57953a74f97cb0 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 7 Jul 2015 02:41:52 +0000 Subject: [PATCH] * vm_core.h: remove rb_iseq_t::orig because rb_iseq_clone() no longer exists. * iseq.c: don't use rb_iseq_t::orig. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 ++++ iseq.c | 121 ++++++++++++++++++++++++------------------------------ vm_core.h | 1 - 3 files changed, 61 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index 296bdbe576..a22b7d5f96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Jul 7 11:37:25 2015 Koichi Sasada + + * vm_core.h: remove rb_iseq_t::orig because rb_iseq_clone() + no longer exists. + + * iseq.c: don't use rb_iseq_t::orig. + Tue Jul 07 11:25:57 2015 Koichi Sasada * iseq.c, internal.h (rb_iseq_clone): removed because we don't need to diff --git a/iseq.c b/iseq.c index ee66e48e1d..cd7f67ac14 100644 --- a/iseq.c +++ b/iseq.c @@ -66,40 +66,34 @@ compile_data_free(struct iseq_compile_data *compile_data) static void iseq_free(void *ptr) { - rb_iseq_t *iseq; RUBY_FREE_ENTER("iseq"); if (ptr) { int i; - iseq = ptr; - if (!iseq->orig) { - /* It's possible that strings are freed */ - if (0) { - RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->location.label), - RSTRING_PTR(iseq->location.path)); - } + rb_iseq_t *iseq = ptr; - RUBY_FREE_UNLESS_NULL(iseq->iseq_encoded); - RUBY_FREE_UNLESS_NULL(iseq->line_info_table); - RUBY_FREE_UNLESS_NULL(iseq->local_table); - RUBY_FREE_UNLESS_NULL(iseq->is_entries); - if (iseq->callinfo_entries) { - for (i=0; icallinfo_size; i++) { - /* TODO: revisit callinfo data structure */ - rb_call_info_kw_arg_t *kw_arg = iseq->callinfo_entries[i].kw_arg; - RUBY_FREE_UNLESS_NULL(kw_arg); - } - RUBY_FREE_UNLESS_NULL(iseq->callinfo_entries); + ruby_xfree(iseq->iseq_encoded); + ruby_xfree(iseq->line_info_table); + ruby_xfree(iseq->local_table); + ruby_xfree(iseq->is_entries); + + if (iseq->callinfo_entries) { + for (i=0; icallinfo_size; i++) { + /* TODO: revisit callinfo data structure */ + rb_call_info_kw_arg_t *kw_arg = iseq->callinfo_entries[i].kw_arg; + ruby_xfree(kw_arg); } - RUBY_FREE_UNLESS_NULL(iseq->catch_table); - RUBY_FREE_UNLESS_NULL(iseq->param.opt_table); - if (iseq->param.keyword != NULL) { - RUBY_FREE_UNLESS_NULL(iseq->param.keyword->default_values); - RUBY_FREE_UNLESS_NULL(iseq->param.keyword); - } - compile_data_free(iseq->compile_data); - RUBY_FREE_UNLESS_NULL(iseq->iseq); + ruby_xfree(iseq->callinfo_entries); } + ruby_xfree(iseq->catch_table); + ruby_xfree(iseq->param.opt_table); + if (iseq->param.keyword != NULL) { + ruby_xfree(iseq->param.keyword->default_values); + ruby_xfree(iseq->param.keyword); + } + compile_data_free(iseq->compile_data); + ruby_xfree(iseq->iseq); + ruby_xfree(ptr); } RUBY_FREE_LEAVE("iseq"); @@ -115,17 +109,12 @@ iseq_mark(void *ptr) RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->location.label), RSTRING_PTR(iseq->location.path)); - if (!iseq->orig) { - RUBY_MARK_UNLESS_NULL(iseq->mark_ary); - RUBY_MARK_UNLESS_NULL(iseq->location.label); - RUBY_MARK_UNLESS_NULL(iseq->location.base_label); - RUBY_MARK_UNLESS_NULL(iseq->location.path); - RUBY_MARK_UNLESS_NULL(iseq->location.absolute_path); - RUBY_MARK_UNLESS_NULL(iseq->coverage); - } - else { - RUBY_MARK_UNLESS_NULL(iseq->orig); - } + RUBY_MARK_UNLESS_NULL(iseq->mark_ary); + RUBY_MARK_UNLESS_NULL(iseq->location.label); + RUBY_MARK_UNLESS_NULL(iseq->location.base_label); + RUBY_MARK_UNLESS_NULL(iseq->location.path); + RUBY_MARK_UNLESS_NULL(iseq->location.absolute_path); + RUBY_MARK_UNLESS_NULL(iseq->coverage); if (iseq->compile_data != 0) { struct iseq_compile_data *const compile_data = iseq->compile_data; @@ -141,38 +130,36 @@ static size_t iseq_memsize(const void *ptr) { size_t size = sizeof(rb_iseq_t); - const rb_iseq_t *iseq; if (ptr) { - iseq = ptr; - if (!iseq->orig) { + const rb_iseq_t *iseq = ptr; + + size += iseq->iseq_size * sizeof(VALUE); + size += iseq->line_info_size * sizeof(struct iseq_line_info_entry); + size += iseq->local_table_size * sizeof(ID); + if (iseq->catch_table) { + size += iseq_catch_table_bytes(iseq->catch_table->size); + } + size += (iseq->param.opt_num + 1) * sizeof(VALUE); + if (iseq->param.keyword != NULL) { + size += sizeof(struct rb_iseq_param_keyword); + size += sizeof(VALUE) * (iseq->param.keyword->num - iseq->param.keyword->required_num); + } + size += iseq->is_size * sizeof(union iseq_inline_storage_entry); + size += iseq->callinfo_size * sizeof(rb_call_info_t); + + if (iseq->compile_data) { + struct iseq_compile_data_storage *cur; + + cur = iseq->compile_data->storage_head; + while (cur) { + size += cur->size + SIZEOF_ISEQ_COMPILE_DATA_STORAGE; + cur = cur->next; + } + size += sizeof(struct iseq_compile_data); + } + if (iseq->iseq) { size += iseq->iseq_size * sizeof(VALUE); - size += iseq->line_info_size * sizeof(struct iseq_line_info_entry); - size += iseq->local_table_size * sizeof(ID); - if (iseq->catch_table) { - size += iseq_catch_table_bytes(iseq->catch_table->size); - } - size += (iseq->param.opt_num + 1) * sizeof(VALUE); - if (iseq->param.keyword != NULL) { - size += sizeof(struct rb_iseq_param_keyword); - size += sizeof(VALUE) * (iseq->param.keyword->num - iseq->param.keyword->required_num); - } - size += iseq->is_size * sizeof(union iseq_inline_storage_entry); - size += iseq->callinfo_size * sizeof(rb_call_info_t); - - if (iseq->compile_data) { - struct iseq_compile_data_storage *cur; - - cur = iseq->compile_data->storage_head; - while (cur) { - size += cur->size + SIZEOF_ISEQ_COMPILE_DATA_STORAGE; - cur = cur->next; - } - size += sizeof(struct iseq_compile_data); - } - if (iseq->iseq) { - size += iseq->iseq_size * sizeof(VALUE); - } } } diff --git a/vm_core.h b/vm_core.h index 41d0ff6573..5d210c6ae3 100644 --- a/vm_core.h +++ b/vm_core.h @@ -345,7 +345,6 @@ struct rb_iseq_struct { /****************/ VALUE self; - const VALUE orig; /* non-NULL if its data have origin */ /* misc */ rb_num_t flip_cnt;