summaryrefslogtreecommitdiff
path: root/yjit
AgeCommit message (Collapse)Author
2023-04-13YJIT: Use an enum to represent counters (#7701)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-13YJIT: Move stack_opnd from Context to Assembler (#7700)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-13YJIT: Add a sampling option to exit tracing (#7693)Adam Hess
Add a sampling option to trace exits Running YJIT with trace exits enabled can make very large metrics files. This allows us to configure a sample rate to make tracing exits possible on larger tests. This also updates the documented YJIT options. Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Co-authored-by: John Hawthorn <john@hawthorn.email> Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-12YJIT: Fix missing argc check in known cfuncsJohn Hawthorn
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] Notes: Merged: https://github.com/ruby/ruby/pull/7697
2023-04-12YJIT: Let Assembler own Context (#7691)Takashi Kokubun
* YJIT: Let Assembler own Context * Update a comment Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> --------- Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-04-11YJIT: Fix build on A64Alan Wu
Typo fix for the last commit (1432b37)
2023-04-11YJIT: Fix a compilation warning in x86_64Takashi Kokubun
This is used only for arm64's cb.jmp_ptr_bytes().
2023-04-11YJIT: Reduce paddings if --yjit-exec-mem-size <= 128 on arm64 (#7671)Takashi Kokubun
* YJIT: Reduce paddings if --yjit-exec-mem-size <= 128 on arm64 * YJIT: Define jmp_ptr_bytes on CodeBlock Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-10YJIT: Avoid using a register for unspecified_bits (#7685)Takashi Kokubun
Fix [Bug #19586] Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-04-08Include `--no-llvm-bc` option in `NM` macro only if usableNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7677
2023-04-06YJIT: Stack temp register allocation for arm64 (#7659)Takashi Kokubun
* YJIT: Stack temp register allocation for arm64 * Update a comment Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> * Update comments about assertion * Update a comment Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> --------- Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-06Update VPATH for socket, & dependenciesMatt Valentine-House
The socket extensions rubysocket.h pulls in the "private" include/gc.h, which now depends on vm_core.h. vm_core.h pulls in id.h when tool/update-deps generates the dependencies for the makefiles, it generates the line for id.h to be based on VPATH, which is configured in the extconf.rb for each of the extensions. By default VPATH does not include the actual source directory of the current Ruby so the dependency fails to resolve and linking fails. We need to append the topdir and top_srcdir to VPATH to have the dependancy picked up correctly (and I believe we need both of these to cope with in-tree and out-of-tree builds). I copied this from the approach taken in https://github.com/ruby/ruby/blob/master/ext/objspace/extconf.rb#L3 Notes: Merged: https://github.com/ruby/ruby/pull/7393
2023-04-05YJIT: Add codegen for Integer methods (#7665)Takashi Kokubun
* YJIT: Add codegen for Integer methods * YJIT: Update dependencies * YJIT: Fix Integer#[] for argc=2 Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-04-05YJIT: Count the number of actually written bytes (#7658)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-05YJIT: Smoke test on Rust 1.58.0Alan Wu
Since warnings might show up on older version but not newer ones. Notes: Merged: https://github.com/ruby/ruby/pull/7657
2023-04-05YJIT: Eanble `unsafe_op_in_unsafe_fn` on crate::coreAlan Wu
Encourages commenting about soundness of `unsafe` usages. Notes: Merged: https://github.com/ruby/ruby/pull/7657
2023-04-05Revert "YJIT: Suppress unnecessary `unsafe` block (GH-7634)"Alan Wu
This reverts commit 9e678cdbd054f78576a8f21b3f97cccc395ade22. Without the `unsafe` annotations, the SAFETY comments make less sense. I want to keep the SAFETY comments. Notes: Merged: https://github.com/ruby/ruby/pull/7657
2023-04-04[Feature #19579] Remove !USE_RVARGC code (#7655)Peter Zhu
Remove !USE_RVARGC code [Feature #19579] The Variable Width Allocation feature was turned on by default in Ruby 3.2. Since then, we haven't received bug reports or backports to the non-Variable Width Allocation code paths, so we assume that nobody is using it. We also don't plan on maintaining the non-Variable Width Allocation code, so we are going to remove it. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-04YJIT: add stats for ratio of versions per block (#7653)Maxime Chevalier-Boisvert
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-04-04Remove an unused counterTakashi Kokubun
I ended up not using it.
2023-04-04Resurrect yjit-smoke-test before #7651Takashi Kokubun
2023-04-04YJIT: Stack temp register allocation (#7651)Takashi Kokubun
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-04-03YJIT: Add codegen for Array#<< (#7645)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-04-01Remove an unneeded function copyTakashi Kokubun
2023-04-01Remove unused VM_CALL_BLOCKISEQ flagTakashi Kokubun
2023-03-31YJIT: Remove unused variable [ci skip]Alan Wu
2023-03-31YJIT: Suppress unnecessary `unsafe` block (#7634)Nobuyoshi Nakada
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-30YJIT: Test more kw and rest cases and change exit nameJimmy Miller
Notes: Merged: https://github.com/ruby/ruby/pull/7628
2023-03-30YJIT: Generate side exits as late as possible (#7612)Takashi Kokubun
* YJIT: Generate side exits late as possible * YJIT: s/for_stack_size/with_stack_size/ * YJIT: s/get_counter/exit_counter/ Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-03-29YJIT: Leave cfp->pc uninitialized for VM_FRAME_MAGIC_CFUNCAlan Wu
C function frames don't need to use the VM-specific pc field to run properly. When pushing a control frame from output code, save one instruction by leaving the field uninitialized. Fix-up rb_vm_svar_lep(), which is used while setting local variables via Regexp#=~. Use cfp->iseq as a secondary signal so it can stop assuming that all CFUNC frames always have zero pc's. Notes: Merged: https://github.com/ruby/ruby/pull/7620 Merged-By: XrXr
2023-03-29YJIT: code_gc(): Assert self is inline to avoid other_cb()Alan Wu
The derived `&mut` from `other_cb()` overlapped with the parameter `ocb`. Use `cfg!()` instead of `#[cfg...]` to avoid unused warnings. Notes: Merged: https://github.com/ruby/ruby/pull/7611
2023-03-29YJIT: Take VM lock in RubyVM::YJIT.code_gcAlan Wu
Code GC needs synchronization. Notes: Merged: https://github.com/ruby/ruby/pull/7611
2023-03-29YJIT: Fix overlapping &mut in Assembler::code_gc()Alan Wu
Making overlapping `&mut`s triggers Undefined Bahavior. This function previously had them through `cb` and `ocb` aliasing with `self` or live references in the caller. To fix the overlap, take `ocb` as a parameter and don't use `get_inline_cb()` in the body of the function. Notes: Merged: https://github.com/ruby/ruby/pull/7611
2023-03-29YJIT: Rest and keyword (non-supplying) (#7608)Jimmy Miller
* YJIT: Rest and keyword (non-supplying) * Update yjit/src/codegen.rs --------- Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-28YJIT: Add `--yjit-pause` and `RubyVM::YJIT.resume` (#7609)Maxime Chevalier-Boisvert
* YJIT: Add --yjit-pause and RubyVM::YJIT.resume This allows booting YJIT in a suspended state. We chose to add a new command line option as opposed to simply allowing YJIT.resume to work without any command line option because it allows for combining with YJIT tuning command line options. It also simpifies implementation. Paired with Kokubun and Maxime. * Update yjit.rb Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> --------- Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-28YJIT: Stop using the starting_context pattern (#7610)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-03-24YJIT: Rest and block_arg support (#7584)Jimmy Miller
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-24YJIT: Constify EC to avoid an `as` pointer cast (#7591)Alan Wu
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-23YJIT: Save PC on rb_str_concat (#7586)Takashi Kokubun
[Bug #19483] Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-03-23YJIT: Use starting context for status === CantCompile (#7583)Jimmy Miller
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-23Use shape information in YJIT's definedivar implementation (#7579)Ole Friis Østergaard
* Use shape information in YJIT's definedivar implementation * Handle complex shape for definedivar Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-23`vm_call_single_noarg_inline_builtin`Koichi Sasada
If the iseq only contains `opt_invokebuiltin_delegate_leave` insn and the builtin-function (bf) is inline-able, the caller doesn't need to build a method frame. `vm_call_single_noarg_inline_builtin` is fast path for such cases. Notes: Merged: https://github.com/ruby/ruby/pull/7486
2023-03-21YJIT: Fix large ISeq rejection (#7576)Alan Wu
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> Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-21YJIT: Fix incorrect exit in splat (#7575)Jimmy Miller
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. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-21Revert "YJIT: Rest and block_arg support (#7557)"Peter Zhu
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>' ```
2023-03-20YJIT: Make dev_nodebug closer to dev (#7570)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-03-20YJIT: tag output type as UnknownHeap in `toregexp` (#7562)Maxime Chevalier-Boisvert
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-17YJIT: Simplify using the BITS associated constantAlan Wu
All the integer types have it. Notes: Merged: https://github.com/ruby/ruby/pull/7563
2023-03-17YJIT: make type info more specific in gen_fixnum_cmp and gen_opt_mod (#7555)Maxime Chevalier-Boisvert
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-03-17YJIT: Delete --yjit-global-constant-state (#7559)Alan Wu
It was useful for evaluating 6068da8937d7e4358943f95e7450dae7179a7763 but I think we should remove it now to make the logic around invalidation more straight forward. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>