Permalink
Browse files

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]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 8b49c71 commit 3468cd1ed68ac08b19fffd78442b5de3a622c6ce @unak unak committed Jan 11, 2013
Showing with 18 additions and 5 deletions.
  1. +6 −0 ChangeLog
  2. +2 −3 compile.c
  3. +0 −1 iseq.h
  4. +8 −0 test/ruby/test_flip.rb
  5. +1 −1 version.h
  6. +1 −0 vm_core.h
View
6 ChangeLog
@@ -1,3 +1,9 @@
+Fri Jan 11 17:12:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* lib/mkmf.rb: add dummy clean-static target to prevent errors for the
View
5 compile.c
@@ -4844,12 +4844,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
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));
View
1 iseq.h
@@ -94,7 +94,6 @@ struct iseq_compile_data {
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;
View
8 test/ruby/test_flip.rb
@@ -10,4 +10,12 @@ def test_hidden_key
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
View
2 version.h
@@ -1,5 +1,5 @@
#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
View
1 vm_core.h
@@ -252,6 +252,7 @@ struct rb_iseq_struct {
/* misc */
ID defined_method_id; /* for define_method */
+ rb_num_t flip_cnt;
/* used at compile time */
struct iseq_compile_data *compile_data;

0 comments on commit 3468cd1

Please sign in to comment.