Age | Commit message (Collapse) | Author |
|
WeakMap can crash during compaction because the st_insert could allocate
memory.
|
|
If we're during incremental marking, then Ruby code can execute that
deallocates certain memory buffers that have been called with
rb_gc_mark_weak, which can cause use-after-free bugs.
Notes:
Merged: https://github.com/ruby/ruby/pull/8375
|
|
Previously we used the next character following the found prefix to
determine if the match ended on a broken character.
This had caused surprising behaviour when a valid character was followed
by a UTF-8 continuation byte.
This commit changes the behaviour to instead look for the end of the
last character in the prefix.
[Bug #19784]
Co-authored-by: ywenc <ywenc@github.com>
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Notes:
Merged: https://github.com/ruby/ruby/pull/8348
|
|
This is an internal only function not exposed to the C extension API.
It's only use so far is from rb_vm_mark, where it's used to mark the
values in the vm->trap_list.cmd array.
There shouldn't be any reason why these cannot move.
This commit allows them to move by updating their references during the
reference updating step of compaction.
To do this we've introduced another internal function
rb_gc_update_values as a partner to rb_gc_mark_values.
This allows us to refactor rb_gc_mark_values to not pin
Notes:
Merged: https://github.com/ruby/ruby/pull/8341
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/8296
|
|
[Feature #19783]
This commit adds support for weak references in the GC through the
function `rb_gc_mark_weak`. Unlike strong references, weak references
does not mark the object, but rather lets the GC know that an object
refers to another one. If the child object is freed, the pointer from
the parent object is overwritten with `Qundef`.
Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
Notes:
Merged: https://github.com/ruby/ruby/pull/8113
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/8289
|
|
duplicated typedef declaration was not allowed in C99.
Notes:
Merged: https://github.com/ruby/ruby/pull/8274
|
|
duplicated typedef declaration was not allowed in C99.
Notes:
Merged: https://github.com/ruby/ruby/pull/8274
|
|
Fixes [Bug #17646]
Patch from xtkoba (Tee KOBAYASHI)
Notes:
Merged: https://github.com/ruby/ruby/pull/8288
|
|
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
|
|
Also an option command line should have precedence over `RUBYOPT`.
Notes:
Merged: https://github.com/ruby/ruby/pull/8200
|
|
|
|
[Feature #18885]
For now, the optimizations performed are:
- Run a major GC
- Compact the heap
- Promote all surviving objects to oldgen
Other optimizations may follow.
Notes:
Merged: https://github.com/ruby/ruby/pull/7662
|
|
Notes:
Merged-By: maximecb <maximecb@ruby-lang.org>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/8071
|
|
RARRAY_CONST_PTR now does the same things as RARRAY_CONST_PTR_TRANSIENT.
Notes:
Merged: https://github.com/ruby/ruby/pull/8071
|
|
Command line options should have higher precedence than the same
options in shebang and `RUBYOPT`.
Notes:
Merged: https://github.com/ruby/ruby/pull/8068
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/8068
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7942
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7983
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7983
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7976
Merged-By: nobu <nobu@ruby-lang.org>
|
|
SunC warns use of `NULL`, pointer to data as function pointers.
Notes:
Merged: https://github.com/ruby/ruby/pull/7972
Merged-By: nobu <nobu@ruby-lang.org>
|
|
Introduce `Module#set_temporary_name` for setting identifiers for otherwise
anonymous modules/classes.
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
|
|
It's a bad idea to overwrite the flags as the garbage collector may have
set other flags.
Notes:
Merged: https://github.com/ruby/ruby/pull/7940
|
|
|
|
Introduce Universal Parser mode for the parser.
This commit includes these changes:
* Introduce `UNIVERSAL_PARSER` macro. All of CRuby related functions
are passed via `struct rb_parser_config_struct` when this macro is enabled.
* Add CI task with 'cppflags=-DUNIVERSAL_PARSER' for ubuntu.
Notes:
Merged: https://github.com/ruby/ruby/pull/7927
|
|
Hashes are no longer allocated on the transient heap.
|
|
* Add deprecations for public struct rb_io members.
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
|
|
The benchmark results show that this feature has either a positive or
no impact on performance. The memory usage is also mostly unchanged,
except in hexapdf, where there is a decrease in RSS.
-------------- ----------- ---------- --------- ----------- ---------- --------- -------------- -------------
bench master (ms) stddev (%) RSS (MiB) branch (ms) stddev (%) RSS (MiB) branch 1st itr master/branch
activerecord 70.8 2.2 56.0 71.7 2.2 56.0 0.99 0.99
erubi_rails 20.5 13.6 94.7 20.5 14.3 94.2 0.93 1.00
hexapdf 2541.0 0.7 212.8 2544.4 0.7 203.4 1.00 1.00
liquid-c 65.6 0.3 38.9 65.3 0.3 38.9 1.01 1.01
liquid-compile 63.7 0.3 34.6 61.1 0.2 34.6 1.04 1.04
liquid-render 163.1 0.1 37.1 163.3 0.1 37.1 1.00 1.00
mail 139.3 0.1 50.5 137.0 0.1 50.1 0.99 1.02
psych-load 2065.7 0.1 36.9 2068.2 0.1 37.3 1.00 1.00
railsbench 2034.6 0.5 103.9 2031.9 0.5 103.8 1.02 1.00
ruby-lsp 65.3 3.1 89.8 66.2 3.0 89.7 1.01 0.99
sequel 73.2 1.0 40.3 73.4 1.0 40.3 1.00 1.00
-------------- ----------- ---------- --------- ----------- ---------- --------- -------------- -------------
Notes:
Merged: https://github.com/ruby/ruby/pull/7871
|
|
This reverts commit 10621f7cb9a0c70e568f89cce47a02e878af6778.
This was reverted because the gc integrity build started failing. We
have figured out a fix so I'm reopening the PR.
Original commit message:
Fix cvar caching when class is cloned
The class variable cache that was added in
ruby#4544 changed the behavior of class
variables on cloned classes. As reported when a class is cloned AND a
class variable was set, and the class variable was read from the
original class, reading a class variable from the cloned class would
return the value from the original class.
This was happening because the IC (inline cache) is stored on the ISEQ
which is shared between the original and cloned class, therefore they
share the cache too.
To fix this we are now storing the `cref` in the cache so that we can
check if it's equal to the current `cref`. If it's different we don't
want to read from the cache. If it's the same we do. Cloned classes
don't share the same cref with their original class.
This will need to be backported to 3.1 in addition to 3.2 since the bug
exists in both versions.
We also added a marking function which was missing.
Fixes [Bug #19379]
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Notes:
Merged: https://github.com/ruby/ruby/pull/7900
|
|
This reverts commit 77d1b082470790c17c24a2f406b4fec5d522636b.
|
|
The class variable cache that was added in
https://github.com/ruby/ruby/pull/4544 changed the behavior of class
variables on cloned classes. As reported when a class is cloned AND a
class variable was set, and the class variable was read from the
original class, reading a class variable from the cloned class would
return the value from the original class.
This was happening because the IC (inline cache) is stored on the ISEQ
which is shared between the original and cloned class, therefore they
share the cache too.
To fix this we are now storing the `cref` in the cache so that we can
check if it's equal to the current `cref`. If it's different we don't
want to read from the cache. If it's the same we do. Cloned classes
don't share the same cref with their original class.
This will need to be backported to 3.1 in addition to 3.2 since the bug
exists in both versions.
We also added a marking function which was missing.
Fixes [Bug #19379]
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Notes:
Merged: https://github.com/ruby/ruby/pull/7265
|
|
Because a thread calling IO#close now blocks in a native condvar wait,
it's possible for there to be _no_ threads left to actually handle
incoming signals/ubf calls/etc.
This manifested as failing tests on Solaris 10 (SPARC), because:
* One thread called IO#close, which sent a SIGVTALRM to the other
thread to interrupt it, and then waited on the condvar to be notified
that the reading thread was done.
* One thread was calling IO#read, but it hadn't yet reached the actual
call to select(2) when the SIGVTALRM arrived, so it never unblocked
itself.
This results in a deadlock.
The fix is to use a real Ruby mutex for the close lock; that way, the
closing thread goes into sigwait-sleep and can keep trying to interrupt
the select(2) thread.
See the discussion in: https://github.com/ruby/ruby/pull/7865/
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
|
|
This reverts commit 18e55fc1e1ec20e8f3166e3059e76c885fc9f8f2.
fix [Bug #19704]
https://bugs.ruby-lang.org/issues/19704
This breaks compatibility for extension libraries. Such changes
need a discussion.
|
|
* Add rb_io_path and rb_io_open_descriptor.
* Use rb_io_open_descriptor to create PTY objects
* Rename FMODE_PREP -> FMODE_EXTERNAL and expose it
FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but
FMODE_EXTERNAL is clearer about what the file descriptor represents and
aligns with language in the IO::Buffer module.
* Ensure that rb_io_open_descriptor closes the FD if it fails
If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be
responsible for closing your file, eventually, if you pass it to
rb_io_open_descriptor, even if it raises an exception.
* Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P
* Expose `rb_io_closed_p`.
* Add `rb_io_mode` to get IO mode.
---------
Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
|
|
When one thread is closing a file descriptor whilst another thread is
concurrently reading it, we need to wait for the reading thread to be
done with it to prevent a potential EBADF (or, worse, file descriptor
reuse).
At the moment, that is done by keeping a list of threads still using the
file descriptor in io_close_fptr. It then continually calls
rb_thread_schedule() in fptr_finalize_flush until said list is empty.
That busy-looping seems to behave rather poorly on some OS's,
particulary FreeBSD. It can cause the TestIO#test_race_gets_and_close
test to fail (even with its very long 200 second timeout) because the
closing thread starves out the using thread.
To fix that, I introduce the concept of struct rb_io_close_wait_list; a
list of threads still using a file descriptor that we want to close. We
call `rb_notify_fd_close` to let the thread scheduler know we're closing
a FD, which fills the list with threads. Then, we call
rb_notify_fd_close_wait which will block the thread until all of the
still-using threads are done.
This is implemented with a condition variable sleep, so no busy-looping
is required.
Notes:
Merged: https://github.com/ruby/ruby/pull/7865
|
|
With VWA, AR hashes are much larger than ST hashes. Hash#replace
attempts to directly copy the contents of AR hashes into ST hashes so
there will be memory corruption caused by writing past the end of memory.
This commit changes it so that if a ST hash is being replaced with an AR
hash it will insert each element into the ST hash.
Notes:
Merged: https://github.com/ruby/ruby/pull/7846
|
|
Now, calling `rb_fork` directly breaks the PID cache and the timer
thread, so must use `rb_fork_ruby` or similar instead.
Notes:
Merged: https://github.com/ruby/ruby/pull/7834
|
|
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
|
|
This allows Hashes with ST tables to fit int he 80 byte size pool.
Notes:
Merged: https://github.com/ruby/ruby/pull/7742
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7742
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7742
|
|
|
|
The following functions are turned into macros and no longer can be
used as expressions in core.
- rb_sys_fail
- rb_sys_fail_str
- rb_sys_fail_path
|
|
This commit introduces a new instruction `opt_newarray_send` which is
used when there is an array literal followed by either the `hash`,
`min`, or `max` method.
```
[a, b, c].hash
```
Will emit an `opt_newarray_send` instruction. This instruction falls
back to a method call if the "interested" method has been monkey
patched.
Here are some examples of the instructions generated:
```
$ ./miniruby --dump=insns -e '[@a, @b].max'
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,12)> (catch: FALSE)
0000 getinstancevariable :@a, <is:0> ( 1)[Li]
0003 getinstancevariable :@b, <is:1>
0006 opt_newarray_send 2, :max
0009 leave
$ ./miniruby --dump=insns -e '[@a, @b].min'
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,12)> (catch: FALSE)
0000 getinstancevariable :@a, <is:0> ( 1)[Li]
0003 getinstancevariable :@b, <is:1>
0006 opt_newarray_send 2, :min
0009 leave
$ ./miniruby --dump=insns -e '[@a, @b].hash'
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)> (catch: FALSE)
0000 getinstancevariable :@a, <is:0> ( 1)[Li]
0003 getinstancevariable :@b, <is:1>
0006 opt_newarray_send 2, :hash
0009 leave
```
[Feature #18897] [ruby-core:109147]
Co-authored-by: John Hawthorn <jhawthorn@github.com>
Notes:
Merged: https://github.com/ruby/ruby/pull/6090
|
|
Classes are now exactly 80 bytes when embedded, which perfectly fits the
3rd size pool on 32 bit systems.
Notes:
Merged: https://github.com/ruby/ruby/pull/7719
|
|
Moves shape ID to FL_USER4 to FL_USER19 for the shape ID on 32 bit
systems. This makes the rb_classext_struct smaller so that it can be
embedded.
Notes:
Merged: https://github.com/ruby/ruby/pull/7719
|
|
This commit moves RCLASS_CLONED from the flags to the
rb_classext_struct. This frees the FL_USER1 bit.
Notes:
Merged: https://github.com/ruby/ruby/pull/7719
|