aboutsummaryrefslogtreecommitdiffstats
path: root/tool/ruby_vm/models
Commit message (Collapse)AuthorAgeFilesLines
* Reverting r62775, this should fix i686 buildstenderlove2018-03-191-0/+1
| | | | | | | | 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
* Revert "Add direct marking on iseq operands"naruse2018-03-161-1/+0
| | | | | | | | | | This reverts commit r62706. It causes SEGV on i686-linux (debian) and armv7l-linux-eabihf: http://www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20180309T204300Z.diff.html.gz http://rubyci.s3.amazonaws.com/scw-9d6766/ruby-trunk/log/20180309T211706Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add direct marking on iseq operandstenderlove2018-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Directly marking iseq operands allows us to eliminate the "mark array" stored on ISEQ objects, which will reduce the amount of memory ISEQ objects consume. This patch changes the iseq mark function to: * Directly marks ISEQ operands * Iterate over and mark child ISEQs It also introduces two flags on the ISEQ object. In order to mark instruction operands, we have to disassemble the instructions and find the instruction parameters and types. Instructions may also be translated to jump addresses. Instruction sequences may get marked by the GC *while* they're mid flight (being compiled). The `ISEQ_TRANSLATED` flag is used to indicate whether or not the instructions have been translated to jump addresses so that when we decode the instructions we know whether or not we need to go from jump location back to original instruction or not. Not all ISEQ objects have any markable objects embedded in their instructions. We can detect whether or not an ISEQ has markable objects in the instructions at compile time. If the instructions contain markable objects, we set a flag `ISEQ_MARKABLE_ISEQ` on the ISEQ object. This means that during the mark phase, we can skip decompilation if the flag is *not* set. In other words, we can avoid decompilation of we know in advance there is nothing to mark. `once` instructions have an operand that contains the result of a one-time compilation of a regex. Before this patch, that operand was called an "inline cache", even though the struct was actually an "inline storage". This patch changes the operand to be an "inline storage" so that we can differentiate between caches that need marking (the inline storage) and caches that don't need marking (inline cache). [ruby-core:84909] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bare_instructions.rb: sp_inc is signednobu2018-01-301-1/+1
| | | | | | | | | | | * tool/ruby_vm/models/bare_instructions.rb (predefine_attributes): `sp_inc` attribute which may return negative values must be signed `rb_snum_t`, to be signed-expanded at type promotion. * vm_insnhelper.h (ADJ_SP): removed the workaround for platforms where rb_num_t is wider than int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* s/CALL_SIMPLE_METHOD/DISPATCH_ORIGINAL_INSN/shyouhei2018-01-291-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that DISPATCH_ORIGINAL_INSN is introduced, we can replace CALL_SIMPLE_METHOD with DISPATCH_ORIGINAL_INSN. These two macros differ in size very much and results in this big difference in compiled binary size. This changeset reduces the size of vm_exec_core from 32,352 bytes to 27,008 bytes on my machine. As a result it yields slightly better performance. Closes [GH-1779]. ----------------------------------------------------------- benchmark results: minimum results in each 3 measurements. Execution time (sec) name before after so_ackermann 0.484 0.454 so_array 0.837 0.779 so_binary_trees 5.928 5.801 so_concatenate 3.473 3.543 so_count_words 0.201 0.222 so_exception 0.255 0.252 so_fannkuch 1.080 1.019 so_fasta 1.459 1.463 so_k_nucleotide 1.218 1.180 so_lists 0.499 0.484 so_mandelbrot 2.189 2.324 so_matrix 0.510 0.496 so_meteor_contest 3.025 2.925 so_nbody 1.319 1.273 so_nested_loop 0.941 0.932 so_nsieve 1.806 1.647 so_nsieve_bits 2.151 2.078 so_object 0.632 0.621 so_partial_sums 1.560 1.632 so_pidigits 1.190 1.183 so_random 0.333 0.353 so_reverse_complement 0.604 0.586 so_sieve 0.521 0.481 so_spectralnorm 1.774 1.722 Speedup ratio: compare with the result of `before' (greater is better) name after so_ackermann 1.065 so_array 1.075 so_binary_trees 1.022 so_concatenate 0.980 so_count_words 0.903 so_exception 1.009 so_fannkuch 1.059 so_fasta 0.997 so_k_nucleotide 1.032 so_lists 1.032 so_mandelbrot 0.942 so_matrix 1.028 so_meteor_contest 1.034 so_nbody 1.036 so_nested_loop 1.009 so_nsieve 1.097 so_nsieve_bits 1.035 so_object 1.018 so_partial_sums 0.956 so_pidigits 1.006 so_random 0.943 so_reverse_complement 1.032 so_sieve 1.083 so_spectralnorm 1.030 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extensive use of instruction attributesshyouhei2018-01-291-21/+16
| | | | | | | | | Instead of using magic numbers, let us define a series of attributes and use them from the VM core. Proper function declarations makes these attributes inlined in most modern compilers. On my machine exact same binary is generated with or without this changeset. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bare_instructions.rb: show class name on inspectk0kubun2018-01-271-1/+1
| | | | | | | | | as it's helpful for debugging. I'm not sure what's the good output for RubyVM::TraceInstructions, so I left it as it is. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move ADD_PC around to optimize PC manipluiationsshyouhei2018-01-261-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces new attribute handles_flame and if that is _not_ the case, places ADD_PC right after INC_SP. This improves locality of PC manipulations to prevents unnecessary register spill- outs. As a result, it reduces the size of vm_exec_core from 32,688 bytes to 32,384 bytes on my machine. Speedup is very faint, but certain. ----------------------------------------------------------- benchmark results: minimum results in each 3 measurements. Execution time (sec) name before after so_ackermann 0.476 0.464 so_array 0.742 0.728 so_binary_trees 5.493 5.466 so_concatenate 3.619 3.395 so_count_words 0.190 0.184 so_exception 0.249 0.239 so_fannkuch 0.994 0.953 so_fasta 1.369 1.374 so_k_nucleotide 1.111 1.111 so_lists 0.470 0.481 so_mandelbrot 2.059 2.050 so_matrix 0.466 0.465 so_meteor_contest 2.712 2.781 so_nbody 1.154 1.204 so_nested_loop 0.852 0.846 so_nsieve 1.636 1.623 so_nsieve_bits 2.073 2.039 so_object 0.616 0.584 so_partial_sums 1.464 1.481 so_pidigits 1.075 1.082 so_random 0.321 0.317 so_reverse_complement 0.555 0.558 so_sieve 0.495 0.490 so_spectralnorm 1.634 1.627 Speedup ratio: compare with the result of `before' (greater is better) name after so_ackermann 1.025 so_array 1.019 so_binary_trees 1.005 so_concatenate 1.066 so_count_words 1.030 so_exception 1.040 so_fannkuch 1.043 so_fasta 0.996 so_k_nucleotide 1.000 so_lists 0.978 so_mandelbrot 1.004 so_matrix 1.001 so_meteor_contest 0.975 so_nbody 0.959 so_nested_loop 1.007 so_nsieve 1.008 so_nsieve_bits 1.017 so_object 1.056 so_partial_sums 0.989 so_pidigits 0.994 so_random 1.014 so_reverse_complement 0.996 so_sieve 1.010 so_spectralnorm 1.004 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tool/ruby_vm/models/attribute.rb: void for empty argumentsnobu2018-01-151-3/+13
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tool/ruby_vm support for pre-2.0 BASERUBYshyouhei2018-01-122-4/+3
| | | | | | | This was not requested :) but actually easier than the previous so I just did it anyway. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tool/ruby_vm support for pre-2.1 BASERUBYshyouhei2018-01-126-29/+32
| | | | | | as requested by devs, support for BASERUBY prior to 2.1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* delete tool/instruction.rb (2nd try)shyouhei2018-01-128-0/+581
| | | | | | | | | | | | | | | | | | | | | | | Previous commit changed insns.def format. Now is the time for its generators. In doing so I chose to modernize the system, not just patch. My attempt includes - extensive use of Onigumo regular expressions - split from one big file (instruction.rb) into separated MVC - partial view Also, let me take this opportunity to kill old unused features such as - stack caching - minsns / yasmdata which are never seriously used - yarvarch document generation (moved to doc/) - vast majority of unused arguments to insns2vm.rb This commit generates VM source codes that cleanly compile, and the generated binary passes tests. At least for me. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* merge revisions 61753:61750 61747:61740 61737:61728shyouhei2018-01-108-581/+0
| | | | | | | Revert all the VM generator rewrites; requested by naruse git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* delete tool/instruction.rbshyouhei2018-01-098-0/+581
Previous commit changed insns.def format. Now is the time for its generators. In doing so I chose to modernize the system, not just patch. My attempt includes - extensive use of Onigumo regular expressions - split from one big file (instruction.rb) into separated MVC - partial view Also, let me take this opportunity to kill old unused features such as - stack caching - minsns / yasmdata which are never seriously used - yarvarch document generation (moved to doc/) - vast majority of unused arguments to insns2vm.rb This commit generates VM source codes that cleanly compile, and the generated binary passes tests. At least for me. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e