summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-12-05Add openssl reformatting to .git-blame-ignore-revs [ci skip]Kazuki Yamaguchi
2025-12-05fix typo s/sharable/shareable/Koichi Sasada
2025-12-04[ruby/openssl] Expand tabs in C source filesKazuki Yamaguchi
Since around 2018, we have been using spaces for indentation for newly added code[1]. The mixed use of tabs and spaces has repeatedly confused new contributors who configured their editors to use a different tab size than 8. Since git blame can now skip specific commits, ruby/ruby did a mass reformatting of tabs in 2022[2]. Do the same in ruby/openssl. While at it, fix a few indentation issues, mainly in switch-case labels and in ossl_ssl_session.c, which used doubled indentation size. This patch contains white-space changes only. git diff -w output should be empty. [1] https://bugs.ruby-lang.org/issues/14246 [2] https://bugs.ruby-lang.org/issues/18891 https://github.com/ruby/openssl/commit/4d6214f507
2025-12-04[ruby/openssl] Revert "rewriting most of the asn1 init code in ruby"Kazuki Yamaguchi
This reverts commit https://github.com/ruby/openssl/commit/830505172882. The commit is part of the bigger effort to rewrite OpenSSL::ASN1 in Ruby. OpenSSL::ASN1 is relatively isolated from the rest of ruby/openssl and is not tightly bound to the OpenSSL API. The current implementation also needs a major refactor for several reasons, so this remains a long-term goal. However, the work is not yet complete. We are close to releasing v4.0.0, and we want to avoid shipping fragmented code in a stable branch. The changes can be reapplied when the rest is ready. https://github.com/ruby/openssl/commit/362942dcbf
2025-12-05Method and UnboundMethod can be sharableKoichi Sasada
with `RUBY_TYPED_FROZEN_SHAREABLE_NO_REC`, if the receiver object is shareable on Method objects.
2025-12-05(experimental) RUBY_TYPED_FROZEN_SHAREABLE_NO_RECKoichi Sasada
`T_DATA` has a flag `RUBY_TYPED_FROZEN_SHAREABLE` which means if the `T_DATA` object is frozen, it can be sharable. On the `Ractor.make_sharable(obj)`, rechable objects from the `T_DATA` object will be apply `Ractor.make_shareable` recursively. `RUBY_TYPED_FROZEN_SHAREABLE_NO_REC` is similar to the `RUBY_TYPED_FROZEN_SHAREABLE`, but doesn't apply `Ractor.make_sharable` recursively for children. If it refers to unshareable objects, it will simply raise an error. I'm not sure this pattern is common or not, so it is not in public. If we find more cases, we can discuss publication.
2025-12-04Remove mismatched indentations warning (#15410)Étienne Barrié
2025-12-05Refine non-nil warnings for the deprecated variablesNobuyoshi Nakada
2025-12-05[Bug #21764] Propagate the encoding of ID to warningNobuyoshi Nakada
2025-12-04[ruby/prism] Fix `%Q` with newline delimiter and heredoc interpolationEarlopain
The lexer did not jump to the `heredoc_end`, causing the heredoc end delimiter to be parsed twice. Normally the heredocs get flushed when a newline is encountered. But because the newline is part of the string delimiter, that codepath is not taken. Fixes [Bug #21758] https://github.com/ruby/prism/commit/7440eb4b11
2025-12-04[DOC] Fix a macro nameNobuyoshi Nakada
2025-12-04Deprecate `rb_eval_cmd_kw`Nobuyoshi Nakada
2025-12-04Add `rb_eval_cmd_call_kw` to shortcutNobuyoshi Nakada
2025-12-04Ractor.store_if_absent should not warnKoichi Sasada
```ruby $VERBOSE = true Ractor.store_if_absent :key do end #=> warning: the block passed to 'Ractor.store_if_absent' defined at <internal:ractor>:474 may be ignored ```
2025-12-04Update default gems list at d343968ec3a899a29ff4e330dc914d [ci skip]git
2025-12-04[ruby/json] Release 2.17.1Jean Boussier
https://github.com/ruby/json/commit/e5e4fd558e
2025-12-04[ruby/json] Fix a regression in parsing of unicode surogate pairsJean Boussier
Fix: https://github.com/ruby/json/issues/912 In the case of surogate pairs we consume two backslashes, so `json_next_backslash` need to ensure it's not sending us back in the stream. https://github.com/ruby/json/commit/0fce370c41
2025-12-04[ruby/rubygems] Increase connection pool to allow for up to 70% speed increase:Edouard CHIN
- ### TL;DR Bundler is heavily limited by the connection pool which manages a single connection. By increasing the number of connection, we can drastiscally speed up the installation process when many gems need to be downloaded and installed. ### Benchmark There are various factors that are hard to control such as compilation time and network speed but after dozens of tests I can consistently get aroud 70% speed increase when downloading and installing 472 gems, most having no native extensions (on purpose). ``` # Before bundle install 28.60s user 12.70s system 179% cpu 23.014 total # After bundle install 30.09s user 15.90s system 281% cpu 16.317 total ``` You can find on this gist how this was benchmarked and the Gemfile used https://gist.github.com/Edouard-chin/c8e39148c0cdf324dae827716fbe24a0 ### Context A while ago in #869, Aaron introduced a connection pool which greatly improved Bundler speed. It was noted in the PR description that managing one connection was already good enough and it wasn't clear whether we needed more connections. Aaron also had the intuition that we may need to increase the pool for downloading gems and he was right. > We need to study how RubyGems uses connections and make a decision > based on request usage (e.g. only use one connection for many small > requests like bundler API, and maybe many connections for > downloading gems) When bundler downloads and installs gem in parallel https://github.com/ruby/rubygems/blob/4f85e02fdd89ee28852722dfed42a13c9f5c9193/bundler/lib/bundler/installer/parallel_installer.rb#L128 most threads have to wait for the only connection in the pool to be available which is not efficient. ### Solution This commit modifies the pool size for the fetcher that Bundler uses. RubyGems fetcher will continue to use a single connection. The bundler fetcher is used in 2 places. 1. When downloading gems https://github.com/ruby/rubygems/blob/4f85e02fdd89ee28852722dfed42a13c9f5c9193/bundler/lib/bundler/source/rubygems.rb#L481-L484 2. When grabing the index (not the compact index) using the `bundle install --full-index` flag. https://github.com/ruby/rubygems/blob/4f85e02fdd89ee28852722dfed42a13c9f5c9193/bundler/lib/bundler/fetcher/index.rb#L9 Having more connections in 2) is not any useful but tweaking the size based on where the fetcher is used is a bit tricky so I opted to modify it at the class level. I fiddle with the pool size and found that 5 seems to be the sweet spot at least for my environment. https://github.com/ruby/rubygems/commit/6063fd9963
2025-12-03ZJIT: Optimize setivar with shape transition (#15375)Max Bernstein
Since we do a decent job of pre-sizing objects, don't handle the case where we would need to re-size an object. Also don't handle too-complex shapes. lobsters stats before: ``` Top-20 calls to C functions from JIT code (79.4% of total 90,051,140): rb_vm_opt_send_without_block: 19,762,433 (21.9%) rb_vm_setinstancevariable: 7,698,314 ( 8.5%) rb_hash_aref: 6,767,461 ( 7.5%) rb_vm_env_write: 5,373,080 ( 6.0%) rb_vm_send: 5,049,229 ( 5.6%) rb_vm_getinstancevariable: 4,535,259 ( 5.0%) rb_obj_is_kind_of: 3,746,306 ( 4.2%) rb_ivar_get_at_no_ractor_check: 3,745,237 ( 4.2%) rb_vm_invokesuper: 3,037,467 ( 3.4%) rb_ary_entry: 2,351,983 ( 2.6%) rb_vm_opt_getconstant_path: 1,344,740 ( 1.5%) rb_vm_invokeblock: 1,184,474 ( 1.3%) Hash#[]=: 1,064,288 ( 1.2%) rb_gc_writebarrier: 1,006,972 ( 1.1%) rb_ec_ary_new_from_values: 902,687 ( 1.0%) fetch: 898,667 ( 1.0%) rb_str_buf_append: 833,787 ( 0.9%) rb_class_allocate_instance: 822,024 ( 0.9%) Hash#fetch: 699,580 ( 0.8%) _bi20: 682,068 ( 0.8%) Top-4 setivar fallback reasons (100.0% of total 7,732,326): shape_transition: 6,032,109 (78.0%) not_monomorphic: 1,469,300 (19.0%) not_t_object: 172,636 ( 2.2%) too_complex: 58,281 ( 0.8%) ``` lobsters stats after: ``` Top-20 calls to C functions from JIT code (79.0% of total 88,322,656): rb_vm_opt_send_without_block: 19,777,880 (22.4%) rb_hash_aref: 6,771,589 ( 7.7%) rb_vm_env_write: 5,372,789 ( 6.1%) rb_gc_writebarrier: 5,195,527 ( 5.9%) rb_vm_send: 5,049,145 ( 5.7%) rb_vm_getinstancevariable: 4,538,485 ( 5.1%) rb_obj_is_kind_of: 3,746,241 ( 4.2%) rb_ivar_get_at_no_ractor_check: 3,745,172 ( 4.2%) rb_vm_invokesuper: 3,037,157 ( 3.4%) rb_ary_entry: 2,351,968 ( 2.7%) rb_vm_setinstancevariable: 1,703,337 ( 1.9%) rb_vm_opt_getconstant_path: 1,344,730 ( 1.5%) rb_vm_invokeblock: 1,184,290 ( 1.3%) Hash#[]=: 1,061,868 ( 1.2%) rb_ec_ary_new_from_values: 902,666 ( 1.0%) fetch: 898,666 ( 1.0%) rb_str_buf_append: 833,784 ( 0.9%) rb_class_allocate_instance: 821,778 ( 0.9%) Hash#fetch: 755,913 ( 0.9%) Top-4 setivar fallback reasons (100.0% of total 1,703,337): not_monomorphic: 1,472,405 (86.4%) not_t_object: 172,629 (10.1%) too_complex: 58,281 ( 3.4%) new_shape_needs_extension: 22 ( 0.0%) ``` I also noticed that primitive printing in HIR was broken so I fixed that. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2025-12-04ZJIT: Inline Kernel#class (#15397)Max Bernstein
We generally know the receiver's class from profile info. I see 600k of these when running lobsters.
2025-12-03ZJIT: Fix definite assignment to work with multiple entry blocksMax Bernstein
2025-12-03ZJIT: Only use make_equal_to for instructions with outputMax Bernstein
It's used as an alternative to find-and-replace, so we should have nothing to replace.
2025-12-04[ruby/psych] Add option to disable symbol parsingCaleb Stewart
https://github.com/ruby/psych/commit/4e9d08c285
2025-12-04[ruby/psych] Remove y Object extension in IRBRune Philosof
Fixes: ruby#685 This feature can easily break how you use other gems like factory_bot or prawn. https://github.com/ruby/psych/pull/747#issuecomment-3413139525 > But I kind of think we should leave `psych/y` around. If people really want to use it they could require the file. If you miss the function in Kernel, you can require it interactively or add it to `.irbrc`: ```ruby require 'psych/y' ``` https://github.com/ruby/psych/commit/f1610b3f05
2025-12-04Remove needless parse.y `new_nil` macroyui-knk
In the past parse.y and ripper had different `new_nil` definition so that `new_nil` returns `nil` for ripper. ```c // parse.y #define new_nil(loc) NEW_NIL(loc) // ripper #define new_nil(loc) Qnil ``` However Rearchitect Ripper (89cfc1520717257073012ec07105c551e4b8af7c) removed `new_nil` definition for ripper then this commit removes needless parse.y macro and uses `NEW_NIL` directly.
2025-12-04Remove needless parse.y `value_expr` macroyui-knk
In the past parse.y and ripper had different `value_expr` definition so that `value_expr` does nothing for ripper. ```c // parse.y #define value_expr(node) value_expr_gen(p, (node)) // ripper #define value_expr(node) ((void)(node)) ``` However Rearchitect Ripper (89cfc1520717257073012ec07105c551e4b8af7c) removed `value_expr` definition for ripper then this commit removes needless parse.y macro and uses `value_expr_gen` directly.
2025-12-03YJIT: Pass class and shape ID directly instead of objectMax Bernstein
2025-12-03Move imemo fields check out of shape_get_nextMax Bernstein
Not every caller (for example, YJIT) actually needs to pass the object. YJIT (and, in the future, ZJIT) only need to pass the class.
2025-12-03Remove spurious obj != klass check in shape_get_nextMax Bernstein
This should never be true. I added an `rb_bug` in case it was and it wasn't true in any of btest or test-all. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2025-12-03ZJIT: Use the custom iteratorAaron Patterson
This commit uses the custom instruction iterator in arm64 / x86_64 instruction splitting. Once we introduce basic blocks to LIR, the custom iterator will ensure that instructions are added to the correct place.
2025-12-03ZJIT: Add a specialized instruction iterator to the assemblerAaron Patterson
This commit adds a specialized instruction iterator to the assembler with a custom "peek" method. The reason is that we want to add basic blocks to LIR. When we split instructions, we need to add any new instructions to the correct basic block. The custom iterator will maintain the correct basic block inside the assembler, that way when we push any new instructions they will be appended to the correct place.
2025-12-03Track small malloc/free changes in thread localJohn Hawthorn
2025-12-03Group malloc counters togetherJohn Hawthorn
2025-12-03gc.c: check if the struct has fields before marking the fields_objJean Boussier
If GC trigger in the middle of `struct_alloc`, and the struct has more than 3 elements, then `fields_obj` reference is garbage. We must first check the shape to know if it was actually initialized.
2025-12-03gc.c: Pass shape_id to `newobj_init`Jean Boussier
Attempt to fix the following SEGV: ``` ruby(gc_mark) ../src/gc/default/default.c:4429 ruby(gc_mark_children+0x45) [0x560b380bf8b5] ../src/gc/default/default.c:4625 ruby(gc_mark_stacked_objects) ../src/gc/default/default.c:4647 ruby(gc_mark_stacked_objects_all) ../src/gc/default/default.c:4685 ruby(gc_marks_rest) ../src/gc/default/default.c:5707 ruby(gc_marks+0x4e7) [0x560b380c41c1] ../src/gc/default/default.c:5821 ruby(gc_start) ../src/gc/default/default.c:6502 ruby(heap_prepare+0xa4) [0x560b380c4efc] ../src/gc/default/default.c:2074 ruby(heap_next_free_page) ../src/gc/default/default.c:2289 ruby(newobj_cache_miss) ../src/gc/default/default.c:2396 ruby(RB_SPECIAL_CONST_P+0x0) [0x560b380c5df4] ../src/gc/default/default.c:2420 ruby(RB_BUILTIN_TYPE) ../src/include/ruby/internal/value_type.h:184 ruby(newobj_init) ../src/gc/default/default.c:2136 ruby(rb_gc_impl_new_obj) ../src/gc/default/default.c:2500 ruby(newobj_of) ../src/gc.c:996 ruby(rb_imemo_new+0x37) [0x560b380d8bed] ../src/imemo.c:46 ruby(imemo_fields_new) ../src/imemo.c:105 ruby(rb_imemo_fields_new) ../src/imemo.c:120 ``` I have no reproduction, but my understanding based on the backtrace and error is that GC is triggered inside `newobj_init` causing the new object to be marked while in a incomplete state. I believe the fix is to pass the `shape_id` down to `newobj_init` so it can be set before the GC has a chance to trigger.
2025-12-03ZJIT: Optimize NewArray to use rb_ec_ary_new_from_values (#15391)Goshanraj Govindaraj
2025-12-03[ruby/prism] Fix wrong error message for lower percent i arraysEarlopain
Not so sure how to trigger it but this is definitly more correct. https://github.com/ruby/prism/commit/1bc8ec5e5d
2025-12-03[ruby/prism] Correctly handle line continuations in %w/i% interrupted by ↵Earlopain
heredocs See https://bugs.ruby-lang.org/issues/21756. Ripper fails to parse this, but prism actually also doesn't handle it correctly. When heredocs are used, even in lowercase percent arays there can be multiple `STRING_CONTENT` tokens. We need to concat them. Luckily we don't need to handle as many cases as in uppercase arrays where interpolation is allowed. https://github.com/ruby/prism/commit/211677000e
2025-12-03wb-protect autoload_constJohn Hawthorn
2025-12-03Speedup TypedData_Get_StructJean Boussier
While profiling `Monitor#synchronize` and `Mutex#synchronize` I noticed a fairly significant amount of time spent in `rb_check_typeddata`. By implementing a fast path that assumes the object is valid and that can be inlined, it does make a significant difference: Before: ``` Mutex 13.548M (± 3.6%) i/s (73.81 ns/i) - 68.566M in 5.067444 Monitor 10.497M (± 6.5%) i/s (95.27 ns/i) - 52.529M in 5.032698s ``` After: ``` Mutex 20.887M (± 0.3%) i/s (47.88 ns/i) - 106.021M in 5.075989s Monitor 16.245M (±13.3%) i/s (61.56 ns/i) - 80.705M in 5.099680s ``` ```ruby require 'bundler/inline' gemfile do gem "benchmark-ips" end mutex = Mutex.new require "monitor" monitor = Monitor.new Benchmark.ips do |x| x.report("Mutex") { mutex.synchronize { } } x.report("Monitor") { monitor.synchronize { } } end ```
2025-12-03[ruby/prism] Follow repo move from oracle/truffleruby to truffleruby/trufflerubyBenoit Daloze
https://github.com/ruby/prism/commit/c8e1b11120
2025-12-03Update default gems list at 94581b1ffde5e2afeba4631152955c [ci skip]git
2025-12-03[ruby/json] Release 2.17.0Jean Boussier
https://github.com/ruby/json/commit/4bdb2d14fe
2025-12-03[ruby/json] Fix handling of depthÉtienne Barrié
https://github.com/ruby/json/commit/ccca602274
2025-12-03fstring_concurrent_set_create: only assert the string has no ivarsJean Boussier
The NEWOBJ tracepoint can generate an object_id, that's alright, what we don't want is actual instance variables.
2025-12-03Rename `rb_obj_exivar_p` -> `rb_obj_gen_fields_p`Jean Boussier
The "EXIVAR" terminology has been replaced by "gen fields" AKA "generic fields". Exivar implies variable, but generic fields include more than just variables, e.g. `object_id`.
2025-12-03[ruby/json] Fix duplicated test_unsafe_load_with_options test caseJean Boussier
https://github.com/ruby/json/commit/7b62fac525
2025-12-03[ruby/json] Reproduce C ext behavior of ignoring mutated depth in arraysÉtienne Barrié
https://github.com/ruby/json/commit/e0257b9f82
2025-12-03[ruby/json] Test and restore behavior around to_json changing depthÉtienne Barrié
When serializing an Array, and one of the elements of the Array requires calling `to_json`, if the depth is changed, it will be used for the next entries, which wasn't the case before https://github.com/ruby/json/commit/5abd43490714, and is not the case with TruffleRuby and JRuby. Additionally, with TruffleRuby and JRuby the state's depth after the `to_json` call is used to close the Array, which isn't the case with CRuby. https://github.com/ruby/json/commit/386b36fde5
2025-12-03[ruby/json] Improve `JSON.load` and `JSON.unsafe_load` to allow passing ↵Jean Boussier
options as second argument Otherwise it's very error prone. https://github.com/ruby/json/commit/c54de70f90