31 Commits

Author SHA1 Message Date
Peter Zhu
7379b9ed78 Optimize rb_mark_generic_ivar for T_DATA and T_STRUCT
T_DATA and T_STRUCT could have ivars but might not use the generic_fields_tbl.
This commit skips lookup in the generic_fields_tbl for those cases.
2026-01-09 17:31:10 +01:00
Nobuyoshi Nakada
0b65ac6daf
Remove a no longer used prototype declaration in re.c
Include internal/error.h instead.
2025-12-26 15:11:23 +09:00
Nobuyoshi Nakada
dd2f7d6ae6 [Bug #21794] Fix for platforms where O_CLOEXEC is not available 2025-12-19 19:48:43 +09:00
Luke Gruber
bfd28d581c
make rb_singleton_class ractor safe (#15591)
Since singleton classes are created lazily, we need to make sure that
we lock around their creation.  Unfortunately, that means we need to
lock around every shareable object's call to `singleton_class`,
including classes and modules.
2025-12-18 12:37:27 -05:00
Luke Gruber
4fb537b1ee
Make tracepoints with set_trace_func or TracePoint.new ractor local (#15468)
Before this change, GC'ing any Ractor object caused you to lose all
enabled tracepoints across all ractors (even main). Now tracepoints are
ractor-local and this doesn't happen. Internal events are still global.

Fixes [Bug #19112]
2025-12-16 14:06:55 -05:00
Alan Wu
dce716e25b ZJIT: Update depend for zjit.o 2025-12-05 15:49:25 -05:00
Satoshi Tagomori
aaa1234702 update referenced filenames from namespace to box 2025-11-07 13:14:54 +09:00
Koichi Sasada
3f230c7eb4 add deps 2025-10-30 18:04:08 +09:00
Koichi Sasada
bc00c4468e use SET_SHAREABLE
to adopt strict shareable rule.

* (basically) shareable objects only refer shareable objects
* (exception) shareable objects can refere unshareable objects
  but should not leak reference to unshareable objects to Ruby world
2025-10-23 13:08:26 +09:00
Max Bernstein
9ad902e55c ZJIT: Inline String#==, String#=== 2025-10-22 12:39:57 -07:00
Peter Zhu
f46ebed2ff Fix memory leak of darray in loaded_features_index 2025-10-21 20:21:45 -04:00
Max Bernstein
17368234bf
ZJIT: Implement codegen for FixnumMod (#14857)
This is mostly to see what happens to the loops-times benchmark.
2025-10-20 21:30:48 +00:00
Stan Lo
2ed5a02fcc
ZJIT: Add NoSingletonClass patch point (#14680)
* ZJIT: Add NoSingletonClass patch point

This patch point makes sure that when the object has a singleton class,
the JIT code is invalidated. As of now, this is only needed for C call
optimization.

In YJIT, the singleton class guard only applies to Array, Hash, and String.
But in ZJIT, we may optimize C calls from gems (e.g. `sqlite3`). So the
patch point needs to be applied to a broader range of classes.

* ZJIT: Only generate NoSingletonClass guard when the type can have singleton class

* ZJIT: Update or forget NoSingletonClass patch point when needed
2025-10-02 09:03:25 -07:00
Satoshi Tagomori
9361af6ee7 Update dependency after rebase 2025-09-29 01:15:38 +09:00
Satoshi Tagomori
53a1ff71e7 Add and fix dependencies 2025-09-29 01:15:38 +09:00
Alan Wu
63483e75b8 ZJIT: Actually call rb_zjit_root_update_references()
Previously unused.
2025-09-25 18:36:58 -04:00
Samuel Williams
e6879401fe
Use ec->interrupt_mask to prevent interrupts. (#14588)
Disallow pending interrupts to be checked during `FiberScheduler#unblock`.

Ractors can send signals at any time, so the previous debug assertion
can fail if a Ractor sends a signal.

Co-authored-by: Luke Gruber <luke.gruber@shopify.com>
2025-09-18 14:24:29 +12:00
Nobuyoshi Nakada
9620964f9c
Use API version for syntax version instead of program version 2025-09-13 18:02:55 +09:00
Earlopain
ea8d493763
Explicitly use a ruby version for prism to parse the code as (#14523)
Prism can parse multiple versions of ruby. Because of that branch release managers are ok with simply
bumping prism to its latest version.

However, if no version is specified, it will parse as the latest known version, which can be ahead of the maintenance branch.
So we need to explicitly pass a version to not accidentally introduce new syntax to maintenance branches.
2025-09-12 13:49:35 -07:00
Stan Lo
77a421fb05
ZJIT: Clear jit entry from iseqs after TracePoint activation (#14407)
ZJIT: Remove JITed code after TracePoint is enabled
2025-09-02 19:20:08 +00:00
Luke Gruber
9db54a1a98 Fixes to encoding/transcoding for ractors.
Not all ractor-related encoding issues were fixed by 1afc07e815051e2f73493f055f2130cb642ba12a.
I found more by running my test-all branch with 3 ractors for each test.
2025-08-22 10:49:44 -07:00
Jean Boussier
b6bf44ae0f variable.c: handle cleared fields_obj in genfields cache
[Bug #21547]

Followup: https://github.com/ruby/ruby/pull/14201

When adding an instance variable and the IMEMO/fields need to be
larger, we allocate a new one and clear the old one.

Since the old one may still be in other ec's cache, on a hit we must
check the IMEMO/fields isn't a stale one.
2025-08-21 14:17:29 +02:00
Nobuyoshi Nakada
504b963762 Fix dependencies of generated prism sources for NMake
The VPATH rule of NMake is different from others.  Abandon using
them in the rules for the generated source, locate them in the top
source directory, as well as the generated library files of prism.
2025-08-18 01:01:31 +09:00
Nobuyoshi Nakada
9b576cd625 Extract ruby_api_version_name 2025-08-14 12:39:19 +09:00
Peter Zhu
31ff07ed1e Add link to Ruby options doc in help text
Adds link to https://docs.ruby-lang.org/en/master/ruby/options_md.html in
Ruby help text (-h and --help).
2025-08-13 11:24:50 -04:00
Stan Lo
4a70f946a7
ZJIT: Implement SingleRactorMode invalidation (#14121)
* ZJIT: Implement SingleRactorMode invalidation

* ZJIT: Add macro for compiling jumps

* ZJIT: Fix typo in comment

* YJIT: Fix typo in comment

* ZJIT: Avoid using unexported types in zjit.h

`enum ruby_vminsn_type` is declared in `insns.inc` and is not exported.
Using it in `zjit.h` would cause build errors when the file including it
doesn't include `insns.inc`.
2025-08-06 13:51:41 -07:00
Jean Boussier
f3206cc79b Struct: keep direct reference to IMEMO/fields when space allows
It's not rare for structs to have additional ivars, hence are one
of the most common, if not the most common type in the `gen_fields_tbl`.

This can cause Ractor contention, but even in single ractor mode
means having to do a hash lookup to access the ivars, and increase
GC work.

Instead, unless the struct is perfectly right sized, we can store
a reference to the associated IMEMO/fields object right after the
last struct member.

```
compare-ruby: ruby 3.5.0dev (2025-08-06T12:50:36Z struct-ivar-fields-2 9a30d141a1) +PRISM [arm64-darwin24]
built-ruby: ruby 3.5.0dev (2025-08-06T12:57:59Z struct-ivar-fields-2 2ff3ec237f) +PRISM [arm64-darwin24]
warming up.....

|                      |compare-ruby|built-ruby|
|:---------------------|-----------:|---------:|
|member_reader         |    590.317k|  579.246k|
|                      |       1.02x|         -|
|member_writer         |    543.963k|  527.104k|
|                      |       1.03x|         -|
|member_reader_method  |    213.540k|  213.004k|
|                      |       1.00x|         -|
|member_writer_method  |    192.657k|  191.491k|
|                      |       1.01x|         -|
|ivar_reader           |    403.993k|  569.915k|
|                      |           -|     1.41x|
```

Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
2025-08-06 17:07:49 +02:00
Takashi Kokubun
2cd10de330
ZJIT: Prepare for sharing JIT hooks with ZJIT (#14044) 2025-07-30 10:11:10 -07:00
Nobuyoshi Nakada
fb6f255028
Rename builtin_binary.inc as .rbbin
Distinguish between platform-dependent ".rbbin" and platform-
independent ".inc" files.
2025-07-26 20:19:55 +09:00
Hiroshi SHIBATA
9e105a5037 update-deps 2025-07-25 19:50:06 +09:00
Hiroshi SHIBATA
be7b1164e6 Split autogenerated dependency to depend file from common.mk 2025-07-25 19:50:06 +09:00