Граф коммитов

250 Коммитов

Автор SHA1 Сообщение Дата
Alan Wu 4c7afa64b4 Make gen_opt_aref() delegate to gen_opt_send_without_block() (#9)
Basically mirroring the interpreter for the general case.
2021-10-20 18:19:34 -04:00
Alan Wu f1b11fa454 Comment edits 2021-10-20 18:19:34 -04:00
Maxime Chevalier-Boisvert 3e80104024 Aesthetic changes and add missing counter 2021-10-20 18:19:34 -04:00
Alan Wu 8106a95efb English 2021-10-20 18:19:34 -04:00
Alan Wu 10c0275b11 Use jmp with memory operand for smaller code size 2021-10-20 18:19:34 -04:00
Alan Wu 1610dc0864 YJIT: use a context-free landing pad to optimize `leave`
This allows gen_leave to always do an indirect to cfp->jit_return.
2021-10-20 18:19:34 -04:00
Maxime Chevalier-Boisvert 9bd779cbf9 Don't check if value is immediate if context has type info 2021-10-20 18:19:34 -04:00
Maxime Chevalier-Boisvert e66c9f8c62 Remove redundant mov 2021-10-20 18:19:34 -04:00
Maxime Chevalier-Boisvert adbd7ff332 Fix frozen check (use jnz) and move heap object check. 2021-10-20 18:19:34 -04:00
Aaron Patterson 435d7c5088 Improve set instance variable
This commit improves the set ivar implementation.
2021-10-20 18:19:34 -04:00
Maxime Chevalier-Boisvert 60496b6666 Pass self type through method calls 2021-10-20 18:19:34 -04:00
Maxime Chevalier-Boisvert 0cc73ca2a9 Malloc branch entries (#112)
* Malloc branch entries

* Add ASM comment for stack overflow check

* WIP

* Fix branch GC code. Add rb_darray_remove_unordered().

* Fix block end_pos after branch rewriting. Remove dst_patched bits.
2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert 33c975b813 Merge pull request #114 from Shopify/yjit-dup-comments
YJIT: Avoid adding duplicate code comments
2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert 23f88957e6 Switch to 2-comparison heap object check 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert f2530f884e Improve codegen and type tracking in putobject 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert 6250506de2 Remove debug prints 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert edaf12def6 Fix local type tracking in getlocal, setlocal. Add test. 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert 791f20af6e WIP 2021-10-20 18:19:33 -04:00
Alan Wu 476a3f4be7 Use a insn_opnd instead of a bool 2021-10-20 18:19:33 -04:00
Alan Wu 4442029ec4 move assert. opnd.idx doesn't make sense for OPND_SELF 2021-10-20 18:19:33 -04:00
Alan Wu 4ea2e753f6 YJIT: implement calls to ivar getter methods 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert 6164274c76 Re-enable local type tracking, until first call 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert 0805cba735 Update yjit_codegen.c 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert 2404ff691d Factor our guard_two_fixnums(). Implement opt_or. 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert f6e3f75c2b Introduce concept of YJIT instruction operands 2021-10-20 18:19:33 -04:00
Alan Wu b626dd7211 YJIT: Fancier opt_getinlinecache
Make sure `opt_getinlinecache` is in a block all on its own, and
invalidate it from the interpreter when `opt_setinlinecache`.
It will recompile with a filled cache the second time around.
This lets YJIT runs well when the IC for constant is cold.
2021-10-20 18:19:33 -04:00
Alan Wu 515fb988fe YJIT: add comments to disassembly
Introduce a new macro `ADD_COMMENT(cb, comment)` that records a comment
for the current write position in the code block.

Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
Co-authored-by: Aaron Patterson <aaron.patterson@shopify.com>
2021-10-20 18:19:33 -04:00
Alan Wu 7f4b9e8e61 YJIT: make ratio_in_yjit more accurate
Don't count instructions that take exit to the interpreter.
2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert 54312d777c Disable local type tracking for now 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert cbbae12a96 Keep track of local types in the context 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert c299112fd7 use ctx_stack_push_self() 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert aee44e4f2b Part 1 of improved type tracking logic 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert ac1aa84c1a First sketch at temp type mapping 2021-10-20 18:19:32 -04:00
Alan Wu d03b7f77d4 Fix GCC warnings
Mostly unused and uninitialized warnings here and there
2021-10-20 18:19:32 -04:00
Alan Wu 2b09e2fe7b Add a comment 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert fe784d1449 Track interpreter return as an exit reason for leave instr 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert 0e5c3d66b8 Implement opt_gt 2021-10-20 18:19:32 -04:00
Alan Wu 63f875b841 Factor out protected callee guard, check for private callees
We didn't need the private check before because we were lifting from the
interpreter's cache, and the interpreter only caches when visibility
checks go through.
2021-10-20 18:19:32 -04:00
Alan Wu 8173d54020 Factor out jit_jump_to_next_insn 2021-10-20 18:19:32 -04:00
Alan Wu fbb514f67e Introduce yjit_guard_known_klass() 2021-10-20 18:19:32 -04:00
Alan Wu a8f7eb2f35 Polymorphic opt_send_without_block 2021-10-20 18:19:32 -04:00
Alan Wu ec1cbbb07d Get rid of dependency on rb_call_cache 2021-10-20 18:19:32 -04:00
Alan Wu 0cd9120f17 YJIT: hash specialization for opt_aref
Make it lazy and add a hash specialization in addition to the array
specialization.
2021-10-20 18:19:32 -04:00
Alan Wu db53decad6 Exit reason breakdown for opt_aref 2021-10-20 18:19:32 -04:00
Alan Wu c04e5188d5 YJIT: use a flat array for finding codegen functions
Simpler and faster.
2021-10-20 18:19:32 -04:00
Alan Wu 927ead9f75 YJIT: unify exits. Patch iseqs only when necessary
* YJIT: unify exits. Patch iseqs only when necessary

This fixes the gotcha that returning YJIT_CANT_COPMILE for an
instruction at entry position leading to infinite loop.

Also, iseq patching is only done only when necessary, which should make
most exits faster.

* Now that exits are the same, return YJIT_CANT_COMPILE
2021-10-20 18:19:32 -04:00
Alan Wu 5d834bcf9f YJIT: lazy polymorphic getinstancevariable
Lazily compile out a chain of checks for different known classes and
whether `self` embeds its ivars or not.

* Remove trailing whitespaces

* Get proper addresss in Capstone disassembly

* Lowercase address in Capstone disassembly

Capstone uses lowercase for jump targets in generated listings. Let's
match it.

* Use the same successor in getivar guard chains

Cuts down on duplication

* Address reviews

* Fix copypasta error

* Add a comment
2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert c6156e5113 Fix trailing spaces 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
Jose Narvaez 4e2eb7695e Yet Another Ruby JIT!
Renaming uJIT to YJIT. AKA s/ujit/yjit/g.
2021-10-20 18:19:31 -04:00