aboutsummaryrefslogtreecommitdiffstats
path: root/yjit
Commit message (Collapse)AuthorAgeFilesLines
* YJIT: Avoid register allocation conflict with a higher stack_idx (#9143)Takashi Kokubun2023-12-061-5/+16
| | | | | YJIT: Avoid register allocation conflict with a higher stack_idx
* YJIT: Assert code pages are not partially in-boundsAlan Wu2023-12-051-0/+4
| | | | Helps understand page switching
* YJIT: Simplify code page switching logic, remove an assertAlan Wu2023-12-051-9/+8
| | | | | | | | | | | | | | We have received a report of `assert!( !cb.has_dropped_bytes())` in set_page() failing. The only explanation for this seems to be memory allocation failing in write_byte(). The if condition implies that `current_write_pos < dst_pos < mem_size`, which rules out failing to encode the relative jump. The has_capacity() assert above not tripping implies that we were in a place in the page where write_byte() did attempt to write the byte and potentially made a syscall in the process. Remove the assert, since memory allocation could fail. Also, return failure if the destination is outside of the code region to detect that out-of-memory situation quicker.
* YJIT: Mark and update stubs in invalidated blocks (#9104)Alan Wu2023-12-041-49/+99
| | | | | Like in the example given in delayed_deallocation(), stubs can be hit even if the block housing it is invalidated. Mark them so we don't work with invalidate ISeqs when hitting these stubs.
* YJIT: Cancel on-stack jit_return on invalidation (#9086)Takashi Kokubun2023-11-301-0/+12
| | | | | | | | | | | * YJIT: Cancel on-stack jit_return on invalidation Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> * Use RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P --------- Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
* YJIT: optimized codegen for `rb_ary_length()` (#9085)Maxime Chevalier-Boisvert2023-11-301-1/+27
| | | YJIT: optimized codegen for rb_ary_length()
* YJIT: Bump ec->cfp after setting cfp->jit_return (#9072)Takashi Kokubun2023-11-302-16/+16
|
* YJIT: edit `yjit.md` and bring it up to date (#9068)Maxime Chevalier-Boisvert2023-11-291-2/+0
| | | Also make various minor edits to improve readability.
* YJIT: fix bug in top cfunc logging in `--yjit-stats` (#9056)Maxime Chevalier-Boisvert2023-11-281-3/+2
| | | | | YJIT: correctly handle case where there are no cfunc calls Fix bug in top cfunc logging in `--yjit-stats`
* YJIT: reduce default exec-mem-size to 64MiB (#9054)Maxime Chevalier-Boisvert2023-11-281-2/+2
|
* YJIT: Assert no patch overlap on pos_marker (#9048)Takashi Kokubun2023-11-287-17/+33
|
* YJIT: add top C function call counts to `--yjit-stats` (#9047)Maxime Chevalier-Boisvert2023-11-272-1/+97
| | | | | * YJIT: gather call counts for individual cfuncs Co-authored by Takashi Kokubun
* YJIT: record `num_send_cfunc` stat (#9022)Maxime Chevalier-Boisvert2023-11-232-3/+5
| | | | | | | | | * YJIT: record num_send_cfunc stat Also report num_send_known_cfunc as percentage of num_send_cfunc * Rename num_send_known_cfunc => num_send_cfunc_inline Name seems more descriptive of what we do with out custom codegen
* YJIT: Apply patches ignoring page_end_reserve (#9015)Takashi Kokubun2023-11-231-6/+7
|
* YJIT: Fix jmp_ptr_bytes on x86_64 (#9016)Takashi Kokubun2023-11-231-1/+1
|
* YJIT: Avoid a register spill on arm64 (#9014)Takashi Kokubun2023-11-221-1/+1
|
* YJIT: Skip dump-disasm if it fails to create a file (#8968)Takashi Kokubun2023-11-211-5/+9
|
* Don't try compacting ivars on Classes that are "too complex"Aaron Patterson2023-11-201-1/+1
| | | | | Too complex classes use a hash table to store ivs, and should always pin their IVs. We shouldn't touch those classes in compaction.
* YJIT: Print a disasm path to stderr (#8967)Takashi Kokubun2023-11-201-1/+1
| | | YJIT: Print a perf map path to stderr
* YJIT: make --yjit-max-versions=N option undocumented (#8962)Maxime Chevalier-Boisvert2023-11-201-2/+1
| | | | Not useful for the vast majority of end users to change this option.
* YJIT: shrink `Context` down to 15 bytes (#8911)Maxime Chevalier-Boisvert2023-11-131-20/+95
| | | | | * WIP context refactoring * Refactor to remove Context.temp_mapping
* YJIT: Fix `clippy::useless_vec` in a testAlan Wu2023-11-101-1/+1
|
* YJIT: Take cargo --fix for unnecessary calls to into()Alan Wu2023-11-102-9/+9
|
* YJIT: Auto fix for clippy::unnecessary_castAlan Wu2023-11-102-3/+3
|
* YJIT: Auto fix for clippy::clone_on_copyAlan Wu2023-11-103-21/+21
|
* YJIT: Panic with more info when global invalidation patching failsAlan Wu2023-11-101-1/+3
|
* YJIT: Invoke PosMarker callbacks only with solid positionsAlan Wu2023-11-103-6/+58
| | | | | | | | | | | | | | | | | | | Previously, PosMarker callbacks ran even when the assembler failed to assemble its contents due to insufficient space. This was problematic because when Assembler::compile() failed, the callbacks were given positions that have no valid code, contrary to general expectation. For example, we use a PosMarker callback to record VM instruction boundaries and patch in jumps to exits in case the guest program starts tracing, however, previously, we could record a location near the end of the code block, where there is no space to patch in jumps. I suspect this is the cause of the recent occurrences of rare random failures on GitHub Actions with the invariants.rs:529 "can rewrite existing code" message. `--yjit-perf` also uses PosMarker and had a similar issue. Buffer the list of callbacks to fire, and only fire them when all code in the assembler are written out successfully. It's more intuitive this way.
* YJIT: Fix comment typos [ci skip]Edwin Garcia2023-11-101-2/+2
|
* YJIT: Disable code GC (#8865)Takashi Kokubun2023-11-082-6/+30
| | | | Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
* Refactor rb_shape_transition_shape_capa outJean Boussier2023-11-083-36/+22
| | | | | | | | | | | | | | | | Right now the `rb_shape_get_next` shape caller need to first check if there is capacity left, and if not call `rb_shape_transition_shape_capa` before it can call `rb_shape_get_next`. And on each of these it needs to checks if we got a TOO_COMPLEX back. All this logic is duplicated in the interpreter, YJIT and RJIT. Instead we can have `rb_shape_get_next` do the capacity transition when needed. The caller can compare the old and new shapes capacity to know if resizing is needed. It also can check for TOO_COMPLEX only once.
* YJIT: Fix assert in OOM scenarioAlan Wu2023-11-071-1/+1
| | | | | | | | | | | We still need to do `jit.record_boundary_patch_point = false` when gen_outlined_exit() returns `None` and we return with `?`. Previously, we tripped the assert at codegen.rs:1042. Found with `--yjit-exec-mem-size=3` on the lobsters benchmark. Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
* YJIT: Use u32 for CodePtr to save 4 bytes eachAlan Wu2023-11-0714-161/+175
| | | | | | | | | | | | | | | | We've long had a size restriction on the code memory region such that a u32 could refer to everything. This commit capitalizes on this restriction by shrinking the size of `CodePtr` to be 4 bytes from 8. To derive a full raw pointer from a `CodePtr`, one needs a base pointer. Both `CodeBlock` and `VirtualMemory` can be used for this purpose. The base pointer is readily available everywhere, except for in the case of the `jit_return` "branch". Generalize lea_label() to lea_jump_target() in the IR to delay deriving the `jit_return` address until `compile()`, when the base pointer is available. On railsbench, this yields roughly a 1% reduction to `yjit_alloc_size` (58,397,765 to 57,742,248).
* YJIT: Inline basic Ruby methods (#8855)Takashi Kokubun2023-11-073-4/+59
| | | | | | | * YJIT: Inline basic Ruby methods * YJIT: Fix "InsnOut operand made it past register allocation" checktype should not generate a useless instruction.
* YJIT: handle out of shape situation in gen_setinstancevariable (#8857)Jean byroot Boussier2023-11-071-1/+5
| | | | | | If the VM ran out of shape, `rb_shape_transition_shape_capa` might return `OBJ_TOO_COMPLEX_SHAPE`. Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
* YJIT: implement two-step call threshold (#8839)Maxime Chevalier-Boisvert2023-11-032-3/+20
| | | | | | | | | | | | | | | | | | | * YJIT: implement two-step call threshold Automatically switch call threshold to a larger value for larger, production-sized apps, while still allowing smaller apps and command-line programs to start with a lower threshold. * Update yjit/src/options.rs Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> * Make the new variables constants * Check that a custom call threshold was not specified --------- Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
* YJIT: Delete some dead code and enable lintsAlan Wu2023-11-032-21/+6
|
* YJIT: Always define method codegen table at boot (#8807)Takashi Kokubun2023-11-022-99/+89
|
* updating bindgenAaron Patterson2023-10-241-0/+11
|
* YJIT: Skip printing stats at exit if --yjit-disable (#8727)Takashi Kokubun2023-10-201-1/+1
|
* YJIT: remove unused `--yjit-greedy-versioning` command-line option (#8713)Maxime Chevalier-Boisvert2023-10-192-15/+1
|
* YJIT: Return Option from asm.compile() for has_dropped_bytes()Alan Wu2023-10-197-176/+175
| | | | | | | | | So that we get a reminder to check CodeBlock::has_dropped_bytes(). Internally, asm.compile() already checks it, and this patch just propagates it out to the caller with a `#[must_use]`. Code GC logic moved out one level in entry_stub_hit(), so the body can freely use `?`
* YJIT: Add RubyVM::YJIT.enable (#8705)Takashi Kokubun2023-10-192-41/+47
|
* YJIT: Enable the dead_code lint and delete some dead codeAlan Wu2023-10-192-82/+6
|
* YJIT: Add a live ISeq counter Alan Wu2023-10-181-0/+6
| | | | | | | It's an estimator for application size and could be used as a compilation heuristic later. Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
* Revert "shape.h: Make attr_index_t uint8_t"Katherine Oelsner2023-10-182-5/+5
| | | | This reverts commit e3afc212ec059525fe4e5387b2a3be920ffe0f0e.
* YJIT: Add --yjit-perf (#8697)Takashi Kokubun2023-10-187-8/+105
| | | Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
* Bump rustix from 0.38.2 to 0.38.19 in /yjit/bindgendependabot[bot]2023-10-181-9/+9
| | | | | | | | | | | | | Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.2 to 0.38.19. - [Release notes](https://github.com/bytecodealliance/rustix/releases) - [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.2...v0.38.19) --- updated-dependencies: - dependency-name: rustix dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
* YJIT: Fix clippy::redundant_localsAlan Wu2023-10-171-3/+1
| | | | | | > note: `#[deny(clippy::redundant_locals)]` on by default On Rust 1.73.0.
* YJIT: Remove call to compile() on empty AssemblerAlan Wu2023-10-171-4/+1
|
* YJIT: Add a few missing counters for send fallback (#8681)Takashi Kokubun2023-10-172-3/+6
|