summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-07-15follow-up for a54c717c7a74b91a3cdf20742c355e3ea42052d1.nagachika
2024-07-15merge revision(s) dc146babf47a84bbd1f176d766637d4a40327019, ↵nagachika
f23d5028059078a346efc977287b669d494a5a3f, a0f7de814ae5c299d6ce99bed5fb308a05d50ba0: [Backport #20296] [Bug #20296] Clear errinfo when `exception: false` [Bug #20296] Refine the test [Bug #20296] Fix the default assertion message
2024-07-15merge revision(s) e04146129ec6898dd6a9739dad2983c6e9b68056, ↵nagachika
d5080f6e8b77364483ff6727b1065e45e180f05d: [Backport #20292] [Bug #20292] Truncate embedded string to new capacity Fix -Wsign-compare on String#initialize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../string.c:1886:57: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘long int’ [-Wsign-compare] 1886 | if (STR_EMBED_P(str)) RUBY_ASSERT(osize <= str_embed_capa(str)); | ^~
2024-07-15merge revision(s) 5e0c17145131e073814c7e5b15227d0b4e73cabe: [Backport #20169]nagachika
Make io_fwrite safe for compaction [Bug #20169] Embedded strings are not safe for system calls without the GVL because compaction can cause pages to be locked causing the operation to fail with EFAULT. This commit changes io_fwrite to use rb_str_tmp_frozen_no_embed_acquire, which guarantees that the return string is not embedded.
2024-07-13follow-up for 3faef1d40dc1d6eea8ffcd624528f431ccaf0a5b.nagachika
2024-07-13merge revision(s) f36a71e26995b69ff72bc132bbcf40ad89571414: [Backport #20307]nagachika
[Bug #20307] Fix `Hash#update` to make frozen copy of string keys
2024-07-13Extract `RHASH_STRING_KEY_P`Nobuyoshi Nakada
2024-07-13Extract `RHASH_IDENTHASH_P`Nobuyoshi Nakada
2024-07-13merge revision(s) d19d683a354530a27b4cbb049223f8dc70c75849: [Backport #20250]nagachika
rb_obj_setup: do not copy RUBY_FL_SEEN_OBJ_ID [Bug #20250] We're seting up a new instance, so it never had an associated object_id.
2024-07-07merge revision(s) 82b57d7bfeefd717c10f7a5a3484aca6b3e708a3: [Backport #20162]nagachika
Fix memory leak when duplicating too complex object [Bug #20162] Creating a ST table then calling st_replace leaks memory because the st_replace overwrites the ST table without freeing any of the existing memory. This commit changes it to use st_copy instead. For example: RubyVM::Shape.exhaust_shapes o = Object.new o.instance_variable_set(:@a, 0) 10.times do 100_000.times { o.dup } puts `ps -o rss= -p #{$$}` end Before: 23264 33600 42672 52160 61600 71728 81056 90528 100560 109840 After: 14752 14816 15584 15584 15664 15664 15664 15664 15664 15664
2024-07-07merge revision(s) e626da82eae3d437b84d4f9ead0164d436b08e1a, ↵nagachika
f3af5ae7e6c1c096bbfe46d69de825a02b1696cf: [Backport #20311] Don't pin named structs defined in Ruby [Bug #20311] `rb_define_class_under` assumes it's called from C and that the reference might be held in a C global variable, so it adds the class to the VM root. In the case of `Struct.new('Name')` it's wasteful and make the struct immortal. Make Struct memory leak test faster [Bug #20311] It times out on some platform, so we can reduce iterations. On my machine it completes in 250ms and RSS grows 8X.
2024-07-06[Backport #11036 to 3.2] Add explicit compiler fence when pushing frames to ↵Ivo Anjo
ensure safe profiling **What does this PR do?** This PR tweaks the `vm_push_frame` function to add an explicit compiler fence (`atomic_signal_fence`) to ensure profilers that use signals to interrupt applications (stackprof, vernier, pf2, Datadog profiler) can safely sample from the signal handler. This is a backport of #11036 to Ruby 3.2 . **Motivation:** The `vm_push_frame` was specifically tweaked in https://github.com/ruby/ruby/pull/3296 to initialize the a frame before updating the `cfp` pointer. But since there's nothing stopping the compiler from reordering the initialization of a frame (`*cfp =`) with the update of the cfp pointer (`ec->cfp = cfp`) we've been hesitant to rely on this on the Datadog profiler. In practice, after some experimentation + talking to folks, this reordering does not seem to happen. But since modern compilers have a way for us to exactly tell them not to do the reordering (`atomic_signal_fence`), this seems even better. I've actually extracted `vm_push_frame` into the "Compiler Explorer" website, which you can use to see the assembly output of this function across many compilers and architectures: https://godbolt.org/z/3oxd1446K On that link you can observe two things across many compilers: 1. The compilers are not reordering the writes 2. The barrier does not change the generated assembly output (== has no cost in practice) **Additional Notes:** The checks added in `configure.ac` define two new macros: * `HAVE_STDATOMIC_H` * `HAVE_DECL_ATOMIC_SIGNAL_FENCE` Since Ruby generates an arch-specific `config.h` header with these macros upon installation, this can be used by profilers and other libraries to test if Ruby was compiled with the fence enabled. **How to test the change?** As I mentioned above, you can check https://godbolt.org/z/3oxd1446K to confirm the compiled output of `vm_push_frame` does not change in most compilers (at least all that I've checked on that site).
2024-07-06merge revision(s) 75aaeb35b82da26359b9418d2963384d0c55839c: [Backport #20239]nagachika
[Bug #20239] Fix overflow at down-casting
2024-07-06merge revision(s) 3a04ea2d0379dd8c6623c2d5563e6b4e23986fae: [Backport #20305]nagachika
[Bug #20305] Fix matching against an incomplete character When matching against an incomplete character, some `enclen` calls are expected not to exceed the limit, and some are expected to return the required length and then the results are checked if it exceeds.
2024-07-06merge revision(s) 78d9fe69479d32214a52ad7291c3973f1b6b7f6f, ↵nagachika
04729fe68dceddab045be7324e26c2bb15aa62c7: [Backport #20286] [Backport #20286] Ensure that exiting thread invokes end-of-life behaviour. (#10039) Fix exception handling in `rb_fiber_scheduler_set`. (#10042)
2024-07-06merge revision(s) a7ff264477105b5dc0ade6facad4176a1b73df0b: [Backport #20393]nagachika
Don't clear pending interrupts in the parent process. (#10365)
2024-07-06merge revision(s) 5d1702e01a36e11b183fe29ce10780a9b1a41cf0: [Backport #20414]nagachika
Enumerator should use a non-blocking fiber, change `rb_fiber_new` to be non-blocking by default. (#10481)
2024-07-06merge revision(s) 1e08a9f0e9058186db18f29efc6458c00f10a856: [Backport #20499]nagachika
[Bug #20499] Use Xcode owned tools for Xcode clang Xcode has its own version tools that may be incompatible with genuine LLVM tools, use the tools in the same directory.
2024-07-05Added macos-13 and removed macos-11Hiroshi SHIBATA
2024-06-19bump patchlevel.nagachika
2024-06-19bump rexml version to 3.2.9.nagachika
2024-06-18added redirect wrapper for envutilHiroshi SHIBATA
2024-06-18Load Rake::TaskLib when missing itHiroshi SHIBATA
2024-06-18Show prerequisites for compile taskNobuyoshi Nakada
2024-06-18Allow test-unit-ruby-core files to be loaded from bundled gemsNobuyoshi Nakada
Separate the directly from the customized test-unit, since it may not work with bundled gems.
2024-06-18merge revision(s) ↵nagachika
9f708d48f6df37ee9600db9d51b57a156609a13b,0301473fb523c71d8cdc4966971f31f502001185,7f0e26b7f99bf76408569892ce20318501f74729: [Backport #20516] Clear runtime dependencies if default gems is specified. The current build system uses runtime dependencies from only `.bundle` directory. We shouldn't install runtime dependencies from rubygems.org when `make test-bundled-gems` is invoked. Fixed dependencies list format Re-use strscan with ruby repo
2024-06-18partially merge revision(s) 70ad58cb62b195ba86a5ef07a565b22b02a040ea: ↵nagachika
[Backport #20516] Update bundled_gems
2024-06-18Revert "merge revision(s) 18eaf0be905e3e251423b42d6f4e56b7cae1bc3b: ↵nagachika
[Backport #20494]" This reverts commit ec30266267b2a063089b8ce7967203bcbadbdf4e.
2024-06-18Revert "merge revision(s) 22e4eeda6561693367fc7a00b92b90f46b09cabd, ↵nagachika
1ab7c412d2e3880a7ad233c32e93961888f8145c, fd549b229b0822198ddc847703194263a2186ed1: [Backport #20515]" This reverts commit dc4ca25e0a01e072ba3cf1fc47612aff72c980af.
2024-06-15merge revision(s) 22e4eeda6561693367fc7a00b92b90f46b09cabd, ↵nagachika
1ab7c412d2e3880a7ad233c32e93961888f8145c, fd549b229b0822198ddc847703194263a2186ed1: [Backport #20515] ci: Test whether GMP is working in compilers.yml (#10875) Avoid reoccurence of [Bug #20515] Requires https://github.com/ruby/ruby/pull/10876 since 18eaf0be905e3e251423b42d6f4e56b7cae1bc3b bug: https://bugs.ruby-lang.org/issues/20515 RUBY_CHECK_HEADER didn't define HAVE_{header-file} (#10876) --with-gmp is not working at all because HAVE_GMP_H was missing since 18eaf0be90. [Bug #20515] bug: https://bugs.ruby-lang.org/issues/20515 follow-up: https://bugs.ruby-lang.org/issues/20494 follow-up: 18eaf0be905e3e251423b42d6f4e56b7cae1bc3b follow-up: https://github.com/ruby/ruby/pull/10805 test_bignum: defined? returns String (#10880) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit didn't verify the test is working properly due to mistaken auto-merge… [Bug #20515] bug: https://bugs.ruby-lang.org/issues/20515 follow-up: 22e4eeda6561693367fc7a00b92b90f46b09cabd follow-up: https://github.com/ruby/ruby/pull/10875
2024-06-15merge revision(s) 18eaf0be905e3e251423b42d6f4e56b7cae1bc3b: [Backport #20494]nagachika
[Bug #20494] Search non-default directories for GMP Co-Authored-by: lish82 (Hiroki Katagiri)
2024-06-15Inline RB_VM_SAVE_MACHINE_CONTEXT into BLOCKING_REGIONKJ Tsanaktsidis
There's an exhaustive explanation of this in the linked redmine bug, but the short version is as follows: blocking_region_begin can spill callee-saved registers to the stack for its own use. That means they're not saved to ec->machine by the call to setjmp, since by that point they're already on the stack and new, different values are in the real registers. ec->machine's end-of-stack pointer is also bumped to accomodate this, BUT, after blocking_region_begin returns, that points past the end of the stack! As far as C is concerned, that's fine; the callee-saved registers are restored when blocking_region_begin returns. But, if another thread triggers GC, it is relying on finding references to Ruby objects by walking the stack region pointed to by ec->machine. If the C code in exec; subsequently does things that use that stack memory, then the value will be overwritten and the GC might prematurely collect something it shouldn't. [Bug #20493]
2024-06-15Fix inconsistent evaluation of keyword splat (#10959)Peter Zhu
[Bug #20180] Backports #9624.
2024-06-15compile.c: use putspecialobject for RubyVM::FrozenCoreJean Boussier
[Bug #20569] `putobject RubyVM::FrozenCore`, is not serializable, we have to use `putspecialobject VM_SPECIAL_OBJECT_VMCORE`.
2024-06-03merge revision(s) 631449ac6b9336dfce577a786aff7eca0b8abcf1:nagachika
README.ja.md: Remove Cirrus CI badge image. folloup for 15ee9c7c1b693f29b6b2dbe7b47488bf154e481c.
2024-06-03merge revision(s) b93553bb7e292a6eb83bbb60532b60126393534f:nagachika
Cirrus CI has been removed [ci skip]
2024-06-03merge revision(s) 15ee9c7c1b693f29b6b2dbe7b47488bf154e481c:nagachika
[DOC] README.md: Remove Cirrus CI badge image. (#8785) We removed the `.cirrus.yml` at the commit <01b5d1d2ff6ca91b2909dfa67295f59b53e6f065>. Let's remove the badge image too.
2024-06-03merge revision(s) 01b5d1d2ff6ca91b2909dfa67295f59b53e6f065:nagachika
YJIT: Add a cargo job for Arm64 and remove .cirrus.yml (#8679) * YJIT: Add a cargo job for Arm64 * YJIT: Use command names as job names They look more consistent with jobs that use the command name as a job name, such as `make (check)`, `make (test-bundled-gems)`, etc. * Remove .cirrus.yml
2024-06-03Revert "partially merge revision(s) ↵nagachika
70ad58cb62b195ba86a5ef07a565b22b02a040ea: [Backport #20516]" This reverts commit 519ac9c5fd7bfa75655231188ac1da9589563618.
2024-06-03Revert "merge revision(s) ↵nagachika
9f708d48f6df37ee9600db9d51b57a156609a13b,0301473fb523c71d8cdc4966971f31f502001185,7f0e26b7f99bf76408569892ce20318501f74729: [Backport #20516]" This reverts commit 0de1ff12973ffc04bc9a8b0799e963922986d1eb.
2024-06-02merge revision(s) ↵nagachika
9f708d48f6df37ee9600db9d51b57a156609a13b,0301473fb523c71d8cdc4966971f31f502001185,7f0e26b7f99bf76408569892ce20318501f74729: [Backport #20516] Clear runtime dependencies if default gems is specified. The current build system uses runtime dependencies from only `.bundle` directory. We shouldn't install runtime dependencies from rubygems.org when `make test-bundled-gems` is invoked. Fixed dependencies list format Re-use strscan with ruby repo
2024-06-01partially merge revision(s) 70ad58cb62b195ba86a5ef07a565b22b02a040ea: ↵nagachika
[Backport #20516] Update bundled_gems
2024-05-28[ruby/readline-ext] Skip test_interrupt_in_other_thread on arm32-linuxmatoro
This is a combination of main Ruby commit https://github.com/ruby/ruby/commit/aefc98891c42024039f19ef45bdfe93fbc590b7c and my PR correcting the regex https://github.com/ruby/ruby/pull/10819. Upstream Ruby requests that changes to this test go to readline-ext repo before being backported to 3.2 branch. https://github.com/ruby/readline-ext/commit/868f873a78
2024-05-18Fix `io_buffer_get_string` default length computation. (#8427)Samuel Williams
* Fix `io_buffer_get_string` default length computation. When an offset bigger than the size is given, the resulting length will be computed incorrectly. Raise an argument error in this case. * Validate all arguments.
2024-05-18Improvements to `IO::Buffer` `read`/`write`/`pread`/`pwrite`. (#7826)Samuel Williams
- Fix IO::Buffer `read`/`write` to use a minimum length.
2024-05-18Rename `data` -> `buffer` for better readability. (#7836)Samuel Williams
2024-05-18Adjust `else` style to be consistent in each files [ci skip]Nobuyoshi Nakada
2024-05-16merge revision(s) ae8990aef098410ecc2b5f48fea9d7d171a3c5f6: [Backport #20183]nagachika
Alias init functions The extension library has each initialization function named "Init_" + basename. If multiple extensions have the same base name (such as cgi/escape and erb/escape), the same function will be registered for both names. To fix this conflict, rename the initialization functions under sub directories using using parent names, when statically linking.
2024-05-14Fix `String#index` to clear MatchData when a regexp is passedJean Boussier
[Bug #20421] The bug was fixed in Ruby 3.3 via 9dcdffb8bf8a3654fd78bf1a58b30c8e13888a7a
2024-05-08CI: Pass -O2 for annocheckAlan Wu
Because `optflags` is pasted into the invocation line after `CC`, we were building with -O1 unintentionally. You can see this in the configuration summary: https://github.com/ruby/ruby/actions/runs/3933391169/jobs/6727044423#step:9:753 The check actually fails with -O2. To make it pass, upstream suggest that we use the annocheck GCC plugin. Since it requires building from source as the debian package for it isn't ready yet, punt on it for now and use `--skip-gaps`. Co-authored-by: Jun Aruga <jaruga@redhat.com>