summaryrefslogtreecommitdiff
path: root/yjit/src
AgeCommit message (Collapse)Author
2023-02-20YJIT: Fix assertion for partially mapped last pages (#7337)Takashi Kokubun
Follows up [Bug #19400] Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-02-17YJIT: Consolidate jit methods in JITState impl (#7336)Jimmy Miller
These jit_* methods don't jit code, but instead check things on the JITState. We had other methods that did the same thing that were just added on the impl JITState. For consistency I added these methods there. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-17YJIT: Use rb_ivar_get at the end of ivar chains (#7334)Takashi Kokubun
* YJIT: Use rb_ivar_get at the end of ivar chains * Rename the counter to get_ivar_max_depth Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-02-17Add asm comment to YJIT's rb_str_empty_pMaxime Chevalier-Boisvert
2023-02-16YJIT: Fix false assumption that String#+@ => ::StringAlan Wu
Could return a subclass. [Bug #19444] Notes: Merged: https://github.com/ruby/ruby/pull/7328
2023-02-16YJIT: jit_prepare_routine_call() for String#+@ missingAlan Wu
We saw SEGVs due to this when running with StackProf, which needs a correct PC for RUBY_INTERNAL_EVENT_NEWOBJ, the same event used for ObjectSpace allocation tracing. [Bug #19444] Notes: Merged: https://github.com/ruby/ruby/pull/7328
2023-02-16YJIT: Show Context stats on exit (#7327)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-02-16YJIT: Refactor getlocal and setlocal insns (#7320)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-16YJIT: Initial support for rest args (#7311)Jimmy Miller
* YJIT: Initial support for rest args * Update yjit/src/codegen.rs --------- Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-16Move `attached_object` into `rb_classext_struct`Jean Boussier
Given that signleton classes don't have an allocator, we can re-use these bytes to store the attached object in `rb_classext_struct` without making it larger. Notes: Merged: https://github.com/ruby/ruby/pull/7309
2023-02-15YJIT: `Kernel#{is_a?,instance_of?}` fast paths (GH-7297)Jimmy Miller
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Notes: Merged: https://github.com/ruby/ruby/pull/7297 Merged-By: XrXr
2023-02-15Encapsulate RCLASS_ATTACHED_OBJECTJean Boussier
Right now the attached object is stored as an instance variable and all the call sites that either get or set it have to know how it's stored. It's preferable to hide this implementation detail behind accessors so that it is easier to change how it's stored. Notes: Merged: https://github.com/ruby/ruby/pull/7308
2023-02-14YJIT: Optimize != for Integers and Strings (#7301)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-14YJIT: Check correct BOP on gen_fixnum_cmp (#7303)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-02-14YJIT: Don't side-exit on too-complex shapes (#7298)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-13YJIT: Fix a typo in a counter nameTakashi Kokubun
I added `invokeblock_iseq_arg0_args_splat` counter but it wasn't used because of a typo. Related to https://github.com/ruby/ruby/pull/7234
2023-02-10YJIT: add counters for polymorphic send and send with known class (#7288)Maxime Chevalier-Boisvert
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-10use correct svar even if env is escapedKoichi Sasada
This patch is follo-up of 0a82bfe. Without this patch, if env is escaped (Proc'ed), strange svar can be touched. This patch tracks escaped env and use it. Notes: Merged: https://github.com/ruby/ruby/pull/7282
2023-02-09YJIT: optimized codegen for `rb_ary_empty_p` (WIP) (#7242)Maxime Chevalier-Boisvert
* YJIT: add specialized implementation of rb_ary_empty_p() * Update yjit/src/codegen.rs Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> --------- Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-09YJIT: Support invokesuper in a block (#7264)Maple Ong
Support invokesuper in a block on YJIT invokesuper previously side exited when it is in a block. To make sure we're compiling the correct method in super, we now use the local environment pointer (LEP) to get the method, which will work in a block. Co-authored-by: John Hawthorn <john@hawthorn.email> Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-09YJIT: Add counter for megamorphic send (#7274)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-09YJIT: Use the system page size when the code page size is too small (#7267)Alan Wu
Previously on ARM64 Linux systems that use 64 KiB pages (`CONFIG_ARM64_64K_PAGES=y`), YJIT was panicking on boot due to a failed assertion. The assertion was making sure that code GC can free the last code page that YJIT manages without freeing unrelated memory. YJIT prefers picking 16 KiB as the granularity at which to free code memory, but when the system can only free at 64 KiB granularity, that is not possible. The fix is to use the system page size as the code page size when the system page size is 64 KiB. Continue to use 16 KiB as the code page size on common systems that use 16/4 KiB pages. Add asserts to code_gc() and free_page() about code GC's assumptions. Fixes [Bug #19400] Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-09Merge gc.h and internal/gc.hMatt Valentine-House
[Feature #19425] Notes: Merged: https://github.com/ruby/ruby/pull/7273
2023-02-09YJIT: Add counters for ivar exits (#7266)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-06YJIT: Support arg0 splat on invokeblock (#7234)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-06YJIT: Check interrupts on frame pop (#7248)Takashi Kokubun
YJIT: Skip gen_check_ints on ISEQ send On the interpreter, vm_push_frame doesn't check interrupts. Only vm_pop_frame does. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-03YJIT: Make Block::start_addr non-optionalAlan Wu
We set the block address as soon as we make the block, so there is no point in making it `Option<CodePtr>`. No memory saving, unfortunately, as `mem::size_of::<Block>() = 176` before and after this change. Still a simplification for the logic, though. Notes: Merged: https://github.com/ruby/ruby/pull/7243
2023-02-03YJIT: Support ifunc on invokeblock (#7233)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-02YJIT: log the names of methods we call to in disasm (#7231)Maxime Chevalier-Boisvert
* YJIT: log the names of methods we call to in disasm * Assert that pointer is not null * Handle case where UTF8 conversion not possible Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-02-02Fix typos in YJIT [ci skip]Alan Wu
2023-02-02YJIT: Crash with rb_bug() when panickingAlan Wu
Helps with getting good bug reports in the wild. Intended to be backported to the 3.2.x series. Notes: Merged: https://github.com/ruby/ruby/pull/7232
2023-02-02YJIT: ARM64: Fix long jumps to labelsAlan Wu
Previously, with Code GC, YJIT panicked while trying to emit a B.cond instruction with an offset that is not encodable in 19 bits. This only happens when the code in an assembler instance straddles two pages. To fix this, when we detect that a jump to a label can land on a different page, we switch to a fresh new page and regenerate all the code in the assembler there. We still assume that no one assembler has so much code that it wouldn't fit inside a fresh new page. [Bug #19385] Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> Notes: Merged: https://github.com/ruby/ruby/pull/7227
2023-02-02YJIT: ARM64: Move functions out of arm64_emit()Alan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/7227
2023-02-02YJIT: other_cb is None in testsAlan Wu
Since the other cb is in CodegenGlobals, and we want Rust tests to be self-contained. Notes: Merged: https://github.com/ruby/ruby/pull/7227
2023-02-02YJIT: Move CodegenGlobals::freed_pages into an RcAlan Wu
This allows for supplying a freed_pages vec in Rust tests. We need it so we can test scenarios that occur after code GC. Notes: Merged: https://github.com/ruby/ruby/pull/7227
2023-02-01use correct svar (#7225)Koichi Sasada
* use correct svar Without this patch, svar location is used "nearest Ruby frame". It is almost correct but it doesn't correct when the `each` method is written in Ruby. ```ruby class C include Enumerable def each %w(bar baz).each{|e| yield e} end end C.new.grep(/(b.)/){|e| p [$1, e]} ``` This patch fix this issue by traversing ifunc's cfp. Note that if cfp doesn't specify this Thread's cfp stack, reserved svar location (`ec->root_svar`) is used. * make yjit-bindgen --------- Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-02-01Remove whitespaceMaxime Chevalier-Boisvert
2023-01-31YJIT: Handle splat with opt more fully (#7209)Jimmy Miller
* YJIT: Handle splat with opt more fully * Update yjit/src/codegen.rs --------- Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-01-31YJIT: Fix BorrowMutError on BOP invalidation (#7212)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-01-31YJIT: Group unimplemented method types togetherAlan Wu
Grouping these together helps with finding all of the unimplemented method types. It was interleaved with some other match arm long and short previously. Notes: Merged: https://github.com/ruby/ruby/pull/7210
2023-01-31YJIT: Implement codegen for Kernel#block_given? (#7202)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-01-30YJIT: Add splat optimized_send (#7167)Jimmy Miller
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-01-30YJIT: Initial implementation of splat with optional params (#7166)Jimmy Miller
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-01-30YJIT: Fix BorrowMutError on GC.compact (#7176)Takashi Kokubun
YJIT: Fix BorrowMutError Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-01-30YJIT: Skip defer_compilation for fixnums if possible (#7168)Takashi Kokubun
* YJIT: Skip defer_compilation for fixnums if possible * YJIT: It should be Some(false) * YJIT: Define two_fixnums_on_stack on Context Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-01-30YJIT: Inline return address callback (#7198)Alan Wu
This makes it so that the generator and the output code read in the same order. I think it reads better this way. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-01-20YJIT: Avoid BorrowError on GC.compact (#7164)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-01-20YJIT: get rid of unneeded `.into()`Jimmy Miller
Notes: Merged: https://github.com/ruby/ruby/pull/7158 Merged-By: XrXr
2023-01-19YJIT: Refactor side_exitsJimmy Miller
Notes: Merged: https://github.com/ruby/ruby/pull/7155
2023-01-19YJIT: Remove duplicated information in BranchTarget (#7151)Takashi Kokubun
Note: On the new code of yjit/src/core.rs:2178, we no longer leave the state `.block=None` but `.address=Some...`, which might be important. We assume it's actually not needed and take a risk here to minimize heap allocations, but in case it turns out to be necessary, we could signal/resurrect that state by introducing a new BranchTarget (or BranchShape) variant dedicated to it. Notes: Merged-By: k0kubun <takashikkbn@gmail.com>