summaryrefslogtreecommitdiff
path: root/Makefile.in
AgeCommit message (Collapse)Author
2018-08-04common.mk: stop building MJIT min header for mswink0kubun
Since it's impossible to leave macro when preprocessing C source file with cl.exe, I decided to create precompiled header on Ruby's build time instead. We're not doing it for non-mswin environment for 2 reasons: 1) Precompiled header may not be able to be used when CC is upgraded. 2) We need to create as many precompiled headers as the patterns of compile options. (Probably only 2, for with and without --jit-debug) I'll ignore them for mswin for now, and solve it later by including CC version and --jit-debug information in precompiled header filename. After that, non-mswin environment may follow it to simplify build system. Makefile.in: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-31Makefile.in: remove GNU-make dependencynobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-31mjit.c: allow using MJIT header in build directoryk0kubun
when $MJIT_SEARCH_BUILD_DIR is set. If prefix path is owned by root, `make install` needs to be run by root. But in general we don't want to run `make test-all`, and also running `make test-all` currently fails due to permission tests of rdoc and rubygems. Thus, prior to this commit, specifying a prefix like "/usr/local" could mean there was no way to pass test-all. So we should not depend on `make install` for `make test-all`. Thus I reverted r64104 and r64103, and applied this workaround to pass `make test-all` without `make install`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-08benchmark: introduce benchmark_driver.gemk0kubun
Makefile.in: Clone benchmark-driver repository in benchmark/benchmark-driver `make update-benchmark-driver`, like simplecov. win32/Makefile.sub: Roughly do the same thing. .gitignore: Ignore the cloned repository. common.mk: Trigger `make update-benchmark-driver` to run `make benchmark` and adjust arguments for benchmark_driver.gem. benchmark/require.yml: renamed from benchmark/bm_require.rb, benchmark/prepare_require.rb benchmark/require_thread.yml: renamed from benchmark/bm_require_thread.rb, benchmark/prepare_require_thread.rb benchmark/so_count_words.yml: renamed from benchmark/bm_so_count_words.rb, benchmark/prepare_so_count_words.rb, benchmark/wc.input.base benchmark/so_k_nucleotide.yml: renamed from benchmark/bm_so_k_nucleotide.rb, benchmark/prepare_so_k_nucleotide.rb, benchmark/make_fasta_output.rb benchmark/so_reverse_complement.yml: renamed from benchmark/bm_so_reverse_complement.rb, benchmark/prepare_so_reverse_complement.rb, benchmark/make_fasta_output.rb I'm sorry but I made some duplications between benchmark/require.yml and benchmark/require_thread.yml, and between benchmark/so_k_nucleotide.yml and benchmark/so_reverse_complement.yml. If you're not comfortable with it, please combine these YAMLs to share the same prelude. One YAML file can have multiple benchmark definitions sharing prelude. benchmark/driver.rb: Replace its core feature with benchmark_driver.gem. Some old features are gone for now, but I'll add them again later. [Misc #14902] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-02Makefile.in: ARCH_FLAG may contain "-m64" etc.ngoto
* Makefile.in (mjit_config.h): ARCH_FLAG may contain "-m64", "-m32", "-march=i486" and so on, but the change made with r63232 only supports "-arch AAA -arch BBB" mainly used on Mac OS X. To solve the issue, ARCH_FLAG is parsed and the architectures specified in "-arch XXX" are added to $archs and the rest is stored to $arch_flag. The $arch_flag is defined as MJIT_ARCHFLAG if $archs is empty or the target architecture is not listed in $arch. Fix build failure on Solaris 10 with ./configure CFLAGS="-m64". [Bug #14876] [ruby-dev:50583] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-22remove DISABLE_RUBYGEMS from config filesnobu
* configure.ac: removed DISABLE_RUBYGEMS macro from config.h, not to rebuild everything when the flag changed. * configure.ac, win32/configure.bat: make USE_RUBYGEMS lowercase. * tool/mkconfig.rb: remove RUBYGEMS stuff from rbconfig.rb, not to reconfigure and rebuild all extension libraries. * Makefile.in (CPPFLAGS): enable/disable Rubygems by USE_RUBYGEMS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-17Makefile.in: MJIT_DLDFLAGSnobu
* Makefile.in (mjit_config.h): needs -arch flag to link, as well as precompiling the header, when compiling for i386 on x86_64 mac. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-02gmake.mk: update in the source directory properlynobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-01Skip colliding filenames in LIBRUBY_ALIASESknu
This allows user to specify any name in `--with-so-name` that might cause a name clash with LIBRUBY_ALIASES on the platform. Without this, for example, configuring with `--with-soname=ruby --enable-shared` on macOS would end up running `ln -sf libruby.dylib libruby.dylib` only to fail with the following error in installation: ``` make[2]: stat: libruby.dylib: Too many levels of symbolic links ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-20goruby build was brokenusa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28mjit_config.h: expand min header namenobu
* Makefile.in, win32/Makefile.sub (mjit_config.h): expand min header name, including the version number and the suffix. * mjit.c (init_header_filename): the version number and the suffix are now included in the header name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22Makefile.in: MJIT_ARCHFLAGnobu
* Makefile.in (mjit_config.h): separate MJIT_ARCHFLAG for each architecture on universal binary. cannot use precompiled-header with multiple -arch options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-09configure.ac: --disable-mathn optionnobu
* Makefile.in, win32/Makefile.sub: move CANONICALIZATION_FOR_MATHN from config.h which affects all extension libraries to XCFLAGS for the core only. * configure.ac: added --disable-mathn option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-03mjit_config.h: MJIT_LDSHAREDnobu
* configure.in (MJIT_LDSHARED): define based on LDSHARED with replacing CC with MJIT_CC. * Makefile.in, win32/Makefile.sub (mjit_config.h): instead of the default LDSHARED, use MJIT_LDSHARED to link mjit shared objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02Makefile.in (ruby.pc): phony target [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-01MJIT specific flagsnobu
Passing options to configure like as `configure MJIT_OPTFLAGS=-O MJIT_DEBUGFLAGS=-g` overrides options to be used to compile JIT code, separately from the default options to be used for ruby itself. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-26Makefile.in: fix portability issuenobu
* Makefile.in (mjit_config.h): Alternative value with $@ and printf without argument are not portable, could fail on some platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-21Makefile.in (mjit_config.h): fix duplicated outputnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-21Makefile.in: empty commentnobu
* Makefile.in (mjit_config.h): add an empty comment if no content, to tell the empty content explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-20Makefile.in: fix for Solarisnobu
* Makefile.in (mjit_config.h): expand for each words. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-20common.mk: moved macros to mjit_config.hnobu
* Makefile.in, common.mk, win32/Makefile.sub: moved MJIT macros to mjit_config.h from XCFLAGS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-20Makefile.in: function to quote for mjit_config.hnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-17LIBRUBY_A with extsnobu
* Makefile.in, win32/Makefile.sub (LIBRUBY_A): link with extension libraries if EXTSTATIC is set, so that static-ruby would work too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-17separate PRE_LIBRUBY_UPDATEnobu
* Makefile.in, win32/Makefile.sub (PRE_LIBRUBY_UPDATE): separate definitions without miniruby. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-15Avoid using `@` in macro substitution that confuses FreeBSD makeknu
``` making mjit_config.h make: Unknown modifier ' ' make: Unclosed variable specification (expecting ')') for "Q" (value "") modifier /bin/sh: Syntax error: end of file unexpected (expecting "}") *** Error code 2 Stop. ``` The at sign probably conflicts the `:@temp@string@` modifier syntax supported by FreeBSD make. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-12Makefile.in: drop obsoleted debug outputk0kubun
mjit_config.h errors are already fixed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11Makefile.in: prevent from building `"",` macrok0kubun
Loop removal in r62373 caused the CI failure like: https://travis-ci.org/ruby/ruby/builds/340136977 mjit_config.h was: #ifndef RUBY_MJIT_CONFIG_H #define RUBY_MJIT_CONFIG_H 1 #define MJIT_CC_COMMON "gcc", #define MJIT_CFLAGS "-w", #define MJIT_OPTFLAGS "-O3", #define MJIT_DEBUGFLAGS "-ggdb3", #define MJIT_LDSHARED "gcc", "-shared", #define MJIT_DLDFLAGS "", #endif /* RUBY_MJIT_CONFIG_H */ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11Makefile.in: debug mjit_config.h againk0kubun
Somehow r62373 is failing on travis... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11Makefile.in: use "%s"nobu
* Makefile.in (mjit_config.h): use "%s" not to interprete % in arguments. and `set` and `loop` are not needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11Makefile.in: use printfk0kubun
`echo -n` is sometimes not available. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20180211T132503Z.log.html.gz#miniruby git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11Makefile.in: define macro in one linek0kubun
Having macro definition in multiple definitions makes compiler error output hard to read, like the commit message of r62367. Probably build failures will be fixed by r62370, but let me simplify the mjit_config.h content for future debugging. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11mjit_config.h: moved backslashs outside quotesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11Makefile.in: add output to debug rubycik0kubun
build failure. From current output, I can't know what's wrong from current error log. https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos7/ruby-trunk/log/20180211T110003Z.log.html.gz#miniruby compiling mjit.c mjit.c:573:1: error: stray ‘\’ in program static const char *const CC_DEBUG_ARGS[] = {MJIT_DEBUGFLAGS NULL}; ^ mjit.c:573:1: error: stray ‘\’ in program mjit.c:574:1: error: stray ‘\’ in program static const char *const CC_OPTIMIZE_ARGS[] = {MJIT_OPTFLAGS NULL}; ^ mjit.c:574:1: error: stray ‘\’ in program mjit.c:584:5: error: stray ‘\’ in program MJIT_CC_COMMON MJIT_CFLAGS GCC_PIC_FLAGS ^ mjit.c:584:5: error: stray ‘\’ in program mjit.c:584:5: error: stray ‘\’ in program mjit.c:584:5: error: stray ‘\’ in program mjit.c:588:1: error: stray ‘\’ in program static const char *const CC_LDSHARED_ARGS[] = {MJIT_LDSHARED GCC_PIC_FLAGS NULL}; ^ mjit.c:588:1: error: stray ‘\’ in program mjit.c:588:1: error: stray ‘\’ in program mjit.c:589:1: error: stray ‘\’ in program static const char *const CC_DLDFLAGS_ARGS[] = {MJIT_DLDFLAGS NULL}; ^ cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default] cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default] cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default] cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default] gmake: *** [mjit.o] Error 1 exit 2 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11mjit_config.h: include trailing comma for empty listnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-11mjit_config.h: more macrosnobu
* Makefie.in, win32/Makefile.sub: add more macros for compiler to mjit_config.h. * mjit.c: unification VC and GCC in progress. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-10mjit_config.h: show content if verbosenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-10mjit_config.hnobu
* Makefie.in, win32/Makefile.sub: make mjit_config.h from configured variables, including necessary options, e.g., `-m32` for 32bit binary on 64bit platform. * mjit.c: always use configured CC command. as config.h depends on the compiler, different compilers cannot work. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-09Makefile.in: removed duplicate SET_LC_MESSAGESnobu
[ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-08MJIT header for multiarchnobu
* configure.ac: MJIT_HEADER_INSTALL_DIR to rubyarchhdrdir to support multiarch. * Makefile.in (MJIT_HEADER_INSTALL_DIR): configured by multiarch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-06moved MJIT_CPPFLAGSnobu
* Makefile.in, win32/Makefile.sub (XCFLAGS): moved MJIT_CPPFLAGS from CPPFLAGS. MJIT_CPPFLAGS is only for mjit.c, unused in extension libraries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-06common.mk: MJIT_CPPFLAGSnobu
* common.mk (MJIT_CPPFLAGS): moved common definition flags for mjit compilation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-06mjit headers for universal binarynobu
* common.mk (MJIT_HEADER, MJIT_MIN_HEADER): added hook to separate intermediate headers per archs. * defs/gmake.mk: build mjit headers per -arch options, and then merge the headers with `#ifdef`s. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-05mjit.c: determine prefix of MJIT header at runtimek0kubun
so that MJIT can work if Ruby is distributed as prebuilt binary. Now mjit_init() depends on the internal const TMP_RUBY_PREFIX which is only available after ruby_init_loadpath_safe() (L1608) and before ruby_init_prelude() (L1681). So the place of mjit_init() is moved. Makefile.in: Removed static prefix from MJIT_HEADER_ISNTALL_DIR macro. And this removes the unused LIBRUBY_LIBDIR macro as well. win32/Makefile.sub: ditto. Patch by: Lars Kanis <lars@greiz-reinsdorf.de> [Bug #14445] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04common.mk: CPPOUTFLAGnobu
* common.mk (rb_mjit_header.h): use $(CPPOUTFLAG). * win32/Makefile.sub (CPPOUTFLAG): needs -Fi to let cl.exe name preprocessed file, instead of -Fo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04common.mk: rb_mjit_header.hnobu
* common.mk (rb_mjit_header.h): moved from Makefile.in and win32/Makefile.sub. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04mjit_compile.c: merge initial JIT compilerk0kubun
which has been developed by Takashi Kokubun <takashikkbn@gmail> as YARV-MJIT. Many of its bugs are fixed by wanabe <s.wanabe@gmail.com>. This JIT compiler is designed to be a safe migration path to introduce JIT compiler to MRI. So this commit does not include any bytecode changes or dynamic instruction modifications, which are done in original MJIT. This commit even strips off some aggressive optimizations from YARV-MJIT, and thus it's slower than YARV-MJIT too. But it's still fairly faster than Ruby 2.5 in some benchmarks (attached below). Note that this JIT compiler passes `make test`, `make test-all`, `make test-spec` without JIT, and even with JIT. Not only it's perfectly safe with JIT disabled because it does not replace VM instructions unlike MJIT, but also with JIT enabled it stably runs Ruby applications including Rails applications. I'm expecting this version as just "initial" JIT compiler. I have many optimization ideas which are skipped for initial merging, and you may easily replace this JIT compiler with a faster one by just replacing mjit_compile.c. `mjit_compile` interface is designed for the purpose. common.mk: update dependencies for mjit_compile.c. internal.h: declare `rb_vm_insn_addr2insn` for MJIT. vm.c: exclude some definitions if `-DMJIT_HEADER` is provided to compiler. This avoids to include some functions which take a long time to compile, e.g. vm_exec_core. Some of the purpose is achieved in transform_mjit_header.rb (see `IGNORED_FUNCTIONS`) but others are manually resolved for now. Load mjit_helper.h for MJIT header. mjit_helper.h: New. This is a file used only by JIT-ed code. I'll refactor `mjit_call_cfunc` later. vm_eval.c: add some #ifdef switches to skip compiling some functions like Init_vm_eval. win32/mkexports.rb: export thread/ec functions, which are used by MJIT. include/ruby/defines.h: add MJIT_FUNC_EXPORTED macro alis to clarify that a function is exported only for MJIT. array.c: export a function used by MJIT. bignum.c: ditto. class.c: ditto. compile.c: ditto. error.c: ditto. gc.c: ditto. hash.c: ditto. iseq.c: ditto. numeric.c: ditto. object.c: ditto. proc.c: ditto. re.c: ditto. st.c: ditto. string.c: ditto. thread.c: ditto. variable.c: ditto. vm_backtrace.c: ditto. vm_insnhelper.c: ditto. vm_method.c: ditto. I would like to improve maintainability of function exports, but I believe this way is acceptable as initial merging if we clarify the new exports are for MJIT (so that we can use them as TODO list to fix) and add unit tests to detect unresolved symbols. I'll add unit tests of JIT compilations in succeeding commits. Author: Takashi Kokubun <takashikkbn@gmail.com> Contributor: wanabe <s.wanabe@gmail.com> Part of [Feature #14235] --- * Known issues * Code generated by gcc is faster than clang. The benchmark may be worse in macOS. Following benchmark result is provided by gcc w/ Linux. * Performance is decreased when Google Chrome is running * JIT can work on MinGW, but it doesn't improve performance at least in short running benchmark. * Currently it doesn't perform well with Rails. We'll try to fix this before release. --- * Benchmark reslts Benchmarked with: Intel 4.0GHz i7-4790K with 16GB memory under x86-64 Ubuntu 8 Cores - 2.0.0-p0: Ruby 2.0.0-p0 - r62186: Ruby trunk (early 2.6.0), before MJIT changes - JIT off: On this commit, but without `--jit` option - JIT on: On this commit, and with `--jit` option ** Optcarrot fps Benchmark: https://github.com/mame/optcarrot | |2.0.0-p0 |r62186 |JIT off |JIT on | |:--------|:--------|:--------|:--------|:--------| |fps |37.32 |51.46 |51.31 |58.88 | |vs 2.0.0 |1.00x |1.38x |1.37x |1.58x | ** MJIT benchmarks Benchmark: https://github.com/benchmark-driver/mjit-benchmarks (Original: https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch/MJIT-benchmarks) | |2.0.0-p0 |r62186 |JIT off |JIT on | |:----------|:--------|:--------|:--------|:--------| |aread |1.00 |1.09 |1.07 |2.19 | |aref |1.00 |1.13 |1.11 |2.22 | |aset |1.00 |1.50 |1.45 |2.64 | |awrite |1.00 |1.17 |1.13 |2.20 | |call |1.00 |1.29 |1.26 |2.02 | |const2 |1.00 |1.10 |1.10 |2.19 | |const |1.00 |1.11 |1.10 |2.19 | |fannk |1.00 |1.04 |1.02 |1.00 | |fib |1.00 |1.32 |1.31 |1.84 | |ivread |1.00 |1.13 |1.12 |2.43 | |ivwrite |1.00 |1.23 |1.21 |2.40 | |mandelbrot |1.00 |1.13 |1.16 |1.28 | |meteor |1.00 |2.97 |2.92 |3.17 | |nbody |1.00 |1.17 |1.15 |1.49 | |nest-ntimes|1.00 |1.22 |1.20 |1.39 | |nest-while |1.00 |1.10 |1.10 |1.37 | |norm |1.00 |1.18 |1.16 |1.24 | |nsvb |1.00 |1.16 |1.16 |1.17 | |red-black |1.00 |1.02 |0.99 |1.12 | |sieve |1.00 |1.30 |1.28 |1.62 | |trees |1.00 |1.14 |1.13 |1.19 | |while |1.00 |1.12 |1.11 |2.41 | ** Discourse's script/bench.rb Benchmark: https://github.com/discourse/discourse/blob/v1.8.7/script/bench.rb NOTE: Rails performance was somehow a little degraded with JIT for now. We should fix this. (At least I know opt_aref is performing badly in JIT and I have an idea to fix it. Please wait for the fix.) *** JIT off Your Results: (note for timings- percentile is first, duration is second in millisecs) categories_admin: 50: 17 75: 18 90: 22 99: 29 home_admin: 50: 21 75: 21 90: 27 99: 40 topic_admin: 50: 17 75: 18 90: 22 99: 32 categories: 50: 35 75: 41 90: 43 99: 77 home: 50: 39 75: 46 90: 49 99: 95 topic: 50: 46 75: 52 90: 56 99: 101 *** JIT on Your Results: (note for timings- percentile is first, duration is second in millisecs) categories_admin: 50: 19 75: 21 90: 25 99: 33 home_admin: 50: 24 75: 26 90: 30 99: 35 topic_admin: 50: 19 75: 20 90: 25 99: 30 categories: 50: 40 75: 44 90: 48 99: 76 home: 50: 42 75: 48 90: 51 99: 89 topic: 50: 49 75: 55 90: 58 99: 99 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04Makefile.in: use CFLAGS_NO_ARCH for cppk0kubun
Using $(CFLAGS) breaks the build when multiple `-arch` options are given. Then we should omit arch flags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04common.mk: MJIT_MIN_HEADERnobu
* common.mk ($(MJIT_MIN_HEADER)): moved duplicate recipe from Makefile.in and win32/Makefile.sub. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04use ifchange tool for rb_mjit_header.hnobu
* Makefile.in, win32/Makefile.sub (rb_mjit_header.h): use ifchange tool. cmp command is not available on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04mjit.c: merge MJIT infrastructurek0kubun
that allows to JIT-compile Ruby methods by generating C code and using C compiler. See the first comment of mjit.c to know what this file does. mjit.c is authored by Vladimir Makarov <vmakarov@redhat.com>. After he invented great method JIT infrastructure for MRI as MJIT, Lars Kanis <lars@greiz-reinsdorf.de> sent the patch to support MinGW in MJIT. In addition to merging it, I ported pthread to Windows native threads. Now this MJIT infrastructure can be compiled on Visual Studio. This commit simplifies mjit.c to decrease code at initial merge. For example, this commit does not provide multiple JIT threads support. We can resurrect them later if we really want them, but I wanted to minimize diff to make it easier to review this patch. `/tmp/_mjitXXX` file is renamed to `/tmp/_ruby_mjitXXX` because non-Ruby developers may not know the name "mjit" and the file name should make sure it's from Ruby and not from some harmful programs. TODO: it may be better to store this to some temporary directory which Ruby is already using by Tempfile, if it's not bad for performance. mjit.h: New. It has `mjit_exec` interface similar to `vm_exec`, which is for triggering MJIT. This drops interface for AOT compared to the original MJIT. Makefile.in: define macros to let MJIT know the path of MJIT header. Probably we can refactor this to reduce the number of macros (TODO). win32/Makefile.sub: ditto. common.mk: compile mjit.o and mjit_compile.o. Unlike original MJIT, this commit separates MJIT infrastructure and JIT compiler code as independent object files. As initial patch is NOT going to have ultra-fast JIT compiler, it's likely to replace JIT compiler, e.g. original MJIT's compiler or some future JIT impelementations which are not public now. inits.c: define MJIT module. This is added because `MJIT.enabled?` was necessary for testing. test/lib/zombie_hunter.rb: skip if `MJIT.enabled?`. Obviously this wouldn't work with current code when JIT is enabled. test/ruby/test_io.rb: skip this too. This would make no sense with MJIT. ruby.c: define MJIT CLI options. As major difference from original MJIT, "-j:l"/"--jit:llvm" are renamed to "--jit-cc" because I want to support not only gcc/clang but also cl.exe (Visual Studio) in the future. But it takes only "--jit-cc=gcc", "--jit-cc=clang" for now. And only long "--jit" options are allowed since some Ruby committers preferred it at Ruby developers Meeting on January, and some of options are renamed. This file also triggers to initialize MJIT thread and variables. eval.c: finalize MJIT worker thread and variables. test/ruby/test_rubyoptions.rb: fix number of CLI options for --jit. thread_pthread.c: change for pthread abstraction in MJIT. Prefix rb_ for functions which are used by other files. thread_win32.c: ditto, for Windows. Those pthread porting is one of major works that YARV-MJIT created, which is my fork of MJIT, in Feature 14235. thread.c: follow rb_ prefix changes vm.c: trigger MJIT call on VM invocation. Also trigger `mjit_mark` to avoid SEGV by race between JIT and GC of ISeq. The improvement was provided by wanabe <s.wanabe@gmail.com>. In JIT compiler I created and am going to add in my next commit, I found that having `mjit_exec` after `vm_loop_start:` is harmful because the JIT-ed function doesn't proceed other ISeqs on RESTORE_REGS of leave insn. Executing non-FINISH frame is unexpected for my JIT compiler and `exception_handler` triggers executions of such ISeqs. So `mjit_exec` here should be executed only when it directly comes from `vm_exec` call. `RubyVM::MJIT` module and `.enabled?` method is added so that we can skip some tests which don't expect JIT threads or compiler file descriptors. vm_insnhelper.h: trigger MJIT on method calls during VM execution. vm_core.h: add fields required for mjit.c. `bp` must be `cfp[6]` because rb_control_frame_struct is likely to be casted to another struct. The last position is the safest place to add the new field. vm_insnhelper.c: save initial value of cfp->ep as cfp->bp. This is an optimization which are done in both MJIT and YARV-MJIT. So this change is added in this commit. Calculating bp from ep is a little heavy work, so bp is kind of cache for it. iseq.c: notify ISeq GC to MJIT. We should know which iseq in MJIT queue is GCed to avoid SEGV. TODO: unload some GCed units in some safe way. gc.c: add hooks so that MJIT can wait GC, and vice versa. Simultaneous JIT and GC executions may cause SEGV and so we should synchronize them. cont.c: save continuation information in MJIT worker. As MJIT shouldn't unload JIT-ed code which is being used, MJIT wants to know full list of saved execution contexts for continuation and detect ISeqs in use. mjit_compile.c: added empty JIT compiler so that you can reuse this commit to build your own JIT compiler. This commit tries to compile ISeqs but all of them are considered as not supported in this commit. So you can't use JIT compiler in this commit yet while we added --jit option now. Patch author: Vladimir Makarov <vmakarov@redhat.com>. Contributors: Takashi Kokubun <takashikkbn@gmail.com>. wanabe <s.wanabe@gmail.com>. Lars Kanis <lars@greiz-reinsdorf.de>. Part of Feature 12589 and 14235. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e