aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Rename imemo_alloc with imemo_tmpbufmame2018-05-095-35/+35
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (rb_imemo_alloc_new): split for each purposemame2018-05-093-22/+34
| | | | | | | | | | | imemo_alloc is used for three purposes: auto-free pointer (alternative of alloca), alloc_tmp_buffer, and heap allocation for bison. To make it clear, this change introduces three functions: rb_imemo_alloc_auto_free_pointer, rb_imemo_alloc_auto_free_maybe_mark_buffer, and rb_imemo_alloc_parser_heap. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* type func(); is different from type func(void);shyouhei2018-05-091-1/+1
| | | | | | | | | | If a function declarator includes no parameter list, that doesn't mean the function takes zero parameter. rb_ast_new here does take zero parameter, so it should be explicitly prototypes as (void). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (rb_imemo_alloc_new): improve the API interfacemame2018-05-093-14/+14
| | | | | | | | rb_imemo_alloc_new returns rb_imemo_alloc_t*, but took VALUEs, which is inconsistent. To make the intention clear, it now takes only a pointer to the buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* RSTRING_PTR is not guaranteed to be VALUE-aligned (retry)shyouhei2018-05-094-10/+10
| | | | | | | | Don't abuse struct RString to hold arbitrary memory region. Raw pointer should just suffice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fixed file structure for csv.gemspec.hsbt2018-05-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * properties.svn2018-05-090-0/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * append newline at EOF.svn2018-05-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Merge csv-1.0.2 from upstream.hsbt2018-05-0918-860/+1335
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert r63362 due to test failure. Sorry!shyouhei2018-05-091-7/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* RSTRING_PTR is not guaranteed to be VALUE-alignedshyouhei2018-05-091-5/+7
| | | | | | | | Don't abuse struct RString to hold arbitrary memory region. use rb_alloc_tmp_buffer for that purpose. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-05-09svn2018-05-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* _mjit_compile_pc_and_sp.erb: make sure no uninitializedk0kubun2018-05-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | area on VM stack to prevent SEGV on GC. GC may mark every value in VM stack. Unfortunately I couldn't write a test for it... So let me explain the situation. SEGV example: https://gist.github.com/k0kubun/c7cea2b5761ffdff29ec79ea1a8f7f91 ``` $ ruby --dump=insns -e 'def oct(num, len); "%0#{len}o" % num; end' == disasm: #<ISeq:oct@-e:1 (1,0)-(1,41)> (catch: FALSE) local table (size: 2, argc: 2 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) [ 2] num@0<Arg> [ 1] len@1<Arg> 0000 putobject "%0" ( 1)[LiCa] 0002 getlocal_WC_0 len@1 0004 dup 0005 checktype T_STRING 0007 branchif 14 0009 dup 0010 opt_send_without_block <callinfo!mid:to_s, argc:0, FCALL|ARGS_SIMPLE>, <callcache> 0013 tostring 0014 putobject "o" 0016 concatstrings 3 0018 getlocal_WC_0 num@0 0020 opt_mod <callinfo!mid:%, argc:1, ARGS_SIMPLE>, <callcache> 0023 leave [Re] ``` Prior to this commit, after arguments are pushed on 0010, stacks were: VM stack: [uninitialized, uninitialized, len] JIT stack: ["%0", len, len] And then, when GC is invoked on 0016, VM stack will be [uninitialized, uninitialized] and those uninitialized values will be marked by GC. With this commit, after arguments are pushed on 0010, stacks will be: VM stack: [len] JIT stack: ["%0", len, len] And VM stack will be [] on 0016. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: eval_string_protect wrappernobu2018-05-081-1/+7
| | | | | | | | * vm_eval.c (eval_string_protect): cast data instead of the function pointer, to suppress "cast between incompatible function types" warning by gcc 8.1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rb_ary_dig, rb_hash_dig: nobody is using them outside.shyouhei2018-05-082-2/+2
| | | | | | | mark them static. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix type mismatch.ko12018-05-081-1/+1
| | | | | | | * cont.c (fiber_context_create): `func` should accept variable args. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Merge rdoc-6.0.4 from upstream.hsbt2018-05-083-60/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: host out context setupnobu2018-05-081-6/+13
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove unreachable breakkazu2018-05-081-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Modify spaces [ci skip]kazu2018-05-081-5/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: wrapper functionnobu2018-05-071-1/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: refined error messagenobu2018-05-071-2/+4
| | | | | | | * cont.c (fiber_machine_stack_alloc): refined the error message on failure at setting a guard page. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* _mjit_compile_send.erb: inline recursive callk0kubun2018-05-073-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mjit_compile.c: propagate funcname to compile_insn test_jit.rb: add test covering this behavior * Benchmark ``` require 'benchmark_driver' Benchmark.driver(runner: :time, repeat_count: 4) do |x| x.prelude %{ def fib(x) return x if x == 0 || x == 1 fib(x-1) + fib(x-2) end } x.report 'fib(40)' x.loop_count 1 x.rbenv( 'before,--jit', 'before', 'after,--jit', 'after', ) x.verbose end ``` ``` before,--jit: ruby 2.6.0dev (2018-05-08 trunk 63349) +JIT [x86_64-linux] before: ruby 2.6.0dev (2018-05-08 trunk 63349) [x86_64-linux] after,--jit: ruby 2.6.0dev (2018-05-08 trunk 63349) +JIT [x86_64-linux] last_commit=_mjit_compile_send.erb: inline recursive call after: ruby 2.6.0dev (2018-05-08 trunk 63349) [x86_64-linux] last_commit=_mjit_compile_send.erb: inline recursive call Calculating ------------------------------------- before,--jit before after,--jit after fib(40) 2.886 8.685 2.562 8.800 s - 1.000 times Comparison: fib(40) after,--jit: 2.6 s before,--jit: 2.9 s - 1.13x slower before: 8.7 s - 3.39x slower after: 8.8 s - 3.44x slower ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove needless require [ci skip]kazu2018-05-071-2/+0
| | | | | | already require on top git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-05-08svn2018-05-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use `&.` instead of modifier if and remove needless closed?kazu2018-05-071-6/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix a typo [ci skip]kazu2018-05-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-05-07svn2018-05-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: machine stack cache conditionnobu2018-05-071-5/+5
| | | | | | | | * cont.c (fiber_store, rb_fiber_terminate): separate the condition to cache machine stacks, which is not directly restricted to the platforms, and may be used on Windows too in the future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-05-06svn2018-05-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse: Suppress warningsnobu2018-05-062-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Ruby warns "instance variable `@version` not initialized" for optparse when it receives `--version` option. `test.rb` ```ruby require 'optparse' Version = '1' OptionParser.new.parse(ARGV) ``` ``` $ ruby -w test.rb --version /home/pocke/.rbenv/versions/2.5.1/lib/ruby/2.5.0/optparse.rb:1168: warning: instance variable @version not initialized /home/pocke/.rbenv/versions/2.5.1/lib/ruby/2.5.0/optparse.rb:1175: warning: instance variable @release not initialized test 1 ``` This change will suppress the warnings. [Fix GH-1871] From: Masataka Pocke Kuwabara <kuwabara@pocke.me> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* securerandom.rb: [DOC] require in examplesnobu2018-05-051-0/+14
| | | | | | | | | | * lib/securerandom.rb: added `require 'securerandom'` to each example, to state these methods are defined in this library and require it explicitly. [ruby-core:85933] [Bug #14576] [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* forgot to add INT2FIX (sorry!)shyouhei2018-05-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* passing rb_thread_sleep to rb_protect is IMHO dangerousshyouhei2018-05-041-1/+8
| | | | | | | | | | rb_thread_sleep's argument is int, while rb_protect expects the function to take VALUE. Depending on ABI this could be a problem. We should wrap rb_thread_sleep here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-05-05svn2018-05-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* nobody is using the return value of rb_io_fptr_finalizeshyouhei2018-05-042-5/+22
| | | | | | | | However this function is listed in ruby/io.h. We cannot but define a new, void-returning variant to use instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use `&.` instead of modifier ifkazu2018-05-041-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-05-04svn2018-05-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* object.c: raise on long invalid float stringnobu2018-05-042-1/+31
| | | | | | | | * object.c (rb_cstr_to_dbl_raise): check long invalid float string more precisely when truncating insignificant part. [ruby-core:86800] [Bug #14729] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* _mjit_compile_send.erb: retry inlining attr_readerk0kubun2018-05-035-15/+76
| | | | | | | | | | | | | | | | | This reverts r63249 (revert r63212) and fixes a bug in it. The test to prevent the bug is added as well. vm_insnhelper.c: add `index` argument to vm_getivar. The argument is created so that MJIT can pass the value of `cc->aux.index` on compilation time. The cache invalidation in _mjit_compile_send_guard.erb is only working for the cache value on compilation time. Note: As `index` is always passed as constant and it's force-inlined, the performance of `vm_getivar` won't be degraded in VM. _mjit_compile_send_guard.erb: New. Used to invalidate inlined values of cc. common.mk: update dependencies for _mjit_compile_send_guard.erb git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit_compile.c: skip generating unnecessary gotok0kubun2018-05-031-5/+5
| | | | | | | | after return or longjmp. This is mainly for skipping the check of stack size in such cases, which shouldn't be checked because it does never happen. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit_compile.c: verify stack size agreementk0kubun2018-05-032-9/+24
| | | | | | | | | between branches. mjit_compile.inc.erb: move the compiled_for_pos reference to mjit_compile.c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "ext/cgi/escape: preserve String subclass in result"normal2018-05-032-26/+5
| | | | | | | This reverts commit 6afea14043b0c0e603f26c89ae0d043f65852668 r63328 I misread the original bug report and got results flipped. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit_compile.inc.erb: verify stack consistencyk0kubun2018-05-032-5/+16
| | | | | | | | on JIT compilation. r63092 was risky without this check. mjit_compile.c: update comment about stack consistency check git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/cgi/escape: preserve String subclass in resultnormal2018-05-022-5/+26
| | | | | | | | | | | * ext/cgi/escape/escape.c (optimized_escape_html): use rb_str_new_with_class (optimized_unescape_html): ditto (optimized_escape): ditto (optimized_unescape): ditto * test/cgi/test_cgi_util.rb (test_escape_string_subclass): new test [ruby-core:86847] [Bug #14732] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: test local variablesk0kubun2018-05-021-4/+17
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: test opt_aref_with againk0kubun2018-05-021-1/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: make it possible to automatically findk0kubun2018-05-021-7/+43
| | | | | | untested insns. Resolved some warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-05-03svn2018-05-021-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: verify tested insnsk0kubun2018-05-021-68/+102
| | | | | | and fix some untested insns git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e