[#81492] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — normalperson@...
Issue #13618 has been reported by normalperson (Eric Wong).
12 messages
2017/06/01
[#88695] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/08/27
> https://bugs.ruby-lang.org/issues/13618
[#81569] [Ruby trunk Feature#12589] VM performance improvement proposal — vmakarov@...
Issue #12589 has been updated by vmakarov (Vladimir Makarov).
3 messages
2017/06/04
[#81581] [Ruby trunk Bug#13632] Not processable interrupt queue for a thread after it's notified that FD is closed in some other thread. — sir.nickolas@...
Issue #13632 has been reported by nvashchenko (Nikolay Vashchenko).
4 messages
2017/06/05
[#81590] Re: [ruby-cvs:66197] ko1:r59023 (trunk): revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures. — Eric Wong <normalperson@...>
ko1@ruby-lang.org wrote:
5 messages
2017/06/06
[#81591] Re: [ruby-cvs:66197] ko1:r59023 (trunk): revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures.
— Eric Wong <normalperson@...>
2017/06/06
Eric Wong <normalperson@yhbt.net> wrote:
[#81596] Re: [ruby-cvs:66203] Re: Re: ko1:r59023 (trunk): revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures.
— Eric Wong <normalperson@...>
2017/06/06
Eric Wong <normalperson@yhbt.net> wrote:
[#81825] [Ruby trunk Feature#13697] [PATCH]: futex based thread primitives — normalperson@...
Issue #13697 has been reported by normalperson (Eric Wong).
3 messages
2017/06/29
[ruby-core:81709] [Ruby trunk Feature#13434] better method definition in C API
From:
nobu@...
Date:
2017-06-16 09:01:23 UTC
List:
ruby-core #81709
Issue #13434 has been updated by nobu (Nobuyoshi Nakada).
I don't like "mini-language" which needs a parser.
----------------------------------------
Feature #13434: better method definition in C API
https://bugs.ruby-lang.org/issues/13434#change-65405
* Author: normalperson (Eric Wong)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Current ways to define and parse arguments in the Ruby C API are clumsy,
slow, and impede potential optimizations.
The current C API for defining (rb_define_{singleton_}, method),
and parsing (rb_scan_args, rb_get_kwargs) is orthogonal but inefficient.
rb_get_kwargs creates garbage which pure Ruby kwarg methods do not.
[Feature #11339] was an ugly workaround to use Ruby wrapper methods
for IO#*nonblock methods to avoid garbage from rb_get_kwargs.
Furthermore, it should be possible to annotate args for C functions as
"read-only, use-once" or similar. In other words, it should be possible to
implement my idea from [ruby-core:80626] where method lookup can be done
out-of-order in some cases, and allow optimizations such as replacing
"putstring" insns with garbage-free "putobject" insns for constants strings
without introducing backwards incompatibility for Rubyists.
We can also get rid of the limited basic op redefinition checks and
implement more generic versions of opt_aref_with / opt_aset_with
for more functions that can take frozen string args.
The "read-only, use-once" annotation can even make it safe for
a dynamic strings to be immediately recycled to reduce garbage.
So we could annotate "puts" and IO#write in a way that causes the VM to
immediately recycle its argument if it's a dynamically-generated string:
puts "#{dynamic} #{string(:here)}"
I am not good at API design; so I'm not sure what it should look like.
Perhaps sendmsg_nonblock may be implemented like:
```
struct rb_method_info {
/* to be filled in by rb_def_method ... */
};
static VALUE
sendmsg_nonblock(struct rb_method_info *info, int argc, VALUE *argv, VALUE self)
{
VALUE mesg, flags, dest_sockaddr, control, exception;
rb_get_args(info, argc, argv,
&mesg, &flags, &dest_sockaddr, &control, &exception);
...
}
/*
* ALLCAPS variable names mean read-only (like "constants" in Ruby)
* "1" prefix means use only once, eligible for immediately recycle
* if dynamic string
*/
rb_def_method(rb_cBasickSocket, sendmsg_nonblock,
"sendmsg_nonblock(1MESG "
"1FLAGS = 0), "
"1DEST_SOCKADDR = nil), "
"*1CONTROL, exception: true)", -1);
/* rb_hash_aset can be done as:
* where 0KEY (not "1" prefix) means it is constant and persistent,
* and "val" (all lower case, no prefix) means it is a normal
* variable which can persistent after the function returns
*/
rb_def_method(rb_Hash, rb_hash_aset, "[0KEY]=val", 2);
```
Thoughts?
The existing C API must continue to work, so 3rd-party extensions can
migrate to the new API slowly.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>