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
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
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
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
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
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
* 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
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
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
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
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
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
* 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
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
* 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
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
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
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
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
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
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