Граф коммитов

8860 Коммитов

Автор SHA1 Сообщение Дата
Johnny Willemsen 6438f3cad6 [ruby/racc] Removed old originalId in comment
https://github.com/ruby/racc/commit/1dfbef8e99
2022-12-23 09:46:59 +09:00
Kazuki Yamaguchi 2d2baaf2f4 [ruby/openssl] Ruby/OpenSSL 3.1.0
https://github.com/ruby/openssl/commit/c2f7d775c6
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi a778305919 [ruby/openssl] Ruby/OpenSSL 3.0.2
https://github.com/ruby/openssl/commit/48b79333e0
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi 046aadb89b [ruby/openssl] Ruby/OpenSSL 2.2.3
https://github.com/ruby/openssl/commit/04acccd692
2022-12-23 09:39:15 +09:00
Joe Truba 0e11d2c3f8 [ruby/openssl] pkey/ec: check private key validity with OpenSSL 3
The behavior of EVP_PKEY_public_check changed between OpenSSL 1.1.1
and 3.0 so that it no longer validates the private key. Instead, private
keys can be validated through EVP_PKEY_private_check and
EVP_PKEY_pairwise_check.

[ky: simplified condition to use either EVP_PKEY_check() or
EVP_PKEY_public_check().]

https://github.com/ruby/openssl/commit/e38a63ab3d
2022-12-23 09:39:15 +09:00
Yuta Saito 782777a803 [ruby/openssl] Undefine `OpenSSL::SSL` for no socket platforms
This fixes a linkage error about `ossl_ssl_type` on platforms which do
not have socket, like WASI.

Even before this patch, some items are disabled under `OPENSSL_NO_SOCK` since
ee22fad45d
However, due to some new use of OpenSSL::SSL::Socket over the past few years,
the build under `OPENSSL_NO_SOCK` had been broken.

This patch guards whole `OpenSSL::SSL` items by `OPENSSL_NO_SOCK`.

[ky: adjusted to apply on top of my previous commit that removed the
OpenSSL::ExtConfig, and added a guard to lib/openssl/ssl.rb.]

https://github.com/ruby/openssl/commit/b0cfac6a96
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi e6ca644329 [ruby/openssl] ssl: remove OpenSSL::ExtConfig
This module was introduced in 2015 for internal use within this library.
Neither of the two constants in it is used anymore. I don't think we
will be adding a new constant in the foreseeable future, either.

OPENSSL_NO_SOCK is unused since commit https://github.com/ruby/openssl/commit/998d66712a78 (r55191).
HAVE_TLSEXT_HOST_NAME is unused since commit https://github.com/ruby/openssl/commit/4eb4b3297a92.

https://github.com/ruby/openssl/commit/eed3894bda
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi dd6f3276e0 [ruby/openssl] ssl: disable NPN support on LibreSSL
As noted in commit https://github.com/ruby/openssl/commit/a2ed156cc9f1 ("test/test_ssl: do not run NPN tests
for LibreSSL >= 2.6.1", 2017-08-13), NPN is known not to work properly
on LibreSSL.

Disable NPN support on LibreSSL, whether OPENSSL_NO_NEXTPROTONEG is
defined or not.

NPN is less relevant today anyway. Let's also silence test suite when
it's not available.

https://github.com/ruby/openssl/commit/289f6e0e1f
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi d6c16dd3e6 [ruby/openssl] ssl: update TLS1_3_VERSION workaround for older LibreSSL versions
The macro is now defined by default in LibreSSL 3.4+. Let's document it
for future readers.

https://github.com/ruby/openssl/commit/935698e9f9
2022-12-23 09:39:15 +09:00
Nobuyoshi Nakada 6df4d272c3 [ruby/openssl] Suppress deprecation warnings by OpenSSL 3
https://github.com/ruby/openssl/commit/91657a7924
2022-12-23 09:39:15 +09:00
Nobuyoshi Nakada d7d1bb3e87 [ruby/openssl] Constify when building with OpenSSL 3
https://github.com/ruby/openssl/commit/c0023822fe
2022-12-23 09:39:15 +09:00
Nobuyoshi Nakada 2bc7eac822 [ruby/openssl] Check for functions with arguments
https://github.com/ruby/openssl/commit/b67aaf925d
2022-12-23 09:39:14 +09:00
Joe Truba ca7a6b1553 [ruby/openssl] pkey/ec: fix ossl_raise() calls using cEC_POINT instead of eEC_POINT
https://github.com/ruby/openssl/commit/b2e9f5e132
2022-12-23 09:39:14 +09:00
Joe Truba 13137236dc [ruby/openssl] raise when EC_POINT_cmp or EC_GROUP_cmp error instead of returning true
https://github.com/ruby/openssl/commit/e1e8f3cebe
2022-12-23 09:39:14 +09:00
Hiroshi SHIBATA 1998d97908
[ruby/date] Bump version to 3.3.3
https://github.com/ruby/date/commit/ea3644a7c4
2022-12-19 10:50:21 +09:00
Nobuyoshi Nakada c316a5f2f1 [ruby/date] Adjust format [ci skip]
https://github.com/ruby/date/commit/71c35b4054
2022-12-18 03:03:54 +00:00
Nobuyoshi Nakada b8cc0992c6 [ruby/date] Extract `head_match_p` and abbreviated name length constants
https://github.com/ruby/date/commit/3f666fa882
2022-12-18 02:58:51 +00:00
Nobuyoshi Nakada df49bf8150 [ruby/date] Consider the length of string to parse
https://github.com/ruby/date/commit/3bfed83ce7
2022-12-18 02:58:50 +00:00
Nobuyoshi Nakada 49dc424ff3 [ruby/date] Remove `extz_pats` table
https://github.com/ruby/date/commit/945e26e243
2022-12-18 02:58:49 +00:00
Nobuyoshi Nakada 70c905963e [ruby/date] Remove `merid_names` table
https://github.com/ruby/date/commit/7fe2bd5f94
2022-12-18 02:58:48 +00:00
Nobuyoshi Nakada 6efeaabef0 [ruby/date] Match abbreviated day and month names with head of full names
https://github.com/ruby/date/commit/a45f8f03c9
2022-12-18 02:58:47 +00:00
Hiroshi SHIBATA 11f3bef260 [ruby/date] Bump version to 3.3.2
https://github.com/ruby/date/commit/7afd9d4615
2022-12-16 06:36:03 +00:00
Hiroshi SHIBATA d95ee11462 [ruby/io-console] Bump version to 0.6.0
https://github.com/ruby/io-console/commit/441528e3eb
2022-12-16 03:45:11 +00:00
Hiroshi SHIBATA 7e26ff7dc0 [ruby/io-wait] Bump version to 0.3.0
https://github.com/ruby/io-wait/commit/940ba319d3
2022-12-16 02:36:21 +00:00
Jemma Issroff e9ba3042e1 Indicate if a shape is too_complex in ObjectSpace#dump 2022-12-15 13:41:47 -08:00
Jemma Issroff c1ab6ddc9a Transition complex objects to "too complex" shape
When an object becomes "too complex" (in other words it has too many
variations in the shape tree), we transition it to use a "too complex"
shape and use a hash for storing instance variables.

Without this patch, there were rare cases where shape tree growth could
"explode" and cause performance degradation on what would otherwise have
been cached fast paths.

This patch puts a limit on shape tree growth, and gracefully degrades in
the rare case where there could be a factorial growth in the shape tree.

For example:

```ruby
class NG; end

HUGE_NUMBER.times do
  NG.new.instance_variable_set(:"@unique_ivar_#{_1}", 1)
end
```

We consider objects to be "too complex" when the object's class has more
than SHAPE_MAX_VARIATIONS (currently 8) leaf nodes in the shape tree and
the object introduces a new variation (a new leaf node) associated with
that class.

For example, new variations on instances of the following class would be
considered "too complex" because those instances create more than 8
leaves in the shape tree:

