91675 Commits

Author SHA1 Message Date
John Hawthorn
9b8c846bdf Add an additional test to module_eqq 2025-05-12 19:05:19 -07:00
Jeremy Evans
203199251f Remove Set#to_h
This overrides Enumerable#to_h, but doesn't handle a block, breaking
backwards compatibility.

Set#to_h was added in the marshalling support commit, but isn't
necessary for that, as the underlying function is called. Remove
the method definition to restore backwards compatibility.
2025-05-13 10:09:58 +09:00
Nobuyoshi Nakada
b758b6f204
Prevent namespace inspected strings from GC 2025-05-13 09:05:08 +09:00
John Hawthorn
b0502e8f90 Remove respond_to check from Class#bind_call 2025-05-12 14:10:29 -07:00
Nobuyoshi Nakada
c6528548d0 [ruby/erb] Use cgi/escape instead of deprecated cgi/util 2025-05-12 09:59:58 -07:00
git
03a7f1ff08 Update default gems list at 957473d87fc7741c8d36caed8f05db [ci skip] 2025-05-12 16:22:47 +00:00
Aaron Patterson
957473d87f [ruby/psych] Bump version for release
https://github.com/ruby/psych/commit/b9dec9f811
2025-05-12 16:21:41 +00:00
Earlopain
0c94ae048a [ruby/psych] Fix dumping StringIO (and potentially others) on Ruby <= 2.7
In Ruby < 3.0, the superclass of StringIO was actually already `Data`,
but it doesn't have the expected shape. So, on these earlier versions it errors:
> NoMethodError: undefined method `members' for #<StringIO:0x00005641dd5f2880>
>    vendor/bundle/ruby/2.6.0/gems/psych-5.2.5/lib/psych/visitors/yaml_tree.rb:170:in `visit_Data'

This test doesn't fail on 2.7, presumably because it can pull in a newer `stringio` version.

