8000 merge revision(s) r45553,r45554,r45557,r45558,r45561,r45566,r45567: [… · github/ruby@e973ab4 · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit e973ab4

Browse files
committed
merge revision(s) r45553,r45554,r45557,r45558,r45561,r45566,r45567: [Backport ruby#9718]
* array.c (rb_ary_modify): remember shared array owner if a shared array owner is promoted and a shared array is not promoted. Now, shared array is WB-unprotected so that shared arrays are not promoted. All objects referred from shared array should be marked correctly. [ruby-core:61919] [ruby-trunk - Bug ruby#9718] * test/ruby/test_array.rb: add a test for above. * test/ruby/test_array.rb: remove useless `assert'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent d41b88b commit e973ab4

File tree

5 files changed

+53
-3
lines changed

5 files changed

+53
-3
lines changed

ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
Mon May 19 00:47:00 2014 Koichi Sasada <ko1@atdot.net>
2+
3+
* test/ruby/test_array.rb: remove useless `assert'.
4+
5+
Mon May 19 00:47:00 2014 Koichi Sasada <ko1@atdot.net>
6+
7+
* array.c (rb_ary_modify): remember shared array owner if a shared
8+
array owner is promoted and a shared array is not promoted.
9+
10+
Now, shared array is WB-unprotected so that shared arrays are not
11+
promoted. All objects referred from shared array should be marked
12+
correctly.
13+
14+
[ruby-core:61919] [ruby-trunk - Bug #9718]
15+
16+
* test/ruby/test_array.rb: add a test for above.
17+
118
Mon May 19 00:26:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
219

320
* parse.y (parser_yylex): only a newline after label should be

array.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ rb_ary_modify(VALUE ary)
343343
ARY_SET_CAPA(ary, len);
344344
ARY_SET_PTR(ary, ptr);
345345
}
346+
347+
/* TODO: age2 promotion, OBJ_PROMOTED() checks not infant. */
348+
if (OBJ_PROMOTED(ary) && !OBJ_PROMOTED(shared)) {
349+
rb_gc_writebarrier_remember_promoted(ary);
350+
}
346351
}
347352
}
348353

test/ruby/envutil.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def rubybin
3030
LANG_ENVS = %w"LANG LC_ALL LC_CTYPE"
3131

3232
def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr = false,
33-
encoding: nil, timeout: 10, reprieve: 1, **opt)
33+
encoding: nil, timeout: 10, reprieve: 1,
34+
stdout_filter: nil, stderr_filter: nil,
35+
**opt)
3436
in_c, in_p = IO.pipe
3537
out_p, out_c = IO.pipe if capture_stdout
3638
err_p, err_c = IO.pipe if capture_stderr && capture_stderr != :merge_to_stdout
@@ -84,6 +86,8 @@ def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr =
8486
err_p.close if capture_stderr && capture_stderr != :merge_to_stdout
8587
Process.wait pid
8688
status = $?
89+
stdout = stdout_filter.call(stdout) if stdout_filter
90+
stderr = stderr_filter.call(stderr) if stderr_filter
8791
return stdout, stderr, status
8892
end
8993
ensure

test/ruby/test_array.rb

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2389,7 +2389,7 @@ def test_rotate!
23892389
assert_equal([], a.rotate!(13))
23902390
assert_equal([], a.rotate!(-13))
23912391
a = [].freeze
2392-
assert_raise_with_message(RuntimeError, /can't modify frozen/) {a.rotate!}
2392+
assert_raise_with_message(RuntimeError, /can\'t modify frozen/) {a.rotate!}
23932393
a = [1,2,3]
23942394
assert_raise(ArgumentError) { a.rotate!(1, 1) }
23952395
end
@@ -2428,4 +2428,28 @@ def test_bsearch_in_find_any_mode
24282428

24292429
assert_include([4, 7], a.bsearch {|x| (2**100).coerce((1 - x / 4) * (2**100)).first })
24302430
end
2431+
2432+
def test_shared_marking
2433+
reduce = proc do |s|
2434+
s.gsub(/(verify_internal_consistency_reachable_i:\sWB\smiss\s\S+\s\(T_ARRAY\)\s->\s)\S+\s\((proc|T_NONE)\)\n
2435+
\K(?:\1\S+\s\(\2\)\n)*/x) do
2436+
"...(snip #{$&.count("\n")} lines)...\n"
2437+
end
2438+
end
2439+
begin
2440+
assert_normal_exit(<<-EOS, '[Bug #9718]', timeout: 5, stdout_filter: reduce)
2441+
queue = []
2442+
50.times do
2443+
10_000.times do
2444+
queue << lambda{}
2445+
end
2446+
GC.start(full_mark: false, immediate_sweep: true)
2447+
GC.verify_internal_consistency
2448+
queue.shift.call
2449+
end
2450+
EOS
2451+
rescue Timeout::Error => e
2452+
skip e.message
2453+
end
2454+
end
24312455
end

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.2"
22
#define RUBY_RELEASE_DATE "2014-05-19"
3-
#define RUBY_PATCHLEVEL 103
3+
#define RUBY_PATCHLEVEL 104
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 5

0 commit comments

Comments
 (0)
0