>> it's == it is >> you mean its > > yes. non-native speakers make ...
13 years, 9 months ago
(2011-07-01 17:49:47 UTC)
#3
>> it's == it is
>> you mean its
>
> yes. non-native speakers make that mistake a lot.
native ones too.
> hate to have confusion with escaping of strings ets. escapanalyze(),
> how's that.
escapes
?
On Fri, Jul 1, 2011 at 19:49, Russ Cox <rsc@golang.org> wrote: >>> it's == it ...
13 years, 9 months ago
(2011-07-01 17:53:00 UTC)
#4
On Fri, Jul 1, 2011 at 19:49, Russ Cox <rsc@golang.org> wrote:
>>> it's == it is
>>> you mean its
>>
>> yes. non-native speakers make that mistake a lot.
>
> native ones too.
>
>> hate to have confusion with escaping of strings ets. escapanalyze(),
>> how's that.
>
> escapes
escapes it be.
> ?
>
still in progress but addressed what you commented so far http://codereview.appspot.com/4634073/diff/9022/src/cmd/gc/esc.c File src/cmd/gc/esc.c (right): http://codereview.appspot.com/4634073/diff/9022/src/cmd/gc/esc.c#newcode18 ...
13 years, 8 months ago
(2011-07-04 11:33:49 UTC)
#5
> no it makes sense, see line 1197: this is the way to say that ...
13 years, 8 months ago
(2011-07-15 15:47:30 UTC)
#9
> no it makes sense, see line 1197: this is the way to say that arguments
> to built-in print are safe pre esc.c, i.e. print(&x) should not force x
> to be heapalloced.
oh. that's an interesting change.
I uploaded a new version of the 'complex' CL, which i think is actually correct, ...
13 years, 8 months ago
(2011-07-18 14:32:10 UTC)
#11
I uploaded a new version of the 'complex' CL, which i think is actually
correct, even though it's still a bit more conservative at some points than
it needs to be, but at least it's correct in the sense that
bytes.Buffer.Bytes() is actually flagged as unsafe as it really is.
This is for the '-s' mode, not '-ss', which is supposed to do full alias
analysis.
I'm still looking to see if the 'simple' version you proposed is actually
going to end up being simpler, but before that i'm first adding a directory
test/esc and a facility to check the output of $(GC) -m for the cases in
there.
On Fri, Jul 15, 2011 at 16:16, <lvd@google.com> wrote:
> addressed your comments.
>
> trying the More Simple version in a separate client, pls hold off review
> for a bit.
>
>
>
>
http://codereview.appspot.com/**4634073/diff/39009/src/cmd/gc/**gen.c<http://...
> File src/cmd/gc/gen.c (right):
>
> http://codereview.appspot.com/**4634073/diff/39009/src/cmd/gc/**
>
gen.c#newcode91<http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/gen.c#newcode91>
> src/cmd/gc/gen.c:91: if (n == nodfp)
> On 2011/07/14 00:39:57, rsc wrote:
>
>> please ,s/if (/if(/g
>> in all files
>>
>
> Done.
>
>
> http://codereview.appspot.com/**4634073/diff/39009/src/cmd/gc/**
>
gen.c#newcode121<http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/gen.c#newcode121>
> src/cmd/gc/gen.c:121: n->xoffset = 0;
> On 2011/07/14 00:39:57, rsc wrote:
>
>> can delete
>>
>
> Done.
>
>
>
http://codereview.appspot.com/**4634073/diff/39009/src/cmd/gc/**go.h<http://c...
> File src/cmd/gc/go.h (right):
>
> http://codereview.appspot.com/**4634073/diff/39009/src/cmd/gc/**
>
go.h#newcode258<http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/go.h#newcode258>
> src/cmd/gc/go.h:258: Type* paramfld; // TField for this PPARAM
> On 2011/07/14 00:39:57, rsc wrote:
>
>> TFIELD
>>
>
> Done.
>
>
> http://codereview.appspot.com/**4634073/diff/39009/src/cmd/gc/**
>
go.h#newcode273<http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/go.h#newcode273>
> src/cmd/gc/go.h:273: NodeList* asrc; // flow(this, src)
> On 2011/07/14 00:39:57, rsc wrote:
>
>> comefrom?
>>
>
> sounds a bit intercal. it was for 'Assignment SouRCe. how about
> flowsrc?
>
>
> http://codereview.appspot.com/**4634073/diff/39009/src/cmd/gc/**
>
typecheck.c<http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/typecheck.c>
> File src/cmd/gc/typecheck.c (right):
>
> http://codereview.appspot.com/**4634073/diff/39009/src/cmd/gc/**
>
typecheck.c#newcode527<http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/typecheck.c#newcode527>
> src/cmd/gc/typecheck.c:527: // top&Eindir means this is &x in *&x. (or
> the arg to built-in print)
> On 2011/07/14 00:39:57, rsc wrote:
>
>> "or the arg to built-in print". huh? really?
>> that would be a mistake.
>>
>
> no it makes sense, see line 1197: this is the way to say that arguments
> to built-in print are safe pre esc.c, i.e. print(&x) should not force x
> to be heapalloced.
>
>
> http://codereview.appspot.com/**4634073/diff/39009/src/cmd/gc/**
>
typecheck.c#newcode1603<http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/typecheck.c#newcode1603>
> src/cmd/gc/typecheck.c:1603: if (!debug['s']) addrescapes(n->left);
> On 2011/07/14 00:39:57, rsc wrote:
>
>> 2 lines
>>
>
> Done.
>
>
>
http://codereview.appspot.com/**4634073/<http://codereview.appspot.com/4634073/>
>
i will wait for the simple version. it would be much better to write the ...
13 years, 8 months ago
(2011-07-19 14:15:12 UTC)
#12
i will wait for the simple version.
it would be much better to write the test cases without -m.
otherwise they apply only to a single version of the
compiler and can't be shared, for example, with gccgo.
test/escape.go manages to be generic.
On Mon, Jul 18, 2011 at 10:32, Luuk van Dijk <lvd@google.com> wrote:
> I uploaded a new version of the 'complex' CL, which i think is actually
> correct, even though it's still a bit more conservative at some points than
> it needs to be, but at least it's correct in the sense that
> bytes.Buffer.Bytes() is actually flagged as unsafe as it really is.
> This is for the '-s' mode, not '-ss', which is supposed to do full alias
> analysis.
>
> I'm still looking to see if the 'simple' version you proposed is actually
> going to end up being simpler, but before that i'm first adding a directory
> test/esc and a facility to check the output of $(GC) -m for the cases in
> there.
> On Fri, Jul 15, 2011 at 16:16, <lvd@google.com> wrote:
>>
>> addressed your comments.
>>
>> trying the More Simple version in a separate client, pls hold off review
>> for a bit.
>>
>>
>> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/gen.c
>> File src/cmd/gc/gen.c (right):
>>
>>
>> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/gen.c#newcode91
>> src/cmd/gc/gen.c:91: if (n == nodfp)
>> On 2011/07/14 00:39:57, rsc wrote:
>>>
>>> please ,s/if (/if(/g
>>> in all files
>>
>> Done.
>>
>>
>> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/gen.c#newcode121
>> src/cmd/gc/gen.c:121: n->xoffset = 0;
>> On 2011/07/14 00:39:57, rsc wrote:
>>>
>>> can delete
>>
>> Done.
>>
>> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/go.h
>> File src/cmd/gc/go.h (right):
>>
>>
>> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/go.h#newcode258
>> src/cmd/gc/go.h:258: Type* paramfld; // TField for this PPARAM
>> On 2011/07/14 00:39:57, rsc wrote:
>>>
>>> TFIELD
>>
>> Done.
>>
>>
>> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/go.h#newcode273
>> src/cmd/gc/go.h:273: NodeList* asrc; // flow(this, src)
>> On 2011/07/14 00:39:57, rsc wrote:
>>>
>>> comefrom?
>>
>> sounds a bit intercal. it was for 'Assignment SouRCe. how about
>> flowsrc?
>>
>> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/typecheck.c
>> File src/cmd/gc/typecheck.c (right):
>>
>>
>>
http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/typecheck.c#newco...
>> src/cmd/gc/typecheck.c:527: // top&Eindir means this is &x in *&x. (or
>> the arg to built-in print)
>> On 2011/07/14 00:39:57, rsc wrote:
>>>
>>> "or the arg to built-in print". huh? really?
>>> that would be a mistake.
>>
>> no it makes sense, see line 1197: this is the way to say that arguments
>> to built-in print are safe pre esc.c, i.e. print(&x) should not force x
>> to be heapalloced.
>>
>>
>>
http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/typecheck.c#newco...
>> src/cmd/gc/typecheck.c:1603: if (!debug['s']) addrescapes(n->left);
>> On 2011/07/14 00:39:57, rsc wrote:
>>>
>>> 2 lines
>>
>> Done.
>>
>> http://codereview.appspot.com/4634073/
>
>
On Tue, Jul 19, 2011 at 16:15, Russ Cox <rsc@golang.org> wrote: > i will wait ...
13 years, 8 months ago
(2011-07-19 14:33:28 UTC)
#13
On Tue, Jul 19, 2011 at 16:15, Russ Cox <rsc@golang.org> wrote:
> i will wait for the simple version.
>
won't be /much/ simpler
> it would be much better to write the test cases without -m.
> otherwise they apply only to a single version of the
> compiler and can't be shared, for example, with gccgo.
> test/escape.go manages to be generic.
>
but not very specific and it makes the tests spun out over a lot of places.
I'd like to be able to write a 3 line function to check that some basic
case behaves as expected, and check not just calls to escapes() but also the
tagging of the parameters with noflow. I'm open to suggestions.
btw bytes.String() is now (correctly) safe, b/c OARRAYBYTESTR and friends
are actually safe. uploaded a last patchset for that.
>
> On Mon, Jul 18, 2011 at 10:32, Luuk van Dijk <lvd@google.com> wrote:
> > I uploaded a new version of the 'complex' CL, which i think is actually
> > correct, even though it's still a bit more conservative at some points
> than
> > it needs to be, but at least it's correct in the sense that
> > bytes.Buffer.Bytes() is actually flagged as unsafe as it really is.
> > This is for the '-s' mode, not '-ss', which is supposed to do full alias
> > analysis.
> >
> > I'm still looking to see if the 'simple' version you proposed is actually
> > going to end up being simpler, but before that i'm first adding a
> directory
> > test/esc and a facility to check the output of $(GC) -m for the cases in
> > there.
> > On Fri, Jul 15, 2011 at 16:16, <lvd@google.com> wrote:
> >>
> >> addressed your comments.
> >>
> >> trying the More Simple version in a separate client, pls hold off review
> >> for a bit.
> >>
> >>
> >> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/gen.c
> >> File src/cmd/gc/gen.c (right):
> >>
> >>
> >>
> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/gen.c#newcode91
> >> src/cmd/gc/gen.c:91: if (n == nodfp)
> >> On 2011/07/14 00:39:57, rsc wrote:
> >>>
> >>> please ,s/if (/if(/g
> >>> in all files
> >>
> >> Done.
> >>
> >>
> >>
> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/gen.c#newcode121
> >> src/cmd/gc/gen.c:121: n->xoffset = 0;
> >> On 2011/07/14 00:39:57, rsc wrote:
> >>>
> >>> can delete
> >>
> >> Done.
> >>
> >> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/go.h
> >> File src/cmd/gc/go.h (right):
> >>
> >>
> >>
> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/go.h#newcode258
> >> src/cmd/gc/go.h:258: Type* paramfld; // TField for this PPARAM
> >> On 2011/07/14 00:39:57, rsc wrote:
> >>>
> >>> TFIELD
> >>
> >> Done.
> >>
> >>
> >>
> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/go.h#newcode273
> >> src/cmd/gc/go.h:273: NodeList* asrc; // flow(this, src)
> >> On 2011/07/14 00:39:57, rsc wrote:
> >>>
> >>> comefrom?
> >>
> >> sounds a bit intercal. it was for 'Assignment SouRCe. how about
> >> flowsrc?
> >>
> >> http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/typecheck.c
> >> File src/cmd/gc/typecheck.c (right):
> >>
> >>
> >>
>
http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/typecheck.c#newco...
> >> src/cmd/gc/typecheck.c:527: // top&Eindir means this is &x in *&x. (or
> >> the arg to built-in print)
> >> On 2011/07/14 00:39:57, rsc wrote:
> >>>
> >>> "or the arg to built-in print". huh? really?
> >>> that would be a mistake.
> >>
> >> no it makes sense, see line 1197: this is the way to say that arguments
> >> to built-in print are safe pre esc.c, i.e. print(&x) should not force x
> >> to be heapalloced.
> >>
> >>
> >>
>
http://codereview.appspot.com/4634073/diff/39009/src/cmd/gc/typecheck.c#newco...
> >> src/cmd/gc/typecheck.c:1603: if (!debug['s']) addrescapes(n->left);
> >> On 2011/07/14 00:39:57, rsc wrote:
> >>>
> >>> 2 lines
> >>
> >> Done.
> >>
> >> http://codereview.appspot.com/4634073/
> >
> >
>
notes from lvd: so the basic simplification is: anything on the lhs of an assignment ...
13 years, 8 months ago
(2011-07-26 15:53:51 UTC)
#14
notes from lvd:
so the basic simplification is:
anything on the lhs of an assignment that isnt a NAME becomes &theSink
and no more bother with derefdepth()
which was the number of '*''s in the type name basically
i did spend a couple of days trying to get that to work too
but there be dragons
although now i know where they are
i can think of a way around them
there are still tons of print statements conveniently commented out, esp if you
want to know what goes on in finding the function argument nodes/types
and i recommen drunning with -mmmmmm on a simple 3 line program to get a feel
the testsuite is a mess, i'll clean that up later
basically for every case bumped into i made a 4 line x.go
PTAL. at last a version again that builds the tree and passes all tests, including ...
13 years, 7 months ago
(2011-08-22 14:10:56 UTC)
#20
PTAL.
at last a version again that builds the tree and passes all tests, including
the ones in escape2.go.
I did not merge the big switch, instead focussed on getting the
escflood/walk right, with he handling of loop scopes. For that i needed to
trust the flow graph, which i did in 'my' version.
Once this is in, i'll be happy to re-try to simplify escstmt/escexpr.
/L
On Fri, Aug 5, 2011 at 22:55, <lvd@google.com> wrote:
> Hello rsc@golang.org, rogpeppe@gmail.com (cc:
> golang-dev@googlegroups.com),
>
> Please take another look.
>
>
>
>
http://codereview.appspot.com/**4634073/<http://codereview.appspot.com/4634073/>
>
On Mon, Aug 22, 2011 at 16:10, Luuk van Dijk <lvd@google.com> wrote: > PTAL. > ...
13 years, 7 months ago
(2011-08-22 14:16:52 UTC)
#21
On Mon, Aug 22, 2011 at 16:10, Luuk van Dijk <lvd@google.com> wrote:
> PTAL.
>
> at last a version again that builds the tree and passes all tests,
> including the ones in escape2.go.
>
woops. that was b/c i forgot to un-comment-out the switching on part. hold
horses.
>
> I did not merge the big switch, instead focussed on getting the
> escflood/walk right, with he handling of loop scopes. For that i needed to
> trust the flow graph, which i did in 'my' version.
>
> Once this is in, i'll be happy to re-try to simplify escstmt/escexpr.
>
> /L
>
>
> On Fri, Aug 5, 2011 at 22:55, <lvd@google.com> wrote:
>
>> Hello rsc@golang.org, rogpeppe@gmail.com (cc:
>> golang-dev@googlegroups.com),
>>
>> Please take another look.
>>
>>
>>
>>
http://codereview.appspot.com/**4634073/<http://codereview.appspot.com/4634073/>
>>
>
>
> > > > Please take another look. > > > http://codereview.appspot.com/**4634073/<http://codereview.appspot.com/4634073/> > The closure ...
13 years, 7 months ago
(2011-08-24 11:27:00 UTC)
#23
>
>
>
> Please take another look.
>
>
>
http://codereview.appspot.com/**4634073/<http://codereview.appspot.com/4634073/>
>
The closure variables are now handled way at the top again, by introducing
an edge from the closure to a fake addr of the cvars' target, mimicing
exactly the assignment walk is going to to later, and completely natural if
you think of a closure object as the struct that runtime.closure generates
for you. that makes escwalk very simple now.
i regrouped the cases in both switches to common effects, and lumped all the
trivial ones into the default, and took out the diagnostic for 'unhandled
cases'. that makes expr much shorter.
after much soulsearching and some attempts to get started i ended up *not*
merge escstmt and escexpr, because
a) i think it's not subtle or complicated, or at least not more than your
unified one, but that could be because i looked at this for months now.
probably related, i didn't see a clear path of least resistance transforming
the code from this state to the other one without losing track of introduced
bugs. I would be fine with checking this in and then you reorganizing it.
otoh, i dont think it solves a problem and i'd also be more comfortable i
think to work on it the way it is.
btw, i also ran make test in the old exp/go/eval, which caught more bugs
(namely all) than all of the rest of the tree (almost zero) while i worked
on removing the closure and paramref cases from escwalk.
i left the diagnostic edgecount and dstcount in but commented out. useful
if you want to know why pkg/go/printer takes so long.
What would be a benchmark where we could see the effect of all this in Real
Life?
/L
mostly done except the hotly disputed one :-) testing one more time before submitting http://codereview.appspot.com/4634073/diff/100013/src/cmd/gc/dcl.c ...
13 years, 7 months ago
(2011-08-24 16:51:40 UTC)
#26
Issue 4634073: code review 4634073: gc: Escape analysis.
(Closed)
Created 13 years, 9 months ago by lvd
Modified 13 years, 7 months ago
Reviewers: kevlar
Base URL:
Comments: 132