ruby/internal
Koichi Sasada 2f50936cb9 Ractor.make_shareable(obj)
Introduce new method Ractor.make_shareable(obj) which tries to make
obj shareable object. Protocol is here.

(1) If obj is shareable, it is shareable.
(2) If obj is not a shareable object and if obj can be shareable
    object if it is frozen, then freeze obj. If obj has reachable
    objects (rs), do rs.each{|o| Ractor.make_shareable(o)}
    recursively (recursion is not Ruby-level, but C-level).
(3) Otherwise, raise Ractor::Error. Now T_DATA is not a shareable
    object even if the object is frozen.

If the method finished without error, given obj is marked as
a sharable object.

To allow makng a shareable frozen T_DATA object, then set
`RUBY_TYPED_FROZEN_SHAREABLE` as type->flags. On default,
this flag is not set. It means user defined T_DATA objects are
not allowed to become shareable objects when it is frozen.

You can make any object  shareable by setting FL_SHAREABLE flag,
so if you know that the T_DATA object is shareable (== thread-safe),
set this flag, at creation time for example. `Ractor` object is one
example, which is not a frozen, but a shareable object.
2020-10-21 07:59:24 +09:00
..
array.h RARRAY_AREF: convert into an inline function 2020-08-15 12:09:26 +09:00
bignum.h include/ruby/backward/2/r_cast.h: deprecate 2020-08-27 15:03:36 +09:00
bits.h Fix a typo [ci skip] 2020-05-18 17:42:50 +09:00
class.h sync RClass::ext::iv_index_tbl 2020-10-17 08:18:04 +09:00
compar.h add #include guard hack 2020-04-13 16:06:00 +09:00
compile.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
compilers.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
complex.h include/ruby/backward/2/r_cast.h: deprecate 2020-08-27 15:03:36 +09:00
cont.h Make Mutex per-Fiber instead of per-Thread 2020-09-14 16:44:09 +12:00
dir.h add #include guard hack 2020-04-13 16:06:00 +09:00
enc.h add #include guard hack 2020-04-13 16:06:00 +09:00
encoding.h add #include guard hack 2020-04-13 16:06:00 +09:00
enum.h add #include guard hack 2020-04-13 16:06:00 +09:00
enumerator.h add #include guard hack 2020-04-13 16:06:00 +09:00
error.h Disable deprecation warning by the default [Feature #16345] 2020-09-25 09:50:33 +09:00
eval.h add #include guard hack 2020-04-13 16:06:00 +09:00
file.h add #include guard hack 2020-04-13 16:06:00 +09:00
fixnum.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
gc.h Initialize new T_OBJECT as ROBJECT_EMBED 2020-09-02 14:54:29 -07:00
hash.h Ractor.make_shareable(obj) 2020-10-21 07:59:24 +09:00
imemo.h include/ruby/backward/2/r_cast.h: deprecate 2020-08-27 15:03:36 +09:00
inits.h add #include guard hack 2020-04-13 16:06:00 +09:00
io.h add #include guard hack 2020-04-13 16:06:00 +09:00
load.h add #include guard hack 2020-04-13 16:06:00 +09:00
loadpath.h add #include guard hack 2020-04-13 16:06:00 +09:00
math.h add #include guard hack 2020-04-13 16:06:00 +09:00
missing.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
mjit.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
numeric.h include/ruby/backward/2/r_cast.h: deprecate 2020-08-27 15:03:36 +09:00
object.h ROBJECT_IV_INDEX_TBL: convert into an inline function 2020-08-19 14:30:57 +09:00
parse.h add #include guard hack 2020-04-13 16:06:00 +09:00
proc.h Moved rb_callable_receiver internal 2020-10-06 10:11:51 +09:00
process.h Allow Dir.home to work for non-login procs when $HOME not set 2020-05-23 23:16:28 +09:00
random.h add #include guard hack 2020-04-13 16:06:00 +09:00
range.h Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241) 2020-10-21 02:40:18 +09:00
rational.h include/ruby/backward/2/r_cast.h: deprecate 2020-08-27 15:03:36 +09:00
re.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
sanitizers.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
scheduler.h Make `Thread#join` non-blocking. 2020-09-21 11:48:44 +12:00
serial.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
signal.h add #include guard hack 2020-04-13 16:06:00 +09:00
static_assert.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
string.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
struct.h include/ruby/backward/2/r_cast.h: deprecate 2020-08-27 15:03:36 +09:00
symbol.h add #include guard hack 2020-04-13 16:06:00 +09:00
thread.h Standardised scheduler interface. 2020-09-14 16:44:09 +12:00
time.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
transcode.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
util.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00
variable.h Introduce Ractor mechanism for parallel execution 2020-09-03 21:11:06 +09:00
vm.h Expose ec -> backtrace (internal) and use it to implement fiber backtrace. 2020-08-18 00:56:35 +12:00
warnings.h sed -i 's|ruby/impl|ruby/internal|' 2020-05-11 09:24:08 +09:00