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

49439 Коммитов

Автор SHA1 Сообщение Дата
hsbt 2701001b2f Fix a typo.
* win32/win32.c: wrok -> work

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 10:09:00 +00:00
mame 4d073d5377 parse.y: Removes unreachable warnings
tIDENTIFIER is now always a local id (except fname).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 08:54:25 +00:00
mame 6bdd198937 parse.y: Removes unneeded NULL checks
Nowadays, there are less rules whose return value is NULL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 08:54:24 +00:00
mame 84cf66cc6e parse.y: Remove unneeded NULL check
There are many usages assuming that bodystmt always returns non-null.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 07:54:24 +00:00
mame 8ac73660bc parse.y (last_arg_append, rest_arg_append): factor out the code clones
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 07:39:47 +00:00
shyouhei 194d4e99ad __declspec(align(#)) does not take sizeof()
same as r61833


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 07:32:48 +00:00
shyouhei 8a52dbdb2a ruby_aligned_char no longer needed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 07:30:43 +00:00
nobu 995717e15c raddrinfo.c: fix parse_numeric_port
* ext/socket/raddrinfo.c (parse_numeric_port): necessary
  regardless of GETADDRINFO_EMU.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 07:01:08 +00:00
shyouhei 8699a7a006 take alignof instead of sizeof
win32ole.c includes ALLOCA_N(struct myCPINFOEX, 1).  On such case
it is not a wise idea to align to the size of that struct.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 06:47:56 +00:00
mame 7c088b9662 parse.y (new_ary_op_assign): Factor out the typical code clone
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 06:25:43 +00:00
mame c2052b027c parse.y: Fix a bug of `obj[42, &blk] ||= foo bar`
Follow up of r28123 (!)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 06:25:42 +00:00
mame 53c6960ddf parse.y (begin_block): Factor out BEGIN {} process.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 06:25:41 +00:00
shyouhei 369aca64cf also blacklist gcc 4.9 for __builtin_alloca_with_align
Reports show that gcc (Raspbian 4.9.2-10) 4.9.2 fails here.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 05:51:46 +00:00
nobu 55af62599a tool/ruby_vm/models/attribute.rb: void for empty arguments
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 05:27:11 +00:00
mame 52a5f76e8b parse.y: Remove unused code comment blocks
The code fragments were commented out in YARV merge era.
I believe that it will be never needed in near future.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 05:17:18 +00:00
shyouhei 39ee36f63d disable __builtin_alloca_with_align for GCC 4.8
It seems to be a false positive that the configure detects this
undocumented function to be available on the compiler.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 04:36:09 +00:00
shyouhei e41b4a45a4 give up RSTRING_PTR() being VALUE-aligned
rb_setup_fake_str() can take arbitrary char* address, typicalluy
C string literals.  These arguments have no guarantee of
alignment at all.  It was not a wise idea for me to think
RSTRING_PTR can be aligned.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 04:36:09 +00:00
shyouhei bca40b8b56 sorry, this hunk was a garbage. [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 04:36:08 +00:00
shyouhei cabc3b6516 __declspec(align(#)) does not take sizeof()
Use compile-time constant expression instead.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:59:18 +00:00
nobu 65236c069e more ytab.sed fixes
* tool/ytab.sed: fix for more old bison which does not support %lex-param
  at yydestruct (missed at the previous commit).
  define yy_stack_print macro to add `p` argument instead of
  replacement at callers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:39:32 +00:00
shyouhei 8f745a2fab more support for NORETURN
Before this NORETURN was checked only for __attribute__ or __declspec,
but nowadays other ways are there to tell compilers that a function
never returns.  Take them into account.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:35:20 +00:00
shyouhei df9a70900a __builtin_alloca_with_align for optimal memory access
ALLOCA_N takes type arugment.  It is natural that the returned
value to be used as an array of type, thus type-aligned.
Luckily GCC has a builtin to tell compiler such alignment info.
This should generate beter instructions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:35:19 +00:00
shyouhei 39cfa67b4f __builtin_assume_aligned for *(foo *) casts
These casts are guarded. Must be safe to assume alignments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:35:18 +00:00
shyouhei 21429b1488 __alignof__ to take alignment of a type
C11 and C++11 has this feature so why not use it when available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:35:17 +00:00
shyouhei f089a52865 __attibute__((__aligned__)) for RSTRING_PTR()
For instance array.c:rb_ary_product() uses RSTRING_PTR() as an
array of int. So to avoid misaligned memory access RSTRING_PTR()
must at least be sizeof(int)-aligned.  However the type of
RSTRING_PTR() is char*, which of course can expect alignment as
much as 1.  This is a problem.

The reality is, there is no misaligned memory access because the
memory region behind RSTRING_PTR() is allocated using malloc().
Memory regions returned from malloc() are always aligned
appropriately.  So let's tell the compiler about this information.
It seems GCC, clang, and MSVC have such feature.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:35:16 +00:00
nobu 630ab3b925 more ytab.sed fixes
* tool/ytab.sed: `p` is too short to distinguish alone from other
  names.  fix for more old bison which does not support %lex-param
  at yydestruct.  add `p` argument to non-prototype declaration of
  yy_stack_print.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 02:23:24 +00:00
svn 5f3ddb32c7 * 2018-01-15
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 00:45:26 +00:00
mame 4cc9894845 tool/ytab.sed: Support some old bison implementations
At least, I confirmed bison 2.3 (because macOS uses the version).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 00:45:26 +00:00
mame 5c0748b627 parse.y (parser_heredoc_dedent): Removed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 14:44:46 +00:00
nobu 07d356ee28 parse.y: yydebug
* parse.y (yydebug): define to disable a global variable and get
  rid of linker error when static linked ext.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 14:28:10 +00:00
mame a9f2596336 parse.y: Remove unused a macro "FIXME"
I don't know what it was, but seems that it has been already fixed since
r12117.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 14:17:25 +00:00
nobu 99e52bcd8e parse.y: ripper no longer uses rb_discard_node
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 14:14:51 +00:00
mame 269856a4a1 parse.y: Remove a code for old yacc
The current parse.y won't compile with yacc since it depends on many
bison's extensions.  Also, configure.ac does not have a check for yacc,
so the macro OLD_YACC is no longer used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 14:09:41 +00:00
mame 15352965c2 parse.y: Remove almost all *_gen macros by passing parser_params explicitly
In parse.y many functions were suffixed "_gen" and had companion macros
to pass struct parser_params implicitly, which made parse.c bigger and
more obscure.

This change expands and removes almost all "*_gen" macros.  This
requires explicit passing of struct parser_params, i.e., we need to
write "foo(p, ..)" instead of "foo(..)".  However, it is just extra
three letters.  I believe that this is easier to understand.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 13:51:44 +00:00
mame 97b9899924 parse.y: Expand global-like accessor macros for struct parser_params
For example, `lex_strterm` is expanded to `p->lex.strterm`.
I believe that this expansion make the code straightforward.
They look not so annoying because "parser" was renamed to "p".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 13:51:41 +00:00
mame 14be478d88 parse.y: Use "p" for the variable of struct parser_params consistently
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 13:51:38 +00:00
mame ca6e1620bd parse.y: Avoid "p" as a variable name
Because I want to use the name "p" for struct parser_params through
parse.c.  This change renames "p" to "ptr", "paren", etc. depending upon
the context.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 13:51:35 +00:00
nobu 6b5e0bd98c exclude flexible array size with old compilers
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 11:19:18 +00:00
svn bbea027027 * 2018-01-14
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 02:44:54 +00:00
normal 7db24a6269 net/http: use writev for HTTP chunked request bodies
This reduces both user and system CPU time for large
uploads with dynamically-generated request bodies.

              user     system      total        real
before:   0.393334   1.580000   1.973334 (  1.971066)
after:    0.223334   0.976666   1.200000 (  1.198514)

------
require 'socket'
require 'net/http'
require 'benchmark'
nr = 1024 * 1024 * 1024
s = TCPServer.new('127.0.0.1', 0)
addr = s.addr
at_exit { Process.waitall }
fork do
  c = s.accept
  # not exactly accurate but fast
  IO.copy_stream(c, '/dev/null', nr + 500000)
  begin
    buf = c.readpartial(16384)
    tmp = ''
    until buf.end_with?(-"0\r\n\r\n")
      buf << c.readpartial(16384, tmp)
    end
  rescue EOFError
  end
  c.write "HTTP/1.1 201 Created\r\nConnection:close\r\n\r\n"
  c.close
end
r, w = IO.pipe
fork do
  r.close
  IO.copy_stream('/dev/zero', w, nr)
  w.close
end
w.close
Net::HTTP.start(addr[3], addr[1]) do |http|
  put = Net::HTTP::Put.new('/dev0/foo')
  put['Content-Type'] = 'application/content-type'
  put['Transfer-Encoding'] = 'chunked'
  put.body_stream = r
  puts(Benchmark.measure { http.request(put) })
end
------

* lib/net/http/generic_request.rb (write): use multi-arg write
* lib/net/protocol.rb (write): support multi-arg
  (write0): ditto
  [ruby-core:84845] [Feature #14339]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-14 02:44:53 +00:00
mame 982e9e6235 string.c (struct mapping_buffer): Use FLEX_ARY_LEN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 13:08:05 +00:00
mame c33ba4a67e compile.c (struct ibf_object_*): Use FLEX_ARY_LEN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 13:00:14 +00:00
mame fb4b6f70b7 compile.c (struct ibf_id_entry): Just removed.
It looked unused.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 13:00:11 +00:00
mame 7ad9975fe7 iseq.h (struct iseq_catch_table_entry, iseq_compile_data_storage): Use FLEX_ARY_LEN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 12:44:17 +00:00
mame 879df66d96 file.c (struct apply_arg): Use FLEX_ARY_LEN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 12:25:15 +00:00
mame ccc5c73258 variable.c (struct gen_ivtbl): Use FLEX_ARY_LEN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 12:17:42 +00:00
mame 2768bae806 node.c (node_buffer_elem_t): Use FLEX_ARY_LEN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 12:09:24 +00:00
mame 7da7716159 internal.h (FLEX_ARY_LEN): Add a macro to define a flexible array
Also, use it in iseq.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 11:45:25 +00:00
hsbt afcd060a92 Fix a typo.
configure.ac: delcares -> declares.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 11:10:08 +00:00
shyouhei 90cb7d3048 __VA_ARGS__ is a C99ism
give up CALL_ATTRIBUTE macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-13 10:47:33 +00:00