```ruby
class Foo; end
9.times { Foo.new.instance_variable_set(":@uniq_#{_1}", 1) }
```

However, the following class is *not* too complex because it only has
one leaf in the shape tree:

```ruby
class Foo
  def initialize
    @a = @b = @c = @d = @e = @f = @g = @h = @i = nil
  end
end
9.times { Foo.new }
``

This case is rare, so we don't expect this change to impact performance
of most applications, but it needs to be handled.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2022-12-15 10:06:04 -08:00
Jemma Issroff a3d552aedd Add variation_count on classes
Count how many "variations" each class creates. A "variation" is a a
unique ordering of instance variables on a particular class. This can
also be thought of as a branch in the shape tree.

For example, the following Foo class will have 2 variations:

```ruby
class Foo ; end

Foo.new.instance_variable_set(:@a, 1) # case 1: creates one variation
Foo.new.instance_variable_set(:@b, 1) # case 2: creates another variation

foo = Foo.new
foo.instance_variable_set(:@a, 1) # does not create a new variation
foo.instance_variable_set(:@b, 1) # does not create a new variation (a continuation of the variation in case 1)
```

We will use this number to limit the amount of shapes that a class can
create and fallback to using a hash iv lookup.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2022-12-15 10:06:04 -08:00
Samuel Williams d20bd06a97
Remove `require 'io/wait'` where it's no longer necessary. (#6932)
* Remove `require 'io/wait'` as it's part of core now.

* Update ruby specs using version gates.

* Add note about why it's conditional.
2022-12-15 11:37:01 +13:00
Nobuyoshi Nakada 71dd8b3caa
socket.rb - simplify check for the method 2022-12-15 00:27:47 +09:00
Jean Boussier 1df6d0e578 objspace_dump.c: don't dump class of T_IMEMO
They don't actually have a class.
2022-12-14 15:53:41 +01:00
Hiroshi SHIBATA bec7deba30 [ruby/date] Fixed wrong minimum version of Ruby
Fixed https://github.com/ruby/date/issues/83

https://github.com/ruby/date/commit/9731a3e732
2022-12-14 07:56:09 +00:00
Hiroshi SHIBATA 9e4d7e99ce [ruby/syslog] Bump version to 0.1.1
https://github.com/ruby/syslog/commit/a92b55b638
2022-12-14 06:18:10 +00:00
Hiroshi SHIBATA 87d32376d9 [ruby/readline-ext] Bump version to 0.1.5
https://github.com/ruby/readline-ext/commit/7af996f24b
2022-12-14 05:54:06 +00:00
MSP-Greg 74995162fc
socket.rb - don't load io/wait (#6922)
See d2166c09b0 and #6036 for more context.
2022-12-14 08:57:38 +13:00
zverok 1859784422 [ruby/date] Implement Date#deconstruct_keys and DateTime#deconstruct_keys
https://github.com/ruby/date/commit/6bb6d3a810
2022-12-13 19:52:06 +00:00
Nobuyoshi Nakada 99d0a257af [ruby/openssl] [DOC] Remove duplicate doc
RDoc does not consider preprocessor conditionals, but equally uses
both documents of `#if` and `#else` sides.

https://github.com/ruby/openssl/commit/ea0a112a0c
2022-12-13 19:55:18 +09:00
Hiroshi SHIBATA 3de7ff8eb9
We should apply https://github.com/ruby/openssl/pull/576 instead of them:
6d8f396f37
  c8b3bd45cc
