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

72865 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada cf7d07570f
Dump non-ASCII char as unsigned
Non-ASCII code may be negative on platforms plain char is signed.
2022-07-22 09:56:48 +09:00
Jeremy Evans 7223c0da15 Do not chomp trailing line separator IO#each with nil separator and chomp
nil separator means no sepator, so chomp should not remove a line
separator.

Partially Fixes [Bug #18770]
2022-07-21 12:55:24 -07:00
Peter Zhu 3a5ea7c688 Remove unused variable in array.c
array.c:460:14: warning: unused variable 'len' [-Wunused-variable]
        long len  = ARY_HEAP_LEN(ary);
2022-07-21 15:49:26 -04:00
Peter Zhu 9d862011e8 Remove check for shared root arrays
All shared root arrays should not be on the transient heap.
ary_make_shared evacuates arrays from the transient heap when creating
shared roots.
2022-07-21 15:17:59 -04:00
Jean byroot Boussier f0ae583a3d Revert "objspace_dump.c: skip dumping method name if not pure ASCII"
This reverts commit 79406e3600.
2022-07-21 19:56:08 +02:00
Nobuyoshi Nakada 4af0dd36fc
Remove the file that was probably added by accident [ci skip] 2022-07-22 02:07:51 +09:00
Takashi Kokubun 2661980435
Add .git-blame-ignore-revs [ci skip]
for [Misc #18891]

It is a file that could be used with `git config blame.ignoreRevsFile`.
The file name `.git-blame-ignore-revs` is natively supported by GitHub,
so you don't need anything else to make it work on GitHub.
https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view

However, for your local git repository use, if you configure `blame.ignoreRevsFile`
globally, git expects you to have the file in every git repository you
use, which is nearly impossible.

So, for your local development, you're supposed to use this file with:

```
git config --local blame.ignoreRevsFile .git-blame-ignore-revs
```
2022-07-21 10:00:35 -07:00
Jean Boussier 79406e3600 objspace_dump.c: skip dumping method name if not pure ASCII
Sidekiq has a method named `❨╯°□°❩╯︵┻━┻`which corrupts
heap dumps.

Normally we could just dump is as is since it's valid UTF-8 and need
no escaping. But our code to escape control characters isn't UTF-8
aware so it's more complicated than it seems.

Ultimately since the overwhelming majority of method names are
pure ASCII, it's not a big loss to just skip it.
2022-07-21 18:43:45 +02:00
Takashi Kokubun 5b21e94beb Expand tabs [ci skip]
[Misc #18891]
2022-07-21 09:42:04 -07:00
Peter Zhu 3ff53c8e04 Remove macOS 10.15 from CI
macOS 10.15 is deprecated on GitHub Actions and will have periodic
brownouts. See actions/virtual-environments#5583.
2022-07-21 11:49:24 -04:00
Jeremy Evans 203f179ce7 Revert "Do not chomp trailing line separator IO#each with nil separator and chomp"
This reverts commit 04f86ad0b5.

This is causing CI issues, reverting for now.
2022-07-21 08:29:50 -07:00
Jeremy Evans 12ac8971a3 Do not have class/module keywords look up ancestors of Object
Fixes case where Object includes a module that defines a constant,
then using class/module keyword to define the same constant on
Object itself.

Implements [Feature #18832]
2022-07-21 08:28:05 -07:00
Jeremy Evans 04f86ad0b5 Do not chomp trailing line separator IO#each with nil separator and chomp
nil separator means no sepator, so chomp should not remove a line
separator.

Partially Fixes [Bug #18770]
2022-07-21 08:13:40 -07:00
git 672925bf14 * 2022-07-22 [ci skip] 2022-07-22 00:02:53 +09:00
Jeremy Evans 423b41cba7 Make String#each_line work correctly with paragraph separator and chomp
Previously, it was including one newline when chomp was used,
which is inconsistent with IO#each_line behavior. This makes
behavior consistent with IO#each_line, chomping all paragraph
separators (multiple consecutive newlines), but not single
newlines.

Partially Fixes [Bug #18768]
2022-07-21 08:02:32 -07:00
Peter Zhu cdbb9b8555 [Bug #18929] Fix heap creation thrashing in GC
Before this commit, if we don't have enough slots after sweeping but
had pages on the tomb heap, then the GC would frequently allocate and
deallocate pages. This is because after sweeping it would set
allocatable pages (since there were not enough slots) but free the
pages on the tomb heap.

This commit reuses pages on the tomb heap if there's not enough slots
after sweeping.
2022-07-21 10:46:32 -04:00
Nobuyoshi Nakada 804b073573 Update common sources including id.h after update 2022-07-21 22:32:33 +09:00
Jean Boussier f954c5dae4 string.c: use str_enc_fastpath in TERM_LEN
Not having to fetch the rb_encoding save a significant
amount of time.

Additionally, even when we have to fetch it, we can do
it faster using `ENCODING_GET` rather than `rb_enc_get`.

```
compare-ruby: ruby 3.2.0dev (2022-07-19T08:41:40Z master cb9fd920a3) [arm64-darwin21]
built-ruby: ruby 3.2.0dev (2022-07-21T11:16:16Z faster-buffer-conc.. 4f001f0748) [arm64-darwin21]
warming up...

|                      |compare-ruby|built-ruby|
|:---------------------|-----------:|---------:|
|binary_concat_utf8    |    510.580k|  565.600k|
|                      |           -|     1.11x|
|binary_concat_binary  |    512.653k|  571.483k|
|                      |           -|     1.11x|
|utf8_concat_utf8      |    511.396k|  566.879k|
|                      |           -|     1.11x|
```
2022-07-21 15:06:50 +02:00
Peter Zhu 80672b2d0e Add comment in array.c about flags 2022-07-21 09:02:45 -04:00
Peter Zhu d67fcdcc9f Add RARRAY_SHARED_FLAG 2022-07-21 09:02:45 -04:00
Peter Zhu 1c9acb6bb1 Refactor macros of array.c
Move some macros in array.c to internal/array.h so that other files
can also access these macros.
2022-07-21 09:02:45 -04:00
Peter Zhu 4798a4fec2 Remove unused internal macros in rarray.h 2022-07-21 09:02:45 -04:00
Nobuyoshi Nakada 86b29ef877 [ruby/digest] Ignore test_ractor.rb on non-Ractor ruby
https://github.com/ruby/digest/commit/352b8c1636
2022-07-21 11:45:48 +09:00
Nobuyoshi Nakada 4a7ecc1bd9 [ruby/digest] Find an available digest algorithm to test
https://github.com/ruby/digest/commit/8844716793
2022-07-21 09:58:46 +09:00
Aaron Patterson 1341dea771 Prevent the stack from being marked twice
This commit prevents the stack from being marked twice: once via the
Fiber, and once via the Thread.  It introduces an assertion to assert
that the ec on the thread is the same as the ec on the Fiber being
marked via the thread.
2022-07-20 13:45:55 -07:00
Daniel Colson 32e406d6d3 Ensure _id2ref finds symbols with the correct type
Prior to this commit it was possible to call `ObjectSpace._id2ref` with
an offset static symbol object_id and get back a new, incorrectly tagged
symbol:

```
> sensible_sym = ObjectSpace._id2ref(:a.object_id)
=> :a
> nonsense_sym = ObjectSpace._id2ref(:a.object_id + 40)
=> :a
> sensible_sym == nonsense_sym
=> false
```

`nonsense_sym` ends up tagged with `RUBY_ID_INSTANCE` instead of
`RB_ID_LOCAL`. That means we can do silly things like:

```
> foo = Object.new
> foo.instance_variable_set(:a, 123)
(irb):2:in `instance_variable_set': `a' is not allowed as an instance variable name (NameError)
> foo.instance_variable_set(ObjectSpace._id2ref(:a.object_id + 40), 123)
=> 123
> foo.instance_variables
=> [:a]
```

This was happening because `get_id_entry` ignores the tag bits when
looking up the symbol. So `rb_id2str(symid)` would return a value and
then we'd continue on with the nonsense `symid`.

This commit prevents the situation by checking that the `symid` actually
matches what we get back from `get_id_entry`. Now we get a `RangeError`
for the nonsense id:

```
> ObjectSpace._id2ref(:a.object_id)
=> :a
> ObjectSpace._id2ref(:a.object_id + 40)
(irb):1:in `_id2ref': 0x000000000013f408 is not symbol id value (RangeError)
```

Co-authored-by: John Hawthorn <jhawthorn@github.com>
2022-07-20 10:38:44 -07:00
Peter Zhu 5871ecf956 Add RARRAY_LITERAL_FLAG for array literals
Array created as literals during iseq compilation don't need a
reference count since they can never be modified. The previous
implementation would mutate the hidden array's reference count,
causing copy-on-write invalidation.

This commit adds a RARRAY_LITERAL_FLAG for arrays created through
rb_ary_literal_new. Arrays created with this flag do not have reference
count stored and just assume they have infinite number of references.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2022-07-20 13:13:56 -04:00
git b25ee69e38 * 2022-07-21 [ci skip] 2022-07-21 01:32:04 +09:00
John Hawthorn 660b1e973c
YJIT: Skip setlocal WB check for immediate values (#6122)
Write barriers may be required when VM_ENV_FLAG_WB_REQUIRED is set,
however write barriers only affect heap objects being written. If we
know an immediate value is being written we can skip this check.
2022-07-20 12:31:40 -04:00
Noah Gibbs 6140edb5df
Match +YJIT in Ruby desc when testing segv (#6141)
In test_bug_reporter and test_rubyoptions we intentionally
test child processes that cause SEGV. We run them with YJIT
if the parent uses YJIT so that the text description
matches the parent RUBY_DESCRIPTION.
2022-07-20 10:48:58 -04:00
Peter Zhu 86d061294d [Bug #18928] Fix crash in WeakMap
In wmap_live_p, if is_pointer_to_heap returns false, then the page is
either in the tomb or has already been freed, so the object is dead. In
this case, wmap_live_p should return false.
2022-07-20 08:40:31 -04:00
David Rodríguez fa5724cca9 [rubygems/rubygems] Fix `ruby setup.rb --destdir /foo` modifying global specs
Running a command like that is actually removing any previous default
bundler specs in the default RubyGems installation (outside of destdir).
It should instead only modify destdir.

https://github.com/rubygems/rubygems/commit/5ed275383c
2022-07-20 19:55:34 +09:00
David Rodríguez fae0d60120 [rubygems/rubygems] Refactor destdir checks
https://github.com/rubygems/rubygems/commit/ca956c0de2
2022-07-20 19:55:34 +09:00
David Rodríguez fcfb3ce371 [rubygems/rubygems] More cleanup
https://github.com/rubygems/rubygems/commit/6012800a20
2022-07-20 19:55:33 +09:00
David Rodríguez bdef3c73fe [rubygems/rubygems] Unify common logic
https://github.com/rubygems/rubygems/commit/e5434be14c
2022-07-20 19:55:33 +09:00
Takuya Noguchi cbaf58d455 [rubygems/rubygems] Bundler: update primary source in man 5 gemfile
Specifying multiple primary sources in top-level was deprecated in
Bundler 1.13.
As Bundler CLI uses primary source instead of global, "global source"
is replaced with "primary source".

Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>

https://github.com/rubygems/rubygems/commit/1dd1753f6e
2022-07-20 19:45:08 +09:00
Nobuyoshi Nakada 472740de41
Fix free objects count condition
Free objects have `T_NONE` as the builtin type.  A pointer to a valid
array element will never be `NULL`.
2022-07-20 17:39:54 +09:00
Nobuyoshi Nakada e330dceb3f
Mark ruby scripts in YAML [ci skip]
```elisp
(mmm-ify-by-regexp 'ruby-mode
  "^ *#!.*ruby" 0 "^ *shell: *ruby.*{0}" 0 0)
```
2022-07-20 09:40:59 +09:00
David Rodríguez c0aa8ee947 [rubygems/rubygems] Fix casing typo when resetting `RbConfig::CONFIG["ENABLE_SHARED"]`
https://github.com/rubygems/rubygems/commit/3d1ae0050b
2022-07-20 03:03:33 +09:00
git 9ce27dd2cd * 2022-07-20 [ci skip] 2022-07-20 00:23:59 +09:00
Nobuyoshi Nakada 8f17591435 [Bug #18905] Check symbol name types more strictly 2022-07-20 00:23:38 +09:00
Takuya Noguchi 631b34ef95 [rubygems/rubygems] Bundler: change error/warning message for multiple global sources
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>

https://github.com/rubygems/rubygems/commit/316564b8fc
2022-07-19 23:51:47 +09:00
Jean Boussier cb9fd920a3 str_buf_cat: preserve coderange when going through fastpath
rb_str_modify clear the coderange, which in this case isn't
necessary.

```
compare-ruby: ruby 3.2.0dev (2022-07-12T15:01:11Z master 71aec68566) [arm64-darwin21]
built-ruby: ruby 3.2.0dev (2022-07-19T07:17:01Z faster-buffer-conc.. 3cad62aab4) [arm64-darwin21]
warming up...

|                      |compare-ruby|built-ruby|
|:---------------------|-----------:|---------:|
|binary_concat_utf8    |    360.617k|  605.091k|
|                      |           -|     1.68x|
|binary_concat_binary  |    446.650k|  605.053k|
|                      |           -|     1.35x|
|utf8_concat_utf8      |    454.166k|  597.311k|
|                      |           -|     1.32x|
```

```
|            |compare-ruby|built-ruby|
|:-----------|-----------:|---------:|
|erb_render  |      1.790M|    2.045M|
|            |           -|     1.14x|
```
2022-07-19 10:41:40 +02:00
Jean Boussier 0ae8dbbee0 rb_str_buf_append: fastpath to str_buf_cat
If the LHS is ASCII compatible and the RHS is 7BIT
we can directly concat without being concerned about
anything else.

Benchmark:
```
compare-ruby: ruby 3.2.0dev (2022-07-12T15:01:11Z master 71aec68566) [arm64-darwin21]
built-ruby: ruby 3.2.0dev (2022-07-13T10:13:53Z faster-buffer-conc.. a04c10476d) [arm64-darwin21]
warming up...

|                      |compare-ruby|built-ruby|
|:---------------------|-----------:|---------:|
|binary_append_utf8    |    385.315k|  573.663k|
|                      |           -|     1.49x|
|binary_append_binary  |    446.579k|  574.898k|
|                      |           -|     1.29x|
|utf8_append_utf8      |    430.936k|  573.394k|
|                      |           -|     1.33x|
```

Note that in the benchmark, the RHS always have a precomputed
coderange. So the benchmark never enter the slowpath of having to
scan the RHS. However it's extremly likely that we'll end
up scanning it anyway in rb_enc_cr_str_buf_cat
2022-07-19 10:41:40 +02:00
Nobuyoshi Nakada ee1d2b276a [ruby/fileutils] Add an octal prefix to clarify to be octal
https://github.com/ruby/fileutils/commit/332025bc02

Co-Authored-By: David Rodríguez <deivid.rodriguez@riseup.net>
2022-07-19 17:33:44 +09:00
Jean Boussier d084585f01 Rename ENCINDEX_ASCII to ENCINDEX_ASCII_8BIT
Otherwise it's way too easy to confuse it with US_ASCII.
2022-07-19 08:48:56 +02:00
Jemma Issroff 85ea46730d Separate TS_IVC and TS_ICVARC in is_entries buffers
This allows us to treat cvar caches differently than ivar caches.
2022-07-18 14:06:30 -07:00
dependabot[bot] 3ac9956dee [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.19 to 0.9.20.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.19...v0.9.20)

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

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

https://github.com/rubygems/rubygems/commit/2689b6b940
2022-07-19 04:46:16 +09:00
Jemma Issroff ecff334995 Extract vm_ic_entry API to mimic vm_cc behavior 2022-07-18 12:44:01 -07:00
git f240e28dfe * 2022-07-19 [ci skip] 2022-07-19 02:49:18 +09:00