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

58943 Коммитов

Автор SHA1 Сообщение Дата
Aaron Patterson 7460c884fb
Use an identity hash for pinning Ripper objects
Ripper reuses parse.y for its implementation.  Ripper changes the
grammar productions to sometimes return Ruby objects.  This Ruby objects
are put in to the parser's stack, so they must be kept alive.  This is
where the "mark_ary" comes in.  The mark array ensures that Ruby objects
created and pushed on the stack during the course of parsing will stay
alive for the life of the parsing functions.

Unfortunately, Arrays do not prevent their contents from moving.  If the
compactor runs, objects on the parser stack could move because the array
won't prevent them from moving.  But the GC doesn't know about the
parser stack, so it can't update references in that stack (it will
update them in the array).

This commit changes the mark array to be an identity hash.  Since the
identity hash relies on memory addresses for the definition of identity,
the GC will not allow keys in an identity hash to move.  We can prevent
movement of objects in the parser stack by sticking them in an identity
hash.
2019-11-05 08:24:14 -08:00
git d47b643428 * 2019-11-06 [ci skip] 2019-11-06 00:39:55 +09:00
Mark Abraham 07f2062c8f Improve string literal concatenation for C++11
Downstream C++ projects that compile with C++11 or newer and include
the generated config.h file issue compiler warnings. Both C and C++
compilers do string-literal token pasting regardless of whitespace
between the tokens to paste. C++ compilers since C++11 require such
spaces, to avoid ambiguity with the new style of string literals
introduced then. This change fixes such projects without affecting
core Ruby.
2019-11-06 00:31:52 +09:00
aycabta 6aacef4948 Assert return value of Readline.readline only if Ruby is before 2.7 2019-11-05 21:06:29 +09:00
Jeremy Evans c4b627e2da Only taint on Ruby <2.7
Ruby 2.7 deprecates taint and it no longer has an effect.
2019-11-05 20:57:22 +09:00
Jeremy Evans 652800cc09 Only untaint line on Ruby <2.7
Untaint is deprecated and has no effect on Ruby 2.7+.
2019-11-05 20:54:46 +09:00
Nobuyoshi Nakada c6a52cffd1
Separated `@counter` and `@tally` so that "-ft" works with "-j" 2019-11-05 17:43:38 +09:00
Nobuyoshi Nakada fa52a924aa Enable "-f" option in multi_exec mode
Make `MultiFormatter` a module and extend the formatter specified
by "-f" option.
2019-11-05 17:42:35 +09:00
Nobuyoshi Nakada 19f91f7880 `DottedFormatter#finish` consistency
Rmoved optional parameter `printed_exceptions`, and clear
`exceptions` just after printing each exception, instead.
2019-11-05 17:42:35 +09:00
Nobuyoshi Nakada dfb3322d27 `DottedFormatter#state` consistency
Let the method of `DottedFormatter` subclasses have the same
arity.
2019-11-05 17:42:35 +09:00
NARUSE, Yui bea322a352 Revert "[EXPERIMENTAL] Make Symbol#to_s return a frozen String [Feature #16150]"
This reverts commit 6ffc045a81.
2019-11-05 17:30:54 +09:00
Lars Kanis 853d91a04a Fix coroutine support on win32
Ruby master branch currently fails on win32 MINGW at this spec:
https://github.com/ruby/spec/blob/master/core/thread/element_set_spec.rb

MINGW makes use of setjmp3() implemented in MSVCRT.DLL.
This function traverses the SEH list up to a terminating pointer 0xFFFFFFFF.
It therefore currently segfaults on NULL.
The SEH linked list must be terminated by 0xFFFFFFFF instead of NULL.

This fixes the issue mentioned here:
  https://github.com/ruby/ruby/pull/2279#issuecomment-509508810
2019-11-05 15:31:21 +09:00
卜部昌平 7c07300491 let the .bss section initialize static variables
ISO/IEC 9899:1999 section 6.7.8 specifies the values of static
storage which are not explicitly initialized.  According to that
these initializers can be omitted.  Doing so improvoes future
compatibility against addition / deletion of the fields of this
struct.
2019-11-05 13:46:08 +09:00
卜部昌平 6ff1250739 rb_method_basic_definition_p with CC
Noticed that rb_method_basic_definition_p is frequently called.
Its callers include vm_caller_setup_args_block(),
rb_hash_default_value(), rb_num_neative_int_p(), and a lot more.

It seems worth caching the method resolution part.  Majority of
rb_method_basic_definion_p() usages take fixed class and fixed
method id combinations.

Calculating -------------------------------------
                           ours       trunk
           so_matrix      2.379       2.115 i/s -       1.000 times in 0.420409s 0.472879s

Comparison:
                        so_matrix
                ours:         2.4 i/s
               trunk:         2.1 i/s - 1.12x  slower