2022-12-13 18:07:41 +09:00
Henrique Bontempo 2be03fb5b0
[ruby/openssl] Fixes OPENSSL_LIBRARY_VERSION description on
documentation
(https://github.com/ruby/openssl/pull/559)

Adds back missing constant description on the documentation.
2022-12-13 18:07:41 +09:00
Theo Buehler 8ab8c2d601
[ruby/openssl] Enable HKDF support for LibreSSL 3.6 and later
LibreSSL 3.6 added support for HKDF in EVP. Enable this in ossl_kdf.c.

https://github.com/ruby/openssl/commit/9bdd39a7e2
2022-12-13 18:07:41 +09:00
Yusuke Nakamura d4dce27d89
[ruby/openssl] Allow empty string to OpenSSL::Cipher#update
For some reasons, plaintext may be empty string.

ref https://www.rfc-editor.org/rfc/rfc9001.html#section-5.8

https://github.com/ruby/openssl/commit/953592a29e
2022-12-13 18:07:41 +09:00
Theo Buehler d92f4fe4d7
[ruby/openssl] Use EVP_Digest{Sign,Verify} when available
LibreSSL 3.4 added EVP_DigestSign() and EVP_DigestVerify(). Use them
when available to prepare for the addition of Ed25519 support in
LibreSSL 3.7.

https://github.com/ruby/openssl/commit/475b2bf766
2022-12-13 18:07:41 +09:00
Peter Zhu 5302d04e5a [DOC] Fix format in ObjectSpace.dump_all 2022-12-12 10:16:38 -05:00
Peter Zhu be710c1bf7 [DOC] Fix format for ObjectSpace.dump_shapes 2022-12-12 10:15:24 -05:00
Peter Zhu a9c3dc8d2e [DOC] Fix call-seq for ObjectSpace methods 2022-12-12 09:58:39 -05:00
Peter Zhu 58e3ce5de6 [DOC] Fix typo in docs for ObjectSpace.dump_all 2022-12-12 09:56:44 -05:00
Peter Zhu 87d5470873 [DOC] Fix indentation for ObjectSpace.dump_all 2022-12-12 09:51:12 -05:00
Peter Zhu 0b4fda11ec [DOC] Don't document private methods in objspace 2022-12-12 09:48:06 -05:00
Jean Boussier d7812d1949 objspace_dump.c: dump the capacity field for INITIAL_CAPACITY shapes
We forgot about that one, it's quite useful to see which capacity
we started from.
2022-12-09 17:06:21 +01:00
Hiroshi SHIBATA 01cf3ab3b8 [ruby/date] Bump version to 3.3.1
https://github.com/ruby/date/commit/b7a8229041
2022-12-09 07:57:33 +00:00
Charles Oliver Nutter e96b64f5e7 [ruby/date] No-op gem for JRuby for now
Remove all shipped files and require path on JRuby until we can
add JRuby's extension to the gem.

Temporary workaround for #48

https://github.com/ruby/date/commit/94c3becef2
2022-12-09 07:55:07 +00:00
Hiroshi SHIBATA 3b45498d3e Merge json-2.6.3 2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA 7d04cddfef Merge stringio-3.0.4 2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA 286812bcf3 Merge fiddle-1.1.1 2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA 4e31fea77d Merge strscan-3.0.5 2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA d7baa17b49 [ruby/etc] Bump version to 1.4.2
https://github.com/ruby/etc/commit/5cac138538
2022-12-09 05:57:49 +00:00
Sutou Kouhei 8bbf4e5d8d [ruby/stringio] bump up to 3.0.5
https://github.com/ruby/stringio/commit/e62b9d78d3
2022-12-08 20:58:53 +00:00
Jean Boussier 73771e4b19 ObjectSpace.dump_all: dump shapes as well
I see several arguments in doing so.

First they use a non trivial amount of memory, so for various memory
profiling/mapping tools it is relevant to have visibility of the space
occupied by shapes.

Then, some pathological code can create a tons of shape, so it is
valuable to have a way to have a way to observe shapes without having
to compile Ruby with `SHAPE_DEBUG=1`.

And additionally it's likely much faster to dump then this way than
to use `RubyVM::Shape`.

There are however a few open questions:

- Shapes can't respect the `since:` argument. Not sure what to do when
  it is provided. Would probably make sense to not dump them.
- Maybe it would make more sense to have a separate `ObjectSpace.dump_shapes`?
- Maybe instead `dump_all` should take a `shapes: false` argument?

Additionally, `ObjectSpace.dump_shapes` is added for the use case of
debugging the evolution of the shape tree.
2022-12-08 18:46:16 +01:00
Sutou Kouhei b9d055d760 [ruby/stringio] bump up to 3.0.4
https://github.com/ruby/stringio/commit/5ba853d6ff
2022-12-08 05:12:15 +00:00
Hiroshi SHIBATA 9fce6014b5 [ruby/psych] Bump version to 5.0.1
https://github.com/ruby/psych/commit/bdf20e6042
2022-12-08 02:08:25 +00:00
Daniel Colson 64cdf8bae7 Update dependencies 2022-12-06 12:37:23 -08:00
Jemma Issroff e4aba8f519 Add shape_id to heap dump 2022-12-05 14:33:16 -08:00
Hiroshi SHIBATA fa865f5752 [ruby/bigdecimal] Bump version to 3.1.3
https://github.com/ruby/bigdecimal/commit/25a75c2033
2022-12-05 10:44:30 +00:00
Hiroshi SHIBATA 3f8dad0463 [ruby/zlib] Bump version to 3.0.0
https://github.com/ruby/zlib/commit/f1ce5e3e8d
2022-12-05 08:26:21 +00:00
Hiroshi SHIBATA 3396b10ff1 [ruby/win32ole] Bump version to 1.8.9
https://github.com/ruby/win32ole/commit/e4a1f3a2bf
2022-12-05 08:22:51 +00:00
Hiroshi SHIBATA faafb7b740 [ruby/stringio] Revert "Bump version to 3.0.4"
This reverts commit https://github.com/ruby/stringio/commit/aeb7e1a0bde6.

https://github.com/ruby/stringio/commit/003dd0d003
2022-12-05 08:03:29 +00:00
Hiroshi SHIBATA 95e272baf8 [ruby/stringio] Bump version to 3.0.4
https://github.com/ruby/stringio/commit/aeb7e1a0bd
2022-12-05 08:02:25 +00:00
Hiroshi SHIBATA 40ee1eea76 [ruby/psych] Bump version to 5.0.0
https://github.com/ruby/psych/commit/4fed0941b9
2022-12-05 07:44:39 +00:00
Hiroshi SHIBATA 0d5ad44ac3 [ruby/pathname] Bump version to 0.2.1
https://github.com/ruby/pathname/commit/7e796cc78e
2022-12-05 16:33:43 +09:00
Hiroshi SHIBATA ccb41a0a36 [ruby/nkf] Bump version to 0.1.2
https://github.com/ruby/nkf/commit/98607bd2be
2022-12-05 06:51:37 +00:00
Hiroshi SHIBATA 8c596369e8 [ruby/io-nonblock] Bump version to 0.2.0
https://github.com/ruby/io-nonblock/commit/46c0ec245e
2022-12-05 06:22:15 +00:00
Hiroshi SHIBATA f6dad39544 [ruby/fcntl] Bump version to 1.0.2
https://github.com/ruby/fcntl/commit/20fd776303
2022-12-05 06:09:41 +00:00
Hiroshi SHIBATA a0deb64909 [ruby/etc] Bump version to 1.4.1
https://github.com/ruby/etc/commit/b3e9d9ceb0
2022-12-05 06:07:32 +00:00
Hiroshi SHIBATA fcbafe7f4a [ruby/digest] Bump version to 3.1.1
https://github.com/ruby/digest/commit/fad16582ea
2022-12-05 05:56:58 +00:00
Hiroshi SHIBATA 774dad4915 [ruby/date] Bump version to 3.3.0
https://github.com/ruby/date/commit/ac1642cf39
2022-12-05 05:19:16 +00:00
Nobuyoshi Nakada b8a73e704d [ruby/pathname] [Misc #19155] [DOC] Addion of absolute paths
https://github.com/ruby/pathname/commit/3cb5ed2576
2022-12-03 15:53:20 +00:00
Nobuyoshi Nakada 678bcfcaa6 [ruby/io-console] Check rawmode option names strictly
https://github.com/ruby/io-console/commit/aa8fc7e947
2022-12-02 10:33:35 +00:00
S-H-GAMELINKS 1a64d45c67 Introduce encoding check macro 2022-12-02 01:31:27 +09:00
Hiroshi SHIBATA c8bfbbc25e
Removed documentation for incomplete option about [Feature #17134] 2022-11-30 17:20:38 +09:00
Takashi Kokubun d2c62426e5 [ruby/erb] Skip using the extension for truffleruby as well
(https://github.com/ruby/erb/pull/39)

* Skip using the extension for truffleruby as well

* Just skip building the C extension for TruffleRuby

* Skip rake compile for truffleruby

* Use resolve_feature_path

* Revert "Use resolve_feature_path"

This reverts commit https://github.com/ruby/erb/commit/acc1e0c0ffaf.

* Use resolve_feature_path with LoadError guard

https://github.com/ruby/erb/commit/85dcb08439
2022-11-27 06:30:48 +00:00
Takashi Kokubun 574896a0ce [ruby/erb] Define ERB::Escape module
(https://github.com/ruby/erb/pull/38)

Close #32
2022-11-26 05:32:25 +00:00
Takashi Kokubun addb1cbbfd [ruby/erb] Keep ERB::Util#html_escape private
ERB::Util.html_escape has been public, but ERB::Util#html_escape had
been private.

https://github.com/ruby/erb/commit/e62210bf56
2022-11-25 08:54:18 +00:00
Nobuyoshi Nakada 1a47521c44
Use `rb_sprintf` instead of deprecated `sprintf` 2022-11-25 08:51:14 +09:00
Takashi Kokubun c480f589c2 [ruby/erb] Rename erb.so to erb/escape.so
(https://github.com/ruby/erb/pull/35)

https://github.com/ruby/erb/commit/1280046952
2022-11-24 23:22:00 +00:00
Nobuyoshi Nakada 612aa5c24a
Use class methods of `File` over `Kernel.open` and `IO.read` 2022-11-21 22:16:49 +09:00
Yudai Takada 29e6d97517
Fix typos (#6775)
* s/Innteger/Integer/

* s/diretory/directory/

* s/Bufer/Buffer/

* s/defalt/default/

* s/covearge/coverage/
2022-11-20 21:07:18 -08:00
yui-knk d8601621ed Enhance keep_tokens option for RubyVM::AbstractSyntaxTree parsing methods
Implementation for Language Server Protocol (LSP) sometimes needs token information.
For example both `m(1)` and `m(1, )` has same AST structure other than node locations
then it's impossible to check the existence of `,` from AST. However in later case,
it might be better to suggest variables list for the second argument.
Token information is important for such case.

This commit adds these methods.

* Add `keep_tokens` option for `RubyVM::AbstractSyntaxTree.parse`, `.parse_file` and `.of`
* Add `RubyVM::AbstractSyntaxTree::Node#tokens` which returns tokens for the node including tokens for descendants nodes.
* Add `RubyVM::AbstractSyntaxTree::Node#all_tokens` which returns all tokens for the input script regardless the receiver node.

[Feature #19070]

Impacts on memory usage and performance are below:

Memory usage:

```
$ cat test.rb
root = RubyVM::AbstractSyntaxTree.parse_file(File.expand_path('../test/ruby/test_keyword.rb', __FILE__), keep_tokens: true)

$ /usr/bin/time -f %Mkb /usr/local/bin/ruby -v
ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux]
11408kb

# keep_tokens :false
$ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb
17508kb

# keep_tokens :true
$ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb
30960kb
```

Performance:

```
$ cat ../ast_keep_tokens.yml
prelude: |
  src = <<~SRC
    module M
      class C
        def m1(a, b)
          1 + a + b
        end
      end
    end
  SRC
benchmark:
  without_keep_tokens: |
    RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: false)
  with_keep_tokens: |
    RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: true)

$ make benchmark COMPARE_RUBY="./ruby" ARGS=../ast_keep_tokens.yml
/home/kaneko.y/.rbenv/shims/ruby --disable=gems -rrubygems -I../benchmark/lib ../benchmark/benchmark-driver/exe/benchmark-driver \
            --executables="compare-ruby::./ruby -I.ext/common --disable-gem" \
            --executables="built-ruby::./miniruby -I../lib -I. -I.ext/common  ../tool/runruby.rb --extout=.ext  -- --disable-gems --disable-gem" \
            --output=markdown --output-compare -v ../ast_keep_tokens.yml
compare-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux]
built-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux]
warming up..

|                     |compare-ruby|built-ruby|
|:--------------------|-----------:|---------:|
|without_keep_tokens  |     21.659k|   21.303k|
|                     |       1.02x|         -|
|with_keep_tokens     |      6.220k|    5.691k|
|                     |       1.09x|         -|
```
2022-11-21 09:01:34 +09:00
Samuel Williams ea8a7287e2
Add support for `sockaddr_un` on Windows. (#6513)
* Windows: Fix warning about undefined if_indextoname()

* Windows: Fix UNIXSocket on MINGW and make .pair more reliable

* Windows: Use nonblock=true for read tests with scheduler

* Windows: Move socket detection from File.socket? to File.stat

Add S_IFSOCK to Windows and interpret reparse points accordingly.
Enable tests that work now.

* Windows: Use wide-char functions to UNIXSocket

This fixes behaviour with non-ASCII characters.
It also fixes deletion of temporary UNIXSocket.pair files.

* Windows: Add UNIXSocket tests for specifics of Windows impl.

* Windows: fix VC build due to missing _snwprintf

Avoid usage of _snwprintf, since it fails linking ruby.dll like so:

  linking shared-library x64-vcruntime140-ruby320.dll
  x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol snwprintf
  x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol vsnwprintf_l

whereas linking miniruby.exe succeeds.

This patch uses snprintf on the UTF-8 string instead.

Also remove branch GetWindowsDirectoryW, since it doesn't work.

* Windows: Fix dangling symlink test failures

Co-authored-by: Lars Kanis <kanis@comcard.de>
2022-11-17 14:50:25 -08:00
Nobuyoshi Nakada dc1c4e4675 Clean extension build directories and exts.mk file 2022-11-16 18:42:46 +09:00
Nobuyoshi Nakada be65cf5325 Remove `-j` option from `MFLAGS` for sub-makes 2022-11-16 18:42:46 +09:00
Kenta Murata c75de1e330 [ruby/bigdecimal] Add fallback definition of MAYBE_UNUSED
https://github.com/ruby/bigdecimal/commit/b2123faa52
2022-11-15 06:59:11 +00:00
Kenta Murata 3c60e030b5 [ruby/bigdecimal] Replace sprintf by snprintf
https://github.com/ruby/bigdecimal/commit/d6f5bb40c7
2022-11-15 04:02:01 +00:00
Kenta Murata 3147a3900f [ruby/bigdecimal] Mark some functions MAYBE_UNUSED
https://github.com/ruby/bigdecimal/commit/d70a4d53e5
2022-11-15 00:34:23 +00:00
Kenta Murata 8d82f4ba1c [ruby/bigdecimal] Add specific value allocators
* Add NewZero* and NewOne* function families
* Use them instead of VpAlloc for allocating 0 and 1

https://github.com/ruby/bigdecimal/commit/9276a94ac7
2022-11-13 12:33:29 +00:00
Kenta Murata 802dce4acd [ruby/bigdecimal] Add and use specific value allocators
* Add rbd_allocate_struct_zero for making 0.0
* Add rbd_allocate_struct_one for making 1.0
* Use them to replace VpAlloc calls
* Renmae VpPt5 to VpConstPt5

https://github.com/ruby/bigdecimal/commit/40c826f5e6
2022-11-13 06:01:27 +00:00
Kenta Murata 019f53de5c [ruby/bigdecimal] Make VPrint function always available
https://github.com/ruby/bigdecimal/commit/5391f7e92c
2022-11-13 06:01:27 +00:00
Kenta Murata d1f55dea86 [ruby/bigdecimal] Tweak VpAlloc
* Stop reusing mx and mf
* Check szVal == NULL first
* Treat special values before checking the leading `#`

https://github.com/ruby/bigdecimal/commit/14f3d965f8
2022-11-13 04:29:19 +00:00
Kenta Murata bbb9f72353 [ruby/bigdecimal] Rewrite allocation functions
* Rename them
* Make allocation count operations atomic

https://github.com/ruby/bigdecimal/commit/a5ab34a115
2022-11-13 03:47:40 +00:00
Kenta Murata 2703410289 [ruby/bigdecimal] Twak GetPrecisionInt and rename it to check_int_precision
https://github.com/ruby/bigdecimal/commit/69d0588a3b
2022-11-13 02:46:42 +00:00
Kenta Murata ef1c6109b1 [ruby/bigdecimal] Tweak check_rounding_mode_option
https://github.com/ruby/bigdecimal/commit/e1c6c9be25
2022-11-13 02:02:02 +00:00
Kenta Murata 74c6e6e565 [ruby/bigdecimal] Rewrite check_rounding_mode function
Use table-lookup algorithm instead of consecutive if-statements.

https://github.com/ruby/bigdecimal/commit/23eaff3ae5
2022-11-13 02:02:01 +00:00
Kenta Murata b89769b978 [ruby/bigdecimal] [Doc] Fix the document of n_significant_digits
https://github.com/ruby/bigdecimal/commit/91b72a9341
2022-11-13 02:02:00 +00:00
Kenta Murata 977aac057f [ruby/bigdecimal] Make GetVpValue inline
https://github.com/ruby/bigdecimal/commit/1b642e2e59
2022-11-13 02:02:00 +00:00
Kenta Murata 0d5248673d [ruby/bigdecimal] Make BigDecimal_double_fig inline
https://github.com/ruby/bigdecimal/commit/4ecf04da7a
2022-11-13 02:01:59 +00:00
Jemma Issroff c726c48a3d Remove numiv from RObject
Since object shapes store the capacity of an object, we no longer
need the numiv field on RObjects. This gives us one extra slot which
we can use to give embedded objects one more instance variable (for a
total of 3 ivs). This commit removes the concept of numiv from RObject.
2022-11-10 10:11:34 -05:00
Jemma Issroff 5246f4027e Transition shape when object's capacity changes
This commit adds a `capacity` field to shapes, and adds shape
transitions whenever an object's capacity changes. Objects which are
allocated out of a bigger size pool will also make a transition from the
root shape to the shape with the correct capacity for their size pool
when they are allocated.

This commit will allow us to remove numiv from objects completely, and
will also mean we can guarantee that if two objects share shapes, their
IVs are in the same positions (an embedded and extended object cannot
share shapes). This will enable us to implement ivar sets in YJIT using
object shapes.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2022-11-10 10:11:34 -05:00
Peter Zhu 68bd1d6855 Fix compiler issues in test on C99
Fixes the following issue when compiling using C99:

ext/-test-/rb_call_super_kw/rb_call_super_kw.c
ext/-test-/random/loop.c:16:39: error: extra ';' outside of a function [-Werror,-Wextra-semi]
RB_RANDOM_DEFINE_INIT_INT32_FUNC(loop);
2022-11-10 09:07:20 -05:00
Nobuyoshi Nakada b7e8876704
[Bug #19100] Add `init_int32` function to `rb_random_interface_t`
Distinguish initialization by single word from initialization by
array.
2022-11-10 12:06:13 +09:00
Nobuyoshi Nakada 6eaed20e14
Add version to the interface of Random extensions 2022-11-10 11:59:45 +09:00
Nobuyoshi Nakada b7504af8fc Preprocess for older bison is no longer needed 2022-11-10 09:51:50 +09:00
Nobuyoshi Nakada ef1c1ddf68
Use `rb_sprintf` instead of deprecated `sprintf` 2022-11-09 11:58:37 +09:00
yui-knk f7db1affd1 Set default %printer for NODE nterms
Before:

```
Reducing stack by rule 639 (line 5062):
   $1 = token "integer literal" (1.0-1.1: 1)
-> $$ = nterm simple_numeric (1.0-1.1: )
```

After:

```
Reducing stack by rule 641 (line 5078):
   $1 = token "integer literal" (1.0-1.1: 1)
-> $$ = nterm simple_numeric (1.0-1.1: NODE_LIT)
```

`"<*>"` is supported by Bison 2.3b (2008-05-27) or later.
https://git.savannah.gnu.org/cgit/bison.git/commit/?id=12e3584054c16ab255672c07af0ffc7bb220e8bc

Therefore developers need to install Bison 2.3b+ to build ruby from
source codes if their Bison is older.

Minimum version requirement for Bison is changed to 3.0.

See: https://bugs.ruby-lang.org/issues/19068 [Feature #19068]
2022-11-08 12:30:03 +09:00
Takashi Kokubun 9af344a421 [ruby/erb] Revert the strpbrk optimization
because it's much slower on M1 https://github.com/ruby/erb/pull/29.
It'd be too complicated to switch the implementation based on known
optimized platforms / versions.

Besides, short strings are the most common usages of this method and
SIMD doesn't really help that case. All in all, I can't justify the
existence of this code.

https://github.com/ruby/erb/commit/30691c8995
2022-11-05 08:34:32 +00:00
Takashi Kokubun 458d6fb15e [ruby/erb] Optimize away the rb_convert_type call using RB_TYPE_P
https://github.com/ruby/erb/commit/12058c3784
2022-11-05 07:52:46 +00:00
Takashi Kokubun e8873e01b6 [ruby/erb] Use strpbrk only when str is long enough for SIMD
This is the same trick used by https://github.com/k0kubun/hescape to
choose the best strategy for different scenarios.

https://github.com/ruby/erb/commit/af26da2858
2022-11-05 07:52:45 +00:00
Takashi Kokubun 419d2fc14d [ruby/erb] Optimize the no-escape case with strpbrk
(https://github.com/ruby/erb/pull/29)

Typically, strpbrk(3) is optimized pretty well with SIMD instructions.
Just using it makes this as fast as a SIMD-based implementation for the
no-escape case.

Not utilizing this for escaped cases because memory allocation would be
a more significant bottleneck for many strings anyway. Also, there'll be
some overhead in calling a C function (strpbrk) many times because we're
not using SIMD instructions directly. So using strpbrk all the time
might not necessarily be faster.
2022-11-05 06:58:48 +00:00
Takashi Kokubun b169d78c88 [ruby/erb] Avoid using prepend + super for fallback
(https://github.com/ruby/erb/pull/28)

`prepend` is prioritized more than ActiveSupport's monkey-patch, but the
monkey-patch needs to work.

https://github.com/ruby/erb/commit/611de5a865
2022-11-04 16:46:29 +00:00
Nobuyoshi Nakada 13395757fa
Update dependencies for bc28acc347 2022-11-05 00:48:42 +09:00
Nobuyoshi Nakada cb18deee72
Substitute from the actual netinet6/in6.h
Xcode no longer links the system include files directory to `/usr`.
Extract the actual header file path from cpp output.
2022-11-04 17:38:28 +09:00
Takashi Kokubun ccf32a5ca4 [ruby/erb] Do not allocate a new String if not needed
[Feature #19102]https://github.com/ruby/erb/commit/ecebf8075c
2022-11-04 07:07:24 +00:00
Takashi Kokubun 20efeaddbe [ruby/erb] Optimize away to_s if it's already T_STRING
[Feature #19102]https://github.com/ruby/erb/commit/38c6e182fb
2022-11-04 07:07:24 +00:00
Takashi Kokubun dc5d06e9b1 [ruby/erb] Copy CGI.escapeHTML to ERB::Util.html_escape
https://github.com/ruby/erb/commit/ac9b219fa9
2022-11-04 07:07:23 +00:00
Peter Zhu 4a8cd9e8bc Use shared flags of the type
The ELTS_SHARED flag is generic, so we should prefer to use the flags
specific of the type (STR_SHARED for strings and RARRAY_SHARED_FLAG
for arrays).
2022-11-02 11:03:21 -04:00
Nobuyoshi Nakada 7ed10abdd9 [ruby/bigdecimal] Suppress macro redefinition warnings
`HAVE_` macros by autoconf are defined as 1.

https://github.com/ruby/bigdecimal/commit/cd35868aa6
2022-10-30 14:21:31 +00:00
Nobuyoshi Nakada bc28acc347 [ruby/digest] Use CommonDigest by default if available
https://github.com/ruby/digest/commit/cce9ada85e
2022-10-29 12:06:03 +00:00
Nobuyoshi Nakada 739ad81ff1 [ruby/date] Check month range as civil 2022-10-27 05:36:11 +00:00
Nobuyoshi Nakada 711b2ed5fe
Make the timestamp path correspond to the bundled target path
So different timestamps for different paths will be used.  Extentions
paths in bundled gems contain `ruby_version`, which includes the ABI
version, and the same timestamp file for different paths resulted in
build failures when it changed.
2022-10-24 17:47:59 +09:00
Burdette Lamar 35e03a44b8 [ruby/stringio] [DOC] Enhanced RDoc for StringIO
(https://github.com/ruby/stringio/pull/36)

Treats:
- #each_codepoint
- #gets
- #readline (shows up in doc for module IO::generic_readable, not class
StringIO)
- #each_line

https://github.com/ruby/stringio/commit/659aca7fe5
2022-10-21 14:12:45 +00:00
Jemma Issroff 6aed5b0c11 Unmark Internal IV test as pending
Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2022-10-20 11:59:34 -07:00
Burdette Lamar c32180d5ce [ruby/stringio] [DOC] Enhanced RDoc for StringIO
(https://github.com/ruby/stringio/pull/35)

Treated:
- #getc
- #getbyte
- #ungetc
- #ungetbyte
- #readchar
- #readbyte
- #each_char

https://github.com/ruby/stringio/commit/6400af8d9f
2022-10-19 15:33:08 +00:00
Burdette Lamar 18b96d8a82 [ruby/stringio] [DOC] StringIO doc enhancements
(https://github.com/ruby/stringio/pull/33)

Treated:
- ::new
- ::open
- #string
- #string=
- #close
- #close_read
- #close_write
- #closed?
- #closed_read?
- #closed_write?
- #eof?

https://github.com/ruby/stringio/commit/be9b64d739
2022-10-19 09:12:18 +09:00
Nobuyoshi Nakada 01d56b99bf
[DOC] Fix rdoc-ref 2022-10-19 08:52:29 +09:00
Burdette Lamar 6bd72a6406 [DOC] Enhanced RDoc for StringIO (#34)
Treated:
- #lineno
- #lineno=
- #binmode
- #reopen
- #pos
- #pos=
- #rewind
- #seek
- #sync
- #each_byte
2022-10-18 18:41:00 +00:00
Aaron Patterson dffca50bb6 [ruby/fiddle] Free closures immediately
(https://github.com/ruby/fiddle/pull/109)

These structs don't need to be freed as part of finalization, so lets
free them immediately.

https://github.com/ruby/fiddle/commit/8a10ec1152
2022-10-18 17:21:45 +09:00
Sutou Kouhei e84ea4af69 [ruby/fiddle] Add support for linker script on Linux
GitHub: fix https://github.com/ruby/fiddle/pull/107

Reported by nicholas a. evans. Thanks!!!

https://github.com/ruby/fiddle/commit/49ea1490df
2022-10-18 17:21:45 +09:00
Sutou Kouhei 08ec656282 [ruby/fiddle] Bump version 2022-10-18 17:21:45 +09:00
Nobuyoshi Nakada 091e3522d7 fiddle: use the old rb_ary_tmp_new() alias
Fiddle is a gem and has the external upstream which supports older
versions of Ruby.
2022-10-18 17:21:45 +09:00
Ben Toews 7db29de008 [ruby/openssl] add document-method for BN#mod_inverse
https://github.com/ruby/openssl/commit/5befde7519
2022-10-17 23:38:35 +09:00
Ben Toews 149cb049f1 [ruby/openssl] add BN#mod_sqrt
https://github.com/ruby/openssl/commit/4619ab3e76
2022-10-17 23:38:34 +09:00
Ben Toews e037731c9f [ruby/openssl] define BIGNUM_2cr macro for BN function that takes context and
returns a BN

https://github.com/ruby/openssl/commit/4d0971c51c
2022-10-17 23:38:34 +09:00
Bart de Water 6166fa612c [ruby/openssl] Call out insecure PKCS #1 v1.5 default padding for RSA
https://github.com/ruby/openssl/commit/fd5eaa6dfc
2022-10-17 16:35:35 +09:00
Samuel Williams aecc470a33 [ruby/openssl] Use default `IO#timeout` if possible.
https://github.com/ruby/openssl/commit/471340f612
2022-10-17 16:35:35 +09:00
Christophe De La Fuente 17998ad3bb [ruby/openssl] Add support to SSL_CTX_set_keylog_callback
- This callback is invoked when TLS key material is generated or
  received, in order to allow applications to store this keying material
  for debugging purposes.
- It is invoked with an `SSLSocket` and a string containing the key
  material in the format used by NSS for its SSLKEYLOGFILE debugging
  output.
- This commit adds the Ruby binding `keylog_cb` and the related tests
- It is only compatible with OpenSSL >= 1.1.1. Even if LibreSSL implements
  `SSL_CTX_set_keylog_callback()` from v3.4.2, it does nothing (see
  648d39f0f0)

https://github.com/ruby/openssl/commit/3b63232cf1
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi e4b1627983 [ruby/openssl] ssl: fix "warning: ‘ctx’ may be used uninitialized"
The code was introduced by https://github.com/ruby/openssl/commit/65530b887e54 ("ssl: enable generating keying
material from SSL sessions", 2022-08-03).

This is harmless, but we should avoid it.

https://github.com/ruby/openssl/commit/f5b82e814b
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi 04bf83d6f7 [ruby/openssl] bump version number to 3.1.0.pre
https://github.com/ruby/openssl/commit/fceb978a5d
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi cd83f5b961 [ruby/openssl] Ruby/OpenSSL 3.0.1
https://github.com/ruby/openssl/commit/e5bbd015dc
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi 15a966a674 [ruby/openssl] Ruby/OpenSSL 2.2.2
https://github.com/ruby/openssl/commit/de8a644bc4
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi 33d30a8675 [ruby/openssl] Ruby/OpenSSL 2.1.4
https://github.com/ruby/openssl/commit/5316241e61
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi b69d41e1c4 [ruby/openssl] pkey/ec: check existence of public key component before exporting
i2d_PUBKEY_bio() against an EC_KEY without the public key component
trggers a null dereference.

This is a regression introduced by commit https://github.com/ruby/openssl/commit/56f0d34d63fb ("pkey:
refactor #export/#to_pem and #to_der", 2017-06-14).

Fixes https://github.com/ruby/openssl/pull/527#issuecomment-1220504524
Fixes https://github.com/ruby/openssl/issues/369#issuecomment-1221554057

https://github.com/ruby/openssl/commit/f6ee0fa4de
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi 0677b2fb87 [ruby/openssl] pkey: restore support for decoding "openssl ecparam -genkey" output
Scan through the input for a private key, then fallback to generic
decoder.

OpenSSL 3.0's OSSL_DECODER supports encoded key parameters. The PEM
header "-----BEGIN EC PARAMETERS-----" is used by one of such encoding
formats. While this is useful for OpenSSL::PKey::PKey, an edge case has
been discovered.

The openssl CLI command line "openssl ecparam -genkey" prints two PEM
blocks in a row, one for EC parameters and another for the private key.
Feeding the whole output into OSSL_DECODER results in only the first PEM
block, the key parameters, being decoded. Previously, ruby/openssl did
not support decoding key parameters and it would decode the private key
PEM block instead.

While the new behavior is technically correct, "openssl ecparam -genkey"
is so widely used that ruby/openssl does not want to break existing
applications.

Fixes https://github.com/ruby/openssl/pull/535

https://github.com/ruby/openssl/commit/d486c82833
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi 4fb2845c7b [ruby/openssl] pkey: clear error queue before each OSSL_DECODER_from_bio() call
Fix potential error queue leak.

https://github.com/ruby/openssl/commit/3992b6f208
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi 10f93a8bd7 [ruby/openssl] pkey/dsa: let PKey::DSA.generate choose appropriate q size
DSA parameters generation via EVP_PKEY_paramgen() will not automatically
adjust the size of q value but uses 224 bits by default unless specified
explicitly. This behavior is different from the now-deprecated
DSA_generate_parameters_ex(), which PKey::DSA.generate used to call.

Fixes https://github.com/ruby/openssl/issues/483

Fixes: https://github.com/ruby/openssl/commit/1800a8d5ebaf ("pkey/dsa: use high level EVP interface to generate parameters and keys", 2020-05-17)

https://github.com/ruby/openssl/commit/0105975a0b
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi 65bba0ef6f [ruby/openssl] hmac: use EVP_PKEY_new_raw_private_key() if available
Current OpenSSL 3.0.x release has a regression with zero-length MAC
keys. While this issue should be fixed in a future release of OpenSSL,
we can use EVP_PKEY_new_raw_private_key() in place of the problematic
EVP_PKEY_new_mac_key() to avoid the issue. OpenSSL 3.0's man page
recommends using it regardless:

> EVP_PKEY_new_mac_key() works in the same way as
> EVP_PKEY_new_raw_private_key().  New applications should use
> EVP_PKEY_new_raw_private_key() instead.

Fixes https://github.com/ruby/openssl/issues/369#issuecomment-1224912710

https://github.com/ruby/openssl/commit/4293f18b1f
2022-10-17 16:35:35 +09:00
Kazuki Yamaguchi bee383d9fe [ruby/openssl] x509*: fix error queue leak in #extensions= and #attributes= methods
X509at_delete_attr() in OpenSSL master puts an error queue entry if
there is no attribute left to delete. We must either clear the error
queue, or try not to call it when the list is already empty.

https://github.com/ruby/openssl/commit/a0c878481f
2022-10-17 16:35:35 +09:00
madblobfish 79543b9a53 [ruby/openssl] ssl: enable generating keying material from SSL sessions
Add OpenSSL::SSL::SSLSocket#export_keying_material to support RFC 5705

https://github.com/ruby/openssl/commit/65530b887e
2022-10-17 16:35:35 +09:00
Nobuhiro IMAI a98096349e [ruby/openssl] Check if the option is an Hash in `pkey_ctx_apply_options0()`
causes SEGV if it is an Array or something like that.

https://github.com/ruby/openssl/commit/ef23525210
2022-10-17 16:35:35 +09:00
Alan Wu 5dae78b9d3 [ruby/openssl] Pass arguments to check macro presence
X509_STORE_get_ex_new_index() is a macro, so passing just its name to
have_func() doesn't detect it. Pass an example call instead.

https://github.com/ruby/openssl/commit/8d264d3e60

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-10-17 16:35:35 +09:00
Alan Wu a211b32180 [ruby/openssl] Check for OpenSSL functions in headers
While building with a custom build of OpenSSL, I noticed in mkmf.log
that all the feature detection checks are done using a program lacking
an OpenSSL header include. `mkmf` retries using a fallback program when
this fails, but that means all the `have_func` calls compile twice when
compiling once should suffice. Example log without this commit:

    have_func: checking for X509_STORE_CTX_get0_cert()... -------------------- yes

    DYLD_FALLBACK_LIBRARY_PATH=.:../.. "clang -o conftest ...
    conftest.c:14:57: error: use of undeclared identifier 'X509_STORE_CTX_get0_cert'
    int t(void) { void ((*volatile p)()); p = (void ((*)()))X509_STORE_CTX_get0_cert; return !p; }
                                                            ^
    1 error generated.
    checked program was:
    /* begin */
     1: #include "ruby.h"
     2:
     3: /*top*/
     4: extern int t(void);
     5: int main(int argc, char **argv)
     6: {
     7:   if (argc > 1000000) {
     8:     int (* volatile tp)(void)=(int (*)(void))&t;
     9:     printf("%d", (*tp)());
    10:   }
    11:
    12:   return !!argv[argc];
    13: }
    14: int t(void) { void ((*volatile p)()); p = (void ((*)()))X509_STORE_CTX_get0_cert; return !p; }
    /* end */

    DYLD_FALLBACK_LIBRARY_PATH=.:../.. "clang -o conftest ...
    checked program was:
    /* begin */
     1: #include "ruby.h"
     2:
     3: /*top*/
     4: extern int t(void);
     5: int main(int argc, char **argv)
     6: {
     7:   if (argc > 1000000) {
     8:     int (* volatile tp)(void)=(int (*)(void))&t;
     9:     printf("%d", (*tp)());
    10:   }
    11:
    12:   return !!argv[argc];
    13: }
    14: extern void X509_STORE_CTX_get0_cert();
    15: int t(void) { X509_STORE_CTX_get0_cert(); return 0; }
    /* end */

The second compilation succeeds.

Specify the header for each checked function.

https://github.com/ruby/openssl/commit/34ae7d92d0
2022-10-17 16:35:33 +09:00
Kazuki Yamaguchi 63234edf67 openssl: use the old rb_ary_tmp_new() alias
openssl has to support older versions of Ruby. Undo the change in
ext/openssl/ossl_pkey_ec.c by commit efb91ff19b ("Rename
rb_ary_tmp_new to rb_ary_hidden_new", 2022-07-25).
2022-10-17 16:25:51 +09:00
Nobuyoshi Nakada 66a650ec41 [ruby/psych] Fix missing `abort` call
https://github.com/ruby/psych/commit/de2b98c7b7

Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2022-10-12 20:24:38 +09:00
Nobuyoshi Nakada ed01bacf27 [ruby/psych] Abandon when libyaml is not found
https://github.com/ruby/psych/commit/0b89eda398
2022-10-12 20:24:37 +09:00
Nobuyoshi Nakada 3539da64fc
[DOC] Replace the external URIs to docs with rdoc-ref 2022-10-12 12:27:40 +09:00
Jemma Issroff ad63b668e2
Revert "Revert "This commit implements the Object Shapes technique in CRuby.""
This reverts commit 9a6803c90b.
2022-10-11 08:40:56 -07:00
yui-knk 4bfdf6d06d Move `error` from top_stmts and top_stmt to stmt
By this change, syntax error is recovered smaller units.
In the case below, "DEFN :bar" is same level with "CLASS :Foo"
now.

```
module Z
  class Foo
    foo.
  end

  def bar
  end
end
```

[Feature #19013]
2022-10-08 17:59:11 +09:00
Samuel Williams 844a9dff88
Try `nil` as default for 'default timeout'. (#6509) 2022-10-08 14:02:34 +13:00
Samuel Williams a081fe76de
Simplify default argument specification. (#6507) 2022-10-07 22:51:27 +13:00
Samuel Williams e4f91bbdba
Add IO#timeout attribute and use it for blocking IO operations. (#5653) 2022-10-07 21:48:38 +13:00
Hiroshi SHIBATA 4f78560cf1
Add --with-libffi-source-dir feature and removed --enable-bundled-libffi option. (#113)
https://bugs.ruby-lang.org/issues/18571

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2022-10-07 15:20:11 +09:00
Sutou Kouhei ada9f8a9f7 [ruby/fiddle] closure: follow variable name change
GitHub: GH-102

https://github.com/ruby/fiddle/commit/2530496602
2022-10-07 15:18:54 +09:00
Sutou Kouhei a4ad6bd9aa [ruby/fiddle] closure: free resources when an exception is raised in Closure.new
GitHub: GH-102

https://github.com/ruby/fiddle/commit/81a8a56239
2022-10-07 15:18:53 +09:00
Sutou Kouhei 255e617bc3 [ruby/fiddle] Add Fiddle::Closure.create and Fiddle::Closure.free
GitHub: fix GH-102

It's for freeing a closure explicitly.

We can't use Fiddle::Closure before we fork the process. If we do it,
the process may be crashed with SELinux.

See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091
for details.

Reported by Vít Ondruch. Thanks!!!

https://github.com/ruby/fiddle/commit/a0ccc6bb1b
2022-10-07 15:18:51 +09:00
Aaron Patterson 0097c7f388 [ruby/fiddle] Add `sym_defined?` methods to test if a symbol is defined (https://github.com/ruby/fiddle/pull/108)
I would like to check if a symbol is defined before trying to access it.
Some symbols aren't available on all platforms, so instead of raising an
exception, I want to check if it's defined first.

Today we have to do:

```ruby
begin
  addr = Fiddle::Handle.sym("something")
  # do something
rescue Fiddle::DLError
end
```

I want to write this:

```ruby
if Fiddle::Handle.sym_defined?("something")
  addr = Fiddle::Handle.sym("something")
  # do something
end
```

https://github.com/ruby/fiddle/commit/9d3371de13

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2022-10-07 15:18:51 +09:00
Aaron Patterson 755d99e878 [ruby/fiddle] Move "type" constants to `Fiddle::Types` (https://github.com/ruby/fiddle/pull/112)
This helps to reduce repetition in code. Instead of doing "TYPE_*"
everywhere, you can do `include Fiddle::Types`, and write the type name
directly.

This PR is to help reduce repetition when writing Fiddle code. Right now
we have to type `TYPE_` everywhere, and you also have to include all of
`Fiddle` to access `TYPE_*` constants. With this change, you can just
include `Fiddle::Types` and it will shorten your code and also you only
have to include those constants.

Here is an example before:

```ruby
require "fiddle"

module MMAP
  # All Fiddle constants included
  include Fiddle

  def self.make_function name, args, ret
    ptr = Handle::DEFAULT[name]
    func = Function.new ptr, args, ret, name: name
    define_singleton_method name, &func.to_proc
  end

  make_function "munmap", [TYPE_VOIDP, # addr
                           TYPE_SIZE_T], # len
                           TYPE_INT

  make_function "mmap", [TYPE_VOIDP,
                         TYPE_SIZE_T,
                         TYPE_INT,
                         TYPE_INT,
                         TYPE_INT,
                         TYPE_INT], TYPE_VOIDP

  make_function "mprotect", [TYPE_VOIDP, TYPE_SIZE_T, TYPE_INT], TYPE_INT
end
```

After:

```ruby
require "fiddle"

module MMAP
  # Only type names included
  include Fiddle::Types

  def self.make_function name, args, ret
    ptr = Fiddle::Handle::DEFAULT[name]
    func = Fiddle::Function.new ptr, args, ret, name: name
    define_singleton_method name, &func.to_proc
  end

  make_function "munmap", [VOIDP, # addr
                           SIZE_T], # len
                           INT

  make_function "mmap", [VOIDP, SIZE_T, INT, INT, INT, INT], VOIDP

  make_function "mprotect", [VOIDP, SIZE_T, INT], INT
end
```

We only need to import the type names, and you don't have to type
`TYPE_` over and over. I think this makes Fiddle code easier to read.

https://github.com/ruby/fiddle/commit/49fa7233e5

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2022-10-07 15:18:50 +09:00
Aaron Patterson 48a6498406 [ruby/fiddle] Add constants for unsigned values (https://github.com/ruby/fiddle/pull/111)
This commit adds constants for unsigned values. Currently we can use `-`
to mean "unsigned", but I think having a specific name makes Fiddle more
user friendly. This commit continues to support `-`, but introduces
negative constants with "unsigned" names

I think this will help to eliminate [this
code](3a56bf0bcc/lib/mjit/c_type.rb (L31-L38))

https://github.com/ruby/fiddle/commit/2bef0f1082

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2022-10-07 15:18:49 +09:00
Nobuyoshi Nakada 1b7c5c394f [ruby/date] Fix misplaced time zone offset checks
https://github.com/ruby/date/commit/d21c69450a
2022-10-07 14:41:31 +09:00
Hiroshi SHIBATA fc218e5977 [ruby/psych] Removed the related condition of --enable-bundled-libyaml
https://github.com/ruby/psych/commit/7c211a43c1
2022-10-07 12:55:31 +09:00
Hiroshi SHIBATA 94d4bea7c9 [ruby/psych] --enable-bundled-libyaml config has been removed
https://github.com/ruby/psych/commit/447d372dcd
2022-10-07 12:55:30 +09:00
Hiroshi SHIBATA 0b4352b91d
Removed the related files for downloading with extlibs 2022-10-05 18:22:06 +09:00
Burdette Lamar ded895baa9
[DOC] RDoc changes for IO (#6458)
Moves Expect library doc into io.c.
    Changes certain links to local sections, now pointing to sections in doc/io_streams.rdoc.
    Removes local sections now superseded by sections in doc/io_streams.rdoc.
2022-10-02 08:24:08 -05:00
Aaron Patterson 9a6803c90b
Revert "This commit implements the Object Shapes technique in CRuby."
This reverts commit 68bc9e2e97d12f80df0d113e284864e225f771c2.
2022-09-30 16:01:50 -07:00
Nobuyoshi Nakada cb16dcb184 [ruby/date] The shrunk words to be copied is limited
Th buffer size is small enough and no need to allocate dynamically.

https://github.com/ruby/date/commit/f62bf0a01d
2022-09-29 14:56:39 +09:00
Nobuyoshi Nakada 5a8aaedaff [ruby/date] Narrow ALLOCV region for shrunk words
https://github.com/ruby/date/commit/f51b038074
2022-09-29 14:06:36 +09:00
Samuel Williams bd2fbd3588
Add `Coverage.supported?` to detect what modes are supported. 2022-09-29 09:44:14 +13:00
Samuel Williams 9dd902b831
Add `eval: true/false` flag to `Coverage.setup`. 2022-09-29 09:44:14 +13:00
Jemma Issroff d594a5a8bd
This commit implements the Object Shapes technique in CRuby.
Object Shapes is used for accessing instance variables and representing the
"frozenness" of objects.  Object instances have a "shape" and the shape
represents some attributes of the object (currently which instance variables are
set and the "frozenness").  Shapes form a tree data structure, and when a new
instance variable is set on an object, that object "transitions" to a new shape
in the shape tree.  Each shape has an ID that is used for caching. The shape
structure is independent of class, so objects of different types can have the
same shape.

For example:

```ruby
class Foo
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

class Bar
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

foo = Foo.new # `foo` has shape id 2
bar = Bar.new # `bar` has shape id 2
```

Both `foo` and `bar` instances have the same shape because they both set
instance variables of the same name in the same order.

This technique can help to improve inline cache hits as well as generate more
efficient machine code in JIT compilers.

This commit also adds some methods for debugging shapes on objects.  See
`RubyVM::Shape` for more details.

For more context on Object Shapes, see [Feature: #18776]

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
2022-09-28 08:26:21 -07:00
Nobuyoshi Nakada d12fce7af3 [ruby/date] Check time zone offset elements
Too big parts of fractional hour time zone offset can cause assertion
failures.

https://github.com/ruby/date/commit/06bcfb2729
2022-09-28 21:07:00 +09:00
Maciej Rzasa b8e804e410 [ruby/bigdecimal] Document precision=0 and ndigits=0 for converting from Float
https://github.com/ruby/bigdecimal/commit/4f0894c6c0
2022-09-28 09:29:49 +09:00
Chad Wilson 1a06bc94d9 [ruby/psych] Bump snakeyaml from 1.31 to 1.33
https://github.com/ruby/psych/commit/8a761cdfb7
2022-09-28 00:11:05 +09:00
Aaron Patterson 06abfa5be6
Revert this until we can figure out WB issues or remove shapes from GC
Revert "* expand tabs. [ci skip]"

This reverts commit 830b5b5c35.

Revert "This commit implements the Object Shapes technique in CRuby."

This reverts commit 9ddfd2ca00.
2022-09-26 16:10:11 -07:00
Jemma Issroff 9ddfd2ca00 This commit implements the Object Shapes technique in CRuby.
Object Shapes is used for accessing instance variables and representing the
"frozenness" of objects.  Object instances have a "shape" and the shape
represents some attributes of the object (currently which instance variables are
set and the "frozenness").  Shapes form a tree data structure, and when a new
instance variable is set on an object, that object "transitions" to a new shape
in the shape tree.  Each shape has an ID that is used for caching. The shape
structure is independent of class, so objects of different types can have the
same shape.

For example:

```ruby
class Foo
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

class Bar
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

foo = Foo.new # `foo` has shape id 2
bar = Bar.new # `bar` has shape id 2
```

Both `foo` and `bar` instances have the same shape because they both set
instance variables of the same name in the same order.

This technique can help to improve inline cache hits as well as generate more
efficient machine code in JIT compilers.

This commit also adds some methods for debugging shapes on objects.  See
`RubyVM::Shape` for more details.

For more context on Object Shapes, see [Feature: #18776]

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
2022-09-26 09:21:30 -07:00
Samuel Williams a95b741a97 [ruby/bigdecimal] Remove trailing whitespace.
https://github.com/ruby/bigdecimal/commit/223d193f01
2022-09-25 19:34:27 +09:00
Maciek Rząsa 8e2c425183 [ruby/bigdecimal] Improve documentation of BigDecimal#sign
Fixes https://github.com/ruby/bigdecimal/issues/78 by describing behaviour for positive and negative zero in the docs.

https://github.com/ruby/bigdecimal/commit/5415b120ab
2022-09-25 16:51:17 +09:00
David Carlier d35bc88b37
sockopt adding Linux constants, SO_INCOMING_CPU/SO_INCOMING_NAPI_ID. 2022-09-21 17:15:54 +09:00
David Carlier 8cbbc061c4 openbsd sockets add SO_RTABLE constant 2022-09-21 17:10:36 +09:00
David Carlier ec2d13567e Introduces FreeBSD's SO_USER_COOKIE among socketopt's options. 2022-09-21 15:48:34 +09:00
David CARLIER 8a9dfb676b sockets add `TCP_CONNECTION_INFO` and `TCP_KEEPALIVE` constants. 2022-09-21 15:23:50 +09:00
David CARLIER 017573c3b3 socket add FreeBSD's SO_SETFIB constant. 2022-09-21 15:22:47 +09:00
卜部昌平 7060b23ffa proper function prototypes for openssl
Just to reroute compiler warnings.
2022-09-21 11:44:09 +09:00
卜部昌平 437800d3b0 getenv: is in stdlib.h
getenv is a very basic function that has been in stdlib.h since
ISO/IEC 9899:1990.  There is absolutely zero need for us to redeclare.

pty.c already includes stdlib.h out of the box so we need nothing.
2022-09-21 11:44:09 +09:00
卜部昌平 45741918e1 reserved_word: just use gperf 3.1 declaration
The reason why this was commented out was because of gperf 3.0 vs 3.1
differences (see [Feature #13883]).  Five years passed, I am pretty
confident that we can drop support of old versions here.

Ditto for uniname2ctype_p(), onig_jis_property(), and zonetab().
2022-09-21 11:44:09 +09:00
Sutou Kouhei e40fa6c480
[DOC] socket: fix wrong sample addresses (#6372)
IPv6 link local address is fe80::/10 not ff80::/10:

https://www.rfc-editor.org/rfc/rfc4291.html

    Link-Local unicast   1111111010           FE80::/10       2.5.6

IPv6 (deprecated) site local address is fec0::/10 not ffc0::/10:

https://www.rfc-editor.org/rfc/rfc3513.html

    Site-local unicast   1111111011           FEC0::/10       2.5.6
2022-09-20 16:09:42 +09:00