aboutsummaryrefslogtreecommitdiffstats
path: root/bootstraptest
Commit message (Collapse)AuthorAgeFilesLines
* YJIT: Optional parameter rework and bugfix (#8220)Alan Wu2023-08-151-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | * YJIT: Fix splatting empty array with rest param * YJIT: Rework optional parameter handling to fix corner case The old code had a few unintuitive parts. The starting PC of the callee was set in different places; `num_param`, which one would assume to be static for a particular callee seemingly tallied to different amounts depending on the what the caller passed; `opts_filled_with_splat` was greater than zero even when the opts were not filled by items in the splat array. Functionally, the bits that lets the callee know which keyword parameters are unspecified were not passed properly when there are optional parameters and a rest parameter, and then optional parameters are all filled. Make `num_param` non-mut and use parameter information in the callee iseq as-is. Move local variable nil fill and placing of the rest array out of `gen_push_frame()` as they are only ever relevant for iseq calls. Always place the rest array at `lead_num + opt_num` to fix the previously buggy situation. * YJIT: Compile splat calls to iseqs with rest params Test interactions with optional parameters.
* YJIT: Implement GET_BLOCK_HANDLER() for invokesuper (#8206)Takashi Kokubun2023-08-111-0/+12
|
* YJIT: Compile exception handlers (#8171)Takashi Kokubun2023-08-081-0/+22
| | | Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
* YJIT: handle expandarray_rhs_too_small case (#8161)Maxime Chevalier-Boisvert2023-08-031-0/+11
| | | | | | | | | | | | | | | | | | | | | | | * YJIT: handle expandarray_rhs_too_small case YJIT: fix csel bug in x86 backend, add test Remove commented out lines Refactor expandarray to use chain guards Propagate Type::Nil when known Update yjit/src/codegen.rs Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> * Add missing counter, use get_array_ptr() in expandarray * Make change suggested by Kokubun to reuse loop --------- Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
* Implement `opt_aref_with` instruction (#8118)ywenc2023-07-261-0/+12
| | | | | | | | | | | Implement gen_opt_aref_with Vm opt_aref_with is available Test opt_aref_with Stats for opt_aref_with Co-authored-by: jhawthorn <jhawthorn@github.com>
* Fix a typo [ci skip]Nobuyoshi Nakada2023-07-171-1/+1
|
* Skip a flaky test for RJITTakashi Kokubun2023-07-111-2/+3
|
* YJIT: Break register cycles for C arguments (take 2) (#8018)Takashi Kokubun2023-07-041-0/+8
| | | | | | | * Revert "Revert "YJIT: Break register cycles for C arguments (#7918)"" This reverts commit 78ca085785460de46bfc4851a898d525c1698ef8. * Use shfited_live_ranges for the last-insn check
* YJIT: Fix autosplat miscomp for blocks with optionals (#8006)Alan Wu2023-07-041-0/+10
| | | | | | | | | | | | | | | | | | * YJIT: Fix autosplat miscomp for blocks with optionals When passing an array as the sole argument to `yield`, and the yieldee takes more than 1 optional parameter, the array is expanded similar to `*array` splat calls. This is called "autosplat" in `setup_parameters_complex()`. Previously, YJIT did not detect this autosplat condition. It passed the array without expanding it, deviating from interpreter behavior. Detect this conditon and refuse to compile it. Fixes: Shopify/yjit#313 * RJIT: Fix autosplat miscomp for blocks with optionals This is mirrors the same issue as YJIT. See previous commit.
* RJIT: Fix unspecified_bits with localsTakashi Kokubun2023-04-261-0/+14
|
* Generalize cfunc large array splat fix to fix many additional cases raising ↵Jeremy Evans2023-04-251-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SystemStackError Originally, when 2e7bceb34ea858649e1f975a934ce1894d1f06a6 fixed cfuncs to no longer use the VM stack for large array splats, it was thought to have fully fixed Bug #4040, since the issue was fixed for methods defined in Ruby (iseqs) back in Ruby 2.2. After additional research, I determined that same issue affects almost all types of method calls, not just iseq and cfunc calls. There were two main types of remaining issues, important cases (where large array splat should work) and pedantic cases (where large array splat raised SystemStackError instead of ArgumentError). Important cases: ```ruby define_method(:a){|*a|} a(*1380888.times) def b(*a); end send(:b, *1380888.times) :b.to_proc.call(self, *1380888.times) def d; yield(*1380888.times) end d(&method(:b)) def self.method_missing(*a); end not_a_method(*1380888.times) ``` Pedantic cases: ```ruby def a; end a(*1380888.times) def b(_); end b(*1380888.times) def c(_=nil); end c(*1380888.times) c = Class.new do attr_accessor :a alias b a= end.new c.a(*1380888.times) c.b(*1380888.times) c = Struct.new(:a) do alias b a= end.new c.a(*1380888.times) c.b(*1380888.times) ``` This patch fixes all usage of CALLER_SETUP_ARG with splatting a large number of arguments, and required similar fixes to use a temporary hidden array in three other cases where the VM would use the VM stack for handling a large number of arguments. However, it is possible there may be additional cases where splatting a large number of arguments still causes a SystemStackError. This has a measurable performance impact, as it requires additional checks for a large number of arguments in many additional cases. This change is fairly invasive, as there were many different VM functions that needed to be modified to support this. To avoid too much API change, I modified struct rb_calling_info to add a heap_argv member for storing the array, so I would not have to thread it through many functions. This struct is always stack allocated, which helps ensure sure GC doesn't collect it early. Because of how invasive the changes are, and how rarely large arrays are actually splatted in Ruby code, the existing test/spec suites are not great at testing for correct behavior. To try to find and fix all issues, I tested this in CI with VM_ARGC_STACK_MAX to -1, ensuring that a temporary array is used for all array splat method calls. This was very helpful in finding breaking cases, especially ones involving flagged keyword hashes. Fixes [Bug #4040] Co-authored-by: Jimmy Miller <jimmy.miller@shopify.com>
* Emit special instruction for array literal + .(hash|min|max)Aaron Patterson2023-04-181-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a new instruction `opt_newarray_send` which is used when there is an array literal followed by either the `hash`, `min`, or `max` method. ``` [a, b, c].hash ``` Will emit an `opt_newarray_send` instruction. This instruction falls back to a method call if the "interested" method has been monkey patched. Here are some examples of the instructions generated: ``` $ ./miniruby --dump=insns -e '[@a, @b].max' == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,12)> (catch: FALSE) 0000 getinstancevariable :@a, <is:0> ( 1)[Li] 0003 getinstancevariable :@b, <is:1> 0006 opt_newarray_send 2, :max 0009 leave $ ./miniruby --dump=insns -e '[@a, @b].min' == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,12)> (catch: FALSE) 0000 getinstancevariable :@a, <is:0> ( 1)[Li] 0003 getinstancevariable :@b, <is:1> 0006 opt_newarray_send 2, :min 0009 leave $ ./miniruby --dump=insns -e '[@a, @b].hash' == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)> (catch: FALSE) 0000 getinstancevariable :@a, <is:0> ( 1)[Li] 0003 getinstancevariable :@b, <is:1> 0006 opt_newarray_send 2, :hash 0009 leave ``` [Feature #18897] [ruby-core:109147] Co-authored-by: John Hawthorn <jhawthorn@github.com>
* YJIT: Fixes failure reported by rails for opt+splat+rest (#7727)Jimmy Miller2023-04-171-0/+14
|
* RJIT: Skip a YJIT testAlan Wu2023-04-141-1/+1
| | | | | Despite applying a fix to RJIT similar to the YJIT fix, this test still crashes RJIT.
* YJIT: Fix false object collection when setting ivarAlan Wu2023-04-141-0/+20
| | | | | | | | | | | Previously, setinstancevariable could generate code that calls `rb_ensure_iv_list_size()` without first updating `cfp->sp`. This means in the event that a GC start from within said routine the top few objects would not be marked, causing them to be falsly collected. Call `jit_prepare_routine_call()` first. [Bug #19601]
* YJIT: Add support for rest with option and splat args (#7698)Jimmy Miller2023-04-131-0/+40
|
* YJIT: Fix missing argc check in known cfuncsJohn Hawthorn2023-04-121-0/+32
| | | | | | | | | | | | | | | | | Previously we were missing a compile-time check that the known cfuncs receive the correct number of arguments. We noticied this because in particular when using ARGS_SPLAT, which also wasn't checked, YJIT would crash on code which was otherwise correct (didn't raise exceptions in the VM). This still supports vararg (argc == -1) cfuncs. I added an additional assertion that when we use the specialized codegen for one of these known functions that the argc are popped off the stack correctly, which should help ensure they're implemented correctly (previously the crash was usually observed on a future `leave` insn). [Bug #19595]
* YJIT: Avoid using a register for unspecified_bits (#7685)Takashi Kokubun2023-04-101-0/+19
| | | Fix [Bug #19586]
* YJIT: Add codegen for Integer methods (#7665)Takashi Kokubun2023-04-051-0/+5
| | | | | | | * YJIT: Add codegen for Integer methods * YJIT: Update dependencies * YJIT: Fix Integer#[] for argc=2
* RJIT: Fix arguments for shift_stackTakashi Kokubun2023-04-031-11/+25
|
* YJIT: Test more kw and rest cases and change exit nameJimmy Miller2023-03-301-5/+7
|
* YJIT: Rest and keyword (non-supplying) (#7608)Jimmy Miller2023-03-291-0/+15
| | | | | | | | | * YJIT: Rest and keyword (non-supplying) * Update yjit/src/codegen.rs --------- Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
* YJIT: Rest and block_arg support (#7584)Jimmy Miller2023-03-241-0/+21
|
* YJIT: Use starting context for status === CantCompile (#7583)Jimmy Miller2023-03-231-0/+42
|
* Use shape information in YJIT's definedivar implementation (#7579)Ole Friis Østergaard2023-03-231-0/+47
| | | | | * Use shape information in YJIT's definedivar implementation * Handle complex shape for definedivar
* YJIT: Fix large ISeq rejection (#7576)Alan Wu2023-03-211-0/+13
| | | | | | | | | | | | We crashed in some edge cases due to the recent change to not compile encoded iseqs that are larger than `u16::MAX`. - Match the C signature of rb_yjit_constant_ic_update() and clamp down to `IseqIdx` size - Return failure instead of panicking with `unwrap()` in codegen when the iseq is too large Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> Co-authored-by: Noah Gibbs <noah.gibbs@shopify.com>
* YJIT: Fix incorrect exit in splat (#7575)Jimmy Miller2023-03-211-0/+15
| | | | | | | So by itself, this shouldn't have been a correctness issue, but we also pop the stack for block_args. Doing stack manipulation like that and then side-exiting causes issues. So, while this fixes the immediate failure, we have a bigger issue with block_args popping and then exiting that we need to deal with.
* Revert "YJIT: Rest and block_arg support (#7557)"Peter Zhu2023-03-211-21/+0
| | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5d0a1ffafa61da04dbda38a5cb5565bcb8032a78. This commit is causing sequel in yjit-bench to raise with this stack trace: ``` sequel-5.64.0/lib/sequel/dataset/sql.rb:266:in `literal': wrong argument type Array (expected Proc) (TypeError) from sequel-5.64.0/lib/sequel/database/misc.rb:269:in `literal' from sequel-5.64.0/lib/sequel/adapters/shared/sqlite.rb:314:in `column_definition_default_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:564:in `block in column_definition_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:564:in `each' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:564:in `column_definition_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:634:in `block in column_list_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:634:in `map' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:634:in `column_list_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:753:in `create_table_sql' from sequel-5.64.0/lib/sequel/adapters/shared/sqlite.rb:348:in `create_table_sql' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:702:in `create_table_from_generator' from sequel-5.64.0/lib/sequel/database/schema_methods.rb:203:in `create_table' from benchmarks/sequel/benchmark.rb:19:in `<main>' ```
* Remove a warning in bootstraptest/runner.rbTakashi Kokubun2023-03-191-1/+1
| | | | ../bootstraptest/runner.rb:121: warning: assigned but unused variable - e
* YJIT: Rest and block_arg support (#7557)Jimmy Miller2023-03-171-0/+21
| | | | | | | | | * YJIT: Rest and block_arg support * Update bootstraptest/test_yjit.rb --------- Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
* Skip a flaky test that might not workTakashi Kokubun2023-03-171-1/+1
|
* YJIT: Remove exit for rest and send combo (#7546)Jimmy Miller2023-03-161-0/+8
|
* Fix indirect counter incrementNobuyoshi Nakada2023-03-151-1/+2
| | | | | `*pcnt++` just dereferences `pcnt` then increments the local variable, but has no side effect.
* RJIT: Skip a flaky test_thread test for nowTakashi Kokubun2023-03-102-3/+2
| | | | and unskip a ractor test that was actually running
* YJIT: Handle special case of splat and rest lining up (#7422)Jimmy Miller2023-03-071-0/+22
| | | | | | | | | | | | | | | | If you have a method that takes rest arguments and a splat call that happens to line up perfectly with that rest, you can just dupe the array rather than move anything around. We still have to dupe, because people could have a custom to_a method or something like that which means it is hard to guarantee we have exclusive access to that array. Example: ```ruby def foo(a, b, *rest) end foo(1, 2, *[3, 4]) ```
* s/mjit/rjit/Takashi Kokubun2023-03-062-3/+3
|
* s/MJIT/RJIT/Takashi Kokubun2023-03-063-5/+5
|
* Rename MJIT filenames to RJITTakashi Kokubun2023-03-061-0/+0
|
* Add more GC guardsTakashi Kokubun2023-03-051-1/+1
|
* Deal with too slow testTakashi Kokubun2023-03-051-1/+1
|
* Support SP motion in all insnsTakashi Kokubun2023-03-051-0/+6
|
* Implement initial opt_ltTakashi Kokubun2023-03-051-0/+6
|
* Put nil on an appropriate indexTakashi Kokubun2023-03-051-0/+4
|
* add a test for RactorKoichi Sasada2023-03-061-0/+28
| | | | | Ractor should take care method cache invalidation. Added test will miss method cache on each method call.
* Another attempt to skip test_ractor on ci.rvm.jpTakashi Kokubun2023-03-031-1/+1
| | | | This reverts commit 8d31a60f47fb053bcfe0c744a89bd666dae48539.
* Fix a YJIT enablement checkTakashi Kokubun2023-03-031-1/+1
| | | | | This should be enough for `make test` and `make btest-ruby` while it doesn't work for `make btest`.
* YJIT: fix CI issue reported by Koichi caused by small stack patch (#7442)Maxime Chevalier-Boisvert2023-03-031-0/+27
| | | | | Includes small reproduction produced by Kokubun. http://ci.rvm.jp/results/trunk-yjit@ruby-sp2-docker
* Re-skip an unstable Ractor testTakashi Kokubun2023-03-021-1/+2
| | | | | https://github.com/ruby/ruby/actions/runs/4316423442/jobs/7532190115 http://ci.rvm.jp/results/trunk-yjit@ruby-sp2-docker/4466770
* Revert "Revert "Re-enable test_ractor for YJIT""Takashi Kokubun2023-03-021-5/+3
| | | | | | This reverts commit 9792d9e40f790e6deb18ead56a8befc9d5c4bc51. Ractor implementation has been rewritten. Let's see if it works now.
* YJIT: Fix cfunc splatJimmy Miller2023-03-021-1/+12
| | | Follow-up for cb8a040b7906c09d9d3ac3d3fe853f633005024f.