Commit graph

63490 commits

Author SHA1 Message Date
Benoit Daloze
ba24aee292 Remove spec which is too difficult to get working with various compilers
* The spec means to use an actual system library function, not a wrapper.
2020-10-26 08:06:33 +01:00
Nobuyoshi Nakada
507af75415
[DOC] Expanded glob patterns for Dir.glob
No longer need to get rid of C block comments in builtin ruby
script comments.
2020-10-26 09:09:45 +09:00
Nobuyoshi Nakada
3cb03a00a8
Include c_escape.rb in COMPILE_PRELUDE
template/prelude.c.tmpl requires tool/ruby_vm/helpers/c_escape.rb.
2020-10-26 09:05:08 +09:00
Nobuyoshi Nakada
396e921044
Escape '/*' within block comment too 2020-10-26 09:01:27 +09:00
Nobuyoshi Nakada
b6d0b3dfaf
Use gcc-specific pragma only on gcc (and the family) 2020-10-26 08:16:51 +09:00
Jeremy Evans
ff2276ef8c Fix bootstrap-test error in previous commit 2020-10-25 15:56:10 -07:00
Marc-Andre Lafortune
9c8f0a34df Use 'shareable' with an 'e' [ci skip] 2020-10-25 18:10:14 -04:00
git
8376cae25a * 2020-10-26 [ci skip] 2020-10-26 05:45:34 +09:00
Marc-Andre Lafortune
5e6f9fd83a Tweak a few Ractor tests that were missing comments [ci skip] 2020-10-25 16:44:59 -04:00
Marc-Andre Lafortune
ee54075a94 Remove trailing whitespace [ci skip] 2020-10-25 16:38:37 -04:00
Nobuyoshi Nakada
25a332f5cf
Fix compilation on MSVC
* cast scalar value instead of function
* use `rb_pid_t` for the portability
2020-10-25 22:07:09 +09:00
Nobuyoshi Nakada
e880d075f8
[DOC] refined "**" description in Dir.glob [ci skip]
As same as the description for `File.fnmatch`.
[Bug #17283]
2020-10-25 21:24:23 +09:00
git
8d22dd8cb8 * 2020-10-25 [ci skip] 2020-10-25 19:43:43 +09:00
Benoit Daloze
99e067eac6 Try to fix compilation on MSVC 2020-10-25 11:42:20 +01:00
Benoit Daloze
148961adcd Update to ruby/spec@4f59d86 2020-10-24 15:53:53 +02:00
Benoit Daloze
342fbae83c Update to ruby/mspec@b56e7a2 2020-10-24 15:53:53 +02:00
git
1388257d7a * 2020-10-24 [ci skip] 2020-10-24 22:52:20 +09:00
Benoit Daloze
71f699543b Tweaks for the ruby/spec workflow 2020-10-24 15:51:18 +02:00
Kenta Murata
f754b42285
numeric.c, range.c: prohibit zero step
* numeric.c: prohibit zero step in Numeric#step

* range.c: prohibit zero step in Range#step

* Fix ruby-spec

[Feature #15573]
2020-10-23 15:26:51 +09:00
Takashi Kokubun
40bad72f31
Assert in_gc >= 0 instead of guarding it (#3687) 2020-10-22 21:59:13 -07:00
卜部昌平
7cf34cfaa3 .github/workflows/spec_guards.yml add
Translate a part of .travis.yml into GitHub Actions workflow.
2020-10-23 10:38:34 +09:00
Alan Wu
196eada8c6 mutete -> mutate 2020-10-22 18:20:35 -04:00
Andrew Kerr
ef3c25888e Fix small typo in comment in lib/irb.c 2020-10-22 10:56:35 -07:00
git
b9193df971 * 2020-10-23 [ci skip] 2020-10-23 01:52:32 +09:00
Aaron Patterson
9a6720a15d
Revert "Add assertions when inline caches are copied to MJIT"
This reverts commit 6cb6d5abc3.
This reverts commit 1484b786ae.

I think we don't need these assertions anymore.  I believe the problem
is solved by abf678a439
2020-10-22 09:52:05 -07:00
Aaron Patterson
abf678a439 Use a lock level for a less granular lock.
We are seeing an error where code that is generated with MJIT contains
references to objects that have been moved.  I believe this is due to a
race condition in the compaction function.

`gc_compact` has two steps:

1. Run a full GC to pin objects
2. Compact / update references

Step one is executed with `garbage_collect`.  `garbage_collect` calls
`gc_enter` / `gc_exit`, these functions acquire a JIT lock and release a
JIT lock.  So a lock is held for the duration of step 1.

Step two is executed by `gc_compact_after_gc`.  It also holds a JIT
lock.

I believe the problem is that the JIT is free to execute between step 1
and step 2.  It copies call cache values, but doesn't pin them when it
copies them.  So the compactor thinks it's OK to move the call cache
even though it is not safe.

We need to hold a lock for the duration of `garbage_collect` *and*
`gc_compact_after_gc`.  This patch introduces a lock level which
increments and decrements.  The compaction function can increment and
decrement the lock level and prevent MJIT from executing during both
steps.
2020-10-22 07:59:06 -07:00
Kenta Murata
d23d5c3130
rational.c: try converting by to_int in Rational() (#3684)
[Bug #12485]
2020-10-22 17:59:52 +09:00
Koichi Sasada
603fb940c0 refactoring obj_traverse_i 2020-10-22 00:43:44 +09:00
Koichi Sasada
0c0d0752f1 allow to access ivars of frozen shareable objects
Accessing a shareable object is prohibitted because it can cause
race condition, but if the shareable object is frozen, there is no
problem to access ivars.
2020-10-22 00:43:44 +09:00
git
9629378477 * 2020-10-22 [ci skip] 2020-10-22 00:07:02 +09:00
Koichi Sasada
3a97d36157 refactoring frozen_shareable_p 2020-10-21 23:57:44 +09:00
Koichi Sasada
89f6644de7 refactoring rb_obj_traverse()
* create rec check hash lazily
* do not pass *data pointer for enter/leave function because
  it is not used.
2020-10-21 23:52:11 +09:00
Koichi Sasada
af2471365f refactoring rb_ractor_confirm_belonging()
rb_ractor_belonging() returns 0 only if it has sharable flag.
rb_ractor_confirm_belonging() checks rb_ractor_shareable_p()
if the belonging ractor id is different from current ractor id.
2020-10-21 23:52:11 +09:00
Koichi Sasada
631eaa8510 check main-ractor or not first
On non-multi-ractor-mode, the cost of rb_ractor_main_p() is low
so check it first.
2020-10-21 23:52:11 +09:00
Yusuke Endoh
762be87759 test/json/json_parser_test.rb: suppress warnings
20201021T123003Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20201021T123003Z/ruby/test/json/json_parser_test.rb:227: warning: ambiguous first argument; put parentheses or a space even after `-' operator
/home/chkbuild/chkbuild/tmp/build/20201021T123003Z/ruby/test/json/json_parser_test.rb:228: warning: ambiguous first argument; put parentheses or a space even after `-' operator
```
2020-10-21 23:37:42 +09:00
Koichi Sasada
4414031735 extend timeout of rbs test on rbs tests 2020-10-21 17:59:03 +09:00
Koichi Sasada
b59077eecf Ractor-safe rb_objspace_reachable_objects_from
rb_objspace_reachable_objects_from(obj) is used to traverse all
reachable objects from obj. This function modify objspace but it
is not ractor-safe (thread-safe). This patch fix the problem.

Strategy:
(1) call GC mark process during_gc
(2) call Ractor-local custom mark func when !during_gc
2020-10-21 16:15:22 +09:00
Nobuyoshi Nakada
4640c4ea8a
Removed more unnecessary ID caches
```
find . -name \*.o -exec nm {} + |&
grep -e 'InitVM_.*\.rbimpl_id' -e 'Init_.*\.rbimpl_id' |
sed 's/^.* b //;s/\.[1-9][0-9]*$//;s/\.rbimpl_id$//' |
uniq
```
should be empty.
2020-10-21 13:04:20 +09:00
Nobuyoshi Nakada
5a77e90fe8
Use rb_intern_const instead of rb_intern in Init functions
```
find . -name \*.o -exec nm {} + |&
sed '/Init_.*\.rbimpl_id/!d;s/^.* b //;s/\.[1-9][0-9]*$//;s/\.rbimpl_id$//' |
uniq
```
should be empty.
2020-10-21 12:46:53 +09:00
Stefan Stüben
8c2e5bbf58 Don't redefine #rb_intern over and over again 2020-10-21 12:45:18 +09:00
Nobuyoshi Nakada
d497436d07
Update dependencies for macOS 2020-10-21 12:31:45 +09:00
Nobuyoshi Nakada
640b340583
Check dependencies on macOS too 2020-10-21 12:31:38 +09:00
Jacob Matthews
73834b5fc9 Calculate transient heap block usable size at compile time 2020-10-21 11:44:10 +09:00
卜部昌平
da25affdac .github: reduce copy&paste
Found that we can set default working directory for github actions.
2020-10-21 09:24:47 +09:00
卜部昌平
1c5f44cd72 .travis.yml: reduce redundant tests
These tests are (more or less) covered by github actions now.
2020-10-21 09:24:47 +09:00
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
git
587feb0b6e * 2020-10-21 [ci skip] 2020-10-21 02:40:38 +09:00
Kenta Murata
a6a8576e87
Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241)
* Support ArithmeticSequence in Array#slice

* Extract rb_range_component_beg_len

* Use rb_range_values to check Range object

* Fix ary_make_partial_step

* Fix for negative step cases

* range.c: Describe the role of err argument in rb_range_component_beg_len

* Raise a RangeError when an arithmetic sequence refers the outside of an array

[Feature #16812]
2020-10-21 02:40:18 +09:00
Nobuyoshi Nakada
081cc4eb28
Dump FrozenCore specially 2020-10-20 23:52:19 +09:00
Nobuyoshi Nakada
d915e7ee00
strip trailing spaces [ci skip] 2020-10-20 23:52:19 +09:00