summaryrefslogtreecommitdiff
path: root/yjit_iface.c
AgeCommit message (Collapse)Author
2021-10-20Convert yjit static stat variables to countersNoah Gibbs
2021-10-20Add tests, comments, and an assert for invokesuperAlan Wu
2021-10-20Add a macro for tweaking default call thresholdAlan Wu
For use in development for writing `test.rb` and running with `make run`.
2021-10-20Try running with more YJIT options in CI to surface more bugsMaxime Chevalier-Boisvert
2021-10-20Add graphviz outputAaron Patterson
This adds a method to blocks to get outgoing ids, then uses the outgoing ids to generate a graphviz graph. Two methods were added to the Block object. One method returns an id for the block, which is just the address of the underlying block. The other method returns a list of outgoing block ids. We can use Block#id in conjunction with Block#outgoing_ids to construct a graph of blocks
2021-10-20Warn rather than raise when --yjit-stats is ignoredJean Boussier
2021-10-20If --yjit-stats is given without RUBY_DEBUG, that should be an error.Noah Gibbs
2021-10-20Allow to enable `--yjit-stats` via a env variableJean Boussier
2021-10-20Use builtin_inline_p to avoid pushing a frame for primitive C methods (#63)Maxime Chevalier-Boisvert
* Use builtin_inline_p to skip a frame of C methods * Fix bugs in primitive cfunc call code * Remove if (push_frame) {} * Remove if (push_frame) {} * Push Aaron's fix to avoid hardcoding insn lengths Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2021-10-20Increase default YJIT call threshold to 10. Add exec mem size arg. (#52)Maxime Chevalier-Boisvert
2021-10-20Implement send with blocksAlan Wu
* Implement send with blocks Not that much extra work compared to `opt_send_without_block`. Moved the stack over flow check because it could've exited after changes are made to cfp. * rename oswb counters * Might as well implement sending block to cfuncs * Disable sending blocks to cfuncs for now * Reconstruct interpreter sp before calling into cfuncs In case the callee cfunc calls a method or delegates to a block. This also has the side benefit of letting call sites that sometimes are iseq calls and sometimes cfunc call share the same successor. * only sync with interpreter sp when passing a block Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Co-authored-by: Aaron Patterson <aaron.patterson@shopify.com>
2021-10-20Print top-20 common exit reasons instead of just top-10 (#19)Maxime Chevalier-Boisvert
2021-10-20Try to alloc executable memory within rel32 range on Linux machines (#12)Maxime Chevalier-Boisvert
* Use INT32_MIN, INT32_MAX, etc. constants in yjit_asm.c * Print warning on stderr when code past rel32 jump range * Fix preprocessor snafu * Move rel32 warning into --yjit-stats * Try to allocate within rel32 offset on Linux machines * Update yjit_asm.c Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> * On Linux, use sysconf to get the page size Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2021-10-20Implement greedy versioning. Refactor versioning logic. (#10)Maxime Chevalier-Boisvert
* Implement eager versioning. Refactor versioning logic. * Add --version-limit and --greedy-versioning command-line args
2021-10-20cYjitCodeComment is only defined if we're not in debugging modeAaron Patterson
This commit fixes a build error. If we build in release mode (IOW *without* RUBY_DEBUG), then this constant isn't defined. Release mode builds are required by yjit-bench
2021-10-20Malloc branch entries (#112)Maxime Chevalier-Boisvert
* Malloc branch entries * Add ASM comment for stack overflow check * WIP * Fix branch GC code. Add rb_darray_remove_unordered(). * Fix block end_pos after branch rewriting. Remove dst_patched bits.
2021-10-20YJIT: Fancier opt_getinlinecacheAlan Wu
Make sure `opt_getinlinecache` is in a block all on its own, and invalidate it from the interpreter when `opt_setinlinecache`. It will recompile with a filled cache the second time around. This lets YJIT runs well when the IC for constant is cold.
2021-10-20Compute percentage of exits for top-10 exit opsMaxime Chevalier-Boisvert
2021-10-20Fix two stats bugs, refactor stats code, add total_insn_count printMaxime Chevalier-Boisvert
2021-10-20YJIT: add comments to disassemblyAlan Wu
Introduce a new macro `ADD_COMMENT(cb, comment)` that records a comment for the current write position in the code block. Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Co-authored-by: Aaron Patterson <aaron.patterson@shopify.com>
2021-10-20Update yjit_iface.cMaxime Chevalier-Boisvert
2021-10-20YJIT: make ratio_in_yjit more accurateAlan Wu
Don't count instructions that take exit to the interpreter.
2021-10-20Collect statistics about binding allocations / local variable setAaron Patterson
This commit collects statistics about how many binding objects are allocated as well as the number of local variables set on bindings. Statistics are output along with other YJIT stats. Here is an example of the output: ``` ***YJIT: Printing runtime counters from yjit.rb*** Number of Bindings Allocated: 195 Number of locals modified through binding: 0 opt_send_without_block exit reasons: ivar_get_method 7515891 (40.4%) se_cc_klass_differ 3081330 (16.6%) iseq_argc_mismatch 1564578 ( 8.4%) se_receiver_not_heap 1557663 ( 8.4%) ic_empty 1407064 ( 7.6%) optimized_method 995823 ( 5.4%) iseq_not_simple 819413 ( 4.4%) alias_method 706972 ( 3.8%) bmethod 685253 ( 3.7%) callsite_not_simple 225983 ( 1.2%) kw_splat 25999 ( 0.1%) ivar_set_method 902 ( 0.0%) cfunc_toomany_args 394 ( 0.0%) refined_method 42 ( 0.0%) cfunc_ruby_array_varg 29 ( 0.0%) invalid_cme 4 ( 0.0%) leave exit reasons: se_finish_frame 4067107 (100.0%) se_interrupt 24 ( 0.0%) getinstancevariable exit reasons: undef 121177 (100.0%) idx_out_of_range 5 ( 0.0%) opt_aref exit reasons: (all relevant counters are zero) compiled_iseq_count: 3944 main_block_code_size: 1.1 MiB side_block_code_size: 0.6 MiB vm_insns_count: 1137268516 yjit_exec_insns_count: 414015644 ratio_in_yjit: 26.7% avg_len_in_yjit: 7.5 total_exit_count: 55491789 most frequent exit op: opt_send_without_block: 18587628 (33.5%) opt_getinlinecache: 11075822 (20.0%) send: 4949300 (8.9%) leave: 4067131 (7.3%) defined: 3975196 (7.2%) setinstancevariable: 3567315 (6.4%) invokesuper: 2982163 (5.4%) getblockparamproxy: 2168852 (3.9%) opt_nil_p: 2104524 (3.8%) opt_aref: 2013858 (3.6%) ``` Running RailsBench allocates 195 binding objects but doesn't set any local variables.
2021-10-20Log code size in bytes instead of MiBMaxime Chevalier-Boisvert
2021-10-20Fix improper use of st_foreach_with_replaceAlan Wu
Replacing the key was only okay if the new key hashes to the same thing as the old key. That doesn't hold for YJIT's table when the keys move.
2021-10-20Fix GCC warningsAlan Wu
Mostly unused and uninitialized warnings here and there
2021-10-20Introduce yjit_guard_known_klass()Alan Wu
2021-10-20Polymorphic opt_send_without_blockAlan Wu
2021-10-20Get rid of dependency on rb_call_cacheAlan Wu
2021-10-20YJIT: lazy polymorphic getinstancevariableAlan Wu
Lazily compile out a chain of checks for different known classes and whether `self` embeds its ivars or not. * Remove trailing whitespaces * Get proper addresss in Capstone disassembly * Lowercase address in Capstone disassembly Capstone uses lowercase for jump targets in generated listings. Let's match it. * Use the same successor in getivar guard chains Cuts down on duplication * Address reviews * Fix copypasta error * Add a comment
2021-10-20Add metric for average # of insns spent in yjit before exitingMaxime Chevalier-Boisvert
2021-10-20Include ruby/ruby.h before vm_core.hAlan Wu
This is how vm.c does it, and if we don't follow it in yjit compilation units, rb_vm_t would have a conflicting size.
2021-10-20Check for nullAlan Wu
Sometimes you bop before you init, you know?
2021-10-20Make Blocks depend on BOPSAaron Patterson
When a BOP is redefined, the BOP redefinition callback will invalidate any blocks that depend on BOPS. This allows us to eliminate runtime checks for BOP redefinition.
2021-10-20Yet Another Ruby JIT!Jose Narvaez
Renaming uJIT to YJIT. AKA s/ujit/yjit/g.