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

81501 Коммитов

Автор SHA1 Сообщение Дата
yui-knk c3ab946e86 `ObjectSpace.count_nodes` doesn't count nodes
Node has not been managed by GC from Ruby 2.5.
Therefore these codes are not needed. If ObjectSpace depends on Node,
it needs to update the file when node type is updated. Delete node
related codes to avoid such update.
2023-11-21 14:39:06 +09:00
TSUYUSATO Kitsune a861c74813 Add a test 2023-11-21 14:07:47 +09:00
TSUYUSATO Kitsune fe746747b4 Reject 'class << (return); end` by "void value expression" 2023-11-21 14:07:47 +09:00
Kouhei Yanagita 04eb40b633 [Bug #11183] Fix rb_complex_pow for special angles
Add a special treatment for when the argument of self is an
integral multiple of 45 degrees.

  1i ** (10 ** 100)         #=> 1+0i
  1i ** (10 ** 100 + 1)     #=> 0+1i
  (1+1i) ** (10 ** 100)     # warning: in a**b, b may be too big
                            #=> (Infinity+0.0i)
  (1+1i) ** (10 ** 100 + 1) # warning: in a**b, b may be too big
                            #=> (Infinity+Infinity*i)
2023-11-21 14:06:26 +09:00
Hiroya Fujinami b6b31f673d [ruby/prism] Check a token after targets more strictly
(https://github.com/ruby/prism/pull/1878)

Fix https://github.com/ruby/prism/pull/1832

https://github.com/ruby/prism/commit/060bcc81a8
2023-11-21 02:45:12 +00:00
Kevin Newton 5299b4a362 [ruby/prism] Build the ability to format errors
(https://github.com/ruby/prism/pull/1796)

Previously, we only supported error messages that were constant
strings. This works for the most part, but there are some times
where we want to include some part of the source in the error
message to make it better.

For example, instead of "Token is reserved" it's better to write
"_1 is reserved".

To do this, we now support allocating error messages at runtime
that are built around format strings.

https://github.com/ruby/prism/commit/7e6aa17deb
2023-11-21 02:43:18 +00:00
Kevin Newton 9fa524dd41 [ruby/prism] Split up CaseNode and CaseMatchNode
(https://github.com/ruby/prism/pull/1801)

https://github.com/ruby/prism/commit/4c1391ea56
2023-11-21 02:38:07 +00:00
Kevin Newton 73d519ec46 [prism] Remove pm_big5_hkscs from common.mk targets 2023-11-20 21:18:31 -05:00
Ryan Garver e16ff17374 Rename the big5-hkscs stuff to something more generic and add UAO sharing common code.
Merge the Big5 extensions into pm_big5.c
2023-11-20 21:18:31 -05:00
dependabot[bot] a4003bb8dc [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.82 to 0.9.83.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.82...v0.9.83)

---
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/9eb6220c6c
2023-11-21 01:45:54 +00:00
dependabot[bot] 7960db04b1 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.82 to 0.9.83.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.82...v0.9.83)

---
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/41670ad4e2
2023-11-21 00:58:08 +00:00
Aaron Patterson 6fce8c7980 Don't try compacting ivars on Classes that are "too complex"
Too complex classes use a hash table to store ivs, and should always pin
their IVs.  We shouldn't touch those classes in compaction.
2023-11-20 16:09:48 -08:00
ima1zumi 7164715666 [ruby/irb] Enable Setting Completer Type through `IRB_COMPLETOR`
(https://github.com/ruby/irb/pull/771)

I propose introducing the capability to set the IRB completion kinds via an environment variable, specifically `IRB_COMPLETOR=type`.
This feature aims to enhance the Rails console experience by allowing Rails users to specify their preferred completion more conveniently.

Currently, when using the Rails console, there's no straightforward way to globally set the type completion across a Rails application repository.
It's possible to configure this setting by placing a `.irbrc` file at the project root. However, using a .irbrc file is not ideal as it allows for broad configurations and can potentially affect the production environment.
My suggestion focuses on allowing users to set the completion to 'type' in a minimal.

This enhancement would be particularly beneficial for teams writing RBS in their Rails applications.
This type completer, integrated with RBS, would enhance completion accuracy, improving the Rails console experience.

https://github.com/ruby/irb/commit/032f6da25f
2023-11-21 00:04:41 +00:00
Peter Zhu a182b2c5e1 Implement Enumerator objects on VWA
This commit implements Enumerator objects on VWA. This speeds allocations
and decreases memory usage.

```
require "benchmark"

ary = []

puts(Benchmark.measure do
  10_000_000.times do
    u = ary.to_enum
  end
end)

puts `ps -o rss= -p #{$$}`
```

Before:

```
  1.500774   0.002717   1.503491 (  1.506791)
 18512
```

After:

```
  0.892580   0.002539   0.895119 (  0.897642)
 16480
```
2023-11-20 18:59:01 -05:00
Peter Zhu ad03320743 Support declarative marked TypedData objects on VWA 2023-11-20 18:59:01 -05:00
Haldun Bayhantopcu 36afc11ece [ruby/prism] Fix locations derived from arguments.
(https://github.com/ruby/prism/pull/1897)

https://github.com/ruby/prism/commit/00b76ef254
2023-11-20 23:03:23 +00:00
Kevin Newton 914640eadd Use new match write targets 2023-11-20 18:00:44 -05:00
Kevin Newton e269096d15 [ruby/prism] Replace match write locals with match write targets
https://github.com/ruby/prism/commit/eec1862967
2023-11-20 18:00:44 -05:00
Takashi Kokubun fa547cd702
YJIT: Print a disasm path to stderr (#8967)
YJIT: Print a perf map path to stderr
2023-11-20 14:51:54 -08:00
Peter Zhu f376163194 Fix crash when evacuating generic ivar
When transitioning generic instance variable objects to too complex, we
set the shape first before performing inserting the new gen_ivtbl. The
st_insert for the new gen_ivtbl could allocate and cause a GC. If that
happens, then it will crash because the object will have a too complex
shape but not yet be backed by a st_table.

This commit changes the order so that the insert happens first before
the new shape is set.

The following script reproduces the issue:

```
o = []
o.instance_variable_set(:@a, 1)

i = 0
o = Object.new
while RubyVM::Shape.shapes_available > 0
  o.instance_variable_set(:"@i#{i}", 1)
  i += 1
end

ary = 1_000.times.map { [] }

GC.stress = true
ary.each do |o|
  o.instance_variable_set(:@a, 1)
  o.instance_variable_set(:@b, 1)
end
```
2023-11-20 16:57:24 -05:00
Jemma Issroff 103bbd21f8 [PRISM] Updated LocalVariableTargetNodes too 2023-11-20 13:48:46 -08:00
Jemma Issroff b913626bea [PRISM] Fix LocalVariableWriteNodes within blocks
Prior to this commit, we weren't recursing up scopes to look for
the local definition. With this commit, we do so, fixing local writes
within blocks
2023-11-20 13:48:46 -08:00
Maxime Chevalier-Boisvert f9628fb4be
YJIT: make --yjit-max-versions=N option undocumented (#8962)
Not useful for the vast majority of end users to change
this option.
2023-11-20 21:26:18 +00:00
Kevin Newton 323bec6295 RubyVM::InstructionSequence.compile_file_prism
* Provide a new API compile_file_prism which mirrors compile_file
but uses prism to parse/compile.
* Provide the ability to run test-all with RUBY_ISEQ_DUMP_DEBUG set
to "prism". If it is, we'll use the new compile_file_prism API to
load iseqs during the test run.
2023-11-20 12:45:29 -08:00
eileencodes 2796e4ece2 [PRISM] Implement once node for interpolated regex
This PR implements the once node on interpolated regexes.

There is a bug in Prism where the interpolated regex with the once flag
only works when there is not a local variable so the test uses a "1".
We'll need to fix that.
2023-11-20 12:42:05 -08:00
Jemma Issroff c5d5929443 [PRISM] Don't pop args to YieldNode 2023-11-20 12:12:34 -08:00
Lynne Ashminov 307a5cb20b [ruby/prism] adds encodings for ibm869
(https://github.com/ruby/prism/pull/1886)

https://github.com/ruby/prism/commit/41462400b7
2023-11-20 20:06:14 +00:00
Maple Ong 9fbdb26f06 [ruby/prism] Add and test ibm863 encoding
(https://github.com/ruby/prism/pull/1853)

* Add and test ibm863

* Remove dup encoding and add alias

* Update test/prism/encoding_test.rb

Co-authored-by: Kevin Newton <kddnewton@gmail.com>

* Readd bitfield table lol

---------

https://github.com/ruby/prism/commit/4cd756d7ff

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2023-11-20 20:06:00 +00:00
Peter Zhu 9d51ab8b3d Fix indentation [ci skip] 2023-11-20 13:43:31 -05:00
Jean Boussier ffb1eb37e7 proc.c: Make Method and UnboundMethod embded
Avoid some needless malloc churn

```
compare-ruby: ruby 3.3.0dev (2023-11-20T02:02:55Z master 701b0650de) [arm64-darwin22]
last_commit=[ruby/prism] feat: add encoding for IBM865 (https://github.com/ruby/prism/pull/1884)
built-ruby: ruby 3.3.0dev (2023-11-20T16:23:07Z embedded-methods e35284bfaa) [arm64-darwin22]
warming up..

|                         |compare-ruby|built-ruby|
|:------------------------|-----------:|---------:|
|allocate_method          |      8.413M|   12.333M|
|                         |           -|     1.47x|
|allocate_unbound_method  |      8.083M|   11.607M|
|                         |           -|     1.44x|
```

```
prelude: |
  class SomeClass
    def foo
    end
  end
  some_object = SomeClass.new
benchmark:
  allocate_method: some_object.method(:foo)
  allocate_unbound_method: SomeClass.instance_method(:foo)
```
2023-11-20 18:04:13 +01:00
Jean Boussier 5278742bf0 marshal.c: embed load and dump argument objects
This avoid a bit of needless malloc churn.
2023-11-20 17:43:01 +01:00
Jean Boussier 05028f4d55 compile.c: make pinned_list embedable
This saves some malloc churn for small pin lists.
2023-11-20 17:27:32 +01:00
Kevin Newton 5b0256e3c4 [ruby/prism] Disallow defining a numbered parameter method
(https://github.com/ruby/prism/pull/1797)

https://github.com/ruby/prism/commit/c13165e6aa
2023-11-20 16:12:50 +00:00
David Wessman f9fb05f9d0 [ruby/prism] feat: Adds macCroatian encoding
(https://github.com/ruby/prism/pull/1880)

* feat: Adds macCroatian encoding

- Based on:
https://en.wikipedia.org/wiki/Mac_OS_Croatian_encoding
https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/CROATIAN.TXT

Co-authored-by: Josefine Rost <nijrost@gmail.com>

* Use output from bin/encodings and adds to docs/encoding.md

---------

https://github.com/ruby/prism/commit/019a82d8f3

Co-authored-by: Josefine Rost <nijrost@gmail.com>
2023-11-20 16:07:19 +00:00
Kevin Newton f2ed7eaba0 [ruby/prism] Add character APIs for locations
(https://github.com/ruby/prism/pull/1809)

https://github.com/ruby/prism/commit/d493ccd093
2023-11-20 16:07:06 +00:00
Hiroya Fujinami adee7dab3e [ruby/prism] Correctly parse the `resuce` modifier in the rhs of the
assignments
(https://github.com/ruby/prism/pull/1879)

Fix https://github.com/ruby/prism/pull/1541

https://github.com/ruby/prism/commit/9fb276e1f4
2023-11-20 15:58:19 +00:00
Kevin Newton 75d85f3f6f [ruby/prism] Remove non-ASCII source characters
(https://github.com/ruby/prism/pull/1787)

https://github.com/ruby/prism/commit/5acc38a2f3
2023-11-20 15:53:22 +00:00
Hiroya Fujinami caa9ae7804 [ruby/prism] Fix parsing `...` in arguments
(https://github.com/ruby/prism/pull/1882)

* Fix parsing `...` in arguments

Fix https://github.com/ruby/prism/pull/1830
Fix https://github.com/ruby/prism/pull/1831

* Rename the constant name to PM_ERR_ARGUMENT_FORWARDING_UNBOUND

https://github.com/ruby/prism/pull/1882#discussion_r1398461156

https://github.com/ruby/prism/commit/519653aec2
2023-11-20 15:52:44 +00:00
Peter Zhu 83da4a7e62 Fix crash when iterating over generic ivars 2023-11-20 10:13:18 -05:00
eileencodes 4dd11c067d Switching first argument in pm_interpolated_node_compile
This changes the first argument in `pm_interpolated_node_compile` to use
a pointer.
2023-11-20 07:05:09 -08:00
Étienne Barrié 46ef74f270 Embed Thread::Backtrace::Location into Thread::Backtrace
Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2023-11-20 15:23:56 +01:00
Jean Boussier 83c385719d Specialize String#dup
`String#+@` is 2-3 times faster than `String#dup` because it can
directly go through `rb_str_dup` instead of using the generic
much slower `rb_obj_dup`.

This fact led to the existance of the ugly `Performance/UnfreezeString`
rubocop performance rule that encourage users to rewrite the much
more readable and convenient `"foo".dup` into the ugly `(+"foo")`.

Let's make that rubocop rule useless.

```
compare-ruby: ruby 3.3.0dev (2023-11-20T02:02:55Z master 701b0650de) [arm64-darwin22]
last_commit=[ruby/prism] feat: add encoding for IBM865 (https://github.com/ruby/prism/pull/1884)
built-ruby: ruby 3.3.0dev (2023-11-20T12:51:45Z faster-str-lit-dup 6b745bbc5d) [arm64-darwin22]
warming up..

|       |compare-ruby|built-ruby|
|:------|-----------:|---------:|
|uplus  |     16.312M|   16.332M|
|       |           -|     1.00x|
|dup    |      5.912M|   16.329M|
|       |           -|     2.76x|
```
2023-11-20 14:33:20 +01:00
Derek Moore 701b0650de [ruby/prism] feat: add encoding for IBM865
(https://github.com/ruby/prism/pull/1884)

* feat: add encoding for IBM865

* style: fix incorrect autoformat

https://github.com/ruby/prism/commit/14c6ae0182
2023-11-20 02:02:55 +00:00
Yuta Saito 9aee12cc28 [wasm] Enable more ext libraries on CI as much as possible 2023-11-19 11:52:57 +09:00
Burdette Lamar 37585fd62a [ruby/open3] [DOC] RDoc for Open3
(https://github.com/ruby/open3/pull/20)

https://github.com/ruby/open3/commit/4c9e7492eb
2023-11-19 02:42:33 +00:00
Hiroya Fujinami 8b4b0b7177 [ruby/prism] Don't add an invalid identifier capture to locals
(https://github.com/ruby/prism/pull/1836)

* Don't add an invalid identifier capture to locals

Fix https://github.com/ruby/prism/pull/1815

* Delay creating a MatchWriteNode

https://github.com/ruby/prism/pull/1836#discussion_r1393716600

https://github.com/ruby/prism/commit/635f595a36
2023-11-19 02:05:21 +00:00
Syed Faraaz Ahmad 5fea1d08bd [ruby/prism] feat: add encoding for ibm866
(https://github.com/ruby/prism/pull/1864)

Add encoding for ibm866

---------

https://github.com/ruby/prism/commit/1a96cc71f7

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2023-11-19 01:05:41 +00:00
Orhan Toy 5d2d0962cc [ruby/prism] Add GB1988 encoding
https://github.com/ruby/prism/commit/78d3fa7172
2023-11-19 01:05:11 +00:00
Orhan Toy 71a30b7596 [ruby/prism] Add macCyrillic encoding
https://github.com/ruby/prism/commit/220b40921a
2023-11-19 01:03:19 +00:00
Martin Emde db6492092f [ruby/prism] Fix typos in comments and docs
https://github.com/ruby/prism/commit/16b3d19758
2023-11-19 00:56:27 +00:00