summaryrefslogtreecommitdiff
path: root/insns.def
AgeCommit message (Collapse)Author
2019-02-01insns.def: opt_regexpmatch1 is not a leaf insnk0kubun
Given `str`, if `str_coderange(str)` is `ENC_CODERANGE_BROKEN`, it calls `rb_raise`. And it calls `rb_funcallv` from `rb_exc_new3`. http://ci.rvm.jp/results/trunk-vm-asserts@silicon-docker/1673244 Maybe we can have a function to directly call `exc_initialize` for this purpose, but it may not be worth having such a function for keeping the instruction leaf. We may even want to delete the insn https://github.com/ruby/ruby/pull/1959. I'm not sure whether compile.c could generate opt_regexpmatch2 for invalid coderange string. Let's monitor that for a while. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-01insns.def: mark exception-raising instructions non-leafshyouhei
These instructions were missed before. The stack canary mechanism (see r64677) can not detect rb_raise() because exceptions jump over the canary liveness check. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-09insns.def (duparray, duphash): add dtrace hookstenderlove
They are considered Array and Hash creation events, so allow dtrace (and systemtap) to track those creations. Co-Authored-By: Eric Wong <e@80x24.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-31Method reference operatornobu
Introduce the new operator for method reference, `.:`. [Feature #12125] [Feature #13581] [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-28vm_insnhelper.c: delete unused macrosshyouhei
- FIXNUM_2_P: moved to vm_insnhelper.c because that is the only place this macro is used. - FLONUM_2_P: ditto. - FLOAT_HEAP_P: not used anywhere. - FLOAT_INSTANCE_P: ditto. - GET_TOS: ditto. - USE_IC_FOR_SPECIALIZED_METHOD: ditto. - rb_obj_hidden_p: ditto. - REG_A: ditto. - REG_B: ditto. - GET_CONST_INLINE_CACHE: ditto. - vm_regan_regtype: moved inside of VM_COLLECT_USAGE_DETAILS because that os the only place this enum is used. - vm_regan_acttype: ditto. - GET_GLOBAL: used only once. Removed with replacing that usage. - SET_GLOBAL: ditto. - rb_method_definition_create: declaration moved to vm_insnhelper.c because that is the only place this declaration makes sense. - rb_method_definition_set: ditto. - rb_method_definition_eq: ditto. - rb_make_no_method_exception: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-27delete emacs mode lines [ci skip]shyouhei
These settings are now covered by .dir-locals.el. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-26insns.def: refactor to avoid CALL_METHOD macroshyouhei
These send and its variant instructions are the most frequently called paths in the entire process. Reducing macro expansions to make them dedicated function called vm_sendish() is the main goal of this changeset. It reduces the size of vm_exec_coref from 25,552 bytes to 23,728 bytes on my machine. I see no significant slowdown. Fix: [GH-2056] vanilla: ruby 2.6.0dev (2018-12-19 trunk 66449) [x86_64-darwin15] ours: ruby 2.6.0dev (2018-12-19 refactor-send 66449) [x86_64-darwin15] last_commit=insns.def: refactor to avoid CALL_METHOD macro Calculating ------------------------------------- vanilla ours vm2_defined_method 2.645M 2.823M i/s - 6.000M times in 5.109888s 4.783254s vm2_method 8.553M 8.873M i/s - 6.000M times in 1.579892s 1.524026s vm2_method_missing 3.772M 3.858M i/s - 6.000M times in 3.579482s 3.499220s vm2_method_with_block 8.494M 8.944M i/s - 6.000M times in 1.589774s 1.509463s vm2_poly_method 0.571 0.607 i/s - 1.000 times in 3.947570s 3.733528s vm2_poly_method_ov 5.514 5.168 i/s - 1.000 times in 0.408156s 0.436169s vm3_clearmethodcache 2.875 2.837 i/s - 1.000 times in 0.783018s 0.793493s Comparison: vm2_defined_method ours: 2822555.4 i/s vanilla: 2644878.1 i/s - 1.07x slower vm2_method ours: 8872947.8 i/s vanilla: 8553433.1 i/s - 1.04x slower vm2_method_missing ours: 3858192.3 i/s vanilla: 3772296.3 i/s - 1.02x slower vm2_method_with_block ours: 8943825.1 i/s vanilla: 8493955.0 i/s - 1.05x slower vm2_poly_method ours: 0.6 i/s vanilla: 0.6 i/s - 1.06x slower vm2_poly_method_ov vanilla: 5.5 i/s ours: 5.2 i/s - 1.07x slower vm3_clearmethodcache vanilla: 2.9 i/s ours: 2.8 i/s - 1.01x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-26add _sp_inc_helpers.erb [ci skip]shyouhei
Just add more room for comments. This is a pure refactoring that does not change anything but readability. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-20hide iseq operand object for duphash. [Bug #15440]ko1
* compile.c (compile_array): hide source Hash object. * hash.c (rb_hash_resurrect): introduced to dup Hash object using rb_cHash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-06Speed up hash literals by dupingtenderlove
This commit replaces the `newhashfromarray` instruction with a `duphash` instruction. Instead of allocating a new hash from an array stored in the Instruction Sequences, store a hash directly in the instruction sequences and dup it on execution. == Instruction sequence changes == ```ruby code = <<-eorby { "foo" => "bar", "baz" => "lol" } eorby insns = RubyVM::InstructionSequence.compile(code, __FILE__, nil, 0, frozen_string_literal: true) puts insns.disasm ``` On Ruby 2.5: ``` == disasm: #<ISeq:<compiled>@test.rb:0 (0,0)-(0,36)>==================== 0000 putobject "foo" 0002 putobject "bar" 0004 putobject "baz" 0006 putobject "lol" 0008 newhash 4 0010 leave ``` Ruby 2.6@r66174 3b6321083a2e3525da3b34d08a0b68bac094bd7f: ``` $ ./ruby test.rb == disasm: #<ISeq:<compiled>@test.rb:0 (0,0)-(0,36)> (catch: FALSE) 0000 newhashfromarray 2, ["foo", "bar", "baz", "lol"] 0003 leave ``` Ruby 2.6 + This commit: ``` $ ./ruby test.rb == disasm: #<ISeq:<compiled>@test.rb:0 (0,0)-(0,36)> (catch: FALSE) 0000 duphash {"foo"=>"bar", "baz"=>"lol"} 0002 leave ``` == Benchmark Results == Compared to 2.5.3: ``` $ make benchmark ITEM=hash_literal_small COMPARE_RUBY=/Users/aaron/.rbenv/versions/2.5.3/bin/ruby generating known_errors.inc known_errors.inc unchanged ./revision.h unchanged /Users/aaron/.rbenv/shims/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \ --executables="compare-ruby::/Users/aaron/.rbenv/versions/2.5.3/bin/ruby -I.ext/common --disable-gem" \ --executables="built-ruby::./miniruby -I./lib -I. -I.ext/common -r./prelude --disable-gem" \ $(find ./benchmark -maxdepth 1 -name '*hash_literal_small*.yml' -o -name '*hash_literal_small*.rb' | sort) Calculating ------------------------------------- compare-ruby built-ruby hash_literal_small2 1.498 1.877 i/s - 1.000 times in 0.667581s 0.532656s hash_literal_small4 1.197 1.642 i/s - 1.000 times in 0.835375s 0.609160s hash_literal_small8 0.620 1.215 i/s - 1.000 times in 1.611638s 0.823090s Comparison: hash_literal_small2 built-ruby: 1.9 i/s compare-ruby: 1.5 i/s - 1.25x slower hash_literal_small4 built-ruby: 1.6 i/s compare-ruby: 1.2 i/s - 1.37x slower hash_literal_small8 built-ruby: 1.2 i/s compare-ruby: 0.6 i/s - 1.96x slower ``` Compared to r66255 ``` $ make benchmark ITEM=hash_literal_small COMPARE_RUBY=/Users/aaron/.rbenv/versions/ruby-trunk/bin/ruby generating known_errors.inc known_errors.inc unchanged ./revision.h unchanged /Users/aaron/.rbenv/shims/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \ --executables="compare-ruby::/Users/aaron/.rbenv/versions/ruby-trunk/bin/ruby -I.ext/common --disable-gem" \ --executables="built-ruby::./miniruby -I./lib -I. -I.ext/common -r./prelude --disable-gem" \ $(find ./benchmark -maxdepth 1 -name '*hash_literal_small*.yml' -o -name '*hash_literal_small*.rb' | sort) Calculating ------------------------------------- compare-ruby built-ruby hash_literal_small2 1.567 1.831 i/s - 1.000 times in 0.638056s 0.546039s hash_literal_small4 1.298 1.652 i/s - 1.000 times in 0.770214s 0.605182s hash_literal_small8 0.873 1.216 i/s - 1.000 times in 1.145304s 0.822047s Comparison: hash_literal_small2 built-ruby: 1.8 i/s compare-ruby: 1.6 i/s - 1.17x slower hash_literal_small4 built-ruby: 1.7 i/s compare-ruby: 1.3 i/s - 1.27x slower hash_literal_small8 built-ruby: 1.2 i/s compare-ruby: 0.9 i/s - 1.39x slower ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07Rename get/setinlinecache to opt_get/opt_setinlinecachemame
The instructions are just for optimization. To clarity the intention, this change adds the prefix "opt_", like "opt_case_dispatch". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07insns.def: forgot add cast [ci skip]shyouhei
See r65595 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07insns.def: avoid integer overflowshyouhei
In these expressions `1` is of type `signed int` (cf: ISO/IEC 9899:1990 section 6.1.3.2). The variable (e.g. `num`) is of type `rb_num_t`, which is in fact `unsigned long`. These two expressions then exercises the "usual arithmetic conversions" (cf: ISO/IEC 9899:1990 section 6.2.1.5) and both eventually become `unsigned long`. The two unsigned expressions are then subtracted to generate another unsigned integer expression (cf: ISO/IEC 9899:1990 section 6.3.6). This is where integer overflows can occur. OTOH the left hand side of the assignments are `rb_snum_t` which is `signed long`. The assignments exercise the "implicit conversion" of "an unsigned integer is converted to its corresponding signed integer" case (cf: ISO/IEC 9899:1990 section 6.2.1.2), which is "implementation-defined" (read: not portable). Casts are the proper way to avoid this problem. Because all expressions are converted to some integer types before any binary operations are performed, the assignments now have fully defined behaviour. These values can never exceed LONG_MAX so the casts must not lose any information. See also: https://travis-ci.org/ruby/ruby/jobs/451726874#L4357 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-30introduce TransientHeap. [Bug #14858]ko1
* transient_heap.c, transient_heap.h: implement TransientHeap (theap). theap is designed for Ruby's object system. theap is like Eden heap on generational GC terminology. theap allocation is very fast because it only needs to bump up pointer and deallocation is also fast because we don't do anything. However we need to evacuate (Copy GC terminology) if theap memory is long-lived. Evacuation logic is needed for each type. See [Bug #14858] for details. * array.c: Now, theap for T_ARRAY is supported. ary_heap_alloc() tries to allocate memory area from theap. If this trial sccesses, this array has theap ptr and RARRAY_TRANSIENT_FLAG is turned on. We don't need to free theap ptr. * ruby.h: RARRAY_CONST_PTR() returns malloc'ed memory area. It menas that if ary is allocated at theap, force evacuation to malloc'ed memory. It makes programs slow, but very compatible with current code because theap memory can be evacuated (theap memory will be recycled). If you want to get transient heap ptr, use RARRAY_CONST_PTR_TRANSIENT() instead of RARRAY_CONST_PTR(). If you can't understand when evacuation will occur, use RARRAY_CONST_PTR(). (re-commit of r65444) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-30revert r65444 and r65446 because of commit missko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-30introduce TransientHeap. [Bug #14858]ko1
* transient_heap.c, transient_heap.h: implement TransientHeap (theap). theap is designed for Ruby's object system. theap is like Eden heap on generational GC terminology. theap allocation is very fast because it only needs to bump up pointer and deallocation is also fast because we don't do anything. However we need to evacuate (Copy GC terminology) if theap memory is long-lived. Evacuation logic is needed for each type. See [Bug #14858] for details. * array.c: Now, theap for T_ARRAY is supported. ary_heap_alloc() tries to allocate memory area from theap. If this trial sccesses, this array has theap ptr and RARRAY_TRANSIENT_FLAG is turned on. We don't need to free theap ptr. * ruby.h: RARRAY_CONST_PTR() returns malloc'ed memory area. It menas that if ary is allocated at theap, force evacuation to malloc'ed memory. It makes programs slow, but very compatible with current code because theap memory can be evacuated (theap memory will be recycled). If you want to get transient heap ptr, use RARRAY_CONST_PTR_TRANSIENT() instead of RARRAY_CONST_PTR(). If you can't understand when evacuation will occur, use RARRAY_CONST_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-29less verbose code by sharing attribute definitionsshyouhei
The idea behind this commit is that handles_sp and leaf are two concepts that are not mutually independent. By making one explicitly depend another, we can reduces the number of lines of codes written, thus making things concise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-24newhashfromarray should be a leaf insn.ko1
* insns.def (newhashfromarray): `rb_hash_bulk_insert()` can call Ruby methods like #hash so that it should not be a leaf insn. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-24need a castko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-24introduce new YARV insn newhashfromarray.ko1
* insns.def (newhashfromarray): added to replace `core_hash_from_ary` method to eliminate method call overhead. On my environment, I got the following benchmark results: x = {x: 1} modified: 7864988.6 i/s trunk: 6004098.1 i/s - 1.31x slower x = {x: 1, y: 2} trunk: 6127338.4 i/s modified: 5232380.0 i/s - 1.17x slower x = {x: 1, y: 2, z: 3} modified: 6089553.1 i/s trunk: 5249333.5 i/s - 1.16x slower This trivial improvement should be reconsider because of usage of this instruction. * compile.c: ditto. * defs/id.def, vm.c: remove unused functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20Remove tracecoverage instructionsmame
The instructions were used only for branch coverage. Instead, it now uses a trace framework [Feature #14104]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-26fix OPT_CALL_THREADED_CODE issue.ko1
* insns.def (opt_send_without_block): reorder insn position because `opt_str_freeze` insn refer this insn (function) when OPT_CALL_THREADED_CODE is true. * vm_opts.h (OPT_THREADED_CODE): introduce new macro to select threaded code implementation with a compile option (-D...). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-26revert r64847, r64846 and r64839k0kubun
because r64849 seems to fix issues which we were confused about. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-26revert r64838 and r64839k0kubun
because some build failures persisted git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-25insns.def: drop bitblt insnk0kubun
as a workaround to fix the build pipeline broken by r64824, because optimizing Ruby should be prioritized higher than supporting unused jokes. In the current build system, exceeding 200 insns somehow crashes C extension build on some of MinGW environments like "mingw32-make[1]: *** No rule to make target 'note'. Stop." https://ci.appveyor.com/project/ruby/ruby/build/9725/job/co4nu9jugm8qwdrp and on some of Linux environments like "cannot load such file -- stringio (LoadError)" ``` build_install /home/ko1/ruby/src/trunk_gcc5/lib/rubygems/specification.rb:18:in `require': cannot load such file -- stringio (LoadError) from /home/ko1/ruby/src/trunk_gcc5/lib/rubygems/specification.rb:18:in `<top (required)>' from /home/ko1/ruby/src/trunk_gcc5/lib/rubygems.rb:1365:in `require' from /home/ko1/ruby/src/trunk_gcc5/lib/rubygems.rb:1365:in `<module:Gem>' from /home/ko1/ruby/src/trunk_gcc5/lib/rubygems.rb:116:in `<top (required)>' from /home/ko1/ruby/src/trunk_gcc5/tool/rbinstall.rb:24:in `require' from /home/ko1/ruby/src/trunk_gcc5/tool/rbinstall.rb:24:in `<main>' make: *** [do-install-nodoc] Error 1 ``` http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/1353447 This commit removes "bitblt" and "trace_bitblt" insns, which reduces the number of insns from 202 to 200 and fixes at least the latter build failure. I hope this fixes the MinGW build failure as well. Let me confirm the situation on AppVeyor CI. Note that this is hard to fix because some MinGW environments (MSP-Greg's MinGW CI on AppVeyor) don't reproduce this and some Linux environments (including my local machine) don't reproduce it either. Make sure you have the reproductive environment and confirm it's fixed when reverting this commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-25Revert "Revert r64824 to fix build failure on AppVeyor"k0kubun
This reverts commit r64829. I'll prepare another temporary fix, but I'll separately commit that to make it easier to revert that later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-25Revert r64824 to fix build failure on AppVeyork0kubun
AppVeyor msys2/MinGW build started to fail like: https://ci.appveyor.com/project/ruby/ruby/build/9722/job/b94kixi004klmye3 Until I can investigate that, I revert this for now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-24insns.def: optimize & and | of Integer [experimental]k0kubun
not optimizing Array#& and Array#| because vm_insnhelper.c can't easily inline it (large amount of array.c code would be needed in vm_insnhelper.c) and the method body is a little complicated compared to Integer's ones. So I thought only Integer#& and Integer#| have a significant impact, and eliminating unnecessary branches would contribute to JIT's performance. vm_insnhelper.c: ditto tool/transform_mjit_header.rb: make sure these instructions are inlined on JIT. compile.c: compile vm_opt_and and vm_opt_or. id.def: define id for them to be used in compile.c and vm*.c vm.c: track redefinition of Integer#& and Integer#| vm_core.h: allow detecting redefinition of & and | test/ruby/test_jit.rb: test new insns test/ruby/test_optimization.rb: ditto * Optcarrot benchmark This is a kind of experimental thing but I'm committing this since the performance impact is significant especially on Optcarrot with JIT. $ benchmark-driver benchmark.yml --rbenv 'before::before --disable-gems;before+JIT::before --disable-gems --jit;after::after --disable-gems;after+JIT::after --disable-gems --jit' -v --repeat-count 24 before: ruby 2.6.0dev (2018-09-24 trunk 64821) [x86_64-linux] before+JIT: ruby 2.6.0dev (2018-09-24 trunk 64821) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-09-24 opt_and 64821) [x86_64-linux] last_commit=opt_or after+JIT: ruby 2.6.0dev (2018-09-24 opt_and 64821) +JIT [x86_64-linux] last_commit=opt_or Calculating ------------------------------------- before before+JIT after after+JIT Optcarrot Lan_Master.nes 51.460 66.315 53.023 71.173 fps Comparison: Optcarrot Lan_Master.nes after+JIT: 71.2 fps before+JIT: 66.3 fps - 1.07x slower after: 53.0 fps - 1.34x slower before: 51.5 fps - 1.38x slower [close https://github.com/ruby/ruby/pull/1963] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-14forgot to expand tabs [ci skip]shyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-14move ADD_PC around (take 2)shyouhei
Now that we can say for sure if an instruction calls a method or not internally, it is now possible to reroute the bugs that forced us to revert the "move PC around" optimization. First try: r62051 Reverted: r63763 See also: r63999 ---- trunk: ruby 2.6.0dev (2018-09-13 trunk 64736) [x86_64-darwin15] ours: ruby 2.6.0dev (2018-09-13 trunk 64736) [x86_64-darwin15] last_commit=move ADD_PC around (take 2) Calculating ------------------------------------- trunk ours so_ackermann 1.884 2.278 i/s - 1.000 times in 0.530926s 0.438935s so_array 1.178 1.157 i/s - 1.000 times in 0.848786s 0.864467s so_binary_trees 0.176 0.177 i/s - 1.000 times in 5.683895s 5.657707s so_concatenate 0.220 0.221 i/s - 1.000 times in 4.546896s 4.518949s so_count_words 6.729 6.470 i/s - 1.000 times in 0.148602s 0.154561s so_exception 3.324 3.688 i/s - 1.000 times in 0.300872s 0.271147s so_fannkuch 0.546 0.968 i/s - 1.000 times in 1.831328s 1.033376s so_fasta 0.541 0.547 i/s - 1.000 times in 1.849923s 1.827091s so_k_nucleotide 0.800 0.777 i/s - 1.000 times in 1.250635s 1.286295s so_lists 2.101 1.848 i/s - 1.000 times in 0.475954s 0.541095s so_mandelbrot 0.435 0.408 i/s - 1.000 times in 2.299328s 2.450535s so_matrix 1.946 1.912 i/s - 1.000 times in 0.513872s 0.523076s so_meteor_contest 0.311 0.317 i/s - 1.000 times in 3.219297s 3.152052s so_nbody 0.746 0.703 i/s - 1.000 times in 1.339815s 1.423441s so_nested_loop 0.899 0.901 i/s - 1.000 times in 1.111767s 1.109555s so_nsieve 0.559 0.579 i/s - 1.000 times in 1.787763s 1.726552s so_nsieve_bits 0.435 0.428 i/s - 1.000 times in 2.296282s 2.333852s so_object 1.368 1.442 i/s - 1.000 times in 0.731237s 0.693684s so_partial_sums 0.616 0.546 i/s - 1.000 times in 1.623592s 1.833097s so_pidigits 0.831 0.832 i/s - 1.000 times in 1.203117s 1.202334s so_random 2.934 2.724 i/s - 1.000 times in 0.340791s 0.367150s so_reverse_complement 0.583 0.866 i/s - 1.000 times in 1.714144s 1.154615s so_sieve 1.829 2.081 i/s - 1.000 times in 0.546607s 0.480562s so_spectralnorm 0.524 0.558 i/s - 1.000 times in 1.908716s 1.792382s git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-12resurrect the string to expect modificationsshyouhei
String#freeze can be redefined to be destructive. While such redefinition is definitely weird, it should be possible. Resurrect the string to prepare for that sort of things. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-12make opt_str_freeze leafshyouhei
Simply use DISPATCH_ORIGINAL_INSN instead of rb_funcall. This is, when possible, overall performant because method dispatch results are cached inside of CALL_CACHE. Should also be good for JIT. ---- trunk: ruby 2.6.0dev (2018-09-12 trunk 64689) [x86_64-darwin15] ours: ruby 2.6.0dev (2018-09-12 leaf-insn 64688) [x86_64-darwin15] last_commit=make opt_str_freeze leaf Calculating ------------------------------------- trunk ours vm2_freezestring 5.440M 31.411M i/s - 6.000M times in 1.102968s 0.191017s Comparison: vm2_freezestring ours: 31410864.5 i/s trunk: 5439865.4 i/s - 5.77x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-12make opt_case_dispatch leafshyouhei
This instruction can be written without rb_funcall. It not only boosts performance of case statements, but also makes room of future JIT improvements. Because opt_case_dispatch is about optimization this should not be a bad thing to have. ---- trunk: ruby 2.6.0dev (2018-09-05 trunk 64634) [x86_64-darwin15] ours: ruby 2.6.0dev (2018-09-12 leaf-insn 64688) [x86_64-darwin15] last_commit=make opt_case_dispatch leaf Calculating ------------------------------------- trunk ours vm2_case_lit 1.366 2.012 i/s - 1.000 times in 0.731839s 0.497008s Comparison: vm2_case_lit ours: 2.0 i/s trunk: 1.4 i/s - 1.47x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-11add new instruction attribute called leafshyouhei
An instruction is leaf if it has no rb_funcall inside. In order to check this property, we introduce stack canary which is a random number collected at runtime. Stack top is always filled with this number and checked for stack smashing operations, when VM_CHECK_MODE. [GH-1947] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11vm_args.c: stop requiring `calling` in vm_caller_setup_arg_blockk0kubun
_mjit_compile_send.erb: simplify code using the change insns.def: adapt to the interface change git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-10insns.def (invokesuper): remove a dummy receiever flag hack for ZSUPERmame
This is just a refactoring. The receiver of "invokesuper" was a boolean to represent if it is ZSUPER or not. This was used in vm_search_super_method to prohibit ZSUPER call in define_method. (It is currently prohibited because of the limitation of the implementation.) This change removes the hack by introducing an explicit flag, VM_CALL_SUPER, to signal the information. Now, the implementation of "invokesuper" is consistent with "send" instruction. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-27insns.def: remove old wrong explanation for get/setconstantmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-25insns.def: s/handles_frame/handles_sp/k0kubun
because it's more suitable to describe the current behavior now. tool/ruby_vm/models/bare_instructions.rb: ditto. tool/ruby_vm/views/_insn_entry.erb: ditto. tool/ruby_vm/views/_mjit_compile_insn_body.erb: ditto. tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-19mjit_compile.c: reduce sp motion on JITk0kubun
This retries r62655, which was reverted at r63863 for r63763. tool/ruby_vm/views/_mjit_compile_insn.erb: revert the revert. tool/ruby_vm/views/_mjit_compile_insn_body.erb: ditto. tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb: ditto. tool/ruby_vm/views/_mjit_compile_send.erb: ditto. tool/ruby_vm/views/mjit_compile.inc.erb: ditto. tool/ruby_vm/views/_insn_entry.erb: revert half of r63763. The commit was originally reverted since changing pc motion was bad for tracing, but changing sp motion was totally fine. For JIT, I wanna resurrect the sp motion change in r62051. tool/ruby_vm/models/bare_instructions.rb: ditto. insns.def: ditto. vm_insnhelper.c: ditto. vm_insnhelper.h: ditto. * benchmark $ benchmark-driver benchmark.yml --rbenv 'before;after;before --jit;after --jit' --repeat-count 12 -v before: ruby 2.6.0dev (2018-07-19 trunk 63998) [x86_64-linux] after: ruby 2.6.0dev (2018-07-19 add-sp 63998) [x86_64-linux] last_commit=mjit_compile.c: reduce sp motion on JIT before --jit: ruby 2.6.0dev (2018-07-19 trunk 63998) +JIT [x86_64-linux] after --jit: ruby 2.6.0dev (2018-07-19 add-sp 63998) +JIT [x86_64-linux] last_commit=mjit_compile.c: reduce sp motion on JIT Calculating ------------------------------------- before after before --jit after --jit Optcarrot Lan_Master.nes 51.354 50.238 70.010 72.139 fps Comparison: Optcarrot Lan_Master.nes after --jit: 72.1 fps before --jit: 70.0 fps - 1.03x slower before: 51.4 fps - 1.40x slower after: 50.2 fps - 1.44x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-17revert r63988k0kubun
Due to trunk-mjit CI failures: http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1130097 http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1130196 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-17insns.def: remove redundant ifndef in r63988k0kubun
By the way, the original patch of r63988 was provided by wanabe: https://github.com/wanabe/ruby/tree/local-stack but I forgot to add his credit in the previous commit message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-17mjit_compile.c: resurrect local variable stackk0kubun
This optimization was reverted on r63863, but this commit resurrects the optimization to skip some sp motions on JIT execution. tool/ruby_vm/views/_mjit_compile_insn_body.erb: ditto tool/ruby_vm/views/_mjit_compile_insn.erb: ditto insns.def: resurrect handles_frame as handles_stack, which was deleted on r63763. tool/ruby_vm/models/bare_instructions.rb: ditto vm_insnhelper.c: prevent moving sp outside insns.def to allow modifying it by JIT. * Optcarrot benchmark $ benchmark-driver benchmark.yml --rbenv 'before --jit;after --jit' --repeat-count 12 -v before --jit: ruby 2.6.0dev (2018-07-17 trunk 63987) +JIT [x86_64-linux] after --jit: ruby 2.6.0dev (2018-07-17 local-stack 63987) +JIT [x86_64-linux] last_commit=mjit_compile.c: resurrect local variable stack Calculating ------------------------------------- before --jit after --jit Optcarrot Lan_Master.nes 70.518 72.144 fps Comparison: Optcarrot Lan_Master.nes after --jit: 72.1 fps before --jit: 70.5 fps - 1.02x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-15insns.def: fix typo in commentktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-07insns.def: stop pushing unnecessary keys for MJITk0kubun
[Bug #14892] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05revert r62655 for r63763k0kubun
r63655 was tightly coupled to handle_frames and some assumptions seems to have been broken by r63763. To partially resolve Bug#14892, this reverts the optimization for now. I want to make MJIT CI happy first and then I'll probably retry r63655 by partially reverting r63763 for sp changes. The skipped test is not fixed yet. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27give up insn attr handles_frameshyouhei
I introduced this mechanism in r62051 to speed things up. Later it was reported that the change causes problems. I searched for workarounds but nothing seemed appropriate. I hereby officially give it up. The idea to move ADD_PC around was a mistake. Fixes [Bug #14809] and [Bug #14834]. Signed-off-by: Urabe, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27refactor move logics out of insns.defshyouhei
This is a pure refactoring. I see no difference in this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27move function declarations from insns.def to internal.hshyouhei
Just avoid being loose. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21insns.def: checktypenobu
* insns.def (checktype): split branchiftype to checktype and branchif, to make branch condition negation possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19Reverting r62775, this should fix i686 buildstenderlove
We need to mark default values for kwarg methods. This also fixes Bootsnap. IBF iseq loading needed to mark iseqs as "having markable objects". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e