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

82251 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 2cdbeb29e6
Do not leave test file
Run this test separately because something seems remained unreleased
on Windows.
2023-12-25 13:01:55 +09:00
Peter Zhu b4efa4b700 Don't copy RUBY_FL_PROMOTED flag in rb_obj_setup
RUBY_FL_PROMOTED is used by the garbage collector to track when an
object becomes promoted to the old generation. rb_obj_setup must not
copy that flag over because then it may become out-of-sync with the age
of the object.

This fixes a bug in Method#clone where the cloned Method object may get
RUBY_FL_PROMOTED incorrectly set.
2023-12-24 22:13:49 -05:00
Hiroshi SHIBATA 1b5f3dd6a1
Removed empty sections 2023-12-25 12:04:28 +09:00
Hiroshi SHIBATA 27ead9907d
Typofix under lib and test, tool directories 2023-12-25 11:32:42 +09:00
Peter Zhu 7002e77694 Fix Symbol#inspect for GC compaction
The test fails when RGENGC_CHECK_MODE is turned on:

    1) Failure:
    TestSymbol#test_inspect_under_gc_compact_stress [test/ruby/test_symbol.rb:123]:
    <":testing"> expected but was
    <":\x00\x00\x00\x00\x00\x00\x00">.
2023-12-24 21:29:40 -05:00
Hiroshi SHIBATA e233730846
Partly reverted c903cddf55
These are intentional words
2023-12-25 11:22:12 +09:00
Hiroshi SHIBATA c903cddf55
Typofix under doc directory 2023-12-25 11:17:51 +09:00
Peter Zhu 70618a48f7 Fix off-by-one error for declarative marking
The for loops for marking and reference updating declaratively marked
TypedData objects did not mark/reference update the very last element.

