Commit graph

20692 commits

Author SHA1 Message Date
Matt Valentine-House
4d77803a66 Rename full_mark -> rgengc_allow_full_mark 2024-07-12 14:43:33 +01:00
Matt Valentine-House
f543c68e1c Provide GC.config to disable major GC collections
This feature provides a new method `GC.config` that configures internal
GC configuration variables provided by an individual GC implementation.

Implemented in this PR is the option `full_mark`: a boolean value that
will determine whether the Ruby GC is allowed to run a major collection
while the process is running.

It has the following semantics

This feature configures Ruby's GC to only run minor GC's. It's designed
to give users relying on Out of Band GC complete control over when a
major GC is run. Configuring `full_mark: false` does two main things:

* Never runs a Major GC. When the heap runs out of space during a minor
  and when a major would traditionally be run, instead we allocate more
  heap pages, and mark objspace as needing a major GC.
* Don't increment object ages. We don't promote objects during GC, this
  will cause every object to be scanned on every minor. This is an
  intentional trade-off between minor GC's doing more work every time,
  and potentially promoting objects that will then never be GC'd.

The intention behind not aging objects is that users of this feature
should use a preforking web server, or some other method of pre-warming
the oldgen (like Nakayoshi fork)before disabling Majors. That way most
objects that are going to be old will have already been promoted.

This will interleave major and minor GC collections in exactly the same
what that the Ruby GC runs in versions previously to this. This is the
default behaviour.

