Takashi Kokubun
9d59d093bd
MJIT: Compile methods in batches ( #6900 )
...
* MJIT: Compile methods in batches
* MJIT: make mjit-bindgen
* MJIT: Fix RubyVM::MJIT tests
2022-12-10 22:21:06 -08:00
Takashi Kokubun
8893913ae6
MJIT: Clarify jit_unit is only for MJIT
2022-12-08 23:43:09 -08:00
Takashi Kokubun
260a00d80e
MJIT: Refactor JIT failure handling
2022-12-08 23:08:34 -08:00
Takashi Kokubun
4885aa9a7c
MJIT: Add comments about custom hooks [ci skip]
2022-12-08 23:06:27 -08:00
Takashi Kokubun
0dc5c117a5
MJIT: Convert compact_p flag to an enum
...
I'm gonna add another type of unit shortly.
2022-12-08 22:53:58 -08:00
Takashi Kokubun
bfc225764e
MJIT: Drop an obsoleted explanation [ci skip]
...
There's no MJIT worker thread anymore
2022-12-08 22:40:56 -08:00
Takashi Kokubun
33aa06e3e6
Use a ruby-lang alias [ci skip]
2022-12-08 22:40:56 -08:00
Takashi Kokubun
ec184077bc
MJIT: Remove obsoleted conditional variables
2022-12-08 21:42:15 -08:00
Takashi Kokubun
2cea8e014d
MJIT: Mark MJIT's objects from mjit_mark
...
It looks like the current way of marking objects was breaking
eightbitraptor's upcoming VWA changes and this seems to fix it.
2022-12-08 10:31:56 -08:00
Takashi Kokubun
09bc3abd2e
MJIT: Deal with a TODO with assertion
2022-12-07 21:20:05 -08:00
Takashi Kokubun
65545c6608
MJIT: Fix an assertion broken with --mjit-wait enabled
2022-12-06 23:46:16 -08:00
Takashi Kokubun
17d45feeb6
MJIT: Refactor mjit_wait
2022-12-06 23:21:19 -08:00
Takashi Kokubun
57cb4a8179
MJIT: Remove obsoleted MJIT counters
2022-12-06 23:05:00 -08:00
Takashi Kokubun
12916e283f
MJIT: Use xfree for units
...
now that we use ZALLOC_N for allocating units
2022-12-06 23:00:22 -08:00
Takashi Kokubun
718e4f6efc
MJIT: Explain why we have MJIT_CFLAGS_PIPE [ci skip]
2022-12-06 22:59:06 -08:00
Takashi Kokubun
98c41dfe6f
MJIT: Just use ZALLOC_N in create_unit
...
We no longer use an MJIT worker thread, so there's no need to avoid GC.
2022-12-06 22:40:08 -08:00
Takashi Kokubun
7e20704000
MJIT: Remove an unused argument and unused counters
...
I plan to rebuild MJIT metrics later, not using debug counters.
2022-12-06 22:19:26 -08:00
Takashi Kokubun
e6b63b382c
MJIT: Refactor the jit_func enum for MJIT
...
All values should have a MJIT_ prefix. We could address the warning for
the end mark if we just define the macro for the check next to the enum.
It even simplifies some code for checking the enum.
2022-12-06 21:36:58 -08:00
Takashi Kokubun
7a2b1364ef
MJIT: Merge mjit_unit.h into mjit_c.h
...
The distinction doesn't make much difference today.
2022-11-29 21:34:46 -08:00
Takashi Kokubun
ecc15bc94a
MJIT: Rename mjit_compiler.c to mjit_c.c
...
It's no longer about the compiler logic itself.
2022-11-29 21:26:59 -08:00
Takashi Kokubun
44165df121
MJIT: Cache an ISeq pointer instance
...
to obviate one rb_funcall. This also removes rb_ptr as refactoring.
2022-11-28 23:53:33 -08:00
Takashi Kokubun
9c13fc614c
MJIT: Make it parsable by Solargraph ( #6827 )
...
* Revert "Revert "MJIT: Make it parsable by Solargraph""
This reverts commit 8e18761da1
.
* Call rb_gc_register_mark_object
2022-11-28 21:33:55 -08:00
Takashi Kokubun
8e18761da1
Revert "MJIT: Make it parsable by Solargraph"
...
This reverts commit ccd8dd6ad3
.
Revert "MJIT: Fix miniruby with MJIT_FORCE_ENABLE"
This reverts commit b033775ed9
.
GitHub Actions is failing. I ran out of time today to investigate it.
will try it again tomorrow.
2022-11-28 00:13:23 -08:00
Takashi Kokubun
ccd8dd6ad3
MJIT: Make it parsable by Solargraph
2022-11-27 23:46:59 -08:00
Takashi Kokubun
1d1200555f
MJIT: Avoid hanging on mjit_wait with a JIT failure
2022-11-27 23:06:29 -08:00
Takashi Kokubun
2a6dfb1cbb
Synchronously run the MJIT compiler in the parent
...
process. Completely isolating the MJIT compilation process complicates a
lot of things for ensuring consistency before and after the fork.
Just running this synchronously makes things a lot easier, for example
the race condition of capture_cc_entries could be fixed by this patch
alone. Hopefully, the bottleneck is the C compiler and not this Ruby
code. Also, this change doesn't negatively impact MJIT's final numbers
on yjit-bench while "1st itr" is degraded for sure.
2022-11-27 14:16:29 -08:00
Takashi Kokubun
ac4d00df82
MJIT: Change default --mjit-max-cache back to 100
...
These days we benchmark MJIT using yjit-bench. The warmup duration in
yjit-bench is very short, so compiling many methods comes at a cost even
while it's actually optimal for MJIT to compile everything / tens of
thousands of methods once it reaches the peak performance.
yjit-bench doesn't necessarily represent the peak performance on production.
It measures the performance of Ruby 30~60s after boot. If your JIT takes
more than 1 minute to warm up, there's no way for the JIT to make the numbers
good on yjit-bench.
Until we make MJIT's compilation much faster, we don't afford compiling
10,000 methods on yjit-bench.
This change alone makes MJIT's benchmark number on railsbench 2x better :p
2022-11-25 15:55:19 -08:00
Nobuyoshi Nakada
1a47521c44
Use `rb_sprintf` instead of deprecated `sprintf`
2022-11-25 08:51:14 +09:00
Takashi Kokubun
d15d1c01c2
Rename --mjit-min-calls to --mjit-call-threshold ( #6731 )
...
for consistency with YJIT
2022-11-14 23:38:52 -08:00
Takashi Kokubun
e377875cff
s/mjit_func_t/jit_func_t/
2022-11-13 14:41:08 -08:00
Takashi Kokubun
e7166c9bb7
Allow passing a Rust closure to rb_iseq_callback ( #6575 )
2022-10-18 09:07:11 -07:00
Takashi Kokubun
e7c71c6c92
Make mjit_cont sharable with YJIT ( #6556 )
...
* Make mjit_cont sharable with YJIT
* Update dependencies
* Update YJIT binding
2022-10-17 09:27:59 -07:00
Samuel Williams
22af2e9084
Rework vm_core to use `int first_lineno` struct member.
2022-09-26 00:41:16 +13:00
Takashi Kokubun
cac0dcfbff
Fix typo
...
I meant the other one. Otherwise this option doesn't make sense.
2022-09-07 14:26:58 +09:00
Takashi Kokubun
496bdf01e2
Adjust pch_status for --mjit=pause
...
to let mjit_add_iseq_to_process work
2022-09-06 22:14:01 -07:00
Takashi Kokubun
f0661bf3a0
Skip early mjit_add_iseq_to_process on --mjit=pause
2022-09-06 18:40:23 -07:00
Takashi Kokubun
f24c65ea7e
Skip calling check_unit_queue with mjit_opts.custom
...
fixing the behavior of b726c06e7e
2022-09-06 18:25:46 -07:00
Takashi Kokubun
b726c06e7e
Allow hooking a different method after --mjit=pause
...
The interface is similar to RubyVM::ISeq.translate; it's used if defined.
Same as --mjit=pause, this is an undocumented feature for MJIT experiments.
2022-09-06 15:52:02 +09:00
Takashi Kokubun
341b40bd0c
Cache RubyVM::MJIT constants
...
for performance
2022-09-06 15:50:14 +09:00
Takashi Kokubun
5b3bd91fcb
Add an option to lazily boot MJIT for experiments
...
You may use `RUBYOPT=--mjit=pause irb` to play with RubyVM::MJIT::C,
control the boot timing of MJIT, or customize the implementation while
paused. It's an undocumented feature for such experiments.
2022-09-06 15:45:10 +09:00
Takashi Kokubun
f6925fab85
Do not fork the process on --mjit-wait
...
fork is for parallel compilation, but --mjit-wait cancels it.
It's more useful to not fork it for binding.irb, debugging, etc.
2022-09-06 15:42:02 +09:00
Takashi Kokubun
63ed61e322
Deal with MJIT_FORCE_ENABLE miniruby
...
http://ci.rvm.jp/results/trunk-mjit@phosphorus-docker/4225469
2022-09-05 08:39:37 -07:00
Takashi Kokubun
3767c6a90d
Ruby MJIT ( #6028 )
2022-09-04 21:53:46 -07:00
Takashi Kokubun
f6d569b7c0
Call appropriate hooks on MJIT's fork
...
This takes care of signal_self_pipe and other things.
2022-09-04 18:22:25 -07:00
Takashi Kokubun
cfa40e225a
Prefer stdbool for MJIT options
...
same motivation as d6f21b308b
2022-09-03 20:01:51 -07:00
Nobuyoshi Nakada
f6d4d73abd
Use `rb_fork` to suppress deprecated-declarations warnings
2022-08-21 14:04:52 +09:00
Takashi Kokubun
ddf96b7693
Drop mswin support of MJIT ( #6265 )
...
The current MJIT relies on SIGCHLD and fork(2) to be performant, and
it's something mswin can't offer. You could run Linux MJIT on WSL
instead.
[Misc #18968 ]
2022-08-20 18:35:36 -07:00
Takashi Kokubun
dc8d70e461
Execute MJIT in a forked Ruby process ( #6264 )
...
[Misc #18968 ]
2022-08-20 16:33:03 -07:00
Yuta Saito
00f411c58a
Add `-bundle_loader` to mjit compilation args on macOS
2022-08-04 16:29:22 +09:00
Nobuyoshi Nakada
f42230ff22
Adjust styles [ci skip]
2022-07-27 18:42:27 +09:00