57968 Commits

Author SHA1 Message Date
Yusuke Endoh
95297a15f1 compile.c (compile_hash): rewrite the compilation algorithm
This is a similar refactoring to 8c908c989077c74eed26e02912b98362e509b8a3,
but the target is compile_hash.
2019-09-08 03:17:04 +09:00
aycabta
3568029823 Remove .document and .gitignore from file list of rdoc.gemspec 2019-09-08 03:07:45 +09:00
Yusuke Endoh
4f63634af1 compile.c (NODE_OP_ASGN1): Remove unneeded DECL_ANCHOR 2019-09-08 01:22:26 +09:00
Nobuyoshi Nakada
2d017d6126
make-snapshot: default to the toplevel directory
As this tool has been intended to use in a working directory,
assume that the toplevel directory is under the VCS, and SVN will
no longer be canonical.
2019-09-08 00:48:18 +09:00
Yusuke Endoh
a3f5265fd1 parse.y: Use the correct alias for brace flag of hash literal
nd_alen and nd_brace is the same field, but nd_brace is more suitable
for this case.
2019-09-08 00:28:03 +09:00
Yusuke Endoh
95f9d7c76d compile.c (keyword_node_p): Refactor out keyword node checks 2019-09-08 00:28:03 +09:00
Yusuke Endoh
86b74d1a73 compile.c (compile_hash): Remove redundant check for NODE_ZLIST
NODE_ZLIST case is handled in compile_hash, so iseq_compile_each0
doesn't have to do the same check redundantly.
2019-09-08 00:28:03 +09:00
Yusuke Endoh
050f67c9c6 compile.c (compile_hash): Simplify the keyword handling
The length of NODE_LIST chain in NODE_HASH is always even because it
represents key-value pairs.  There is no need to check for the
odd-length case.
2019-09-08 00:28:03 +09:00
Yusuke Endoh
bb78c83678 compile.c (compile_hash): don't add a temporal array to mark_ary
The array is just for a temporal buffer to create a hash, not stored in
the final iseq.
2019-09-08 00:28:03 +09:00
Yusuke Endoh
7cba9a8406 compile.c (compile_array): undef a temporal macro 2019-09-08 00:28:02 +09:00
git
b543f5b20f * 2019-09-08 [ci skip] 2019-09-08 00:23:56 +09:00
Nobuyoshi Nakada
f3bae2c6cf
Touch copied cache files to make tarballs stable 2019-09-08 00:22:25 +09:00
Nobuyoshi Nakada
5a6954ba74
Suppress detached head warning 2019-09-08 00:22:24 +09:00
Takashi Kokubun
ae8b977742
Avoid defining DISPATCH_ARCH_DEPEND_WAY macro
when it's not used. This macro is not used when it's direct threaded code.

This patch is purely for readability and has no impact for any behavior.
2019-09-07 23:13:47 +09:00
git
a9b63db3b6 * remove trailing spaces. [ci skip] 2019-09-07 22:22:30 +09:00
Yusuke Endoh
8c908c9890 compile.c (compile_array): rewrite the compilation algorithm
The original code looks unnecessarily complicated (to me).
Also, it creates a pre-allocated array only for the prefix of the array.

The new code optimizes not only the prefix but also the subsequence that
is longer than 0x40 elements.

    # not optimized
    10000000.times { [1+1, 1,2,3,4,...,63]    } # 2.12 sec.
    # (1+1; push 1; push 2; ...; puts 63; newarray 64; concatarray)

    # optimized
    10000000.times { [1+1, 1,2,3,4,...,63,64] } # 1.46 sec.
    # (1+1; newarray 1; putobject [1,2,3,...,64]; concatarray)