* This new method has the following extra semantics:
  - `GC.config` with no arguments returns a hash of the keys of the
    currently configured GC
  - `GC.config` with a key pair (eg. `GC.config(full_mark: true)` sets
    the matching config key to the corresponding value and returns the
    entire known config hash, including the new values. If the key does
    not exist, `nil` is returned

* When a minor GC is run, Ruby sets an internal status flag to determine
  whether the next GC will be a major or a minor. When `full_mark:
  false` this flag is ignored and every GC will be a minor.

  This status flag can be accessed at
  `GC.latest_gc_info(:needs_major_by)`. Any value other than `nil` means
  that the next collection would have been a major.

  Thus it's possible to use this feature to check at a predetermined
  time, whether a major GC is necessary and run one if it is. eg. After
  a request has finished processing.

  ```ruby
  if GC.latest_gc_info(:needs_major_by)
    GC.start(full_mark: true)
  end
  ```

[Feature #20443]
2024-07-12 14:43:33 +01:00
tomoya ishida
17a4c7cfcf [ruby/reline] Fix rendering bug of nomultiline prompt
(https://github.com/ruby/reline/pull/730)

Fix bug of `print('a'*10); Reline.readline('>')` wrong rendering

c0469a12b9
2024-07-12 12:21:26 +00:00
Yusuke Endoh
bb1ef81732 [ruby/error_highlight] Make test_COLON2_5 conditional again
da5e76bb06
2024-07-12 06:26:53 +00:00
Hiroshi SHIBATA
371055979f Pend some tests because these are not working with macOS 15 beta and Xcode 16 beta 2024-07-12 13:38:22 +09:00
Hiroshi SHIBATA
9acc0efdc1
Use fixture certificates to fix test failure with RHEL9.
20240711T213004Z.fail.html.gz

```
  1) Error:
HTTPSProxyTest#test_https_proxy_ssl_connection:
OpenSSL::X509::CertificateError: invalid digest
    /home/chkbuild/chkbuild/tmp/build/20240711T213004Z/ruby/test/net/http/test_https_proxy.rb:63:in 'OpenSSL::X509::Certificate#sign'
    /home/chkbuild/chkbuild/tmp/build/20240711T213004Z/ruby/test/net/http/test_https_proxy.rb:63:in 'HTTPSProxyTest#test_https_proxy_ssl_connection'
```
2024-07-12 09:15:12 +09:00
Kevin Newton
c1df15c3e6 [PRISM] Use node ids for error highlight 2024-07-11 14:25:54 -04:00
Kevin Newton
aa473489a2 [ruby/prism] Various cleanup for initializers and typechecks
86cf82794a
2024-07-11 14:25:54 -04:00
Kevin Newton
2bf9ae3fa1 [ruby/prism] Add node ids to nodes
bf16ade7f9
2024-07-11 14:25:54 -04:00
Kevin Newton
39dcfe26ee [ruby/prism] Move Node#type and Node::type documentation
08a71f6259
2024-07-11 14:25:54 -04:00
Kevin Newton
32090e2b8d [ruby/prism] Add Node#breadth_first_search
1ffb141199
2024-07-11 14:25:54 -04:00
Kevin Newton
aca42a2478 [ruby/prism] Expose common flags in inspect output
d0143865c2
2024-07-11 14:25:54 -04:00
Kevin Newton
687be43c79 [ruby/prism] Expose flags on every node type
9f12a56fd6
2024-07-11 14:25:54 -04:00
Kevin Newton
ca48fb76fb [ruby/prism] Move location to second position for node initializers
4cc0eda4ca
2024-07-11 14:25:54 -04:00
Kevin Newton
678dd769e5 [ruby/prism] Reconfigure error tests
fb7e1ebb7f
2024-07-11 14:25:54 -04:00
Jeremy Evans
c698180e68 [ruby/logger] Add reraise_write_errors keyword argument to Logger and LogDevice
This allows the user to specify exception classes to treat as regular
exceptions instead of being swallowed.  Among other things, it is
useful for having Logger work with Timeout.

Fixes Ruby Bug 9115.

436a7d680f
2024-07-11 15:25:17 +00:00
Jeremy Daer
e1a034cb96
IBM864 single-byte transcoding (#10518)
Include € euro sign from CCSID 864
2024-07-11 17:03:14 +09:00
Yusuke Endoh
e1238a1fab Enumerable#all?: Stop optimizing when a given block is not optimizable
This is a follow up to 182822683f.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2024-07-11 12:28:23 +09:00
Dmitriy Ivliev
6dc0086d20 [rubygems/rubygems] fix s3 source configuration issue
356726bd1a
2024-07-11 02:27:46 +00:00
Evgeni Golov
bc1b4235fb [ruby/net-http] implement talking SSL to the proxy too
https://bugs.ruby-lang.org/issues/16482

ae2d83f88b
2024-07-11 01:56:08 +00:00
fatkodima
70bdc0f777 [ruby/net-http] Add ability to configure default settings for new connections
fed3dcd0c2
2024-07-11 01:51:03 +00:00
MSP-Greg
9f4b45fbf7 [ruby/net-http] test_https.rb - fix test_session_reuse_but_expire
5544243c41
2024-07-11 01:22:10 +00:00
Jeremy Evans
bfba96a106 Avoid a hash allocation when keyword splatting empty hash when calling ruby2_keywords method
Treat this similar to keyword splatting nil, using goto ignore.
However, keep previous behavior if the method accepts a keyword
splat, to avoid double hash allocation.

This also can avoid an array allocation when calling a method
that doesn't have any splat parameters but supports literal
keyword parameters, because ignore_keyword_hash_p was not
ignoring the keyword hash in that case.

This change doesn't remove the empty ruby2_keywords hash from
the array, which caused an assertion failure if the method
being called accepted keywords in some cases.  Modify the
assertion to handle this case.  An alternative approach would
add a flag to the args struct so the args_argc calculation could
handle this case and report the correct argc, but such an approach
would likely be slower.
2024-07-10 16:38:06 -07:00
git
8c69caa495 * append newline at EOF. [ci skip] 2024-07-10 23:06:20 +00:00
Hiroshi SHIBATA
840f7ebfde [ruby/net-http] Commented out unfinished chunked test
6376592cb4
2024-07-10 23:06:10 +00:00
Hiroshi SHIBATA
492b505d95 [ruby/net-http] Removed needless warning
d867edc0fe
2024-07-10 23:06:10 +00:00
Hiroshi SHIBATA
b11aba503b [ruby/net-http] Split POST test because new dummy server can't handle continuouse POST request
54a99b9f0c
2024-07-10 23:06:09 +00:00
Hiroshi SHIBATA
e77bc17e5d [ruby/net-http] Write log after server start, not handling request
205bac757a
2024-07-10 23:06:09 +00:00
Hiroshi SHIBATA
6428536146 [ruby/net-http] Split test class because TCPServer couldn't accept localhost and 127.0.0.1 both
749a1b3197
2024-07-10 23:06:08 +00:00
Hiroshi SHIBATA
4e6463ad7a [ruby/net-http] Support chunked data and fixed test failure with multipart/form-data
b38c2795a9
2024-07-10 23:06:08 +00:00
Hiroshi SHIBATA
87a45af105 [ruby/net-http] Removed server-side log test
9c16c383ce
2024-07-10 23:06:07 +00:00
Hiroshi SHIBATA
5e6f04abc8 [ruby/net-http] Fix wrong hostname with test_max_version test
f00d198433
2024-07-10 23:06:07 +00:00
Hiroshi SHIBATA
c7eb9ac6f9 [ruby/net-http] Rewrite WEBrick server with TCPServer and OpenSSL::SSL::SSLServer
b01bcf6d7f
2024-07-10 23:06:06 +00:00
Jeremy Evans
0ee3960685 Eliminate array allocations for single splat followed by mutable keywords
For calls such as:

  m(*ary, a: 2, **h)
  m(*ary, **h, **h, **h)

Where m does not take a positional argument splat, there was previously
an array allocation (splatarray true) to dup ary, even though it was not
necessary to do so.  This is because the elimination of the array allocation
(splatarray false) was performed in the optimizer, and the optimizer didn't
handle this case, because the instructions for the keywords can be of
arbitrary length.

Move part of the optimization from the optimizer to the compiler,
detecting parse trees of the form:

  ARGS_PUSH:
    head: SPLAT
    tail: HASH (without brace)

And using splatarray false instead of splatarray true for them.

Unfortunately, moving part of the optimization to the compiler broke
the hash allocation elimination optimization for calls of the
form:

  m(*ary, a: 2)

That's because the compiler had already set splatarray false,
and the optimizer code was looking for splatarray true.

Split the array allocation elimination and hash allocation
elimination in the optimizer so that the hash allocation
elimination will still apply if the compiler performs the
splatarray false optimization.
2024-07-10 14:45:38 -07:00
dependabot[bot]
ac0e0f0c76 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.97 to 0.9.98.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.97...v0.9.98)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

d2846130bc
2024-07-09 14:42:40 +00:00
Hiroshi SHIBATA
f9004fc8aa [rubygems/rubygems] Suppress SSLError warning because it's only for debugging.
http://ci.rvm.jp/logfiles/brlog.trunk.20240709-010435#L1554

a1a46f413b
2024-07-09 09:09:14 +00:00
Hiroshi SHIBATA
e09df57427 [ruby/open-uri] Try Windows tests again
50f265ba29
2024-07-09 07:27:48 +00:00
Hiroshi SHIBATA
5d82abdfc8 Removed duplicate server thread 2024-07-09 16:21:55 +09:00
Hiroshi SHIBATA
e62ac3aac7 Reapply "Reverts related commits with https://github.com/ruby/open-uri/pull/37"
This reverts commit 02c4f0c89d.
2024-07-09 16:21:55 +09:00
Hiroshi SHIBATA
02c4f0c89d
Reverts related commits with https://github.com/ruby/open-uri/pull/37
It caused Timeout failure with RJIT and chkbuild

20240708T063006Z.fail.html.gz
2715264485
2024-07-08 20:00:01 +09:00
Hiroshi SHIBATA
a5f4014738
Load net-http explicitly for SimpleHTTPProxyServer 2024-07-08 17:05:12 +09:00
Hiroshi SHIBATA
b903d9f09f [ruby/tempfile] typofix
82a74b017e
2024-07-08 06:18:57 +00:00
Hiroshi SHIBATA
4658d65242 Load socket explicitly for TCPServer 2024-07-08 15:15:46 +09:00
Hiroshi SHIBATA
95bf9049a7 Load OpenSSL on TestOpenURIUtils for with_https 2024-07-08 15:15:46 +09:00
Hiroshi SHIBATA
dcc8e54234 [ruby/open-uri] Don't use Base64 library
c8c0452d53
2024-07-08 04:53:14 +00:00
Hiroshi SHIBATA
bf898057b4 [ruby/open-uri] Test with Windows
2606892a43
2024-07-08 04:53:13 +00:00
Hiroshi SHIBATA
71490d2314 [ruby/open-uri] Move certificates under the TestOpenURIUtils
a28c2da5d2
2024-07-08 04:53:12 +00:00
Hiroshi SHIBATA
3d78e63312 [ruby/open-uri] Load stringio with the correct files
cb17a907a2
2024-07-08 04:53:12 +00:00
Hiroshi SHIBATA
09c52b91b9 [ruby/open-uri] Removed needless class definition and variables
ab0e916997
2024-07-08 04:53:12 +00:00
Hiroshi SHIBATA
61e00856c9 [ruby/open-uri] Don't use URI library
15989970b6
2024-07-08 04:53:11 +00:00