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

12002 Коммитов

Автор SHA1 Сообщение Дата
Kevin Newton 8ab56869a6 Rename YARP filepaths to prism filepaths 2023-09-27 13:57:38 -04:00
Kevin Newton 5f905026bc [ruby/yarp] Move node ext and parse result to their own files
https://github.com/ruby/yarp/commit/916828767c
2023-09-27 12:10:23 -04:00
Kevin Newton 7d11f58b6e [ruby/yarp] Move lex compat into its own file
https://github.com/ruby/yarp/commit/e90f88f21f
2023-09-27 12:10:23 -04:00
Kevin Newton 3e8aa3d1cc [ruby/yarp] Move node inspector into its own file
https://github.com/ruby/yarp/commit/1c843d2f22
2023-09-27 12:10:23 -04:00
Kevin Newton 978f91a10c [ruby/yarp] Move debug into its own file
https://github.com/ruby/yarp/commit/139362c90a
2023-09-27 12:10:23 -04:00
Kevin Newton aeb53cb50e [ruby/yarp] More documentation for desugar compiler
https://github.com/ruby/yarp/commit/4a6df3c2a4
2023-09-27 12:10:23 -04:00
Kevin Newton b18e05b18f [ruby/yarp] Split up compiler versus visitor
https://github.com/ruby/yarp/commit/2e6baa3f19
2023-09-27 12:10:23 -04:00
Kevin Newton 2a4a55f896 [ruby/yarp] Move DSL into its own file
https://github.com/ruby/yarp/commit/3d34404d80
2023-09-27 12:10:23 -04:00
Kevin Newton 1c049c64c0 [ruby/yarp] Move BasicVisitor below ParseResult in yarp.rb
https://github.com/ruby/yarp/commit/d51014582a
2023-09-27 12:10:23 -04:00
Kevin Newton 28cc144b63 [ruby/yarp] Move more features under autoload
https://github.com/ruby/yarp/commit/2f1f3fa448
2023-09-27 12:10:23 -04:00
Kevin Newton af8d475281 [ruby/yarp] Move dispatcher into its own autoload
https://github.com/ruby/yarp/commit/52bd001ea2
2023-09-27 12:10:23 -04:00
Kevin Newton be861053c5 [ruby/yarp] Use less magical numbers for regular expression flags
https://github.com/ruby/yarp/commit/c6a0abdd24
2023-09-27 12:10:23 -04:00
Ry Biesemeyer bece880874 [rubygems/rubygems] Centralize logic using `Pathname#relative_path_from`
To avoid potential crashes when trying to jump from a drive to another
on Windows, and take the change refactor things a bit.

https://github.com/rubygems/rubygems/commit/7c9a9a431a
2023-09-27 05:20:58 +00:00
David Rodriguez a812f1fed0 [rubygems/rubygems] Reword a couple of error messages
When a path does not make a lot of sense.

https://github.com/rubygems/rubygems/commit/d173c79e9a
2023-09-27 05:20:57 +00:00
krororo bc664609df [rubygems/rubygems] Refactor full sha revision match logic
https://github.com/rubygems/rubygems/commit/f0d8255ebd
2023-09-27 05:18:10 +00:00
krororo fbee93fc19 [rubygems/rubygems] Fix bundle install when older revisions of git source
https://github.com/rubygems/rubygems/commit/a30712c0fc
2023-09-27 05:18:10 +00:00
David Rodriguez 57c3e45ee8 [rubygems/rubygems] Fix `bundle lock --minor --update <dep>` edge case
When the latest allowed minor of `dep` adds a new dependency, that new
dependency would be incorrectly resolved to the latest minor of the
first major version.

