Update some out of date information and mention how to check that YJIT is enabled.
This commit is contained in:
Maxime Chevalier-Boisvert 2023-01-31 15:53:40 -05:00 коммит произвёл GitHub
Родитель 9f9dca0c52
Коммит 97740a525e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 9 добавлений и 4 удалений

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

@ -157,8 +157,8 @@ YJIT supports all command-line options supported by upstream CRuby, but also add
- `--yjit`: enable YJIT (disabled by default) - `--yjit`: enable YJIT (disabled by default)
- `--yjit-call-threshold=N`: number of calls after which YJIT begins to compile a function (default 30) - `--yjit-call-threshold=N`: number of calls after which YJIT begins to compile a function (default 30)
- `--yjit-exec-mem-size=N`: size of the executable memory block to allocate, in MiB (default 128 MiB) - `--yjit-exec-mem-size=N`: size of the executable memory block to allocate, in MiB (default 64 MiB)
- `--yjit-stats`: produce statistics after the execution of a program - `--yjit-stats`: produce statistics after the execution of a program (incurs a run-time cost)
- `--yjit-trace-exits`: produce a Marshal dump of backtraces from specific exits. Automatically enables `--yjit-stats` (must configure and build with `--enable-yjit=stats` to use this) - `--yjit-trace-exits`: produce a Marshal dump of backtraces from specific exits. Automatically enables `--yjit-stats` (must configure and build with `--enable-yjit=stats` to use this)
- `--yjit-max-versions=N`: maximum number of versions to generate per basic block (default 4) - `--yjit-max-versions=N`: maximum number of versions to generate per basic block (default 4)
- `--yjit-greedy-versioning`: greedy versioning mode (disabled by default, may increase code size) - `--yjit-greedy-versioning`: greedy versioning mode (disabled by default, may increase code size)
@ -166,6 +166,13 @@ YJIT supports all command-line options supported by upstream CRuby, but also add
Note that there is also an environment variable `RUBY_YJIT_ENABLE` which can be used to enable YJIT. Note that there is also an environment variable `RUBY_YJIT_ENABLE` which can be used to enable YJIT.
This can be useful for some deployment scripts where specifying an extra command-line option to Ruby is not practical. This can be useful for some deployment scripts where specifying an extra command-line option to Ruby is not practical.
You can verify that YJIT is enabled by checking that `ruby -v --yjit` includes the string `+YJIT`:
```sh
ruby -v --yjit
ruby 3.3.0dev (2023-01-31T15:11:10Z master 2a0bf269c9) +YJIT dev [x86_64-darwin22]
```
### Benchmarking ### Benchmarking
We have collected a set of benchmarks and implemented a simple benchmarking harness in the [yjit-bench](https://github.com/Shopify/yjit-bench) repository. This benchmarking harness is designed to disable CPU frequency scaling, set process affinity and disable address space randomization so that the variance between benchmarking runs will be as small as possible. Please kindly note that we are at an early stage in this project. We have collected a set of benchmarks and implemented a simple benchmarking harness in the [yjit-bench](https://github.com/Shopify/yjit-bench) repository. This benchmarking harness is designed to disable CPU frequency scaling, set process affinity and disable address space randomization so that the variance between benchmarking runs will be as small as possible. Please kindly note that we are at an early stage in this project.
@ -245,8 +252,6 @@ The YJIT source code is divided between:
- `yjit/src/options.rs`: handling of command-line options - `yjit/src/options.rs`: handling of command-line options
- `yjit/bindgen/src/main.rs`: C bindings exposed to the Rust codebase through bindgen - `yjit/bindgen/src/main.rs`: C bindings exposed to the Rust codebase through bindgen
- `yjit/src/cruby.rs`: C bindings manually exposed to the Rust codebase - `yjit/src/cruby.rs`: C bindings manually exposed to the Rust codebase
- `misc/test_yjit_asm.sh`: script to compile and run the in-memory assembler tests
- `misc/yjit_asm_tests.c`: tests for the in-memory assembler
The core of CRuby's interpreter logic is found in: The core of CRuby's interpreter logic is found in:
- `insns.def`: defines Ruby's bytecode instructions (gets compiled into `vm.inc`) - `insns.def`: defines Ruby's bytecode instructions (gets compiled into `vm.inc`)