[#80531] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] — Eric Wong <normalperson@...>
SASADA Koichi <ko1@ruby-lang.org> wrote:
On 2017/04/02 11:35, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
Eric Wong <normalperson@yhbt.net> wrote:
On 2017/05/08 9:33, Eric Wong wrote:
On 2017/05/08 10:53, SASADA Koichi wrote:
SASADA Koichi <ko1@atdot.net> wrote:
On 2017/05/08 12:01, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
On 2017/05/08 15:36, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
On 2017/05/09 12:38, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
On 2017/05/09 14:12, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
On 2017/05/09 15:23, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
Thank you.
[#80763] [Ruby trunk Feature#13434] better method definition in C API — naruse@...
Issue #13434 has been updated by naruse (Yui NARUSE).
[#80844] [Ruby trunk Bug#13503] Improve performance of some Time & Rational methods — watson1978@...
Issue #13503 has been updated by watson1978 (Shizuo Fujita).
[#80892] [Ruby trunk Misc#13514] [PATCH] thread_pthread.c (native_sleep): preserve old unblock function — ko1@...
Issue #13514 has been updated by ko1 (Koichi Sasada).
ko1@atdot.net wrote:
On 2017/04/27 8:58, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
Eric Wong <normalperson@yhbt.net> wrote:
[ruby-core:80924] Ensuring a de-referenceable method definition
Hi Ruby-core: I was hoping someone familiar with
rb_callable_method_entry could help me figure out what the rules are
for de-referencing the contained rb_method_definition_struct 'def'.
I'm looking for a target instruction sequence to inline by peeking
inside of the CALL_CACHE. The pseudocode looks something like this:
```
CALL_CACHE cc = <load call cache>;
const rb_callable_method_entry_t *me = cc->me;
if(!me)
{
// abort
}
if (!me->def)
{
// abort
}
switch (METHOD_ENTRY_VISI(cc->me))
{
case METHOD_VISI_PUBLIC:
break; // OK for inlining.
case METHOD_VISI_PRIVATE:
if (ci->flag & VM_CALL_FCALL)
break; // Ok for inlining
default:
//abort
}
switch(me->def->type) // Crashes here de-referencing me->def
{
// ...
}
```
I'm missing some sort of safety check that's required to ensure
`me->def` is a valid pointer, but I've yet to quite put it all
together.
I've tried piecing a check together METHOD_ENTRY_BASIC and
METHOD_ENTRY_COMPLEMENTED, with no real luck.
Empirically, what I _have_ found is that should me->flags have its low
bit set (if (me->flags & 1), me->def isn't pointing to allocated
memory, however, it's not clear to me what this is actually saying, as
I'm not sure what those bits of the flags word are actually being used
for.
Any advice on what the actual checks are that one would need to make to
ensure I can look in `me->def`. I'm sure it's something simple, but I
have yet to be able to reverse engineer it, and probably would be better
to just ask.
Thanks so much,
-- Matthew
[1]: https://github.com/rubyomr-preview/ruby/issues/61
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>