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

1078 Коммитов

Автор SHA1 Сообщение Дата
Yusuke Endoh ae5458f228 thread.c: Convert TAG_BREAK to a normal exception at thread top-level
[Bug #18475]
2022-01-13 03:21:45 +09:00
S.H 75aae66c4f
Some codes replace to `RBOOL` macro (#5023)
* Some code replace and using RBOOL macro

* Fix indent

* Using RBOOL in syserr_eqq function
2021-11-09 17:09:29 +09:00
Peter Zhu aeae6e2842 [Feature #18290] Remove all usages of rb_gc_force_recycle
This commit removes usages of rb_gc_force_recycle since it is a burden
to maintain and makes changes to the GC difficult.
2021-11-08 14:05:54 -05:00
Yuta Saito 8590d61ea9 Select including thread impl file at config time 2021-10-30 10:18:33 +09:00
Nobuyoshi Nakada 33844f3096
Prefer ANSI-style prototypes over old K&R-style definitions 2021-10-27 10:16:52 +09:00
Yusuke Endoh 86e3d77abb
Make Coverage suspendable (#4856)
* Make Coverage suspendable

Add `Coverage.suspend`, `Coverage.resume` and some methods.

[Feature #18176] [ruby-core:105321]
2021-10-25 20:00:51 +09:00
Nobuyoshi Nakada 9822ebee5b suppress warnings by parenthesizing unclear expressions 2021-10-24 19:24:50 +09:00
S.H dc9112cf10
Using NIL_P macro instead of `== Qnil` 2021-10-03 22:34:45 +09:00
Nobuyoshi Nakada 19f9d9cf73 Remove extraneous conversion to float [Bug #18236] 2021-10-03 22:06:31 +09:00
Nobuyoshi Nakada ff480f2953
Cast to void pointer to suppress -Wformat-pedantic in RUBY_DEBUG_LOG 2021-10-03 13:59:48 +09:00
S-H-GAMELINKS 1e9a688cd5 Move some function declaration to internal/io.h 2021-09-28 18:08:08 +13:00
S.H b8c3a84bdd
Refactor and Using RBOOL macro 2021-09-15 08:11:05 +09:00
S-H-GAMELINKS 032534dbdf Using RB_BIGNUM_TYPE_P macro 2021-09-11 09:13:24 +09:00
Samuel Williams 2d4f29e77e Fix potential hang when joining threads.
If the thread termination invokes user code after `th->status` becomes
`THREAD_KILLED`, and the user unblock function causes that `th->status` to
become something else (e.g. `THREAD_RUNNING`), threads waiting in
`thread_join_sleep` will hang forever. We move the unblock function call
to before the thread status is updated, and allow threads to join as soon
as `th->value` becomes defined.

This reverts commit 6505c77501.
2021-08-03 22:23:48 +12:00
S.H 378e8cdad6
Using RBOOL macro 2021-08-02 12:06:44 +09:00
Yusuke Endoh 6505c77501 Revert "Fix potential hang when joining threads."
This reverts commit 13f8521c63.

http://rubyci.s3.amazonaws.com/solaris11-gcc/ruby-master/log/20210727T230009Z.fail.html.gz
http://rubyci.s3.amazonaws.com/solaris11-sunc/ruby-master/log/20210728T000009Z.fail.html.gz

This revert is to confirm whether the commit is the cause.
If the failures consistently occur after this revert, I'll
reintroduce the commit.
2021-07-28 11:05:36 +09:00
Nobuyoshi Nakada 82191da2a2 Predefine recursive key ID 2021-07-27 15:40:27 +09:00
Samuel Williams 13f8521c63 Fix potential hang when joining threads.
If the thread termination invokes user code after `th->status` becomes
`THREAD_KILLED`, and the user unblock function causes that `th->status` to
become something else (e.g. `THREAD_RUNNING`), threads waiting in
`thread_join_sleep` will hang forever. We move the unblock function call
to before the thread status is updated, and allow threads to join as soon
as `th->value` becomes defined.
2021-07-27 18:23:30 +12:00
Nobuyoshi Nakada 070557afc4 Distinguish signal and timeout [Bug #16608] 2021-07-25 13:09:03 -07:00
Samuel Williams 42130a64f0
Replace copy coroutine with pthread implementation. 2021-07-01 11:23:03 +12:00
Nobuyoshi Nakada 9eae8cdefb
Prefer qualified names under Thread 2021-06-29 11:41:10 +09:00
Nobuyoshi Nakada 358a357f72
Reduce repeated same code 2021-06-24 13:27:02 +09:00
Samuel Williams 45e65f302b Deprecate and rework old (fd) centric functions. 2021-06-22 22:48:57 +12:00
Nobuyoshi Nakada e4f891ce8d
Adjust styles [ci skip]
* --braces-after-func-def-line
* --dont-cuddle-else
* --procnames-start-lines
* --space-after-for
* --space-after-if
* --space-after-while
2021-06-17 10:13:40 +09:00
Samuel Williams 050a895439
Wake up join list within thread EC context. (#4471)
* Wake up join list within thread EC context.

* Consume items from join list so that they are not re-executed.

If `rb_fiber_scheduler_unblock` raises an exception, it can result in a
segfault if `rb_threadptr_join_list_wakeup` is not within a valid EC. This
change moves `rb_threadptr_join_list_wakeup` into the thread's top level EC
which initially caused an infinite loop because on exception will retry. We
explicitly remove items from the thread's join list to avoid this situation.

* Verify the required scheduler interface.

* Test several scheduler hooks methods with broken `unblock` implementation.
2021-06-14 17:56:53 +12:00
Nobuyoshi Nakada 93be7a4c6b
Suppress clobbered warnings on Travis-CI ppc64le-linux 2021-06-03 20:07:26 +09:00
Nobuyoshi Nakada 9024c7f1bb
Make `Thread#native_thread_id` not-implemented if unsupported
Raise `NotImplementedError` on unsupported platforms regardless
the argument consistently.
2021-06-01 22:27:13 +09:00
NARUSE, Yui 46655156dc Add Thread#native_thread_id [Feature #17853] 2021-05-26 15:14:11 +09:00
Jeremy Evans 5c4ff3f00c Document how to handle kill/terminate interrupts in Thread.handle_interrupt
The kill/terminate interrupts are internally handled not as Exception
instances, but as integers.  So using Exception doesn't handle these
interrupts, but Object does.  You can use Integer if you only want to
handle kill/terminate interrupts, but that's probably more of an
implementation detail, while handling Object should work regardless
of the implementation.

Fixes [Bug #15735]
2021-04-08 07:53:06 -07:00
Nobuyoshi Nakada 2a83650b0f Destroy VM-wise locks before freeing [Bug #15852] 2021-03-09 20:11:34 +09:00
Nobuyoshi Nakada b3c53a8a88
Make Ractor stdio belonging to the Ractor [Bug #17672]
Defer making ractor stdio until ractor started.
Before ractor started, created objects belong to the caller ractor
instead of the created ractor.
2021-03-07 00:58:28 +09:00
Jeremy Evans fc83b4896e Don't document that Thread#group can return nil
Thread's are assigned a group at initialization, and no API exists
for them to unassign them from a group without assigning them to
another group.

Fixes [Bug #17505]
2021-02-10 07:55:53 -08:00
Samuel Williams 5f69a7f604
Expose scheduler as public interface & bug fixes. (#3945)
* Rename `rb_scheduler` to `rb_fiber_scheduler`.

* Use public interface if available.

* Use `rb_check_funcall` where possible.

* Don't use `unblock` unless the fiber was non-blocking.
2021-02-09 19:39:56 +13:00
Koichi Sasada b2674c1fd7 unblock thread is only for main ractor.
other ractors should not have a unblock thread.
This patch fixes 6f727853ce.
2021-02-05 15:33:00 +09:00
Koichi Sasada 6f727853ce only main thread can modify vm->ubf_async_safe
vm->ubf_async_safe is VM global resource and only main thread
can manipulate it.
[Bug #17482]
2021-02-03 08:53:02 +09:00
Gannon McGibbon 9e0075a3d9 Replace "iff" with "if and only if"
iff means if and only if, but readers without that knowledge might
assume this to be a spelling mistake. To me, this seems like
exclusionary language that is unnecessary. Simply using "if and only if"
instead should suffice.
2021-01-19 12:06:45 -08:00
Koichi Sasada 7340e7f827 introduce rb_ractor_atfork()
to reset main ractor at fork().
2020-12-24 04:30:50 +09:00
Koichi Sasada e052d07163 Revert "need to clear blocking cnt at fork (child process)"
This reverts commit 0dd4896175.

It breaks the tests on RUBY_DEBUG=1.
2020-12-23 16:55:36 +09:00
Koichi Sasada 0dd4896175 need to clear blocking cnt at fork (child process) 2020-12-23 14:41:44 +09:00
Koichi Sasada 7204b81bcb fix to use rb_ractor_id()
Catch up recent changes on USE_RUBY_DEBUG_LOG=1.
2020-12-22 12:59:47 +09:00
Koichi Sasada 967040ba59 Introduce negative method cache
pCMC doesn't have negative method cache so this patch  implements it.
2020-12-14 11:57:46 +09:00
Koichi Sasada c2fa024e02 fix Thread's interrupt and Ractor#take issue
Thread's interrupt set Ractor's wakeup_status as interrupted, but
the status remains next Ractor communication API. This patch makes
to ignore the previous interrupt state.
[Bug #17366]

Also this patch solves the Thread#kill and Ractor#take issues.
2020-12-07 16:01:35 +09:00
Nobuyoshi Nakada d2b7e1e4b2
Protoized old pre-ANSI K&R style definitions 2020-12-05 14:57:31 +09:00
Samuel Williams 3b5b309b7b Proposed method for dealing with stack locals which have non-local lifetime. 2020-12-05 11:38:56 +13:00
Koichi Sasada a79fe07db6 show the error message before Ractor.yield
Ractor's error will be printed if Thread#report_on_exception
is true (default), and error message is used. Without this patch,
the exception object is sent by Ractor.yield and it can be shared
with another ractor.

http://ci.rvm.jp/results/trunk-random3@phosphorus-docker/3269368

To prevent such sharing, show errors befor Ractor.yield().
2020-11-25 15:08:10 +09:00
Koichi Sasada 5e3259ea74 fix public interface
To make some kind of Ractor related extensions, some functions
should be exposed.

* include/ruby/thread_native.h
  * rb_native_mutex_*
  * rb_native_cond_*
* include/ruby/ractor.h
  * RB_OBJ_SHAREABLE_P(obj)
  * rb_ractor_shareable_p(obj)
  * rb_ractor_std*()
  * rb_cRactor

and rm ractor_pub.h
and rename srcdir/ractor.h to srcdir/ractor_core.h
    (to avoid conflict with include/ruby/ractor.h)
2020-11-18 03:52:41 +09:00
Koichi Sasada db31ace934 Threads in a ractor will be killed with the ractor
If a terminating ractor has child threads, then kill all child
threads.
2020-11-11 15:49:02 +09:00
Koichi Sasada 1e8abe5d03 introduce USE_VM_CLOCK for windows.
The timer function used on windows system set timer interrupt
flag of current main ractor's executing ec and thread can detect
the end of time slice. However, to set all ec->interrupt_flag for
all running ractors, it is requires to synchronize with other ractors.
However, timer thread can not acquire the ractor-wide lock because
of some limitation.

To solve this issue, this patch introduces USE_VM_CLOCK compile option
to introduce rb_vm_t::clock. This clock will be incremented by the
timer thread and each thread can check the incrementing by comparison
with previous checked clock. At last, on windows platform this patch
introduces some overhead, but I think there is no critical performance
issue because of this modification.
2020-11-11 15:49:02 +09:00
Samuel Williams a08ee8330d Rename to `Fiber#set_scheduler`. 2020-11-07 23:39:50 +13:00
Koichi Sasada 08ddc335ea sync vm->waiting_fds correctly.
vm->waiting_fds is global resource so we need to lock it correctly.
(forgot to sync one place)
2020-10-30 16:52:09 +09:00
Jeremy Evans dfb3605bbe
Add Thread.ignore_deadlock accessor
Setting this to true disables the deadlock detector.  It should
only be used in cases where the deadlock could be broken via some
external means, such as via a signal.

Now that $SAFE is no longer used, replace the safe_level_ VM flag
with ignore_deadlock for storing the setting.

Fixes [Bug #13768]
2020-10-28 15:27:00 -07:00
Stefan Stüben 8c2e5bbf58 Don't redefine #rb_intern over and over again 2020-10-21 12:45:18 +09:00
Benoit Daloze bfc1c7205d Add Ractor#receive and Ractor.receive and use it in all places
* Keep Ractor#recv/Ractor.recv as an alias for now.
2020-10-10 12:48:09 +02:00
Samuel Williams 2db081b5ff Don't use `th->scheduler` directly because it's not always valid to do so. 2020-10-01 21:38:36 +13:00
Nobuyoshi Nakada 0d37ed5fdc
rb_thread_scheduler is no longer used 2020-10-01 13:45:20 +09:00
Samuel Williams dd2e95fb26 Remove `Thread.scheduler` from public interface.
It's implementation is equivalent to:

Thread.current.scheduler unless Thread.current.blocking?
2020-10-01 16:56:05 +13:00
Benoit Daloze 82998918ef Make Thread#join always convert its argument, as before 70f08f1eed 2020-09-21 16:22:04 +02:00
Benoit Daloze 0fa1c82bfc Make it clear the first field of join_arg is the waiting thread
* And not some list of sort.
2020-09-21 15:58:08 +02:00
Samuel Williams 70f08f1eed Make `Thread#join` non-blocking. 2020-09-21 11:48:44 +12:00
Samuel Williams 501fff14c7 When setting current thread scheduler to nil, invoke `#close`. 2020-09-21 09:51:33 +12:00
Benoit Daloze 9472d16061 Call scheduler.block instead of scheduler.kernel_sleep for blocking Queue/SizedQueue operations
* scheduler.unblock was already already called before but with no corresponding scheduler.block
* add test that Queue#pop makes the scheduler wait until it gets an element.
2020-09-17 14:59:38 +02:00
Koichi Sasada f7ccb8dd88 restart Ractor.select on intterupt
signal can interrupt Ractor.select, but if there is no exception,
Ractor.select should restart automatically.
2020-09-15 00:04:59 +09:00
Samuel Williams 8eea66a0ca Add support for Queue & SizedQueue. 2020-09-14 16:44:09 +12:00
Benoit Daloze 178c1b0922 Make Mutex per-Fiber instead of per-Thread
* Enables Mutex to be used as synchronization between multiple Fibers
  of the same Thread.
* With a Fiber scheduler we can yield to another Fiber on contended
  Mutex#lock instead of blocking the entire thread.
* This also makes the behavior of Mutex consistent across CRuby, JRuby and TruffleRuby.
* [Feature #16792]
2020-09-14 16:44:09 +12:00
Samuel Williams d387029f39 Standardised scheduler interface. 2020-09-14 16:44:09 +12:00
Samuel Williams 703e529751 Add `rb_thread_current_scheduler()`. 2020-09-14 16:44:09 +12:00
Hiroshi SHIBATA e691e671ca Removed Thread#safe_level 2020-09-11 10:52:52 +09:00
Matt Valentine-House ef22af4db0 If the GC runs before the Mutex's are initialised then we get a crash in pthread_mutex_lock.
It is possible for GC to run during initialisation due to objects being allocated
2020-09-10 08:48:51 -07:00
Koichi Sasada 79df14c04b Introduce Ractor mechanism for parallel execution
This commit introduces Ractor mechanism to run Ruby program in
parallel. See doc/ractor.md for more details about Ractor.
See ticket [Feature #17100] to see the implementation details
and discussions.

[Feature #17100]

This commit does not complete the implementation. You can find
many bugs on using Ractor. Also the specification will be changed
so that this feature is experimental. You will see a warning when
you make the first Ractor with `Ractor.new`.

I hope this feature can help programmers from thread-safety issues.
2020-09-03 21:11:06 +09:00
Nobuyoshi Nakada a90f29ebb2
procnames-start-lines [ci skip] 2020-08-17 14:27:34 +09:00
Samuel Williams f3462d99a3 Rename `rb_current_thread_scheduler` to `rb_thread_scheduler_if_nonblocking`.
Correctly capture thread before releasing GVL and pass as argument to
`rb_thread_scheduler_if_nonblocking`.
2020-07-20 13:20:58 +12:00
卜部昌平 de3e931df7 add UNREACHABLE_RETURN
Not every compilers understand that rb_raise does not return.  When a
function does not end with a return statement, such compilers can issue
warnings.  We would better tell them about reachabilities.
2020-06-29 11:05:41 +09:00
卜部昌平 8fc8912109 exec_recursive: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
2020-06-29 11:05:41 +09:00
Yusuke Endoh 50efa18c6c compile.c: Improve branch coverage instrumentation [Bug #16967]
Formerly, branch coverage measurement counters are generated for each
compilation traverse of the AST.  However, ensure clause node is
traversed twice; one is for normal-exit case (the resulted bytecode is
embedded in its outer scope), and the other is for exceptional case (the
resulted bytecode is used in catch table).  Two branch coverage counters
are generated for the two cases, but it is not desired.

This changeset revamps the internal representation of branch coverage
measurement.  Branch coverage counters are generated only at the first
visit of a branch node.  Visiting the same node reuses the
already-generated counter, so double counting is avoided.
2020-06-20 09:28:03 +09:00
Jeremy Evans 4e1f2283b4 Make Thread#thread_variable? similar to #thread_variable_get
Don't use rb_check_id, which only works for pinned symbols.
Switch inadvertent creation test for thread_variable? to
only check for pinned symbols, same as thread_variable_get
and thread_variable_set.

Make key variable name in thread_local_set match
thread_local_get and thread_variable?.

Fixes [Bug #16906]
2020-05-25 21:38:35 -07:00
Samuel Williams 0e3b0fcdba
Thread scheduler for light weight concurrency. 2020-05-14 22:10:55 +12:00
Kazuhiro NISHIYAMA 7cc55f4bc4
Thread#backtrace may return nil [ci skip] 2020-05-12 11:46:41 +09:00
卜部昌平 9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平 d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
Koichi Sasada fd0222caed should check pending interrupts correctly.
rb_uninterruptible() disables any interrupts using handle_interrupt
feature (This function is used by `p`).
After this function, pending interrupts should be checked correctly,
however there is no chance to setup interrupt flag of working
threads, it means that nobody checks pending interrupts.
For example, it ignores terminate signal delivered at the end
of main thread and program can't stop.

This patch set interrupt flag if there are pending interrupts.
2020-04-09 12:51:51 +09:00
卜部昌平 9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Koichi Sasada ff98931dac check flags passed to rb_nogvl()
RB_NOGVL_UBF_ASYNC_SAFE is wrongly specified because flags
is not checked.
[Bug #15499] 23444302
2020-03-26 01:19:35 +09:00
卜部昌平 c7e6dbd5ab fix arity mismatch
This is a ruby method with arity zero.  Which means, this function takes
one argument (that is self).
2020-02-20 11:46:54 +09:00
卜部昌平 115fec062c more on NULL versus functions.
Function pointers are not void*.  See also
ce4ea956d2
8427fca49b
2020-02-07 14:24:19 +09:00
Nobuyoshi Nakada 7584853cfe
st_delete_wrap is no longer used 2020-01-11 10:43:39 +09:00
Lourens Naudé 40c57ad4a1 Let execution context local storage be an ID table 2020-01-11 14:40:36 +13:00
Jeremy Evans beae6cbf0f Fully separate positional arguments and keyword arguments
This removes the warnings added in 2.7, and changes the behavior
so that a final positional hash is not treated as keywords or
vice-versa.

To handle the arg_setup_block splat case correctly with keyword
arguments, we need to check if we are taking a keyword hash.
That case didn't have a test, but it affects real-world code,
so add a test for it.

This removes rb_empty_keyword_given_p() and related code, as
that is not needed in Ruby 3.  The empty keyword case is the
same as the no keyword case in Ruby 3.

This changes rb_scan_args to implement keyword argument
separation for C functions when the : character is used.
For backwards compatibility, it returns a duped hash.
This is a bad idea for performance, but not duping the hash
breaks at least Enumerator::ArithmeticSequence#inspect.

Instead of having RB_PASS_CALLED_KEYWORDS be a number,
simplify the code by just making it be rb_keyword_given_p().
2020-01-02 18:40:45 -08:00
Kazuhiro NISHIYAMA bb5b8ace8d
Fix typo 2019-12-28 21:10:08 +09:00
卜部昌平 5e22f873ed decouple internal.h headers
Saves comitters' daily life by avoid #include-ing everything from
internal.h to make each file do so instead.  This would significantly
speed up incremental builds.

We take the following inclusion order in this changeset:

1.  "ruby/config.h", where _GNU_SOURCE is defined (must be the very
    first thing among everything).
2.  RUBY_EXTCONF_H if any.
3.  Standard C headers, sorted alphabetically.
4.  Other system headers, maybe guarded by #ifdef
5.  Everything else, sorted alphabetically.

Exceptions are those win32-related headers, which tend not be self-
containing (headers have inclusion order dependencies).
2019-12-26 20:45:12 +09:00
卜部昌平 33e9601938 TIMESPEC_SEC_MAX might be bigger than 53 bits.
The same as 41bc766763.  Read that commit
for what is happening.
2019-12-26 20:45:12 +09:00
卜部昌平 bf53d6c7d1 other minior internal header tweaks
These headers need no rewrite.  Just add some minor tweaks, like
addition of #include lines.  Mainly cosmetic.

TIMET_MAX_PLUS_ONE was deleted because the macro was used from only
one place (directly write expression there).
2019-12-26 20:45:12 +09:00
Eric Wong b12bc3b046 thread.c: avoid needless read after select|ppoll
We do not need to issue pipe|eventfd read(2) syscall
unless select, ppoll|poll declares the FD needs reading.
2019-12-16 18:31:08 +00:00
Jean byroot Boussier 8a80bfcfd4 Make Thread#to_s consistent with Method and Proc to_s 2019-12-11 11:59:14 +09:00
Koichi Sasada ee57920008 move an interrupt point.
`args_ptr` can be corrupted by interrupt handlers.
Pointed by nagachika <https://ruby-trunk-changes.hatenablog.com/entry/ruby_trunk_changes_20191204>.
2019-12-05 15:57:23 +09:00
Jeremy Evans 5c2c396685 Check interrupts before starting thread
Fixes a hang when Thread.new calls Thread.new in a loop.

Fixes [Bug #13688]
2019-12-03 17:27:34 +02:00
Jeremy Evans ffd0820ab3 Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
2019-11-18 01:00:25 +02:00
Jeremy Evans c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
2019-11-18 01:00:25 +02:00
John Hawthorn ebbe396d3c Use ident hash for top-level recursion check
We track recursion in order to not infinite loop in ==, inspect, and
similar methods by keeping a thread-local 1 or 2 level hash. This allows
us to track when we have seen the same object (ex. using inspect) or
same pair of objects (ex. using ==) in this stack before and to treat
that differently.

Previously both levels of this Hash used the object's memory_id as a key
(using object_id would be slow and wasteful). Unfortunately, prettyprint
(pp.rb) uses this thread local variable to "pretend" to be inspect and
inherit its same recursion behaviour.

This commit changes the top-level hash to be an identity hash and to use
objects as keys instead of their object_ids.

I'd like to have also converted the 2nd level hash to an ident hash, but
it would have prevented an optimization which avoids allocating a 2nd
level hash for only a single element, which we want to keep because it's
by far the most common case.

So the new format of this hash is:

{ object => true } (not paired)
{ lhs_object => rhs_object_memory_id } (paired, single object)
{ lhs_object => { rhs_object_memory_id => true, ... } } (paired, many objects)

We must also update pp.rb to match this (using identity hashes).
2019-11-04 15:27:15 -08:00
Ben Woosley bb71a128eb Prefer st_is_member over st_lookup with 0
The st_is_member DEFINE has simpler semantics, for more readable code.
2019-10-09 23:46:50 +09:00
卜部昌平 7e0ae1698d avoid overflow in integer multiplication
This changeset basically replaces `ruby_xmalloc(x * y)` into
`ruby_xmalloc2(x, y)`.  Some convenient functions are also
provided for instance `rb_xmalloc_mul_add(x, y, z)` which allocates
x * y + z byes.
2019-10-09 12:12:28 +09:00