https://github.com/rubygems/rubygems/commit/fd50c9d4f3
2023-09-27 03:29:37 +00:00
elfham 3f1cfc43bd [ruby/reline] Fix config.rb to File.expand_path $include path in
inputrc
(https://github.com/ruby/reline/pull/592)

* Fix config.rb to File.expand_path $include path in inputrc

* fix bug of test_include_expand_path on Windows

https://github.com/ruby/reline/commit/4d34e52d0b
2023-09-26 13:08:20 +00:00
elfham 766b06dfa3 [ruby/reline] Update to Unicode 15.1.0
(https://github.com/ruby/reline/pull/591)

https://github.com/ruby/reline/commit/c2fc1f771a
2023-09-25 14:28:21 +00:00
David Rodriguez 0e808183ee [rubygems/rubygems] Allow standalone mode to work on a Windows edge case
If a gem is located in a different drive than the Gemfile, standalone
mode will fail to generate the `bundler/setup` script, failing with an
error like

```
ArgumentError: different prefix: "C:/" and "D:/a/rubygems/rubygems/bundler/tmp/2/bundled_app/bundle/bundler"
  C:/hostedtoolcache/windows/Ruby/3.0.5/x64/lib/ruby/3.0.0/pathname.rb:528:in `relative_path_from'
  D:/a/rubygems/rubygems/bundler/tmp/2/gems/system/gems/bundler-2.4.20/lib/bundler/installer/standalone.rb:58:in `gem_path'
  D:/a/rubygems/rubygems/bundler/tmp/2/gems/system/gems/bundler-2.4.20/lib/bundler/installer/standalone.rb:33:in `block (2 levels) in paths'
  D:/a/rubygems/rubygems/bundler/tmp/2/gems/system/gems/bundler-2.4.20/lib/bundler/installer/standalone.rb:32:in `map'
  D:/a/rubygems/rubygems/bundler/tmp/2/gems/system/gems/bundler-2.4.20/lib/bundler/installer/standalone.rb:32:in `block in paths'
```

I'm fixing this by falling back to using a full path in this case.

This was caught by a failing spec, so I'm not adding new specs.

https://github.com/rubygems/rubygems/commit/3cb9b9ab7a
2023-09-25 07:13:21 +00:00
Hartley McGuire e581b78ed2 Improve performance of include? by 5-10x
Rails uses IPAddr#include? to evaluate what it should use as the
client's remote ip by filtering potential ips against a trusted list
of internal ips. In a _very_ minimal app, #include? was showing up in
a profile as ~1% of request time.

The issue is that #include? was converting itself and the other value
passed in to ranges of IPAddr. This mean as a worst case (where other is
a non-IPAddr, like a String) then there would be 5 IPAddr instances
created (other -> IPAddr, and two each for the conversions to ranges).
However, wrapping the begin and end values as IPAddr is not needed
because they are necessarily fixed addresses already.

This patch extracts the logic for getting the begin_addr and end_addr
from the #to_range method so that they can be used in #include? without
having to instantiate so many IPAddr.

Benchmark:

```ruby
net1 = IPAddr.new("192.168.2.0/24")
net2 = IPAddr.new("192.168.2.100")
net3 = IPAddr.new("192.168.3.0")
net4 = IPAddr.new("192.168.2.0/16")

Benchmark.ips do |x|
  x.report("/24 includes address") { net1.include? net2 }
  x.report("/24 not includes address") { net1.include? net3 }
  x.report("/16 includes /24") { net4.include? net1 }
  x.report("/24 not includes /16") { net1.include? net4 }
  x.compare!
end
```

Before:

```
Comparison:
    /24 not includes /16:   175041.3 i/s
/24 not includes address:   164933.2 i/s - 1.06x  (± 0.00) slower
        /16 includes /24:   163881.9 i/s - 1.07x  (± 0.00) slower
    /24 includes address:   163558.4 i/s - 1.07x  (± 0.00) slower
```

After:

```
Comparison:
    /24 not includes /16:  2588364.9 i/s
/24 not includes address:  1474650.7 i/s - 1.76x  (± 0.00) slower
        /16 includes /24:  1461351.0 i/s - 1.77x  (± 0.00) slower
    /24 includes address:  1425463.5 i/s - 1.82x  (± 0.00) slower
```
2023-09-23 02:22:25 +00:00
Haldun Bayhantopcu c54e225f34 [ruby/yarp] Introduce YP_TOKEN_METHOD_NAME
https://github.com/ruby/yarp/commit/e855bf415c
2023-09-22 15:47:56 +00:00
BurdetteLamar 170e622aad [ruby/prettyprint] [DOC] Link fixes
https://github.com/ruby/prettyprint/commit/f1f583c827
2023-09-22 13:58:45 +00:00
Stan Lo f59b488b5a [ruby/irb] Page show_source's output
(https://github.com/ruby/irb/pull/719)

https://github.com/ruby/irb/commit/3cedc5cb62
2023-09-22 13:00:32 +00:00
BurdetteLamar 48b141b49d [ruby/pstore] [DOC] Link fixes
https://github.com/ruby/pstore/commit/3f328a1e0e
2023-09-21 21:08:28 +00:00
Samuel Giddins 5c11dea40c [rubygems/rubygems] Reduce allocations when parsing lockfile
```
==> memprof.after.txt <==
Total allocated: 673.08 kB (7644 objects)
Total retained:  107.35 kB (1018 objects)

==> memprof.before.txt <==
Total allocated: 739.12 kB (9140 objects)
Total retained:  138.61 kB (1695 objects)
```

Savings will scale by the number of lines in the lockfile

https://github.com/rubygems/rubygems/commit/f6abf4439c
2023-09-21 19:53:56 +00:00
Samuel Giddins 812c8196b6 [rubygems/rubygems] Remove usage of Dir.chdir that just execute a subprocess
Preferring instead to spawn the subprocess in the correct directory

https://github.com/rubygems/rubygems/commit/ad5abd6a45
2023-09-21 18:30:37 +00:00
Samuel Giddins e9ed0b3068 [rubygems/rubygems] Stop bundler eagerly loading all specs with exts
We were setting the wrong `extension_dir` for git specs stubs

Additionally, the call to `self.extension_dir` was loading the
remote spec, which was avoidable since the stub had an extension dir
(and in fact its #gem_build_complete_path does exactly what we want
anyway)

Finally, now set the base_dir when loading the remote_spec from a
stub specification, since the git source sets the base dir for stubs
based on where the spec _will_ be installed to, and we want to preserve
that so the base_dir for the loaded spec & the stub are the same

https://github.com/rubygems/rubygems/commit/a94acb465b
2023-09-21 18:28:54 +00:00
Samuel Giddins 02fa2acbde [rubygems/rubygems] Freeze more strings in generated gemspecs
Specifically, this will have frozen string literals for:
- Gem platform tuple entries
- Gem::Version strings
- Gem::Specification#installed_by_version
- Dependency requirement strings

https://github.com/rubygems/rubygems/commit/6195da5bdb
2023-09-21 18:25:04 +00:00
Samuel Giddins 0a423d4c4e [rubygems/rubygems] Aggressively optimize allocations in SafeMarshal
Reduces allocations in a bundle install --full-index by an order of magnitude

Main wins are (a) getting rid of exessive string allocations for exception message stack

(b) Avoiding hash allocations caused by kwargs for #initialize

(c) avoid using unpack to do bit math, its easy enough to do by hand

(d) special case the most common elements so they can be read without an allocation

(e) avoid string allocations every time a symbol->string lookup is done by using symbol#name

https://github.com/rubygems/rubygems/commit/7d2ee51402
2023-09-21 07:40:58 +00:00
Jemma Issroff d6abca459f [ruby/yarp] Print locations using line / col instead of offsets
This commit changes printing of locations to use the format
(start_line,start_column)-(end_line,end_column) instead of using
offsets.

https://github.com/ruby/yarp/commit/c078696e22
2023-09-20 18:30:34 +00:00
Samuel Giddins 843c83ee5f [rubygems/rubygems] Give up, load Time via Marshal.load
https://github.com/rubygems/rubygems/commit/6c92ba2ba3
2023-09-20 02:03:04 +00:00
Samuel Giddins cadca9f67e [rubygems/rubygems] All rubies working with different time zones
Tested with:

`ruby -e 'trap("INT") { exit 1 }; TZ=%w[UTC +0000 -0000]; RUBY=%w[ruby-2.7 ruby-3.2.2 jruby-9.4 truffleruby-22 truffleruby-23]; TZ.product(RUBY).each { |t, r| puts ?**120, "TZ=#{t} RUBY=#{r}", "*"*120; system({"TZ"=>t,"RUBY"=>r}, *ARGV) }' zsh -lic 'chruby $RUBY; ruby -vw -Ilib test/rubygems/test_gem_safe_marshal.rb --verbose=progress'`

https://github.com/rubygems/rubygems/commit/6192005afb
2023-09-20 02:03:03 +00:00
Samuel Giddins c65c88e65c [rubygems/rubygems] Tests passing on truffleruby 22 in addition to 23
https://github.com/rubygems/rubygems/commit/8065530d43
2023-09-20 02:03:03 +00:00
Samuel Giddins e52f9bd41e [rubygems/rubygems] Bundler error handling
https://github.com/rubygems/rubygems/commit/63b422b71a
2023-09-20 02:03:02 +00:00
Samuel Giddins f0d1b0cc4b [rubygems/rubygems] Allow bundler to load from the dependency api
https://github.com/rubygems/rubygems/commit/3303957286
2023-09-20 02:03:01 +00:00
Samuel Giddins fe90e83b48 [rubygems/rubygems] Use safe_load in bundler when available
https://github.com/rubygems/rubygems/commit/34d096e38a
2023-09-20 02:03:01 +00:00
Samuel Giddins 1fff3e44ff [rubygems/rubygems] Verified working on mri/jruby/truffleruby with specs on rubygems.org
https://github.com/rubygems/rubygems/commit/4f51741cc6
2023-09-20 02:03:00 +00:00
Samuel Giddins cdcc760dc0 [rubygems/rubygems] Broader version compatibility in marshal tests
https://github.com/rubygems/rubygems/commit/6ec518c563
2023-09-20 02:02:59 +00:00
Samuel Giddins c80a4d453a [rubygems/rubygems] Fix UTC time loading
https://github.com/rubygems/rubygems/commit/2a4d0a44b0
2023-09-20 02:02:58 +00:00
Samuel Giddins d182d83ce9 [rubygems/rubygems] Add a Marshal.load replacement that walks an AST to safely load permitted classes/symbols
https://github.com/rubygems/rubygems/commit/7e4478fe73
2023-09-20 02:02:58 +00:00
Benoit Daloze 7fc73ab5f6 [ruby/yarp] Only keep semantic fields in Java, i.e. skip location fields
* Add $YARP_SERIALIZE_ONLY_SEMANTICS_FIELDS to control where to serialize location fields at templating time,
  this way there is no overhead for either case and nothing to check at runtime.
* Add a byte in the header to indicate whether location fields are included as expected.
* Fixes https://github.com/ruby/yarp/issues/807
* Simplify the build-java CI job now that the FFI backend is available so JRuby can serialize.
* Support keeping some location fields which are still needed until there is a replacement

https://github.com/ruby/yarp/commit/fc5cf2df12
2023-09-19 17:20:01 +00:00
Kevin Newton 4da53fd3a7 [ruby/yarp] Better Node#pretty_print
Respect the current indentation

https://github.com/ruby/yarp/commit/068333ef49
2023-09-19 16:57:46 +00:00
Samuel Giddins 4023637d20 [rubygems/rubygems] Reduce allocations for stub specifications
This helps with memory usage during application boot time

```
==> memprof.after.txt <==
Total allocated: 1.43 MB (18852 objects)
Total retained:  421.12 kB (4352 objects)

==> memprof.before.txt <==
Total allocated: 2.43 MB (28355 objects)
Total retained:  469.69 kB (5425 objects)
```

See https://bugs.ruby-lang.org/issues/19890 about the readline
allocations

https://github.com/rubygems/rubygems/commit/d7eb66eee3
2023-09-19 07:25:51 +00:00
Samuel Giddins cea7e6ecca [rubygems/rubygems] Lazily construct fetcher debug messages
Avoids constructing several strings

https://github.com/rubygems/rubygems/commit/8a322dbe11
2023-09-19 07:14:53 +00:00
nick evans dfb2b4cbc9 [ruby/securerandom] Add support for UUID version 7
Although the specification for UUIDv7 is still in draft, the UUIDv7
algorithm has been relatively stable as it progresses to completion.

Version 7 UUIDs can be very useful, because they are lexographically
sortable, which can improve e.g: database index locality.  See section
6.10 of the draft specification for further explanation:

  https://datatracker.ietf.org/doc/draft-ietf-uuidrev-rfc4122bis/

The specification allows up to 12 bits of extra timestamp precision, to
make UUID generation closer to monotonically increasing.  This provides
between 1ms and ~240ns of timestamp precision.  At the cost of some code
complexity and a small performance penalty, a kwarg may specify any
arbitrary precision between 0 and 12 extra bits.  Any stronger
guarantees of monotonicity have considerably larger tradeoffs, so
nothing more is implemented.  This limitation is documented.

Ruby issue: https://bugs.ruby-lang.org/issues/19735

https://github.com/ruby/securerandom/commit/34ed1a2ec3
2023-09-19 01:55:27 +00:00
0x1eef e77c766b7a [ruby/net-http] No longer neccessary to call `String#freeze` on string literals.
See #144

https://github.com/ruby/net-http/commit/5a986c13d3
2023-09-19 01:32:18 +00:00
Yoshiki Takagi 465c222ef1 [rubygems/rubygems] Bump actions/checkout to v4 in bundler gem template
https://github.com/rubygems/rubygems/commit/5ed4c600da
2023-09-19 01:06:35 +00:00
Jeremy Evans 230834d9bb [ruby/base64] Bump required_ruby_version to 2.4.0
The gem depends on String#unpack1, which was introduced in Ruby 2.4.

https://github.com/ruby/base64/commit/9f0e4ba155
2023-09-19 01:04:54 +00:00
Kevin Newton 1636f6abd6 [ruby/yarp] Use compact_child_nodes where possible
https://github.com/ruby/yarp/commit/c1911fa9b1
2023-09-18 17:48:52 +00:00