Граф коммитов

110 Коммитов

Автор SHA1 Сообщение Дата
k0kubun efd99b5331 Revert "mjit.c: use boolean type for boolean variables"
This reverts commit bb1a1aeab0.

We hit something on ci.rvm.jp, reverting until investigation is done.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10 13:29:29 +00:00
k0kubun bb1a1aeab0 mjit.c: use boolean type for boolean variables
and functions to clarify the intention and make sure it's not used in a
surprising way (like using 2, 3, ... other than 0, 1 even while it seems
to be a boolean).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10 13:21:58 +00:00
nobu 78d6e33702 Fix styles [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-09 13:58:49 +00:00
odaira d612c44dad Enable MJIT on AIX
* configure.ac: disable using __builtin_setjmp to avoid errors when execution
  globally jumps out of JITted code. Specify -std=gnu99 to JIT compilation
  to avoid errors regarding the "restrict" keyword in the precompiled header.
  Specify -shared in addition to -Wl,-G when building shared libraries
  to make mjit_build_dir.so expose the MJIT_BUILD_DIR symbol.  Use LDR_PRELOAD
  to load mjit_build_dir.so.

* mjit_worker.c: do not specify -nodefaultlibs or -nostdlibs because on AIX
  JITted code internally refers to the memcpy function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-04 22:19:09 +00:00
k0kubun 60989daa1b mjit.c: eliminate -save-temps flag
in a new variable cc_common_args.

`cflags=-save-temps=obj` makes MJIT fail like:
https://rubyci.org/logs/www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20181203T095000Z.log.html.gz

This rubyci specifies -save-temps=obj in CFLAGS to use update-deps, and
the flag is harmful when we want to use -pipe flag.

mjit_worker.c: prefer cc_common_args over CC_COMMON_ARGS

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 12:32:01 +00:00
k0kubun 33eebfd301 mjit_worker.c: undefine CC_PATH
because we mostly use cc_path now and the comment is obsolete (CC_PATH
is now absolute path and the TODO is already resolved).

mjit.c: use CC_COMMON_ARGS[0] directly

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 12:00:27 +00:00
normal eb38fb670b vm_trace.c: workqueue as thread-safe version of postponed_job
postponed_job is safe to use in signal handlers, but is not
thread-safe for MJIT.  Implement a workqueue for MJIT
thread-safety.

[Bug #15316]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-30 03:56:29 +00:00
k0kubun 86cb3d319f mjit_worker.c: promote mjit_copy_job from function
-local variable to global variable.

Consider this case:
1. MJIT worker: dequeue ISeq (stop_worker_p was still FALSE)
2. Ruby thread: call Kernel#exec, which calls mjit_finish(FALSE),
                sets `stop_worker_p = TRUE`, and fires RUBY_VM_CHECK_INTS() once
3. MJIT worker: register copy job, but found stop_worker_p is TRUE.
                set `worker_stopped = TRUE` and the thread stops.
4. Function-local job variable expires by the thread stop (this is eliminated by this commit)
5. Ruby thread: find `worker_stopped` becamse TRUE, start Kernel#exec.
                Kernel#exec fails but exception is rescued.
6. Ruby thread: call RUBY_VM_CHECK_INTS. copy job is dispatched but job variable
                is already expired.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-27 12:00:51 +00:00
ko1 96990203b7 Support targetting TracePoint [Feature #15289]
* vm_trace.c (rb_tracepoint_enable_for_target): support targetting
  TracePoint. [Feature #15289]

  Tragetting TracePoint is only enabled on specified method, proc
  and so on, example: `tp.enable(target: code)`.

  `code` should be consisted of InstructionSeuqnece (iseq)
  (RubyVM::InstructionSeuqnece.of(code) should not return nil)
  If code is a tree of iseq, TracePoint is enabled on all of
  iseqs in a tree.

  Enabled tragetting TracePoints can not enabled again with
  and without target.

* vm_core.h (rb_iseq_t): introduce `rb_iseq_t::local_hooks`
  to store local hooks.
  `rb_iseq_t::aux::trace_events` is renamed to
  `global_trace_events` to contrast with `local_hooks`.

* vm_core.h (rb_hook_list_t): add `rb_hook_list_t::running`
  to represent how many Threads/Fibers are used this list.
  If this field is 0, nobody using this hooks and we can
  delete it.

  This is why we can remove code from cont.c.

* vm_core.h (rb_vm_t): because of above change, we can eliminate
  `rb_vm_t::trace_running` field.
  Also renamed from `rb_vm_t::event_hooks` to `global_hooks`.

* vm_core.h, vm.c (ruby_vm_event_enabled_global_flags): renamed
  from `ruby_vm_event_enabled_flags.

* vm_core.h, vm.c (ruby_vm_event_local_num): added to count
  enabled targetting TracePoints.

* vm_core.h, vm_trace.c (rb_exec_event_hooks): accepts
  hook list.

* vm_core.h (rb_vm_global_hooks): added for convinience.

* method.h (rb_method_bmethod_t): added to maintain Proc
  and `rb_hook_list_t` for bmethod (defined by define_method).

* prelude.rb (TracePoint#enable): extracet a keyword parameter
  (because it is easy than writing in C).
  It calls `TracePoint#__enable` internal method written in C.

* vm_insnhelper.c (vm_trace): check also iseq->local_hooks.

* vm.c (invoke_bmethod): check def->body.bmethod.hooks.

* vm.c (hook_before_rewind): check iseq->local_hooks
  and def->body.bmethod.hooks before rewind by exception.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-26 18:16:39 +00:00
k0kubun a3bb9f1093 mjit_worker.c: disable running copy job
after MJIT worker stop.

r65928 didn't fix the SEGV. This commit hopes to fix
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/1478576

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-26 12:50:42 +00:00
k0kubun 2751b5366d mjit.c: avoid running copy job handler after ISeq GC
like this http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1471633

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-22 13:29:44 +00:00
k0kubun d53220848c mjit_worker.c: avoid GC when modifying ISeq
This is hoped to fix the SEGV:
https://app.wercker.com/ruby/ruby/runs/mjit-test1/5bf392cf183106002856c1f0?step=5bf3bddc87436a0006292535

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 11:18:59 +00:00
k0kubun fe6974a8fc mjit_worker.c: support MJIT in forked Ruby process
by launching MJIT worker thread in child Ruby process.

See the comment before `mjit_child_after_fork` for details.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-18 08:25:48 +00:00
k0kubun bdf5eb3b91 mjit_worker.c: fix typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-18 08:22:46 +00:00
k0kubun c8cfd78b40 mjit_worker.c: stop expanding already-absolute MJIT_CC
r65577 seems to have made MJIT_CC (MJIT_CC_COMMONA) become an absolute
path. So start_process doesn't need to find that from PATH by dln_find_exe_r.

This commit is motivated by the msys2 AppVeyor CI failure:
https://ci.appveyor.com/project/ruby/ruby/builds/20084104/job/1pg15os4dtttyl0q

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07 08:04:39 +00:00
k0kubun 6c2014768e mjit_worker.c: don't use _one for now
I'm planning to use _one later, but it may be doubly registered by
switching `stop_worker_p` now and so we should not use _one for now.

Otherwise stale job may reject new job registration and
copy_cache_from_main_thread may wait forever.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06 07:30:37 +00:00
k0kubun 7a2263fb38 mjit_worker.c: strictly control MJIT copy job
-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-06 07:22:25 +00:00
k0kubun 6e9703b011 mjit_worker.c: do no access pointer after free
When we return there, `unit` is already freed.
This is detected by coverity scan.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 11:40:43 +00:00
k0kubun f1d545a76f mjit_worker.c: emphasize free_list of compact_units [ci skip]
In https://bugs.ruby-lang.org/issues/14867#note-98, it's considered
useless at once. So I emphasized the necessity of it in the comment.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-01 01:47:26 +00:00
normal 143776f6fe mjit: get rid of rb_mjit_unit_node and use ccan/list
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-31 23:55:22 +00:00
k0kubun 883f93a12e Revert "revert r65471 and include Eric's patch as well"
This reverts commit ff5dc2cbbf.

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-31 13:12:39 +00:00
k0kubun ff5dc2cbbf revert r65471 and include Eric's patch as well
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-31 12:21:55 +00:00
normal dc8a744d6e Revert "mjit: get rid of rb_mjit_unit_node and use ccan/list"
This reverts commit c5177fa846. 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-31 06:44:42 +00:00
normal c5177fa846 mjit: get rid of rb_mjit_unit_node and use ccan/list
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-31 03:02:01 +00:00
ko1 8f675cdd00 support theap for T_HASH. [Feature #14989]
* hash.c, internal.h: support theap for small Hash.
  Introduce RHASH_ARRAY (li_table) besides st_table and small Hash
  (<=8 entries) are managed by an array data structure.
  This array data can be managed by theap.
  If st_table is needed, then converting array data to st_table data.

  For st_table using code, we prepare "stlike" APIs which accepts hash value
  and are very similar to st_ APIs.

  This work is based on the GSoC achievement
  by tacinight <tacingiht@gmail.com> and refined by ko1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-30 22:11:51 +00:00
k0kubun 456a54de69 mjit_worker.c: don't ask MJIT copy job to main thread
when main thread is waiting for MJIT worker forever without executing
RUBY_VM_CHECK_INTS due to --jit-wait.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-23 13:05:29 +00:00
k0kubun 5984aa84db mjit.c: prevent from accessing expired job
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-23 00:09:10 +00:00
k0kubun d96483de72 mjit_worker.c: return more appropriate result
of copy job. When job is being stopped but job is actually finished,
returning FALSE could be a little confusing from the function name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-22 09:53:00 +00:00
k0kubun 89293c4ba1 mjit_worker.c: check appropriate flag to stop
This was not intentional in r65299.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-22 09:48:35 +00:00
k0kubun 821ff80c0c mjit_worker.c: make sure copy job wait is unblocked
by stop_worker(). Previously copy_cache_from_main_thread() might loop forever
even with stop_worker() is being called from ruby_cleanup().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-22 09:40:44 +00:00
k0kubun 13df05acfa mjit.c: copy call cache values to MJIT worker
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-21 14:23:24 +00:00
k0kubun 1b5aa4f516 mjit.c: copy inline cache values to MJIT worker
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-21 13:21:28 +00:00
k0kubun 67e2373f06 mjit_worker.c: don't refer to freed value
remove_from_list() frees node, but after that node->next could be used

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 11:21:07 +00:00
ko1 b710785f1a add disabling MJIT features option.
* 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-20 06:53:00 +00:00
k0kubun 4765da9c58 mjit_worker.c: don't compile more than max_cache_size
Prior to this commit, max_cache_size + 1 methods could be active.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-19 13:47:02 +00:00
k0kubun b712840c8a mjit_worker.c: suppress child process's output properly
Prior to this commit, some of parent process's output was unintentionally
suppressed. We couldn't suppress only child process's output with spawnvp.

Instead of that, this commit uses CreateProcess directly to redirect stdout
and stderr only for child process.

As it's dealing with HANDLE returned from CreateProcess, now waitpid macro
needs to CloseHandle it.

win32/win32.c: Introduce rb_w32_start_process which is designed for MJIT
worker. Other similar functions can't be used since they are using ALLOCV
that may trigger GC, which should be avoided on MJIT worker.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-12 15:14:51 +00:00
k0kubun 0fd5f063aa win32/Makefile.sub: generate MJIT header pdb
in the MJIT-header-specific path, not default path like vc140.pdb.

mjit_worker.c: specify the MJIT-header-specific pdb path.

tool/rbinstall.rb: install MJIT header pdb as well.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-11 16:28:04 +00:00
k0kubun 50f2520b1f mjit_worker.c: clean up all unnecessary files on mswin
test_jit.rb: passed all MJIT tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-07 15:09:58 +00:00
k0kubun ceab2821a0 mjit_worker.c: don't suppress cl.exe logs
on --jit-verbose=2+.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-07 14:51:53 +00:00
k0kubun b62c1a22b3 mjit_worker.c: print warning if FreeLibrary fails
because somehow AppVeyor fails to remove so file by Permission Deined.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-07 12:28:46 +00:00
k0kubun 77a682a3dd mjit_worker.c: clean up .obj file on mswin
prior to this commit, .obj file is generated on current directory and nobody deletes that.
This changes it to make sure it's generated to temporary directory and removes that.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-07 08:03:36 +00:00
nobu 7e9ee35fb8 Remove -Wno-parentheses flag.
[Fix GH-1958]

From: Jun Aruga <jaruga@redhat.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-21 10:19:10 +00:00
k0kubun 9f6e9b40d3 mjit_worker.c: atomically print main message and \n
To attempt to fix CI failure on rubyci freebsd:
https://rubyci.org/logs/rubyci.s3.amazonaws.com/freebsd11zfs/ruby-trunk/log/20180911T123001Z.fail.html.gz

```
JIT success (68.7ms): mjit9@(eval):1 -> /usr/home/hsbt/chkbuild/tmp/build/20180911T123001Z/tmp/jit_test_unload_units_20180911-96427-13cagj9/_ruby_mjit_p99188u9.c
JIT compaction (25.1ms): Compacted 10 methods -> /usr/home/hsbt/chkbuild/tmp/build/20180911T123001Z/tmp/jit_test_unload_units_20180911-96427-13cagj9/_ruby_mjit_p99188u10.soToo many JIT code -- 1 units unloaded

JIT success (68.2ms): mjit10@(eval):1 -> /usr/home/hsbt/chkbuild/tmp/build/20180911T123001Z/tmp/jit_test_unload_units_20180911-96427-13cagj9/_ruby_mjit_p99188u11.c
```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-11 14:38:05 +00:00
k0kubun b173fc92c0 mjit_worker.c: revert r64322 and r64323
I gave up to introduce the optimization that skips pc motion by checking
C code's line number. The same code can often be shared by multiple
program counters and it's so hard to achieve the optimization in MJIT's
architecture.

Reverting to improve performance by removing -g1 and to remove so file
when it becomes not necessary.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-18 01:10:03 +00:00
k0kubun 0ab6266c9d Makefile.in: drop MJIT_DLDFLAGS_NOCOMPRESS
which is obsoleted by r64331

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13 11:02:37 +00:00
k0kubun 422f4e3e1b configure.ac: MJIT_DLDFLAGS_NOCOMPRESS
is configured now, to force -Wl,--compress-debug-sections=no
for MJIT only when the option is used in MJIT_DLDFLAGS.

This needs to be done in configure.ac to resolve build failure like
https://travis-ci.org/ruby/ruby/builds/415120662.

Makefile.in: define it in mjit_config.h

mjit_worker.c: replace hard-coded flag to MJIT_DLDFLAGS_NOCOMPRESS

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-12 15:13:06 +00:00
k0kubun 7e478ba366 mjit_worker.c: lazily delete so file
on ELF.

I need symbol name and line number to lazily create program counter for
optimization on ELF binary.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-12 15:00:03 +00:00
k0kubun bd789fa590 mjit_worker.c: allow showing line number
on addr2line.c, if --jit-save-temps is specified.

I'm going to use the line number to lazily create program counter to
improve the performance degraded in r64283.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-12 14:42:25 +00:00
k0kubun 69bfb6d850 mjit_worker.c: remove redundant cast for calloc/alloca
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11 14:36:14 +00:00
k0kubun 5cd84d247f mjit_worker.c: handle calloc failure
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-11 14:34:05 +00:00
k0kubun 1b157084a4 mjit_worker.c: never trigger GC on MJIT worker
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11 14:27:53 +00:00
k0kubun 004b8ad0c3 mjit_worker.c: don't use ruby_strdup
on MJIT worker. That may trigger GC. And handled strdup failure instead.

mjit_compile.c: update comment about GC

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11 14:18:55 +00:00
k0kubun d9260c5a50 mjit_worker.c: share MJIT warning logic
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-11 14:05:34 +00:00
k0kubun 3d2e7b6158 mjit_worker.c: resurrect more static declarations
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-11 10:05:56 +00:00
k0kubun cfe7f7ca7e mjit_worker.c: reorder functions and variables
so that related things are placed closely.

Sorry for mixing them in previous commits...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11 09:58:20 +00:00
k0kubun 3c442229d6 mjit.c: make some variables static again
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-11 09:48:07 +00:00
k0kubun a48d1d7991 mjit.c: include mjit_worker.c
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-11 09:37:14 +00:00
k0kubun 6306aa9222 mjit.c: exclude mjit_valid_class_serial_p
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-11 08:34:25 +00:00
k0kubun b2e0d54024 mjit_worker.c: prefix mjit_ to pch_status
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-11 08:07:13 +00:00
k0kubun ddcb40f595 mjit_worker.c: carve out worker-related code
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-11 07:57:58 +00:00