When RGENGC_CHECK_MODE is turned on, this caused the test in Enumerator
to fail with:

    tool/lib/test/unit/testcase.rb:173:in `rescue in run': failed to allocate memory (NoMemoryError)
2023-12-24 20:37:59 -05:00
Samuel Williams 260bf60e52
Correctly release the underlying file mapping. (#9340)
* Avoiding using `Tempfile` which was retaining the file preventing it from unlinking.
2023-12-25 14:20:53 +13:00
Peter Zhu 5af64ff7db Fix Enumerator#with_index for GC compaction
enumerator_block_call was not safe for compaction because the Array
backing the argv was not pinned, so it could get moved during compaction
which would make argv point to somewhere else.

The test crashes when RGENGC_CHECK_MODE is turned on:

    TestEnumerator#test_with_index_under_gc_compact_stress
    check_rvalue_consistency: 0x55db0b399450 is not a Ruby object.
    test/ruby/test_enumerator.rb:133: [BUG] check_rvalue_consistency_force: there is 1 errors.
    ruby 3.3.0dev (2023-12-23T23:00:27Z master 50bf437341) [x86_64-linux]
    -- Control frame information -----------------------------------------------
    c:0034 p:---- s:0192 e:000187 CFUNC  :with_index
    c:0033 p:---- s:0185 e:000184 CFUNC  :each
    c:0032 p:---- s:0182 e:000181 CFUNC  :to_a
    c:0031 p:0055 s:0178 e:000175 BLOCK  test/ruby/test_enumerator.rb:133
    c:0030 p:0024 s:0172 e:000171 METHOD tool/lib/envutil.rb:242
    c:0029 p:0024 s:0167 e:000166 METHOD tool/lib/envutil.rb:251
    c:0028 p:0005 s:0160 e:000159 METHOD test/ruby/test_enumerator.rb:131
    ...
    -- C level backtrace information -------------------------------------------
    build/ruby(rb_print_backtrace+0x14) [0x55db0b1deb21] vm_dump.c:820
    build/ruby(rb_vm_bugreport) vm_dump.c:1151
    build/ruby(bug_report_end+0x0) [0x55db0b3a53a6] error.c:1042
    build/ruby(rb_bug_without_die) error.c:1042
    build/ruby(die+0x0) [0x55db0afc77c2] error.c:1050
    build/ruby(rb_bug) error.c:1052
    build/ruby(gc_move+0x0) [0x55db0afbada0] gc.c:1714
    build/ruby(check_rvalue_consistency+0xa) [0x55db0afef0c3] gc.c:1729
    build/ruby(is_markable_object) gc.c:4769
    build/ruby(gc_mark_stack_values) gc.c:6595
    build/ruby(rb_gc_mark_vm_stack_values) gc.c:6605
    build/ruby(rb_execution_context_mark+0x39) [0x55db0b1d8589] vm.c:3309
    build/ruby(thread_mark+0x15) [0x55db0b1a9805] vm.c:3381
    build/ruby(gc_mark_stacked_objects+0x6d) [0x55db0aff2c3d] gc.c:7564
    build/ruby(gc_mark_stacked_objects_all) gc.c:7602
    build/ruby(gc_marks_rest) gc.c:8797
    build/ruby(gc_marks+0xd) [0x55db0aff43d5] gc.c:8855
    build/ruby(gc_start) gc.c:9608
    build/ruby(rb_multi_ractor_p+0x0) [0x55db0aff5463] gc.c:9489
    build/ruby(rb_vm_lock_leave) vm_sync.h:92
    build/ruby(garbage_collect) gc.c:9491
    build/ruby(newobj_slowpath+0xcb) [0x55db0aff57ab] gc.c:2871
    build/ruby(newobj_slowpath_wb_protected) gc.c:2895
    build/ruby(newobj_of0+0x24) [0x55db0aff59e4] gc.c:2937
    build/ruby(newobj_of) gc.c:2947
    build/ruby(rb_wb_protected_newobj_of) gc.c:2962
    build/ruby(ary_alloc_embed+0x10) [0x55db0b2f3e40] array.c:668
    build/ruby(ary_new) array.c:709
    build/ruby(rb_ary_tmp_new_from_values) array.c:759
    build/ruby(rb_ary_new_from_values) array.c:771
    build/ruby(args_copy+0x18) [0x55db0b1bbb88] vm_args.c:158
2023-12-24 16:22:34 -05:00
BurdetteLamar 86ef38194b RDoc for complex.c 2023-12-24 14:56:06 -05:00
Peter Zhu f0efeddd41 Fix Regexp#inspect for GC compaction
rb_reg_desc was not safe for GC compaction because it took in the C
string and length but not the backing String object so it get moved
during compaction. This commit changes rb_reg_desc to use the string
from the Regexp object.

The test fails when RGENGC_CHECK_MODE is turned on:

    TestRegexp#test_inspect_under_gc_compact_stress [test/ruby/test_regexp.rb:474]:
    <"(?-mix:\\/)|"> expected but was
    <"/\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00/">.
2023-12-24 11:04:41 -05:00
BurdetteLamar 8ad8803bb4 RDoc for Complex 2023-12-24 11:00:30 -05:00
Peter Zhu 42442ed789 Fix Regexp#match for GC compaction
The test fails when RGENGC_CHECK_MODE is turned on:

    TestRegexp#test_match_under_gc_compact_stress:
    NoMethodError: undefined method `match' for nil
        test_regexp.rb:878:in `block in test_match_under_gc_compact_stress'
2023-12-24 09:03:55 -05:00
Samuel Williams 37753f163e
IO::Buffer improvements and documentation. (#9329)
* Restore experimental warnings.

* Documentation and code structure improvements.

* Improved validation of flags, clarified documentation of argument handling.

* Remove inconsistent use of `Example:` and add example to `null?`.

* Expose `IO::Buffer#private?` and add test.
2023-12-25 02:03:36 +13:00
Nobuyoshi Nakada 61289d9405
Initialize loop variable of `ccan_list_for_each`
On platforms where `typeof` is unsupported, `ccan_container_off_var`
calculates the offset of member by pointer subtraction.  Although this
will result in the compile-time invariant value regardless the pointer
value, the loop variable will be used before assignment and may cause
an using uninitialized variable warning.
2023-12-24 19:34:25 +09:00
git 86893b28f7 Update bundled gems list as of 2023-12-24 2023-12-24 06:58:23 +00:00
Koichi Sasada a87ae242bb Use noinline version of accessing current ec
On universal.arm64e-darwin22 with clang 15.0.0 (I didn't check
details yet) accessing `ruby_current_ec` directly causes
assertion violation `VM_ASSERT(ec == rb_current_ec_noinline())`
on `rb_current_execution_context()`, maybe because TLS accessing
issue.
2023-12-24 15:13:33 +09:00
Koichi Sasada 541371e286 accept `RB_WAITFD_IN | RB_WAITFD_OUT` for waiting events
Assrsion was `events == RB_WAITFD_IN || events == RB_WAITFD_OUT`
but it should accept `RB_WAITFD_IN | RB_WAITFD_OUT`.
2023-12-24 14:53:46 +09:00
Nobuyoshi Nakada 0fef890b4f
[DOC] Fix markup in HTML
Inside HTML is not markdown.
2023-12-24 13:59:34 +09:00
Koichi Sasada 82015496b9 MN: access `timer_th.waiting` with lock
`timer_th.waiting` should be protected by `timer_th.waiting_lock`
2023-12-24 10:57:27 +09:00
Daisuke Fujimura (fd0) daefbf8fbf Use native_thread_init_stack on cygwin 2023-12-24 08:06:03 +09:00
Peter Zhu 50bf437341 Fix String#sub for GC compaction
The test fails when RGENGC_CHECK_MODE is turned on:

    TestString#test_sub_gc_compact_stress = 9.42 s
    1) Failure:
    TestString#test_sub_gc_compact_stress [test/ruby/test_string.rb:2089]:
    <"aaa [amp] yyy"> expected but was
    <"aaa [] yyy">.
