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

86338 Коммитов

Автор SHA1 Сообщение Дата
Peter Zhu a9f6bd028a Add make target shared-gc
Allows building shared GC using `make shared-gc SHARED_GC=gc_impl`
2024-07-08 16:47:25 -04:00
Alan Wu 3be9ce3cf6
YJIT: `dump-disasm`: Print comments and bytes in release builds
This change implements a fallback mode for the `--yjit-dump-disasm`
development command-line option to make it usable in release builds.
Previously, using the option with release builds of YJIT yielded only
a warning asking the user to build with `--enable-yjit=dev`.

While builds that use the `disasm` feature still give the best output,
just having the comments is useful enough for many kinds of debugging.
Having it usable in release builds is nice for new hackers, too, since
this allows for tinkering without having to learn how to build YJIT in
development mode.

Sample output on A64:

```
  # regenerate_branch
  # Insn: 0001 opt_send_without_block (stack_size: 1)
  # guard known object with singleton class
  0x11f7e0034: 4b 00 00 58 03 00 00 14 08 ce 9c 04 01 00 00
  0x11f7e0043: 00 3f 00 0b eb 81 06 01 54 1f 20 03 d5
  # RUBY_VM_CHECK_INTS(ec)
  0x11f7e0050: 8b 02 42 b8 cb 07 01 35
  # stack overflow check
  0x11f7e0058: ab 62 02 91 7f 02 0b eb 69 07 01 54
  # save PC to CFP
  0x11f7e0064: 0b 3b 9a d2 2b 2f a0 f2 0b 00 cc f2 6b 02 00
  0x11f7e0073: f8 ab 82 00 91
```

To ensure this feature doesn't incur too much cost when running without
the `--yjit-dump-disasm` option, I checked that there is no significant
impact to compile time and memory usage with the `compile_time_ns` and
`yjit_alloc_size` entry in `RubyVM::YJIT.runtime_stats`. For each
sample, I ran 3 iterations of the `lobsters` YJIT benchmark. The
statistics summary and done with the `summary` function in R.

Compile time, sample size of 60, lower is better:

```
       Before              After
 Min.   :2.054e+09   Min.   :2.028e+09
 1st Qu.:2.069e+09   1st Qu.:2.044e+09
 Median :2.081e+09   Median :2.060e+09
 Mean   :2.089e+09   Mean   :2.066e+09
 3rd Qu.:2.109e+09   3rd Qu.:2.085e+09
 Max.   :2.146e+09   Max.   :2.144e+09
```

Allocation size, sample size of 20, lower is better:

```
       Before             After
 Min.   :21804742   Min.   :21794082
 1st Qu.:21826682   1st Qu.:21816282
 Median :21844042   Median :21826814
 Mean   :21960664   Mean   :22026291
 3rd Qu.:21861228   3rd Qu.:22040439
 Max.   :22587426   Max.   :22930614
```

The `yjit_alloc_size` samples are noisy, but since the average increased
by only 0.3%, and the median is lower, I feel safe saying that there is
no significant change.
2024-07-08 20:02:30 +00:00
BurdetteLamar a57b4340d0 Doc fixes 2024-07-08 14:35:29 -04:00
David Rodríguez ae6a2d0641 [rubygems/rubygems] Fix wrong version is comment
This RubyGems feature is being released as 3.5.15, so we can stop
monkeypatching RubyGems once support for the previous version is
dropped.

https://github.com/rubygems/rubygems/commit/36f146840d
2024-07-08 17:06:26 +00:00
David Rodríguez 39826f384a [rubygems/rubygems] Backport binstub race condition fix to Bundler
https://github.com/rubygems/rubygems/commit/b07e46820d
2024-07-08 17:06:25 +00:00
Peter Zhu 0c61e21277 Rename rb_gc_impl_verify_internal_consistency to gc_verify_internal_consistency
It's an internal function so we can drop the rb_gc_impl
2024-07-08 09:08:22 -04:00
Peter Zhu e148db70ea Make rb_gc_impl_verify_internal_consistency static
The function is not used outside of this file.
2024-07-08 09:06:45 -04:00
Hiroshi SHIBATA 02c4f0c89d
Reverts related commits with https://github.com/ruby/open-uri/pull/37
It caused Timeout failure with RJIT and chkbuild

