summaryrefslogtreecommitdiff
path: root/yjit/src/codegen.rs
AgeCommit message (Collapse)Author
2022-08-29Check only symbol flag bits (#6301)Takashi Kokubun
* Check only symbol flag bits * Check all 4 bits Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2022-08-29Remove ir_ssa.rs as we aren't using it and it's now outdatedMaxime Chevalier-Boisvert
Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Add --yjit-dump-disasm to dump every compiled code ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/430) * Add --yjit-dump-disasm to dump every compiled code * Just use get_option * Carve out disasm_from_addr * Avoid push_str with format! * Share the logic through asm.compile * This seems to negatively impact the compilation speed Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Various AArch64 optimizations (https://github.com/Shopify/ruby/pull/433)Kevin Newton
* When we're storing an immediate 0 value at a memory address, we can use STUR XZR, Xd instead of loading 0 into a register and then storing that register. * When we're moving 0 into an argument register, we can use MOV Xd, XZR instead of loading the value into a register first. * In the newarray instruction, we can skip looking at the stack at all if the number of values we're using is 0. Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Fix and re-enable String to_s, << and unary plus ↵Noah Gibbs
(https://github.com/Shopify/ruby/pull/429) Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Use VALUE for callinfos that are on the heap ↵Alan Wu
(https://github.com/Shopify/ruby/pull/420) Yet another case of `jit_mov_gc_ptr()` being yanked out during the transition to the new backend, causing a crash after object movement. The intresting wrinkle with this one is that not all callinfos are GC'ed objects, so the old code had an implicit assumption. https://github.com/ruby/ruby/blob/b0b9f7201acab05c2a3ad92c3043a1f01df3e17f/yjit/src/codegen.rs#L4087-L4095 Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Avoid marking op_type on gen_defined (https://github.com/Shopify/ruby/pull/419)Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Use VALUE for block_iseq (https://github.com/Shopify/ruby/pull/417)Takashi Kokubun
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Fix a bus error on regenerate_branch (https://github.com/Shopify/ruby/pull/408)Takashi Kokubun
* Fix a bus error on regenerate_branch * Fix pad_size Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Only check lowest bit for _Bool type (https://github.com/Shopify/ruby/pull/412)Alan Wu
* Only check lowest bit for _Bool type The `test AL, AL` got lost during porting and we were generating `test RAX, RAX` instead. The upper bits of a `_Bool` return type is unspecified and we were failing `TestClass#test_singleton_class_should_has_own_namespace` due to interpreterting the return value incorrectly. * Enable test_class for test-all on x86_64 Notes: Merged: https://github.com/ruby/ruby/pull/6289
2022-08-29Fix issue with expandarray, add missing jl, enable tests ↵Maxime Chevalier-Boisvert
(https://github.com/Shopify/ruby/pull/409)
2022-08-29Temporarily disable rb_str_concat, add CI tests ↵Maxime Chevalier-Boisvert
(https://github.com/Shopify/ruby/pull/407) Make sure we can load the test-all runner and run test_yjit.rb
2022-08-29Port jit_rb_str_concat to new backend, re-enable cfunc lookup ↵Noah Gibbs (and/or Benchmark CI)
(https://github.com/Shopify/ruby/pull/402)
2022-08-29YJIT: Implement concatarray in yjit (https://github.com/Shopify/ruby/pull/405)Maple Ong
* Create code generation func * Make rb_vm_concat_array available to use in Rust * Map opcode to code gen func * Implement code gen for concatarray * Add test for concatarray * Use new asm backend * Add comment to C func wrapper
2022-08-29Use bindgen for old manual extern declarations ↵Alan Wu
(https://github.com/Shopify/ruby/pull/404) We have a large extern block in cruby.rs leftover from the port. We can use bindgen for it now and reserve the manual declaration for just a handful of vm_insnhelper.c functions. Fixup a few minor discrepencies bindgen found between the C declaration and the manual declaration. Mostly missing `const` on the C side.
2022-08-29Fix bugs in gen_opt_getinlinecacheMaxime Chevalier-Boisvert
2022-08-29Port opt_getinlinecache to the new backend ↵Zack Deveau
(https://github.com/Shopify/ruby/pull/399)
2022-08-29Port opt_aref and opt_aset to the new backend IR ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/387) * Port opt_aref and opt_aset to the new backend IR * Recompute memory operands
2022-08-29Port getblockparamproxy and getblockparam ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/394)
2022-08-29Port invokesuper to the new backend IR ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/391)
2022-08-29Port the remaining method types in opt_send_without_block ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/390)
2022-08-29Update asm comments for gen_send_iseqMaxime Chevalier-Boisvert
2022-08-29Port cfunc lookup, plus simpler cfunc generators. ↵Noah Gibbs
(https://github.com/Shopify/ruby/pull/388) This port does *not* create invalidation regions to ensure minimum invalidatable block sizes, and so it does not port the to_s generator.
2022-08-29Prefer asm.store over asm.mov (https://github.com/Shopify/ruby/pull/385)Takashi Kokubun
* Prefer asm.store over asm.mov * Reverse a couple of unsure changes * Revert changes that don't work
2022-08-29Port expandarray to the new backend IR ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/376) * Port expandarray to the new backend IR * More use of into() * Break out live ranges * Refactor the code further * Reuse registers more
2022-08-29Port gen_send_iseq to the new backend IR ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/381) * Port gen_send_iseq to the new backend IR * Replace occurrences of 8 by SIZEOF_VALUE Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
2022-08-29Port invokebuiltin* insns to the new backend IR ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/375) * Port invokebuiltin* insns to the new backend IR * Fix the C_ARG_OPNDS check boundary
2022-08-29More concise csel with IntoAlan Wu
2022-08-29Port send to the new backend and test it ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/373)
2022-08-29Port opt_eq and opt_neq to the new backend ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/371) * Port opt_eq and opt_neq to the new backend * Just use into() outside Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> * Use C_RET_OPND to share the register * Revert "Use C_RET_OPND to share the register" This reverts commit 99381765d0008ff0f03ea97c6c8db608a2298e2b. Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2022-08-29Port objtostring to the new backend (https://github.com/Shopify/ruby/pull/369)Takashi Kokubun
2022-08-29Port opt_str_uminus to new backend IR ↵Zack Deveau
(https://github.com/Shopify/ruby/pull/370)
2022-08-29Port gen_opt_str_freeze to new backend IR ↵Zack Deveau
(https://github.com/Shopify/ruby/pull/366)
2022-08-29Port setivar to the new backend IR (https://github.com/Shopify/ruby/pull/362)Takashi Kokubun
* Port setivar to the new backend IR * Add a few more setivar test cases * Prefer const_ptr Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2022-08-29Port opt_minus, opt_or, and opt_and to the new IR ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/364) * Port opt_minus, opt_or, and opt_and to the new IR * Fix the Op::Or issue with push_insn * Prefer asm.store for clarity
2022-08-29Port opt_mod to the new backend IR (https://github.com/Shopify/ruby/pull/363)Takashi Kokubun
2022-08-29Fix to float guard in jit_guard_known_klass to use the correct output ↵Noah Gibbs
operand. (https://github.com/Shopify/ruby/pull/365)
2022-08-29Port send-only insns and write tests (https://github.com/Shopify/ruby/pull/360)Takashi Kokubun
2022-08-29Opnd::Value fixes (https://github.com/Shopify/ruby/pull/354)Alan Wu
* Fix asm.load(VALUE) - `<VALUE as impl Into<Opnd>>` didn't track that the value is a value - `Iterator::map` doesn't evaluate the closure you give it until you call `collect`. Use a for loop instead so we put the gc offsets into the compiled block properly. * x64: Mov(mem, VALUE) should load the value first Tripped in codegen for putobject now that we are actually feeding `Opnd::Value` into the backend. * x64 split: Canonicallize VALUE loads * Update yjit/src/backend/x86_64/mod.rs
2022-08-29Port gen_send_cfunc to the new backend ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/357) * Port gen_send_cfunc to the new backend * Remove an obsoleted test * Add more cfunc tests * Use csel_e instead and more into() Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> * Add a missing lea for build_kwargs * Split cfunc test cases Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2022-08-29Convert getinstancevariable to new backend IR ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/352) * Convert getinstancevariable to new backend IR * Support mem-based mem * Use more into() * Add tests for getivar * Just load obj_opnd to a register * Apply another into() * Flip the nil-out condition * Fix duplicated counts of side_exit
2022-08-29Remove empty linesMaxime Chevalier-Boisvert
2022-08-29Port gen_concatstring to new backend IR ↵Zack Deveau
(https://github.com/Shopify/ruby/pull/350) * Port gen_concatstring to new backend IR * Update yjit/src/codegen.rs Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2022-08-29Port anytostring, intern, and toregexp ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/348) * Port anytostring, intern, and toregexp * Port getspecial to the new backend (#349) PR: https://github.com/Shopify/ruby/pull/349
2022-08-29Port only ATTRSET of opt_send_without_block ↵Takashi Kokubun
(https://github.com/Shopify/ruby/pull/351)
2022-08-29Port class variable instructions (https://github.com/Shopify/ruby/pull/346)Takashi Kokubun
2022-08-29Port setglobal to the new backend (https://github.com/Shopify/ruby/pull/347)Takashi Kokubun
2022-08-29Minor cleanups (https://github.com/Shopify/ruby/pull/345)Alan Wu
* Move allocation into Assembler::pos_marker We wanted to do this to begin with but didn't because we were confused about the lifetime parameter. It's actually talking about the lifetime of the references that the closure captures. Since all of our usages capture no references (they use `move`), it's fine to put a `+ 'static` here. * Use optional token syntax for calling convention macro * Explicitly request C ABI on ARM It looks like the Rust calling convention for functions are the same as the C ABI for now and it's unlikely to change, but it's easy for us to be explicit here. I also tried saying `extern "aapcs"` but that unfortunately doesn't work.
2022-08-29Port gen_checktype to the new IR assembler backend ↵Zack Deveau
(https://github.com/Shopify/ruby/pull/343)
2022-08-29Port the YJIT defined opcode; fix C_ARG_REGS ↵Noah Gibbs
(https://github.com/Shopify/ruby/pull/342)