summaryrefslogtreecommitdiff
path: root/yjit/src
AgeCommit message (Collapse)Author
2022-08-29Fix bug with LeaLabel on x86, add CI testMaxime Chevalier-Boisvert
2022-08-29Fix comment typoMaxime Chevalier-Boisvert
2022-08-29Port print_str to new backend (https://github.com/Shopify/ruby/pull/318)Kevin Newton
* ADR and ADRP for AArch64 * Implement Op::Jbe on X86 * Lera instruction * Op::BakeString * LeaPC -> LeaLabel * Port print_str to the new backend * Port print_value to the new backend * Port print_ptr to the new backend * Write null-terminators in Op::BakeString * Fix up rebase issues on print-str port * Add back in panic for X86 backend for unsupported instructions being lowered * Fix target architecture
2022-08-29Port newhash, add tests for newhash, duphashMaxime Chevalier-Boisvert
2022-08-29Add extra assertion in new_label for KevinMaxime Chevalier-Boisvert
2022-08-29Exclude X0 (C_RET_REG) from allocatable registers on arm ↵Maxime Chevalier-Boisvert
(https://github.com/Shopify/ruby/pull/319) * Exclude X0 (C_RET_REG) from allocatable registers on arm * Add another small test snippett
2022-08-29Op::CPushAll and Op::CPopAll (https://github.com/Shopify/ruby/pull/317)Kevin Newton
Instructions for pushing all caller-save registers and the flags so that we can implement dump_insns.
2022-08-29Assert that the # of bytes matches for label refs ↵Kevin Newton
(https://github.com/Shopify/ruby/pull/316)
2022-08-29Encode MRS and MSR for AArch64 (https://github.com/Shopify/ruby/pull/315)Kevin Newton
2022-08-29Fix compile errors on arm on the CI (https://github.com/Shopify/ruby/pull/313)Maxime Chevalier-Boisvert
* Fix compile errors on arm on the CI * Fix typo
2022-08-29Port over putstringMaxime Chevalier-Boisvert
2022-08-29Port over setlocal_wc0Maxime Chevalier-Boisvert
2022-08-29Port gen_getlocal()Maxime Chevalier-Boisvert
2022-08-29Better label refs (https://github.com/Shopify/ruby/pull/310)Kevin Newton
Previously we were using a `Box<dyn FnOnce>` to support patching the code when jumping to labels. We needed to do this because some of the closures that were being used to patch needed to capture local variables (on both X86 and ARM it was the type of condition for the conditional jumps). To get around that, we can instead use const generics since the condition codes are always known at compile-time. This means that the closures go from polymorphic to monomorphic, which means they can be represented as an `fn` instead of a `Box<dyn FnOnce>`, which means they can fall back to a plain function pointer. This simplifies the storage of the `LabelRef` structs and should hopefully be a better default going forward.
2022-08-29Fix jumps (https://github.com/Shopify/ruby/pull/309)Kevin Newton
* Jumps for A64 should be in # of instructions * More splitting for Arm64 https://github.com/Shopify/ruby/pull/309
2022-08-29More Arm64 lowering/backend work (https://github.com/Shopify/ruby/pull/307)Kevin Newton
* More Arm64 lowering/backend work * We now have encoding support for the LDR instruction for loading a PC-relative memory location * You can now call add/adds/sub/subs with signed immediates, which switches appropriately based on sign * We can now load immediates into registers appropriately, attempting to keep the minimal number of instructions: * If it fits into 16 bytes, we use just a single movz. * Else if it can be encoded into a bitmask immediate, we use a single mov. * Otherwise we use a movz, a movk, and then optionally another one or two movks. * Fixed a bunch of code to do with the Op::Load opcode. * We now handle GC-offsets properly for Op::Load by skipping around them with a jump instruction. (This will be made better by constant pools in the future.) * Op::Lea is doing what it's supposed to do now. * Fixed a bug in the backend tests to do with not using the result of an Op::Add. * Fix the remaining tests for Arm64 * Move split loads logic into each backend
2022-08-29Add #[must_use] annotations to asm instructionsMaxime Chevalier-Boisvert
2022-08-29Add a backend test with a load of a GC'd VALUEMaxime Chevalier-Boisvert
2022-08-29Get started on branchunless portMaxime Chevalier-Boisvert
2022-08-29Get codegen for deferred compilation workingMaxime Chevalier-Boisvert
2022-08-29Add test for direct jump to a code pointerMaxime Chevalier-Boisvert
2022-08-29Arm64 progress (https://github.com/Shopify/ruby/pull/304)Kevin Newton
* Get initial wiring up * Split IncrCounter instruction * Breakpoints in Arm64 * Support for ORR * MOV instruction encodings * Implement JmpOpnd and CRet * Add ORN * Add MVN * PUSH, POP, CCALL for Arm64 * Some formatting and implement Op::Not for Arm64 * Consistent constants when working with the Arm64 SP * Allow OR-ing values into the memory buffer * Test lowering Arm64 ADD * Emit unconditional jumps consistently in Arm64 * Begin emitting conditional jumps for A64 * Back out some labelref changes * Remove label API that no longer exists * Use a trait for the label encoders * Encode nop * Add in nops so jumps are the same width no matter what on Arm64 * Op::Jbe for CodePtr * Pass src_addr and dst_addr instead of calculated offset to label refs * Even more jump work for Arm64 * Fix up jumps to use consistent assertions * Handle splitting Add, Sub, and Not insns for Arm64 * More Arm64 splits and various fixes * PR feedback for Arm64 support * Split up jumps and conditional jump logic
2022-08-29LSL, LSR, B.cond (https://github.com/Shopify/ruby/pull/303)Kevin Newton
* LSL and LSR * B.cond * Move A64 files around to make more sense * offset -> byte_offset for bcond
2022-08-29Conscise IR disassembly (https://github.com/Shopify/ruby/pull/302)Alan Wu
The output from `dbg!` was too verbose. For `test_jo` the output went from 37 lines to 5 lines. The added index helps parsing InsnOut indicies. Samples: ``` test backend::tests::test_jo ... [src/backend/ir.rs:589] &self = Assembler 000 Load(Mem64[Reg(3) + 8]) -> Out64(0) 001 Sub(Out64(0), 1_i64) -> Out64(1) 002 Load(Out64(1)) -> Out64(2) 003 Add(Out64(2), Mem64[Reg(3)]) -> Out64(3) 004 Jo() target=CodePtr(CodePtr(0x5)) -> Out64(4) 005 Mov(Mem64[Reg(3)], Out64(3)) -> Out64(5) test backend::tests::test_reuse_reg ... [src/backend/ir.rs:589] &self = Assembler 000 Load(Mem64[Reg(3)]) -> Out64(0) 001 Add(Out64(0), 1_u64) -> Out64(1) 002 Load(Mem64[Reg(3) + 8]) -> Out64(2) 003 Add(Out64(2), 1_u64) -> Out64(3) 004 Add(Out64(1), 1_u64) -> Out64(4) 005 Add(Out64(1), Out64(4)) -> Out64(5) 006 Store(Mem64[Reg(3)], Out64(4)) -> Out64(6) 007 Store(Mem64[Reg(3) + 8], Out64(5)) -> Out64(7) ```
2022-08-29Delete dbg!() callsAlan Wu
2022-08-29Fix backend transform bug, add testMaxime Chevalier-Boisvert
2022-08-29Port over duphash and newarrayMaxime Chevalier-Boisvert
2022-08-29Port over get_branch_target()Maxime Chevalier-Boisvert
2022-08-29Port over setnMaxime Chevalier-Boisvert
2022-08-29Add jo insn and test for joMaxime Chevalier-Boisvert
2022-08-29Port topn, adjuststack, most of opt_plusMaxime Chevalier-Boisvert
2022-08-29Port guard_two_fixnumsMaxime Chevalier-Boisvert
2022-08-29Port gen_full_cfunc_returnMaxime Chevalier-Boisvert
2022-08-29Port getlocal_WC0Maxime Chevalier-Boisvert
2022-08-29Port over gen_putspecialobjectMaxime Chevalier-Boisvert
2022-08-29Port gen_putself, log what can't be compiled in --yjit-dump-insnsMaxime Chevalier-Boisvert
2022-08-29TST, CMP, AND/ANDS with registers (https://github.com/Shopify/ruby/pull/301)Kevin Newton
* Add TST instruction and AND/ANDS entrypoints for immediates * TST/AND/ANDS for registers * CMP instruction
2022-08-29Make sure allocated reg size in bits matches insn out sizeMaxime Chevalier-Boisvert
2022-08-29AND/ANDS for A64 (https://github.com/Shopify/ruby/pull/300)Kevin Newton
2022-08-29Add Opnd.rm_num_bits() methodMaxime Chevalier-Boisvert
2022-08-29Implement X86Reg::sub_reg() methodMaxime Chevalier-Boisvert
2022-08-29Fix small bug in x86_splitMaxime Chevalier-Boisvert
2022-08-29Get rid of temporary context methodsMaxime Chevalier-Boisvert
2022-08-29Add bitwise and to x86 backendMaxime Chevalier-Boisvert
2022-08-29Add stores to one of the testsMaxime Chevalier-Boisvert
2022-08-29Move backend tests to their own fileMaxime Chevalier-Boisvert
2022-08-29Add support for using InsnOut as memory operand baseMaxime Chevalier-Boisvert
2022-08-29Rename transform_insns to forward_passMaxime Chevalier-Boisvert
2022-08-29Add assertMaxime Chevalier-Boisvert
2022-08-29Remove unused code, add backend asm testMaxime Chevalier-Boisvert