http://rubyci.s3.amazonaws.com/debian11/ruby-master/log/20240708T063006Z.fail.html.gz
https://github.com/ruby/ruby/actions/runs/9836594303/job/27152644853
2024-07-08 20:00:01 +09:00
Jean Boussier 9594db0cf2 Implement Hash.new(capacity:)
[Feature #19236]

When building a large hash, pre-allocating it with enough
capacity can save many re-hashes and significantly improve
performance.

```
/opt/rubies/3.3.0/bin/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \
	            --executables="compare-ruby::../miniruby-master -I.ext/common --disable-gem" \
	            --executables="built-ruby::./miniruby --disable-gem" \
	            --output=markdown --output-compare -v $(find ./benchmark -maxdepth 1 -name 'hash_new' -o -name '*hash_new*.yml' -o -name '*hash_new*.rb' | sort)
compare-ruby: ruby 3.4.0dev (2024-03-25T11:48:11Z master f53209f023) +YJIT dev [arm64-darwin23]
last_commit=[ruby/irb] Cache RDoc::RI::Driver.new (https://github.com/ruby/irb/pull/911)
built-ruby: ruby 3.4.0dev (2024-03-25T15:29:40Z hash-new-rb 77652b08a2) +YJIT dev [arm64-darwin23]
warming up...

|                    |compare-ruby|built-ruby|
|:-------------------|-----------:|---------:|
|new                 |      7.614M|    5.976M|
|                    |       1.27x|         -|
|new_with_capa_1k    |     13.931k|   15.698k|
|                    |           -|     1.13x|
|new_with_capa_100k  |     124.746|   148.283|
|                    |           -|     1.19x|
```
2024-07-08 12:24:33 +02:00
Hiroshi SHIBATA bfb8cad771
Expand RJIT timeout to 60min 2024-07-08 17:58:46 +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
https://github.com/ruby/tempfile/commit/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
David Rodríguez e4825a5194 [rubygems/rubygems] Fix another race condition
We also need to protect prior removal of the binstub, otherwise it can
happen that:

* Process A removes prior binstub FOO.
* Process B removes prior binstub FOO (does nothing actually because Process A already removed it).
* Process A writes binstub FOO for gem BAR from the beginning of file.
* Process B writes binstub FOO for gem BAZ from the beginning of file.

Similarly as before, if binstub FOO for gem BAR is bigger that binstub
FOO for gem BAZ, garbage bytes will be left around at the end of the
file, corrupting the binstub.

The solution is to also protect removal of the previous binstub. To do
this, we use a file lock on an explicit `.lock` file.

https://github.com/rubygems/rubygems/commit/d99a80e62d
2024-07-08 14:38:31 +09:00
David Rodríguez d90a930ede [rubygems/rubygems] Properly protect writing binstubs with a file lock
There's an issue when multiple processes try to write the same binstub.
The problem is that our file locking mechanism is incorrect because
files are truncated _before_ they are locked. So it can happen that:

* Process A truncates binstub FOO.
* Process B truncates binstub FOO.
* Process A writes binstub FOO for gem BAR from the beginning of file.
* Process B writes binstub FOO for gem BAZ from the beginning of file.

If binstub FOO for gem BAR is bigger than binstub FOO for gem BAZ, then
some bytes will be left around at the end of the binstub, making it
corrupt.

This was not a problem in our specs until the spec testing binstubs with
the same name coming from different gems changed from using gems named
"fake" and "rack" to using gems named "fake" and "myrack". Because of
the difference in gem name length, the generated binstub for gem
"myrack" is now longer, causing the above problem if binstub for gem
myrack is written first.

The solution is to make sure when using flock to always use modes that
DON'T truncate the file when opening it. So, we use `r+` if the file
exists previously (it requires the file to exist previously), otherwise
we use `a+`.

https://github.com/rubygems/rubygems/commit/ce8bcba90f
2024-07-08 14:38:30 +09:00
David Rodríguez da12d63431 [rubygems/rubygems] Scope rescuing `Errno::ENOLCK` to just `File.open`
https://github.com/rubygems/rubygems/commit/2a9d347d29
2024-07-08 14:38:29 +09:00
David Rodríguez 7cf7e7e2c0 [rubygems/rubygems] Add missing blank line after method documentation
https://github.com/rubygems/rubygems/commit/2df7560ade
2024-07-08 14:38:29 +09:00
David Rodríguez 6db1c53fce [rubygems/rubygems] Remove unnecessary FileUtils usage
All other `chmod` usages in the file use `File.chmod`, so keep it
consistent.

https://github.com/rubygems/rubygems/commit/3dc0cf8703
2024-07-08 14:38:28 +09:00
Hiroshi SHIBATA dcc8e54234 [ruby/open-uri] Don't use Base64 library
https://github.com/ruby/open-uri/commit/c8c0452d53
2024-07-08 04:53:14 +00:00
Hiroshi SHIBATA bf898057b4 [ruby/open-uri] Test with Windows
https://github.com/ruby/open-uri/commit/2606892a43
2024-07-08 04:53:13 +00:00
Hiroshi SHIBATA 71490d2314 [ruby/open-uri] Move certificates under the TestOpenURIUtils
https://github.com/ruby/open-uri/commit/a28c2da5d2
2024-07-08 04:53:12 +00:00
Hiroshi SHIBATA 3d78e63312 [ruby/open-uri] Load stringio with the correct files
https://github.com/ruby/open-uri/commit/cb17a907a2
2024-07-08 04:53:12 +00:00
Hiroshi SHIBATA 09c52b91b9 [ruby/open-uri] Removed needless class definition and variables
https://github.com/ruby/open-uri/commit/ab0e916997
2024-07-08 04:53:12 +00:00
Hiroshi SHIBATA 61e00856c9 [ruby/open-uri] Don't use URI library
https://github.com/ruby/open-uri/commit/15989970b6
2024-07-08 04:53:11 +00:00
Hiroshi SHIBATA e6b6c2ba9d [ruby/open-uri] support CONNECT method for SimpleHTTPProxy
https://github.com/ruby/open-uri/commit/2e36793bd5
2024-07-08 04:53:11 +00:00
Hiroshi SHIBATA b782906400 [ruby/open-uri] Added SimpleHTTPSServer by TCPServer and OpenSSL
https://github.com/ruby/open-uri/commit/57c80e1576
2024-07-08 04:53:10 +00:00
Hiroshi SHIBATA debcf108fa [ruby/open-uri] Added SimpleHTTPProxyServer by TCPServer
https://github.com/ruby/open-uri/commit/ad47529306
2024-07-08 04:53:10 +00:00
Hiroshi SHIBATA a574e290c5 [ruby/open-uri] Extract SimpleHTTPServer and with_http to TestOpenURIUtils module for other tests
https://github.com/ruby/open-uri/commit/489a1e9006
2024-07-08 04:53:10 +00:00
Hiroshi SHIBATA 7a74dcedd3 [ruby/open-uri] Added SimpleHTTPSServer by TCPServer
https://github.com/ruby/open-uri/commit/a2b1ebe465
2024-07-08 04:53:09 +00:00
Hiroshi SHIBATA a105bf8169 [ruby/open-uri] Removed needless setup and teardown, tmpdir variables
https://github.com/ruby/open-uri/commit/b2d7fc4ff3
2024-07-08 04:53:09 +00:00
Hiroshi SHIBATA 846c45c2b4 [ruby/open-uri] Extract FTP tests from test_open-uri.rb
https://github.com/ruby/open-uri/commit/324111eb41
2024-07-08 04:53:09 +00:00
Hiroshi SHIBATA 6fb482d429 [ruby/open-uri] Extract HTTP Proxy tests from test_open-uri.rb
https://github.com/ruby/open-uri/commit/e9e6bd2779
2024-07-08 04:53:08 +00:00
dependabot[bot] 6d24bc49ab Bump actions/upload-artifact from 4.3.3 to 4.3.4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.3 to 4.3.4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65462800fd...0b2256b8c0)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-08 12:54:12 +09:00
dependabot[bot] 6ac030981f Bump ruby/setup-ruby from 1.184.0 to 1.185.0
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.184.0 to 1.185.0.
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb)
- [Commits](97e35c5302...3a77c29278)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-08 12:15:25 +09:00
Naoto Ono 8ede84aa95 Move the file location of launchable.rb 2024-07-08 10:15:04 +09:00
Naoto Ono 5b78925455 Integrate Launchable into make btest 2024-07-08 10:15:04 +09:00
KJ Tsanaktsidis dface4427d Also export CC for dtrace's benefit as well
The CFLAGS might contain flags that only work with the specified CC
2024-07-07 22:37:36 +10:00
KJ Tsanaktsidis 8ec67052e6 Do not define SHSTK feature for amd64 Context.S
We do not implement CET shadow-stack switching in amd64 Context.S. If
you compile Ruby with `-fcf-protection=full` and run it with
`GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK` exported, it will crash with a
control flow exception.

