68822 Commits

Author SHA1 Message Date
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
Maxime Chevalier-Boisvert
1a937dd196 Use darray for incoming branches 2021-10-20 18:19:30 -04:00
Alan Wu
df451752c1 Free your memories! 2021-10-20 18:19:30 -04:00
Alan Wu
b87962eb04 Stop using UJIT.install_entry in btest
CI runs on some platforms uJIT doesn't support. They don't have
UJIT.install_entry. Maybe we want something like `install_entry_if_possible`.
2021-10-20 18:19:30 -04:00
Alan Wu
48b8c5106c Mark and update object references in generated code
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2021-10-20 18:19:30 -04:00
Alan Wu
064e345053 Check for ::Array, not T_ARRAY in opt_aref 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
9d62ab303c Update ujit.md 2021-10-20 18:19:30 -04:00
Maxime Chevalier-Boisvert
7fbbd0c67c Update ujit.md 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
2babfeb858 Update ujit.md 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
701a802a42 Create ujit.md 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
1279236ff8 Fix opt_aref SNAFU 2021-10-20 18:19:29 -04:00
Alan Wu
faabe2b0ad Ujit bug fixes
* uJIT: don't compile tailcalls

* Don't compile calls to protected methods

We need to generate extra code to check whether the call goes through if
we want to support these.

* Fix copy pasta

* Update blockids in branches

* Update dependencies
2021-10-20 18:19:29 -04:00
Alan Wu
15b088bd6e ujit.h instead in the rest of Ruby
ujit_iface.h is meant for uJIT internal use only.
2021-10-20 18:19:29 -04:00
Alan Wu
03af6ad995 Should fix builds without mjit support 2021-10-20 18:19:29 -04:00
Alan Wu
1e573775bf Stop printing when invalidating uJIT blocks 2021-10-20 18:19:29 -04:00
Alan Wu
d3c9e31104 Fix empty struct 2021-10-20 18:19:29 -04:00
Alan Wu
73bcd26354 Fix build on MSVC
Use compiler protable way of delcaring function as maybe unused.
2021-10-20 18:19:29 -04:00
Alan Wu
0ebb072f9f Add regression test for extended table bounds check 2021-10-20 18:19:29 -04:00
Mike Dalessio
980aa329b6 fix: ujit getinstancevariable code checks ivar extended table size
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
ddd1a5ce79 Add op-not-redefined check to opt_aref 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
48736599ac Fix compiled iseq count stat 2021-10-20 18:19:29 -04:00
Alan Wu
c02517bacb Tie lifetime of uJIT blocks to iseqs
* Tie lifetime of uJIT blocks to iseqs

   Blocks weren't being freed when iseqs are collected.

* Add rb_dary. Use it for method dependency table

* Keep track of blocks per iseq

  Remove global version_tbl

* Block version bookkeeping fix

* dary -> darray

* free ujit_blocks

* comment about size of ujit_blocks
2021-10-20 18:19:29 -04:00
Alan Wu
148ab79cd7 oops 2021-10-20 18:19:29 -04:00
Alan Wu
0b8473c4b4 Fix pedantic returning void 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
d192b149ba Added more tests to make btest 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
8ed77f96fc Add another torture test to make btest 2021-10-20 18:19:29 -04:00
Alan Wu
c2f6552af4 Copy right number of bytes in add_incoming 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
e7d20e6616 Free block->incoming in invalidate_block_version() 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
a7c1bc61d2 Add missing VM_CHECK_INTS() for correctness 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
faafe716af Add jit_print_loc() for debugging, based on Alan Wu's snippet 2021-10-20 18:19:29 -04:00
Mike Dalessio
7a75e9bbaf ujit_asm: if mmap() fails with the address hint, try without
valgrind doesn't seem to support the address hint, and so the fallback
to using NULL will allow valgrind to run.
2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
05d36f31ca Fix bug in putobject found by @tenderlove 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
2eac297f9f Optimize gen_dup 2021-10-20 18:19:29 -04:00
Maxime Chevalier-Boisvert
3d026adb61 Add failing test identified by Aaron Patterson 2021-10-20 18:19:28 -04:00
Maxime Chevalier-Boisvert
a267f45502 Remove superfluous instruction in opt_send_without_block 2021-10-20 18:19:28 -04:00
Maxime Chevalier-Boisvert
75b623776b Fix jit_return bug, return address on wrong frame 2021-10-20 18:19:28 -04:00
Maxime Chevalier-Boisvert
c1c5fd5a8d Fix REG_SP writeback bug in gen_exit 2021-10-20 18:19:28 -04:00
Maxime Chevalier-Boisvert
f9e16b0e07 Fix context push/pop in Ruby-to-Ruby calls 2021-10-20 18:19:28 -04:00
Mike Dalessio
69d27e3f97 fix: allow make to complete when DEBUG_RUBY is not set 2021-10-20 18:19:28 -04:00
Mike Dalessio
99d285a75c fix: ensure add_incoming allocates the proper length memory
Without this fix, valgrind reports for zero-length blocks:

==149294== Invalid write of size 4
==149294==    at 0x408121: add_incoming (ujit_core.c:173)
==149294==    by 0x408121: gen_block_version (ujit_core.c:286)
==149294==    by 0x40873C: gen_entry_point (ujit_core.c:303)
==149294==    by 0x3609DF: rb_ujit_compile_iseq (ujit_iface.c:319)
==149294==    by 0x33BD2F: mjit_exec (mjit.h:158)
==149294==    by 0x33BD2F: rb_vm_exec (vm.c:2167)
...
==149294==  Address 0x11278850 is 0 bytes inside a block of size 1 alloc'd
==149294==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==149294==    by 0x40811B: add_incoming (ujit_core.c:171)
==149294==    by 0x40811B: gen_block_version (ujit_core.c:286)
==149294==    by 0x40873C: gen_entry_point (ujit_core.c:303)
==149294==    by 0x3609DF: rb_ujit_compile_iseq (ujit_iface.c:319)
==149294==    by 0x33BD2F: mjit_exec (mjit.h:158)
==149294==    by 0x33BD2F: rb_vm_exec (vm.c:2167)
2021-10-20 18:19:28 -04:00
Maxime Chevalier-Boisvert
a8827e5c5f Added failing test to make btest 2021-10-20 18:19:28 -04:00
Maxime Chevalier-Boisvert
9d8cc01b75 WIP JIT-to-JIT returns 2021-10-20 18:19:28 -04:00
Maxime Chevalier-Boisvert
6341fc21b2 Don't increment instr/exit counters if stats not requested 2021-10-20 18:19:28 -04:00
Maxime Chevalier-Boisvert
21c4dd037d Fix bug unnecessarily causing version limit hit 2021-10-20 18:19:28 -04:00