2019-09-07 22:08:39 +09:00
Yusuke Endoh
07876bf6db compile.c (compile_hash): refactoring
The same refactoring as to b601b13c7267889bf394146353c5f2b0eb488278.
2019-09-07 20:25:12 +09:00
Yusuke Endoh
187328b703 compile.c (compile_array): refactoring
"popped" case can be so simple, so this change moves the branch to the
first, instead of scattering `if (popped)` branches to the main part.
Also, the return value "len" is not used.  So it returns just 0 or 1.
2019-09-07 20:25:12 +09:00
Benoit Daloze
324dd9d01f armv7l and armv7l are the same platform, generalize to armv7
[Bug #16007]
2019-09-07 12:53:47 +02:00
Nobuyoshi Nakada
5511213487
Exit gently if no VCS found but --suppress_not_found is given 2019-09-07 17:26:28 +09:00
Nobuyoshi Nakada
5b5c9b6101
Removed no longer used variable 2019-09-07 17:26:28 +09:00
Yusuke Endoh
a2260bd636 compile.c: Separate compile_list to two functions for Array and Hash
compile_list was for the compilation of Array literal and Hash literal.
I guess it was originally reasonable to handle them in one function, but
now, compilation of Array is very different from Hash.  So the function
was complicated by many branches for Array and Hash.

This change separates the function to two ones for Array and Hash.
2019-09-07 16:45:49 +09:00
Yusuke Endoh
2f2f8107d0 compile.c (compile_list): allow an odd-length hidden array literal
An array literal [1,2,...,301] was compiled to the following iseq:

  duparray [1,2,...,300]
  putobject [301]
  concatarray

The Array literal optimization took every two elements maybe because it
must handle not only Array but also Hash.
Now the optimization takes each element if it is an Array literal.  So
the new iseq is: duparray [1,2,...,301].
2019-09-07 16:26:38 +09:00
Yusuke Endoh
1e008105bc compile.c (compile_list): emit newarraykwsplat only at the last chunk
`[{}, {}, {}, ..., {}, *{}]` is wrongly created.

A big array literal is created and concatenated for every 256 elements.
The newarraykwsplat must be emitted only at the last chunk.
2019-09-07 16:05:15 +09:00
Kazuhiro NISHIYAMA
c725a4e48f
Check github.repository in doxygen.yml [ci skip] 2019-09-07 14:03:29 +09:00
Yusuke Endoh
a7a2be7a31 Rename some function/definition names that handles NODE_LIST
from array to list.
Follow up to ac50ac03aeb210763730cdc45f230e236519223d
2019-09-07 13:56:41 +09:00
Yusuke Endoh
99c9431ea1 Rename NODE_ARRAY to NODE_LIST to reflect its actual use cases
and NODE_ZARRAY to NODE_ZLIST.

NODE_ARRAY is used not only by an Array literal, but also the contents
of Hash literals, method call arguments, dynamic string literals, etc.
In addition, the structure of NODE_ARRAY is a linked list, not an array.

This is very confusing, so I believe `NODE_LIST` is a better name.
2019-09-07 13:56:29 +09:00
Kazuhiro NISHIYAMA
f223ab47e6
[DOC] Update output of Ripper.sexp [ci skip] 2019-09-07 13:50:05 +09:00
Nobuyoshi Nakada
8bfc46a9a3
Fixed wrong usage of file2lastrev.rb 2019-09-07 11:59:19 +09:00
Nobuyoshi Nakada
8b290448e3
Assign to vcs in new_vcs block not to use rescue result 2019-09-07 11:56:23 +09:00
Nobuyoshi Nakada
59e29389a8
Fixed wrong method at 71f7b0421ac 2019-09-07 11:47:45 +09:00
Jeremy Evans
146677a1e7 Fix keyword argument warnings in the tests from Class#new
This were previously hidden because calls from C were not warned.
2019-09-06 19:41:23 -07:00
Jeremy Evans
434582d888 Fix Tempfile.open to correctly pass keywords to Tempfile.new 2019-09-06 19:41:23 -07:00
Jeremy Evans
5603681520 Enable keyword argument warnings when called from C
Previously, Ruby did not warn in these cases, and in some cases
did not have the same behavior.  This makes calls from C handled
the same way as calls from Ruby.
2019-09-06 19:41:23 -07:00
Jeremy Evans
80e679ef2d Fix keyword argument separation warnings for enumerators
This makes objects created via #to_enum and related methods pass
keyword arguments as keywords.

To implement this, add a kw_splat member of struct enumerator and
struct iter_method_arg, and add rb_block_call_kw, which is the
same as rb_block_call_kw with a flag for whether the last argument
is keyword options.
2019-09-06 19:41:23 -07:00
Jeremy Evans
37a2c660aa Convert keyword argument to required positional hash argument for Class#new, Method#call, UnboundMethod#bind_call
Also add keyword argument separation warnings for Class#new and Method#call.

To allow for keyword argument to required positional hash converstion in
cfuncs, add a vm frame flag indicating the cfunc was called with an empty
keyword hash (which was removed before calling the cfunc).  The cfunc can
check this frame flag and add back an empty hash if it is passing its
arguments to another Ruby method.  Add rb_empty_keyword_given_p function
for checking if called with an empty keyword hash, and
rb_add_empty_keyword for adding back an empty hash to argv.

All of this empty keyword argument support is only for 2.7.  It will be
removed in 3.0 as Ruby 3 will not convert empty keyword arguments to
required positional hash arguments.  Comment all of the relevent code
to make it obvious this is expected to be removed.

Add rb_funcallv_kw as an public C-API function, just like rb_funcallv
but with a keyword flag.  This is used by rb_obj_call_init (internals
of Class#new).  This also required expected call_type enum with
CALL_FCALL_KW, similar to the recent addition of CALL_PUBLIC_KW.

Add rb_vm_call_kw as a internal function, used by call_method_data
(internals of Method#call and UnboundMethod#bind_call). Add tests
for UnboundMethod#bind_call keyword handling.
2019-09-06 19:41:23 -07:00
Nobuyoshi Nakada
3fafc549ba
Fix error when checking file modified with git-svn 2019-09-07 11:38:39 +09:00
Nobuyoshi Nakada
d783609ac3
Get rid of overwriting revision.h and creating .revision.time 2019-09-07 11:38:39 +09:00
Nobuyoshi Nakada
5118aa2d58
Use git describe --contains for tags 2019-09-07 11:38:38 +09:00
Nobuyoshi Nakada
3890c9eeee
Added more debug outputs from VCS::GIT 2019-09-07 11:38:38 +09:00
Nobuyoshi Nakada
71f7b0421a
Refined file2lastrev.rb options
* check --srcdir if given twice or more
* falls back to the current working directory if no --srcdir
  option is given.
* define common VCS options.
2019-09-07 11:38:38 +09:00
Nobuyoshi Nakada
799de9122e
Separated VCS.define_options for common VCS options 2019-09-07 11:38:38 +09:00
MSP-Greg
4068be1d9f appveyor.yml - msys2 update code
As AppVeyor's MSYS2 install gets out of date, this may require 'special' code...

This code also adds updating the database, which currently updates gcc from 9.1.0 to 9.2.0.
2019-09-07 10:48:40 +09:00
Yusuke Endoh
3bb3fa4051 eval.c (rb_rescue2): fix a probably wrong return
This return skips `va_end(ap)`, which is not intended, I guess.
Coverity Scan found this.
2019-09-07 09:20:27 +09:00
Takashi Kokubun
9c0626fa90
Upgrade benchmark-driver to v0.15.4
Fixing a bug on Windows introduced in v0.15.0
2019-09-07 09:14:33 +09:00
Jeremy Evans
258843106f Fix SortedSet subclasses that override initialize
The first time SortedSet#initialize is called, it overwrites
itself, then recalls #initialize, which results in calling the
subclass's initialize, not the current initialize.

Just inline the default initialize behavior to avoid this issue.

No test for this as it can only be triggered the very first time
that SortedSet#initialize is called.

Fixes [Bug #15830]
2019-09-06 14:20:22 -07:00
git
2d076dd5ac * 2019-09-07 [ci skip] 2019-09-07 00:45:44 +09:00
Takashi Kokubun
bb53ddfe0e
Upgrade benchmark-driver to v0.15.3
It got some nice features for better support of
benchmark_driver-output-charty, Windows, ridk, and rbenv.
2019-09-07 00:43:38 +09:00
Yusuke Endoh
ade1283ca2 Fix a use-after-free bug by avoiding rb_str_new_frozen
`str2 = rb_str_new_frozen(str1)` seems to make str1 a shared string that
refers to str2, but str2 is not marked as STR_IS_SHARED_M nor
STR_NOFREE.
`rb_fstring(str2)` frees str2's ptr because it is not marked, and the
free'ed pointer is the same as str1's ptr.
After that, accessing str1 may cause use-after-free memory corruption.

I guess this is a bug of rb_str_new_frozen, but I'm completely unsure
what it should be; the string states and flags are not documented.
So, this is a workaround for [Bug #16136].  I confirmed that rspec of
activeadmin runs gracefully.
2019-09-06 23:35:20 +09:00
Nobuyoshi Nakada
055b441093
VCS::GIT no longer accepts remote repository 2019-09-06 22:15:36 +09:00