summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-01-09gmake.mk: update srcdir filesnobu
* defs/gmake.mk (commit): update source files under the sources directory after commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: set ID to yylval ID instead of tokennobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: Remove special handling of tOROP and tANDOPmame
The complexity is no longer considered necessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09.gdbinit (print_lineno): follow up changes in r61534, r61536ktsj
insns_info was refactored. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: use change_shortcut_operator_idnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09wrap statement expression with __extension__nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09parse.y: Remove duplicated nd_line setyui-knk
* parse.y: These nodes are created with `@$` locations. Start position of `@$` is same as start position of `@1`. And NEW_XXX macros set first_loc.lineno of a passed code range to nd_line. So these nd_set_line are not needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09constifiednobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08vm.c: remove extra ifdefnobu
* vm.c (rb_execution_context_mark): VM_ASSERT works only if VM_CHECK_MODE > 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08use `getblockparamproxy` to pass blocks.ko1
* compile.c (setup_args): use `getblockparamproxy` (`rb_block_param_proxy`) to represent a block parameter passing. * vm_args.c (vm_caller_setup_arg_block): check `rb_block_param_proxy` instead of using `VM_CALL_ARGS_BLOCKARG_BLOCKPARAM` call flag. * vm_core.h (VM_CALL_ARGS_BLOCKARG_BLOCKPARAM): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08fix a bug only on assertion.ko1
* vm.c (rb_execution_context_mark): check escaped directly to skip assertions. Not sure why there is an inconsistency. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08* 2018-01-09svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08fix mark miss of Env (which is pointed by prev_ep).ko1
* vm.c (rb_execution_context_mark): r61624 and r61659 introduce marking miss bug for Env objects as a prev_ep which is contained by Proc objects because Proc objects can be collected when they should be living and Env objects will collected unexpectedly. This patch solves this problem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Make consistent with the terms about code ranges and locationsmame
"loc" was ambiguous; it might refer both a location and a code range. This change uses "loc" for a location, and "crange" or "cr" for a code range. A location (abbr. loc) is a point in a program and consists of line number and column number. A code range (abbr. crange and cr) is a range within a program and consists of a pair of locations which is the first and the last. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y (remove_duplicate_keys): Remove a not used argumentyui-knk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Factor out code fragments that merges two code rangesmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y (block_append_gen): Remove a not used argumentyui-knk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Use nd_loc of head and tailyui-knk
* parse.y (block_append_gen): Use nd_loc of head(tail) when create NEW_BLOCK of head(tail). e.g. The locations of the NODE_BLOCK is fixed: ``` BEGIN { :a } BEGIN { :b } ``` * Before ``` NODE_BLOCK (line: 5, code_range: (5,0)-(7,1)) ``` * After ``` NODE_BLOCK (line: 1, code_range: (1,0)-(7,1)) ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Fix the lineno of nd_set_lineyui-knk
* parse.y: Follow up of r61676. r61676 removed ruby_sourceline from some actions. When stop to use lineno of "n th" symbol, it's better to use last location's lineno of "n-1 th" symbol. e.g. ``` primary : k_begin {} bodystmt k_end ``` Before r61676 we use lineno of `@2` (ruby_sourceline). In this case, last location's lineno of `k_begin` (`@1`) is suitable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08net/http: clear compressed chunk after decompressionnormal
We no longer need the compressed data once the inflate block is called; so clear it ASAP to reduce memory overhead. This is a small chunk, so it only saves a few hundred kilobytes with the script below. before: RssAnon: 5976 kB after: RssAnon: 5564 kB ------ require 'net/http' require 'zlib' response_gz = ARGV.shift or abort "#$0 TEMPORARY_FILE" # pre-create response since compressing is slower than decompressing unless File.readable?(response_gz) nr = 16384 * 2 buf = ((0..255).map(&:chr).join * 128) File.open(response_gz, 'wb') do |fp| gzip = Zlib::GzipWriter.new(fp) nr.times { gzip.write(buf) } gzip.close end buf.clear end response_gz = File.open(response_gz) s = TCPServer.new('127.0.0.1', 0) pid = fork do c = s.accept c.readpartial(16384).clear c.write("HTTP/1.1 200 OK\r\n" \ "Content-Length: #{response_gz.stat.size}\r\n" \ "Content-Encoding: gzip\r\n" \ "Accept-Ranges: bytes\r\n" \ "\r\n") IO.copy_stream(response_gz, c) c.close end addr = s.addr Net::HTTP.start(addr[3], addr[1]) do |http| http.request_get(-'/') do |res| res.read_body(&:clear) end end puts File.readlines(-'/proc/self/status').grep(/RssAnon/)[0] Process.waitpid2(pid) ------ * lib/net/http/response.rb (inflate_adapter): clear compressed_chunk git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08Update minitest-5.11.1hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Remove dispose_stringmame
I think that recycling the delimiter string objects doesn't pay its complexity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08vm_insnhelper.c: vm_invoke_block_opt_callnobu
* vm_insnhelper.c (vm_invoke_block_opt_call): renamed with sliding arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08vm.c: respect redefinition of Proc#callnobu
* vm.c (vm_redefinition_check_method_type): hoist out method definition type to check redefinition. * vm.c (rb_vm_check_redefinition_opt_method): should check optimized method too. * vm.c (vm_init_redefined_flag): check Proc#call. * vm_insnhelper.c (vm_call_opt_block_call): search proper method if redefined. [Bug #14335] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08Add parens [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08node.c: show newline node marknobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Use last_loc.lineno instead of ruby_sourcelinemame
State-less way is better. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Remove `$<num>$ = ruby_sourceline` hacksmame
Instead, use bison's lineno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08compile.c: compile_case2 branchnobu
* compile.c (compile_case2): compile as a branch condition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: constified NULL_LOCnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08doc/NEWS-2.5.0: Time.at is a class methodmrkn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Factor out special handling of a short-cut operator idmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Remove duplicated nd_loc setyui-knk
* parse.y: nd_loc is set by NEW_CASE2/NEW_WHEN git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Embed simple wrapper functions for NEW_NODEsmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Make NULL_LOC to be internalyui-knk
* parse.y (NULL_LOC): We will create NODEs only inside of parse.y, so make NULL_LOC to be internal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: Remove unneeded wrapper functions for NEW_NODEsmame
Just refactoring. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: set bison's first_loc.lineno to nd_line by defaultmame
This change initializes nd_line, lineno of each node, by default, by using the first line number of code range that bison tracks, instead of extracting from lexer state. The lexer state basically provides only the last line number of code range, so many hacks are used to approximate the first line number. The hacks have been introduced on demand, or very ad-hocly. I think this change will make it possible to remove most of the hacks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08parse.y: make all NEW_NODE macros receive locationmame
This looks a big change, but just for refactoring. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08zlib: reduce garbage on Zlib::GzipReader#readpartialnormal
For garbage-concious users who use the `outbuf' argument of `readpartial' to supply a destination buffer, this provides a drastic reduction in garbage when inflating large inputs in a streaming fashion. This results in a anonymous RSS reduction in the reader similar to the reduction in the writer from r61631. Results using the test script from r61631 <https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61631> Before: writer 7.359999 0.000000 7.359999 ( 7.360639) writer RssAnon: 4040 kB reader 6.346667 0.070000 6.416667 ( 7.387654) reader RssAnon: 98272 kB After: writer 7.309999 0.000000 7.309999 ( 7.310651) writer RssAnon: 4048 kB reader 6.146666 0.003333 6.149999 ( 7.334868) reader RssAnon: 4300 kB * ext/zlib/zlib.c (struct read_raw_arg): new struct (gzfile_read_raw_partial): use read_raw_arg (gzfile_read_raw_rescue): ditto (gzfile_read_raw): accept outbuf, use read_raw_arg (gzfile_read_raw_ensure): accept outbuf (gzfile_read_header): ditto (gzfile_check_footer): ditto (gzfile_read_more): ditto (gzfile_read_raw_until_zero): adjust for changes (gzfile_fill): ditto (gzfile_readpartial): ditto (gzfile_read_all): ditto (gzfile_getc): ditto (gzfile_reader_end_run): ditto (gzfile_reader_get_unused): ditto (rb_gzreader_initialize): ditto (gzreader_skip_linebreaks): ditto (gzreader_gets): ditto (zlib_gunzip_run): ditto [ruby-core:84660] [Feature #14319] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08open-uri: clear string after bufferingnormal
Since r58846 (in Ruby 2.5), it is safe to clear the string yielded to Net::HTTPResponse#read_body methods. This reduces malloc garbage (anonymous RSS) using the Linux-only script below: before: user system total real 0.030000 0.250000 0.280000 ( 0.280511) RssAnon: 60240 kB after: user system total real 0.050000 0.223333 0.273333 ( 0.273118) RssAnon: 6676 kB ------ # warning this script requires 1G free space for buffering require 'open-uri' require 'socket' require 'benchmark' s = TCPServer.new('127.0.0.1', 0) len = 1024 * 1024 * 1024 buf = ((0..255).map(&:chr).join * 128) nr = len / buf.size pid = fork do c = s.accept c.readpartial(16384).clear c.write("HTTP/1.1 200 OK\r\n" \ "Content-Length: #{len}\r\n" \ "Content-Type: application/octet-stream\r\n" \ "\r\n") buf.freeze # speeds up IO#write slightly nr.times { c.write(buf) } c.close end addr = s.addr open("http://#{addr[3]}:#{addr[1]}/", "rb") do |fp| bm = Benchmark.measure do while fp.read(16384, buf) end end puts bm end puts File.readlines("/proc/#$$/status").grep(/RssAnon/)[0] Process.waitpid2(pid) ------ * lib/open-uri.rb: clear string yielded by Net::HTTPResponse#read_body [ruby-core:84662] [Feature #14320] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08net/protocol: read directly into rbuf if it's emptynormal
There's no need to allocate a temporary string when @rbuf is empty, we can use it as the read_nonblock destination buffer to save both allocation overhead and avoid a later memcpy. This results in a halving user CPU time and tiny memory reduction with the script below: user system total real before 0.603333 0.539999 1.143332 ( 1.143347) RssAnon: 5624 kB after 0.283334 0.560000 0.843334 ( 0.846072) RssAnon: 5592 kB ------ require 'net/http' require 'benchmark' s = TCPServer.new('127.0.0.1', 0) len = 1024 * 1024 * 1024 * 2 pid = fork do c = s.accept c.readpartial(16384).clear c.send("HTTP/1.0 200 OK\r\nContent-Length: #{len}\r\n\r\n", Socket::MSG_MORE) IO.copy_stream('/dev/zero', c, len) c.close end addr = s.addr Net::HTTP.start(addr[3], addr[1]) do |http| http.request_get('/') do |res| puts(Benchmark.measure { res.read_body(&:clear) }) end end puts File.readlines("/proc/self/status").grep(/RssAnon/)[0] Process.waitpid2(pid) ------ * lib/net/protocol.rb (rbuf_fill): avoid allocation if rbuf is empty [ruby-core:84678] [Feature #14326] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08net/protocol: use binary string buffersnormal
Not an encoding expert, but this seems necessary for the next change. All of the IO#read, IO#read_nonblock and related methods will return a binary string when given a length argument; so anything appended to these buffers via << will be binary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07Speedup `block.call` [Feature #14330]ko1
* insns.def (getblockparamproxy): introduce new instruction to return the `rb_block_param_proxy` object if possible. This object responds to `call` method and invoke given block (completely similar to `yield`). * method.h (OPTIMIZED_METHOD_TYPE_BLOCK_CALL): add new optimized call type which is for `rb_block_param_proxy.cal`. * vm_insnhelper.c (vm_call_method_each_type): ditto. * vm_insnhelper.c (vm_call_opt_block_call): ditto. * vm_core.h (BOP_CALL, PROC_REDEFINED_OP_FLAG): add check for `Proc#call` redefinition. * compile.c (iseq_compile_each0): compile to use new insn `getblockparamproxy` for method call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07lib/scanf.rb: [DOC] fix typosstomar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07* 2018-01-08svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07doc/NEWS-2.5.0: improve languagestomar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07node.c: fix SEGV of `->(a:){}` when --dump=parsetreemame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07parse.y: do not overwrite case_body positionnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07parse.y: set case_body line position to argsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-07parse.y: removed unused macro new_command_callnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e