Skip to content

Commit 30c76f4

Browse files
author
Maxime Chevalier-Boisvert
authored
Update yjit.md
Update citation, fix outdated and inaccurate information.
1 parent 9350c2b commit 30c76f4

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

doc/yjit/yjit.md

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,24 @@ If you wish to learn more about the approach taken, here are some conference tal
2929
- ECOOP 2015 talk: [Simple and Effective Type Check Removal through Lazy Basic Block Versioning](https://www.youtube.com/watch?v=S-aHBuoiYE0)
3030
- ECOOP 2015 paper: [Simple and Effective Type Check Removal through Lazy Basic Block Versioning](https://arxiv.org/pdf/1411.0352.pdf)
3131

32-
To cite this repository in your publications, please use this bibtex snippet:
33-
34-
```
35-
@misc{yjit_ruby_jit,
36-
author = {Chevalier-Boisvert, Maxime and Wu, Alan and Patterson, Aaron},
37-
title = {YJIT - Yet Another Ruby JIT},
38-
year = {2021},
39-
publisher = {GitHub},
40-
journal = {GitHub repository},
41-
howpublished = {\url{https://github.com/Shopify/yjit}},
32+
To cite YJIT in your publications, please cite the VMIL 2021 paper:
33+
34+
```
35+
@inproceedings{yjit_vmil2021,
36+
author = {Chevalier-Boisvert, Maxime and Gibbs, Noah and Boussier, Jean and Wu, Si Xing (Alan) and Patterson, Aaron and Newton, Kevin and Hawthorn, John},
37+
title = {YJIT: A Basic Block Versioning JIT Compiler for CRuby},
38+
year = {2021},
39+
isbn = {9781450391092},
40+
publisher = {Association for Computing Machinery},
41+
address = {New York, NY, USA},
42+
url = {https://doi.org/10.1145/3486606.3486781},
43+
doi = {10.1145/3486606.3486781},
44+
booktitle = {Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages},
45+
pages = {25–32},
46+
numpages = {8},
47+
keywords = {ruby, dynamically typed, compiler, optimization, just-in-time, bytecode},
48+
location = {Chicago, IL, USA},
49+
series = {VMIL 2021}
4250
}
4351
```
4452

@@ -146,10 +154,10 @@ The machine code generated for a given method can be printed by adding `puts Rub
146154
YJIT supports all command-line options supported by upstream CRuby, but also adds a few YJIT-specific options:
147155

148156
- `--yjit`: enable YJIT (disabled by default)
149-
- `--yjit-call-threshold=N`: number of calls after which YJIT begins to compile a function (default 10)
150-
- `--yjit-exec-mem-size=N`: size of the executable memory block to allocate, in MiB (default 256 MiB)
151-
- `--yjit-stats`: produce statistics after the execution of a program (must compile with `cppflags=-DRUBY_DEBUG` to use this)
152-
- `--yjit-trace-exits`: produce a Marshal dump of backtraces from specific exits. Automatically enables `--yjit-stats` (must compile with `cppflags=-DRUBY_DEBUG` to use this)
157+
- `--yjit-call-threshold=N`: number of calls after which YJIT begins to compile a function (default 30)
158+
- `--yjit-exec-mem-size=N`: size of the executable memory block to allocate, in MiB (default 128 MiB)
159+
- `--yjit-stats`: produce statistics after the execution of a program
160+
- `--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)
153161
- `--yjit-max-versions=N`: maximum number of versions to generate per basic block (default 4)
154162
- `--yjit-greedy-versioning`: greedy versioning mode (disabled by default, may increase code size)
155163

@@ -175,19 +183,7 @@ This section contains tips on writing Ruby code that will run as fast as possibl
175183
- CRuby method calls are costly. Favor larger methods over smaller methods.
176184
- Try to write code so that the same variables always have the same type
177185

178-
You can also compile YJIT in debug mode and use the `--yjit-stats` command-line option to see which bytecodes cause YJIT to exit, and refactor your code to avoid using these instructions in the hottest methods of your code.
179-
180-
### Memory Statistics
181-
182-
YJIT, including in production configuration, keeps track of the size of generated code. If you check `YJIT.runtime_stats` you can see them:
183-
184-
```
185-
$ RUBYOPT="--yjit" irb
186-
irb(main):001:0> RubyVM::YJIT.runtime_stats
187-
=> {:inline_code_size=>331945, :outlined_code_size=>272980}
188-
```
189-
190-
These are the size in bytes of generated inlined code and generated outlined code. If the combined sizes for generated code are very close to the total YJIT exec-mem-size (see above), YJIT will stop generating code once the limit is reached. Try to make sure you have enough exec-mem-size for the program you're running. By default YJIT will allocate 268,435,456 bytes (256 MiB) of space for generated inlined and outlined code.
186+
You can also use the `--yjit-stats` command-line option to see which bytecodes cause YJIT to exit, and refactor your code to avoid using these instructions in the hottest methods of your code.
191187

192188
### Other Statistics
193189

0 commit comments

Comments
 (0)