https://github.com/ruby/psych/commit/0f40f56268
2025-05-12 16:19:38 +00:00
Takashi Kokubun
53a27f114a
YJIT: Split the block on optimized getlocal/setlocal (#13282) 2025-05-12 09:03:46 -07:00
Takashi Kokubun
0b6cee7329
ZJIT: Stop padding side exits (#13295) 2025-05-12 08:57:15 -07:00
Nobuyoshi Nakada
64944cf422
[DOC] Remove a garbage 2025-05-13 00:07:56 +09:00
Peter Zhu
85d9ebc995 Remove duplicate asan_unpoisoning_object
It's already defined in internal/sanitizers.h.
2025-05-12 10:51:17 -04:00
Burdette Lamar
bc6d48bd34
[DOC] Tweak for String#+@ (#13285) 2025-05-12 10:16:37 -04:00
Nobuyoshi Nakada
311b9352a1 [ruby/erb] [DOC] Make documentation 100%
https://github.com/ruby/erb/commit/9152ce8db4
2025-05-12 13:57:24 +00:00
Nobuyoshi Nakada
46e4c86737 Detect clock_gettime and clock_getres for winpthreads 2025-05-12 17:45:39 +09:00
Nobuyoshi Nakada
91375d7579 CI: Create proper revision.h on Windows 2025-05-12 17:45:39 +09:00
Nobuyoshi Nakada
d2ffdb1088 Explicit cast down from double to int 2025-05-12 17:45:39 +09:00
Nobuyoshi Nakada
ed2806117a Do not let files depend on a phony target 2025-05-12 17:45:39 +09:00
Nobuyoshi Nakada
543e3a1896 Cast up int instruction code to VALUE
Fix Visual C warnings:
```
iseq.c(3793): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size
iseq.c(3794): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size
```
2025-05-12 17:45:39 +09:00
Nobuyoshi Nakada
f1f0cc14cc Separate __has_attribute from defined(__has_attribute)
Fix Visual C warnings:
```
regenc.h(121): warning C4067: unexpected tokens following preprocessor directive - expected a newline
```
2025-05-12 17:45:39 +09:00
Jean Boussier
131ba059ca test_object_id.rb: use better randomness
When the test is repeated 20 or more times in the same process
it's not that unlikely for `rand(100_000)` to return the same thing
twice, causing `TestObjectIdTooComplexClass` to fail.

```
  1) Failure:
TestObjectIdTooComplexClass#test_dup_with_id_and_ivar [/tmp/ruby/src/trunk-repeat20-asserts/test/ruby/test_object_id.rb:172]:
Expected #<struct RubyVM::Shape
 id=6783,
 parent_id=6774,
 edge_name=:@___26417,
 next_field_index=2,
 heap_index=0,
 type=1,
 capacity=7> to be too_complex?.
```
2025-05-12 09:49:59 +02:00
Hiroshi SHIBATA
f638e14838
Support to sync cgi/escape from ruby/cgi repo 2025-05-12 12:52:33 +09:00
Randy Stauner
4464cbe5cd [rubygems/rubygems] Fix doctor command parsing of otool output
I have several gem dylibs that have a line matching "(compatibility "
with no file path preceding it.

https://github.com/rubygems/rubygems/commit/de9dc2bdc4
2025-05-12 11:09:22 +09:00
Jean Boussier
af79914002 [ruby/json] Favor decimal notation over scientific notation for floats
e.g.
```
JSON.dump(1746861937.7842371)
```

master:
```
"1.https://github.com/ruby/json/commit/746861937784+9"
```

This branch and older json versions:
```
https://github.com/ruby/json/commit/1746861937.7842371
```

In the end it's shorter, and according to `canada.json` benchmark
performance is the same.

https://github.com/ruby/json/commit/866f72a437
2025-05-12 11:09:11 +09:00
Takashi Kokubun
dc5555d74a Fix -Wmaybe-uninitialized
../namespace.c: In function ‘current_namespace’:
../namespace.c:221:48: warning: ‘proc_ns’ may be used uninitialized [-Wmaybe-uninitialized]
  221 |                     if (permit_calling_builtin || (proc_ns && NAMESPACE_USER_P(proc_ns)))
      |                         ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../namespace.c:204:31: note: ‘proc_ns’ was declared here
  204 |         const rb_namespace_t *proc_ns;
      |                               ^~~~~~~

In function ‘copy_ext_file’,
    inlined from ‘rb_namespace_local_extension’ at ../namespace.c:855:18:
../namespace.c:768:21: warning: ‘written’ may be used uninitialized [-Wmaybe-uninitialized]
  768 |             wrote = fwrite(buffer+written, 1, read-written, dst);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../namespace.c: In function ‘rb_namespace_local_extension’:
../namespace.c:748:25: note: ‘written’ was declared here
  748 |     size_t read, wrote, written;
      |                         ^~~~~~~

In function ‘copy_ext_file’,
    inlined from ‘rb_namespace_local_extension’ at ../namespace.c:855:18:
../namespace.c:768:21: warning: ‘read’ may be used uninitialized [-Wmaybe-uninitialized]
  768 |             wrote = fwrite(buffer+written, 1, read-written, dst);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../namespace.c: In function ‘rb_namespace_local_extension’:
../namespace.c:748:12: note: ‘read’ was declared here
  748 |     size_t read, wrote, written;
      |            ^~~~
2025-05-11 13:37:47 -07:00
Jean Boussier
8b7a4d167a Handle GC triggering while building the initial id_to_obj_tbl
GC can trigger while we build the table, and if it sweeps an object
with an ID, it may not find it in the `id_to_obj` table.
2025-05-11 22:05:06 +02:00
Nobuyoshi Nakada
2fe8b9cd3d Copy to path with the base name 2025-05-12 02:50:25 +09:00
Nobuyoshi Nakada
b48b841378 digest.so needs ruby/digest.h which is installed by build-ext 2025-05-12 02:50:25 +09:00
Nobuyoshi Nakada
204740b73f Revert "Try removing building C API specs in CRuby makefiles entirely"
This reverts commit 2a9236366d6016738a756caecab03263565a20c7.
spec/ruby/optional/capi/spec_helper.rb doesn't work well for mingw.
2025-05-12 02:50:25 +09:00
Nobuyoshi Nakada
3e47e7a499 Fix redefinition of clock_gettime and clock_getres
winpthreads-git 12.0.0.r720 provides `clock_gettime` and
`clock_getres` as inline functions.
2025-05-12 02:50:25 +09:00
Jean Boussier
f2e5f6dbb6 Allow T_CLASS and generic types to be too_complex
The intial complex shape implementation never allowed objects
other than T_OBJECT to become too complex, unless we run out of
shapes.

I don't see any reason to prevent that.

Ref: https://github.com/ruby/ruby/pull/6931
2025-05-11 19:35:58 +02:00
Jean Boussier
54c2edc05d Fix Namespace#inspect to display its internal id 2025-05-11 17:38:14 +02:00
Satoshi Tagomori
b94df81be2 RUBY_TYPED_WB_PROTECTED should be specified with write barrier protection on this object.
https://github.com/tagomoris/ruby/pull/7
RUBY_TYPED_FREE_IMMEDIATELY can be added because namespace_entry_free does no IO nor
things to block.
2025-05-11 23:32:50 +09:00
Jean Boussier
574127b0db Add missing gc_mark in autoload_const_mark
If we're referencing the namespace object we have to mark it.
2025-05-11 23:32:50 +09:00
Satoshi Tagomori
ae2d5378e8 Suppress warning about unused variable without VM_CHECK_MODE 2025-05-11 23:32:50 +09:00
Jean Boussier
e9b538bb35 Fix namespace_initialize to not crash on boot
```
/opt/rubies/head-namespaces/bin/ruby(sigsegv+0x84) [0x104e897e8]
/usr/lib/system/libsystem_platform.dylib(_sigtramp+0x38) [0x18de56de4]
/opt/rubies/head-namespaces/bin/ruby(object_id+0x80) [0x104d7d420]
/opt/rubies/head-namespaces/bin/ruby(object_id+0x80) [0x104d7d420]
/opt/rubies/head-namespaces/bin/ruby(rb_initialize_main_namespace+0xe4) [0x104ddaa20]
/opt/rubies/head-namespaces/bin/ruby(ruby_opt_init+0x120) [0x104e7f524]
/opt/rubies/head-namespaces/bin/ruby(ruby_process_options+0x1370) [0x104e7e31c]
/opt/rubies/head-namespaces/bin/ruby(ruby_options+0xb0) [0x104d69844]
/opt/rubies/head-namespaces/bin/ruby(main+0x64) [0x104ca8d54]
```

I'm not too sure why `rb_obj_id` crashes, but I suspect it's called too
early. Either way I don't think generating an object_id for namespaces
is a good idea. If all we need is a unique number we can do that
for much cheaper.
2025-05-11 23:32:50 +09:00
Satoshi Tagomori
b132322e94 Skip mmtk/i686 tests for a while 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
bbcc3782b1 Skip updating max_iv_count when the namespace cannot be determined 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
c2c5b05423 Unexpectedly miss-fixed macro during rebase 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
f0b41ef669 Describe the basic documents of Namespace 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
8199e6e1a6 Show experimental warning when namespace is enabled 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
8ecc04dc04 Delete code for debugging namespace 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
82f645e818 Namespace::Entry is long living object 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
294b52fb9b Follow the code style about else 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
90e5ce6132 Rename RCLASS_EXT() macro to RCLASS_EXT_PRIME() to prevent using it wrongly
The macro RCLASS_EXT() accesses the prime classext directly, but it can be
valid only in a limited situation when namespace is enabled.
So, to prevent using RCLASS_EXT() in the wrong way, rename the macro and
let the developer check it is ok to access the prime classext or not.
2025-05-11 23:32:50 +09:00
Satoshi Tagomori
ff790c759e Compact prime classext readable/writable flags
To make RClass size smaller, move flags of prime classext readable/writable to:
 readable - use ns_classext_tbl is NULL or not (if NULL, it's readable)
 writable - use FL_USER2 of RBasic flags
2025-05-11 23:32:50 +09:00
Satoshi Tagomori
e81d50207b Add yjit/zjit bindings for adding namespace 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
5ee1ec313a initialize method tables before any GC chance 2025-05-11 23:32:50 +09:00
Satoshi Tagomori
f24ba27d6d avoid calling ZALLOC after NEWOBJ_OF for RClass: need to return RClass not promoted 2025-05-11 23:32:50 +09:00
Yusuke Endoh
4b33b468ac Fix function pointer type mismatch with rb_define_private_method
`rb_define_private_method` performs strict type checking on the function
pointer. As a result, we cannot pass the function a generic signature.

```
  /github/workspace/src/namespace.c:1097:72: note: expected 'VALUE (*)(void)' {aka 'long unsigned int (*)(void)'} but argument is of type 'VALUE (*)(int,  VALUE *, VALUE)' {aka 'long unsigned int (*)(int,  long unsigned int *, long unsigned int)'}
   1097 | namespace_define_loader_method(VALUE module, const char *name, VALUE (*func)(ANYARGS), int argc)
        |                                                                ~~~~~~~~^~~~~~~~~~~~~~
```

This commit defines the method directly to avoid the mismatch error.
2025-05-11 23:32:50 +09:00