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

ruby-changes:26729

From: usa <ko1@a...>
Date: Fri, 11 Jan 2013 17:13:27 +0900 (JST)
Subject: [ruby-changes:26729] usa:r38781 (ruby_1_9_3): merge revision(s) 38739: [Backport #7671]

usa	2013-01-11 17:13:17 +0900 (Fri, 11 Jan 2013)

  New Revision: 38781

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

  Log:
    merge revision(s) 38739: [Backport #7671]
    
    * vm_core.h (rb_iseq_t): move flip_cnt from struct iseq_compile_data,
      because it has same life span as enclosing iseq.  [Bug #7671]
      [ruby-core:51296]

  Modified directories:
    branches/ruby_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/compile.c
    branches/ruby_1_9_3/iseq.h
    branches/ruby_1_9_3/test/ruby/test_flip.rb
    branches/ruby_1_9_3/version.h
    branches/ruby_1_9_3/vm_core.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 38780)
+++ ruby_1_9_3/ChangeLog	(revision 38781)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Fri Jan 11 17:12:44 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_core.h (rb_iseq_t): move flip_cnt from struct iseq_compile_data,
+	  because it has same life span as enclosing iseq.  [Bug #7671]
+	  [ruby-core:51296]
+
 Fri Jan 11 17:11:26 2013  NARUSE, Yui  <naruse@r...>
 
 	* lib/mkmf.rb: add dummy clean-static target to prevent errors for the
Index: ruby_1_9_3/vm_core.h
===================================================================
--- ruby_1_9_3/vm_core.h	(revision 38780)
+++ ruby_1_9_3/vm_core.h	(revision 38781)
@@ -252,6 +252,7 @@ struct rb_iseq_struct { https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/vm_core.h#L252
 
     /* misc */
     ID defined_method_id;	/* for define_method */
+    rb_num_t flip_cnt;
 
     /* used at compile time */
     struct iseq_compile_data *compile_data;
Index: ruby_1_9_3/iseq.h
===================================================================
--- ruby_1_9_3/iseq.h	(revision 38780)
+++ ruby_1_9_3/iseq.h	(revision 38781)
@@ -94,7 +94,6 @@ struct iseq_compile_data { https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/iseq.h#L94
     struct iseq_compile_data_storage *storage_current;
     int last_line;
     int last_coverable_line;
-    int flip_cnt;
     int label_no;
     int node_level;
     const rb_compile_option_t *option;
Index: ruby_1_9_3/compile.c
===================================================================
--- ruby_1_9_3/compile.c	(revision 38780)
+++ ruby_1_9_3/compile.c	(revision 38781)
@@ -4844,12 +4844,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/compile.c#L4844
 	LABEL *lend = NEW_LABEL(nd_line(node));
 	LABEL *lfin = NEW_LABEL(nd_line(node));
 	LABEL *ltrue = NEW_LABEL(nd_line(node));
-	struct iseq_compile_data *data = iseq->local_iseq->compile_data;
+	rb_iseq_t *local_iseq = iseq->local_iseq;
 	rb_num_t cnt;
 	VALUE key;
 
-	if (!data) data = iseq->compile_data;
-	cnt = data->flip_cnt++ + DEFAULT_SPECIAL_VAR_COUNT;
+	cnt = local_iseq->flip_cnt++ + DEFAULT_SPECIAL_VAR_COUNT;
 	key = INT2FIX(cnt);
 
 	ADD_INSN2(ret, nd_line(node), getspecial, key, INT2FIX(0));
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 38780)
+++ ruby_1_9_3/version.h	(revision 38781)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 366
+#define RUBY_PATCHLEVEL 367
 
 #define RUBY_RELEASE_DATE "2013-01-11"
 #define RUBY_RELEASE_YEAR 2013
Index: ruby_1_9_3/test/ruby/test_flip.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_flip.rb	(revision 38780)
+++ ruby_1_9_3/test/ruby/test_flip.rb	(revision 38781)
@@ -10,4 +10,12 @@ class TestFlip < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_flip.rb#L10
       2000.times {eval %[(foo..bar) ? 1 : 2]}
     end
   end
+
+  def test_shared_eval
+    bug7671 = '[ruby-core:51296]'
+    vs = (1..9).to_a
+    vs.select {|n| if n==2..n==16 then 1 end}
+    v = eval("vs.select {|n| if n==3..n==6 then 1 end}")
+    assert_equal([*3..6], v, bug7671)
+  end
 end

Property changes on: ruby_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r38739


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

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