[前][次][番号順一覧][スレッド一覧]

ruby-changes:39091

From: ko1 <ko1@a...>
Date: Tue, 7 Jul 2015 11:42:10 +0900 (JST)
Subject: [ruby-changes:39091] ko1:r51172 (trunk): * vm_core.h: remove rb_iseq_t::orig because rb_iseq_clone()

ko1	2015-07-07 11:41:52 +0900 (Tue, 07 Jul 2015)

  New Revision: 51172

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51172

  Log:
    * vm_core.h: remove rb_iseq_t::orig because rb_iseq_clone()
      no longer exists.
    * iseq.c: don't use rb_iseq_t::orig.

  Modified files:
    trunk/ChangeLog
    trunk/iseq.c
    trunk/vm_core.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51171)
+++ ChangeLog	(revision 51172)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul  7 11:37:25 2015  Koichi Sasada  <ko1@a...>
+
+	* 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  <ko1@a...>
 
 	* iseq.c, internal.h (rb_iseq_clone): removed because we don't need to
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 51171)
+++ vm_core.h	(revision 51172)
@@ -345,7 +345,6 @@ struct rb_iseq_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L345
     /****************/
 
     VALUE self;
-    const VALUE orig;			/* non-NULL if its data have origin */
 
     /* misc */
     rb_num_t flip_cnt;
Index: iseq.c
===================================================================
--- iseq.c	(revision 51171)
+++ iseq.c	(revision 51172)
@@ -66,40 +66,34 @@ compile_data_free(struct iseq_compile_da https://github.com/ruby/ruby/blob/trunk/iseq.c#L66
 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; i<iseq->callinfo_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; i<iseq->callinfo_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) https://github.com/ruby/ruby/blob/trunk/iseq.c#L109
 
 	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 https://github.com/ruby/ruby/blob/trunk/iseq.c#L130
 iseq_memsize(const void *ptr)
 {
     size_t size = sizeof(rb_iseq_t);
-    const rb_iseq_t *iseq;
 
     if (ptr) {
-	iseq = ptr;
-	if (!iseq->orig) {
-	    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);
+	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;
+	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);
+	    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);
 	}
     }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]