68865 Commits

Author SHA1 Message Date
Maxime Chevalier-Boisvert
fe3bd57007 Remove trailing whitespaces 2021-10-20 18:19:31 -04:00
Alan Wu
cf011b6676 Check for null
Sometimes you bop before you init, you know?
2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
c6156e5113 Fix trailing spaces 2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
4ccfbfe6fa Update yjit.md 2021-10-20 18:19:31 -04:00
Aaron Patterson
c15a577eda Make Blocks depend on BOPS
When a BOP is redefined, the BOP redefinition callback will invalidate
any blocks that depend on BOPS.  This allows us to eliminate runtime
checks for BOP redefinition.
2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
46874b8fb9 Update yjit.md 2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
c56243dab4 Update yjit.md 2021-10-20 18:19:31 -04:00
Jose Narvaez
4e2eb7695e Yet Another Ruby JIT!
Renaming uJIT to YJIT. AKA s/ujit/yjit/g.
2021-10-20 18:19:31 -04:00
Alan Wu
7f7e79d802 YJIT: handle when all counters are zero in printout code
Also filter with not equal to zero instead of greater than zero, in case
there is memory corruption and counters are negative.

Fixes Shopify/ruby#70
2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
eaab6605b7 Update ujit_core.h 2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
0a160407da Update ujit_core.h
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
7f4000b1f4 Machinery to implement deferred compilation 2021-10-20 18:19:31 -04:00
Alan Wu
f8b4082be4 YJIT: fix leak, remove unused field on block_t
This field was never used and is now covered by jit_mov_gc_ptr.
2021-10-20 18:19:31 -04:00
Alan Wu
7de8ce4efc YJIT: Use 2D array to group block versions
For deferred compilation, we sometimes want to care about the order of
the block versions. Use an array instead of a linked list to do that.
2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
d6d58795a9 Rename test files 2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
4a99990b36 Update yjit.md 2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
e4e453c7d0 Update yjit.md 2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
7b38bf189e Update yjit.md 2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
f2b170b01d Update and rename ujit.md to yjit.md 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
abc016ad2c WIP refactor block lists to use darray 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
5c497dfd7f Update ujit.md 2021-10-20 18:19:30 -04:00
Alan Wu
eccf4bcd91 uJIT: support 64 bit operands for TEST. Use it to check for zero
It's one byte shorter than `cmp reg64, 0`. To illustrate:

```
48 83 f9 00        cmp    rcx, 0x0
48 85 c9           test   rcx, rcx
```
2021-10-20 18:19:30 -04:00
Alan Wu
8302eb57b0 Add UJIT.reset_stats!
To allow analyzing sections of the application.
2021-10-20 18:19:30 -04:00
Alan Wu
699bf97493 uJIT: Add exit counters for leave and refactor stats printout code
Filter out counters that are zero and make it easier to have multiple
printout groups.

On `railsbench`:

```
opt_send_without_block exit reasons:
    se_finish_frame     184809 (100.0%)
```
2021-10-20 18:19:30 -04:00
Alan Wu
8a9ee00a31 uJIT: add guards for protected opt_send_without_block calls
These account for about 12% of the time when we were bailing from calls
in railsbench. `ratio_in_ujit` went up 0.1% with this change.
2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
b3b3a8c620 At jit_at_current_insn, jit_peek_at_stack functions 2021-10-20 18:19:30 -04:00
Alan Wu
316f757c44 Runtime counters for bailing from opt_send_without_block
This allows counting things in generated code such as side exits or
different reasons for failing to compile. Runtime counters are exposed
to Ruby as `UJIT.runtime_stats` for ease of reporting and analysis.
2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
2e8db8c35e Update ec->cfp->pc when hitting a stub. 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
824fea684f Thread EC through jit state. Add codegen status enum. 2021-10-20 18:19:30 -04:00
Max Bernstein
f63cdae3a3 Support memory operands to pop 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
831ac473fa Update ujit.md 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
6f437d5b30 Update ujit.md 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
0888d9c9d5 Update ujit.md 2021-10-20 18:19:30 -04:00
Max Bernstein
3a365afaf5 Support memory operands to push 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
799d248e31 Fix jmp encoding. Rename conditional jumps jxx() to jxx_label() 2021-10-20 18:19:30 -04:00
Alan Wu
57977ba30d uJIT: Implement opt_getinlinecache
* ujit: implement opt_getinlinecache

Aggressively bet that writes to constants don't happen and invalidate
all opt_getinlinecache blocks on any and all constant writes.

Use alignment padding on block_t to track this assumption. No change to
sizeof(block_t).

* Fix compile warnings when not RUBY_DEBUG
* Fix reversed condition
* Switch to st_table to keep track of assumptions

Co-authored-by: Aaron Patterson <aaron.patterson@gmail.com>
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
f93f3d6aa1 Implement support for variadic C functions 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
8e5222c887 Update ujit.md 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
028e017e95 Update ujit.md 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
47900e10e3 Update ujit.md 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
6100b52ecf Update ujit.md 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
0d6ed3128a Update ujit_iface.c 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
2a99743056 Update ujit_iface.c 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
0710bec01e Implement --ujit-call-threshold 2021-10-20 18:19:30 -04:00
Alan Wu
58657b33e7 Remove dead code 2021-10-20 18:19:30 -04:00
Alan Wu
9ce2771697 darray: fix strict aliasing issue 2021-10-20 18:19:30 -04:00
Alan Wu
0658ab73ee Use rb_darray_make in ujit 2021-10-20 18:19:30 -04:00
Alan Wu
2240932b64 Add rb_darray_make 2021-10-20 18:19:30 -04:00
Alan Wu
47e05fca10 darray: fix buffer size calculation for element with strict alignment 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
fff6d642b3 Added ujit_save_regs() and ujit_load_regs() helper functions 2021-10-20 18:19:30 -04:00