aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2418 from jeremyevans/array-empty-kwsplatJeremy Evans2019-09-021-2/+16
| | | Ignore empty keyword splats in arrays
* Fix compilation error in SUPPORT_JOKETakashi Kokubun2019-09-021-3/+4
| | | | This seems to have been broken since 4e15be8bade.
* opt_regexpmatch1 is actually making things slower.Urabe, Shyouhei2019-09-021-20/+4
| | | | | | | | | | | | | | | | ---- trunk: ruby 2.6.0dev (2018-09-18 trunk 64767) [x86_64-darwin15] ours: ruby 2.6.0dev (2018-09-18 opt_regexpmatch 64775) [x86_64-darwin15] last_commit=opt_regexpmatch1 is actually making things slower. Calculating ------------------------------------- trunk ours Optcarrot Lan_Master.nes 33.877 35.282 fps Comparison: Optcarrot Lan_Master.nes ours: 35.3 fps trunk: 33.9 fps - 1.04x slower
* Make pattern matching support **nil syntaxKazuki Tsujimoto2019-09-011-4/+19
|
* Support **nil syntax for specifying a method does not accept keyword argumentsJeremy Evans2019-08-301-0/+3
| | | | | | | | | This syntax means the method should be treated as a method that uses keyword arguments, but no specific keyword arguments are supported, and therefore calling the method with keyword arguments will raise an ArgumentError. It is still allowed to double splat an empty hash when calling the method, as that does not pass any keyword arguments.
* Separate keyword arguments from positional argumentsYusuke Endoh2019-08-301-2/+5
| | | | And, allow non-symbol keys as a keyword arugment
* rb_hash_foreach now free from ANYARGS卜部昌平2019-08-271-1/+1
| | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit adds function prototypes for rb_hash_foreach / st_foreach_safe. Also fixes some prototype mismatches.
* decouple compile.c usage of imemo_ifunc卜部昌平2019-08-271-21/+24
| | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from struct vm_ifunc, but in doing so we also have to decouple the usage of this struct in compile.c, which (I think) is an abuse of ANYARGS.
* compile.c: remove const from the first argument of dladdrYusuke Endoh2019-08-271-1/+1
| | | | Unfortunately, dladdr accepts void*, not const void*, in Solaris.
* Switch to using a VM stack argument instead of 2nd operand for getconstantJeremy Evans2019-08-141-7/+14
| | | | | | Some tooling depends on the current bytecode, and adding an operand changes the bytecode. While tooling can be updated for new bytecode, this support doesn't warrant such a change.
* Use Qtrue/Qfalse instead of 1/0 for 2nd operand to getconstantJeremy Evans2019-08-141-7/+7
| | | | Fixes error when using -Werror,-Wshorten-64-to-32.
* * expand tabs. [ci skip]git2019-08-151-7/+7
|
* Remove support for nil::ConstantJeremy Evans2019-08-141-7/+7
| | | | | | | | | | This was an intentional bug added in 1.9. The approach taken here is to add a second operand to the getconstant instruction for whether nil should be allowed and treated as current scope. Fixes [Bug #11718]
* * expand tabs.git2019-08-091-1/+1
|
* Iseq#to_binary: Add support for NoMatchingPatternError and TypeErrorAlan Wu2019-08-091-0/+12
| | | | | | | | | | Binary dumping the iseq for `case foo in []; end` used to crash as there was no handling for these exception classes. Pattern matching generates these classes as operands to `putobject`. [Bug #16088] Closes: https://github.com/ruby/ruby/pull/2325
* C99 allows trailing comma in enumNobuyoshi Nakada2019-08-091-4/+4
|
* Revert "Revert "Add a specialized instruction for `.nil?` calls""Yusuke Endoh2019-08-021-0/+1
| | | | | | This reverts commit a0980f2446c0db735b8ffeb37e241370c458a626. Retry for macOS Mojave.
* Revert "Add a specialized instruction for `.nil?` calls"Yusuke Endoh2019-08-021-1/+0
| | | | | | | | | | This reverts commit 9faef3113fb4331524b81ba73005ba13fa0ef6c6. It seemed to cause a failure on macOS Mojave, though I'm unsure how. https://rubyci.org/logs/rubyci.s3.amazonaws.com/osx1014/ruby-master/log/20190802T034503Z.fail.html.gz This tentative revert is to check if the issue is actually caused by the change or not.
* * expand tabs.git2019-08-011-1/+1
|
* Add a specialized instruction for `.nil?` callsAaron Patterson2019-07-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a specialized instruction for called to `.nil?`. It is about 27% faster than master in the case where the object is nil or not nil. In the case where an object implements `nil?`, I think it may be slightly slower. Here is a benchmark: ```ruby require "benchmark/ips" class Niller def nil?; true; end end not_nil = Object.new xnil = nil niller = Niller.new Benchmark.ips do |x| x.report("nil?") { xnil.nil? } x.report("not nil") { not_nil.nil? } x.report("niller") { niller.nil? } end ``` On Ruby master: ``` [aaron@TC ~/g/ruby (master)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 429.195k i/100ms not nil 437.889k i/100ms niller 437.935k i/100ms Calculating ------------------------------------- nil? 20.166M (± 8.1%) i/s - 100.002M in 5.002794s not nil 20.046M (± 7.6%) i/s - 99.839M in 5.020086s niller 22.467M (± 6.1%) i/s - 112.111M in 5.013817s [aaron@TC ~/g/ruby (master)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 449.660k i/100ms not nil 433.836k i/100ms niller 443.073k i/100ms Calculating ------------------------------------- nil? 19.997M (± 8.8%) i/s - 99.375M in 5.020458s not nil 20.529M (± 7.0%) i/s - 102.385M in 5.020689s niller 21.796M (± 8.0%) i/s - 108.110M in 5.002300s [aaron@TC ~/g/ruby (master)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 402.119k i/100ms not nil 438.968k i/100ms niller 398.226k i/100ms Calculating ------------------------------------- nil? 20.050M (±12.2%) i/s - 98.519M in 5.008817s not nil 20.614M (± 8.0%) i/s - 102.280M in 5.004531s niller 22.223M (± 8.8%) i/s - 110.309M in 5.013106s ``` On this branch: ``` [aaron@TC ~/g/ruby (specialized-nilp)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 468.371k i/100ms not nil 456.517k i/100ms niller 454.981k i/100ms Calculating ------------------------------------- nil? 27.849M (± 7.8%) i/s - 138.169M in 5.001730s not nil 26.417M (± 8.7%) i/s - 131.020M in 5.011674s niller 21.561M (± 7.5%) i/s - 107.376M in 5.018113s [aaron@TC ~/g/ruby (specialized-nilp)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 477.259k i/100ms not nil 428.712k i/100ms niller 446.109k i/100ms Calculating ------------------------------------- nil? 28.071M (± 7.3%) i/s - 139.837M in 5.016590s not nil 25.789M (±12.9%) i/s - 126.470M in 5.011144s niller 20.002M (±12.2%) i/s - 98.144M in 5.001737s [aaron@TC ~/g/ruby (specialized-nilp)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 467.676k i/100ms not nil 445.791k i/100ms niller 415.024k i/100ms Calculating ------------------------------------- nil? 26.907M (± 8.0%) i/s - 133.755M in 5.013915s not nil 25.319M (± 7.9%) i/s - 125.713M in 5.007758s niller 19.569M (±11.8%) i/s - 96.286M in 5.008533s ``` Co-Authored-By: Ashe Connor <kivikakk@github.com>
* Warn if using return at top-level with an argumentJeremy Evans2019-07-291-0/+3
| | | | Fixes [Bug #14062]
* * expand tabs.git2019-07-171-1/+1
|
* compile.c: add NO_CHECK for the calls to COMPILE whose result is unusedYusuke Endoh2019-07-171-1/+1
| | | | to suppress many warnings of Coverity Scan
* * expand tabs.git2019-07-161-3/+3
|
* compile.c: add NO_CHECK for the calls to COMPILE whose result is unusedYusuke Endoh2019-07-161-3/+3
| | | | to suppress many warnings of Coverity Scan
* Add a /* fall through */ commentYusuke Endoh2019-07-161-0/+1
|
* * expand tabs.git2019-07-151-13/+13
|
* compile.c: ignore the result of COMPILE by marking with NO_CHECKYusuke Endoh2019-07-151-17/+18
| | | | to suppress many warnings of Coverity Scan
* Add a /* fall through */ commentYusuke Endoh2019-07-151-0/+1
|
* Add a /* fall through */ commentYusuke Endoh2019-07-151-0/+1
|
* Add a /* fall through */ commentYusuke Endoh2019-07-151-0/+1
|
* Add a /* fall through */ commentYusuke Endoh2019-07-151-0/+1
|
* Add a /* fall through */ commentYusuke Endoh2019-07-151-0/+1
|
* * expand tabs.git2019-07-141-10/+10
|
* compile.c (defined_expr): return void instead of intYusuke Endoh2019-07-141-25/+22
| | | | It always returned 1.
* Fix segfault when using method reference operator without using resultJeremy Evans2019-07-051-1/+4
| | | | Fixes [Bug #15985]
* * expand tabs.git2019-06-161-6/+6
|
* Revert "Make constant assignments more conforming to JIS X 3017:2013 11.4.2.2.3"Yusuke Endoh2019-06-161-13/+8
| | | | | | | This reverts commit 44caca11cfa6bea01a1ef738846183f1a56d5658. The change caused a build failure. http://ci.rvm.jp/results/trunk-vm-asserts@silicon-docker/2102153
* * expand tabs.git2019-06-161-8/+8
|
* Make constant assignments more conforming to JIS X 3017:2013 11.4.2.2.3Yuki Yugui Sonoda2019-06-161-8/+13
| | | | | compile.c (NODE_CDECL): Evaluate the module before the value test/ruby/test_const.rb (test_evaluation_order): added a test case
* Use checktype for performanceKazuki Tsujimoto2019-06-111-4/+2
|
* compile.c: Partially revert r63870 which caused wrong optimizationYusuke Endoh2019-06-071-1/+2
| | | | [Bug #15906]
* Fix grammar of macro name: ECCESSED -> ECCESSIVEMartin Dürst2019-06-051-1/+1
| | | | | Fix the name of the macro variable introduced in 0872ea5330 from NODE_SPECIAL_EXCESSED_COMMA to NODE_SPECIAL_EXCESSIVE_COMMA.
* * expand tabs.git2019-06-041-3/+3
|
* compile.c: Remove the magical `(const NODE*) -1`Yusuke Endoh2019-06-041-2/+2
| | | | | It is used to represent "no default expression" for keyword argument: `def foo(key:)`. This change uses NODE_SPECIAL_REQUIRED_KEYWORD.
* node.h: Avoid a magic number to represent excessed commaYusuke Endoh2019-06-041-1/+1
| | | | | | `(ID)1` was assigned to NODE_ARGS#rest_arg for `{|x,| }`. This change removes the magic number by introducing an explicit macro variable for it: NODE_SPECIAL_EXCESSED_COMMA.
* Use UNALIGNED_MEMBER_PTRNobuyoshi Nakada2019-05-311-2/+3
| | | | | | | | | | | * internal.h (UNALIGNED_MEMBER_ACCESS, UNALIGNED_MEMBER_PTR): moved from eval_intern.h. * compile.c iseq.c, vm.c: use UNALIGNED_MEMBER_PTR for `entries` in `struct iseq_catch_table`. * vm_eval.c, vm_insnhelper.c: use UNALIGNED_MEMBER_PTR for `body` in `rb_method_definition_t`.
* * expand tabs.git2019-05-051-3/+3
|
* parse.y: duplicated when clause warningNobuyoshi Nakada2019-05-051-12/+5
| | | | | * parse.y (case_args): moved "duplicated when clause" warning from compile phase, so that `ruby -wc` shows them.
* Lazy allocate the compile data catch table arrayLourens Naudé2019-04-251-1/+6
| | | | Closes: https://github.com/ruby/ruby/pull/2119