Update documentation about RJIT

This commit is contained in:
Takashi Kokubun 2023-03-07 23:30:49 -08:00
Родитель e93e780f3d
Коммит 4bf037bebd
3 изменённых файлов: 16 добавлений и 22 удалений

Просмотреть файл

@ -4,17 +4,10 @@ This document has some tips that might be useful when you work on RJIT.
## Supported platforms
The following platforms are either tested on CI or assumed to work.
The following platforms are assumed to work. `linux-x86_64` is tested on CI.
* OS: Linux, macOS
* Arch: x86\_64, aarch64, arm64, i686, i386
### Not supported
The RJIT support for the following platforms is no longer maintained.
* OS: Windows (mswin, MinGW), Solaris
* Arch: SPARC, s390x
* OS: Linux, macOS, BSD
* Arch: x86\_64
## Developing RJIT
@ -25,15 +18,14 @@ If you see an "RJIT bindgen" GitHub Actions failure, please commit the `git diff
For doing the same thing locally, run `make rjit-bindgen` after installing libclang.
macOS seems to have libclang by default. On Ubuntu, you can install it with `apt install libclang1`.
### Always run make install
### --enable-rjit
Always run `make install` before running RJIT. It could easily cause a SEGV if you don't.
RJIT looks for the installed header for security reasons.
On supported platforms, `--enable-rjit` is set by default. You usually don't need to specify this.
You may still manually pass `--enable-rjit` to try RJIT on unsupported platforms.
### --rjit-debug vs --rjit-debug=-ggdb3
### --enable-rjit=dev
`--rjit-debug=[flags]` allows you to specify arbitrary flags while keeping other compiler flags like `-O3`,
which is useful for profiling benchmarks.
`--enable-rjit=dev` makes the interpreter slower, but enables the following two features:
`--rjit-debug` alone, on the other hand, disables `-O3` and adds debug flags.
If you're debugging RJIT, what you need to use is not `--rjit-debug=-ggdb3` but `--rjit-debug`.
* `--rjit-dump-disasm`: Dump all JIT code.
* `--rjit-stats`: Print RJIT stats.

4
rjit.c
Просмотреть файл

@ -225,9 +225,11 @@ rjit_setup_options(const char *s, struct rjit_options *rjit_opt)
#define M(shortopt, longopt, desc) RUBY_OPT_MESSAGE(shortopt, longopt, desc)
const struct ruby_opt_message rjit_option_messages[] = {
#if RJIT_STATS
M("--rjit-stats", "", "Enable collecting RJIT statistics"),
#endif
M("--rjit-call-threshold=num", "", "Number of calls to trigger JIT (default: " STRINGIZE(DEFAULT_CALL_THRESHOLD) ")"),
#if RUBY_DEBUG
#ifdef HAVE_LIBCAPSTONE
M("--rjit-dump-disasm", "", "Dump all JIT code"),
#endif
{0}

6
ruby.c
Просмотреть файл

@ -286,11 +286,11 @@ usage(const char *name, int help, int highlight, int columns)
M("-W[level=2|:category]", "", "set warning level; 0=silence, 1=medium, 2=verbose"),
M("-x[directory]", "", "strip off text before #!ruby line and perhaps cd to directory"),
M("--jit", "", "enable JIT for the platform, same as " PLATFORM_JIT_OPTION),
#if USE_RJIT
M("--rjit", "", "enable C compiler-based JIT compiler (experimental)"),
#endif
#if USE_YJIT
M("--yjit", "", "enable in-process JIT compiler"),
#endif
#if USE_RJIT
M("--rjit", "", "enable pure-Ruby JIT compiler (experimental)"),
#endif
M("-h", "", "show this message, --help for more info"),
};