summaryrefslogtreecommitdiff
path: root/tool/transform_mjit_header.rb
AgeCommit message (Collapse)Author
2023-03-06Drop obsoleted MJIT header (#7458)Takashi Kokubun
RJIT doesn't need this. Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-08-20Fix a typo [ci skip]Takashi Kokubun
2022-08-20Drop mswin support of MJIT (#6265)Takashi Kokubun
The current MJIT relies on SIGCHLD and fork(2) to be performant, and it's something mswin can't offer. You could run Linux MJIT on WSL instead. [Misc #18968] Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-02-22[Feature #18249] Implement ABI checkingPeter Zhu
Header file include/ruby/internal/abi.h contains RUBY_ABI_VERSION which is the ABI version. This value should be bumped whenever an ABI incompatible change is introduced. When loading dynamic libraries, Ruby will compare its own `ruby_abi_version` and the `ruby_abi_version` of the loaded library. If these two values don't match it will raise a `LoadError`. This feature can also be turned off by setting the environment variable `RUBY_RUBY_ABI_CHECK=0`. This feature will prevent cases where previously installed native gems fail in unexpected ways due to incompatibility of changes in header files. This will force the developer to recompile their gems to use the same header files as the built Ruby. In Ruby, the ABI version is exposed through `RbConfig::CONFIG["ruby_abi_version"]`. Notes: Merged: https://github.com/ruby/ruby/pull/5474
2020-08-11Use colorize.rb for non-capable terminalsNobuyoshi Nakada
2020-05-17Mark some JIT-ed functions as COLDFUNCTakashi Kokubun
Put some functions which are unlikely to be called on JIT in .text.unlikely section to improve hot code's locality.
2020-05-12Stop always inlining not-optimized get/setivarTakashi Kokubun
As we have the optimization in _mjit_compile_ivar.erb, we don't use these functions if we successfully optimize ivars. Therefore it's consuming code size where we can't optimize it well. To decrease code size, we'd better avoid inlining them. ``` $ benchmark-driver -v --rbenv 'before --jit;after --jit' benchmark.yml --repeat-count=12 --output=all before --jit: ruby 2.8.0dev (2020-05-13T04:49:21Z master 61d451d6ce) +JIT [x86_64-linux] after --jit: ruby 2.8.0dev (2020-05-13T05:46:59Z master a072d323db) +JIT [x86_64-linux] Calculating ------------------------------------- before --jit after --jit Optcarrot Lan_Master.nes 69.8567095356444 73.0360609399857 fps 70.3283101279035 74.6106251902062 72.9135395729567 75.2797344839106 76.6944690546044 77.5705757485036 77.0027971817715 78.2269524040059 78.5069033659736 78.4457471014131 80.1873218604913 80.1273811685818 81.3079566400696 81.7148593303302 81.7285827817226 81.7637234555871 81.7657097839637 82.4520295422720 81.8310114206406 82.7532354379759 81.9886488857863 82.8358739858206 ```
2020-03-22Try asserting no static decl rather than warningTakashi Kokubun
This didn't exist in my machine, but it may exist in some CI environments.
2020-03-22Reduce the number of lines used by transform_mjit_headerTakashi Kokubun
2020-01-30Unnamed groups are not captured when named groups are usedNobuyoshi Nakada
2018-11-05Fix a typo [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05Create MJIT header with strict permissionnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-19transform_mjit_header.rb: fix up r65169nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-19transform_mjit_header.rb: `inline` may be a macronobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-19transform_mjit_header.rb: add system_header pragmanobu
* tool/transform_mjit_header.rb: insert GCC system_header pragma to get rid of errors caused by the contents included from system headers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65169 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-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-11transform_mjit_header.rb: add static to Init_*k0kubun
as well, to make CI succeed with VM_CHECK_MODE > 1. vm_insnhelper.c: drop unnecessary MJIT_HEADER ifdef. This is intended to be ignored by having `static inline`. Removing that by macro would be helpful for minimizing compilation time, but the impact is not so big and having many MJIT_HEADER check would be bad for maintainability. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-31transform_mjit_header.rb: more strict FUNC_HEADER_REGEXPk0kubun
to reduce "SKIPPED" logs on MJIT header build. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-31transform_mjit_header.rb: accept having attributek0kubun
between a type of return value and function identifier. Like: ``` rb_control_frame_t * __attribute__ ((__fastcall__)) rb_vm_opt_struct_aref(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp) { ... } ``` [Bug #14949] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24transform_mjit_header.rb: fix performance regressionk0kubun
on r64031. Compiling vm_search_method_slowpath is very slow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-11transform_mjit_header.rb: workaround for Solaris 10 with old GCCngoto
* tool/transform_mjit_header.rb (MJITHeader.conflicting_types?): Add workaround for Solaris 10 with old GCC (4.6.2), that is essentially the same as for AIX (commit r62326), but probably due to different GCC versions, different error message is shown. [Bug #14751] [ruby-dev:50541] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17transform_mjit_header.rb: read output and errorsnobu
* tool/transform_mjit_header.rb (MJITHeader.check_code): read output and errors than discarding errors. also cl.exe prints the source file name which is a garbage at this time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-07transform_mjit_header.rb: inline ivar operationsk0kubun
* Optcarrot before,--jit: ruby 2.6.0dev (2018-03-07 trunk 62689) +JIT [x86_64-linux] after,--jit: ruby 2.6.0dev (2018-03-07 trunk 62689) +JIT [x86_64-linux] last_commit=transform_mjit_header.rb: inline ivar operations Calculating ------------------------------------- before,--jit after,--jit optcarrot 67.852 69.359 fps Comparison: optcarrot after,--jit: 69.4 fps before,--jit: 67.9 fps - 1.02x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-06transform_mjit_header.rb: inline VM instructionsk0kubun
* Optcarrot benchmark (--jit) Before: 62.42 fps After: 65.31 fps git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-06transform_mjit_header.rb: drop obsoleted debug codek0kubun
Now RubyCI is stable for this part. We no longer use this. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11common.mk: add comments about r62355 [ci skip]k0kubun
transform_mjit_header.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-09transform_mjit_header.rb: fix typo in r62326k0kubun
Today's AIX CI failed due to this... :innocent: git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-09transform_mjit_header.rb: pass -std=c99 for AIX gcck0kubun
I heard `error: conflicting types for 'restrict'` can be solved by adding `-std=c99`. Ideally we should use the same cflags which are used to compile vm.c, but let me try this and see what happens on AIX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-07transform_mjit_header.rb: very verbose error logk0kubun
for debugging AIX..... I have no idea why AIX's gcc is failing to transform MJIT header.... Today's CI output: https://rubyci.org/logs/rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/log/20180207T113303Z.log.html.gz#make git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-07transform_mjit_header.rb: apply Regexp.escapek0kubun
to prevent future breakage Following up r62285 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-07transform_mjit_header.rb: ignore unsupported cck0kubun
to generate MJIT header. Even if we can't build MJIT header, Ruby's build should success. And compilers which are not explicitly supported are likely to fail to transform MJIT header. Also you can pass only gcc or clang to --jit-cc=xxx for now. Thus generating header does never make sense. So I decided to conservatively give up MJIT header generation. But please feel free to add your favorite compiler's macro if you think it's working. (Another workaround is passing -D__GNUC__ :p) [Bug #14447] [Bug #14446] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-06transform_mjit_header.rb: resurrect `exit false`k0kubun
which was just unintentionally dropped at r62252. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-06transform_mjit_header.rb: add output for debugk0kubun
AIX's header build is failing like: ./miniruby -I./lib -I. -I.ext/common ./tool/transform_mjit_header.rb "/usr/bin/gcc " rb_mjit_header.h .ext/include/powerpc-aix7.1.3.0/rb_mjit_min_header-2.6.0.h error in initial header file: /home/odaira/chkbuild/tmp/build/20180206T113302Z/tmp/20180206-15335556-aaiego.c:19:59: error: conflicting types for 'restrict' extern size_t fread(void *restrict, size_t, size_t, FILE *restrict); ^ https://rubyci.org/logs/rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/log/20180206T113302Z.log.html.gz#make It's so hard to know the cause from current output. Let me add debug output and see tomorrow's CI result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-06Remove unused capturekazu
Because `Regexp#to_s` add `(?-mix:)`, it is not unnecessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05transform_mjit_header.rb: restrict transformationk0kubun
to whitelisted patterns. This fix is for NetBSD. [Bug #14439] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05transform_mjit_header.rb: same command after errornobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05transform_mjit_header.rb: check initial codek0kubun
separating the macros. Applying the kept macros to code which is already affected by the macros may cause errors in initial code. This is hopefully the final fix for icc build failure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05transform_mjit_header.rb: remove predefined macrosk0kubun
semi-automatically. This is basically for icc's __DATE__, __TIME__, and many other families. It causes an error by predefined macro redefinition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05transform_mjit_header.rb: no extra CRsnobu
* tool/transform_mjit_header.rb (MJITHeader.check_code!): open temporary file in binary mode too, not to include extra CRs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05transform_mjit_header.rb: take program name from $0nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05transform_mjit_header.rb: read/write in binmodenobu
* tool/transform_mjit_header.rb: read and write as ASCII-8BIT to make single-byte-optimizable always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05transform_mjit_header.rb: separate macro and codenobu
* tool/transform_mjit_header.rb (separate_macro_and_code): return macro and code separately as the name, and concat before output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05transform_mjit_header.rb: scan by regexpnobu
* tool/transform_mjit_header.rb (find_decl): scan by regexp instead of char-by-char loop. return nil when finished. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05Use system option instead of shell redirectkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04transform_mjit_header.rb: refactor messages and exitnobu
* tool/transform_mjit_header.rb: print non-error messages to STDOUT instead of STDERR. exit with false or abort instead of exit 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04match whole wordnobu
* tool/transform_mjit_header.rb: add word boundary anchors and match whole word to get rid of false `static` declarations, e.g., rb_str_new_static. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e