Commit graph

16449 commits

Author SHA1 Message Date
Kazuki Yamaguchi
79d5abd01b [ruby/openssl] test/openssl/test_pkcs12: fix test failures with OpenSSL 3.0
OpenSSL's PKCS12_create() by default uses pbewithSHAAnd40BitRC2-CBC for
encryption of the certificates. However, in OpenSSL 3.0, the algorithm
is part of the legacy provider and is not enabled by default.

Specify another algorithm that is still in the default provider for
these test cases.

998406d18f
2021-10-23 13:38:38 +09:00
Kazuki Yamaguchi
d26e64e0eb [ruby/openssl] test/openssl/test_ssl: relax regex to match OpenSSL's error message
OpenSSL 3.0 slightly changed the error message for a certificate
verification failure when an untrusted self-signed certificate is found
in the chain.

b5a0a19850
2021-10-23 13:38:38 +09:00
Kazuki Yamaguchi
54047b6d06 [ruby/openssl] test/openssl/test_digest: do not test constants for legacy algorithms
Remove availability test for MD4 and RIPEMD160 as they are considered
legacy and may be missing depending on the compile-time options of
OpenSSL. OpenSSL 3.0 by default disables them.

a3e59f4c2e
2021-10-23 13:38:37 +09:00
Kazuki Yamaguchi
5a8e1c520a [ruby/openssl] test/openssl/test_ssl: assume ECC support
Disabling ECC support of OpenSSL is impractical nowadays.

We still try to have the C extension compile on no-ec builds (as well
as no-dh or no-engine, etc.) as long as we can, but keeping test cases
for such an extreme scenario is not worth the effort.

2cd01d4676
2021-10-23 13:38:37 +09:00
Kazuki Yamaguchi
0e805e73ce [ruby/openssl] test/openssl/test_ssl: assume TLS 1.2 support
Current versions of OpenSSL and LibreSSL all support TLS 1.2, so there
is no need for checking the availability.

a175a41529
2021-10-23 13:38:36 +09:00
Kazuki Yamaguchi
37632a0ac6 [ruby/openssl] test/openssl/utils: remove dup_public helper method
It uses deprecated PKey::{RSA,DSA,DH}#set_* methods, which will not
work with OpenSSL 3.0. The same can easily be achieved using
PKey#public_to_der regardless of the key kind.

7b66eaa2db
2021-10-23 13:38:36 +09:00
Yuki Nishijima
93badf4770 Disable did_you_mean in TestPatternMatching 2021-10-22 21:22:14 -04:00
Yuki Nishijima
905be49bf6 Remove the test for DYM's verbose formatter 2021-10-22 21:14:01 -04:00
Yuki Nishijima
66df18c55e Sync did_you_mean again 2021-10-22 21:00:23 -04:00
Yuki Nishijima
22249bbb37 Revert "Sync did_you_mean"
This reverts commit e22d293e06.
2021-10-22 20:56:26 -04:00
Yuki Nishijima
e22d293e06 Sync did_you_mean 2021-10-22 20:35:40 -04:00
Koichi Sasada
6b9285e8d4 'uri/https' is needed
`URI.parse('https://a.b.c/')` needs 'uri/https'.
2021-10-22 23:56:07 +09:00
Tiago
553f234a07 [ruby/uri] URI#HTTP#origin and URI#HTTP#authority (https://github.com/ruby/uri/pull/30)
bf13946c32

Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
2021-10-22 19:48:36 +09:00
Hiroshi SHIBATA
93691d0752
Import bigdecimal-3.1.0.dev 2021-10-22 15:53:49 +09:00
Shugo Maeda
6606597109
Deprecate include/prepend in refinements and add Refinement#import_methods instead
Refinement#import_methods imports methods from modules.
Unlike Module#include, it copies methods and adds them into the refinement,
so the refinement is activated in the imported methods.

