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

155 Коммитов

Автор SHA1 Сообщение Дата
k0kubun f13a2ad6df mjit.c: fix obsoleted comment [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-07 04:29:00 +00:00
k0kubun e889fad86c mjit.h: call compiled code immediately
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-10-07 04:17:59 +00:00
k0kubun c55e10a9ea mjit.c: reduce the number of variables
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-12 12:59:47 +00:00
k0kubun 33d318a29e mjit.c: stop defining alias for a very limited use
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11 14:48:10 +00:00
k0kubun 1bc2641b00 mjit.c: drop obsoleted duplicated declaration
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-11 14:44:31 +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 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 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
nobu 6c70fede0c version.c: separate Init_ruby_description
* 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-10 05:02:35 +00:00
nobu 3ef25ed755 mjit.c: ruby_version is no longer used since r63279
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-10 04:33:11 +00:00
k0kubun 2e003f6c87 process.c: don't wait JIT queue flush on rb_f_exec
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-09 11:39:07 +00:00
k0kubun 212a77ed46 process.c: fix outdated mjit_pause declaration
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-09 11:31:41 +00:00
k0kubun 510cd06c78 mjit.c: add :wait option to RubyVM::MJIT.pause
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-09 09:58:07 +00:00
normal 953b7a2056 mjit.c: remove old comment about WNOHANG and SIGCHLD [ci skip]
[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-08 07:26:14 +00:00
k0kubun 10bccf3465 mjit.c: initial support for mswin MJIT
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-07 16:27:45 +00:00
k0kubun e09c14a05f mjit.c: use -Tc flag explicitly
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-05 14:33:40 +00:00
k0kubun 88975c821c mjit.c: link precompiled object
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-05 05:34:37 +00:00
k0kubun d3e90363d3 mjit.c: reorder functions to reduce #ifdef branches
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-05 04:48:18 +00:00
k0kubun d7786b1e78 mjit.c: include prebuilt precompiled header
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-05 04:37:59 +00:00
k0kubun 5f13fe31ad mjit.c: initialize prebuilt precompiled header
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-05 03:12:09 +00:00
k0kubun d4381d2ceb mjit.c: skip compaction on MinGW
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-02 14:40:36 +00:00
k0kubun 2aea3deddd mjit.c: don't apply workaround if --enable-load-relative
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-02 13:41:27 +00:00
k0kubun 57369c1c70 mjit.c: suppress warnings by -Wunused-value
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-02 13:03:34 +00:00
shyouhei e62214be87 move atomic logic from mjit.c from ruby_atomic.h
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-08-01 03:40:37 +00:00
k0kubun 11974fc010 mjit.c: allow using MJIT header in build directory
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-31 12:43:06 +00:00
shyouhei ab740cbb75 move #pragma out of functions
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
2018-07-30 07:53:24 +00:00
shyouhei d83536c980 reduce copy & paste
We see several occurrence of "diagnostic push/pop" so why not
make them macros.  Tested on GCC8 / Clang 6.

Note that ruby.h is intentionally left untouched because we don't
want to introduce new public macros.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-30 07:07:48 +00:00
shyouhei 18e22154e0 non-constant aggregate initializer is a C99ism
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-30 03:23:32 +00:00
k0kubun e3c1c406fc mjit.c: keep unit->o_file on --jit-save-temps
to use compaction with --jit-save-temps.

Prior to this commit, JIT compaction didn't work with --jit-save-temps
but it wasn't intentional.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-29 08:04:45 +00:00
k0kubun 82bd2a9cc0 mjit.c: disable compaction on empty queue w/ --jit-wait
When --jit-wait is specified, `unit_queue.length` is always 0 and it's
not a good metric.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-29 02:05:08 +00:00
k0kubun 443f4d583c mjit.c: introduce JIT compaction [experimental]
When all compilation finishes or the number of JIT-ed code reaches
--jit-max-cache, this compacts all generated code to a single .so file
and re-loads all methods from it.

In the future, it may trigger compaction more frequently and/or limit
the maximum times of compaction to prevent unlimited memory usage.
So the current behavior is experimental, but at least the performance
improvement in this commit won't be removed.

=== Benchmark ===
In this benchmark, I'll compare following four conditions:

* trunk: r64082
* trunk JIT: r64082 w/ --jit
* single-so JIT: This commit w/ --jit
* objfcn JIT: This branch https://github.com/k0kubun/ruby/tree/objfcn w/ --jit,
  which is shinh's objfcn https://github.com/shinh/ruby/tree/objfcn rebased from this commit

```
$ uname -a
Linux bionic 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
```

* Micro benchmark
Using this script https://gist.github.com/k0kubun/10e6d3387c9ab1b134622b2c9d76ef51,
calls some amount of different methods that just return `nil`. The following tables
are its average duration seconds of 3 measurements.

Smaller is better.

** 1 method (seconds)
|       | trunk             | trunk JIT         | single-so JIT     | objfcn JIT        |
|:------|:------------------|:------------------|:------------------|:------------------|
| Time  | 5.576067774333296 | 5.915551971666446 | 5.833641665666619 | 5.845915191666639 |
| Ratio | 1.00x             | 1.06x             | 1.05x             | 1.05x             |

** 50 methods (seconds)
|       | trunk             | trunk JIT         | single-so JIT     | objfcn JIT        |
|:------|:------------------|:------------------|:------------------|:------------------|
| Time  | 3.1661167996666677| 6.125825928333342 | 4.135432743666665 | 3.750358728333348 |
| Ratio | 1.00x             | 1.93x             | 1.31x             | 1.18x             |

** 1500 methods (seconds)
|       | trunk             | trunk JIT         | single-so JIT     | objfcn JIT        |
|:------|:------------------|:------------------|:------------------|:------------------|
| Time  | 5.971650823666664 | 19.579182102999994| 10.511108153999961| 10.854653588999932|
| Ratio | 1.00x             | 3.28x             | 1.76x             | 1.82x             |

* Discourse
Using the same benchmark strategy as https://bugs.ruby-lang.org/issues/14490 with
this branch https://github.com/k0kubun/discourse/commits/benchmark2 forked from discourse
v1.8.11 to support running trunk.

1. Run ruby script/bench.rb to warm up profiling database
2. Run RUBYOPT='--jit-verbose=1 --jit-max-cache=10000' RAILS_ENV=profile bin/puma -e production
3. WAIT 5-15 or so minutes for all jitting to stop so we have no cross talk
4. Run ab -n 100 http://localhost:9292/
5. Wait for all new jitting to finish
6. Run ab -n 100 http://localhost:9292/

** Response time (ms)
Here is the response time milliseconds for each percentile.
Skipping 99%ile because it's the same as 100%ile in 100 calls.

|     | trunk| trunk|single|objfcn|
|     |      |   JIT|so JIT|   JIT|
|:----|:-----|:-----|:-----|:-----|
| 50% |   38 |   45 |   41 |   43 |
| 66% |   39 |   50 |   44 |   44 |
| 75% |   47 |   51 |   46 |   45 |
| 80% |   49 |   52 |   47 |   47 |
| 90% |   50 |   63 |   50 |   52 |
| 95% |   60 |   79 |   52 |   55 |
| 98% |   91 |  114 |   91 |   91 |
|100% |   97 |  133 |   96 |   99 |

** Ratio (smaller is better)
Here is the response time increase ratio against no-JIT trunk's one.

|     | trunk| trunk|single|objfcn|
|     |      |   JIT|so JIT|   JIT|
|:----|:-----|:-----|:-----|:-----|
| 50% | 1.00x| 1.18x| 1.08x| 1.13x|
| 66% | 1.00x| 1.28x| 1.13x| 1.13x|
| 75% | 1.00x| 1.09x| 0.98x| 0.96x|
| 80% | 1.00x| 1.06x| 0.96x| 0.96x|
| 90% | 1.00x| 1.26x| 1.00x| 1.04x|
| 95% | 1.00x| 1.32x| 0.87x| 0.92x|
| 98% | 1.00x| 1.25x| 1.00x| 1.00x|
|100% | 1.00x| 1.37x| 0.99x| 1.02x|

While 50 and 60 %ile are still worse than no-JIT trunk, 75, 80, 90, 95,
98 and 100% are not slower than that.

So now it's a little harder to say "MJIT slows down Rails applications".
Probably I can close [Bug #14490] now. Let's start improving it.

Close https://github.com/ruby/ruby/pull/1921

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-28 16:14:56 +00:00
k0kubun 297ae3437e mjit.c: clean up unit link from iseq
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-27 22:27:04 +00:00
k0kubun ceab460fca mjit.c: keep all .o files
and lazily delete them on termination.

This will be needed to create a large so file later.
The large number of .o files will be probably compacted before the large so
file is created.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-27 09:27:58 +00:00
k0kubun e09bf11f6e mjit.c: use NOT_COMPILED_JIT_ISEQ_FUNC for unloaded
units, renaming it from NOT_COMPILABLE_JIT_ISEQ_FUNC.

NOT_READY_JIT_ISEQ_FUNC is for ones being compiled, so
mjit_get_iseq_func treats it specially and it shouldn't be used for the
purpose.

I renamed it instead of adding a new one because I'm not sure about the
impact for the performance by increasing the switch branches in mjit_exec.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-27 08:51:56 +00:00
k0kubun 0d753d4f29 mjit.c: release memory for unloaded unit
`xfree(unit)` was missing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-27 08:24:10 +00:00
k0kubun 4aa952f678 mjit.c: clarify the intention of setting 0
which was originally NULL before r62221

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-27 06:01:46 +00:00
k0kubun 781c3ca574 mjit.c: o -> so is not compilation
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-26 13:05:47 +00:00
nobu 05316c40ac fork() is deprecated on Solaris
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-26 09:32:42 +00:00
k0kubun 218aa03c0f mjit.c: split build stages for unix
I'm going to build a large .so file that combines multiple .o files.
For that change, I want to confirm the impact to performance by this
change. So far, I haven't seen the significant change on the max
performance.

* before
$ for i in 1 2 3 4 5 6 7 8 9 1 2; do ruby --jit ../../mame/optcarrot/bin/optcarrot --benchmark ../../mame/optcarrot/examples/Lan_Master.nes; done
fps: 67.66058054621772
checksum: 59662
fps: 67.53138656233348
checksum: 59662
fps: 67.44109425628592
checksum: 59662
fps: 70.29423063961576
checksum: 59662
fps: 72.0147653358158
checksum: 59662
fps: 69.40157398157892
checksum: 59662
fps: 72.3984212467565
checksum: 59662
fps: 67.15473484463604
checksum: 59662
fps: 70.14142014098444
checksum: 59662
fps: 72.51761974327023
checksum: 59662
fps: 72.41086970333218
checksum: 59662

* after
$ for i in 1 2 3 4 5 6 7 8 9 1 2; do ruby --jit ../../mame/optcarrot/bin/optcarrot --benchmark ../../mame/optcarrot/examples/Lan_Master.nes; done
fps: 69.53134628999938
checksum: 59662
fps: 66.13157649232654
checksum: 59662
fps: 70.17474368971281
checksum: 59662
fps: 61.88316323809907
checksum: 59662
fps: 72.48731307319704
checksum: 59662
fps: 65.1180687907147
checksum: 59662
fps: 68.89553415996615
checksum: 59662
fps: 65.77342314036225
checksum: 59662
fps: 64.33337015048106
checksum: 59662
fps: 64.98152672793444
checksum: 59662
fps: 72.225729092625
checksum: 59662

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-25 14:36:08 +00:00
k0kubun 40bb70c7eb mjit.c: completely separate compile_c_to_so
by whether on mswin or not.

This is needed because I'm going to renew the compilation process for
unix, keeping mswin builds as it is, at first.

This commit is not changing the behavior at all.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-25 13:54:00 +00:00
k0kubun f10582d8e7 mjit.c: prevent memory leak on realloc failure
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-25 12:33:38 +00:00
k0kubun cd2eaf2a33 mjit.c: handle memory allocation failure
which was missing in r64033.

Prior to r64033, memory allocation failure had been checked by
TRY_WITH_GC and handled by rb_memerror. But calling rb_memerror on MJIT
worker is problematic since it does EC_JUMP_TAG in the end. Threads
except Ruby's main thread must not use it.

mjit_compile.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24 15:40:05 +00:00
k0kubun 83c9263b85 mjit.c: prevent GC on MJIT worker
mjit_compile.c: ditto.

REALLOC_N, ALLOC_N and xmalloc trigger GC but it's not expected.
Other allocation calls in mjit.c are executed on Ruby's main thread and
thus fine.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24 14:36:10 +00:00
normal c93adfc170 mjit: get rid of memory leak in pause+resume loop
pthread_atfork is not idempotent and repeatedly calling it
causes it to register the same hook repeatedly; leading to
unbound memory growth.

Ruby already has a (confusing-named) internal API for to call
in the forked child process: rb_thread_atfork
Call the MJIT child_after_fork hook inside that to prevent
unbound growth with the following loop:

    loop do
      RubyVM::MJIT.pause
      RubyVM::MJIT.resume
    end

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-08 07:27:24 +00:00
normal 79f01d3972 mjit.c: fix waitpid macro return value for win32
We started checking return value of waitpid, so it needs
to be correct for win32 platforms for MJIT to work.

Thanks-to: MSP-Greg (Greg L) <Greg.mpls@gmail.com>

[ruby-core:87832] [Bug #14867]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-06 06:50:04 +00:00