Age | Commit message (Collapse) | Author |
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3180
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3180
|
|
This fixes various issues when a module is included in or prepended
to a module or class, and then refined, or refined and then included
or prepended to a module or class.
Implement by renaming ensure_origin to rb_ensure_origin, making it
non-static, and calling it when refining a module.
Fix Module#initialize_copy to handle origins correctly. Previously,
Module#initialize_copy did not handle origins correctly. For example,
this code:
```ruby
module B; end
class A
def b; 2 end
prepend B
end
a = A.dup.new
class A
def b; 1 end
end
p a.b
```
Printed 1 instead of 2. This is because the super chain for
a.singleton_class was:
```
a.singleton_class
A.dup
B(iclass)
B(iclass origin)
A(origin) # not A.dup(origin)
```
The B iclasses would not be modified, so the includer entry would be
still be set to A and not A.dup.
This modifies things so that if the class/module has an origin,
all iclasses between the class/module and the origin are duplicated
and have the correct includer entry set, and the correct origin
is created.
This requires other changes to make sure all tests still pass:
* rb_undef_methods_from doesn't automatically handle classes with
origins, so pass it the origin for Comparable when undefing
methods in Complex. This fixed a failure in the Complex tests.
* When adding a method, the method cache was not cleared
correctly if klass has an origin. Clear the method cache for
the klass before switching to the origin of klass. This fixed
failures in the autoload tests related to overridding require,
without breaking the optimization tests. Also clear the method
cache for both the module and origin when removing a method.
* Module#include? is fixed to skip origin iclasses.
* Refinements are fixed to use the origin class of the module that
has an origin.
* RCLASS_REFINED_BY_ANY is removed as it was only used in a single
place and is no longer needed.
* Marshal#dump is fixed to skip iclass origins.
* rb_method_entry_make is fixed to handled overridden optimized
methods for modules that have origins.
Fixes [Bug #16852]
Notes:
Merged: https://github.com/ruby/ruby/pull/3140
|
|
Protected methods are restricted to be called according to the
class/module in where it is defined, not the actual receiver's
class. [Bug #16931]
|
|
|
|
getgrnam(3) says:
```
ERRORS
0 or ENOENT or ESRCH or EBADF or EPERM or ...
The given name or gid was not found.
```
Process::GID.from_name raises an ArgumentError for 0, but Errno::ESRCH
for ESRCH. Actually, WSL 2 raises Errno::ESRCH. This change accepts
all exceptions above.
|
|
|
|
21991e6ca5 enables `__builtin_assume()` for clang and it seems
skip SEGV on rb_class_of() with unexpected value. This test expects
a [BUG] output, so this patch causes [BUG] to show [BUG] message.
https://github.com/ruby/ruby/runs/707088232?check_suite_focus=true#step:12:230
```
1) Failure:
TestVMDump#test_darwin_invalid_access [/Users/runner/runners/2.262.1/work/ruby/ruby/src/test/ruby/test_vm_dump.rb:19]:
pid 43128 exit 0.
1. [2/2] Assertion for "stderr"
| Expected /^\[IMPORTANT\]/ to match "".
```
|
|
If a module has an origin, and that module is included in another
module or class, previously the iclass created for the module had
an origin pointer to the module's origin instead of the iclass's
origin.
Setting the origin pointer correctly requires using a stack, since
the origin iclass is not created until after the iclass itself.
Use a hidden ruby array to implement that stack.
Correctly assigning the origin pointers in the iclass caused a
use-after-free in GC. If a module with an origin is included
in a class, the iclass shares a method table with the module
and the iclass origin shares a method table with module origin.
Mark iclass origin with a flag that notes that even though the
iclass is an origin, it shares a method table, so the method table
should not be garbage collected. The shared method table will be
garbage collected when the module origin is garbage collected.
I've tested that this does not introduce a memory leak.
This change caused a VM assertion failure, which was traced to callable
method entries using the incorrect defined_class. Update
rb_vm_check_redefinition_opt_method and find_defined_class_by_owner
to treat iclass origins different than class origins to avoid this
issue.
This also includes a fix for Module#included_modules to skip
iclasses with origins.
Fixes [Bug #16736]
Notes:
Merged: https://github.com/ruby/ruby/pull/3136
|
|
This reverts commit c745a60634260ba2080d35af6fdeaaae86fe5193.
This triggers a VM assertion. Reverting until the issue can be
debugged.
|
|
If a module has an origin, and that module is included in another
module or class, previously the iclass created for the module had
an origin pointer to the module's origin instead of the iclass's
origin.
Setting the origin pointer correctly requires using a stack, since
the origin iclass is not created until after the iclass itself.
Use a hidden ruby array to implement that stack.
Correctly assigning the origin pointers in the iclass caused a
use-after-free in GC. If a module with an origin is included
in a class, the iclass shares a method table with the module
and the iclass origin shares a method table with module origin.
Mark iclass origin with a flag that notes that even though the
iclass is an origin, it shares a method table, so the method table
should not be garbage collected. The shared method table will be
garbage collected when the module origin is garbage collected.
I've tested that this does not introduce a memory leak.
This also includes a fix for Module#included_modules to skip
iclasses with origins.
Fixes [Bug #16736]
Notes:
Merged: https://github.com/ruby/ruby/pull/2978
|
|
Same as 02705b27be207fce57bd0253251f81108c7ed57b
http://ci.rvm.jp/results/trunk-random1@phosphorus-docker/2955433
```
1)
TestGc#test_start_full_mark [/tmp/ruby/v3/src/trunk-random1/test/ruby/test_gc.rb:61]:
Expected :oldmalloc to be nil.
```
|
|
instead of :TOTAL of ObjectSpace.count_objects.
This test had failed very occasionally:
https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos8/ruby-master/log/20200521T033004Z.fail.html.gz
```
1) Failure:
TestRubyOptimization#test_block_parameter_should_not_create_objects [/home/chkbuild/chkbuild/tmp/build/20200521T033004Z/ruby/test/ruby/test_optimization.rb:713]:
<0> expected but was
<407>.
```
This test of lazy proc creation checks if no object is created during a
method call. However, calling a method itself increases the count of
objects because method cache is now an object (T_MEMO).
The reason why this test rarely fails is because the test was buggy; it
checked the count of :TOTAL, but :TOTAL count changes only when the GC
heap is expanded. Creating one object rarely causes heap expansion.
The test must have checked not only :TOTAL but also the count of :FREE.
Instead, this change more directly checks :T_DATA. Note that a Proc
object is T_DATA.
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3116
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3112
|
|
TestAutoload#test_source_location can't run multiple test-run so
that use assert_separately().
repro command:
make yes-test-all TESTS='--repeat-count=50 ruby/test_autoload -n test_source_location'
Notes:
Merged: https://github.com/ruby/ruby/pull/3111
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3108
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3032
Merged-By: ioquatix <samuel@codeotaku.com>
|
|
It would be a relatively frequent case. It is still slower than
`float * float` because `*` has a dedicated VM instruction (opt_mult),
though.
|
|
This limit was introduced on Nov 20 1996
in 554b989ba1623b9f6a0b76f00824c83a23fbcbc1
Apparently to protect from a buffer overflow:
* eval.c (f_missing): オブジェクトの文字列表現が長すぎる時バッファ
を書き潰していた
However I tested that path with very large strings
and it works fine.
Notes:
Merged: https://github.com/ruby/ruby/pull/3090
|
|
not only when !w but also when w == WAITPID_LOCK_ONLY.
See also: f7c0cc36920a4ed14a3ab1ca6cfdf18ceff1e5d5 and a2264342063260d660b99872eaf5080f6ab08e81.
We thought this change was an oversight in the latter commit.
Without this change, the test fails like:
$ make test-all TESTS="../test/ruby/test_process.rb -n test_exec_failure_leaves_no_child" RUN_OPTS="--jit"
...
1) Failure:
TestProcess#test_exec_failure_leaves_no_child [/home/k0kubun/src/github.com/ruby/ruby/test/ruby/test_process.rb:2493]:
Expected [[26799, #<Process::Status: pid 26799 exit 127>]] to be empty.
Co-Authored-By: Yusuke Endoh <mame@ruby-lang.org>
|
|
[Bug #16465] [Bug #16801]
[Fix GH-2795] [Fix GH-2944] [Fix GH-3045] [Fix GH-3093]
Note: Backporting shouldn't modify object.h and instead can use
struct_new_kw which is basically a duplicate implementation of
rb_class_new_instance_pass_kw
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: John Hawthorn <john@hawthorn.email>
Co-authored-by: Adam Hess <HParker@github.com>
Co-authored-by: Jose Cortinas <jacortinas@gmail.com>
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Notes:
Merged: https://github.com/ruby/ruby/pull/3093
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3091
|
|
|
|
So that `TEST_EXCLUDES` option in common.mk works.
|
|
|
|
I think 9aa5fe1bf89db8cd215b24d8ddfb668714681b83 helps this issue too.
|
|
It turned out that the pdb corruption happens on Visual Studio 2015 as
well.
https://ci.appveyor.com/project/ruby/ruby/builds/32602953/job/3gj43q18wqeiy729
|
|
Fix https://github.com/ruby/ruby/runs/636020145 without skipping too
many tests.
It seems that .c -> .o with debug flags and .o -> .so without debug
flags did not generate .dSYM but now .c -> .so with debug flags seems to
generate a .dSYM directory. As --jit-debug should not be used by normal
users, let me skip implementing the removal for now.
|
|
caused by 818d6d33368a396d9cd3d1a34a84015a9e76c5c8, for now.
I'll take a look at them tomorrow.
|
|
to improve code locality.
Using benchmark-driver/sinatra with 100 methods JIT-ed,
[Before] 12149.97 rps
1.3M /tmp/_ruby_mjit_p31171u145.so
[After] 12818.83 rps
260K /tmp/_ruby_mjit_p32155u145.so
(VM is 13714.89 rps)
|
|
because we support JIT compaction on it
|
|
Running C compiler for JIT compaction inside a critical section may lock
main thread for a long time when it triggers GC. As I'm planning to
increase this duration a bit, I'd like to make sure this doesn't stop
the world.
For now, I chose to give up unloading units when it's during JIT
compaction, assuming other calls may unload them later.
|
|
Couldn't figure out failed/fixed versions.
|
|
Revert 9948addda67f4b7a6e3575f1eba9025f998811d2.
It is now discussed in https://bugs.ruby-lang.org/issues/16814, and an
assert is added with a217d3cedce3f5aa5c27a1ce6c72b65ec37da057.
It would be good to give it a try.
|
|
|
|
|
|
Even for empty argument list, not to be confusing with a writer
method name.
Notes:
Merged: https://github.com/ruby/ruby/pull/3051
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3051
|
|
This reverts commit 67bcac879a2e0ddfb4e7bbd7cb5e5401422de76a.
Notes:
Merged: https://github.com/ruby/ruby/pull/3051
|
|
Since it is impossible to detect stack overflow of C functions robustly,
the test is a bit unreasonable.
https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian-riscv64/ruby-master/log/20200421T120018Z.fail.html.gz
|
|
|
|
https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian-riscv64/ruby-master/log/20200420T083601Z.fail.html.gz
|
|
The test fails due to unknown reason. Need to debug in future, but
tentatively skipped.
|
|
Only the names are case-sensitive.
Notes:
Merged: https://github.com/ruby/ruby/pull/3041
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3040
|
|
on stack when local_stack_p is enabled.
This fixes `RB_FL_TEST_RAW:"RB_FL_ABLE(obj)"` assertion failure
on power_assert's test with JIT enabled.
|
|
Slightly simplifying 8d6aa06620b316904fd10d0cab1b85e07f2fbf67
|