[#83773] [Ruby trunk Bug#14108] Seg Fault with MinGW on svn 60769 — usa@...
Issue #14108 has been updated by usa (Usaku NAKAMURA).
9 messages
2017/11/15
[#83774] Re: [Ruby trunk Bug#14108] Seg Fault with MinGW on svn 60769
— Eric Wong <normalperson@...>
2017/11/15
usa@garbagecollect.jp wrote:
[#83775] Re: [Ruby trunk Bug#14108] Seg Fault with MinGW on svn 60769
— "U.NAKAMURA" <usa@...>
2017/11/15
Hi, Eric
[#83779] Re: [Ruby trunk Bug#14108] Seg Fault with MinGW on svn 60769
— Eric Wong <normalperson@...>
2017/11/15
"U.NAKAMURA" <usa@garbagecollect.jp> wrote:
[#83781] Re: [Ruby trunk Bug#14108] Seg Fault with MinGW on svn 60769
— "U.NAKAMURA" <usa@...>
2017/11/15
Hi, Eric,
[#83782] Re: [Ruby trunk Bug#14108] Seg Fault with MinGW on svn 60769
— Eric Wong <normalperson@...>
2017/11/15
"U.NAKAMURA" <usa@garbagecollect.jp> wrote:
[ruby-core:83813] [Ruby trunk Bug#14068] Unused refinement breaks method search
From:
shugo@...
Date:
2017-11-18 06:58:56 UTC
List:
ruby-core #83813
Issue #14068 has been updated by shugo (Shugo Maeda).
Assignee changed from shugo (Shugo Maeda) to ko1 (Koichi Sasada)
mame (Yusuke Endoh) wrote:
> But, defining UnusedRefinement that refines M2, breaks the behavior, even if it is entirely not used.
When a method is refined, a VM_METHOD_TYPE_REFINED entry is defined at the target module even if
the refinement is not used.
When the method is called, and if the refinement is not used in the scope, vm_call_method_each_type()
falls back to the following code:
```
no_refinement_dispatch:
if (cc->me->def->body.refined.orig_me) {
cc->me = refined_method_callable_without_refinement(cc->me);
}
else {
VALUE klass = RCLASS_SUPER(cc->me->owner);
cc->me = klass ? rb_callable_method_entry(klass, ci->mid) : NULL;
}
return vm_call_method(ec, cfp, calling, ci, cc);
}
```
However, cc-me->owner is not an iclass, but a module, so the method entry
is not found.
Is there any way to get an iclass here, ko1?
Otherwise, we may have to abandon refining modules....
----------------------------------------
Bug #14068: Unused refinement breaks method search
https://bugs.ruby-lang.org/issues/14068#change-67846
* Author: mame (Yusuke Endoh)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Target version: 2.5
* ruby -v: ruby 2.5.0dev (2017-10-30 trunk 60565) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
The following is an expected behavior.
~~~
module M1
def foo
p "M1#foo"
end
end
module M2
end
include M1
include M2
foo() #=> "M1#foo"
~~~
But, defining UnusedRefinement that refines M2, breaks the behavior, even if it is entirely not used.
~~~
module M1
def foo
p "M1#foo"
end
end
module M2
end
module UnusedRefinement # <=== INSERTED
refine(M2) do
def foo
p "M2#foo"
end
end
end
include M1
include M2
foo() #=> test.rb:20:in `<main>': undefined method `foo' for main:Object (NoMethodError)
~~~
--
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>