2023-12-23 18:00:27 -05:00
JP Camara a2ebf9cc63 Replicate EEXIST epoll_ctl behavior in kqueue
* In the epoll implementation, you get an EEXIST if you try to register the same event for the same fd more than once for a particular epoll instance

* Otherwise kevent will just override the previous event registration, and if multiple threads listen on the same fd only the last one to register will ever finish, the others are stuck

* This approach will lead to native threads getting created, similar to the epoll implementation. This is not ideal, but it fixes certain test cases for now, like test/socket/test_tcp.rb#test_accept_multithread
2023-12-24 07:07:11 +09:00
Peter Zhu fadda88903 Fix Regexp#to_s for GC compaction
The test fails when RGENGC_CHECK_MODE is turned on:

    TestRegexp#test_to_s_under_gc_compact_stress = 13.46 s
    1) Failure:
    TestRegexp#test_to_s_under_gc_compact_stress [test/ruby/test_regexp.rb:81]:
    <"(?-mix:abcd\u3042)"> expected but was
    <"(?-mix:\u5C78\u3030\u5C78\u3030\u5C78\u3030\u5C78\u3030\u5C78\u3030)">.
2023-12-23 16:52:05 -05:00
Burdette Lamar 688a1314e6
[DOC] Clean up doc for File#flock (#9332) 2023-12-23 16:08:26 -05:00
Peter Zhu 47f33c3848 Remove useless `#if 1` in array.c 2023-12-23 09:51:30 -05:00
Nobuyoshi Nakada fe9e57bac8
Adjust indent [ci skip] 2023-12-23 19:36:21 +09:00
Nobuyoshi Nakada fd3dede7f4
Fix for older set versions
`Set::VERSION` was not defined in old set.rb bundled with ruby 3.2 or
earlier.
Also add comment for spec/mspec/tool/remove_old_guards.rb.
2023-12-23 18:57:47 +09:00
Nobuyoshi Nakada dc7785e16b
Set 1.1 now checks subclass-ness stricter 2023-12-23 18:15:26 +09:00
Nobuyoshi Nakada f6e9899e8a
Make rbconfig.rb loadable from exe/ruby
So that it can run without `--disable=gems` option.
2023-12-23 18:03:31 +09:00
Nobuyoshi Nakada 8c03bdacd1
Control the precheck for test-all by `PRECHECK_TEST_ALL` 2023-12-23 18:03:30 +09:00
Akinori MUSHA 40bc7ede38 Set 1.1.0 has been imported 2023-12-23 16:51:41 +09:00
Akinori MUSHA c66ff6face [ruby/set] Bump version to 1.1.0
https://github.com/ruby/set/commit/d6cab5bcc8
2023-12-23 16:50:33 +09:00
Akinori MUSHA 67882d7695 [ruby/set] Use the pattern argument instead of a block
https://github.com/ruby/set/commit/c63047c2ce
2023-12-23 16:50:31 +09:00
Akinori MUSHA 6fc3171e8a [ruby/set] The arity of initialize_clone is -1 in Ruby >= 3
https://github.com/ruby/set/commit/32a9689696
2023-12-23 16:50:30 +09:00
Akinori MUSHA 271c74a473 [ruby/set] Drop support for Ruby 2
https://github.com/ruby/set/commit/64dad673d8
2023-12-23 16:50:29 +09:00
Takashi Kokubun da02d08f27 RJIT: Rewind $! after compilation 2023-12-22 22:18:14 -08:00
Takashi Kokubun ef06510265 RJIT: Prefer STDERR over $stderr
When $stderr is redirected, you'll have no way to see why RJIT got
broken. This reference must always be the actual stderr.
2023-12-22 21:48:26 -08:00
Takashi Kokubun c25705c267 Get rid of obsoleted RJITFirst
It was renamed from test_mjit, but we did not maintain it as test_rjit.
We test RJIT very differently.
2023-12-22 20:20:42 -08:00
Burdette Lamar 9b289d58f7
[DOC] RDoc for Complex (#9307) 2023-12-22 22:31:18 -05:00
John Hawthorn f1b7424cbe FREE_AT_EXIT: Don't free main stack post-fork
When a forked process was started in a thread, this would result in a
double-free during the child process exit.

    RUBY_FREE_AT_EXIT=1 ./miniruby -e 'Thread.new { fork { } }.join; Process.waitpid'

This is because the main thread in the forked process was not the
initial VM thread, and the new thread's stack was freed as part of
objectspace iteration.

This change also allows rb_threadptr_root_fiber_release to run without
EC being available.
2023-12-22 18:07:22 -08:00
John Hawthorn 339978ef38 Free default_rand_key after freeing Ractors
Ractor's free iterates through its TLS keys so we need to keep this
memory available until after Ractors are freed.

Minimal reproduction:

    RUBY_FREE_AT_EXIT=1 ./miniruby -e rand
2023-12-22 18:07:22 -08:00
John Hawthorn 697a096c9b Remove EC argument from clean_hooks_check
This argument doesn't seem used anymore. Since we want to free these
objects during VM destruction when RUBY_FREE_AT_EXIT is set they must
work without an EC.

This avoids a use-after-free running `RUBY_FREE_AT_EXIT=1 ./miniruby -e ''`
2023-12-22 18:07:22 -08:00
git 24ff13d8da Update default gems list at 7d7a84e99f [ci skip] 2023-12-23 00:35:43 +00:00
Hiroshi SHIBATA 7d7a84e99f Merge RubyGems-3.5.3 and Bundler-2.5.3 2023-12-23 09:34:26 +09:00
Koichi Sasada fa5de8f68d MN: skip waiting on fiber schedulers
If the Fiber is nonblocking mode, fiber scheduler needs to handle
IO events.
2023-12-23 08:10:41 +09:00
Koichi Sasada beec3d07c9 MN: skip waiting on `read_nonblock'
if the IO for `IO#read_nonblock` is not ready, it needs
to return (or raise) immediately.
2023-12-23 08:10:41 +09:00
Koichi Sasada 2fe9e08578 MN: skip RUBY_DESCRIPTION spec on MN enabled 2023-12-23 08:10:41 +09:00
Koichi Sasada a4b737213e MN: ceil timeout milli seconds
`hrrel / RB_HRTIME_PER_MSEC` floor the timeout value and it can
return wrong value by `Mutex#sleep` (return Integer even if
it should return nil (timeout'ed)).

This patch ceil the value and the issue was solved.
2023-12-23 05:56:02 +09:00