| Age | Commit message (Collapse) | Author |
|
Classes/modules defined in a namespace are defined under ::Object
as usual (as without namespaces), and it'll be set into the const_tbl
of ::Object.
In namespaces, namespace objects' const_tbl is equal to the one of ::Object.
So constants of ::Object are just equal to constants of the namespace.
That means, top level classes/modules in a namespace can be referred
as namespace::KlassName without calling rb_define_class_under_id().
|
|
|
|
Fix: https://github.com/ruby/json/issues/873
This allow users to encode binary strings if they so wish.
e.g. they can use Base64 or similar, or chose to replace invalid
characters with something else.
https://github.com/ruby/json/commit/b1b16c416f
|
|
|
|
|
|
The following script leaks memory:
10.times do
100_000.times do
"\ufffd".encode(Encoding::US_ASCII, fallback: proc { Object.new })
rescue
end
puts `ps -o rss= -p #{$$}`
end
Before:
450244
887748
1325124
1762756
2200260
2637508
3075012
3512516
3950020
4387524
After:
12236
12364
12748
13004
13388
13516
13772
13772
13772
13772
|
|
https://github.com/ruby/json/commit/82b030f294
|
|
https://github.com/ruby/json/commit/f0150e2944
|
|
This fixes k-takata/Onigmo#120.
The commit k-takata/Onigmo@9c13de8d0684ebde97e3709d7693997c81ca374b was insufficient.
https://github.com/k-takata/Onigmo/commit/1de602ddff140d91419e3f86dd35c81d7bd2d8e7
|
|
Fixes k-takata/Onigmo#92.
This fix was ported from oniguruma:
https://github.com/kkos/oniguruma/commit/257082dac8c6019198b56324012f0bd1830ff4ba
https://github.com/k-takata/Onigmo/commit/b1a5445fbeba97b3e94a733c2ce11c033453af73
|
|
Currently, some methods' behavior(e.g. `URI.parse`) don't change
when switching a parser. This is because some methods use
`DEFAULT_PARSER`, but `parser=` doesn't change `DEFAULT_PARSER`.
This PR introduces a constant to keep a parser's instance and
change it when switching a parser. Also, change to use it in
methods.
https://github.com/ruby/uri/commit/aded210709
|
|
Followup to https://github.com/ruby/prism/pull/2213
Before:
```sh
$ ruby -ve "puts 42.~@"
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/prism/commit/dbd83256b1) +PRISM [x86_64-linux]
-e:1:in '<main>': undefined method '~@' for an instance of Integer (NoMethodError)
Did you mean? ~
```
After (matches parse.y):
```sh
$ ./miniruby -ve "puts 42.~@"
ruby 3.5.0dev (2025-10-16T03:40:45Z master https://github.com/ruby/prism/commit/1d95d75c3f) +PRISM [x86_64-linux]
-43
```
https://github.com/ruby/prism/commit/a755bf228f
|
|
https://github.com/ruby/json/commit/9c4db31908
Co-Authored-By: Jean Boussier <jean.boussier@gmail.com>
|
|
This value is dword, not a string.
Amends https://github.com/ruby/resolv/commit/720e25034042.
https://github.com/ruby/resolv/commit/bf00ed8585
|
|
wrong kwargs
This commit fixes the case when there are multiple missing or incorrect
keywords provided to a method. Without this fix, ErrorHighlight itself
will raise an exception
https://github.com/ruby/error_highlight/commit/8bde92b36e
|
|
The following script leaks memory:
10.times do
100_000.times do
"\ufffd".encode(Encoding::US_ASCII, fallback: proc { "\uffee" })
rescue
end
puts `ps -o rss= -p #{$$}`
end
Before:
451196
889596
1328252
1766524
2204668
2643068
3081724
3520124
3958524
4396796
After:
12800
13056
13184
13312
13312
13312
13312
13312
13312
13312
|
|
|
|
|
|
`Time#nsec` and `Time#subsec` were both introduced in Ruby 1.9.
https://github.com/ruby/date/commit/2c310d9f5c
|
|
https://github.com/ruby/date/commit/fd8e3725f8
|
|
|
|
|
|
This prevents a generic RuntimeError from being raised so we can ensure
that the correct error is being rescued.
|
|
The method and aref cases need to accept a parameter.
|
|
It's a call_threshold: 2 test
https://github.com/ruby/ruby/pull/14933#discussion_r2469731499
|
|
Fixes https://github.com/Shopify/ruby/issues/814
This change specializes the case of calling `Array#pop` on a non frozen array with no arguments. `Array#pop` exists in the non-inlined C function list in the ZJIT SFR performance burndown list.
If in the future it is helpful, this patch could be extended to support the case where an argument is provided, but this initial work seeks to elide the ruby frame normally pushed in the case of `Array#pop` without an argument.
|
|
https://github.com/ruby/rubygems/commit/81dbd42abf
|
|
https://github.com/ruby/rubygems/commit/15e46a3a68
|
|
Overview
This PR uses the [jdk.incubator.vector module](https://docs.oracle.com/en/java/javase/20/docs/api/jdk.incubator.vector/jdk/incubator/vector/package-summary.html) as mentioned in [issue #739](https://github.com/ruby/json/issues/739) to accelerate generating JSON with the same algorithm as the C extension.
The PR as it exists right now, it will attempt to build the `json.ext.VectorizedEscapeScanner` class with a target release of `16`. This is the first version of Java with support for the `jdk.incubator.vector` module. The remaining code is built for Java 1.8. The code will attempt to load the `json.ext.VectorizedEscapeScanner` only if the `json.enableVectorizedEscapeScanner` system property is set to `true` (or `1`).
I'm not entirely sure how this is packaged / included with JRuby so I'd love @byroot and @headius's (and others?) thought about how to potential package and/or structure the JARs. I did consider adding the `json.ext.VectorizedEscapeScanner` to a separate `generator-vectorized.jar` but I thought I'd solicit feedback before spending any more time on the build / package process.
Benchmarks
Machine M1 Macbook Air
Note: I've had trouble modifying the `compare.rb` I was using for the C extension to work reliability with the Java extension. I'll probably spend more time trying to get it to work, but as of right now these are pretty raw benchmarks.
Below are two sample runs of the real-world benchmarks. The benchmarks are much more variable then the C extension for some reason. I'm not sure if HotSpot is doing something slightly different per execution.
Vector API Enabled
```
scott@Scotts-MacBook-Air json % ONLY=json JAVA_OPTS='--add-modules jdk.incubator.vector -Djson.enableVectorizedEscapeScanner=true' ruby -I"lib" benchmark/encoder-realworld.rb
WARNING: Using incubator modules: jdk.incubator.vector
== Encoding activitypub.json (52595 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 1.384k i/100ms
Calculating -------------------------------------
json 15.289k (± 0.8%) i/s (65.41 μs/i) - 153.624k in 10.048481s
== Encoding citm_catalog.json (500298 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 76.000 i/100ms
Calculating -------------------------------------
json 753.787 (± 3.6%) i/s (1.33 ms/i) - 7.524k in 9.997059s
== Encoding twitter.json (466906 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 173.000 i/100ms
Calculating -------------------------------------
json 1.751k (± 1.1%) i/s (571.24 μs/i) - 17.646k in 10.081260s
== Encoding ohai.json (20147 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 2.390k i/100ms
Calculating -------------------------------------
json 23.829k (± 0.8%) i/s (41.97 μs/i) - 239.000k in 10.030503s
```
Vector API Disabled
```
scott@Scotts-MacBook-Air json % ONLY=json JAVA_OPTS='--add-modules jdk.incubator.vector -Djson.enableVectorizedEscapeScanner=false' ruby -I"lib" benchmark/encoder-realworld.rb
WARNING: Using incubator modules: jdk.incubator.vector
VectorizedEscapeScanner disabled.
== Encoding activitypub.json (52595 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 1.204k i/100ms
Calculating -------------------------------------
json 12.937k (± 1.1%) i/s (77.30 μs/i) - 130.032k in 10.052234s
== Encoding citm_catalog.json (500298 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 80.000 i/100ms
Calculating -------------------------------------
json 817.378 (± 1.0%) i/s (1.22 ms/i) - 8.240k in 10.082058s
== Encoding twitter.json (466906 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 147.000 i/100ms
Calculating -------------------------------------
json 1.499k (± 1.3%) i/s (667.08 μs/i) - 14.994k in 10.004181s
== Encoding ohai.json (20147 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 2.269k i/100ms
Calculating -------------------------------------
json 22.366k (± 5.7%) i/s (44.71 μs/i) - 224.631k in 10.097069s
```
`master` as of commit `https://github.com/ruby/json/commit/c5af1b68c582`
```
scott@Scotts-MacBook-Air json % ONLY=json ruby -I"lib" benchmark/encoder-realworld.rb
== Encoding activitypub.json (52595 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 886.000 i/100ms
Calculating -------------------------------------
json^C%
scott@Scotts-MacBook-Air json % ONLY=json ruby -I"lib" benchmark/encoder-realworld.rb
== Encoding activitypub.json (52595 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 1.031k i/100ms
Calculating -------------------------------------
json 10.812k (± 1.3%) i/s (92.49 μs/i) - 108.255k in 10.014260s
== Encoding citm_catalog.json (500298 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 82.000 i/100ms
Calculating -------------------------------------
json 824.921 (± 1.0%) i/s (1.21 ms/i) - 8.282k in 10.040787s
== Encoding twitter.json (466906 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 141.000 i/100ms
Calculating -------------------------------------
json 1.421k (± 0.7%) i/s (703.85 μs/i) - 14.241k in 10.023979s
== Encoding ohai.json (20147 bytes)
jruby 9.4.12.0 (3.1.4) 2025-02-11 https://github.com/ruby/json/commit/f4ab75096a Java HotSpot(TM) 64-Bit Server VM 21.0.7+8-LTS-245 on 21.0.7+8-LTS-245 +jit [arm64-darwin]
Warming up --------------------------------------
json 2.274k i/100ms
Calculating -------------------------------------
json 22.612k (± 0.9%) i/s (44.22 μs/i) - 227.400k in 10.057516s
```
Observations
`activitypub.json` and `twitter.json` seem to be consistently faster with the Vector API enabled. `citm_catalog.json` seems consistently a bit slower and `ohai.json` is fairly close to even.
https://github.com/ruby/json/commit/d40b2703a8
|
|
Fixes [Bug #21648]
This is a followup to https://github.com/ruby/ruby/pull/13597.
The added test passed but didn't emit the same instructions.
This also handles bare splats and aligns instructions for all cases
|
|
Previous commits removed all usages of those small keys.
https://github.com/ruby/openssl/commit/f9d87d7912
|
|
Use generic keys whenever possible.
https://github.com/ruby/openssl/commit/73d6a25360
|
|
Use generic keys whenever possible.
https://github.com/ruby/openssl/commit/90d6af60b9
|
|
Use generic keys whenever possible.
https://github.com/ruby/openssl/commit/cc4d40525c
|
|
Use generic keys whenever possible.
https://github.com/ruby/openssl/commit/ef4fa5e9b4
|
|
Use generic keys whenever possible.
https://github.com/ruby/openssl/commit/689fc271b1
|
|
Replace fixed-sized RSA keys with the generic rsa-{1,2,3}.pem keys.
Those test cases do not depend on specific keys or key sizes, and just
need several different keys.
Replace DSA keys with EC keys so that we can run more tests in the FIPS
mode, which do not seem to support DSA anymore.
Also, clean up duplicate test cases using very small keys or obsolete
hash functions.
rake test_fips no longer skips those test cases.
https://github.com/ruby/openssl/commit/3f3105429a
|
|
```
TestResolvDNS#test_no_server:
Test::Unit::ProxyError: Timeout::Error
/path/to/ruby/test/resolv/test_dns.rb:531:in 'TestResolvDNS#test_no_server'
```
|
|
Fixes a segmentation fault when moving nested objects between ractors with GC stress enabled and YJIT.
The issue is a timing problem: `move_enter` allocates new object shells but leaves their contents uninitialized until `move_leave` copies the actual data. If GC runs between these steps (which GC stress makes likely), it tries to follow what appear to be object pointers but are actually uninitialized memory, encountering null or invalid addresses.
The fix zero-initializes the object contents immediately after allocation in `move_enter`, ensuring the GC finds safe null pointers instead of garbage data.
The crash reproduced most consistently with nested hashes and YJIT, likely because nested structures create multiple uninitialized objects simultaneously while YJIT's memory usage increases the probability of GC triggering during moves.
|
|
To detect breaking namespace features on CI.
|
|
Probably since macOS Runner Image Version 20251020.XXXX, spawned
processes initialize `TMPDIR` environment variable under the hood.
|
|
And `LD_PRELOAD` is set to `PRELOADENV` on Linux.
|
|
Use array_of_integer.sort! instead of buble-sort-like algorithm
|
|
Fix: https://github.com/rails/rails/commit/90616277e3d8fc46c9cf35d6a7470ff1ea0092f7#r168784389
Because the `depth` counter is inside `JSON::State` it can't be used
concurrently, and in case of a circular reference the counter may be
left at the max value.
The depth counter should be moved outside `JSON_Generator_State` and
into `struct generate_json_data`, but it's a larger refactor.
In the meantime, `JSON::Coder` calls `State#generate_new` so I changed
that method so that it first copy the state on the stack.
https://github.com/ruby/json/commit/aefa671eca
|
|
When the fallback function in transcode_loop raises, it will leak the memory
in rb_econv_t. The following script reproduces the leak:
10.times do
100_000.times do
"\ufffd".encode(Encoding::US_ASCII, fallback: proc { raise })
rescue
end
puts `ps -o rss= -p #{$$}`
end
Before:
451196
889980
1328508
1767676
2206460
2645372
3083900
3522428
3960956
4399484
After:
12508
12636
12892
12892
13148
13404
13532
13788
13916
13916
|
|
This commit adds tests that raise on `getclassvariable` and
`setclassvariable` to exercise the non-leaf cases as suggested in
https://github.com/ruby/ruby/pull/14918#discussion_r2453804603
|
|
https://github.com/Shopify/ruby/issues/649
Class vars are a bit more involved than ivars, since we need to get the
class from the cref, so this calls out to `rb_vm_getclassvariable` and
`rb_vm_setclassvariable` like YJIT.
|
|
https://github.com/ruby/rubygems/commit/3946be008c
|
|
Fix https://github.com/Shopify/ruby/issues/832
|
|
https://github.com/ruby/prism/commit/17a6a19bbae5c8b438a94816ed67c3852547d859 broke ruby/ruby CI
because some tests are only run against parse.y
This will catch that in the future.
https://github.com/ruby/prism/commit/98e1cd5c04
|