On Thu, Mar 22, 2012 at 11:14, Luuk van Dijk <lvd@golang.org> wrote: > cheapexpr is ...
12 years, 11 months ago
(2012-03-22 12:46:07 UTC)
#6
On Thu, Mar 22, 2012 at 11:14, Luuk van Dijk <lvd@golang.org> wrote:
> cheapexpr is supposed to be or quickly become a noop, the real fix should
> be in order.c, let me quickly try that
>
>
i was confused with safeexpr. that arguments are evaluated before the
start of the function is enforced by the way calls (and inlining) work so
this is a special case. here it should have been handled by the
walkexprlistsafe at line 2359, but safeexpr leaves n[i] alone if both n and
i are names or literals. so i think the clearer fix would be to add just
below that a comment+loop like
// walkexprlistsafe/safeexpr will leave OINDEX (s[n]) alone if
// both s and n are name or literal, but those may index the
// slice we're modifying here. Fix explicitly.
for (l = n->list; l; l = l->next)
l->n = cheapexpr(l->n, init);
...
> On Thu, Mar 22, 2012 at 03:18, <r@golang.org> wrote:
>
>> LGTM
>>
>>
http://codereview.appspot.com/**5876044/<http://codereview.appspot.com/5876044/>
>>
>
>
On Thu, Mar 22, 2012 at 13:46, Luuk van Dijk <lvd@golang.org> wrote: > > On ...
12 years, 11 months ago
(2012-03-22 12:54:48 UTC)
#7
On Thu, Mar 22, 2012 at 13:46, Luuk van Dijk <lvd@golang.org> wrote:
>
> On Thu, Mar 22, 2012 at 11:14, Luuk van Dijk <lvd@golang.org> wrote:
>
>> cheapexpr is supposed to be or quickly become a noop, the real fix should
>> be in order.c, let me quickly try that
>>
>>
> i was confused with safeexpr. that arguments are evaluated before the
> start of the function is enforced by the way calls (and inlining) work so
> this is a special case. here it should have been handled by the
> walkexprlistsafe at line 2359, but safeexpr leaves n[i] alone if both n and
> i are names or literals. so i think the clearer fix would be to add just
> below that a comment+loop like
>
> // walkexprlistsafe/safeexpr will leave OINDEX (s[n]) alone if
> // both s and n are name or literal, but those may index the
> // slice we're modifying here. Fix explicitly.
> for (l = n->list; l; l = l->next)
> l->n = cheapexpr(l->n, init);
>
>
LGTM either way. but at least a comment explaining why it's neccesary
would be nice.
> ...
>
>
>> On Thu, Mar 22, 2012 at 03:18, <r@golang.org> wrote:
>>
>>> LGTM
>>>
>>>
http://codereview.appspot.com/**5876044/<http://codereview.appspot.com/5876044/>
>>>
>>
>>
>
Brad Fitzpatrick <bradfitz@golang.org> writes: > s/along/alone/ typo > > also, why spaces around one the ...
12 years, 11 months ago
(2012-03-22 17:58:05 UTC)
#10
Brad Fitzpatrick <bradfitz@golang.org> writes:
> s/along/alone/ typo
>
> also, why spaces around one the = in one assignment but not the other
> assignment? I don't get this C style.
Sigh. I sent you a new CL.
Ian
Issue 5876044: code review 5876044: cmd/gc: when expanding append inline, preserve arguments
(Closed)
Created 12 years, 11 months ago by iant
Modified 12 years, 11 months ago
Reviewers: bradfitz, iant2, rsc
Base URL:
Comments: 0