2019-11-05 11:39:35 +09:00
Nobuyoshi Nakada 1390d56ecf
Set $JOBS to Tests for parallel tests 2019-11-05 10:28:44 +09:00
Nobuyoshi Nakada 8869384367
Moved Init_encoding from wrong place [Bug #16292] 2019-11-05 10:28:01 +09:00
Kazuhiro NISHIYAMA 30a74aaef0
Fix a typo in WARN_EOL 2019-11-05 10:09:44 +09:00
Nobuyoshi Nakada c7632fa80c Do not occupy `ARGV` by XRUBY command
Instead run test-bundled-gems.rb by `ENV['RUBY']`, which should be
set by runruby.rb.
2019-11-05 08:45:19 +09: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
Nobuyoshi Nakada 7c3bc0aa13
Put an empty line [ci skip] 2019-11-05 08:07:59 +09:00
Burdette Lamar 74bb8fb348 More rdoc for ENV 2019-11-05 08:03:01 +09:00
Nobuyoshi Nakada 9d04fa71fc
Updated minitest to 5.13.0 2019-11-05 02:14:31 +09:00
Nobuyoshi Nakada c0c9a00f83 Simplify test tasks
Removed `if` conditions separating `test-bundled-gems`, and pass
`TESTOPTS` and `TEST_BUNDLED_GEMS_ALLOW_FAILURES` via `env`.
2019-11-05 02:12:26 +09:00
Nobuyoshi Nakada 929a4aa722
Adjust a fucntion signature 2019-11-05 02:05:46 +09:00
Aaron Patterson ec54261b01
Fix zero free objects assertion
This commit is to attempt fixing this error:

  http://ci.rvm.jp/results/trunk-gc-asserts@ruby-sky1/2353281

Each non-full heap_page struct contains a reference to the next page
that contains free slots.  Compaction could fill any page, including
pages that happen to be linked to as "pages which contain free slots".

To fix this, we'll iterate each page, and rebuild the "free page list"
depending on the number of actual free slots on that page.  If there are
no free slots on the page, we'll set the free_next pointer to NULL.

Finally we'll pop one page off the "free page list" and set it as the
"using page" for the next allocation.
2019-11-04 08:58:52 -08:00
Nobuyoshi Nakada a087e027bf
Fixed conditional expressions with only one void side 2019-11-05 01:32:26 +09:00
git bd3463ee35 * 2019-11-05 [ci skip] 2019-11-05 00:07:22 +09:00
Nobuyoshi Nakada 4e8336bae8
Share test-bundled-gems-run in common.mk 2019-11-05 00:05:38 +09:00
Nobuyoshi Nakada e91e3274be
Keep `lex.pcur` after `looking_at_eol_p` 2019-11-04 23:37:53 +09:00
Nobuyoshi Nakada 26316cc350
Warn `if` and `elsif` at EOL [EXPERIMENTAL]
It is unnatural and probably a typo.
2019-11-04 23:17:34 +09:00
Yusuke Endoh c303854e13 Revert "Warn `if` and `elsif` at EOL [EXPERIMENTAL]"
This reverts commit ba35c14325.
This is because ripper fails symbol lookup error.
2019-11-04 22:27:37 +09:00
Nobuyoshi Nakada ba35c14325
Warn `if` and `elsif` at EOL [EXPERIMENTAL]
It is unnatural and probably a typo.
2019-11-04 21:39:54 +09:00
Kazuhiro NISHIYAMA cf377c5556
Fix a typo [ci skip] 2019-11-04 17:12:18 +09:00
Nobuyoshi Nakada ffa9298076
Fixed a typo 2019-11-04 16:38:36 +09:00
Nobuyoshi Nakada 823f25bb96
sync_default_gems.rb: Show the progress at fetching
It looks like hanging up when fetching from a remote first time.
2019-11-04 09:40:26 +09:00
Nobuyoshi Nakada cbbdb4e5a2
[ruby/racc] Strip trailing whitespaces at the last line of actions
https://github.com/ruby/racc/commit/a887ebe529
2019-11-04 09:28:01 +09:00
git 046be65c08 * 2019-11-04 [ci skip] 2019-11-04 09:18:29 +09:00
Nobuyoshi Nakada df62d6522a
Use the dedicated function `rb_io_check_io` 2019-11-04 09:14:18 +09:00
Nobuyoshi Nakada 5a7487bdcd
Added assertions for linebreak 2019-11-03 23:20:01 +09:00
Nobuyoshi Nakada 7b2cd548aa
[DOC] mentioned `\R` [ci skip] 2019-11-03 23:18:01 +09:00
Nobuyoshi Nakada f8b3d7d159
[DOC] \s in regexp is not same as in string [ci skip] 2019-11-03 22:53:17 +09:00
Benoit Daloze 782d1b8fb0 Fix warnings in Regexp#{match,match?} specs 2019-11-03 11:25:42 +01:00
Benoit Daloze fbacfe6820 Update NEWS entry for Feature #13083 2019-11-03 11:14:31 +01:00
Benoit Daloze 4a16623707 Remove incorrect NEWS entry, only Regexp#match and #match? changed 2019-11-03 11:14:31 +01:00
git 985e6ced99 * 2019-11-03 [ci skip] 2019-11-03 19:03:24 +09:00
Kenichi Kamiya 31110d820c Improve warning message
https://github.com/ruby/ruby/pull/2637#discussion_r341812475
2019-11-03 11:03:04 +01:00
Kenichi Kamiya 452bee3ee8 Revert nil error and adding deprecation message 2019-11-03 11:03:04 +01:00
Burdette Lamar 772b0613c5 Correct documented return values for certain ENV methods (#2620) 2019-11-02 15:32:49 +09:00
git e6f0fd8af4 * 2019-11-02 [ci skip] 2019-11-02 00:15:05 +09:00
aycabta ea97933645 Use prompt_list to calculate height by lines 2019-11-02 00:11:15 +09:00