[Bug #17429] [ruby-core:101639]
2021-10-21 16:31:54 +09:00
Koichi Sasada
7185c00fcc freeze (make shareable) script_lines 2021-10-21 16:17:39 +09:00
Koichi Sasada
c7550537f1 RubyVM.keep_script_lines
`RubyVM.keep_script_lines` enables to keep script lines
for each ISeq and AST. This feature is for debugger/REPL
support.

```ruby
RubyVM.keep_script_lines = true
RubyVM::keep_script_lines = true

eval("def foo = nil\ndef bar = nil")
pp RubyVM::InstructionSequence.of(method(:foo)).script_lines
```
2021-10-21 16:17:39 +09:00
Takashi Kokubun
3b16d07e45
Fix test_version again for RUBY_YJIT_ENABLE=1 2021-10-20 22:08:43 -07:00
Takashi Kokubun
66a64e6f16
Fix tests with cppflags=-DYJIT_FORCE_ENABLE
0dbd95c625
2021-10-20 20:52:21 -07:00
Alan Wu
11096da6cc Improve YJIT command line option parsing
Previously, options such as "--yjit123" would enable YJIT. Additionally,
the error message for argument parsing mentioned "--jit-..." instead of
"--yjit-...".
2021-10-20 18:19:43 -04:00
Alan Wu
efed45966b Show +YJIT in version string and RUBY_DESCRIPTION
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-20 18:19:43 -04:00
eileencodes
c8e157bb5c Implement getclassvariable in yjit
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-10-20 18:19:42 -04:00
Alan Wu
78b5e95e41 Add a slowpath for opt_getinlinecache
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-20 18:19:41 -04:00
Alan Wu
c46bda6f19 Fix excessive invalidation for opt_getinlinecache
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-20 18:19:41 -04:00
John Hawthorn
9951a9a8ec Implement invokebuiltin 2021-10-20 18:19:41 -04:00
John Hawthorn
5506f2761f Add test for setlocal 2021-10-20 18:19:41 -04:00
John Hawthorn
ba9d01b3cf Specialize based on types of opt_aset 2021-10-20 18:19:41 -04:00
John Hawthorn
a68e61f089 Add tests against side exits for non-fixnum 2021-10-20 18:19:40 -04:00
Aaron Patterson
554d76afb4 Revert "disable yjit when testing mjit"
This reverts commit e8622ce5c0a09c7213e4d536ddd0ef3ea68377ef.
2021-10-20 18:19:40 -04:00
John Hawthorn
44214e8ad9 Implement getspecial 2021-10-20 18:19:40 -04:00
John Hawthorn
c2b1934475 Add tests against opt_eq side exits 2021-10-20 18:19:40 -04:00
Aaron Patterson
580e1bab18 disable yjit when testing mjit 2021-10-20 18:19:40 -04:00
Aaron Patterson
640b162b51 Exit when the object is frozen
Exit when the object is frozen, also add tests
2021-10-20 18:19:39 -04:00
John Hawthorn
ce02aefabb Allow calling variadic cfuncs with many args
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-20 18:19:39 -04:00
John Hawthorn
fd34c831f6 Allow special case of expandarray with nil 2021-10-20 18:19:39 -04:00
John Hawthorn
c210fade27 Implement newrange 2021-10-20 18:19:39 -04:00
John Hawthorn
3ecc6befcd Implement invokesuper using cfp->ep[ME] check
This fixes and re-enables invokesuper, replacing the existing guards
with a guard on the method entry for the EP.
2021-10-20 18:19:39 -04:00
John Hawthorn
812597676b Avoid immediate side exits in checktype
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-20 18:19:39 -04:00
eileencodes
2ba090a1f9 Add toregexp to yjit
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-20 18:19:39 -04:00
John Hawthorn
e18b0b6eba Implement putspecialobject 2021-10-20 18:19:39 -04:00
John Hawthorn
3edf29668e Add opt_regexpmatch2 2021-10-20 18:19:39 -04:00
eileencodes
d2e8b99b5b Implement tostring instruction for yjit
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-10-20 18:19:38 -04:00
John Hawthorn
786e512178 Add regression test of invalid mapping merge
This should have referenced MAX_TEMP_TYPES, not MAX_LOCAL_TYPES.
2021-10-20 18:19:38 -04:00
eileencodes
b91078ea74 Add setglobal to yjit
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-20 18:19:38 -04:00
John Hawthorn
6aa4637272 Fix and uncomment getlocal test
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-20 18:19:38 -04:00
Maxime Chevalier-Boisvert
1891dcaa9f Add flag so we can easily tell if all stats avail. Comment out broken test. 2021-10-20 18:19:38 -04:00
Aaron Patterson
2a59bd7312 Disable YJIT in MJIT tests 2021-10-20 18:19:38 -04:00
John Hawthorn
adfecd8f4d Allow asserts on results, rather than stdout 2021-10-20 18:19:37 -04:00
John Hawthorn
9c9e23e277 Add assert_no_exits alias 2021-10-20 18:19:37 -04:00
John Hawthorn
4040ca8293 more testing 2021-10-20 18:19:37 -04:00