summaryrefslogtreecommitdiff
path: root/test/ruby/test_yjit.rb
AgeCommit message (Collapse)Author
2021-10-27YJIT: Support newhash with values (#5029)John Hawthorn
* YJIT: Implement newhash with values * YJIT: Add test of duphash * Fix compilation on macos/clang Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2021-10-25Strip out YJIT at build time when unsupported or disabled (#5003)Alan Wu
In an effort to minimize build issues on non x64 platforms, we can decide at build time to not build the bulk of YJIT. This should fix obscure build errors like this one on riscv64: yjit_asm.c:137:(.text+0x3fa): relocation truncated to fit: R_RISCV_PCREL_HI20 against `alloc_exec_mem' We also don't need to bulid YJIT on `--disable-jit-support` builds. One wrinkle to this is that the YJIT Ruby module will not be defined when YJIT is stripped from the build. I think that's a fair change as it's only meant to be used for YJIT development. Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2021-10-20Improve YJIT command line option parsingAlan Wu
Previously, options such as "--yjit123" would enable YJIT. Additionally, the error message for argument parsing mentioned "--jit-..." instead of "--yjit-...".
2021-10-20Show +YJIT in version string and RUBY_DESCRIPTIONAlan Wu
There might be code out there that expect `ruby -v` to print only one line. Since MJIT shows +JIT in `ruby -v` and RUBY_DESCRIPTION, let's show +YJIT. The crash report doesn't show anything about MJIT, so adjust the test. The "test_ruby_version" test was unaware of RUBY_YJIT_ENABLE and so was failing when the variable is set and inherited into the children processes it spawns. Explicitly unset the variable in the test.
2021-10-20Implement getclassvariable in yjiteileencodes
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-10-20Add a slowpath for opt_getinlinecacheAlan Wu
Before this change, when we encounter a constant cache that is specific to a lexical scope, we unconditionally exit. This change falls back to the interpreter's cache in this situation. This should help constant expressions in `class << self`, which is popular at Shopify due to the style guide. This change relies on the cache being warm while compiling to detect the need for checking the lexical scope for simplicity.
2021-10-20Fix excessive invalidation for opt_getinlinecacheAlan Wu
YJIT expects the VM to invalidate opt_getinlinecache when updating the constant cache, and the invalidation used to happen even when YJIT can't use the cached value. Once the first invalidation happens, the block for opt_getinlinecache becomes a stub. When the stub is hit, YJIT fails to compile the instruction as the cache is not usable. The stub becomes a block that exits for opt_getinlinecache which can be invalidated again. Some workloads that bust the interpreter's constant cache can create an invalidation loop with this behavior. Check if the cache is usable become doing invalidation to fix this problem. In the test harness, evaluate the test script in a lambda instead of a proc so `return` doesn't return out of the harness.
2021-10-20Implement invokebuiltinJohn Hawthorn
2021-10-20Add test for setlocalJohn Hawthorn
2021-10-20Specialize based on types of opt_asetJohn Hawthorn
2021-10-20Add tests against side exits for non-fixnumJohn Hawthorn
2021-10-20Implement getspecialJohn Hawthorn
2021-10-20Add tests against opt_eq side exitsJohn Hawthorn
2021-10-20Exit when the object is frozenAaron Patterson
Exit when the object is frozen, also add tests
2021-10-20Allow calling variadic cfuncs with many argsJohn Hawthorn
We have a check to ensure we don't have to push args on the stack to call a cfunc with many args. However we never need to use the stack for variadic cfuncs, so we shouldn't care about the number of arguments.
2021-10-20Allow special case of expandarray with nilJohn Hawthorn
2021-10-20Implement newrangeJohn Hawthorn
2021-10-20Implement invokesuper using cfp->ep[ME] checkJohn Hawthorn
This fixes and re-enables invokesuper, replacing the existing guards with a guard on the method entry for the EP.
2021-10-20Avoid immediate side exits in checktypeJohn Hawthorn
Previously checktype only supported heap objects, however it's not uncommon to receive an immediate, for example when string interpolating a Symbol or Integer.
2021-10-20Add toregexp to yjiteileencodes
The FIXME is there so we remember to investigate why insns clears the temporary array. Is this necessary? If it's not we can remove it from both. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-10-20Implement putspecialobjectJohn Hawthorn
2021-10-20Add opt_regexpmatch2John Hawthorn
2021-10-20Implement tostring instruction for yjiteileencodes
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-10-20Add regression test of invalid mapping mergeJohn Hawthorn
This should have referenced MAX_TEMP_TYPES, not MAX_LOCAL_TYPES.
2021-10-20Add setglobal to yjiteileencodes
Adds yjit support for setting global variables. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Co-authored-by: John Hawthorn <john@hawthorn.email>
2021-10-20Fix and uncomment getlocal testJohn Hawthorn
Previously, under the scraper, this would side-exit because it was returning to a C method. Now that we use the jit_func entrypoint, this test no longer side-exits.
2021-10-20Add flag so we can easily tell if all stats avail. Comment out broken test.Maxime Chevalier-Boisvert
2021-10-20Allow asserts on results, rather than stdoutJohn Hawthorn
2021-10-20Add assert_no_exits aliasJohn Hawthorn
2021-10-20more testingJohn Hawthorn
2021-10-20Add test for recursionJohn Hawthorn
2021-10-20Add test of yjit compilationJohn Hawthorn