This discussion seems to have died out.  Is this something which
should/will be fixed.  Should I open a bug ticket?

On Thu, Aug 27, 2009 at 12:53 PM, Yusuke ENDOH <mame / tsg.ne.jp> wrote:
> Hi,
>
> 2009/8/27 Rick DeNatale <rick.denatale / gmail.com>:
>> On Wed, Aug 26, 2009 at 7:25 PM, Yukihiro Matsumoto<matz / ruby-lang.org> =
wrote:
>>> Hi,
>>>
>>> In message "Re: [ruby-core:25143] Is this an intentional change in 1.9?=
"
>>> =A0 =A0on Thu, 27 Aug 2009 02:30:51 +0900, Rick DeNatale <rick.denatale=
@gmail.com> writes:
>>>
>>> |This seems like a 1.9 bug. Is it?
>>>
>>> I vaguely remember ko1 explained me about the change due to a YARV
>>> internal issue. =A0We have to wait ko1 to determine it's bug or not.
>>
>> I think it's a code generation issue, and also that it's important not
>> to change the semantics of a.x ||=3D value
>
>
> I agree. =A0I expected that `a.x ||=3D value' is equal to `a.x || a.x =3D=
 value',
> but 1.9 cheated on me.
>
>
> =A0a =3D Object.new
> =A0def a.foo; nil; end
> =A0def a.foo=3D(x); :boo; end
>
> =A0p(a.foo ||=3D :foo) =A0 =A0 =A0 =A0#=3D> :boo
> =A0p(a.foo || a.foo =3D :foo) #=3D> :foo
>
>
> Here is a patch. =A0When a.x returns nil or false, three more instruction=
s
> are executed than current implementation. =A0I have not measured actual
> impact of speed.
>
>
> Index: compile.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- compile.c =A0 (revision 24684)
> +++ compile.c =A0 (working copy)
> @@ -3842,22 +3842,26 @@
> =A0 =A0 =A0 =A0 =A0if lcfin =A0# r o
> =A0 =A0 =A0 =A0 =A0pop =A0 =A0 =A0 # r
> =A0 =A0 =A0 =A0 =A0eval v =A0 =A0# r v
> - =A0 =A0 =A0 =A0 send a=3D =A0 # v
> - =A0 =A0 =A0 =A0 jump lfin # v
> + =A0 =A0 =A0 =A0 swap =A0 =A0 =A0# v r
> + =A0 =A0 =A0 =A0 topn 1 =A0 =A0# v r v
> + =A0 =A0 =A0 =A0 send a=3D =A0 # v ?
> + =A0 =A0 =A0 =A0 jump lfin # v ?
>
> =A0 =A0 =A0 =A0 =A0lcfin: =A0 =A0 =A0# r o
> =A0 =A0 =A0 =A0 =A0swap =A0 =A0 =A0# o r
> +
> + =A0 =A0 =A0 =A0 lfin: =A0 =A0 =A0 # o ?
> =A0 =A0 =A0 =A0 =A0pop =A0 =A0 =A0 # o
>
> - =A0 =A0 =A0 =A0 lfin: =A0 =A0 =A0 # v
> -
> =A0 =A0 =A0 =A0 =A0# and
> =A0 =A0 =A0 =A0 =A0dup =A0 =A0 =A0 # r o o
> =A0 =A0 =A0 =A0 =A0unless lcfin
> =A0 =A0 =A0 =A0 =A0pop =A0 =A0 =A0 # r
> =A0 =A0 =A0 =A0 =A0eval v =A0 =A0# r v
> - =A0 =A0 =A0 =A0 send a=3D =A0 # v
> - =A0 =A0 =A0 =A0 jump lfin # v
> + =A0 =A0 =A0 =A0 swap =A0 =A0 =A0# v r
> + =A0 =A0 =A0 =A0 topn 1 =A0 =A0# v r v
> + =A0 =A0 =A0 =A0 send a=3D =A0 # v ?
> + =A0 =A0 =A0 =A0 jump lfin # v ?
>
> =A0 =A0 =A0 =A0 =A0# others
> =A0 =A0 =A0 =A0 =A0eval v =A0 =A0# r o v
> @@ -3881,15 +3885,17 @@
> =A0 =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0 =A0 =A0ADD_INSN(ret, nd_line(node), pop);
> =A0 =A0 =A0 =A0 =A0 =A0COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value);
> + =A0 =A0 =A0 =A0 =A0 ADD_INSN(ret, nd_line(node), swap);
> + =A0 =A0 =A0 =A0 =A0 ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1));
> =A0 =A0 =A0 =A0 =A0 =A0ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next-=
>nd_aid),
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 INT2FIX(1));
> =A0 =A0 =A0 =A0 =A0 =A0ADD_INSNL(ret, nd_line(node), jump, lfin);
>
> =A0 =A0 =A0 =A0 =A0 =A0ADD_LABEL(ret, lcfin);
> =A0 =A0 =A0 =A0 =A0 =A0ADD_INSN(ret, nd_line(node), swap);
> - =A0 =A0 =A0 =A0 =A0 ADD_INSN(ret, nd_line(node), pop);
>
> =A0 =A0 =A0 =A0 =A0 =A0ADD_LABEL(ret, lfin);
> + =A0 =A0 =A0 =A0 =A0 ADD_INSN(ret, nd_line(node), pop);
> =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0else {
> =A0 =A0 =A0 =A0 =A0 =A0COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value);
>
> --
> Yusuke ENDOH <mame / tsg.ne.jp>
>
>



--=20
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale