summaryrefslogtreecommitdiff
path: root/tool/ruby_vm
AgeCommit message (Collapse)Author
2018-01-30bare_instructions.rb: sp_inc is signednobu
* 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
2018-01-29redefinition of a typedef is a C11ismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-29s/CALL_SIMPLE_METHOD/DISPATCH_ORIGINAL_INSN/shyouhei
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
2018-01-29also use sp_inc in vm coreshyouhei
Now that sp_inc attributes are officially provided as inline functions. Why not use them directly from the vm core, not just by the compiler. By doing so, it is now possible for us to optimize stack manipulations. We can now know exactly how many words of stack space an instruction consumes before it actually does. This changeset deletes some lines from insns.def because they are no longer needed. As a result it reduces the size of vm_exec_core function from 32,400 bytes to 32,352 bytes on my machine. It seems it does not affect performance: ----------------------------------------------------------- benchmark results: minimum results in each 3 measurements. Execution time (sec) name before after loop_for 1.093 1.061 loop_generator 1.156 1.152 loop_times 0.982 0.974 loop_whileloop 0.549 0.587 loop_whileloop2 0.115 0.121 Speedup ratio: compare with the result of `before' (greater is better) name after loop_for 1.030 loop_generator 1.003 loop_times 1.008 loop_whileloop 0.935 loop_whileloop2 0.949 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-29extensive use of instruction attributesshyouhei
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
2018-01-27bare_instructions.rb: show class name on inspectk0kubun
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
2018-01-27insns2vm.rb: add missing word to helpk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-27insns2vm.rb: make #generate_parser privatek0kubun
which is only used by #router. To make it private, we need to stop defining them on top-level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-27dumper.rb: stop getting --destdir option valuek0kubun
via current directory. It's kind of a global state and fragile to implementation changes in other places, and how the `Dir.getwd` is set is not obvious from just reading around `RubyVM::Dumper#initialize` if it depends on the global state. tool/ruby_vm/controllers/application_controller.rb: explicitly pass destdir to RubyVM::Dumper. tool/ruby_vm/scripts/insns2vm.rb: explicitly pass destdir parsed from optparse. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-26move ADD_PC around to optimize PC manipluiationsshyouhei
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
2018-01-15tool/ruby_vm/models/attribute.rb: void for empty argumentsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13__VA_ARGS__ is a C99ismshyouhei
give up CALL_ATTRIBUTE macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12merge revision: 61746shyouhei
`signed` is required for Rasbian (x86_64). * tool/ruby_vm/views/_insn_stack_increase.erb: specify `signed` explicitly for systems which use `unsigned` for `char` type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12tool/ruby_vm support for pre-2.0 BASERUBYshyouhei
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
2018-01-12tool/ruby_vm support for pre-2.1 BASERUBYshyouhei
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
2018-01-12tool/ruby_vm support for pre-2.3 BASERUBYshyouhei
as requested by devs, support for BASERUBY prior to 2.3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12delete tool/instruction.rb (2nd try)shyouhei
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
2018-01-12new insns.def format (2nd try)shyouhei
- Gave up @j comments - Room for sp_inc to be a proper grammer element git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-10merge revisions 61753:61750 61747:61740 61737:61728shyouhei
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
2018-01-10Fixed typos.hsbt
* tool/ruby_vm/loaders/opt_operand_def.rb: grammer -> grammar * tool/ruby_vm/scripts/insns2vm.rb: beginnig -> beginning git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09`signed` is required for Rasbian (x86_64).ko1
* tool/ruby_vm/views/_insn_stack_increase.erb: specify `signed` explicitly for systems which use `unsigned` for `char` type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09grep_v is ruby 2.3 featurenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09Here document <<~ is Ruby 2.3 featurenaruse
baseruby should support wider ruby versions git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09insns_info.inc.tmpl: share large tableseshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09insns_info.inc: position independentshyouhei
* template/insns_info.inc.tmpl (insn_name_info): make position independent for large strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09comma at the end of enum is a C99ism.shyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09delete tool/instruction.rbshyouhei
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
2018-01-09* append newline at EOF.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09new insns.def formatshyouhei
- Gave up @j comments - Room for sp_inc to be a proper grammer element git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e