Configure the appropriate notes at the end of Context.S

[Bug #18061]
2024-07-07 20:14:44 +10:00
KJ Tsanaktsidis 3381c60836 Ensure CFLAGS are passed to probes.o generation
The dtrace python script from systemtap on Linux actually looks at the
CFLAGS environment variable when invoking gcc to make the probes.o file.
If we don't pass the CFLAGS we're using, this probes.o file can wind up
without the required annotations indicating that it supports e.g. Intel
CET.

Fix this by explicitly exporting our build flags to the environment for
this script.

[Bug #18061]
2024-07-07 20:14:44 +10:00
KJ Tsanaktsidis b940de83de Revert autoconf macros defining RUBY_AARCH64_{BTI|PAC}_ENABLED
This partially reverts https://github.com/ruby/ruby/pull/10944; now that
we decided to pass CFLAGS to $(CC) when assembling .S files, we don't
need these autoconf macros that capture the state of
__ARM_FEATURE{PAC|BTI}_DEFAULT.

[Bug #20601]
2024-07-07 20:14:44 +10:00
KJ Tsanaktsidis b18701a7ae Remove $(ASFLAGS) from build system and assemble with $(CFLAGS) instead
We already assemble our assembly files using the $(CC) compiler driver,
rather than the actual $(AS) assembler. This means that

* The C preprocessor gets run on the assembly file
* It's valid to pass gcc-style flags to it, like e.g.
  -mbranch-protection or -fcf-protection
* If you do so, the relevant preprocessor macros like __CET__ get set
* If you really wanted to pass assembler flags, you would need to do
  that using -Wa,... anyway

So I think it makes sense to pass "$(XCFLAGS) $(CFLAGS) $(CPPFLAGS)" to
gcc/clang/etc when assembling, rather than passing $(ASFLAGS) (since
the flags are not actually passed to `as`, but `cc`!).

The side effect of this is that if there are mitigation flags like
-fcf-protection in $CFLAGS, then the relevant macros like __CET__ will
be defined when assembling the files.

[Bug #20601]
2024-07-07 20:14:44 +10:00
cdfzo 087b461c83
[DOC] Fix typo `with` -> `wish` 2024-07-07 13:09:42 +09:00
git d76332e551 Update default gems list at abaa1b913d [ci skip] 2024-07-06 17:55:53 +00:00
Stan Lo abaa1b913d [ruby/irb] Bump version to v1.14.0
(https://github.com/ruby/irb/pull/980)

https://github.com/ruby/irb/commit/6a9e129714
2024-07-06 17:55:00 +00:00
Jeremy Evans 7f1fe5f091 Raise a TypeError for Thread#thread_variable{?,_get} for non-symbol
Previously, a TypeError was not raised if there were no thread
variables, because the conversion to symbol was done after that
check.  Convert to symbol before checking for whether thread
variables are set to make the behavior consistent.

Fixes [Bug #20606]
2024-07-06 12:07:32 +02:00
Alan Wu e240fc9c3c [DOC] yjit.md: Markdown fixes for RDoc
It now renders properly on both GitHub and with RDoc's darkfish theme.
2024-07-05 18:38:46 -04:00
Peter Zhu 3fede665ff Update GitHub actions for shared GC 2024-07-05 14:05:58 -04:00
Peter Zhu e2ceded2c6 Change external GC to use directory at configure
This commit changes the external GC API to use `--with-shared-gc=DIR` at
configure time with a directory of the external GC and uses
`RUBY_GC_LIBRARY` environment variable to load the external GC at
runtime.
2024-07-05 14:05:58 -04:00
Peter Zhu 8fd2df529b Revert "Load external GC using command line argument"
This reverts commit 8ddb1110c283c5cb59b6582383f36fdbcc43ab19.
2024-07-05 14:05:58 -04:00