> I tried converting some of the NodeList values into slices, but had trouble understanding how they are linked.
>
> I started with Dcl and InlDcl here but getting segfaults when starting to use the compiler to compile itself.
>
> I could send a (broken!) CL with that work if you are curious.
I started on this as well. You can see my flailing at
https://github.com/josharian/go/commits/wip/gc-remove-nodelist
(probably not a permanent URL, sorry).
The first few commits are stable (although they need rebasing and
cleanup); they remove specific quirky standalone uses in sinit.go,
esc.go, typecheck.go, order.go, etc. I'll probably mail those early in
the Go 1.6 cycle.
Then I added methods to NodeList to capture common things that get
done with them and changed all uses of NodeList to use those methods.
I then changed NodeList to be []*Node and re-implemented the methods.
It was never going to be a real fix, but I was curious about the
performance impact.
It didn't work and I eventually gave up. However, it illustrated that
there's some hidden complexity there. For example, that "Poison
pointer" bit in list1 is not just an optimization, it is currently
required for correctness. And it took me a long time to figure out how
to rewrite the code in order.go so that it made sense.
> It will get rid of a lot of Next fields in many places.
True, and even more importantly, it would make the code much more
readable. However, the goal of this original email is to make the Node
and Prog structs smaller. NodeLists don't contribute much to the
overall memory usage of the compiler, even though they do account for
a non-trivial percentage of its allocations.
-josh