summaryrefslogtreecommitdiff
path: root/mjit.c
AgeCommit message (Collapse)Author
2018-11-07mjit_build_dir: separate MJIT_BUILD_DIRnobu
* Makefile.in (mjit_build_dir.so): separate MJIT_BUILD_DIR to eliminate the feature for test-all after installation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06mjit.c: don't use mutex before checking availabilityk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06mjit_worker.c: strictly control MJIT copy jobk0kubun
-available region. reducing risk of SEGV in mjit_copy_job_handler() like http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1446117 I'm not sure which exact part is causing "[BUG] Segmentation fault at 0x0000000000000008" on `(mjit_copy_job_handler+0x12) [0x564a6c4ce632] /home/ko1/ruby/src/trunk-mjit/mjit.c:26`... mjit.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06Revert "mjit_build_dir: separate MJIT_BUILD_DIR"nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06mjit_build_dir: separate MJIT_BUILD_DIRnobu
* Makefile.in (mjit_build_dir.so): separate MJIT_BUILD_DIR to eliminate the feature for test-all after installation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05Relax MJIT_BUILD_DIR restrictionnobu
* mjit.c (init_header_filename): sticky-mode directory probably would be less unsafe even if it is not owned. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05More verbose message at unsafe headernobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-04Check MJIT_BUILD_DIR strictlynobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-31mjit: get rid of rb_mjit_unit_node and use ccan/listnormal
rb_mjit_unit can either exist in unit_queue or active_units, but not both. This will make state transitions for event-based MJIT process management easier. v2: recheck unit->iseq after GC wakeup The iseq may be GC-ed while we were waiting for it since we delete the unit from unit_queue during get_from_list git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-31Revert "revert r65471 and include Eric's patch as well"k0kubun
This reverts commit ff5dc2cbbf9e7b67c8579ef166bf6a4755507304. Deadlock: http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1438883 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-31revert r65471 and include Eric's patch as wellk0kubun
https://bugs.ruby-lang.org/issues/14867#note-112 I wanna touch similar places. To avoid our conflict, let me merge Eric's patch earlier. Let's watch trunk-mjit / trunk-mjit-wait CIs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-31Revert "mjit: get rid of rb_mjit_unit_node and use ccan/list"normal
This reverts commit c5177fa8464ac304547e384583f9c287e124d34a. r65468 Many CI failures like: http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/1438415 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-31mjit: get rid of rb_mjit_unit_node and use ccan/listnormal
rb_mjit_unit can either exist in unit_queue or active_units, but not both. This will make state transitions for event-based MJIT process management easier. [ruby-core:89654] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-30mjit.c (free_list): clear .lengthnormal
For robustness against future changes. There should be no impact at the moment,here, but we may call mjit_finish more than once in a process lifetime in the future (implementing "stop" instead of just "pause") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-23mjit.c: prevent from accessing expired jobk0kubun
Given that `copy_cache_from_main_thread()` breaks the loop when `stop_worker_p` is TRUE, memory of `job` allocated by `alloca` may be invalid if `stop_worker_p` is already TRUE. mjit_worker.c: explain why `copy_cache_from_main_thread()` should not stop checking `stop_worker_p`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-21mjit.c: copy call cache values to MJIT workerk0kubun
same as r65275 but for call cache. === Optcarrot Benchmark === $ benchmark-driver benchmark.yml --rbenv 'before::before --disable-gems --jit;after::after --disable-gems --jit' -v --repeat-count 24 before: ruby 2.6.0dev (2018-10-21 trunk 65277) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-10-21 trunk 65277) +JIT [x86_64-linux] last_commit=mjit.c: copy call cache values to MJIT worker Calculating ------------------------------------- before after Optcarrot Lan_Master.nes 85.372 85.359 fps Comparison: Optcarrot Lan_Master.nes before: 85.4 fps after: 85.4 fps - 1.00x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-21mjit.c: copy inline cache values to MJIT workerk0kubun
on VM_CHECK_INTS. Letting MJIT worker directly see inline cache which may be being updated could result in inconsistent IC index and serial. mjit_worker.c: request the copy job after dequeue, and receive the result synchronously. tool/ruby_vm/views/_mjit_compile_ivar.erb: use the copied IC mjit_compile.c: change the interface to pass is_entries mjit.h: ditto === Optcarrot Benchmark === Thankfully this didn't have major performance regression. $ benchmark-driver benchmark.yml --rbenv 'before::before --disable-gems --jit;after::after --disable-gems --jit' -v --repeat-count 24 before: ruby 2.6.0dev (2018-10-21 trunk 65263) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-10-21 trunk 65263) +JIT [x86_64-linux] last_commit=mjit.c: copy inline cache values to MJIT worker Calculating ------------------------------------- before after Optcarrot Lan_Master.nes 85.421 85.454 fps Comparison: Optcarrot Lan_Master.nes after: 85.5 fps before: 85.4 fps - 1.00x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20add disabling MJIT features option.ko1
* configure.ac: introduce new configure option `--enable-mjit` and `--disable-mjit`. Default is "enable". `--disable-mjit` disables all of MJIT features so that `ruby --jit` can't enable MJIT. This option affect a macro `USE_MJIT`. This change remove `--enable/disable-install-mjit-header` option. * Makefile.in: introduce the `ENABLE_MJIT` variable. * common.mk: use `ENABLE_MJIT` option. * internal.h: respect `USE_MJIT`. Same as other *.c, *.h. * test/ruby/test_jit.rb: check `ENABLE_MJIT` key of rbconfg.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-19mjit.c: don't let MJIT.pause hang on full active unitsk0kubun
test/ruby/test_rubyvm_mjit.rb: add reproductive test [Bug #15071] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-07mjit.c: fix obsoleted comment [ci skip]k0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-07mjit.h: call compiled code immediatelyk0kubun
after the first compilation on --jit-wait. Previously the assignment to `func` didn't have meaning for the behavior, and the compiled code wasn't called immediately after the synchronous compilation. It wasn't intentional. Fixing this issue without impacting performance without --jit-wait is not so obvious. Adding branch or goto to call func in mjit_exec spoiled the performance without --jit-wait. Instead of that, I called the func inside mjit_wait_call() (former mjit_get_iseq_func()) which is never inlined to mjit_exec(). Thanks to that, this commit has no impact for normal performance. mjit.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-12mjit.c: reduce the number of variablesk0kubun
in mark_ec_units() to simplify code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit.c: stop defining alias for a very limited usek0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit.c: drop obsoleted duplicated declarationk0kubun
of mjit_worker(). It was needed when mjit_worker.c is separated from mjit.c, but it's now just included. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit_worker.c: handle calloc failurek0kubun
Unlike ZALLOC, it's not automatically handled. mjit.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit_worker.c: share MJIT warning logick0kubun
as mjit_warning(). mjit.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit_worker.c: resurrect more static declarationsk0kubun
and remove old mjit_ prefixes again. mjit.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit.c: make some variables static againk0kubun
and remove redundant mjit_ prefixes. mjit_worker.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit.c: include mjit_worker.ck0kubun
instead of linking functions with mjit_worker.o. In the r64285's structure, we needed to publish some variables with mjit_ prefix. But ideally those variables should be completely private in mjit.o (or old mjit_worker.o), and it was hard. So I chose an approach similar to vm*.c for mjit.c and mjit_worker.c. I believe mjit_compile.c is still nice to be separated. After this commit, I'll remove the mjit_ prefix again... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit.c: exclude mjit_valid_class_serial_pk0kubun
from mjit.c because it's executed only on MJIT worker thread. Instead of that, `valid_class_serials` is shared with mjit_ prefix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit_worker.c: prefix mjit_ to pch_statusk0kubun
which was just forgotten. mjit.c: ditto mjit_internal.h: moved some macros only used by mjit_worker.c to it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11mjit_worker.c: carve out worker-related codek0kubun
The motivation of this change is to make sure rb_funcall or GC-related functions are not called on worker-related code. Currently such functions are used in some places and I believe it's partly because it's hard to identify which part is called on MJIT worker thread. Now, mjit.c is safe to use them but we know we need to safely deal with mjit_compile.c, mjit_worker.c and mjit_internal.h. mjit_compile.c: update the comment about it git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-10version.c: separate Init_ruby_descriptionnobu
* version.c (Init_ruby_description): separate to initialize RUBY_DESCRIPTION constant according to mjit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-10mjit.c: ruby_version is no longer used since r63279nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-09process.c: don't wait JIT queue flush on rb_f_execk0kubun
This wasn't intended in r64253. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-09process.c: fix outdated mjit_pause declarationk0kubun
by sharing it with vm.c in internal.h. vm.c: ditto internal.h: ditto mjit.h: share more. mjit.c: make sure the third arguemnt is not used git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-09mjit.c: add :wait option to RubyVM::MJIT.pausek0kubun
and wait until JIT queue is flushed when wait option is not passed or `wait: true` is passed. vm.c: ditto test/ruby/test_rubyvm_mjit.rb: added test for pause/resume test/lib/jit_support.rb: allow retrying MJIT on JITSupport level test/ruby/test_jit.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-08mjit.c: remove old comment about WNOHANG and SIGCHLD [ci skip]normal
[Bug #14867] implemented exactly what was needed (for POSIX platforms, at least). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-07mjit.c: initial support for mswin MJITk0kubun
By this commit's changes in other files, now MJIT started to work on VC++. Unfortunately some features are still broken and they'll be fixed later. This also suppresses cl.exe's default output to stdout because there seems to be no option to do it. Tweaking some log messages as well. vm_core.h: declare `__declspec(dllimport)` to export them correctly on mswin. vm_insnhelper.h: ditto mjit.h: ditto test_jit.rb: skipped some pending tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-05mjit.c: use -Tc flag explicitlyk0kubun
This option makes sure that the argument is C source file. Probably this is not needed, but since I'm debugging it, I want to exclude any failure possibility for now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-05mjit.c: link precompiled objectk0kubun
This is needed to resolve: "error LNK2011: precompiled object not linked in; image may not run" win32/Makefile.sub: Use the same flags as ones for precompiled header. This is needed to resolve: "error C2855: command-line option '/Z7' inconsistent with precompiled header" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-05mjit.c: reorder functions to reduce #ifdef branchesk0kubun
Just moved make_pch into `#else` of `#ifdef _MSC_VER`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-05mjit.c: include prebuilt precompiled headerk0kubun
on mswin properly. Deleted code to attempt make_pch for mswin, since it won't be needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-05mjit.c: initialize prebuilt precompiled headerk0kubun
file name correctly. This allows to use the header installed by r64188. win32/Makefile.sub: define prebuilt precompiled header path instead of unused min header path git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-02mjit.c: skip compaction on MinGWk0kubun
because linking multiple .o files is problematic without having `static` to the same function definitions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-02mjit.c: don't apply workaround if --enable-load-relativek0kubun
is specified. This is needed for MinGW because MJIT_BUILD_DIR doesn't prefix path like "C:\msys64", so it can't be read without msys2's conversion. The workaround is not needed for Windows (LOAD_RELATIVE looks defined by default) anyway. So removed it for such environment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-02mjit.c: suppress warnings by -Wunused-valuek0kubun
on MinGW with __atomic_exchange_n(). It returns the previous pointer value but obviously it's not needed in MJIT's usage. mjit.c: In function 'compact_all_jit_code': ruby_atomic.h:11:36: warning: value computed is not used [-Wunused-value] # define ATOMIC_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-01move atomic logic from mjit.c from ruby_atomic.hshyouhei
This macro shall be shared among other files, not just for mjit.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64156 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-30move #pragma out of functionsshyouhei
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) reportedly fails to compile cf: https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-trunk/log/20180726T093003Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e