Skip to content

Conversation

@ko1
Copy link
Contributor

@ko1 ko1 commented Dec 4, 2025

  1. (experimental) RUBY_TYPED_FROZEN_SHAREABLE_NO_REC

    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.

  2. Method and UnboundMethod can be sharable

    with RUBY_TYPED_FROZEN_SHAREABLE_NO_REC,
    if the receiver object is shareable on Method objects.

`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.
@ko1 ko1 enabled auto-merge (rebase) December 4, 2025 16:23
@launchable-app

This comment has been minimized.

with `RUBY_TYPED_FROZEN_SHAREABLE_NO_REC`,
if the receiver object is shareable on Method objects.
@ko1 ko1 force-pushed the sharable_method branch from f3af8c4 to f9a174b Compare December 4, 2025 16:56
@ko1 ko1 merged commit 4c893e2 into ruby:master Dec 4, 2025
90 of 92 checks passed
@eregon eregon mentioned this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant